diff --git a/test/builtinDetectors.spec.ts b/test/builtinDetectors.spec.ts index 5f6a265f..9de60b7f 100644 --- a/test/builtinDetectors.spec.ts +++ b/test/builtinDetectors.spec.ts @@ -1,28 +1,20 @@ -import fs from "fs"; -import path from "path"; import { exec } from "child_process"; import { describe, it } from "@jest/globals"; - -import { - generateConfig, - TAP, - processTactFiles, - CONTRACTS_DIR, -} from "./testUtil"; +import { TAP, processTactFiles, CONTRACTS_DIR } from "./testUtil"; +import fs from "fs"; +import path from "path"; processTactFiles(CONTRACTS_DIR, (file) => { const contractName = file.replace(".tact", ""); const actualSuffix = "actual.out"; describe(`Testing built-in detectors for ${contractName}`, () => { it(`should generate the expected warnings for ${contractName}`, async () => { - const configPath = await generateConfig(contractName); - // Run the driver and save results to the file. const outputFilePath = path.join( CONTRACTS_DIR, `${contractName}.${actualSuffix}`, ); - const runCommand = `node dist/src/main.js ${configPath}`; + const runCommand = `node dist/src/main.js ${path.join(CONTRACTS_DIR, file)}`; await new Promise((resolve, reject) => { exec(runCommand, (error, stdout, stderr) => { const out = stdout.trim() + stderr.trim(); diff --git a/test/tactIR.spec.ts b/test/tactIR.spec.ts index 7b0574ff..1200c542 100644 --- a/test/tactIR.spec.ts +++ b/test/tactIR.spec.ts @@ -1,19 +1,13 @@ import { run } from "../src/driver"; import { describe, it } from "@jest/globals"; - -import { - generateConfig, - TAP, - processTactFiles, - CONTRACTS_DIR, -} from "./testUtil"; +import { TAP, processTactFiles, CONTRACTS_DIR } from "./testUtil"; +import path from "path"; processTactFiles(CONTRACTS_DIR, (file) => { const contractName = file.replace(".tact", ""); describe(`Testing CFG dump for ${contractName}`, () => { it(`should produce the correct CFG JSON output for ${contractName}`, async () => { - const configPath = await generateConfig(contractName); - await run(configPath, { + await run(path.join(CONTRACTS_DIR, file), { dumpCfg: "json", dumpCfgStdlib: false, dumpCfgOutput: CONTRACTS_DIR, diff --git a/test/testUtil.ts b/test/testUtil.ts index 63e55a06..80cedb9b 100644 --- a/test/testUtil.ts +++ b/test/testUtil.ts @@ -4,25 +4,6 @@ import { expect } from "@jest/globals"; export const CONTRACTS_DIR = path.resolve(__dirname, "contracts"); -/** - * Generates a Tact configuration file for the given contract. - */ -export async function generateConfig(contractName: string): Promise { - const config = { - projects: [ - { - name: `${contractName}`, - path: `./${contractName}.tact`, - output: `./output`, - options: {}, - }, - ], - }; - const configPath = path.join(CONTRACTS_DIR, `${contractName}.config.json`); - await fs.promises.writeFile(configPath, JSON.stringify(config), "utf8"); - return configPath; -} - /** * Provides a minimal TAP-like API. */