Skip to content

Commit 3070fb7

Browse files
committed
Use the vm module instead of contextify
1 parent fc03288 commit 3070fb7

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
"istanbul": "latest",
2121
"jshint": "latest",
2222
"uglify-js": "latest",
23-
"coveralls": "latest",
24-
"contextify": "latest"
23+
"coveralls": "latest"
2524
},
2625
"scripts": {
2726
"test": "node ./node_modules/.bin/_mocha --reporter spec",

test/validators.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
var validator = require('../validator')
22
, format = require('util').format
3-
, contextify = require('contextify')
43
, assert = require('assert')
54
, path = require('path')
6-
, fs = require('fs');
5+
, fs = require('fs')
6+
, vm = require('vm');
77

88
var validator_js = fs.readFileSync(path.join(__dirname, '../validator.js')).toString();
99

@@ -1187,17 +1187,16 @@ describe('Validators', function () {
11871187
}
11881188
};
11891189
window.define.amd = true;
1190-
var sandbox = contextify(window);
1191-
sandbox.run(validator_js);
1192-
sandbox.dispose();
1190+
1191+
var sandbox = vm.createContext(window);
1192+
vm.runInContext(validator_js, sandbox);
11931193
assert.equal(window.validator.trim(' foobar '), 'foobar');
11941194
});
11951195

11961196
it('should bind validator to the window if no module loaders are available', function () {
11971197
var window = {};
1198-
var sandbox = contextify(window);
1199-
sandbox.run(validator_js);
1200-
sandbox.dispose();
1198+
var sandbox = vm.createContext(window);
1199+
vm.runInContext(validator_js, sandbox);
12011200
assert.equal(window.validator.trim(' foobar '), 'foobar');
12021201
});
12031202

0 commit comments

Comments
 (0)