Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing Jasmine Karma单元测试不';t在Angular2单元测试中检测我的测试用例_Unit Testing_Angular_Npm_Ionic2_Karma Jasmine - Fatal编程技术网

Unit testing Jasmine Karma单元测试不';t在Angular2单元测试中检测我的测试用例

Unit testing Jasmine Karma单元测试不';t在Angular2单元测试中检测我的测试用例,unit-testing,angular,npm,ionic2,karma-jasmine,Unit Testing,Angular,Npm,Ionic2,Karma Jasmine,在单元测试angular2/ionic2应用程序时,我遇到了一个有线问题。 我为应用程序编写了一些单元测试,当我点击npm test时,它们被正常测试。但是今天当我点击npm测试时,它没有检测到我的项目的任何单元测试。它在终端中提供以下输出 dilanka@Dilanka-NoteBook:/media/dilanka/Stuff/CODE BASE/Inspection/UnitTesting/Inspection-Rewrite$ npm test > ionic-hello-wor

在单元测试angular2/ionic2应用程序时,我遇到了一个有线问题。 我为应用程序编写了一些单元测试,当我点击
npm test
时,它们被正常测试。但是今天当我点击npm测试时,它没有检测到我的项目的任何单元测试。它在终端中提供以下输出

dilanka@Dilanka-NoteBook:/media/dilanka/Stuff/CODE BASE/Inspection/UnitTesting/Inspection-Rewrite$ npm test

> ionic-hello-world@ test /media/dilanka/Stuff/CODE BASE/Inspection/UnitTesting/Inspection-Rewrite
> ng test --code-coverage

05 12 2016 13:10:45.485:WARN [karma]: No captured browser, open http://localhost:9876/
05 12 2016 13:10:45.492:WARN [karma]: Port 9876 in use
05 12 2016 13:10:45.493:INFO [karma]: Karma v1.3.0 server started at http://localhost:9877/
05 12 2016 13:10:45.493:INFO [launcher]: Launching browser Chrome with unlimited concurrency
05 12 2016 13:10:45.497:INFO [launcher]: Starting browser Chrome
05 12 2016 13:10:47.739:INFO [Chrome 55.0.2883 (Linux 0.0.0)]: Connected on socket /#9FP78x92YrV-nPNoAAAA with id 77141340

START:

Finished in 0.003 secs / 0 secs

SUMMARY:
✔ 0 tests completed
但在其他计算机中,同样的分支毫无疑问地运行
npm install
。它检测所有的测试用例。 然后我在我的计算机上重新安装了node和
npm
。但我还是遇到了同样的情况。 然后我通过在这个项目()上运行
npm test
进行了检查,它也给出了相同的结果,并且没有检测到任何测试用例。以前这个项目在我的电脑上也运行得很好

我不明白出了什么问题。问题是我的
节点
npm
业力配置


请帮帮我。谢谢…

chrome 55版看起来有问题。今天早上我们遇到了同样的问题,我们更新了karma配置文件,使用firefox而不是chrome

要在firefox中运行测试,您需要添加karma firefox launcher插件并将浏览器更改为firefox

plugins: [
  require('karma-jasmine'),
  require('karma-firefox-launcher'),
  require('karma-remap-istanbul'),
  require('angular-cli/plugins/karma')
],


browsers: ['Firefox'],
编辑

通过在下面添加karma.conf.js文件,可以在chrome上实现这一点

mime: { 'text/x-typescript': ['ts','tsx'] }

来源:

chrome 55版似乎有问题。今天早上我们遇到了同样的问题,我们更新了karma配置文件,使用firefox而不是chrome

要在firefox中运行测试,您需要添加karma firefox launcher插件并将浏览器更改为firefox

plugins: [
  require('karma-jasmine'),
  require('karma-firefox-launcher'),
  require('karma-remap-istanbul'),
  require('angular-cli/plugins/karma')
],


browsers: ['Firefox'],
编辑

通过在下面添加karma.conf.js文件,可以在chrome上实现这一点

mime: { 'text/x-typescript': ['ts','tsx'] }

来源:

非常感谢您的回答。现在它工作得很好。我花了一整天的时间来找出错误。但我没有注意到那令人毛骨悚然的铬。这浪费了我一整天的时间。无论如何,谢谢。:)非常感谢你的回答。现在它工作得很好。我花了一整天的时间来找出错误。但我没有注意到那令人毛骨悚然的铬。这浪费了我一整天的时间。无论如何,谢谢。:)