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

Vitest mock feature not working correctly due to change introduced in vite v3.0.6 #10518

Closed
7 tasks done
luckylooke opened this issue Oct 18, 2022 · 1 comment
Closed
7 tasks done

Comments

@luckylooke
Copy link
Contributor

luckylooke commented Oct 18, 2022

Describe the bug

So it seems that v3.0.6 introduced some breaking change unintentionally (semver). Vite v3.0.5 works as expected, also tested v3.1.8 table and v3.2.0-beta.2 as well, results both: NOK.

In following reproduction:
In v3.0.5 and lower the package vue-meta is mocked correctly.
In v3.0.6 and higher the package vue-meta is NOT mocked at all.

Reproduction

https://stackblitz.com/edit/vue-vitest-demo-gk83pk?file=package.json

Steps to reproduce

check console.. you will see failed test
once you change (downgrade) version of vite to v3.0.5 you will get passed test

Or you may navigate to working example here https://stackblitz.com/edit/vue-vitest-demo-nl2dub?file=package.json which already have set vite version 3.0.5

System Info

Stackblitz

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: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    @vitejs/plugin-vue: ^3.0.1 => 3.1.2 
    vite: v3.0.6 => 3.0.6

Used Package Manager

npm

Logs

$ vitest --debug
Error: Unknown option --debug
at async ESMLoader.import (https://vue-vitest-demo-dz15mu.w.staticblitz.com/blitz.3c06ff333fff62d153837b0d0df85b8ed07b008f.js:6:1209286)
at async i.loadESM (https://vue-vitest-demo-dz15mu.w.staticblitz.com/blitz.3c06ff333fff62d153837b0d0df85b8ed07b008f.js:6:246623)
at async handleMainPromise (https://vue-vitest-demo-dz15mu.w.staticblitz.com/blitz.3c06ff333fff62d153837b0d0df85b8ed07b008f.js:6:989295) {
name: 'CACError'
}

Validations

@luckylooke luckylooke changed the title Vitest mock feature not working due to change introduced in vite v3.0.6 Vitest mock feature not working correctly due to change introduced in vite v3.0.6 Oct 19, 2022
@sapphi-red
Copy link
Member

This is happening because of #8659 and vitest needs to use the new option introduced by #10071.
The downstream issue is this one: vitest-dev/vitest#1484

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Nov 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants