Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test state is in "pending" when beforeAll failed #4820

Open
6 tasks done
hi-ogawa opened this issue Dec 29, 2023 · 1 comment
Open
6 tasks done

test state is in "pending" when beforeAll failed #4820

hi-ogawa opened this issue Dec 29, 2023 · 1 comment

Comments

@hi-ogawa
Copy link
Contributor

hi-ogawa commented Dec 29, 2023

Describe the bug

I'm creating a dedicated issue based on the discussion in #4799 (comment)

Current behavior seems to be that the test state is kept in "pending" when beforeAll failed, but the desired behavior might be to mark those tests as "skipped".

Here is a repro and a screenshot of Vitest UI:

https://stackblitz.com/edit/vitest-dev-vitest-yr2mrp?file=test%2Frepro.test.ts

Show screenshot

image

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-yr2mrp?file=test%2Frepro.test.ts

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.10.5 - /usr/local/bin/pnpm
  npmPackages:
    @vitest/ui: latest => 1.1.0 
    vite: latest => 5.0.10 
    vitest: latest => 1.1.0

Used Package Manager

npm

Validations

@sheremet-va
Copy link
Member

sheremet-va commented Jan 3, 2024

That is an interesting dilemma. I decided to look into what other runners do (https://github.com/sheremet-va/test-before):

  1. @playwright/test fails the first test and marks all subsequent tests as "skipped"
  2. jest fails every test that doesn't have "skip" modifier - every test has errors populated (even skipped ones), but the test status stays "pending"
  3. mocha doesn't even register any tests, only failures (looking at json output) - it does show "before all" hook for "<name of the first test>" in the terminal
  4. tap is similar to mocha - only the first test (named assert) is marked as failed, all others are not even collected
  5. node:test marks every test as a failed one if an error is thrown inside before (it has a special "cancelled" state that is shown as a failing test) - output is similar to jest (every test shows an error "test did not finish before its parent and was cancelled" even if it has { skip: true }, but it's counted as skipped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants