Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nyc for coverage #3

Closed
wants to merge 5 commits into from
Closed
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
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
node_modules/

dist/
typings/

coverage/
.nyc_output/

Expand Down
3 changes: 0 additions & 3 deletions client/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import 'angular';
import 'angular-ui-router';

import {appModuleName, appModuleVendorDependencies} from './config';

angular
Expand Down
16 changes: 1 addition & 15 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ module.exports = function (config) {
'client/**/*.ts': [
'webpack',
'sourcemap'
],
'client/**/!(*.spec).ts': [
'coverage'
]
},

Expand All @@ -35,9 +32,6 @@ module.exports = function (config) {
loaders.typescriptTest,
loaders.jade,
loaders.html
],
postLoaders: [
loaders.istanbulInstrumenter
]
},
stats: {
Expand All @@ -51,15 +45,7 @@ module.exports = function (config) {
noInfo: true // prevent console spamming when running in Karma!
},

reporters: ['mocha', 'coverage'],
coverageReporter: {
reporters: [
{ type: 'lcov' },
{ type: 'html' },
{ type: 'text-summary' }
],
dir: './coverage/client/'
},
reporters: ['mocha'],

colors: true,

Expand Down
34 changes: 24 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@
"version": "0.0.0",
"description": "",
"scripts": {
"build": "npm run clean && cross-env NODE_ENV=production webpack --progress --colors",
"prebuild": "npm run clean",
"build": "cross-env NODE_ENV=production webpack --progress --colors",
"clean": "rimraf dist/ coverage/",
"lint": "tslint 'client/**/*.ts'",
"postinstall": "npm run typings",
"start": "webpack-dev-server --inline --colors --display-error-details --display-cached",
"clean": "rimraf dist/ && rimraf coverage/",
"build": "npm run clean && webpack --progress --colors",
"test": "karma start"
"test": "npm run lint && nyc karma start",
"pretypings": "rimraf typings/",
"typings": "tsd install && tsd link"
},
"nyc": {
"extensions": [
".ts"
],
"include": [
"client/**/!(*.spec).ts"
]
},
"author": "Jason Kurian <jgkurian@me.com>",
"license": "MIT",
Expand All @@ -20,36 +29,41 @@
"chai-things": "^0.2.0",
"cross-env": "^1.0.7",
"file-loader": "^0.8.5",
"html-webpack-plugin": "^2.9.0",
"html-webpack-plugin": "^2.10.0",
"istanbul-instrumenter-loader": "^0.2.0",
"jade": "^1.11.0",
"jade-loader": "^0.8.0",
"karma": "^0.13.22",
"karma-chai": "^0.1.0",
"karma-chai-plugins": "^0.7.0",
"karma-chrome-launcher": "^0.2.2",
"karma-coverage": "^0.5.3",
"karma-coverage": "^0.5.5",
"karma-mocha": "^0.2.2",
"karma-mocha-reporter": "^1.2.3",
"karma-mocha-reporter": "^2.0.0",
"karma-sinon": "^1.0.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.7.0",
"mocha": "^2.4.5",
"ng-annotate-loader": "0.1.0",
"nyc": "^6.0.0",
"raw-loader": "^0.5.1",
"rimraf": "^2.5.2",
"sinon": "^1.17.3",
"sinon-chai": "^2.8.0",
"style-loader": "^0.13.0",
"ts-loader": "^0.8.1",
"tslint-loader": "^2.1.0",
"typescript": "^1.8.2",
"tsd": "^0.6.5",
"tslint": "^3.6.0",
"tslint-loader": "^2.1.3",
"typescript": "^1.8.7",
"url-loader": "^0.5.7",
"webpack": "^1.12.14",
"webpack-dev-server": "^1.14.1"
},
"dependencies": {
"angular": "^1.5.0",
"angular-ui-router": "^0.2.18",
"lodash": "^4.5.1"
"basscss": "^8.0.1",
"lodash": "^4.6.1"
}
}
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"version": "1.8.2",
"compilerOptions": {
"experimentalDecorators": true,
"module": "commonjs",
Expand Down
15 changes: 7 additions & 8 deletions webpack/getConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@
const path = require('path');
const webpack = require('webpack');
const htmlWebpackPlugin = require('html-webpack-plugin');
const distAbsolutePath = path.resolve(__dirname, '..', 'dist');
const loaders = require('./loaders');

module.exports = function (context) {
context = context || 'dev';
const production = context === 'prod';
const isProduction = context === 'production';
const distAbsolutePath = path.resolve(__dirname, '..', 'dist');

let plugins = [
new webpack.optimize.CommonsChunkPlugin('vendor', '[name].[hash].bundle.js'),
new htmlWebpackPlugin({
template: path.join(__dirname, '..', 'index.html'),
inject: 'body',
minify: false
minify: isProduction
})
];

if (production) {
if (isProduction) {
plugins.push(new webpack.optimize.UglifyJsPlugin());
}

return {
devtool: 'inline-source-map',
debug: !production,
debug: !isProduction,
cache: true,
verbose: true,
displayErrorDetails: true,
Expand All @@ -34,9 +35,7 @@ module.exports = function (context) {
},

entry: {
app: [
'./client/app.ts'
],
app: './client/app.ts',
vendor: [
'angular',
'angular-ui-router'
Expand Down