Skip to content

Commit

Permalink
No longer try to detect CommonJS to require core
Browse files Browse the repository at this point in the history
- Jasmine-Core expects that to have a nodejs environment

- Fixes #155
- Fixes #168
  • Loading branch information
Gregg Van Hove committed Dec 10, 2016
1 parent 50eb806 commit 78d58ea
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
22 changes: 11 additions & 11 deletions lib/mock-ajax.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Jasmine-Ajax - v3.2.0: a set of helpers for testing AJAX requests under the Jasmine
Jasmine-Ajax - v3.3.0: a set of helpers for testing AJAX requests under the Jasmine
BDD framework for JavaScript.
http://github.com/jasmine/jasmine-ajax
Expand Down Expand Up @@ -32,19 +32,19 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

//Module wrapper to support both browser and CommonJS environment
(function (root, factory) {
if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
var jasmineRequire = require('jasmine-core');
module.exports = factory(root, function() {
return jasmineRequire;
});
} else {
// if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// // CommonJS
// var jasmineRequire = require('jasmine-core');
// module.exports = factory(root, function() {
// return jasmineRequire;
// });
// } else {
// Browser globals
window.MockAjax = factory(root, getJasmineRequireObj);
}
// }
}(typeof window !== 'undefined' ? window : global, function (global, getJasmineRequireObj) {

//
//
getJasmineRequireObj().ajax = function(jRequire) {
var $ajax = {};

Expand Down Expand Up @@ -284,7 +284,7 @@ getJasmineRequireObj().AjaxFakeRequest = function(eventBusFactory) {
return null;
}

extend(FakeXMLHttpRequest, {
extend(FakeXMLHttpRequest, {
UNSENT: 0,
OPENED: 1,
HEADERS_RECEIVED: 2,
Expand Down
16 changes: 8 additions & 8 deletions src/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

//Module wrapper to support both browser and CommonJS environment
(function (root, factory) {
if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
var jasmineRequire = require('jasmine-core');
module.exports = factory(root, function() {
return jasmineRequire;
});
} else {
// if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// // CommonJS
// var jasmineRequire = require('jasmine-core');
// module.exports = factory(root, function() {
// return jasmineRequire;
// });
// } else {
// Browser globals
window.MockAjax = factory(root, getJasmineRequireObj);
}
// }
}(typeof window !== 'undefined' ? window : global, function (global, getJasmineRequireObj) {

// <% files.forEach(function(filename) { %>
Expand Down

0 comments on commit 78d58ea

Please sign in to comment.