diff --git a/docs/configuration.md b/docs/configuration.md index 0cc13d288d..b1965eec73 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -138,7 +138,7 @@ Config file: `"ignorePatterns": ["dist", "coverage"]`
Specify the patterns to all files or directories that are not used to run your tests and thus should _not be copied_ to the sandbox directory for mutation testing. Each patterns in this array should be a [`.gitignore`-style glob pattern](https://git-scm.com/docs/gitignore#_pattern_format). -These patterns are **always ignored**: `['node_modules', '.git', '/reports', '/stryker.log', '.stryker-tmp']`. Because Stryker always ignores these, you should rarely have to adjust the `"ignorePatterns"` setting at all. If you want to undo one of these ignore patterns, you can use the `!` prefix, for example: `['!node_modules']`. +These patterns are **always ignored**: `['node_modules', '.git', '/reports' '*.tsbuildinfo', '/stryker.log', '.stryker-tmp']`. Because Stryker always ignores these, you should rarely have to adjust the `"ignorePatterns"` setting at all. If you want to undo one of these ignore patterns, you can use the `!` prefix, for example: `['!node_modules']`. If a glob pattern starts with `/`, the pattern is relative to the current working directory. For example, `/foo.js` matches to `foo.js` but not `subdir/foo.js`. diff --git a/packages/core/src/input/input-file-resolver.ts b/packages/core/src/input/input-file-resolver.ts index 61d3acb43b..674d14a11a 100644 --- a/packages/core/src/input/input-file-resolver.ts +++ b/packages/core/src/input/input-file-resolver.ts @@ -28,7 +28,7 @@ function toReportSourceFile(file: File): SourceFile { }; } -const ALWAYS_IGNORE = Object.freeze(['node_modules', '.git', '/reports', '/stryker.log']); +const ALWAYS_IGNORE = Object.freeze(['node_modules', '.git', '/reports', '*.tsbuildinfo', '/stryker.log']); export const IGNORE_PATTERN_CHARACTER = '!'; export const MUTATION_RANGE_REGEX = /(.*?):((\d+)(?::(\d+))?-(\d+)(?::(\d+))?)$/; diff --git a/packages/core/test/unit/input/input-file-resolver.spec.ts b/packages/core/test/unit/input/input-file-resolver.spec.ts index 7d213c85cf..9fe9fe7b7a 100644 --- a/packages/core/test/unit/input/input-file-resolver.spec.ts +++ b/packages/core/test/unit/input/input-file-resolver.spec.ts @@ -29,7 +29,7 @@ describe(InputFileResolver.name, () => { const sut = createSut(); await sut.resolve(); expect(testInjector.logger.warn).calledWith( - `No files found in directory ${process.cwd()} using ignore rules: ["node_modules",".git","/reports","/stryker.log",".stryker-tmp"]. Make sure you run Stryker from the root directory of your project with the correct "ignorePatterns".` + `No files found in directory ${process.cwd()} using ignore rules: ["node_modules",".git","/reports","*.tsbuildinfo","/stryker.log",".stryker-tmp"]. Make sure you run Stryker from the root directory of your project with the correct "ignorePatterns".` ); }); @@ -90,7 +90,7 @@ describe(InputFileResolver.name, () => { expect(files[0].name).eq(path.resolve('packages', 'app', 'src', 'index.js')); }); - it('should ignore node_modules, .git, reports, stryker.log and .stryker-tmp by default', async () => { + it('should ignore node_modules, .git, reports, stryker.log, *.tsbuildinfo and .stryker-tmp by default', async () => { // Arrange stubFileSystem({ '.git': { config: '' }, @@ -98,6 +98,10 @@ describe(InputFileResolver.name, () => { '.stryker-tmp': { 'stryker-sandbox-123': { src: { 'index.js': '' } } }, 'index.js': '', 'stryker.log': '', + 'tsconfig.src.tsbuildinfo': '', + dist: { + 'tsconfig.tsbuildinfo': '', + }, reports: { mutation: { 'mutation.json': '' } }, }); const sut = createSut();