[Pkg-javascript-commits] [node-umd] 06/10: Update tests

Bastien Roucariès rouca at moszumanska.debian.org
Mon Apr 17 07:38:13 UTC 2017


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

rouca pushed a commit to annotated tag 3.0.0
in repository node-umd.

commit cc3ca9176d6bfb996efc069919e78825bcb0c894
Author: Forbes Lindesay <forbes at lindesay.co.uk>
Date:   Wed Feb 4 13:36:48 2015 +0000

    Update tests
---
 test/index.js | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/test/index.js b/test/index.js
index 91ec559..7594bae 100644
--- a/test/index.js
+++ b/test/index.js
@@ -9,7 +9,7 @@ var multiNamespaces = umd('a.b.c.d.e', 'return "sentinel"')
 describe('with CommonJS', function () {
   it('uses module.exports', function () {
     var module = {exports: {}}
-    Function('module,exports', src)(module,module.exports)
+    require('vm').runInNewContext(src, {module: module, exports: module.exports})
     assert(module.exports === 'sentinel')
   })
 })
@@ -21,24 +21,29 @@ describe('with amd', function () {
       defed = fn()
     }
     define.amd = true
-    Function('define', src)(define)
+    require('vm').runInNewContext(src, {define: define});
     assert(defed === 'sentinel')
   })
 })
 describe('in the absense of a module system', function () {
   it('uses window', function () {
     var glob = {}
-    Function('window', src)(glob)
+    require('vm').runInNewContext(src, {window: glob})
     assert(glob.sentinelPrime === 'sentinel')
   })
   it('uses global', function () {
     var glob = {}
-    Function('global,window', src)(glob)
+    require('vm').runInNewContext(src, {global: glob})
     assert(glob.sentinelPrime === 'sentinel')
   })
   it('uses self', function () {
     var glob = {}
-    Function('self,window,global', src)(glob)
+    require('vm').runInNewContext(src, {self: glob})
+    assert(glob.sentinelPrime === 'sentinel')
+  })
+  it('uses `this`', function () {
+    var glob = {}
+    require('vm').runInNewContext(src, glob)
     assert(glob.sentinelPrime === 'sentinel')
   })
   it('creates the proper namespaces', function() {

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



More information about the Pkg-javascript-commits mailing list