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

Unexpected include config behaviour since 0.3.0 #725

Closed
6 tasks done
JoostKersjes opened this issue Feb 10, 2022 · 4 comments · Fixed by #728
Closed
6 tasks done

Unexpected include config behaviour since 0.3.0 #725

JoostKersjes opened this issue Feb 10, 2022 · 4 comments · Fixed by #728

Comments

@JoostKersjes
Copy link

Describe the bug

This is my vitest config from vite.config.ts:

  test: {
    globals: true,
    environment: "happy-dom",
    include: ["**/__tests__/*.test.ts"],
  },

Since 0.3.0 this exact config makes Vitest also includes my **/__tests__/*.spec.ts files which I use with Cypress, so Vitest tries to run Cypress tests and fails.

I expect with my include config that only my pattern is used, and not any patterns from the default configuration.

Reproduction

https://stackblitz.com/edit/node-aakamc?file=vite.config.js

System Info

System:
    OS: Linux 5.11 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-11370H @ 3.30GHz
    Memory: 1.66 GB / 15.32 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 17.1.0 - ~/.nvm/versions/node/v17.1.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v17.1.0/bin/yarn
    npm: 8.1.3 - ~/.nvm/versions/node/v17.1.0/bin/npm
  Browsers:
    Firefox: 96.0
  npmPackages:
    @vitejs/plugin-vue: 2.2.0 => 2.2.0 
    vite: 2.8.0 => 2.8.0 
    vitest: 0.3.0 => 0.3.0

Used Package Manager

yarn

Validations

@sheremet-va
Copy link
Member

I expect with my include config that only my pattern is used, and not any patterns from the default configuration.

This was not the intention. Must be a bug.

@DerYeger
Copy link
Member

This is caused by arrays being merged.
Wasn't the intention to not merge arrays and export the default (array) values, so users can include them only in addition to their own values if required?

@sheremet-va
Copy link
Member

This is caused by arrays being merged. Wasn't the intention to not merge arrays and export the default (array) values, so users can include them only in addition to their own values if required?

Yes, this was the intention. I think deepMerge shouldn't merge arrays, this gave us so much headache in the past weeks

@DerYeger
Copy link
Member

This is caused by arrays being merged. Wasn't the intention to not merge arrays and export the default (array) values, so users can include them only in addition to their own values if required?

Yes, this was the intention. I think deepMerge shouldn't merge arrays, this gave us so much headache in the past weeks

I'll create a PR.

DerYeger added a commit to DerYeger/vitest that referenced this issue Feb 10, 2022
antfu pushed a commit that referenced this issue Feb 11, 2022
chaii3 pushed a commit to chaii3/vitest that referenced this issue May 13, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 22, 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

Successfully merging a pull request may close this issue.

3 participants