This repository has been archived by the owner on Aug 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrading various packages, updating readme, switching repo url, add …
…code coverage and better karma test support
- Loading branch information
Plum-Crazy
committed
Sep 12, 2017
1 parent
9c96c6f
commit 41be4e2
Showing
22 changed files
with
295 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea/ | ||
node_modules/ | ||
dist/ | ||
dist/ | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
var webpack = require('webpack'); | ||
var HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
var helpers = require('../helpers'); | ||
|
||
module.exports = { | ||
entry: { | ||
'polyfills': './src/polyfills.ts', | ||
'vendor': './src/vendor.ts', | ||
'app': './src/main.ts' | ||
}, | ||
|
||
resolve: { | ||
extensions: [ | ||
'.js', '.ts' | ||
] | ||
}, | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
use: [ 'awesome-typescript-loader?configFileName=config/tsconfig.json', 'angular2-template-loader' ] | ||
}, | ||
{ | ||
test: /\.html$/, | ||
use: 'html-loader' | ||
}, | ||
{ | ||
test: /\.pug$/, | ||
use: [ 'raw-loader', 'pug-html-loader' ] | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
exclude: /node_modules/, | ||
use: [ 'raw-loader', 'css-loader', 'sass-loader' ] | ||
}, | ||
{ | ||
test: /\.(png|jpe?g|gif|svg|woff|woff2|otf|ttf|eot|ico)$/, | ||
use: 'file-loader?name=assets/[name].[hash].[ext]' | ||
}, | ||
{ | ||
test: /\.css$/, | ||
exclude: helpers.root('src', 'app'), | ||
use: [ 'raw-loader', 'css-loader' ] | ||
} | ||
] | ||
}, | ||
|
||
plugins: [ | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: [ 'app', 'vendor', 'polyfills' ] | ||
}), | ||
|
||
new HtmlWebpackPlugin({ | ||
template: 'src/index.html' | ||
}), | ||
|
||
new webpack.ContextReplacementPlugin( | ||
/angular(\\|\/)core(\\|\/)@angular/, | ||
helpers.root('src'), // location of your src | ||
{} | ||
) | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
var webpackMerge = require('webpack-merge'); | ||
var commonConfig = require('./webpack.common.js'); | ||
var helpers = require('../helpers'); | ||
|
||
module.exports = webpackMerge(commonConfig, { | ||
devtool: 'cheap-module-eval-source-map', | ||
|
||
output: { | ||
path: helpers.root('dist'), | ||
publicPath: 'http://localhost:3000/', | ||
filename: '[name].js', | ||
chunkFilename: '[id].chunk.js' | ||
}, | ||
|
||
devServer: { | ||
historyApiFallback: true, | ||
stats: 'minimal'/*, | ||
TODO setup when REST service ready | ||
proxy: { | ||
'/api/**': { | ||
target: 'http://localhost:8080/your-rest-service', | ||
secure: false, | ||
changeOrigin: true | ||
} | ||
}*/ | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Error.stackTraceLimit = Infinity; | ||
|
||
require("core-js/es6"); | ||
require("reflect-metadata"); | ||
|
||
require("zone.js/dist/zone"); | ||
require("zone.js/dist/long-stack-trace-zone"); | ||
require("zone.js/dist/proxy"); | ||
require("zone.js/dist/sync-test"); | ||
require("zone.js/dist/jasmine-patch"); | ||
require("zone.js/dist/async-test"); | ||
require("zone.js/dist/fake-async-test"); | ||
|
||
const testing = require("@angular/core/testing"); | ||
const browser = require("@angular/platform-browser-dynamic/testing"); | ||
|
||
// Prevent Karma from running prematurely. | ||
__karma__.loaded = function () {}; | ||
|
||
// First, initialize the Angular testing environment. | ||
testing.TestBed.initTestEnvironment( | ||
browser.BrowserDynamicTestingModule, | ||
browser.platformBrowserDynamicTesting() | ||
); | ||
// Then we find all the tests. | ||
const context = require.context('../../src', true, /\.spec\.ts$/); | ||
// And load the modules. | ||
context.keys().map(context); | ||
// Finally, start Karma to run the tests. | ||
__karma__.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
var webpackConfig = require('./webpack.test'); | ||
|
||
module.exports = function(config) { | ||
config.set({ | ||
basePath: '', | ||
files: [ | ||
{ | ||
pattern: './karma-test-shim.js', | ||
watched: false | ||
} | ||
], | ||
preprocessors: { | ||
'./karma-test-shim.js': [ | ||
'webpack', 'sourcemap' | ||
] | ||
}, | ||
frameworks: [ 'jasmine' ], | ||
plugins: [ | ||
require('karma-jasmine'), | ||
require('karma-chrome-launcher'), | ||
require('karma-jasmine-html-reporter'), | ||
require('karma-coverage-istanbul-reporter'), | ||
require('karma-webpack'), | ||
require('karma-sourcemap-loader') | ||
], | ||
client:{ | ||
clearContext: false | ||
}, | ||
webpack: webpackConfig, | ||
coverageIstanbulReporter: { | ||
reports: [ 'html', 'lcovonly' ], | ||
fixWebpackSourcePaths: true, | ||
remapOptions: { | ||
exclude: /\*.spec.ts/ | ||
} | ||
}, | ||
reporters: [ 'progress', /*'kjhtml', */'coverage-istanbul' ], | ||
port: 9876, | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: true, | ||
browsers: [ 'Chrome' ], | ||
singleRun: true | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
var webpack = require('webpack'); | ||
var helpers = require('../helpers'); | ||
|
||
module.exports = { | ||
devtool: 'inline-source-map', | ||
|
||
resolve: { | ||
extensions: [ '.ts', '.js' ] | ||
}, | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
use: [ 'istanbul-instrumenter-loader', 'awesome-typescript-loader?configFileName=config/tsconfig.json', 'angular2-template-loader' ], | ||
exclude: /\.spec\.ts$/ | ||
}, | ||
{ | ||
test: /\.html$/, | ||
use: 'html-loader' | ||
}, | ||
{ | ||
test: /\.pug$/, | ||
use: [ 'raw-loader', 'pug-html-loader' ] | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
exclude: /node_modules/, | ||
use: [ 'raw-loader', 'sass-loader' ] | ||
}, | ||
{ | ||
test: /\.css$/, | ||
include: helpers.root('src', 'app'), | ||
use: 'raw-loader' | ||
} | ||
] | ||
}, | ||
|
||
plugins: [ | ||
new webpack.ContextReplacementPlugin( | ||
/angular(\\|\/)core(\\|\/)@angular/, | ||
helpers.root('src'), | ||
{} | ||
) | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.