Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

test: instructions when encountering symlink error on Windows #7470

Merged

Conversation

j-maas
Copy link
Contributor

@j-maas j-maas commented Mar 26, 2022

Description

Catches the error when setting up tests on Windows as a non-admin without admin privileges (#7390) and outputs instructions on how to fix it.

The error now looks like this:

$ pnpm run test

> vite-monorepo@ test C:\Users\Johannes\Code\vite
> run-s test-serve test-build


> vite-monorepo@ test-serve C:\Users\Johannes\Code\vite
> jest

Error: Jest: Got error running globalSetup - C:\Users\Johannes\Code\vite\scripts\jestGlobalSetup.cjs, reason: Could not create symlinks. On Windows, consider activating Developer Mode to allow non-admin users to create symlinks by following the instructions at https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development.
    at C:\Users\Johannes\Code\vite\scripts\jestGlobalSetup.cjs:32:13      
    at async module.exports (C:\Users\Johannes\Code\vite\scripts\jestGlobalSetup.cjs:24:3)
    at async C:\Users\Johannes\Code\vite\node_modules\.pnpm\@jest+core@27.5.1_ts-node@10.4.0\node_modules\@jest\core\build\runGlobalHook.js:125:13  
    at async waitForPromiseWithCleanup (C:\Users\Johannes\Code\vite\node_modules\.pnpm\@jest+transform@27.5.1\node_modules\@jest\transform\build\ScriptTransformer.js:209:5)
    at async runGlobalHook (C:\Users\Johannes\Code\vite\node_modules\.pnpm\@jest+core@27.5.1_ts-node@10.4.0\node_modules\@jest\core\build\runGlobalHook.js:116:9)
    at async runJest (C:\Users\Johannes\Code\vite\node_modules\.pnpm\@jest+core@27.5.1_ts-node@10.4.0\node_modules\@jest\core\build\runJest.js:369:5)
    at async _run10000 (C:\Users\Johannes\Code\vite\node_modules\.pnpm\@jest+core@27.5.1_ts-node@10.4.0\node_modules\@jest\core\build\cli\index.js:320:7)
    at async runCLI (C:\Users\Johannes\Code\vite\node_modules\.pnpm\@jest+core@27.5.1_ts-node@10.4.0\node_modules\@jest\core\build\cli\index.js:173:3)
    at async Object.run (C:\Users\Johannes\Code\vite\node_modules\.pnpm\jest-cli@27.5.1_ts-node@10.4.0\node_modules\jest-cli\build\cli\index.js:155:37)
ELIFECYCLE  Command failed with exit code 1.
ERROR: "test-serve" exited with 1.
ELIFECYCLE  Test failed. See above for more details.

Additional context

  1. Is the error description appropriate?
  2. Is there a way to pass on the underlying error? Or is it preferable to just show the high-level error as is now?

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@patak-dev patak-dev changed the title test: add instructions when encountering symlink error on Windows test: instructions when encountering symlink error on Windows Mar 26, 2022
@patak-dev patak-dev merged commit 0d7ef43 into vitejs:main Mar 26, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants