NativeScript 测试失败 运行
NativeScript tests fail to run
测试在模拟器中出现 运行,因为应用程序短暂启动时显示 "Testing in Progress" 然后 "Total: 0, Passed: 0, Failed: 0" 的文字(拍摄了模拟器 window 的视频) .
这是一个使用 TypeScript 的 NativeScript Angular 项目。我尝试了一个 src/app/tests/example.js
和 src/app/tests/example.ts
的例子,如下所示:
// A sample Jasmine test
describe('A suite', () => {
it('contains spec with an expectation', () => {
expect(true).toBe(true);
});
});
运行宁 tns test ios
之后的最后几行日志。
Skipping prepare.
Successfully transferred all files.
Refreshing application...
Successfully synced application [redacted] on device CFB71B33-F348-452D-8069-E846D46A246D.
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:54:28: NSUTR: fetching http://127.0.0.1:9876/context.json
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:54:28: NSUTR: fetching http://10.0.1.15:9876/context.json
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:60:32: NSUTR: found karma at 127.0.0.1
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:97:20: NSUTR: connecting to karma at http://127.0.0.1:9876
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:60:32: NSUTR: found karma at 10.0.1.15
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:116:24: NSUTR: successfully connected to karma
08 10 2018 15:56:45.224:INFO [NativeScript / 11.4 (11.4; iPhone)]: Connected on socket 1gPBBxKC1KDaVXesAAAA with id NativeScriptUnit-3023
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:159:20: NSUTR: downloading http://127.0.0.1:9876/context.json
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:200:32: NSUTR: eval script /base/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?a1eb923d36d1ca53b93387cb5312668373ad9ef2
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:200:32: NSUTR: eval script /base/node_modules/karma-jasmine/lib/boot.js?945a38bf4e45ad2770eb94868231905a04a0bd3e
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:200:32: NSUTR: eval script /base/node_modules/karma-jasmine/lib/adapter.js?6cf71867f538f40db053c1775b2c56a83696375c
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:212:24: NSUTR: beginning test run
NativeScript / 11.4 (11.4; iPhone): Executed 0 of 0 SUCCESS (0 secs / 0 secs)
NativeScript / 11.4 (11.4; iPhone): Executed 0 of 0 ERROR (0.006 secs / 0 secs)
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:258:24: NSUTR: completeAck
NativeScript / 11.4 (11.4; iPhone) ERROR
Disconnectedclient disconnected from CONNECTED state
NativeScript / 11.4 (11.4; iPhone): Executed 0 of 0 ERROR (0.006 secs / 0 secs)
Package.json 版本:
"nativescript-unit-test-runner": "^0.3.4",
"@types/jasmine": "~2.8.9",
"jasmine-core": "3.2.1",
"karma": "3.0.0",
"karma-jasmine": "1.1.2",
"karma-nativescript-launcher": "0.4.0",
编辑 也发生在 Android。
我把测试放在了错误的文件夹中。尝试了 src/tests
和 src/app/tests
。注意到提到了 app/tests
,但认为它意味着 src/app
。
N.B. tns test init
没有在 app/tests
.
中创建任何文件
测试在模拟器中出现 运行,因为应用程序短暂启动时显示 "Testing in Progress" 然后 "Total: 0, Passed: 0, Failed: 0" 的文字(拍摄了模拟器 window 的视频) .
这是一个使用 TypeScript 的 NativeScript Angular 项目。我尝试了一个 src/app/tests/example.js
和 src/app/tests/example.ts
的例子,如下所示:
// A sample Jasmine test
describe('A suite', () => {
it('contains spec with an expectation', () => {
expect(true).toBe(true);
});
});
运行宁 tns test ios
之后的最后几行日志。
Skipping prepare.
Successfully transferred all files.
Refreshing application...
Successfully synced application [redacted] on device CFB71B33-F348-452D-8069-E846D46A246D.
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:54:28: NSUTR: fetching http://127.0.0.1:9876/context.json
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:54:28: NSUTR: fetching http://10.0.1.15:9876/context.json
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:60:32: NSUTR: found karma at 127.0.0.1
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:97:20: NSUTR: connecting to karma at http://127.0.0.1:9876
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:60:32: NSUTR: found karma at 10.0.1.15
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:116:24: NSUTR: successfully connected to karma
08 10 2018 15:56:45.224:INFO [NativeScript / 11.4 (11.4; iPhone)]: Connected on socket 1gPBBxKC1KDaVXesAAAA with id NativeScriptUnit-3023
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:159:20: NSUTR: downloading http://127.0.0.1:9876/context.json
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:200:32: NSUTR: eval script /base/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?a1eb923d36d1ca53b93387cb5312668373ad9ef2
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:200:32: NSUTR: eval script /base/node_modules/karma-jasmine/lib/boot.js?945a38bf4e45ad2770eb94868231905a04a0bd3e
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:200:32: NSUTR: eval script /base/node_modules/karma-jasmine/lib/adapter.js?6cf71867f538f40db053c1775b2c56a83696375c
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:212:24: NSUTR: beginning test run
NativeScript / 11.4 (11.4; iPhone): Executed 0 of 0 SUCCESS (0 secs / 0 secs)
NativeScript / 11.4 (11.4; iPhone): Executed 0 of 0 ERROR (0.006 secs / 0 secs)
CONSOLE LOG file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:258:24: NSUTR: completeAck
NativeScript / 11.4 (11.4; iPhone) ERROR
Disconnectedclient disconnected from CONNECTED state
NativeScript / 11.4 (11.4; iPhone): Executed 0 of 0 ERROR (0.006 secs / 0 secs)
Package.json 版本:
"nativescript-unit-test-runner": "^0.3.4",
"@types/jasmine": "~2.8.9",
"jasmine-core": "3.2.1",
"karma": "3.0.0",
"karma-jasmine": "1.1.2",
"karma-nativescript-launcher": "0.4.0",
编辑 也发生在 Android。
我把测试放在了错误的文件夹中。尝试了 src/tests
和 src/app/tests
。注意到提到了 app/tests
,但认为它意味着 src/app
。
N.B. tns test init
没有在 app/tests
.