diff --git a/CHANGELOG.md b/CHANGELOG.md
index 72ab8b8..772d4d1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,12 @@
* added favicon.ico
-
+ * testing
+ - updated wallaby.js and karma.conf.js
+ - updated app.component.spec.ts
+
+
+
# 0.1.15 (2016-04-13)
* Add testing support
* npm scripts
diff --git a/app/app.component.spec.ts b/app/app.component.spec.ts
index 78d87df..da0f507 100644
--- a/app/app.component.spec.ts
+++ b/app/app.component.spec.ts
@@ -5,7 +5,7 @@ import {
expect, it, iit, xit,
describe, ddescribe, xdescribe,
beforeEach, beforeEachProviders, withProviders,
- inject, injectAsync, TestComponentBuilder
+ async, inject, TestComponentBuilder
} from 'angular2/testing';
import { By } from 'angular2/platform/browser';
@@ -13,11 +13,6 @@ import { provide } from 'angular2/core';
import { ViewMetadata } from 'angular2/core';
import { PromiseWrapper } from 'angular2/src/facade/promise';
-interface Done {
- (): void;
- fail: (err: any) => void;
-}
-
//////// SPECS /////////////
/// Delete this
@@ -28,33 +23,33 @@ describe('Smoke test', () => {
});
describe('AppComponent with new', function () {
- it('should instantiate component', () => {
- expect(new AppComponent()).not.toBeNull('Whoopie!');
- });
+ it('should instantiate component', () => {
+ expect(new AppComponent()).toBeDefined('Whoopie!');
+ });
});
describe('AppComponent with TCB', function () {
it('should instantiate component',
- injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
+ async(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
- return tcb.createAsync(AppComponent).then(fixture => {
- expect(fixture.componentInstance instanceof AppComponent).toBe(true, 'should create AppComponent');
- });
- }));
+ tcb.createAsync(AppComponent).then(fixture => {
+ expect(fixture.componentInstance instanceof AppComponent).toBe(true, 'should create AppComponent');
+ });
+ })));
it('should have expected
text',
- injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
+ async(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
- return tcb.createAsync(AppComponent).then(fixture => {
- // fixture.detectChanges(); // needed for a binding; we don't have a binding
+ tcb.createAsync(AppComponent).then(fixture => {
+ // fixture.detectChanges(); // would need to resolve a binding but we don't have a binding
- let h1 = fixture.debugElement.query(el => el.name === 'h1').nativeElement; // it works
+ let h1 = fixture.debugElement.query(el => el.name === 'h1').nativeElement; // it works
- h1 = fixture.debugElement.query(By.css('h1')).nativeElement; // preferred
+ h1 = fixture.debugElement.query(By.css('h1')).nativeElement; // preferred
- expect(h1.innerText).toMatch(/angular 2 app/i, ' should say something about "Angular 2 App"');
- });
+ expect(h1.innerText).toMatch(/angular 2 app/i, ' should say something about "Angular 2 App"');
+ });
- }));
+ })));
});
diff --git a/karma.conf.js b/karma.conf.js
index a587ce8..6331801 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -1,7 +1,7 @@
module.exports = function(config) {
var appBase = 'app/'; // transpiled app JS files
- var appAssets = 'base/app/'; // component assets fetched by Angular's compiler
+ var appAssets ='/base/app/'; // component assets fetched by Angular's compiler
config.set({
basePath: '',
@@ -20,23 +20,32 @@ module.exports = function(config) {
flags: ['--no-sandbox']
}
},
-
files: [
- // Angular and shim libraries loaded by Karma
- { pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true },
- { pattern: 'node_modules/es6-shim/es6-shim.js', included: true, watched: true },
- { pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true },
- { pattern: 'node_modules/rxjs/bundles/Rx.js', included: true, watched: true },
- { pattern: 'node_modules/angular2/bundles/angular2.js', included: true, watched: true },
- { pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true },
-
- // External libraries loaded by Karma
- { pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: true },
- { pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: true },
- { pattern: 'node_modules/a2-in-memory-web-api/web-api.js', included: true, watched: true },
-
- // Configures module loader w/ app and specs, then launch karma
- { pattern: 'karma-test-shim.js', included: true, watched: true },
+ // System.js for module loading
+ 'node_modules/systemjs/dist/system-polyfills.js',
+ 'node_modules/systemjs/dist/system.src.js',
+
+ // Polyfills
+ 'node_modules/es6-shim/es6-shim.js',
+ 'node_modules/angular2/bundles/angular2-polyfills.js',
+
+ // Zone.js dependencies
+ // Note - do not include zone.js itself or long-stack-trace-zone.js` here as
+ // they are included already in angular2-polyfills
+ 'node_modules/zone.js/dist/jasmine-patch.js',
+ 'node_modules/zone.js/dist/async-test.js',
+ 'node_modules/zone.js/dist/fake-async-test.js',
+
+ // RxJs
+ 'node_modules/rxjs/bundles/Rx.js',
+
+ // Angular 2 itself and the testing library
+ 'node_modules/angular2/bundles/angular2.js',
+ 'node_modules/angular2/bundles/router.dev.js',
+ 'node_modules/angular2/bundles/http.dev.js',
+ 'node_modules/angular2/bundles/testing.dev.js',
+
+ 'karma-test-shim.js',
// transpiled application & spec code paths loaded via module imports
{pattern: appBase + '**/*.js', included: false, watched: true},
@@ -47,7 +56,7 @@ module.exports = function(config) {
{pattern: appBase + '**/*.css', included: false, watched: true},
// paths for debugging with source maps in dev tools
- {pattern: appBase + '**/*.ts', included: false, watched: true},
+ {pattern: appBase + '**/*.ts', included: false, watched: false},
{pattern: appBase + '**/*.js.map', included: false, watched: false}
],
diff --git a/wallaby.js b/wallaby.js
index a0023a7..2f8c437 100644
--- a/wallaby.js
+++ b/wallaby.js
@@ -5,12 +5,22 @@ module.exports = function () {
return {
files: [
- {pattern: 'node_modules/es6-shim/es6-shim.js', instrument: false},
+ // System.js for module loading
+ {pattern: 'node_modules/systemjs/dist/system-polyfills.js', instrument: false},
{pattern: 'node_modules/systemjs/dist/system.js', instrument: false},
- {pattern: 'node_modules/reflect-metadata/Reflect.js', instrument: false},
- {pattern: 'node_modules/zone.js/dist/zone.js', instrument: false},
- {pattern: 'node_modules/zone.js/dist/long-stack-trace-zone.js', instrument: false},
+
+ // Polyfills
+ {pattern: 'node_modules/es6-shim/es6-shim.js', instrument: false},
+ {pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', instrument: false},
+
+ // Zone.js dependencies
+ // Note - do not include zone.js itself or long-stack-trace-zone.js` here as
+ // they are included already in angular2-polyfills
{pattern: 'node_modules/zone.js/dist/jasmine-patch.js', instrument: false},
+ {pattern: 'node_modules/zone.js/dist/async-test.js', instrument: false},
+ {pattern: 'node_modules/zone.js/dist/fake-async-test.js', instrument: false},
+
+ // Rx.js, Angular 2 itself, and the testing library not here because loaded by systemjs
{pattern: 'app/**/*+(ts|html|css)', load: false},
{pattern: 'app/**/*.spec.ts', ignore: true}