[Pkg-javascript-commits] [node-invariant] 01/02: restore files from upstream in master

Paolo Greppi paolog-guest at moszumanska.debian.org
Mon Dec 12 07:36:40 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 9b6991c6bf4fb588590fffbedd27f04630a65d42
Author: Paolo Greppi <paolo.greppi at libpf.com>
Date:   Mon Dec 12 07:29:29 2016 +0000

    restore files from upstream in master
---
 test/package/development.js | 12 +++++-------
 test/package/production.js  | 10 ++++------
 test/test.js                | 31 ++++++++++++++++++++++++++++++-
 3 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/test/package/development.js b/test/package/development.js
index 2718491..0840691 100644
--- a/test/package/development.js
+++ b/test/package/development.js
@@ -1,21 +1,19 @@
-var assert = require('assert');
-
-module.exports = function() {
+module.exports = function(t) {
   var invariant = require('../../');
 
-  assert.doesNotThrow(function() {
+  t.doesNotThrow(function() {
     invariant(true, 'invariant message');
   });
 
-  assert.throws(function() {
+  t.throws(function() {
     invariant(false, 'invariant message');
   }, /invariant message/);
 
-  assert.throws(function() {
+  t.throws(function() {
     invariant(true);
   }, /requires an error/i);
 
-  assert.throws(function() {
+  t.throws(function() {
     invariant(false);
   }, /requires an error/i);
 };
diff --git a/test/package/production.js b/test/package/production.js
index 4d5f094..efef0f0 100644
--- a/test/package/production.js
+++ b/test/package/production.js
@@ -1,21 +1,19 @@
-var assert = require('assert');
-	
 module.exports = function(t) {
   var invariant = require('../../');
 
-  assert.doesNotThrow(function() {
+  t.doesNotThrow(function() {
     invariant(true, 'invariant message');
   });
 
-  assert.throws(function() {
+  t.throws(function() {
     invariant(false, 'invariant message');
   }, /invariant message/);
 
-  assert.doesNotThrow(function() {
+  t.doesNotThrow(function() {
     invariant(true);
   });
 
-  assert.throws(function() {
+  t.throws(function() {
     invariant(false);
   }, /minified exception occurred/i);
 };
diff --git a/test/test.js b/test/test.js
index c69c3c1..4ad480c 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1,5 +1,7 @@
 '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;
@@ -7,6 +9,33 @@ var path = require('path');
 
 var file = __dirname + '/package/' + process.env.NODE_ENV + '.js';
 
-test('node', function() {
+test('node', function(t) {
+  t.plan(4);
   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