gpt4 book ai didi

typescript - 找不到跟踪 : AssertionError (Karma-Typescript) 的 SourceMap 位置

转载 作者:行者123 更新时间:2023-12-04 11:15:29 25 4
gpt4 key购买 nike

我正在使用 karma-typescript 进行单元测试,并且在期望失败时遇到以下警告:

04 02 2019 15:36:12.927:WARN [reporter]: SourceMap position not found for trace: AssertionError: expected false to be true
at Object.<anonymous> (base/test/api-client.spec.js?f27f5c9809f69dd36e15c3b125fadb70e6a6487a:61:56)
at step (base/test/api-client.spec.js?f27f5c9809f69dd36e15c3b125fadb70e6a6487a:32:23)
at Object.next (base/test/api-client.spec.js?f27f5c9809f69dd36e15c3b125fadb70e6a6487a:13:53)
at fulfilled (base/test/api-client.spec.js?f27f5c9809f69dd36e15c3b125fadb70e6a6487a:4:58)
HeadlessChrome 71.0.3578 (Mac OS X 10.13.6) When determining an endpoint for service should return the resolved endpoint FAILED
AssertionError: expected false to be true
at Object.<anonymous> (test/api-client.spec.ts:23:33 <- test/api-client.spec.js:61:56)
at step (test/api-client.spec.js:32:23)
at Object.next (test/api-client.spec.js:13:53)
at fulfilled (test/api-client.spec.js:4:58)
HeadlessChrome 71.0.3578 (Mac OS X 10.13.6): Executed 1 of 1 (1 FAILED) ERROR (0.608 secs / 0.593 secs)

我的 karma 配置如下:
module.exports = function (config) {
config.set({

frameworks: ["mocha", "karma-typescript"],

files: [
{ pattern: "src/**/*.ts" },
{ pattern: "test/**/*.ts" }
],

preprocessors: {
"**/*.ts": ["karma-typescript"]
},

reporters: ["dots", "karma-typescript"],

browsers: ["ChromeHeadless"],

karmaTypescriptConfig: {
reports:
{
"html": {
"directory": "coverage",
"subdirectory": "report"
},
"text-summary": ""
},
compilerOptions: {
lib: [
"es2015",
"dom"
]
}
},

singleRun: true
});
};

我尝试添加 sourceMap: true到我的 compilerOptions 部分,但根据 karma-typescript 文档,这应该已经是真的,但这没有区别,警告仍然存在。

我有什么配置错误吗?

谢谢

最佳答案

我也遇到同样的问题。请任何人提供解决方案。我尝试禁用覆盖范围内的检测,这解决了这个问题,但在那之后我的覆盖范围不起作用。

karmaTypescriptConfig: {
coverageOptions: {
instrumentation: false,
}
}
另外,我也遇到了其他一些问题。

关于typescript - 找不到跟踪 : AssertionError (Karma-Typescript) 的 SourceMap 位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54519696/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com