node.jstypescriptnpmtravis-ciava

Why is Ava js not showing error logging locally, only in ci


I have a failing ava test that should error out like this:

$ npm run test
> fetch_courses@1.0.0 test /home/travis/build/********/fetch_courses
> tsc && ava
  Uncaught exception in test/fetchTerms.test.ts
  Error: Cannot find module '../config.js'
  Require stack:
  - /home/travis/build/********/fetch_courses/src/fetchTerms.ts
  - /home/travis/build/********/fetch_courses/test/fetchTerms.test.ts
  - /home/travis/build/********/fetch_courses/node_modules/ava/lib/worker/subprocess.js
  › - node_modules/ava/lib/worker/subprocess.js
  › src/fetchTerms.ts:2:1
  › Object.<anonymous> (src/fetchTerms.ts:139:4)
  › Module.m._compile (node_modules/ts-node/src/index.ts:858:23)
  › require.extensions.<computed> (node_modules/ts-node/src/index.ts:861:12)
  ✖ test/fetchTerms.test.ts exited with a non-zero exit code: 1
  ─
  1 uncaught exception
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fetch_courses@1.0.0 test: `tsc && ava`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the fetch_courses@1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/travis/.npm/_logs/2020-07-21T21_30_16_127Z-debug.log
The command "npm run test" exited with 1.
cache.2
store build cache

which only happens in my travis build.

When I freshly clone [my repository][1] and run npm install and npm run test, which is exactly what happens in travis, this is the logging i see.

$ npm run test

> fetch_courses@1.0.0 test /mnt/c/Users/********/Projects/fetch_courses
> tsc && ava


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fetch_courses@1.0.0 test: `tsc && ava`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fetch_courses@1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /mnt/c/Users/********/.npm/_logs/2020-07-21T22_06_02_028Z-debug.log

So you can see that I'm missing the entire Ava output/error logging.

I don't know what else I can do, but maybe it's some sort of configuration issue? The repository is linked so feel free to poke around and/or try to reproduce.


Solution

  • Couldn't find an answer since it seems like the issue is local to my IDE only, so my workaround was to run ava on the compiled javascript version of the tests. Logging worked there, for whatever reason.