ravi-mone / angular2-lab Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.