karma-jasmine

Error: You need to include some adapter that implements __karma__.start method

断了今生、忘了曾经 提交于 2019-11-26 16:19:24
问题 I'm trying to add some unit tests to one of my projects. So far I've installed and configured karma, and have installed jasmine. I've one test file in my test/ folder. The karma server has started, the browser page is ready, but karma run fails as follows: $ karma run karma-conf.js [2014-06-14 15:19:11.046] [DEBUG] config - Loading config /foo/test/karma-conf.js Waiting for previous execution... Chrome 35.0.1916 (Linux) ERROR You need to include some adapter that implements __karma__.start

Testing - Can't resolve all parameters for (ClassName)

﹥>﹥吖頭↗ 提交于 2019-11-26 11:26:52
问题 Context I created an ApiService class to be able to handle our custom API queries, while using our own serializer + other features. ApiService \'s constructor signature is: constructor(metaManager: MetaManager, connector: ApiConnectorService, eventDispatcher: EventDispatcher); MetaManager is an injectable service that handles api\'s metadatas. ApiConnectorService is a service which is wrapping Http to add our custom headers and signature system. EventDispatcher is basically Symfony\'s event

Getting “Mismatched anonymous define() module…” when I try running tests

こ雲淡風輕ζ 提交于 2019-11-26 11:18:09
问题 I am trying to configure my karma jasmine unit testing with requirejs. But each time i run it, i am getting the below error: Chrome 34.0.1847 (Mac OS X 10.9.2) ERROR Uncaught Error: Mismatched anonymous define() module: function (angular){ describe(\'Unit: Testing RequireJS\', function(){ var ctrl; var scope; var rootScope; beforeEach(angular.mock.module(\'wsaApp\')); beforeEach(angular.mock...<omitted>...ch Below are differenr file: spec file: define([\'angular\'], function(angular){

Angular 2 Testing - Async function call - when to use

独自空忆成欢 提交于 2019-11-26 10:59:49
问题 When do you use the async function in the TestBed when testing in Angular 2? When do you use this? beforeEach(() => { TestBed.configureTestingModule({ declarations: [MyModule], schemas: [NO_ERRORS_SCHEMA], }); }); And when do you use this? beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [MyModule], schemas: [NO_ERRORS_SCHEMA], }); })); Can anyone enlighten me on this ? 回答1: async will not allow the next test to start until the async finishes all its tasks. What async

Angular 2/4/6/7 - Unit Testing with Router

断了今生、忘了曾经 提交于 2019-11-26 08:10:29
问题 In Angular 2.0.0, I am unit testing a component that uses Router. However I get the \'Supplied parameters do not match any signature of call target.\' error. In Visual studio code in spec.ts it is the new Router() that is highlighted in red I really appreciate if someone could let me know what the correct syntax would be? Thanks in advance. My code as follows: spec.ts import { TestBed, async } from \'@angular/core/testing\'; import { NavToolComponent } from \'./nav-tool.component\'; import {

CUSTOM_ELEMENTS_SCHEMA added to NgModule.schemas still showing Error

白昼怎懂夜的黑 提交于 2019-11-26 07:18:52
问题 I just upgraded from Angular 2 rc4 to rc6 and having troubles doing so. I see the following error on my console: Unhandled Promise rejection: Template parse errors: \'cl-header\' is not a known element: 1. If \'cl-header\' is an Angular component, then verify that it is part of this module. 2. If \'cl-header\' is a Web Component then add \"CUSTOM_ELEMENTS_SCHEMA\" to the \'@NgModule.schema\' of this component to suppress this message. (\"<main> [ERROR ->]<cl-header>Loading Header...</cl

Angular 2 Karma Test &#39;component-name&#39; is not a known element

可紊 提交于 2019-11-26 04:20:22
问题 In the AppComponent, I\'m using the nav component in the HTML code. The UI looks fine. No errors when doing ng serve. and no errors in console when I look at the app. But when I ran Karma for my project, there is an error: Failed: Template parse errors: \'app-nav\' is not a known element: 1. If \'app-nav\' is an Angular component, then verify that it is part of this module. 2. If \'app-nav\' is a Web Component then add \'CUSTOM_ELEMENTS_SCHEMA\' to the \'@NgModule.schemas\' of this component