question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exit with error if --watch is used in CI

See original GitHub issue

(Rather than ignoring --watch we’ve decided to exit with an error instead: https://github.com/avajs/ava/issues/1186#issuecomment-274246060@novemberborn)


Description

This is a feature request. Skip ‘–watch’ arg if isCi

Since we have known our test running on CI server. Ava should more clever to ignore --watch arg.

Config

Copy the relevant section from package.json:

{
  "scripts": {
    "test": "ava -w"
  }
}

Now I write my test command like this:

{
  "scripts": {
    "test": "[ -z $CI ] && (ava -w); [ $CI ] && (ava)"
  }
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
forresstcommented, Jan 21, 2017

To summarize the discussion, the solution would be to raise an error (exiting with 1 to allow stop the process in CI) with the following explanatory message : AVA will not run with the --watch (-w) option in CI, because CI processes should terminate, and with the --watch option, AVA will never terminate.

Is that the right solution?

I can do the PR if you want (Code, test and explanation in docs)

1reaction
mightyiamcommented, Jan 16, 2017

Yes. “Skipping” watching, with a warning, seems reasonable. But, if anyone is running with -w in CI it most likely means that his test script has ava -w. Shouldn’t we “educate” by not letting that pass, and instead provide a kind message?

“Error: AVA will not run with the --watch (-w) option in CI, because CI processes should terminate, and with the --watch option, AVA will never terminate.”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Linux CLI watch switch -e, --errexit unexpected exit with ...
The problem is that watch terminates if the output of command does not fit into the CLI window.
Read more >
Exit (light) Codes - GitHub Pages
Continuous Integration / Continuous Development (CI/CD) ... Exit codes are used to identify if a command or script executed with errors or not....
Read more >
Process will exit when watch mode is on · Issue #730
Is the error message Cannot use "watch" with "serve" ? It is an intentional limitation that you can't use both watch and serve...
Read more >
Make it possible to control build status using exit codes - GitLab
The workaround I'm now using: in the following pipeline stages, test for the condition where you want to skip, and exit 0 early....
Read more >
Exit Code 137 - Out of Memory
Exit Code 137 - Out of memory. This is a Linux error code which you may see on CircleCI when your container runs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found