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

expect.poll.toBeDefined is broken #6557

Closed
6 tasks done
dmaretskyi opened this issue Sep 24, 2024 · 1 comment · Fixed by #6562
Closed
6 tasks done

expect.poll.toBeDefined is broken #6557

dmaretskyi opened this issue Sep 24, 2024 · 1 comment · Fixed by #6562
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@dmaretskyi
Copy link

Describe the bug

This test should not be passing, but passes anyway:

test('expect poll', async ({ expect }) => {
  await expect.poll(() => undefined).toBeDefined();
});

Reproduction

https://stackblitz.com/edit/vite-ssr-map-sources-trkjjk?file=repro.test.js

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.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    vite: ^5.4.7 => 5.4.7 
    vitest: ^2.1.1 => 2.1.1

Used Package Manager

pnpm

Validations

@hi-ogawa hi-ogawa added p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Sep 25, 2024
@hi-ogawa
Copy link
Contributor

It looks like "not" state get confused due to toBeDefined definition here and 2nd poll attempt get succeed:

def('toBeDefined', function () {
const negate = utils.flag(this, 'negate')
utils.flag(this, 'negate', false)
if (negate) {
return this.be.undefined
}
return this.not.be.undefined
})

@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants