nest
nest copied to clipboard
[V5] `npm run test` failed after new project created by nest-cli
Setting up a new project with Nest CLI, nothing changed, npm test failed
$ nest new hume2
$ cd hume2
$ npm run test
> [email protected] test /opt/dev/hume2
> jest
FAIL src/app.controller.spec.ts
AppController
root
✕ should return "Hello World!" (138ms)
● AppController › root › should return "Hello World!"
Nest can't resolve dependencies of the AppController (?). Please verify whether [0] argument is available in the current context.
at Injector.<anonymous> (../node_modules/@nestjs/core/injector/injector.js:156:23)
at Generator.next (<anonymous>)
at fulfilled (../node_modules/@nestjs/core/injector/injector.js:4:58)
at <anonymous>
at process._tickCallback (../internal/process/next_tick.js:118:7)
● AppController › root › should return "Hello World!"
TypeError: Cannot read property 'get' of undefined
at Object.it (app.controller.spec.ts:16:33)
at new Promise (<anonymous>)
at <anonymous>
at process._tickCallback (../internal/process/next_tick.js:118:7)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 3.532s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `jest`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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! /Users/jason/.npm/_logs/2018-04-28T06_10_02_033Z-debug.log
Same issue for me. Just added AppService and now runs as it should.
cc @ThomRick The ts starter is fixed already. This issue should be fixed in the next CLI release.
@kamilmysliwiec I'm on it ;-)
Should be ok with the CLI 5.1.1
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.