Skip to content

Commit

Permalink
Add test for CLI tsconfig support (#823)
Browse files Browse the repository at this point in the history
This helps confirm that the code change from #822 is safe, which it seems to be.
Previously, this code path was untested, but now that there are CLI integration
tests, it's not so bad to write a new one for this case.
  • Loading branch information
alangpierce committed Dec 22, 2023
1 parent 05bda34 commit ab642fe
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 3 deletions.
10 changes: 7 additions & 3 deletions integration-test/integration-tests.ts
Expand Up @@ -127,9 +127,13 @@ describe("integration tests", () => {
process.chdir(testDir);
const testConfig = await readJSONFileContents("./test.json");
await rm("./dist-actual", {recursive: true, force: true});
await execPromise(
`${__dirname}/../bin/sucrase ./src --out-dir ./dist-actual ${testConfig.cliOptions}`,
);
if (testConfig.disableAutomaticInputOutputDirs) {
await execPromise(`${__dirname}/../bin/sucrase ${testConfig.cliOptions}`);
} else {
await execPromise(
`${__dirname}/../bin/sucrase ./src --out-dir ./dist-actual ${testConfig.cliOptions}`,
);
}
await assertDirectoriesEqual(resolve("./dist-actual"), resolve("./dist-expected"));
});
}
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
@@ -0,0 +1,4 @@
{
"cliOptions": "--project .",
"disableAutomaticInputOutputDirs": true
}
@@ -0,0 +1,6 @@
{
"include": ["src/*[!-test].ts"],
"compilerOptions": {
"outDir": "dist-actual"
}
}

0 comments on commit ab642fe

Please sign in to comment.