[Pkg-javascript-commits] [node-browser-pack] 93/141: not found test

Bastien Roucariès rouca at moszumanska.debian.org
Thu May 4 10:23:28 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-browser-pack.

commit d4f7d7322195c73ca182bc264740e1d6e479da78
Author: James Halliday <mail at substack.net>
Date:   Thu Jul 24 15:23:40 2014 -0700

    not found test
---
 test/not_found.js | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/test/not_found.js b/test/not_found.js
new file mode 100644
index 0000000..e8ca46b
--- /dev/null
+++ b/test/not_found.js
@@ -0,0 +1,34 @@
+var test = require('tape');
+var pack = require('../');
+var concat = require('concat-stream');
+
+test('not found', function (t) {
+    t.plan(6);
+    
+    var p = pack({ raw: true, hasExports: true });
+    var src = '';
+    p.pipe(concat(function (src) {
+        var r = Function(['T'], 'return ' + src)(t);
+        t.equal(r('xyz')(5), 555);
+        t.equal(r('xyz')(5), 555);
+        t.throws(function() {
+            r('zzz');
+        }, /Cannot find module 'zzz'/);
+        try { r('zzz') }
+        catch (err) { t.equal(err.code, 'MODULE_NOT_FOUND') }
+    }));
+    
+    p.write({
+        id: 'abc',
+        source: 'T.equal(require("./xyz")(3), 333)',
+        entry: true,
+        deps: { './xyz': 'xyz' }
+    });
+    
+    p.write({
+        id: 'xyz',
+        source: 'T.ok(true); module.exports=function(n){return n*111}'
+    });
+    
+    p.end();
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-browser-pack.git



More information about the Pkg-javascript-commits mailing list