diff --git a/test/fixtures/build-withTsconfig/src/tsconfig.json b/test/fixtures/build-withTsconfig/src/tsconfig.json new file mode 100644 index 000000000..1fbdfca66 --- /dev/null +++ b/test/fixtures/build-withTsconfig/src/tsconfig.json @@ -0,0 +1,7 @@ +{ + // ensure that extends works (trailing comma & comment too) + "extends": "../tsconfig.base.json", + "compilerOptions": { + "declarationDir": "../typingsCustom/" + } +} diff --git a/test/tests/tsdx-build.test.js b/test/tests/tsdx-build.test.js index 98d25d44e..b1663c658 100644 --- a/test/tests/tsdx-build.test.js +++ b/test/tests/tsdx-build.test.js @@ -136,6 +136,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); });