From 784b737d837a3083f302a19f625cdd2caa517ab2 Mon Sep 17 00:00:00 2001 From: Hakan Dilek Date: Thu, 14 Jun 2018 09:58:45 +0200 Subject: [PATCH 1/5] integrate tape-run for test runs --- .travis.yml | 7 +++++++ package.json | 8 ++++---- test/binary.js | 2 +- test/browserify.js | 41 ----------------------------------------- test/fill.js | 2 +- test/offset.js | 2 +- test/run.js | 12 ++++++++++++ test/unary.js | 2 +- 8 files changed, 27 insertions(+), 49 deletions(-) delete mode 100644 test/browserify.js create mode 100644 test/run.js diff --git a/.travis.yml b/.travis.yml index bcd34f9..f6c1f9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,7 @@ +addons: + apt: + packages: + - xvfb language: node_js node_js: - 0.12 @@ -6,3 +10,6 @@ node_js: 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..4ba9b0e --- /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(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") { From b62a328d8a5f3ed105dc67e8ec61491967d482df Mon Sep 17 00:00:00 2001 From: Hakan Dilek Date: Thu, 14 Jun 2018 10:07:51 +0200 Subject: [PATCH 2/5] skip npm install --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f6c1f9c..0c1bd76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,4 +12,3 @@ before_install: - npm install npm@latest -g - export DISPLAY=':99.0' - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & - - npm install From bf28c8d1cf61dc9a0353e953fc603d7cda5917ae Mon Sep 17 00:00:00 2001 From: Hakan Dilek Date: Thu, 14 Jun 2018 10:56:30 +0200 Subject: [PATCH 3/5] skip installing latest npm --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0c1bd76..db8802b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,6 @@ node_js: - 5 before_install: - - npm install npm@latest -g - export DISPLAY=':99.0' - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & + - npm install From 6df51db39bf21709bb4b7468b8f6a76f88f5b654 Mon Sep 17 00:00:00 2001 From: Hakan Dilek Date: Thu, 14 Jun 2018 13:01:48 +0200 Subject: [PATCH 4/5] node 0.x compatible function call --- test/run.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/run.js b/test/run.js index 4ba9b0e..0082d80 100644 --- a/test/run.js +++ b/test/run.js @@ -3,7 +3,7 @@ var browserify = require('browserify'); var cases = [ "basic", "unary", "binary", "offset", "fill" ] -cases.forEach(test => { +cases.forEach(function(test) { browserify(__dirname + '/' + test + '.js') .bundle() .pipe(run()) From cb5cff159a9a2209e7bf67a812bcc62bc5bf2f0f Mon Sep 17 00:00:00 2001 From: Hakan Dilek Date: Wed, 4 Jul 2018 08:58:33 +0200 Subject: [PATCH 5/5] ci runs on newer versions of nodejs --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index db8802b..4cb779a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,13 @@ addons: - xvfb language: node_js node_js: - - 0.12 - 4 - 5 + - 6 + - 7 + - 8 + - 9 + - 10 before_install: - export DISPLAY=':99.0'