6
nx run myproject:test --testFile=libs/myproject/src/lib/guards/role.guard.spec.ts

I expect only a single .spec file to be tested. However, the error output shows additional .spec files.

$ nx run myproject:test --testFile=libs/myproject/src/lib/guards/role.guard.spec.ts 

FAIL   core  libs/myproject/src/lib/guards/role.guard.spec.ts
● Test suite failed to run

    libs/myproject/src/lib/auth/auth.service.ts:49:11 - error TS2564: Property 'sessions' has...

    49   private sessions: string;
    libs/myproject/src/lib/auth/auth.service.ts:51:11 - error TS2564...

... Many more lines ...

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        6.953 s
Ran all test suites matching /libs\\myproject\\src\\lib\\guards\\role.guard.spec.ts/i.

Why are extra tests being run such as libs/myproject/src/lib/auth/secure.directive.spec.ts ?

LessQuesar
  • 3,123
  • 1
  • 21
  • 29
  • Everything in the issue is saying that the only test that ran is `role.guard.spec.ts`? – filype Apr 06 '22 at 04:23
  • Weird maybe I pasted the wrong thing in the 2nd box. It was late. I've fixed all the tests on my current project and moved on. – LessQuesar Apr 07 '22 at 18:04

1 Answers1

2

I must have mis-read the output when I posted this. It looks like the nx jest commands I posted, were actually working.

LessQuesar
  • 3,123
  • 1
  • 21
  • 29