We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
refer to: https://v2ex.com/t/746186
大神,我引用了你的这个库之后,原先能够通过的测试,就没有办法通过了。能帮忙瞧一下,哪里配置出了问题么?
谢谢
The text was updated successfully, but these errors were encountered:
@alexya jest 如果要跑 jsx / tsx 文件,最好也编译一下,保证和 webpack loader 处理后一致,如 jest 有 transform 字段配置,通常会配置 ts-jest 或 babel-jest
https://jestjs.io/docs/en/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object
// demo transform: { '^.+\\.(t|j)sx?$': [ 'ts-jest', { babelConfig: { presets: ['@babel/preset-react', '@babel/preset-env'], plugins: [ 'react-hot-loader/babel', '@babel/plugin-proposal-class-properties', '@babel/plugin-transform-runtime', ], }, }, ], },
Sorry, something went wrong.
或者在 jest 环境下就不去 import 这个库呢,
因为这个库导出的给 react 的组件是 ES module 类型的 (导出的给 node 用的 plugin 这些才是 commonjs 的),
所以目前在你的 jest 下如果不经过 babel / esm 这些转换就不支持
No branches or pull requests
refer to:
https://v2ex.com/t/746186
大神,我引用了你的这个库之后,原先能够通过的测试,就没有办法通过了。能帮忙瞧一下,哪里配置出了问题么?
谢谢
The text was updated successfully, but these errors were encountered: