加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
jest.config.js 966 Bytes
一键复制 编辑 原始数据 按行查看 历史
shuanhukexuejia 提交于 2023-01-12 15:52 . fix: test error
const { readdirSync } = require("fs");
const { join } = require("path");
const pkgList = readdirSync(join(__dirname, "./packages")).filter(
(pkg) => pkg.charAt(0) !== "."
);
const moduleNameMapper = {
"\\.(css|less|sass|scss)$": require.resolve("identity-obj-proxy"),
uuid: require.resolve("uuid"),
};
pkgList.forEach((shortName) => {
const name = `@fortune-sheet/${shortName}`;
// Workaround for Jest not having ESM support yet
// See: https://github.com/uuidjs/uuid/issues/451
moduleNameMapper[name] = join(__dirname, `./packages/${shortName}/src`);
});
module.exports = {
collectCoverageFrom: ["packages/**/src/**/*.{ts,tsx}"],
testEnvironment: "jsdom",
moduleNameMapper,
moduleFileExtensions: ["js", "jsx", "ts", "tsx"],
transform: {
"\\.(t|j)sx?$": require.resolve("./tests/transformer"),
},
unmockedModulePathPatterns: ["node_modules/react/", "node_modules/enzyme/"],
verbose: true,
setupFiles: ["./tests/setup.js"],
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化