forked from jamesshore/lets_code_javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpack.js
More file actions
28 lines (25 loc) · 682 Bytes
/
pack.js
File metadata and controls
28 lines (25 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var test = require('tap').test;
var pack = require('../');
test('pack', function (t) {
t.plan(4);
var p = pack();
var src = '';
p.on('data', function (buf) { src += buf });
p.on('end', function () {
var r = Function(['T'], 'return ' + src)(t);
t.equal(r('xyz')(5), 555);
t.equal(r('xyz')(5), 555);
});
p.end(JSON.stringify([
{
id: 'abc',
source: 'T.equal(require("./xyz")(3), 333)',
entry: true,
deps: { './xyz': 'xyz' }
},
{
id: 'xyz',
source: 'T.ok(true); module.exports=function(n){return n*111}'
}
]));
});