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

repeats does not work at all #3334

Closed
6 tasks done
Shinigami92 opened this issue May 9, 2023 · 8 comments · Fixed by #3369
Closed
6 tasks done

repeats does not work at all #3334

Shinigami92 opened this issue May 9, 2023 · 8 comments · Fixed by #3369

Comments

@Shinigami92
Copy link
Contributor

Describe the bug

There is a v0.31.0 new feature repeats #2652

At "real world" it does not work at all.

There are tests in the code base, but somehow the bundled dist seems not to work

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-kzdmn9?file=test/suite.test.ts

System Info

System:
    OS: Linux 6.1 Arch Linux
    CPU: (28) x64 Intel(R) Core(TM) i9-10940X CPU @ 3.30GHz
    Memory: 26.91 GB / 62.48 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
  Browsers:
    Firefox: 112.0.2
  npmPackages:
    @vitest/coverage-c8: ~0.31.0 => 0.31.0 
    @vitest/ui: ~0.31.0 => 0.31.0 
    vite: ~4.3.5 => 4.3.5 
    vitest: ~0.31.0 => 0.31.0

Used Package Manager

pnpm

Validations

@stackblitz
Copy link

stackblitz bot commented May 9, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sheremet-va
Copy link
Member

It doesn't repeat the code in "describe" block, it repeats tests. "describe" just collects and groups tests

@Shinigami92
Copy link
Contributor Author

It doesn't repeat the code in "describe" block, it repeats tests. "describe" just collects and groups tests

Yeah, so it only works right now if

  1. it is a describe block, that wraps directly an it
  2. as you said, only the internal its, but also here the default does not seem to be 5 but 1 if no options are passed at all or the options are empty, so the docs about it is default=5 is also lying 🤔

all in all, it feels very clunky and buggy 🙁

@sheremet-va
Copy link
Member

it is a describe block, that wraps directly an it

If it is true, then it's a bug, yes.

but also here the default does not seem to be 5 but 1 if no options are passed at all or the options are empty, so the docs about it is default=5 is also lying 🤔

What do you mean? How can default be 5?

@Shinigami92
Copy link
Contributor Author

but also here the default does not seem to be 5 but 1 if no options are passed at all or the options are empty, so the docs about it is default=5 is also lying thinking

What do you mean? How can default be 5?

image

/**
* How many times the test will repeat.
*
* @default 5
*/
repeats?: number

@sheremet-va
Copy link
Member

/**
* How many times the test will repeat.
*
* @default 5
*/
repeats?: number

Looks like a typo. If tests were running 5 times by default, it would break a lot of stuff.

@Shinigami92
Copy link
Contributor Author

At Faker we now moved to use .each in general and don't rely on repeats at all
For us this repeats feature feels right now quite to buggy and unstable/experimental
Feel free to close this issue or take some other actions

@sheremet-va
Copy link
Member

Feel free to close this issue or take some other actions

To close this issue, we need to:

  • Change default to 1 in JSDocs
  • Inherit describe options
  • Clarify that repeats will repeat only tests, not test declarations (you will have 1 test running 1000 times, not 1000 tests running once)

@github-actions github-actions bot locked and limited conversation to collaborators Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants