You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FeatureRequest] Allow jest to be ran without watch mode. #6284
This somewhat works but it does not break at breakpoints because (I think) react-scripts is runs jest in watch mode. Adding "env": { "CI": "true" }, allows breakpoints to work again because it disables watch mode.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Create react app debugging",
"type": "node",
"request": "launch",
"env": { "CI": "true" }, // this makes breakpoints work
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
"args": ["test", "--runInBand", "--no-cache"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
I'm fine with this workaround but I'd happier with a --watch=false, --no-watch, --single, or similar flag.
Thanks for the amazing tool and I apologize if I missed anything!
changed the title [-][FeatureRequest] Allow jest to be ran not to be ran in watch mode.[/-][+][FeatureRequest] Allow jest to be ran without watch mode.[/+]on Jan 27, 2019
+1 for this feature, especially considering #2393 (when in watch mode on linux, it fails with too many file watchers)
The fix for this is in jest@24, but as of now, react-scripts is locked to jest@23.6.0 but if you could run jest not in watch mode, then it would be a way to workaround the above issue.
@mrmckeb I put up this one-line PR for --watch=false#6285 if you didn't see. Not sure if it solves the problem the correct way but the simple change seemed to do the job.
@mrmckeb#2393 and jestjs/jest#3254 are the issues I'm trying to resolve. In a very simple new react app (crate-react-app plus react-router and react-bootstrap; and the project has 2 views in it so far just to test out react-router):
vagrant@vagrant-ubuntu-trusty-64:~/projects/business_continuity/management_ui$ yarn test
yarn run v1.13.0
$ react-scripts test
internal/fs/watchers.js:173
throw error;
^
Error: ENOSPC: System limit for number of file watchers reached, watch '/home/vagrant/projects/business_continuity/management_ui/node_modules/eslint-plugin-react/node_modules/resolve/test/module_dir/ymodules'
at FSWatcher.start (internal/fs/watchers.js:165:26)
at Object.watch (fs.js:1254:11)
at NodeWatcher.watchdir (/home/vagrant/projects/business_continuity/management_ui/node_modules/sane/src/node_watcher.js:175:20)
at Walker.<anonymous> (/home/vagrant/projects/business_continuity/management_ui/node_modules/sane/src/common.js:116:12)
at Walker.emit (events.js:182:13)
at /home/vagrant/projects/business_continuity/management_ui/node_modules/walker/lib/walker.js:69:16
at go$readdir$cb (/home/vagrant/projects/business_continuity/management_ui/node_modules/graceful-fs/graceful-fs.js:162:14)
at FSReqWrap.oncomplete (fs.js:141:20)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
the issue seems to be that react-scripts forces jest --watch and jest then tries to watch every file in node_modules (i base this on the comments of these linked issues. it seems to make sense anyway, as my actual project not including node_modules only has a couple dozen files)
In the linked issue there is a comment that this is fixed in jest@24 but react-scripts errors if you use any version but 23.6.0. It also prevents you from setting the jest config option watchPathIgnorePatterns which you could use to tell jest to no longer watch files in node_modules. There is also no way to run jest without --watch and avoid this altogether.
Activity
[-][FeatureRequest] Allow jest to be ran not to be ran in watch mode.[/-][+][FeatureRequest] Allow jest to be ran without watch mode.[/+]rally25rs commentedon Jan 30, 2019
+1 for this feature, especially considering #2393 (when in watch mode on linux, it fails with too many file watchers)
The fix for this is in
jest@24, but as of now,react-scriptsis locked tojest@23.6.0but if you could run jest not in watch mode, then it would be a way to workaround the above issue.mrmckeb commentedon Jan 30, 2019
I think we need to address this, as it is raised often. I'd be open to a PR adding
--no-watch.@rally25rs, I'm not sure what feature you're referring to - can you provide a link?
I use it with watch-mode on Linux (Ubuntu) and it works well locally.
ricokahler commentedon Jan 30, 2019
@mrmckeb I put up this one-line PR for
--watch=false#6285 if you didn't see. Not sure if it solves the problem the correct way but the simple change seemed to do the job.rally25rs commentedon Jan 30, 2019
@mrmckeb #2393 and jestjs/jest#3254 are the issues I'm trying to resolve. In a very simple new react app (crate-react-app plus react-router and react-bootstrap; and the project has 2 views in it so far just to test out react-router):
the issue seems to be that
react-scriptsforcesjest --watchandjestthen tries to watch every file innode_modules(i base this on the comments of these linked issues. it seems to make sense anyway, as my actual project not includingnode_modulesonly has a couple dozen files)In the linked issue there is a comment that this is fixed in
jest@24butreact-scriptserrors if you use any version but23.6.0. It also prevents you from setting the jest config option watchPathIgnorePatterns which you could use to tell jest to no longer watch files innode_modules. There is also no way to run jest without--watchand avoid this altogether.react@16.7.0
react-scripts@2.1.3
jest@23.6.0
mrmckeb commentedon Jan 31, 2019
We need to bump to
jest@24, agreed @rally25rs. For now though, ano-watchflag would help a lot of people.