[Pkg-javascript-commits] [node-invariant] 04/04: enable build-time tests and autopkgtests
Paolo Greppi
paolog-guest at moszumanska.debian.org
Fri Dec 2 15:48:11 UTC 2016
This is an automated email from the git hooks/post-receive script.
paolog-guest pushed a commit to branch master
in repository node-invariant.
commit 20229b25f46c798f0b1660c15675465f18f58258
Author: Paolo Greppi <paolo.greppi at libpf.com>
Date: Fri Dec 2 15:46:52 2016 +0000
enable build-time tests and autopkgtests
---
debian/control | 2 +
debian/patches/00_mocha.diff | 113 +++++++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
debian/rules | 6 +--
debian/tests/control | 3 ++
test/package/development.js | 12 +++--
test/package/production.js | 10 ++--
test/test.js | 31 +-----------
8 files changed, 135 insertions(+), 43 deletions(-)
diff --git a/debian/control b/debian/control
index 70cdedf..827159f 100644
--- a/debian/control
+++ b/debian/control
@@ -6,6 +6,8 @@ Uploaders: Paolo Greppi <paolo.greppi at libpf.com>
Build-Depends:
debhelper (>= 9)
, dh-buildinfo
+ , node-loose-envify
+ , mocha
, nodejs
Standards-Version: 3.9.8
Homepage: https://github.com/zertosh/invariant#readme
diff --git a/debian/patches/00_mocha.diff b/debian/patches/00_mocha.diff
new file mode 100644
index 0000000..c6b912c
--- /dev/null
+++ b/debian/patches/00_mocha.diff
@@ -0,0 +1,113 @@
+Description: Change from tap to mocha as test runner, disable
+ browserify & flow tests.
+Forwarded: not-needed
+Author: Paolo Greppi <paolo.greppi at libpf.com>
+
+Index: node-invariant/test/package/development.js
+===================================================================
+--- node-invariant.orig/test/package/development.js
++++ node-invariant/test/package/development.js
+@@ -1,19 +1,21 @@
+-module.exports = function(t) {
++var assert = require('assert');
++
++module.exports = function() {
+ var invariant = require('../../');
+
+- t.doesNotThrow(function() {
++ assert.doesNotThrow(function() {
+ invariant(true, 'invariant message');
+ });
+
+- t.throws(function() {
++ assert.throws(function() {
+ invariant(false, 'invariant message');
+ }, /invariant message/);
+
+- t.throws(function() {
++ assert.throws(function() {
+ invariant(true);
+ }, /requires an error/i);
+
+- t.throws(function() {
++ assert.throws(function() {
+ invariant(false);
+ }, /requires an error/i);
+ };
+Index: node-invariant/test/package/production.js
+===================================================================
+--- node-invariant.orig/test/package/production.js
++++ node-invariant/test/package/production.js
+@@ -1,19 +1,21 @@
++var assert = require('assert');
++
+ module.exports = function(t) {
+ var invariant = require('../../');
+
+- t.doesNotThrow(function() {
++ assert.doesNotThrow(function() {
+ invariant(true, 'invariant message');
+ });
+
+- t.throws(function() {
++ assert.throws(function() {
+ invariant(false, 'invariant message');
+ }, /invariant message/);
+
+- t.doesNotThrow(function() {
++ assert.doesNotThrow(function() {
+ invariant(true);
+ });
+
+- t.throws(function() {
++ assert.throws(function() {
+ invariant(false);
+ }, /minified exception occurred/i);
+ };
+Index: node-invariant/test/test.js
+===================================================================
+--- node-invariant.orig/test/test.js
++++ node-invariant/test/test.js
+@@ -1,7 +1,5 @@
+ 'use strict';
+
+-var browserify = require('browserify');
+-var test = require('tap').test;
+ var vm = require('vm');
+ var flow = require('flow-bin');
+ var execFile = require('child_process').execFile;
+@@ -9,33 +7,6 @@ var path = require('path');
+
+ var file = __dirname + '/package/' + process.env.NODE_ENV + '.js';
+
+-test('node', function(t) {
+- t.plan(4);
++test('node', function() {
+ require(file)(t);
+ });
+-
+-test('browserify', function(t) {
+- t.plan(7);
+- var b = browserify({
+- entries: file,
+- standalone: 'package'
+- });
+- b.bundle(function(err, src) {
+- t.notOk(err);
+- t.notMatch(String(src), /\bprocess\.env\.NODE_ENV\b/);
+- t.notMatch(String(src), /__DEV__/);
+- var c = {};
+- vm.runInNewContext(src, c);
+- c.package(t);
+- });
+-});
+-
+-test('flow', function(t) {
+- t.plan(1);
+- execFile(flow, ['coverage', 'index.js'], {
+- cwd: path.join(__dirname, 'flow')
+- }, function (err, stdout) {
+- // If the types are broken, we'd have coverage below 100%
+- t.equal(stdout.trim(), 'Covered: 100.00% (5 of 5 expressions)');
+- });
+-});
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..09164d3
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+00_mocha.diff
diff --git a/debian/rules b/debian/rules
index de57af0..b549f43 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,7 +9,5 @@
#override_dh_auto_build:
-#override_dh_auto_test:
-
-
-
+override_dh_auto_test:
+ mocha -u tdd
diff --git a/debian/tests/control b/debian/tests/control
index fc26c31..56e2f21 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,2 +1,5 @@
Tests: require
Depends: node-invariant
+
+Test-Command: mocha -u tdd
+Depends: @, @builddeps@
diff --git a/test/package/development.js b/test/package/development.js
index 0840691..2718491 100644
--- a/test/package/development.js
+++ b/test/package/development.js
@@ -1,19 +1,21 @@
-module.exports = function(t) {
+var assert = require('assert');
+
+module.exports = function() {
var invariant = require('../../');
- t.doesNotThrow(function() {
+ assert.doesNotThrow(function() {
invariant(true, 'invariant message');
});
- t.throws(function() {
+ assert.throws(function() {
invariant(false, 'invariant message');
}, /invariant message/);
- t.throws(function() {
+ assert.throws(function() {
invariant(true);
}, /requires an error/i);
- t.throws(function() {
+ assert.throws(function() {
invariant(false);
}, /requires an error/i);
};
diff --git a/test/package/production.js b/test/package/production.js
index efef0f0..4d5f094 100644
--- a/test/package/production.js
+++ b/test/package/production.js
@@ -1,19 +1,21 @@
+var assert = require('assert');
+
module.exports = function(t) {
var invariant = require('../../');
- t.doesNotThrow(function() {
+ assert.doesNotThrow(function() {
invariant(true, 'invariant message');
});
- t.throws(function() {
+ assert.throws(function() {
invariant(false, 'invariant message');
}, /invariant message/);
- t.doesNotThrow(function() {
+ assert.doesNotThrow(function() {
invariant(true);
});
- t.throws(function() {
+ assert.throws(function() {
invariant(false);
}, /minified exception occurred/i);
};
diff --git a/test/test.js b/test/test.js
index 4ad480c..c69c3c1 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1,7 +1,5 @@
'use strict';
-var browserify = require('browserify');
-var test = require('tap').test;
var vm = require('vm');
var flow = require('flow-bin');
var execFile = require('child_process').execFile;
@@ -9,33 +7,6 @@ var path = require('path');
var file = __dirname + '/package/' + process.env.NODE_ENV + '.js';
-test('node', function(t) {
- t.plan(4);
+test('node', function() {
require(file)(t);
});
-
-test('browserify', function(t) {
- t.plan(7);
- var b = browserify({
- entries: file,
- standalone: 'package'
- });
- b.bundle(function(err, src) {
- t.notOk(err);
- t.notMatch(String(src), /\bprocess\.env\.NODE_ENV\b/);
- t.notMatch(String(src), /__DEV__/);
- var c = {};
- vm.runInNewContext(src, c);
- c.package(t);
- });
-});
-
-test('flow', function(t) {
- t.plan(1);
- execFile(flow, ['coverage', 'index.js'], {
- cwd: path.join(__dirname, 'flow')
- }, function (err, stdout) {
- // If the types are broken, we'd have coverage below 100%
- t.equal(stdout.trim(), 'Covered: 100.00% (5 of 5 expressions)');
- });
-});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-invariant.git
More information about the Pkg-javascript-commits
mailing list