Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix): remove faulty tsconfig.json include of test dir #646

Merged
merged 1 commit into from
Mar 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ module.exports = {
testPathIgnorePatterns: [
'/node_modules/', // default
'<rootDir>/templates/', // don't run tests in the templates
'<rootDir>/test/.*/fixtures/', // don't run tests in fixtures
'<rootDir>/stage-.*/', // don't run tests in auto-generated (and auto-removed) test dirs
],
};
4 changes: 3 additions & 1 deletion src/deprecated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export async function moveTypes() {
'rootDir to "./src".\n' +
'TSDX has deprecated setting tsconfig.compilerOptions.rootDir to ' +
'"./" as it caused buggy output for declarationMaps and occassionally ' +
'for type declarations themselves.'
'for type declarations themselves.\n' +
'You may also need to change your include to remove "test", which also ' +
'caused declarations to be unnecessarily created for test files.'
);

try {
Expand Down
2 changes: 1 addition & 1 deletion templates/basic/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"include": ["src", "types", "test"],
"include": ["src", "types"],
"compilerOptions": {
"module": "esnext",
"lib": ["dom", "esnext"],
Expand Down
2 changes: 1 addition & 1 deletion templates/react-with-storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"include": ["src", "types", "test"],
"include": ["src", "types"],
"compilerOptions": {
"module": "esnext",
"lib": ["dom", "esnext"],
Expand Down
2 changes: 1 addition & 1 deletion templates/react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"include": ["src", "types", "test"],
"include": ["src", "types"],
"compilerOptions": {
"module": "esnext",
"lib": ["dom", "esnext"],
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/fixtures/build-default/test/some-test.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// this is to test that .test/.spec files in the test/ dir are excluded

// and that rootDir: './src' doesn't error with test/ files
4 changes: 4 additions & 0 deletions test/e2e/fixtures/build-default/test/testUtil.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// this is to test that test helper files in the test/ dir are excluded
// i.e. files in test/ that don't have a .spec/.test suffix

// and that rootDir: './src' doesn't error with test/ files
3 changes: 3 additions & 0 deletions test/e2e/fixtures/build-default/types/blar.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// this is to test that rootDir: './src' doesn't error with types/ files

// and that declaration files aren't re-output in dist/
9 changes: 9 additions & 0 deletions test/e2e/tsdx-build-default.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ describe('tsdx build :: zero-config defaults', () => {
expect(output.code).toBe(0);
});

it("shouldn't compile files in test/ or types/", () => {
const output = execWithCache('node ../dist/index.js build');

expect(shell.test('-d', 'dist/test/')).toBeFalsy();
expect(shell.test('-d', 'dist/types/')).toBeFalsy();

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

it('should create the library correctly', () => {
const output = execWithCache('node ../dist/index.js build');

Expand Down