-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from emyann/develop
Feat(Tests): Release including Unit Tests and Major Updates
- Loading branch information
Showing
11 changed files
with
205 additions
and
89 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 |
---|---|---|
|
@@ -6,3 +6,5 @@ typings/**/* | |
~$* | ||
*~ | ||
node_modules/ | ||
src/build/ | ||
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
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,61 @@ | ||
var webpackConf = require('./webpack.config.js'); | ||
module.exports = function (config) { | ||
config.set({ | ||
basePath:'', | ||
frameworks: ['jasmine'], | ||
files: [{ pattern: './tests/unit/spec-bundle.js', watched: false }], | ||
preprocessors: { './tests/unit/spec-bundle.js': ['coverage', 'webpack', 'sourcemap'] }, | ||
webpack: { | ||
module: webpackConf.module, | ||
resolve: webpackConf.resolve | ||
}, | ||
webpackMiddleware: { | ||
noInfo: true, | ||
stats: 'errors-only' | ||
}, | ||
reporters: ['kjhtml', 'spec', 'coverage'], | ||
// optionally, configure the reporter | ||
coverageReporter: { | ||
// specify a common output directory | ||
dir: './tests/build/reports/coverage', | ||
reporters: [ | ||
// reporters not supporting the `file` property | ||
{ type: 'html', subdir: 'report-html' }, | ||
{ type: 'lcov', subdir: 'report-lcov' }, | ||
// reporters supporting the `file` property, use `subdir` to directly | ||
// output them in the `dir` directory | ||
{ type: 'cobertura', subdir: '.', file: 'cobertura.txt' }, | ||
{ type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt' }, | ||
{ type: 'teamcity', subdir: '.', file: 'teamcity.txt' }, | ||
{ type: 'text', subdir: '.', file: 'text.txt' }, | ||
{ type: 'text-summary', subdir: '.', file: 'text-summary.txt' }, | ||
] | ||
}, | ||
specReporter: { | ||
maxLogLines: 5, // limit number of lines logged per test | ||
suppressErrorSummary: true, // do not print error summary | ||
suppressFailed: false, // do not print information about failed tests | ||
suppressPassed: false, // do not print information about passed tests | ||
suppressSkipped: true, // do not print information about skipped tests | ||
showSpecTiming: false // print the time elapsed for each spec | ||
}, | ||
customLaunchers: { | ||
Chrome_travis_ci: { | ||
base: 'Chrome', | ||
flags: ['--no-sandbox'] | ||
} | ||
}, | ||
port: 9876, | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: true, | ||
browsers: ['Chrome'], | ||
singleRun: true, | ||
concurrency: Infinity | ||
}); | ||
|
||
|
||
if (process.env.TRAVIS) { | ||
config.browsers = ['Chrome_travis_ci']; | ||
} | ||
}; |
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
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,5 @@ | ||
describe('TypeScript WebPack Starter Tests', () => { | ||
it('A good way to start building an awesome lib is by doing Unit Tests 👌🏽', () => { | ||
expect(true).toBe(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,9 @@ | ||
Error.stackTraceLimit = Infinity; | ||
|
||
var testContext = require.context('./../../src', true, /\.spec\.ts/); | ||
|
||
function requireAll(requireContext) { | ||
return requireContext.keys().map(requireContext); | ||
} | ||
|
||
var modules = requireAll(testContext); |
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 |
---|---|---|
@@ -1,66 +1,77 @@ | ||
const webpack = require('webpack'); | ||
const path = require('path'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const DashboardPlugin = require('webpack-dashboard/plugin'); | ||
const nodeEnv = process.env.NODE_ENV || 'development'; | ||
const isProd = nodeEnv === 'production'; | ||
const webpack = require("webpack"); | ||
const path = require("path"); | ||
const HtmlWebpackPlugin = require("html-webpack-plugin"); | ||
const DashboardPlugin = require("webpack-dashboard/plugin"); | ||
const nodeEnv = process.env.NODE_ENV || "development"; | ||
const isProd = nodeEnv === "production"; | ||
|
||
var config = { | ||
devtool: isProd ? 'hidden-source-map' : 'cheap-eval-source-map', | ||
context: path.resolve('./src'), | ||
entry: { | ||
app: './index.ts', | ||
vendor: './vendor.ts' | ||
}, | ||
output: { | ||
path: path.resolve('./dist'), | ||
filename: '[name].bundle.js', | ||
sourceMapFilename: '[name].map', | ||
devtoolModuleFilenameTemplate: function (info) { | ||
return "file:///" + info.absoluteResourcePath; | ||
} | ||
}, | ||
module: { | ||
rules: [ | ||
{ enforce: 'pre', test: /\.ts$/, exclude: ["node_modules"], loader: 'ts-loader' }, | ||
{ test: /\.html$/, loader: "html" }, | ||
{ test: /\.css$/, loaders: ['style', 'css'] } | ||
] | ||
}, | ||
resolve: { | ||
extensions: [".ts", ".js"], | ||
modules: [path.resolve('./src'), 'node_modules'] | ||
}, | ||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
'process.env': { // eslint-disable-line quote-props | ||
NODE_ENV: JSON.stringify(nodeEnv) | ||
} | ||
}), | ||
new HtmlWebpackPlugin({ | ||
title: 'Typescript Webpack Starter', | ||
template: '!!ejs-loader!src/index.html' | ||
}), | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: 'vendor', | ||
minChunks: Infinity, | ||
filename: 'vendor.bundle.js' | ||
}), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { warnings: false }, | ||
output: { comments: false }, | ||
sourceMap: false | ||
}), | ||
new DashboardPlugin(), | ||
new webpack.LoaderOptionsPlugin({ | ||
options: { | ||
tslint: { | ||
emitErrors: true, | ||
failOnHint: true | ||
} | ||
} | ||
}) | ||
devtool: isProd ? "hidden-source-map" : "source-map", | ||
context: path.resolve("./src"), | ||
entry: { | ||
app: "./index.ts", | ||
vendor: "./vendor.ts" | ||
}, | ||
output: { | ||
path: path.resolve("./dist"), | ||
filename: "[name].bundle.js", | ||
sourceMapFilename: "[name].bundle.map", | ||
devtoolModuleFilenameTemplate: function (info) { | ||
return "file:///" + info.absoluteResourcePath; | ||
} | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
enforce: "pre", | ||
test: /\.ts?$/, | ||
exclude: ["node_modules"], | ||
use: ["awesome-typescript-loader", "source-map-loader"] | ||
}, | ||
{ test: /\.html$/, loader: "html-loader" }, | ||
{ test: /\.css$/, loaders: ["style-loader", "css-loader"] } | ||
] | ||
}, | ||
resolve: { | ||
extensions: [".ts", ".js"] | ||
}, | ||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
"process.env": { | ||
// eslint-disable-line quote-props | ||
NODE_ENV: JSON.stringify(nodeEnv) | ||
} | ||
}), | ||
new HtmlWebpackPlugin({ | ||
title: "Typescript Webpack Starter", | ||
template: "!!ejs-loader!src/index.html" | ||
}), | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: "vendor", | ||
minChunks: Infinity, | ||
filename: "vendor.bundle.js" | ||
}), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { warnings: false }, | ||
output: { comments: false }, | ||
sourceMap: true | ||
}), | ||
new DashboardPlugin(), | ||
new webpack.LoaderOptionsPlugin({ | ||
options: { | ||
tslint: { | ||
emitErrors: true, | ||
failOnHint: true | ||
} | ||
} | ||
}) | ||
], | ||
devServer: { | ||
contentBase: path.join(__dirname, "dist/"), | ||
compress: true, | ||
port: 3000, | ||
hot: true | ||
} | ||
}; | ||
|
||
module.exports = config; |