-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
How to ignore files on jest watch mode #2516
Comments
Looks like the I'm also seeing this danger/danger-js#82, so this is how I debugged it - if you edit your |
And as I'm interested in specific answers too, my problem was that something was making my fixtures change ( I assume it's the typescript compiler ) I fixed it by doing this in the package.json
|
This should fix it: #2362 |
const onFileChange = (_, filePath: string) => {
filePath = path.join(root, filePath);
const coverageDirectory =
config.coverageDirectory ||
path.resolve(config.rootDir, 'coverage');
const isValidPath =
config.testPathDirs.some(dir => filePath.startsWith(dir)) &&
!filePath.includes(coverageDirectory); Look at this condition But I see you use os.tmpdir() to avoid this problem. |
Jest 19 is out now. |
I'm running into this, I'm unable to use jest watch because my test files clean up the test output dirs using
Ideally I can tell jest to ignore all Is |
Doesn't seem like it, I get the same error with the following added to my "jest": {
"coveragePathIgnorePatterns": [
"node_modules",
"output"
]
} |
Same here using Jest 19.0.2, stuck in an infinite watch loop without |
watchPathIgnorePatterns is the current way. |
I actually have that set up already, but it still doesn't work, I get crashes any time I try to use |
I am using a monorepo. I have a I also tried to use an absolute path, with 1-1 match of the file causing the problem, also does not help... My intended setup is this: module.exports = {
projects: [
'workspaces/hush-hush',
'workspaces/queuing-service',
'workspaces/telepath',
'workspaces/idbox-react-ui',
'workspaces/utils',
{
rootDir: 'workspaces/idservice',
testEnvironment: 'node'
},
{
rootDir: 'workspaces/nameservice',
testEnvironment: 'node'
},
{
testMatch: ['<rootDir>/dummy']
}
],
collectCoverage: true,
collectCoverageFrom: [
'source/**/*.js',
'src/**/*.js',
'pages/*.js',
'components/**',
'!pages/_app.js',
'!**/jest.config.js',
'!**/_document.js',
'!**/*.test.js',
'!**/__mocks__/**.js',
'!**/node_modules/**',
'!**/.next/**'
],
coverageReporters: [
'text-summary',
'lcov'
],
watchPathIgnorePatterns: [
'<rootDir>/fixtures/idservice/'
]
} My tests dynamically create a fixture file in module.exports = {
projects: [
// ....
{
rootDir: 'workspaces/idservice',
testEnvironment: 'node',
watchPathIgnorePatterns: [
'<rootDir>/fixtures/idservice/'
]
}, and then have the The link to repo is here: https://github.com/identity-box/identity-box I am using jest version |
Using jest 26.6.3 and none of this works for me. I'm trying both pacakge and jest.config. npm command is: In package: In jest.config.js But when my test executes this code: Then the test runs in an infinite loop. I comment out that writeFileSync line and everything behaves as expected. Any help would be much appreciated. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Do you want to request a feature or report a bug?
What is the current behavior?
jest --watch
my tests will create new files on project directory. jest rerun when watch new files. run tests loop ......I try set
testPathIgnorePatterns
andtestPathDirs
exclude the new files directory, but same way.If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.What is the expected behavior?
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
The text was updated successfully, but these errors were encountered: