Skip to content

Commit

Permalink
Add test for excluded builtin module
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Apr 25, 2018
1 parent bf97b85 commit 0047b78
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/browser_field_builtin.js
Expand Up @@ -21,3 +21,20 @@ test('no browser field builtin', function (t) {
function log (msg) { t.deepEqual(msg, { a: 'b' }) }
});
});

test('no browser field excluded builtin', function (t) {
t.plan(2);
var src = fs.readFileSync(path.join(__dirname, '/browser_field_builtin/main.js'));
fs.writeFileSync(path.join(tmpdir, 'main.js'), src);
var b = browserify({
entries: path.join(tmpdir, 'main.js'),
builtins: ['path', 'util'],
browserField: false
});
b.bundle(function (err, src) {
t.ifError(err);
t.throws(function () {
vm.runInNewContext(src, { console: { log: function(){} } });
}, /Cannot find module 'querystring'/)
});
})

0 comments on commit 0047b78

Please sign in to comment.