Karma 测试 运行ner 没有 运行 mocha 测试
Karma test runner does not run mocha tests
当运行ning使用mocha(./node_modules/.bin/mocha test
)测试文件运行中的测试时,输出到powershell:
TEST ************
myFunc
- a pending test
0 passing (4ms)
1 pending
当 运行 使用 karma (./node_modules/.bin/karma start
) 连接同一个文件时,console.log("TEST ************");
会打印出来,但测试套件不会 运行。 Karma 给出以下输出:
10 05 2020 14:27:24.326:WARN [karma]: No captured browser, open http://localhost:9876/
10 05 2020 14:27:24.352:INFO [karma-server]: Karma v5.0.5 server started at http://0.0.0.0:9876/
10 05 2020 14:27:24.352:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
10 05 2020 14:27:24.358:INFO [launcher]: Starting browser ChromeHeadless
10 05 2020 14:27:26.898:INFO [Chrome Headless 81.0.4044.138 (Windows 10)]: Connected on socket IBnhFoW1f9d9zLHsAAAA with id 8234878
Chrome Headless 81.0.4044.138 (Windows 10) LOG: 'TEST ************'
Chrome Headless 81.0.4044.138 (Windows 10): Executed 0 of 1 (skipped 1) SUCCESS (0.004 secs / 0 secs)
TOTAL: 0 SUCCESS
test.js
console.log("TEST ************");
describe('myFunc', function() {
it("a pending test");
});
karma.conf.js
module.exports = function(config) {
config.set({
frameworks: ["mocha"],
files: [ "test/test.js"],
plugins: [
"karma-chrome-launcher",
"karma-mocha"
],
browsers: ["ChromeHeadless"]
})
}
package.json
{
"name": "karma-mocha-test",
"devDependencies": {
"karma-chrome-launcher": "^3.1.0",
"karma": "^5.0.5",
"karma-mocha": "^2.0.1",
"mocha": "^7.1.2"
}
}
我在这里缺少什么来进行 karma 运行 mocha 测试并在 powershell 中显示结果?
我缺一个记者,像这样:
,reporters: ["mocha", "coverage-istanbul"]
当运行ning使用mocha(./node_modules/.bin/mocha test
)测试文件运行中的测试时,输出到powershell:
TEST ************
myFunc
- a pending test
0 passing (4ms)
1 pending
当 运行 使用 karma (./node_modules/.bin/karma start
) 连接同一个文件时,console.log("TEST ************");
会打印出来,但测试套件不会 运行。 Karma 给出以下输出:
10 05 2020 14:27:24.326:WARN [karma]: No captured browser, open http://localhost:9876/
10 05 2020 14:27:24.352:INFO [karma-server]: Karma v5.0.5 server started at http://0.0.0.0:9876/
10 05 2020 14:27:24.352:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
10 05 2020 14:27:24.358:INFO [launcher]: Starting browser ChromeHeadless
10 05 2020 14:27:26.898:INFO [Chrome Headless 81.0.4044.138 (Windows 10)]: Connected on socket IBnhFoW1f9d9zLHsAAAA with id 8234878
Chrome Headless 81.0.4044.138 (Windows 10) LOG: 'TEST ************'
Chrome Headless 81.0.4044.138 (Windows 10): Executed 0 of 1 (skipped 1) SUCCESS (0.004 secs / 0 secs)
TOTAL: 0 SUCCESS
test.js
console.log("TEST ************");
describe('myFunc', function() {
it("a pending test");
});
karma.conf.js
module.exports = function(config) {
config.set({
frameworks: ["mocha"],
files: [ "test/test.js"],
plugins: [
"karma-chrome-launcher",
"karma-mocha"
],
browsers: ["ChromeHeadless"]
})
}
package.json
{
"name": "karma-mocha-test",
"devDependencies": {
"karma-chrome-launcher": "^3.1.0",
"karma": "^5.0.5",
"karma-mocha": "^2.0.1",
"mocha": "^7.1.2"
}
}
我在这里缺少什么来进行 karma 运行 mocha 测试并在 powershell 中显示结果?
我缺一个记者,像这样:
,reporters: ["mocha", "coverage-istanbul"]