-
-
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
fallbackCJS
is not supported
#59
Comments
Hey @dctalbot thanks for raising a new issue! As you are the first one raising that kind of issue can you provide a bit more of context:
Thanks for using vitest-fail-on-console :) |
import path from "path"
import { defineConfig } from "vitest/config"
export default () => {
return defineConfig({
test: {
setupFiles: ["./test/setupVitest.ts"],
server: {
deps: {
fallbackCJS: true,
},
},
},
resolve: {
alias: {
src: path.resolve(__dirname, "./src"),
"@test": path.resolve(__dirname, "./test"),
},
},
})
}
import failOnConsole from "vitest-fail-on-console"
failOnConsole()
➜ my-project ✗ pnpm vitest run src/ui/Menu/Menu.test.tsx
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL src/ui/Menu/Menu.test.tsx [ src/ui/Menu/Menu.test.tsx ]
TypeError: default is not a function
❯ test/setupVitest.ts:3:1
1| import failOnConsole from "vitest-fail-on-console"
2|
3| failOnConsole()
| ^
4|
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Test Files 1 failed (1)
Tests no tests
Start at 16:48:04
Duration 259ms (transform 17ms, setup 0ms, collect 0ms, tests 0ms, environment 0ms, prepare 60ms) versions: |
I think the issue may be with
Maybe the dist is detcted as invalid? Unfortunately, I need this setting as |
We're shipping both `./dist/vitest-fail-on-console.es.js` and `./dist/vitest-fail-on-console.umd.js` with "type": "module". Since Vitest only runs `esm` in the test environment (doesn't use require), we can only ship the default export as `./dist/vitest-fail-on-console.es.js` Thanks to @hi-ogawa - vitest-dev/vitest#6352 (comment)
We're shipping both `./dist/vitest-fail-on-console.es.js` and `./dist/vitest-fail-on-console.umd.js` with "type": "module". Since Vitest only runs `esm` in the test environment (doesn't use require), we can only ship the default export as `./dist/vitest-fail-on-console.es.js` Thanks to @hi-ogawa - vitest-dev/vitest#6352 (comment)
fallbackCJS
is not supported
Hey, thank you for looking at this issue! Unfortunately, |
Bug description
I think something is amiss with the packaging configuration.
Description
{type: "module"}
in mypackage.json
setup.mts
did not helpExpected outcome
Actual outcome
TypeError: default is not a function
when using this package.Screenshots / Video / StackTrace
The text was updated successfully, but these errors were encountered: