Change tests option from --watch to --live to avoid node conflict#317
Change tests option from --watch to --live to avoid node conflict#317lyzadanger merged 1 commit intomainfrom
tests option from --watch to --live to avoid node conflict#317Conversation
Node 18.11 introduced a core `--watch` flag. This creates a conflict with using a `--watch` option in the `test` task. For now, change the name of the task's option to `--live` to avoid this conflict. Updated usage: `gulp test --live`
|
In the course of poking at this, I noticed that https://h.readthedocs.io/projects/client/en/latest/developers/developing.html 's section on testing is fairly egregiously out-of-date. We should update that documentation after we sort this. |
|
After doing some digging, it looks like the issue is that the gulp test --watch --no-respawningExcept that the // Parse command-line options for test execution.
program
.option(
'--grep <pattern>',
'Run only tests where filename matches a regex pattern'
)
.option('--watch', 'Continuously run tests (default: false)', false)
.parse(process.argv.filter(a => a !== '--no-respawning'));This is why various other tools that have a In the above the first |
robertknight
left a comment
There was a problem hiding this comment.
To recap, the issue here is that Gulp is detecting any Node or V8 flag names in the CLI args and doing unwanted things if it sees them. The problem arose after a Node update because --watch is now a recognized Node/V8 flag name, according to the v8flags package. There is a way to turn this behavior off, but it is cumbersome.
I would prefer to use --watch as a more obvious name than --live, but as long as we're still using gulp, then the dumb approach of avoiding flag names that conflict with Node/V8 flags is the easiest thing to do. If we migrate away from gulp in future, we can revert the name to --watch.
Node 18.11 introduced a core
--watchflag. This creates a conflict with using a--watchoption in theteststask module. For now, change the name of the task's option to--liveto avoid this conflict.Updated usage:
gulp test --liveTesting this change
mainbranch of theclient, with a local node version of >=18.11, try runninggulp test --watch. It should fail.frontend-build. Runyalc publishclientdirectory, runyalc add @hypothesis/frontend-buildclient, rungulp test --live. It should work: tests should run and then run again on input/source file changes