Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 692aa4e

Browse files
authored
Fix karma test running with ng test (#31)
* Fix karma test running with `ng test` * re-add travis config * re-add missing saucelabs and browserstack configs * fix protractor path
1 parent ac601c8 commit 692aa4e

File tree

13 files changed

+60
-58
lines changed

13 files changed

+60
-58
lines changed

angular-cli.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
"packages": [],
3333
"e2e": {
3434
"protractor": {
35-
"config": "./config/protractor.conf.js"
35+
"config": "./protractor.conf.js"
3636
}
3737
},
3838
"test": {
3939
"karma": {
40-
"config": "./config/karma.conf.js"
40+
"config": "./karma.conf.js"
4141
}
4242
},
4343
"defaults": {
File renamed without changes.

e2e/app.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MaterialDocsAppPage } from './app.po';
1+
import {MaterialDocsAppPage} from './app.po';
22

33
describe('angular-io-v42 App', function() {
44
let page: MaterialDocsAppPage;

config/karma.conf.js renamed to karma.conf.js

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,48 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/0.13/config/configuration-file.html
13
const {customLaunchers, platformMap} = require('./browser-providers');
24
const path = require('path');
35

46
module.exports = function (config) {
57
config.set({
6-
7-
basePath: path.join(__dirname, '..'),
8-
8+
basePath: '',
99
frameworks: ['jasmine', 'angular-cli'],
10-
1110
plugins: [
1211
require('karma-jasmine'),
1312
require('karma-chrome-launcher'),
1413
require('karma-remap-istanbul'),
14+
require('angular-cli/plugins/karma'),
1515
require('karma-browserstack-launcher'),
1616
require('karma-sauce-launcher'),
17-
require('angular-cli/plugins/karma')
1817
],
19-
2018
files: [
2119
{ pattern: './src/test.ts', watched: false }
2220
],
23-
2421
preprocessors: {
2522
'./src/test.ts': ['angular-cli']
2623
},
27-
24+
mime: {
25+
'text/x-typescript': ['ts','tsx']
26+
},
2827
remapIstanbulReporter: {
2928
reports: {
3029
html: 'coverage',
31-
lcovonly: '../coverage/coverage.lcov'
30+
lcovonly: './coverage/coverage.lcov'
3231
}
3332
},
34-
3533
angularCli: {
3634
config: './angular-cli.json',
3735
environment: 'dev'
3836
},
3937
reporters: config.angularCli && config.angularCli.codeCoverage
4038
? ['progress', 'karma-remap-istanbul']
4139
: ['progress'],
42-
4340
port: 9876,
4441
colors: true,
4542
logLevel: config.LOG_INFO,
4643
autoWatch: true,
4744
browsers: ['Chrome'],
4845
singleRun: false,
49-
50-
// Custom launchers for Browserstack and Saucelabs.
5146
customLaunchers: customLaunchers,
5247

5348
sauceLabs: {
@@ -70,9 +65,8 @@ module.exports = function (config) {
7065
timeout: 600,
7166
pollingTimeout: 20000
7267
},
73-
7468
});
75-
69+
7670
if (process.env['TRAVIS']) {
7771

7872
let buildId = `TRAVIS #${process.env.TRAVIS_BUILD_NUMBER} (${process.env.TRAVIS_BUILD_ID})`;
@@ -93,5 +87,5 @@ module.exports = function (config) {
9387
}
9488

9589
config.browsers = platformMap[platformType];
96-
}
90+
}
9791
};

package.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
},
1717
"private": true,
1818
"dependencies": {
19-
"@angular/common": "~2.1.0",
20-
"@angular/compiler": "~2.1.0",
21-
"@angular/core": "~2.1.0",
22-
"@angular/forms": "~2.1.0",
23-
"@angular/http": "~2.1.0",
24-
"@angular/material": "^2.0.0-alpha.9-3",
25-
"@angular/platform-browser": "~2.1.0",
26-
"@angular/platform-browser-dynamic": "~2.1.0",
27-
"@angular/router": "~3.1.0",
19+
"@angular/common": "~2.2.3",
20+
"@angular/compiler": "~2.2.3",
21+
"@angular/core": "~2.2.3",
22+
"@angular/forms": "~2.2.3",
23+
"@angular/http": "~2.2.3",
24+
"@angular/material": "^2.0.0-alpha.11-3",
25+
"@angular/platform-browser": "~2.2.3",
26+
"@angular/platform-browser-dynamic": "~2.2.3",
27+
"@angular/router": "~3.2.3",
2828
"core-js": "^2.4.1",
2929
"fs-extra": "^1.0.0",
3030
"hapi": "^15.2.0",
@@ -34,9 +34,10 @@
3434
"zone.js": "^0.6.23"
3535
},
3636
"devDependencies": {
37+
"@angular/compiler-cli": "~2.2.3",
3738
"@types/jasmine": "^2.2.30",
3839
"@types/node": "^6.0.42",
39-
"angular-cli": "1.0.0-beta.19-3",
40+
"angular-cli": "1.0.0-beta.22-1",
4041
"codelyzer": "1.0.0-beta.1",
4142
"jasmine-core": "2.4.1",
4243
"jasmine-spec-reporter": "2.5.0",
@@ -50,7 +51,7 @@
5051
"protractor": "4.0.9",
5152
"ts-node": "1.2.1",
5253
"tslint": "3.13.0",
53-
"typescript": "~2.0.3",
54+
"typescript": "~2.0.10",
5455
"webdriver-manager": "10.2.5"
5556
}
5657
}
File renamed without changes.

config/protractor.conf.js renamed to protractor.conf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const SpecReporter = require('jasmine-spec-reporter');
77
let config = {
88
allScriptsTimeout: 11000,
99
specs: [
10-
'../e2e/**/*.e2e-spec.ts'
10+
'./e2e/**/*.e2e-spec.ts'
1111
],
1212
capabilities: {
1313
'browserName': 'chrome'
@@ -45,4 +45,4 @@ if (process.env['TRAVIS']) {
4545

4646
}
4747

48-
exports.config = config;
48+
exports.config = config;

src/app/material-docs-app.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import {Component} from '@angular/core';
22

33

44
@Component({
5+
moduleId: module.id,
56
selector: 'material-docs-app',
6-
templateUrl: 'material-docs-app.html',
7-
styleUrls: ['material-docs-app.scss'],
7+
templateUrl: './material-docs-app.html',
8+
styleUrls: ['./material-docs-app.scss'],
89
host: {
910
'[class.docs-dark-theme]': 'isDarkTheme',
1011
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
describe('component list', () => {
2+
it('should run', () => {
3+
expect(1).toBe(1);
4+
});
5+
});

src/app/pages/components/components.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { Component} from '@angular/core';
22

33
@Component({
4+
moduleId: module.id,
45
selector: 'app-components',
5-
templateUrl: 'components.html',
6-
styleUrls: ['components.scss']
6+
templateUrl: './components.html',
7+
styleUrls: ['./components.scss']
78
})
89
export class ComponentsList {
910
componentItems = [

0 commit comments

Comments
 (0)