Closed Psycokwet closed 10 months ago
Tests are failing as expected on my end
pnpm nx run simple-sample:test
> testing-nestjs@0.0.1 nx /home/jay/Documents/code/projects/testing-nestjs
> nx "run" "simple-sample:test"
> nx run simple-sample:test
● Validation Warning:
Unknown option "collectCoverage" with value true was found.
This is probably a typing mistake. Fixing it will remove this message.
Configuration Documentation:
https://jestjs.io/docs/configuration
ts-jest[config] (WARN) message TS151001: If you have issues related to imports, you should consider setting `esModuleInterop` to `true` in your TypeScript configuration file (usually `tsconfig.json`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typ
escript-2-7/#easier-ecmascript-module-interoperability for more information.
ts-jest[config] (WARN) message TS151001: If you have issues related to imports, you should consider setting `esModuleInterop` to `true` in your TypeScript configuration file (usually `tsconfig.json`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typ
escript-2-7/#easier-ecmascript-module-interoperability for more information.
FAIL apps/simple-sample/src/app.service.spec.ts
● AppService › getHello › should fail for being blatantly wrong
expect(received).toEqual(expected) // deep equality
Expected: 42
Received: 20
21 | });
22 | it('should fail for being blatantly wrong', () => {
> 23 | expect(20).toEqual(42);
| ^
24 | });
25 | });
26 | });
at Object.<anonymous> (src/app.service.spec.ts:23:18)
PASS apps/simple-sample/src/app.controller.spec.ts
-------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------------|---------|----------|---------|---------|-------------------
All files | 100 | 100 | 100 | 100 |
app.controller.ts | 100 | 100 | 100 | 100 |
app.service.ts | 100 | 100 | 100 | 100 |
-------------------|---------|----------|---------|---------|-------------------
Test Suites: 1 failed, 1 passed, 2 total
Tests: 1 failed, 4 passed, 5 total
Snapshots: 0 total
Time: 4.251 s
Ran all test suites.
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Ran target test for project simple-sample (5s)
✖ 1/1 failed
✔ 0/1 succeeded [0 read from cache]
ELIFECYCLE Command failed with exit code 1.
Try using the nx
executor runner in the form of pnpm nx run <project-name>:test
, e.g. pnpm nx run simple-sample:test
.
If you're modifying a test in one of the test
directories, you'll need to use the e2e
executor instead, pnpm nx run <project-name>:e2e
Ok thank you, the e2e worked, I did change tests in test folder ! I didn't think of changing specs files. Thanks !
There are e2e tests in the apps/<name>/test
directories and unit tests in apps/<name>/src/**/*.spec.ts
files
Is there an existing issue for this?
Describe the bug
I have bee adding failure expect to tests in simple-sample as well as graphql-sample
But the tests keeps not failing. I've also changed 200 to 404 and cats to null, and so far, no attempts at breaking testes have had any effect, which is worrisome for the test actual working state
Minimum reproduction code and/or steps to reproduce
Adding
In varous test and pnpm test
For example : simple-test
Expected behavior
The test should fail after having been tempered with badly
In which operating systems have you tested?
Additional context
No response