-
Notifications
You must be signed in to change notification settings - Fork 4
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
Change tests
option from --watch
to --live
to avoid node conflict
#317
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
After doing some digging, it looks like the issue is that the gulp test --watch --no-respawning Except 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
--watch
flag. This creates a conflict with using a--watch
option in thetests
task module. For now, change the name of the task's option to--live
to avoid this conflict.Updated usage:
gulp test --live
Testing this change
main
branch of theclient
, with a local node version of >=18.11, try runninggulp test --watch
. It should fail.frontend-build
. Runyalc publish
client
directory, runyalc add @hypothesis/frontend-build
client
, rungulp test --live
. It should work: tests should run and then run again on input/source file changes