mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Adds test for browserify
This commit adds tests to make sure that the browserify bundle will work in the dist file of clipboard.js This commit adds the mocha and chai modules, since karma doesn't work well with node only tests. Also splited tests tasks in package.json and updated .gitignore
This commit is contained in:
parent
623614a4e0
commit
4534fc4ca0
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
npm-debug.log
|
||||
bower_components
|
||||
node_modules
|
||||
|
@ -10,6 +10,8 @@ module.exports = function(karma) {
|
||||
'./node_modules/phantomjs-polyfill/bind-polyfill.js'
|
||||
],
|
||||
|
||||
exclude: ['test/node.js'],
|
||||
|
||||
preprocessors: {
|
||||
'src/**/*.js' : ['browserify'],
|
||||
'test/**/*.js': ['browserify']
|
||||
|
16
package.json
16
package.json
@ -6,9 +6,14 @@
|
||||
"main": "dist/clipboard.js",
|
||||
"browser": "src/clipboard.js",
|
||||
"browserify": {
|
||||
"transform": [["babelify", {
|
||||
"loose": "all"
|
||||
}]]
|
||||
"transform": [
|
||||
[
|
||||
"babelify",
|
||||
{
|
||||
"loose": "all"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
@ -29,6 +34,7 @@
|
||||
"karma-mocha": "^0.2.0",
|
||||
"karma-phantomjs-launcher": "^0.2.1",
|
||||
"karma-sinon": "^1.0.4",
|
||||
"mocha": "^2.3.3",
|
||||
"phantomjs-polyfill": "0.0.1",
|
||||
"uglify": "^0.1.5"
|
||||
},
|
||||
@ -36,6 +42,8 @@
|
||||
"publish": "npm run build && npm run minify",
|
||||
"build": "browserify src/clipboard.js -s Clipboard -o dist/clipboard.js",
|
||||
"minify": "uglify -s dist/clipboard.js -o dist/clipboard.min.js",
|
||||
"test": "karma start --single-run"
|
||||
"test": "npm run mocha | npm run karma",
|
||||
"karma": "karma start --single-run",
|
||||
"mocha": "mocha test/node.js"
|
||||
}
|
||||
}
|
||||
|
11
test/node.js
Normal file
11
test/node.js
Normal file
@ -0,0 +1,11 @@
|
||||
var assert = require('chai').assert;
|
||||
var browserify = require('browserify');
|
||||
|
||||
describe('Node', function() {
|
||||
it('should import the lib in a commonjs env without babel', function(done) {
|
||||
browserify('./dist/clipboard.js').bundle(function(err) {
|
||||
assert.equal(err, null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user