Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

add test suite and fixes #3 #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
language: node_js
node_js:
- "6"
- "5"
branches:
only:
- master
- test
env :
- BROWSSER=chromium_browser
addons:
firefox: 'latest'
cache:
directories:
- node_modules
before_script:
- 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: npm run test
after_success:
- npm run coverage
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# webstomp-client
[![Build Status](https://travis-ci.org/yeyu456/webstomp-client.svg?branch=master)](https://travis-ci.org/yeyu456/webstomp-client)
[![Coverage Status](https://coveralls.io/repos/github/yeyu456/webstomp-client/badge.svg?branch=master)](https://coveralls.io/github/yeyu456/webstomp-client?branch=master)

This library provides a [stomp](https://stomp.github.io/) client for Web browsers and nodejs through Web Sockets.

Expand Down
111 changes: 111 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// Karma configuration
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/!(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'
}
},
webpackMiddleware: {
noInfo:true
},
reporters: ['progress', 'coverage'],
coverageReporter: {
dir: 'test/tmp/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_DISABLE,
// 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'];
}
};
20 changes: 18 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,26 @@
"jshint": "^2.9.1",
"opn-cli": "^3.1.0",
"webpack": "^1.12.14",
"ws": "^1.0.1"
"isparta-loader": "^2.0.0",
"ws": "^1.0.1",
"sockjs": "^0.3.17",
"sockjs-client": "^1.1.1",
"del": "^2.2.0",
"mocha": "^2.5.3",
"chai": "^3.5.0",
"karma": "^0.13.22",
"karma-mocha": "^1.0.1",
"karma-webpack": "^1.7.0",
"karma-chrome-launcher": "^1.0.1",
"karma-ie-launcher": "^1.0.0",
"karma-firefox-launcher": "^1.0.0",
"karma-coverage": "^1.0.0",
"coveralls": "^2.11.9",
"core-js": "^2.4.0"
},
"scripts": {
"test": "echo \"TODO: add tests\"",
"test": "node ./test/test.js",
"coverage": "cat ./test/tmp/coverage/chrome/coverage.info | ./node_modules/coveralls/bin/coveralls.js",
"build": "webpack && webpack -p --config webpack.min.config.js",
"dev": "webpack --watch",
"example": "webpack && opn http://localhost:8080/example & http-server",
Expand Down
Loading