forked from JSteunou/webstomp-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
960 additions
and
14 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
language: node_js | ||
node_js: | ||
- "6" | ||
- "5" | ||
branches: | ||
only: | ||
- master | ||
env : | ||
- BROWSSER=chromium_browser | ||
addons: | ||
firefox: 'latest' | ||
cache: | ||
directories: | ||
- node_modules | ||
before_script: | ||
- npm install -g gulp | ||
- export CHROME_BIN=chromium-browser | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
- sleep 3 # give xvfb some time to start | ||
script: gulp test | ||
after_success: | ||
- gulp 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,66 @@ | ||
'use strict'; | ||
|
||
var gulp = require('gulp'); | ||
var webpack = require('webpack'); | ||
var del = require('del'); | ||
var karma = require('karma').Server; | ||
var spawn = require('child_process').spawn; | ||
var coveralls = require('gulp-coveralls'); | ||
var node; | ||
|
||
gulp.task('clean', function(cb) { | ||
del.sync(['./dist/*']); | ||
cb(); | ||
}); | ||
|
||
gulp.task('testServer', ['clean'], function _testServer(cb) { | ||
if (node) { | ||
node.kill(); | ||
} | ||
webpack({ | ||
entry: './test/support/server-mock.js', | ||
output: { | ||
path: __dirname + '/dist/support', | ||
filename: 'server-mock.js' | ||
}, | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.js$/, | ||
loader: 'babel-loader', | ||
exclude: /node_modules/ | ||
} | ||
] | ||
}, | ||
target: 'node', | ||
resolve: { | ||
extensions: ['', '.js'] | ||
} | ||
}, function(err) { | ||
if (err) { | ||
cb(err); | ||
|
||
} else { | ||
node = spawn('node', ['./dist/support/server-mock.js'], {stdio: 'inherit'}); | ||
cb(); | ||
} | ||
}); | ||
}); | ||
|
||
gulp.task('test', ['testServer'], function _test(cb) { | ||
// jscs:disable requireCapitalizedConstructors | ||
return new karma({ | ||
configFile: __dirname + '/karma.conf.js', | ||
singleRun: true | ||
}, function _testCB(code) { | ||
if (node) { | ||
node.kill(); | ||
} | ||
cb(code); | ||
}).start(); | ||
}); | ||
|
||
gulp.task('coverage', function _coverage(cb) { | ||
return gulp.src('dist/coverage/*/coverage.info') | ||
.pipe(coveralls()); | ||
}); |
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,113 @@ | ||
// Karma configuration | ||
// Generated on Sat Jun 04 2016 17:41:44 GMT+0800 (中国标准时间) | ||
var webpack = require('karma-webpack'); | ||
|
||
module.exports = function(config) { | ||
config.set({ | ||
// base path that will be used to resolve all patterns (eg. files, exclude) | ||
basePath: '', | ||
// frameworks to use | ||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | ||
frameworks: ['mocha'], | ||
// list of files / patterns to load in the browser | ||
files: [ | ||
'node_modules/core-js/client/core.js', | ||
'test/utils-test.js', | ||
'test/frame-test.js', | ||
'test/webstomp-test.js', | ||
'test/client-test.js' | ||
], | ||
plugins: [ | ||
webpack, | ||
'karma-mocha', | ||
'karma-firefox-launcher', | ||
'karma-chrome-launcher', | ||
'karma-ie-launcher', | ||
'karma-coverage' | ||
], | ||
// list of files to exclude | ||
exclude: [], | ||
// preprocess matching files before serving them to the browser | ||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor | ||
preprocessors: { | ||
'test/*.js': ['webpack'], | ||
'src/**/*.js': ['webpack'] | ||
}, | ||
webpack: { | ||
module: { | ||
preLoaders: [ | ||
{ | ||
test: /\.js$/, | ||
loader: 'isparta', | ||
exclude: /(node_modules|test)/ | ||
} | ||
], | ||
loaders: [ | ||
{ | ||
test: /\.js$/, | ||
loader: 'babel-loader', | ||
exclude: /node_modules/ | ||
} | ||
] | ||
}, | ||
resolve: { | ||
extensions: ['', '.js'] | ||
}, | ||
externals: { | ||
ws:'WebSocket' | ||
}, | ||
debug: true | ||
}, | ||
webpackMiddleware: { | ||
noInfo: true | ||
}, | ||
reporters: ['progress', 'coverage'], | ||
coverageReporter: { | ||
dir: 'dist/coverage/', | ||
subdir: function(browser) { | ||
return browser.toLowerCase().split(/[ /-]/)[0]; | ||
}, | ||
reporters: [{ | ||
type: 'html', | ||
file: 'coverage.html' | ||
}, { | ||
type: 'lcovonly', | ||
file: 'coverage.info' | ||
}], | ||
watermarks: { | ||
statements: [60, 90], | ||
functions: [60, 90], | ||
branches: [60, 90], | ||
lines: [60, 90] | ||
} | ||
}, | ||
// web server port | ||
port: 1110, | ||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, | ||
// start these browsers | ||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher | ||
browsers: ['IE', 'Chrome'], | ||
// Continuous Integration mode | ||
// if true, Karma captures browsers, runs the tests and exits | ||
singleRun: false, | ||
|
||
// Concurrency level | ||
// how many browser should be started simultaneous | ||
concurrency: Infinity | ||
}); | ||
if (process.env.TRAVIS) { | ||
config.customLaunchers = { | ||
Chrome: { | ||
base: 'Chrome', | ||
flags: ['--no-sandbox'] | ||
} | ||
}; | ||
config.browsers = ['Firefox', 'Chrome']; | ||
} | ||
}; |
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.