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

fix: toFilePath with abs path in root #1538

Merged
merged 1 commit into from Jun 24, 2022

Conversation

KentoMoriwaki
Copy link
Contributor

I'm working on a devcontainer where the workspace path is /workspace. (which is default when configured from vscode)

When I run vitest spec including expect(doc).toMatchInlineSnapshot(), the test is passed successfully but it fails to update snapshots. The error log is like below.

$ /workspace/node_modules/.bin/vitest run src/ui/consultationEditorV2/utils/convert.test.ts
Debugger attached.

 RUN  v0.15.2 /workspace

 ✓ src/ui/consultationEditorV2/utils/convert.test.ts (1)

Test Files  1 passed (1)
     Tests  1 passed (1)
      Time  6.03s (in thread 13ms, 46366.64%)

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Vitest caught 1 unhandled error during the test run. This might cause false positive tests.
Please, resolve all the errors to make sure your tests are not affected.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: Errors occurred while running tests. For more information, see serialized error.
 ❯ Object.runTests node_modules/vitest/dist/chunk-vite-node-externalize.0ec89ad1.mjs:7089:17
 ❯ processTicksAndRejections node:internal/process/task_queues:96:5
 ❯ async file:/workspace/node_modules/vitest/dist/chunk-vite-node-externalize.0ec89ad1.mjs:10369:9
 ❯ Vitest.runFiles node_modules/vitest/dist/chunk-vite-node-externalize.0ec89ad1.mjs:10379:12
 ❯ Vitest.start node_modules/vitest/dist/chunk-vite-node-externalize.0ec89ad1.mjs:10306:5
 ❯ startVitest node_modules/vitest/dist/chunk-vite-node-externalize.0ec89ad1.mjs:11074:5
 ❯ start node_modules/vitest/dist/cli.mjs:666:9
 ❯ CAC.run node_modules/vitest/dist/cli.mjs:662:3

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: {
  "errors": [
    [Error: ENOENT: no such file or directory, open '/workspace/workspace/src/ui/consultationEditorV2/utils/convert.test.ts'],
  ],
}
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

/workspace/workspace/src/ is a wrong path. the correct is /workspace/src/.
After debugging, I've found a bug in toFilePath function when given absolute path as id and root directry as base. And this will solve this problem.

@netlify
Copy link

netlify bot commented Jun 24, 2022

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 49d87f0
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/62b5b383f2aa3a0009228564
😎 Deploy Preview https://deploy-preview-1538--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@sheremet-va
Copy link
Member

Interesting, do you think this might also fix #1196 and #1534?

@KentoMoriwaki
Copy link
Contributor Author

Both seems related, I think this solves those issues!

@sheremet-va sheremet-va merged commit 34b06db into vitest-dev:main Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants