Add browser tests via karma
This commit is contained in:
1 parent
8cbf2d3e0e
commit
ef4e03dc40
5 files changed
+81
-3
No files matched your search
@@ -7,3 +7,6 @@ typings/
|
||||
typings.json
|
||||
node_modules/
|
||||
dist/
|
||||
*.env
|
||||
coverage/
|
||||
npm-debug.log
|
||||
+6
-1
@@ -1,3 +1,4 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- "5"
|
||||
@@ -6,10 +7,14 @@ node_js:
|
||||
- "8"
|
||||
- "node"
|
||||
|
||||
sudo: false
|
||||
addons:
|
||||
chrome: stable
|
||||
firefox: latest
|
||||
|
||||
script:
|
||||
- npm test
|
||||
- npm run lint
|
||||
- npm run browser-test
|
||||
|
||||
git:
|
||||
depth: 1
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
var testContext = require.context("../src", true, /\.spec\.ts$/);
|
||||
|
||||
function requireAll(context) {
|
||||
return context.keys().map(context);
|
||||
}
|
||||
|
||||
var modules = requireAll(testContext);
|
||||
@@ -0,0 +1,54 @@
|
||||
module.exports = function(config) {
|
||||
var configuration = {
|
||||
frameworks: ["jasmine"],
|
||||
files: [
|
||||
{pattern: './ci/spec-bundle.js', watched: false}
|
||||
],
|
||||
preprocessors: {
|
||||
'./ci/spec-bundle.js': ['webpack', 'sourcemap'],
|
||||
},
|
||||
webpackMiddleware: {
|
||||
scripts: 'errors-only'
|
||||
},
|
||||
webpack: {
|
||||
devtool: "inline-source-map",
|
||||
resolve: {
|
||||
extensions: ['.ts', '.js'],
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
exclude: /node_modules/,
|
||||
use: [{loader: 'ts-loader', options: {transpileOnly: true}}]
|
||||
}
|
||||
]
|
||||
},
|
||||
},
|
||||
mime: {
|
||||
'text/x-typescript': ['ts', 'tsx']
|
||||
},
|
||||
reporters: ["progress"],
|
||||
browsers: ["ChromeHeadless", "FirefoxHeadless"],
|
||||
customLaunchers: {
|
||||
ChromeHeadlessTravis: {
|
||||
base: "ChromeHeadless",
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
concurrency: 8,
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-chrome-launcher',
|
||||
'karma-firefox-launcher',
|
||||
'karma-webpack',
|
||||
'karma-sourcemap-loader'
|
||||
]
|
||||
};
|
||||
|
||||
if (process.env.TRAVIS) {
|
||||
configuration.browsers = ['ChromeHeadlessTravis', 'FirefoxHeadless'];
|
||||
}
|
||||
|
||||
config.set(configuration);
|
||||
}
|
||||
+11
-2
@@ -13,11 +13,20 @@
|
||||
"gulp-tslint": "^8.1.2",
|
||||
"gulp-typescript": "^3.2.3",
|
||||
"tslint": "^5.8.0",
|
||||
"typescript": "^2.6.2"
|
||||
"typescript": "^2.6.2",
|
||||
"webpack": "^3.10.0",
|
||||
"karma": "^2.0.0",
|
||||
"karma-jasmine": "^1.1.1",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-firefox-launcher": "^1.1.0",
|
||||
"karma-webpack": "^2.0.9",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"ts-loader": "^3.3.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "gulp test",
|
||||
"lint": "gulp lint"
|
||||
"lint": "gulp lint",
|
||||
"browser-test": "karma start --single-run"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
Reference in new issue
Block a user