Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Unit testing #3

Merged
merged 9 commits into from
Sep 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# @AngularClass
# http://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,3 @@ jspm_packages

# Optional REPL history
.node_repl_history

typings/
19 changes: 19 additions & 0 deletions cli/watch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const path = require('path');
const spawn = require('cross-spawn');

module.exports = () => {
const npmProcess = spawn(
'node',
[
'--max-old-space-size=4096',
'node_modules/karma/bin/karma',
'start',
path.resolve(__dirname, '..', 'config/karma/local.karma.conf.js'),
'--auto-watch',
'--no-single-run'
],
{
stdio: 'inherit'
}
);
};
16 changes: 16 additions & 0 deletions config/karma/local.karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @author: @AngularClass
*/

module.exports = function (config) {
'use strict';

require('./shared.karma.conf')(config);

config.set({
browsers: [
'Chrome'
]
});

};
49 changes: 49 additions & 0 deletions config/karma/shared.karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Common Karma configuration shared between local / CI testing.
*/
module.exports = function (config) {
'use strict';

let testWebpackConfig = require('../test.webpack.config');
let remapIstanbul = require('remap-istanbul');

config.set({
basePath: '',
frameworks: ['jasmine'],
exclude: [],
files: [
{
pattern: '../../utils/spec-bundle.js',
watched: false
},
// {
// pattern: '../utils/spec-styles.js',
// watched: false
// }
],
preprocessors: {
// '../utils/spec-styles.js': ['webpack'],
'../../utils/spec-bundle.js': ['coverage', 'webpack', 'sourcemap']
},
webpack: testWebpackConfig,
coverageReporter: {
dir: '../../coverage/',
reporters: [
{ type: 'json' },
{ type: 'html' }
],
_onWriteReport: function (collector) {
return remapIstanbul.remap(collector.getFinalCoverage());
}
},
webpackServer: {
noInfo: true
},
reporters: ['mocha', 'coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
singleRun: true
});
};
139 changes: 139 additions & 0 deletions config/test.webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
const path = require('path');

var ProvidePlugin = require('webpack/lib/ProvidePlugin');
var DefinePlugin = require('webpack/lib/DefinePlugin');

var ENV = process.env.ENV = process.env.NODE_ENV = 'test';

var srcPath = path.resolve(process.cwd(), 'src');

const resolves = [
process.cwd(),
path.join(process.cwd(), 'node_modules'),
path.join(__dirname, '..'),
path.join(__dirname, '..', 'node_modules')
];

module.exports = {

devtool: 'inline-source-map',

resolveLoader: {
root: resolves
},
resolve: {
root: resolves,
extensions: [
'',
'.js',
'.ts'
],
},

debug: true,

module: {

preLoaders: [
{
test: /\.ts$/,
loader: 'tslint-loader',
exclude: [path.resolve(srcPath, '..', 'node_modules')]
},

{
test: /\.js$/,
loader: 'source-map-loader',
exclude: [
// these packages have problems with their sourcemaps
path.resolve(srcPath, 'node_modules')
]
}

],

loaders: [
{
test: /\.ts$/,
loaders: [
'ts-loader?silent=true',
'angular2-template-loader'
]
},

{
test: /\.ts$/,
loader: 'ts-loader',
exclude: [/\.e2e\.ts$/]
},

{
test: /\.json$/,
loader: 'json-loader'
},

{
test: /\.css$/,
loader: 'raw-loader'
},

{
test: /\.html$/,
loader: 'raw-loader'
},

{
test: /\.scss$/,
loader: 'raw-loader!sass-loader'
}

],

postLoaders: [

// {
// test: /\.(js|ts)$/,
// loader: 'istanbul-instrumenter-loader!source-map-inline-loader',
// include: srcPath,
// exclude: [
// /\.(e2e|spec)\.ts$/,
// /node_modules/,
// /index\.ts/,
// /fixtures/,
// /testing/
// ]
// }

]
},

plugins: [

new DefinePlugin({
'ENV': JSON.stringify(ENV),
'HMR': false,
'process.env': {
'ENV': JSON.stringify(ENV),
'NODE_ENV': JSON.stringify(ENV),
'HMR': false
},
'ROOT_DIR': JSON.stringify(srcPath)
}),
],

tslint: {
emitErrors: false,
failOnHint: false,
resourcePath: 'src'
},

node: {
global: 'window',
process: false,
crypto: 'empty',
module: false,
clearImmediate: false,
setImmediate: false
}

};
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ module.exports = {
case 'serve':
require('./cli/serve')(argv, skyPagesConfig, webpack, WebpackDevServer);
break;
case 'watch':
require('./cli/watch')();
break;
case 'version':
require('./cli/version')();
break;
Expand Down
40 changes: 27 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "SKY Pages output for skyux2.",
"main": "index.js",
"scripts": {
"postinstall": "typings -- install",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand All @@ -19,38 +18,53 @@
},
"homepage": "https://github.com/blackbaud/sky-pages-out-skyux2#readme",
"dependencies": {
"@angular/common": "2.0.0-rc.6",
"@angular/compiler": "2.0.0-rc.6",
"@angular/core": "2.0.0-rc.6",
"@angular/http": "2.0.0-rc.6",
"@angular/platform-browser": "2.0.0-rc.6",
"@angular/platform-browser-dynamic": "2.0.0-rc.6",
"@angular/router": "3.0.0-rc.2",
"@angular/common": "2.0.0-rc.7",
"@angular/compiler": "2.0.0-rc.7",
"@angular/core": "2.0.0-rc.7",
"@angular/http": "2.0.0-rc.7",
"@angular/platform-browser": "2.0.0-rc.7",
"@angular/platform-browser-dynamic": "2.0.0-rc.7",
"@angular/router": "3.0.0-rc.3",
"@types/jasmine": "2.2.33",
"@types/node": "6.0.38",
"angular2-template-loader": "0.5.0",
"blackbaud-skyux2": "2.0.0-alpha.2",
"blackbaud-skyux2": "2.0.0-alpha.3",
"codelyzer": "0.0.28",
"core-js": "2.4.1",
"cross-spawn": "4.0.0",
"extract-text-webpack-plugin": "1.0.1",
"glob": "7.0.5",
"html-webpack-plugin": "2.22.0",
"jasmine-core": "2.5.1",
"karma": "1.2.0",
"karma-chrome-launcher": "1.0.1",
"karma-coverage": "1.1.1",
"karma-jasmine": "1.0.2",
"karma-mocha-reporter": "2.1.0",
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "1.8.0",
"merge": "1.2.0",
"node-sass": "3.8.0",
"progress-bar-webpack-plugin": "1.9.0",
"raw-loader": "0.5.1",
"reflect-metadata": "0.1.3",
"remap-istanbul": "devCrossNet/remap-istanbul",
"rxjs": "5.0.0-beta.11",
"sass-loader": "^4.0.0",
"sass-loader": "4.0.2",
"source-map-inline-loader": "blackbaud-bobbyearl/source-map-inline-loader",
"source-map-loader": "0.1.5",
"style-loader": "0.13.1",
"ts-helpers": "1.1.1",
"ts-loader": "0.8.2",
"typescript": "1.8.10",
"typings": "1.3.2",
"tslint": "3.15.1",
"tslint-loader": "2.1.5",
"typescript": "2.0.0",
"webpack": "1.13.1",
"webpack-dev-server": "1.15.1",
"webpack-fail-plugin": "1.0.5",
"webpack-md5-hash": "0.0.5",
"webpack-merge": "0.14.1",
"winston": "2.2.0",
"zone.js": "0.6.17"
"zone.js": "0.6.21"
}
}
6 changes: 0 additions & 6 deletions typings.json

This file was deleted.

Loading