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

Regression: generateScopedName ignored by vitest #2146

Closed
6 tasks done
Doeke opened this issue Oct 13, 2022 · 2 comments
Closed
6 tasks done

Regression: generateScopedName ignored by vitest #2146

Doeke opened this issue Oct 13, 2022 · 2 comments

Comments

@Doeke
Copy link

Doeke commented Oct 13, 2022

Describe the bug

Upgrade from vitest 0.18.1 to 0.24.1 causes my tests fail because generateScopedName setting is being ignored.

Possibly caused by this PR: #1803

I tried setting classNameStrategy to 'scoped' which should make it respect generateScopedName but it doesn't work

In the reproduction link below, tests fail unless you downgrade vitest version (eg to 0.18.1):

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-fdmmn9?file=package.json

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 2.66 GB / 15.33 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 14.19.1 - ~/.nvm/versions/node/v14.19.1/bin/node
    npm: 8.18.0 - ~/.nvm/versions/node/v14.19.1/bin/npm
  Browsers:
    Chrome: 106.0.5249.119
  npmPackages:
    @vitejs/plugin-vue: ^3.1.2 => 3.1.2 
    vite: ^3.1.7 => 3.1.7 
    vitest: ^0.24.1 => 0.24.1

Used Package Manager

npm

Validations

@sheremet-va
Copy link
Member

sheremet-va commented Oct 13, 2022

This is not a regression. You need to use css.include option, if you want your CSS files to go through Vite pipeline instead of being mocked.

@Doeke
Copy link
Author

Doeke commented Oct 13, 2022

Thanks, with this I can get my generated class names to work again:

css: { modules: { classNameStrategy: 'scoped' }, include: /.*/ },

Imo by default generated class names during tests should be the same as in production to avoid issues going undetected but w/e

@Doeke Doeke closed this as completed Oct 13, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants