我正在使用 webpack、typescript、jest 和 ts-jest。 我试图替换一个字符串,它可以工作,但是当我运行 jest 时它失败了。 我的 tsconfig
{
"compilerOptions": {
"outDir": "./dist/",
"noImplicitAny": true,
"module": "commonjs",
"target": "esnext",
"sourceMap": true,
"esModuleInterop": true
},
"included": ["./src"]
}
玩笑配置
module.exports = {
testMatch: [
"**/__tests__/**/*.+(ts|tsx|js)",
"**/?(*.)+(spec|test).+(ts|tsx|js)",
],
transform: {
"^.+\\.(ts|tsx)$": "ts-jest",
},
};
错误
TypeError: html.replaceAll is not a function
15 |
16 | //keyword resolver
> 17 | html = html.replaceAll(keyWordRegex(element.name), newContent);
| ^
18 | window.variables[i].content = newContent;
19 |
我该如何解决这个问题