Code Monkey home page Code Monkey logo

angular2-lab's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

angular2-lab's Issues

Karma is failing by connecting mockend response

I am using following env:

Angular2+Angular CLI
Using PhantomJS+Jasmin+Karma
following is my karma.conf.js file:

// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: '..',
frameworks: ['jasmine'],
/plugins: [
require('karma-jasmine')
require('karma-chrome-launcher')
],
customLaunchers: {
// chrome setup for travis CI using chromium
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},/
files: [

{ pattern: 'dist/vendor/es6-shim/es6-shim.js', included: true, watched: false },
{ pattern: 'dist/vendor/zone.js/dist/zone.js', included: true, watched: false },
{ pattern: 'dist/vendor/reflect-metadata/Reflect.js', included: true, watched: false },
{ pattern: 'dist/vendor/systemjs/dist/system-polyfills.js', included: true, watched: false },
{ pattern: 'dist/vendor/systemjs/dist/system.src.js', included: true, watched: false },
{ pattern: 'dist/vendor/zone.js/dist/async-test.js', included: true, watched: false },
{ pattern: 'dist/vendor/zone.js/dist/fake-async-test.js', included: true, watched: false },

{ pattern: 'config/karma-test-shim.js', included: true, watched: true },

// Distribution folder.
{ pattern: 'dist//*', included: false, watched: true }
],
exclude: [
// Vendor packages might include spec files. We don't want to use those.
'dist/vendor/
/.spec.js'
],
preprocessors: {
'/dist/app/__/
.js': ['coverage']
},

'coverageReporter': {
type: 'html',
dir: 'coverage/'
},

reporters: ['progress','coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,

autoWatch: true,
//autoWatch: false,
//browsers: ['Chrome'],
browsers: ['PhantomJS'],
//singleRun: false
browserNoActivityTimeout: 100000,
singleRun: true
});
};

One of the test case:

import {
beforeEach, beforeEachProviders,
describe, xdescribe,
expect, it, xit,
async, inject
} from '@angular/core/testing';
import { AccountSummaryService } from './account-summary.service';
import { HTTP_PROVIDERS, RequestMethod, Response, ResponseOptions, XHRBackend, BaseRequestOptions} from '@angular/http'
import { MockBackend, MockConnection } from '@angular/http/testing';

describe('AccountSummary Service', () => {
let mockBackend: MockBackend;

beforeEachProviders(() => [
HTTP_PROVIDERS,
{ provide: XHRBackend, useClass: MockBackend },
AccountSummaryService
]);

beforeEach(inject([MockBackend], (backend: MockBackend) => {
mockBackend = backend;
}));

it('should ...',
inject([AccountSummaryService], (service: AccountSummaryService) => {
mockBackend.connections.subscribe((connection: MockConnection) => {
expect(connection.request.method).toBe(RequestMethod.Get);
expect(connection.request.url).toBe('recovery/accounts/fdfd');
expect(connection.request.getBody()).toEqual(JSON.stringify({}));
return connection.mockRespond(new Response(new ResponseOptions({ body: 'body', status: 200 })));
});

expect(service.getAccountSummary("fdfd")).toBeTruthy();
}));
});

Execution:

^Cf45c89bd8b9b:recoveries-app nai628$ ng test --no-watch
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
Built project successfully. Stored in "dist/".
DEPRECATED: use your own version of lodash, this will go away in [email protected]
DEPRECATED: use your own version of lodash, this will go away in [email protected]
12 07 2016 11:31:36.994:INFO [karma]: Karma v1.1.1 server started at http://localhost:9876/
12 07 2016 11:31:36.996:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
12 07 2016 11:31:37.001:INFO [launcher]: Starting browser PhantomJS
12 07 2016 11:31:37.519:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket /#IC5HGr-Q6SqNZ-fNAAAA with id 38920043
12 07 2016 11:31:38.335:WARN [web-server]: 404: /base/dist/traceur
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
{
"stack": null,
"originalErr": {},
"line": 821,
"sourceURL": "dist/vendor/systemjs/dist/system.src.js"
}

I am getting

12 07 2016 11:31:38.335:WARN [web-server]: 404: /base/dist/traceur
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
{
"stack": null,
"originalErr": {},
"line": 821,
"sourceURL": "dist/vendor/systemjs/dist/system.src.js"
}

I really wondering where i am getting the issue. Can you help me out. this is very serious issue for me. Appreciate in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.