diff --git a/.travis.yml b/.travis.yml index bcd34f9..4cb779a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,18 @@ +addons: + apt: + packages: + - xvfb language: node_js node_js: - - 0.12 - 4 - 5 + - 6 + - 7 + - 8 + - 9 + - 10 before_install: - - npm install npm@latest -g + - export DISPLAY=':99.0' + - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & + - npm install diff --git a/package.json b/package.json index 135dd54..4f8c717 100644 --- a/package.json +++ b/package.json @@ -14,13 +14,13 @@ "uglify-js": "^2.6.0" }, "devDependencies": { - "ndarray": "^1.0.13", "browserify": "^13.0.0", - "tape": "^4.0.0" + "ndarray": "^1.0.13", + "tape": "^4.0.0", + "tape-run": "^4.0.0" }, "scripts": { - "test": "tape test/*.js", - "pretest": "rm -f node_modules/cwise && ln -s .. node_modules/cwise" + "test": "node test/run.js" }, "repository": { "type": "git", diff --git a/test/binary.js b/test/binary.js index bcf2820..fd0d21d 100644 --- a/test/binary.js +++ b/test/binary.js @@ -1,4 +1,4 @@ -var cwise = require("cwise") +var cwise = require("..") var ndarray = require("ndarray") if(typeof test === "undefined") { diff --git a/test/browserify.js b/test/browserify.js deleted file mode 100644 index e00a1cd..0000000 --- a/test/browserify.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict" - -var browserify = require("browserify") -var vm = require("vm") -var path = require("path") -var tape = require("tape") - -var cases = [ "unary", "binary", "offset", "fill" ] - -bundleCasesFrom(0) - -function bundleCasesFrom(i) { - if (i>=cases.length) return - var b = browserify() - b.ignore("tape") - b.add(__dirname + "/" + cases[i] + ".js") - b.transform(path.normalize(__dirname + "/../cwise.js")) - tape(cases[i], function(t) { // Without nested tests, the asynchronous nature of bundle causes issues with tape... - b.bundle(function(err, src) { - if(err) { - throw new Error("failed to bundle!") - } - vm.runInNewContext(src, { - test: t.test.bind(t), - Buffer: Buffer, - Int8Array: Int8Array, - Int16Array: Int16Array, - Int32Array: Int32Array, - Float32Array: Float32Array, - Float64Array: Float64Array, - Uint8Array: Uint8Array, - Uint16Array: Uint16Array, - Uint32Array: Uint32Array, - Uint8ClampedArray: Uint8ClampedArray, - console: { log: console.log.bind(console) } - }) - t.end() - }) - }) - bundleCasesFrom(i+1) -} diff --git a/test/fill.js b/test/fill.js index 10672b5..a46fd6e 100644 --- a/test/fill.js +++ b/test/fill.js @@ -1,4 +1,4 @@ -var cwise = require("cwise") +var cwise = require("..") var ndarray = require("ndarray") if(typeof test === "undefined") { diff --git a/test/offset.js b/test/offset.js index e937c19..cb0d206 100644 --- a/test/offset.js +++ b/test/offset.js @@ -1,4 +1,4 @@ -var cwise = require("cwise") +var cwise = require("..") var ndarray = require("ndarray") if(typeof test === "undefined") { diff --git a/test/run.js b/test/run.js new file mode 100644 index 0000000..0082d80 --- /dev/null +++ b/test/run.js @@ -0,0 +1,12 @@ +var run = require('tape-run'); +var browserify = require('browserify'); + +var cases = [ "basic", "unary", "binary", "offset", "fill" ] + +cases.forEach(function(test) { + browserify(__dirname + '/' + test + '.js') + .bundle() + .pipe(run()) + .on('results', console.log) + .pipe(process.stdout); +}); diff --git a/test/unary.js b/test/unary.js index 4b33c02..b427a86 100644 --- a/test/unary.js +++ b/test/unary.js @@ -1,4 +1,4 @@ -var cwise = require("cwise") +var cwise = require("..") var ndarray = require("ndarray") if(typeof test === "undefined") {