-
Notifications
You must be signed in to change notification settings - Fork 80
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
nuxt3 use vitest Execution time too long and Unable to use vitest's coverage command #306
Comments
Would you provide a minimal reproduction? 🙏 Nuxt is performing a full build of your site in order to run the test, which is why it takes longer than you expect.We have plans to optimise this, perhaps by using a cached build or sharing builds between test suites. (cc: @antfu) It's also why it's unlikely vitest's coverage option will give you the kind of coverage you want. The repeat output is likely an issue with the fact that we wrap console logs when running For basic unit tests where you do not need to fully build your Nuxt server for testing, I would recommend instead checking out https://github.com/danielroe/vitest-environment-nuxt. |
@danielroe thanks, this is minimal reproduction: https://codesandbox.io/p/sandbox/compassionate-chihiro-bucuv4 please run I don't know why, but running Nuxt test on Codesandbox is indeed very fast, only taking about 10 seconds. However, I found that Codesandbox is using the Node16 version, and the running system is not clear about what it is. However, my development computer is Windows 10, using the Node18 version. Although the running speed is much faster, the content output from the console is still repetitive. thank you! |
I had a similar issue, so decided to limit the scope of some tests and use nuxt-vitest + directly calling |
let's track in #314. |
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Environment
Windows_NT
v18.15.0
3.3.3
2.3.2
yarn@1.23.0-20200615.1913
vite
Reproduction
File:
/tests/NoteTree.spec.ts
File:
App.vue
File:
package.json
Usage: Terminal run:
nuxt test
Describe the bug
Bug preview:
Bug description:
1. Execution time too long
Usually, a simple project only tests whether a page contains a certain string, so it shouldn't take so long. I hope to optimize the test execution logic, such as in the CI/CD process where Yarn install and Yarn build are usually done in the previous steps. I hope to directly conduct real nuxt tests after this, without the need for repeated compilation
2. Excessive duplicate content output from the console
The Vue3 project can be tested using the
vitest run
command, and the console is very concise during the testing process. Repeated output will only output one line, but using thenuxt test
command will output a lot of repetitive content on the console3. Unable to use vitest's coverage command
The coverage command of vitest cannot be used. Vue3 projects can use the
vitest run --coverage
command to calculate and output coverage, but using thenuxt test
command and the--coverage
command also cannot output coverageAdditional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: