diff --git a/jest.config.js b/jest.config.js index 8a1e80a66..c39fb5316 100644 --- a/jest.config.js +++ b/jest.config.js @@ -4,5 +4,7 @@ module.exports = { testPathIgnorePatterns: [ '/node_modules/', // default '/templates/', // don't run tests in the templates + '/test/.*/fixtures/', // don't run tests in fixtures + '/stage-.*/', // don't run tests in auto-generated (and auto-removed) test dirs ], }; diff --git a/templates/basic/tsconfig.json b/templates/basic/tsconfig.json index a63b7e132..a502b91b6 100644 --- a/templates/basic/tsconfig.json +++ b/templates/basic/tsconfig.json @@ -1,5 +1,5 @@ { - "include": ["src", "types", "test"], + "include": ["src", "types"], "compilerOptions": { "module": "esnext", "lib": ["dom", "esnext"], diff --git a/templates/react-with-storybook/tsconfig.json b/templates/react-with-storybook/tsconfig.json index e0b677e59..06ffbb74c 100644 --- a/templates/react-with-storybook/tsconfig.json +++ b/templates/react-with-storybook/tsconfig.json @@ -1,5 +1,5 @@ { - "include": ["src", "types", "test"], + "include": ["src", "types"], "compilerOptions": { "module": "esnext", "lib": ["dom", "esnext"], diff --git a/templates/react/tsconfig.json b/templates/react/tsconfig.json index a63b7e132..a502b91b6 100644 --- a/templates/react/tsconfig.json +++ b/templates/react/tsconfig.json @@ -1,5 +1,5 @@ { - "include": ["src", "types", "test"], + "include": ["src", "types"], "compilerOptions": { "module": "esnext", "lib": ["dom", "esnext"], diff --git a/test/e2e/fixtures/build-default/test/some-test.test.ts b/test/e2e/fixtures/build-default/test/some-test.test.ts new file mode 100644 index 000000000..613c100b4 --- /dev/null +++ b/test/e2e/fixtures/build-default/test/some-test.test.ts @@ -0,0 +1,3 @@ +// this is to test .test/.spec files in the test/ dir are excluded + +// and that rootDir: './src' doesn't error with test/ files diff --git a/test/e2e/fixtures/build-default/test/testUtil.ts b/test/e2e/fixtures/build-default/test/testUtil.ts new file mode 100644 index 000000000..d5c76f081 --- /dev/null +++ b/test/e2e/fixtures/build-default/test/testUtil.ts @@ -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 diff --git a/test/e2e/fixtures/build-default/types/blar.d.ts b/test/e2e/fixtures/build-default/types/blar.d.ts new file mode 100644 index 000000000..a93bfc167 --- /dev/null +++ b/test/e2e/fixtures/build-default/types/blar.d.ts @@ -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/ diff --git a/test/e2e/tsdx-build-default.test.js b/test/e2e/tsdx-build-default.test.js index 7ce8bca5d..0f2798536 100644 --- a/test/e2e/tsdx-build-default.test.js +++ b/test/e2e/tsdx-build-default.test.js @@ -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('-f', 'dist/test/')).toBeFalsy(); + expect(shell.test('-f', 'dist/types/')).toBeFalsy(); + + expect(output.code).toBe(0); + }); + it('should create the library correctly', () => { const output = execWithCache('node ../dist/index.js build');