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

--changed not propagating to yarn workspaces #4674

Closed
6 tasks done
JoeHart opened this issue Dec 5, 2023 · 1 comment · Fixed by #4693
Closed
6 tasks done

--changed not propagating to yarn workspaces #4674

JoeHart opened this issue Dec 5, 2023 · 1 comment · Fixed by #4693
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@JoeHart
Copy link

JoeHart commented Dec 5, 2023

Describe the bug

Hi there! Big fans of the project, a big thank you for all the hard work and v1.0 is great so far!

This is most likely me setting up something wrong, but have boiled it down to as minimal reproduction as I can.

If running vitest in a simple repo, or in a sub package in a workspace running vitest --changed will run only the tests connected to changed code.

When in workspaces running from the root, this fails to find changes.

Reproduction

Here is a stackblits: https://stackblitz.com/~/github.com/JoeHart/stackblitz-starters-2hovz4

Here is the github repo: https://github.com/JoeHart/stackblitz-starters-2hovz4

I can't test it inside stackblits since --changed appears to be using some sort of git command that is dissallowed.

To reproduce:

  1. Git clone the repo above with git clone git@github.com:JoeHart/stackblitz-starters-2hovz4.git
  2. Run yarn inside the repo.
  3. make a change to packages/packageA/index.js
    Here is an example new contents for the file:
export default function getLetter() {
  if (Math.random() > 0.5) {
    return 'c';
  }
  return 'c';
}

So the test should still pass but the runner should find it.

  1. In the root of the repo run yarn vitest --changed

Expected behaviour:

  • It should run the correct test

Actual behaviour:
I get this output:

 RUN  v1.0.1 /Users/joehart/workspace/pactio/stackblitz-starters-2hovz4

projects: packageA
[packageA] Config
include: **/*.{test,spec}.?(c|m)[jt]s?(x)
exclude:  **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*
watch exclude:  **/node_modules/**, **/dist/**
No test files found, exiting with code 0

✨  Done in 0.41s.

System Info

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Max
    Memory: 64.86 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.5.0 - ~/.nvm/versions/node/v18.5.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.5.0/bin/yarn
    npm: 8.12.1 - ~/.nvm/versions/node/v18.5.0/bin/npm
    Watchman: 2023.07.10.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 119.0.6045.199
    Chrome Canary: 121.0.6167.0
    Edge: 119.0.2151.97
    Safari: 17.0
    Safari Technology Preview: 17.4
  npmPackages:
    vitest: ^1.0.1 => 1.0.1

Used Package Manager

yarn

Validations

@JoeHart JoeHart changed the title --changed not propagating to yarn workspaces --changed not propagating to yarn workspaces Dec 5, 2023
@sheremet-va sheremet-va added bug p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Dec 7, 2023
@sheremet-va
Copy link
Member

Thank you for a great reproduction! Was able to find the issue in 2 minutes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants