Skip to content

Commit

Permalink
Add test for CLI tsconfig support
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 4e92c34
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
Original file line number Diff line number Diff line change
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"cliOptions": "--project .",
"disableAutomaticInputOutputDirs": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"include": ["src/*[!-test].ts"],
"compilerOptions": {
"outDir": "dist-actual"
}
}

0 comments on commit 4e92c34

Please sign in to comment.