-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Use Vitest instead of Jest #288
Conversation
Signed-off-by: Naoki Ikeguchi <naoki.ikeguchi@bitkey.jp>
Signed-off-by: Naoki Ikeguchi <naoki.ikeguchi@bitkey.jp>
Thank you for doing this work! I will accept and use this Pull Request.
I don't object to replacing it with |
Should we also delete the following line? happy-css-modules/eslint.config.js Line 90 in b0cafcd
|
Signed-off-by: Naoki Ikeguchi <naoki.ikeguchi@bitkey.jp>
Signed-off-by: Naoki Ikeguchi <naoki.ikeguchi@bitkey.jp>
Signed-off-by: Naoki Ikeguchi <naoki.ikeguchi@bitkey.jp>
@mizdra |
- Vitest outputted `warning: The "??" operator here will always return the left operand`
When I run $ npm run test -- runner.test.ts
...
1:17:09 AM [vite] Failed to load source map for /Users/mizdra/src/github.com/mizdra/happy-css-modules/packages/happy-css-modules/src/runner.test.ts.
Error: An error occurred while trying to read the map file at ./1.css.d.ts.map
Error: ENOENT: no such file or directory, open '/Users/mizdra/src/github.com/mizdra/happy-css-modules/packages/happy-css-modules/src/1.css.d.ts.map'
at async open (node:internal/fs/promises:638:25)
at async Object.readFile (node:internal/fs/promises:1238:14)
at async extractSourcemapFromFile (file:///Users/mizdra/src/github.com/mizdra/happy-css-modules/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:21001:53)
at async loadAndTransform (file:///Users/mizdra/src/github.com/mizdra/happy-css-modules/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:51892:27)
at async ViteNodeServer._transformRequest (file:///Users/mizdra/src/github.com/mizdra/happy-css-modules/node_modules/vite-node/dist/server.mjs:537:16)
at async ViteNodeServer._fetchModule (file:///Users/mizdra/src/github.com/mizdra/happy-css-modules/node_modules/vite-node/dist/server.mjs:499:17)
at async Proxy.fetch (file:///Users/mizdra/src/github.com/mizdra/happy-css-modules/node_modules/vitest/dist/chunks/resolveConfig.DPmbhVlP.js:6616:22)
at async EventEmitter.onMessage (file:///Users/mizdra/src/github.com/mizdra/happy-css-modules/node_modules/vitest/dist/chunks/index.68735LiX.js:91:20)
... Apparently, Vitest found the following line and misunderstood it to indicate the source map for
The following line seems to be causing the bug. It should be |
Let's ignore the Vitest bug here. If you are interested in reporting this bug to Vitest team, please do so. If you are not interested, I will do it for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for contributing!
This may be my misunderstanding. We need to check https://tc39.es/source-map/ to determine if this is a bug. |
@mizdra I checked the spec and found that whitespaces before the sourceMappingURL comment are allowed, as defined in https://tc39.es/source-map/#extraction-javascript. Thus, I think it's an expected behaviour and we cannot declare this as a Vitest's bug. |
And, this example is similar to our situation: https://tc39.es/source-map/#example-5b7659a8. This type of code can be parsed as unintentional even if the regexp starts with ^, unless Vitest parses it using AST. |
Closes #263
This pull request replaces Jest with Vitest.
At the first try, I found that Vitest does not resolve
await-lock
module correctly.The package is not maintained recently and has an issue with ESM interop.
I replaced it with
async-mutex
to resolve the issue.