Skip to content

Commit

Permalink
(test): ensure custom --tsconfig path is correctly read
Browse files Browse the repository at this point in the history
- this never had tests for it, so ensure it's properly read
  - make sure extends works, that an override works, and that paths
    are correctly resolved
  • Loading branch information
agilgur5 committed Mar 11, 2020
1 parent 7102819 commit 9a5a4fb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/fixtures/build-withTsconfig/src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// ensure that extends works (trailing comma & comment too)
"extends": "../tsconfig.base.json",
"compilerOptions": {
"declarationDir": "../typingsCustom/"
}
}
22 changes: 22 additions & 0 deletions test/tests/tsdx-build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,28 @@ describe('tsdx build', () => {
expect(output.code).toBe(0);
});

it('should read custom --tsconfig path', () => {
util.setupStageWithFixture(stageName, 'build-withTsconfig');

const output = shell.exec(
'node ../dist/index.js build --format cjs --tsconfig ./src/tsconfig.json'
);

expect(shell.test('-f', 'dist/index.js')).toBeTruthy();
expect(
shell.test('-f', 'dist/build-withtsconfig.cjs.development.js')
).toBeTruthy();
expect(
shell.test('-f', 'dist/build-withtsconfig.cjs.production.min.js')
).toBeTruthy();

expect(shell.test('-f', 'dist/index.d.ts')).toBeFalsy();
expect(shell.test('-f', 'typingsCustom/index.d.ts')).toBeTruthy();
expect(shell.test('-f', 'typingsCustom/index.d.ts.map')).toBeTruthy();

expect(output.code).toBe(0);
});

afterEach(() => {
util.teardownStage(stageName);
});
Expand Down

0 comments on commit 9a5a4fb

Please sign in to comment.