Skip to content

Some global test/it methods are not implemented #1718

Open
@fedetibaldo

Description

@fedetibaldo

Please provide the environment you discovered this bug in.

https://stackblitz.com/edit/github-ozb72oq5?file=src%2Fexample.spec.ts

Run npm run test to receive this output:

 FAIL  src/example.spec.ts [ src/example.spec.ts ]
TypeError: it.fails is not a function
 ❯ eval src/example.spec.ts:3:8
      1| describe('Some global it/test methods are not implemented', () => {
      2|   it.fails('TypeError: it.fails is not a function.');
      3| });
       |        ^
      4| 
 ❯ _ZoneDelegate.invoke node_modules/zone.js/bundles/zone.umd.js:416:32
 ❯ ZoneImpl.run node_modules/zone.js/bundles/zone.umd.js:147:47
 ❯ eval node_modules/@analogjs/vitest-angular/setup-zone.js:37:25

Which area/package is the issue in?

vitest-angular

Description

Some global it/test methods, although supposedly defined, will run into runtime errors when used. In the case of vitest, the global methods that aren't supported are all the methods except for those defined here:

['test', 'it'].forEach((methodName) => {
. So:

  • each, only, skip, and todo are actually implemented;
  • extend, skipIf, runIf, concurrent, sequential, and for may be implemented, but likely aren't (haven't tested)
  • fails surely isn't implemented (check reproduction)

Please provide the exception or error you saw

FAIL  src/example.spec.ts [ src/example.spec.ts ]
TypeError: it.fails is not a function
 ❯ eval src/example.spec.ts:3:8
      1| describe('Some global it/test methods are not implemented', () => {
      2|   it.fails('TypeError: it.fails is not a function.');
      3| });
       |        ^
      4| 
 ❯ _ZoneDelegate.invoke node_modules/zone.js/bundles/zone.umd.js:416:32
 ❯ ZoneImpl.run node_modules/zone.js/bundles/zone.umd.js:147:47
 ❯ eval node_modules/@analogjs/vitest-angular/setup-zone.js:37:25

Other information

I've noticed that the same file (or very similar, anyway) is present under @analogjs/vite-plugin-angular/setup-vitest. I wonder what's up with that.

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions