Pull out the building of the jasmine interface so node and web both get the same one.
This commit is contained in:
@@ -54,47 +54,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
*
|
*
|
||||||
* Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
|
* Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
|
||||||
*/
|
*/
|
||||||
var jasmineInterface = {
|
var jasmineInterface = jasmineRequire.interface(jasmine, env);
|
||||||
describe: function(description, specDefinitions) {
|
|
||||||
return env.describe(description, specDefinitions);
|
|
||||||
},
|
|
||||||
|
|
||||||
xdescribe: function(description, specDefinitions) {
|
|
||||||
return env.xdescribe(description, specDefinitions);
|
|
||||||
},
|
|
||||||
|
|
||||||
it: function(desc, func) {
|
|
||||||
return env.it(desc, func);
|
|
||||||
},
|
|
||||||
|
|
||||||
xit: function(desc, func) {
|
|
||||||
return env.xit(desc, func);
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeEach: function(beforeEachFunction) {
|
|
||||||
return env.beforeEach(beforeEachFunction);
|
|
||||||
},
|
|
||||||
|
|
||||||
afterEach: function(afterEachFunction) {
|
|
||||||
return env.afterEach(afterEachFunction);
|
|
||||||
},
|
|
||||||
|
|
||||||
expect: function(actual) {
|
|
||||||
return env.expect(actual);
|
|
||||||
},
|
|
||||||
|
|
||||||
pending: function() {
|
|
||||||
return env.pending();
|
|
||||||
},
|
|
||||||
|
|
||||||
spyOn: function(obj, methodName) {
|
|
||||||
return env.spyOn(obj, methodName);
|
|
||||||
},
|
|
||||||
|
|
||||||
jsApiReporter: new jasmine.JsApiReporter({
|
|
||||||
timer: new jasmine.Timer()
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add all of the Jasmine global/public interface to the proper global, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
|
* Add all of the Jasmine global/public interface to the proper global, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
|
||||||
@@ -105,27 +65,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
extend(window, jasmineInterface);
|
extend(window, jasmineInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Expose the interface for adding custom equality testers.
|
|
||||||
*/
|
|
||||||
jasmine.addCustomEqualityTester = function(tester) {
|
|
||||||
env.addCustomEqualityTester(tester);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expose the interface for adding custom expectation matchers
|
|
||||||
*/
|
|
||||||
jasmine.addMatchers = function(matchers) {
|
|
||||||
return env.addMatchers(matchers);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expose the mock interface for the JavaScript timeout functions
|
|
||||||
*/
|
|
||||||
jasmine.clock = function() {
|
|
||||||
return env.clock;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ## Runner Parameters
|
* ## Runner Parameters
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -32,47 +32,7 @@
|
|||||||
*
|
*
|
||||||
* Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
|
* Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
|
||||||
*/
|
*/
|
||||||
var jasmineInterface = {
|
var jasmineInterface = jasmineRequire.interface(jasmine, env);
|
||||||
describe: function(description, specDefinitions) {
|
|
||||||
return env.describe(description, specDefinitions);
|
|
||||||
},
|
|
||||||
|
|
||||||
xdescribe: function(description, specDefinitions) {
|
|
||||||
return env.xdescribe(description, specDefinitions);
|
|
||||||
},
|
|
||||||
|
|
||||||
it: function(desc, func) {
|
|
||||||
return env.it(desc, func);
|
|
||||||
},
|
|
||||||
|
|
||||||
xit: function(desc, func) {
|
|
||||||
return env.xit(desc, func);
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeEach: function(beforeEachFunction) {
|
|
||||||
return env.beforeEach(beforeEachFunction);
|
|
||||||
},
|
|
||||||
|
|
||||||
afterEach: function(afterEachFunction) {
|
|
||||||
return env.afterEach(afterEachFunction);
|
|
||||||
},
|
|
||||||
|
|
||||||
expect: function(actual) {
|
|
||||||
return env.expect(actual);
|
|
||||||
},
|
|
||||||
|
|
||||||
pending: function() {
|
|
||||||
return env.pending();
|
|
||||||
},
|
|
||||||
|
|
||||||
spyOn: function(obj, methodName) {
|
|
||||||
return env.spyOn(obj, methodName);
|
|
||||||
},
|
|
||||||
|
|
||||||
jsApiReporter: new jasmine.JsApiReporter({
|
|
||||||
timer: new jasmine.Timer()
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add all of the Jasmine global/public interface to the proper global, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
|
* Add all of the Jasmine global/public interface to the proper global, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
|
||||||
@@ -83,27 +43,6 @@
|
|||||||
extend(window, jasmineInterface);
|
extend(window, jasmineInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Expose the interface for adding custom equality testers.
|
|
||||||
*/
|
|
||||||
jasmine.addCustomEqualityTester = function(tester) {
|
|
||||||
env.addCustomEqualityTester(tester);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expose the interface for adding custom expectation matchers
|
|
||||||
*/
|
|
||||||
jasmine.addMatchers = function(matchers) {
|
|
||||||
return env.addMatchers(matchers);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expose the mock interface for the JavaScript timeout functions
|
|
||||||
*/
|
|
||||||
jasmine.clock = function() {
|
|
||||||
return env.clock;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ## Runner Parameters
|
* ## Runner Parameters
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -6,66 +6,14 @@ module.exports = function(jasmineRequire) {
|
|||||||
|
|
||||||
var env = jasmine.getEnv();
|
var env = jasmine.getEnv();
|
||||||
|
|
||||||
var jasmineInterface = {
|
var jasmineInterface = jasmineRequire.interface(jasmine, env);
|
||||||
describe: function(description, specDefinitions) {
|
|
||||||
return env.describe(description, specDefinitions);
|
|
||||||
},
|
|
||||||
|
|
||||||
xdescribe: function(description, specDefinitions) {
|
|
||||||
return env.xdescribe(description, specDefinitions);
|
|
||||||
},
|
|
||||||
|
|
||||||
it: function(desc, func) {
|
|
||||||
return env.it(desc, func);
|
|
||||||
},
|
|
||||||
|
|
||||||
xit: function(desc, func) {
|
|
||||||
return env.xit(desc, func);
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeEach: function(beforeEachFunction) {
|
|
||||||
return env.beforeEach(beforeEachFunction);
|
|
||||||
},
|
|
||||||
|
|
||||||
afterEach: function(afterEachFunction) {
|
|
||||||
return env.afterEach(afterEachFunction);
|
|
||||||
},
|
|
||||||
|
|
||||||
expect: function(actual) {
|
|
||||||
return env.expect(actual);
|
|
||||||
},
|
|
||||||
|
|
||||||
spyOn: function(obj, methodName) {
|
|
||||||
return env.spyOn(obj, methodName);
|
|
||||||
},
|
|
||||||
|
|
||||||
jsApiReporter: new jasmine.JsApiReporter({
|
|
||||||
timer: new jasmine.Timer()
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
jasmine: jasmine
|
|
||||||
};
|
|
||||||
|
|
||||||
extend(global, jasmineInterface);
|
extend(global, jasmineInterface);
|
||||||
|
|
||||||
jasmine.addCustomEqualityTester = function(tester) {
|
|
||||||
env.addCustomEqualityTester(tester);
|
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.addMatchers = function(matchers) {
|
|
||||||
return env.addMatchers(matchers);
|
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.clock = function() {
|
|
||||||
return env.clock;
|
|
||||||
};
|
|
||||||
|
|
||||||
function extend(destination, source) {
|
function extend(destination, source) {
|
||||||
for (var property in source) destination[property] = source[property];
|
for (var property in source) destination[property] = source[property];
|
||||||
return destination;
|
return destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return jasmine;
|
return jasmine;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2528,6 +2528,66 @@ getJasmineRequireObj().toThrowError = function(j$) {
|
|||||||
return toThrowError;
|
return toThrowError;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getJasmineRequireObj().interface = function(jasmine, env) {
|
||||||
|
var jasmineInterface = {
|
||||||
|
describe: function(description, specDefinitions) {
|
||||||
|
return env.describe(description, specDefinitions);
|
||||||
|
},
|
||||||
|
|
||||||
|
xdescribe: function(description, specDefinitions) {
|
||||||
|
return env.xdescribe(description, specDefinitions);
|
||||||
|
},
|
||||||
|
|
||||||
|
it: function(desc, func) {
|
||||||
|
return env.it(desc, func);
|
||||||
|
},
|
||||||
|
|
||||||
|
xit: function(desc, func) {
|
||||||
|
return env.xit(desc, func);
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeEach: function(beforeEachFunction) {
|
||||||
|
return env.beforeEach(beforeEachFunction);
|
||||||
|
},
|
||||||
|
|
||||||
|
afterEach: function(afterEachFunction) {
|
||||||
|
return env.afterEach(afterEachFunction);
|
||||||
|
},
|
||||||
|
|
||||||
|
expect: function(actual) {
|
||||||
|
return env.expect(actual);
|
||||||
|
},
|
||||||
|
|
||||||
|
pending: function() {
|
||||||
|
return env.pending();
|
||||||
|
},
|
||||||
|
|
||||||
|
spyOn: function(obj, methodName) {
|
||||||
|
return env.spyOn(obj, methodName);
|
||||||
|
},
|
||||||
|
|
||||||
|
jsApiReporter: new jasmine.JsApiReporter({
|
||||||
|
timer: new jasmine.Timer()
|
||||||
|
}),
|
||||||
|
|
||||||
|
jasmine: jasmine
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.addCustomEqualityTester = function(tester) {
|
||||||
|
env.addCustomEqualityTester(tester);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.addMatchers = function(matchers) {
|
||||||
|
return env.addMatchers(matchers);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.clock = function() {
|
||||||
|
return env.clock;
|
||||||
|
};
|
||||||
|
|
||||||
|
return jasmineInterface;
|
||||||
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().version = function() {
|
getJasmineRequireObj().version = function() {
|
||||||
return '2.0.1';
|
return '2.0.1';
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,66 +28,14 @@ module.exports = function(jasmineRequire) {
|
|||||||
|
|
||||||
var env = jasmine.getEnv();
|
var env = jasmine.getEnv();
|
||||||
|
|
||||||
var jasmineInterface = {
|
var jasmineInterface = jasmineRequire.interface(jasmine, env);
|
||||||
describe: function(description, specDefinitions) {
|
|
||||||
return env.describe(description, specDefinitions);
|
|
||||||
},
|
|
||||||
|
|
||||||
xdescribe: function(description, specDefinitions) {
|
|
||||||
return env.xdescribe(description, specDefinitions);
|
|
||||||
},
|
|
||||||
|
|
||||||
it: function(desc, func) {
|
|
||||||
return env.it(desc, func);
|
|
||||||
},
|
|
||||||
|
|
||||||
xit: function(desc, func) {
|
|
||||||
return env.xit(desc, func);
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeEach: function(beforeEachFunction) {
|
|
||||||
return env.beforeEach(beforeEachFunction);
|
|
||||||
},
|
|
||||||
|
|
||||||
afterEach: function(afterEachFunction) {
|
|
||||||
return env.afterEach(afterEachFunction);
|
|
||||||
},
|
|
||||||
|
|
||||||
expect: function(actual) {
|
|
||||||
return env.expect(actual);
|
|
||||||
},
|
|
||||||
|
|
||||||
spyOn: function(obj, methodName) {
|
|
||||||
return env.spyOn(obj, methodName);
|
|
||||||
},
|
|
||||||
|
|
||||||
jsApiReporter: new jasmine.JsApiReporter({
|
|
||||||
timer: new jasmine.Timer()
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
jasmine: jasmine
|
|
||||||
};
|
|
||||||
|
|
||||||
extend(global, jasmineInterface);
|
extend(global, jasmineInterface);
|
||||||
|
|
||||||
jasmine.addCustomEqualityTester = function(tester) {
|
|
||||||
env.addCustomEqualityTester(tester);
|
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.addMatchers = function(matchers) {
|
|
||||||
return env.addMatchers(matchers);
|
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.clock = function() {
|
|
||||||
return env.clock;
|
|
||||||
};
|
|
||||||
|
|
||||||
function extend(destination, source) {
|
function extend(destination, source) {
|
||||||
for (var property in source) destination[property] = source[property];
|
for (var property in source) destination[property] = source[property];
|
||||||
return destination;
|
return destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return jasmine;
|
return jasmine;
|
||||||
};
|
};
|
||||||
|
|||||||
59
src/core/requireInterface.js
Normal file
59
src/core/requireInterface.js
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
getJasmineRequireObj().interface = function(jasmine, env) {
|
||||||
|
var jasmineInterface = {
|
||||||
|
describe: function(description, specDefinitions) {
|
||||||
|
return env.describe(description, specDefinitions);
|
||||||
|
},
|
||||||
|
|
||||||
|
xdescribe: function(description, specDefinitions) {
|
||||||
|
return env.xdescribe(description, specDefinitions);
|
||||||
|
},
|
||||||
|
|
||||||
|
it: function(desc, func) {
|
||||||
|
return env.it(desc, func);
|
||||||
|
},
|
||||||
|
|
||||||
|
xit: function(desc, func) {
|
||||||
|
return env.xit(desc, func);
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeEach: function(beforeEachFunction) {
|
||||||
|
return env.beforeEach(beforeEachFunction);
|
||||||
|
},
|
||||||
|
|
||||||
|
afterEach: function(afterEachFunction) {
|
||||||
|
return env.afterEach(afterEachFunction);
|
||||||
|
},
|
||||||
|
|
||||||
|
expect: function(actual) {
|
||||||
|
return env.expect(actual);
|
||||||
|
},
|
||||||
|
|
||||||
|
pending: function() {
|
||||||
|
return env.pending();
|
||||||
|
},
|
||||||
|
|
||||||
|
spyOn: function(obj, methodName) {
|
||||||
|
return env.spyOn(obj, methodName);
|
||||||
|
},
|
||||||
|
|
||||||
|
jsApiReporter: new jasmine.JsApiReporter({
|
||||||
|
timer: new jasmine.Timer()
|
||||||
|
}),
|
||||||
|
|
||||||
|
jasmine: jasmine
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.addCustomEqualityTester = function(tester) {
|
||||||
|
env.addCustomEqualityTester(tester);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.addMatchers = function(matchers) {
|
||||||
|
return env.addMatchers(matchers);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.clock = function() {
|
||||||
|
return env.clock;
|
||||||
|
};
|
||||||
|
|
||||||
|
return jasmineInterface;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user