Ava: Watcher gets stuck when AVA cache is deleted

Created on 12 Sep 2019  Â·  13Comments  Â·  Source: avajs/ava

Description

Added a new dep while watch mode was idle and it threw an error. From then on Ava refused to run any test.

Test Source

N/A

Error Message & Stack Trace

Installed new dep.
Hit save, got Couldn't find any files to test.
Hit save, got Internal error.
Used CTRL + C, got Internal error.

  ✖ Couldn't find any files to test

  Type `r` and press enter to rerun tests
  Type `u` and press enter to update snapshots

  ✖ Internal error

^C  
  ✖ Exiting due to SIGINT



  ✖ Internal error
  Error: ENOENT: no such file or directory, open '/Users/xo/code/unraid/core/node_modules/.cache/ava/5fe5159ec36c3f37a28ed54a1b801d15.js.map.396767890'
  Error: ENOENT: no such file or directory, open '/Users/xo/code/unraid/core/node_modules/.cache/ava/5fe5159ec36c3f37a28ed54a1b801d15.js.map.396767890'
      at Object.openSync (fs.js:436:3)
      at Function.writeFileSync [as sync] (/Users/xo/code/unraid/core/node_modules/ava/node_modules/write-file-atomic/index.js:180:13)
      at Object.filename [as precompileFull] (/Users/xo/code/unraid/core/node_modules/ava/lib/babel-pipeline.js:249:20)
      at precompilation.map.reduce (/Users/xo/code/unraid/core/node_modules/ava/lib/api.js:189:21)
      at Array.reduce (<anonymous>)
      at Api.run (/Users/xo/code/unraid/core/node_modules/ava/lib/api.js:184:34)
      at process._tickCallback (internal/process/next_tick.js:68:7)

Config

N/A

Command-Line Arguments

ava --silent --watch

Environment

Node.js v10.14.1
darwin 16.7.0
ava 2.2.0
npm 6.4.1
bug help wanted watch-mode

All 13 comments

Looks like the cache disappeared, which AVA isn't expecting. How did you install the new dependencies? npm ci?

yarn add in another terminal window.

Thanks, I guess that cleans up node_modules too. Maybe the issue is just that the .cache/ava directory is gone, which should be easily detected and dealt with.

Have an issue in github action. Not in watch mode, works fine in local machine.

The project: https://github.com/moseeker/qxjs-cli/runs/775113110?check_suite_focus=true

The full log

2020-06-16T03:42:35.8527090Z added 1088 packages in 17.369s
2020-06-16T03:42:36.1471580Z 
2020-06-16T03:42:36.1473188Z > @moseeker/[email protected] test /home/runner/work/qxjs-cli/qxjs-cli
2020-06-16T03:42:36.1474055Z > run-s build test-me:*
2020-06-16T03:42:36.1474621Z 
2020-06-16T03:42:36.6204070Z 
2020-06-16T03:42:36.6205718Z > @moseeker/[email protected] build /home/runner/work/qxjs-cli/qxjs-cli
2020-06-16T03:42:36.6206806Z > ls . && run-s clean && run-p build:*
2020-06-16T03:42:36.6207266Z 
2020-06-16T03:42:36.6270577Z CHANGELOG.md
2020-06-16T03:42:36.6271291Z LICENSE
2020-06-16T03:42:36.6271754Z README.md
2020-06-16T03:42:36.6272188Z __fixtures__
2020-06-16T03:42:36.6272660Z bin
2020-06-16T03:42:36.6273094Z node_modules
2020-06-16T03:42:36.6273916Z package-lock.json
2020-06-16T03:42:36.6274512Z package.json
2020-06-16T03:42:36.6274925Z src
2020-06-16T03:42:36.6275333Z tests
2020-06-16T03:42:36.6276197Z tsconfig.json
2020-06-16T03:42:36.6276753Z tsconfig.module.json
2020-06-16T03:42:36.6277191Z tslint.json
2020-06-16T03:42:36.6277667Z yarn.lock
2020-06-16T03:42:37.0516051Z 
2020-06-16T03:42:37.0517610Z > @moseeker/[email protected] clean /home/runner/work/qxjs-cli/qxjs-cli
2020-06-16T03:42:37.0517891Z > trash build test
2020-06-16T03:42:37.0517988Z 
2020-06-16T03:42:37.6922775Z 
2020-06-16T03:42:37.6924559Z > @moseeker/[email protected] build:module /home/runner/work/qxjs-cli/qxjs-cli
2020-06-16T03:42:37.6925389Z > tsc -p tsconfig.module.json
2020-06-16T03:42:37.6925952Z 
2020-06-16T03:42:37.7358947Z 
2020-06-16T03:42:37.7361172Z > @moseeker/[email protected] build:main /home/runner/work/qxjs-cli/qxjs-cli
2020-06-16T03:42:37.7362688Z > tsc -p tsconfig.json
2020-06-16T03:42:37.7363162Z 
2020-06-16T03:42:43.9127933Z 
2020-06-16T03:42:43.9129668Z > @moseeker/[email protected] test-me:unit /home/runner/work/qxjs-cli/qxjs-cli
2020-06-16T03:42:43.9130383Z > nyc ava --verbose
2020-06-16T03:42:43.9130745Z 
2020-06-16T03:42:44.8656524Z 
2020-06-16T03:42:44.8707155Z   ✖ Couldn’t find any files to test
2020-06-16T03:42:44.8707645Z 
2020-06-16T03:42:44.8736963Z   ✖ Internal error
2020-06-16T03:42:44.8737666Z   Error: ENOENT: no such file or directory, mkdir '/home/runner/work/qxjs-cli/qxjs-cli/node_modules/.cache/ava'
2020-06-16T03:42:44.8738253Z   Error: ENOENT: no such file or directory, mkdir '/home/runner/work/qxjs-cli/qxjs-cli/node_modules/.cache/ava'
2020-06-16T03:42:44.8738497Z       at Object.fs.mkdirSync (fs.js:840:3)
2020-06-16T03:42:44.8739026Z       at Api._createCacheDir (/home/runner/work/qxjs-cli/qxjs-cli/node_modules/ava/lib/api.js:267:6)
2020-06-16T03:42:44.8739544Z       at Api.run (/home/runner/work/qxjs-cli/qxjs-cli/node_modules/ava/lib/api.js:116:20)
2020-06-16T03:42:44.8740079Z       at Object.exports.run (/home/runner/work/qxjs-cli/qxjs-cli/node_modules/ava/lib/cli.js:445:31)
2020-06-16T03:42:44.8740604Z       at Object.<anonymous> (/home/runner/work/qxjs-cli/qxjs-cli/node_modules/ava/cli.js:10:23)
2020-06-16T03:42:44.8740971Z       at Module._compile (internal/modules/cjs/loader.js:678:30)
2020-06-16T03:42:44.8741577Z       at Module.replacementCompile (/home/runner/work/qxjs-cli/qxjs-cli/node_modules/append-transform/index.js:60:13)
2020-06-16T03:42:44.8741857Z       at Module._extensions..js (internal/modules/cjs/loader.js:689:10)
2020-06-16T03:42:44.8742414Z       at Object.<anonymous> (/home/runner/work/qxjs-cli/qxjs-cli/node_modules/append-transform/index.js:64:4)
2020-06-16T03:42:44.8742670Z       at Module.load (internal/modules/cjs/loader.js:589:32)
2020-06-16T03:42:44.8742772Z 
2020-06-16T03:42:44.8742866Z 
2020-06-16T03:42:44.8970678Z ----------|---------|----------|---------|---------|-------------------
2020-06-16T03:42:44.8974613Z File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
2020-06-16T03:42:44.8975372Z ----------|---------|----------|---------|---------|-------------------
2020-06-16T03:42:44.8981655Z All files |       0 |        0 |       0 |       0 |                   
2020-06-16T03:42:44.8982881Z ----------|---------|----------|---------|---------|-------------------
2020-06-16T03:42:44.9026903Z npm ERR! code ELIFECYCLE
2020-06-16T03:42:44.9029847Z npm ERR! errno 1
2020-06-16T03:42:44.9038393Z npm ERR! @moseeker/[email protected] test-me:unit: `nyc ava --verbose`
2020-06-16T03:42:44.9038665Z npm ERR! Exit status 1
2020-06-16T03:42:44.9041625Z npm ERR! 
2020-06-16T03:42:44.9042335Z npm ERR! Failed at the @moseeker/[email protected] test-me:unit script.
2020-06-16T03:42:44.9042744Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-06-16T03:42:44.9103781Z 
2020-06-16T03:42:44.9104315Z npm ERR! A complete log of this run can be found in:
2020-06-16T03:42:44.9107817Z npm ERR!     /home/runner/.npm/_logs/2020-06-16T03_42_44_904Z-debug.log

@towry that action uses Node.js 10.0.0, AVA requires 10.18.

Is anyone working on this issue right now?

@Lunchb0ne no, but I'll assign it to you since it sounds like your keen 😄

Cool, I'll try my best

Okay, weird, I can't seem to reproduce the issue, but that might be because I'm just using boilerplate code. I'll try with some other project that uses ava for testing.

@Lunchb0ne you may want to try a project that uses @ava/babel, which writes to the cache directory.

Can you suggest any small projects that I can use for testing?

If you write a test.js file and enable babel: true in the configuration, with @ava/babel installed, that should do it.

Okay, I'll try it

Was this page helpful?
0 / 5 - 0 ratings