karma

IE not connected by Karma Runner using VSTS Gulp task

匿名 (未验证) 提交于 2019-12-03 01:40:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am facing an issue with my build pipeline using VSTS. Environment details are: Agent server is Windows Server 2012 R2 The VSTS agent is running on network service For running my client side test cases, I have created a gulp task. Karma runner is used with IE as the browser launcher. The issue I am facing here is with IE as browser in karma.conf file. Whenever this gulp task is ran using VSTS then the karma runner is not connecting. The output is: [ 33m20 09 2018 17 : 32 : 43.924 : WARN [ IE 11.0 . 0 ( Windows 8.1 . 0.0 )]: [

Jasmin + karma: “Error: Unexpected value 'HttpClient' imported by the module 'DynamicTestModule'. Please add a @NgModule annotation.”

匿名 (未验证) 提交于 2019-12-03 01:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using jasmine as a test framework and karma as a test runner. I'm trying to create an HttpClient object so I could create a service that as a depedency to this object: TestBed.configureTestingModule({ declarations: [HttpClient], imports: [HttpClient], providers: [HttpClient] }); TestBed.get(HttpClient); But I'm getting the following error: Error: Unexpected value 'HttpClient' imported by the module 'DynamicTestModule'. Please add a @NgModule annotation. Any one have an idea how to solve this? Follows all the code: import { I18nService }

Karma Start Fails - HeadlessChrome - ERROR Uncaught [object Object]

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using Karma to run test on my Angular 4 app. It works locally but when it runs on my host environment (Travis CI) it fails with the following information: INFO [HeadlessChrome 0.0.0 (Ubuntu 0.0.0)]: Connected on socket vT0QnQaqRkn010dfsw with id 10189531 HeadlessChrome 0.0.0 (Ubuntu 0.0.0): Executed 0 of 180 SUCCESS (0 secs / 0 secs) e 0.0.0 (Ubuntu 0.0.0): Executed 1 of 180 SUCCESS (0 secs / 0.714 secs) HeadlessChrome 0.0.0 (Ubuntu 0.0.0) ERROR Uncaught [object Object] at http://localhost:9876/_karma_webpack_/vendor.bundle.js:14078 I

Don't work $compile in Jasmine Karma Angular

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: ( function () { 'use strict' ; angular . module ( 'app.widgets' ) . directive ( 'analiticsHere' , analitics ); function analitics () { var directive = { template : '<div>hello world</div>' }; return directive ; } })(); Create simple directive. Ant try to test it. inject ( function ( $compile , $rootScope , $templateCache ){ compile = $compile ; scope = $rootScope . $new (); template = $templateCache . get ( 'scripts/widgets/templates/Analytics.html' ); console . log ( template ); //return nothing var element = angular . element ( '

Jasmine, Karma, Angular how to write test on my Angular app?

匿名 (未验证) 提交于 2019-12-03 01:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have just jumped to another project and, basically, I have been asked to write Unit tests. Since I have already know Protractor for e2e testing, I now switched to Karma and Jasmine to carry out unit testing. I have already downloaded karma, jasmine, karma-jasmine, and karma-chrome-launcher. I installed angular-mocks as well so I should be ready to start. I have read many things on the internet but, now, what I really need is a concrete example of a real app to figure out how to start writing tests. I don't need easy examples but concrete

Karma unit testing: Module name “react” has not been loaded yet for context: _. Use require([])

匿名 (未验证) 提交于 2019-12-03 01:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to set up the unit testing framework for react. While doing so, the following error has occurred. I have searched all over the internet with no solution that is working. below are the errors shown and code/packages that I am using. debug error 04 03 2016 04 : 48 : 46.340 : DEBUG [ phantomjs . launcher ]: Error : Module name "react" has not been loaded yet for context : _ . Use require ([]) http : //requirejs.org/docs/errors.html#notloaded 04 03 2016 04 : 48 : 46.341 : DEBUG [ phantomjs . launcher ]: http : //localhost

Karma - Chrome failed 2 times (cannot start). Giving up

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been trying to run my tests using karma-chrome-launcher, but everytime I run my tests it throws this error: INFO [launcher]: Starting browser Chrome ERROR [launcher]: Cannot start Chrome INFO [launcher]: Trying to start Chrome again (1/2). ERROR [launcher]: Cannot start Chrome INFO [launcher]: Trying to start Chrome again (2/2). ERROR [launcher]: Cannot start Chrome ERROR [launcher]: Chrome failed 2 times (cannot start). Giving up. Here's my karma.conf.js code: // Karma configuration // Generated on Mon Mar 23 2015 14:04:19 GMT-0300

How to make travis execute Angular tests on Chrome (“Please set env variable CHROME_BIN”)

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm working on a sample Angular project generated by yeoman. I am able to run karma tests locally (I set system variable CHROME_BIN to point to chromium binary, but this could have been done in more elegant way. Just a quick work-around.) However, when attempting to produce a successful build with travis, I get following error: ERROR [launcher]: Cannot start Chrome Can not find the binary google-chrome Please set env variable CHROME_BIN I've followed the steps described here (basically using generator-travis-ci ) Then tried to fix it with

Disconnected (1 times), because no message in 10000 ms using Karma-Jasmine

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Using Karma runner with jasmine. After all the configuration done, I type on terminal the below command: karma start public/javascripts/karma.conf.js But I am getting the below error where my browser is getting closed. INFO [karma]: Karma v0.12.16 server started at http://localhost:9876/ INFO [launcher]: Starting browser Chrome INFO [Chrome 34.0.1847 (Mac OS X 10.9.2)]: Connected on socket hDO3pMdVNGcBMDx4FI0w with id 60695552 WARN [Chrome 34.0.1847 (Mac OS X 10.9.2)]: Disconnected (1 times), because no message in 10000 ms. I changed the

Cannot find module error when using karma-webpack

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the following karma.conf.js file, I also have a test file called example.spec.js that lives inside app/compontents/example/example.spec.js I am trying to import my Example.js file import Example from 'app/components/Example/Example.jsx'; describe('Example Component', function() { }); But I get the following error Error: Cannot find module "app/components/Example/Example.jsx" I have tried many different ideas, such as ./Example.jsx , ./Example , components/Example/Example.jsx but each time I get the same error. var webpack = require(