From 2e48d0231a058f420df727905952274028e75949 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Wed, 20 Aug 2014 07:36:27 -0500 Subject: [PATCH] Fixed node tests with new WebWorker support Previous changes to make SystemJS support WebWorkers mistakenly broke Node, this fixes it. --- dist/system.js | 3 ++- lib/polyfill-wrapper-end.js | 3 ++- package.json | 2 +- test/test.js | 18 ++++++++++-------- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/dist/system.js b/dist/system.js index 8c205dc5..36d8157a 100644 --- a/dist/system.js +++ b/dist/system.js @@ -2125,4 +2125,5 @@ var $__curScript, __eval; } })(); -})(this); +})(typeof window != 'undefined' ? window : (typeof WorkerGlobalScope != 'undefined' ? + self : global)); diff --git a/lib/polyfill-wrapper-end.js b/lib/polyfill-wrapper-end.js index 464ab6c7..88af86cf 100644 --- a/lib/polyfill-wrapper-end.js +++ b/lib/polyfill-wrapper-end.js @@ -102,4 +102,5 @@ var $__curScript, __eval; } })(); -})(this); +})(typeof window != 'undefined' ? window : (typeof WorkerGlobalScope != 'undefined' ? + self : global)); diff --git a/package.json b/package.json index 9ecec6e3..6fdb8388 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "author": "Guy Bedford", "license": "MIT", "dependencies": { - "es6-module-loader": "~0.8.1" + "es6-module-loader": "~0.8.2" }, "devDependencies": { "qunit": "^0.6.2", diff --git a/test/test.js b/test/test.js index 025204f7..500509ed 100644 --- a/test/test.js +++ b/test/test.js @@ -558,13 +558,15 @@ asyncTest('AMD -> System.register circular -> ES6', function() { }, err); }); -asyncTest('Using SystemJS in a Web Worker', function() { - var worker = new Worker('tests/worker.js'); - worker.onmessage = function(e) { - ok(e.data.amd === 'AMD Module'); - ok(e.data.es6 === 'ES6 Module'); - start(); - }; -}); +if(typeof window !== 'undefined' && window.Worker) { + asyncTest('Using SystemJS in a Web Worker', function() { + var worker = new Worker('tests/worker.js'); + worker.onmessage = function(e) { + ok(e.data.amd === 'AMD Module'); + ok(e.data.es6 === 'ES6 Module'); + start(); + }; + }); +} })();