Use the same global for everything in Env

- No longer use `getGlobal` for clearStack and QueueRunner
This commit is contained in:
Gregg Van Hove
2018-04-13 17:14:48 -07:00
parent 8e8f09b41f
commit c440d13754
3 changed files with 15 additions and 15 deletions

View File

@@ -771,9 +771,9 @@ getJasmineRequireObj().Env = function(j$) {
var totalSpecsDefined = 0;
var realSetTimeout = j$.getGlobal().setTimeout;
var realClearTimeout = j$.getGlobal().clearTimeout;
var clearStack = j$.getClearStack(j$.getGlobal());
var realSetTimeout = global.setTimeout;
var realClearTimeout = global.clearTimeout;
var clearStack = j$.getClearStack(global);
this.clock = new j$.Clock(global, function () { return new j$.DelayedFunctionScheduler(); }, new j$.MockDate(global));
var runnableResources = {};

View File

@@ -940,10 +940,10 @@ describe("Env integration", function() {
});
it("Mock clock can be installed and used in tests", function(done) {
var globalSetTimeout = jasmine.createSpy('globalSetTimeout'),
var globalSetTimeout = jasmine.createSpy('globalSetTimeout').and.callFake(function(cb, t) { setTimeout(cb, t); }),
delayedFunctionForGlobalClock = jasmine.createSpy('delayedFunctionForGlobalClock'),
delayedFunctionForMockClock = jasmine.createSpy('delayedFunctionForMockClock'),
env = new jasmineUnderTest.Env({global: { setTimeout: globalSetTimeout }});
env = new jasmineUnderTest.Env({global: { setTimeout: globalSetTimeout, clearTimeout: clearTimeout, setImmediate: function(cb) { setTimeout(cb, 0); } }});
var assertions = function() {
expect(delayedFunctionForMockClock).toHaveBeenCalled();
@@ -1616,7 +1616,7 @@ describe("Env integration", function() {
});
it("should be possible to get full name from a spec", function() {
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
var env = new jasmineUnderTest.Env(),
topLevelSpec, nestedSpec, doublyNestedSpec;
env.describe("my tests", function() {
@@ -1638,7 +1638,7 @@ describe("Env integration", function() {
});
it("Custom equality testers should be per spec", function(done) {
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
var env = new jasmineUnderTest.Env(),
reporter = jasmine.createSpyObj('fakeReporter', [
"jasmineDone",
"specDone"
@@ -1672,7 +1672,7 @@ describe("Env integration", function() {
});
it("Custom equality testers should be per suite", function(done) {
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
var env = new jasmineUnderTest.Env(),
reporter = jasmine.createSpyObj('fakeReporter', [
"jasmineDone",
"specDone"
@@ -1715,7 +1715,7 @@ describe("Env integration", function() {
});
it("Custom equality testers for toContain should be per spec", function(done) {
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
var env = new jasmineUnderTest.Env(),
reporter = jasmine.createSpyObj('fakeReporter', [
"jasmineDone",
"specDone"
@@ -1766,7 +1766,7 @@ describe("Env integration", function() {
});
it("Custom equality testers for toContain should be per suite", function(done) {
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
var env = new jasmineUnderTest.Env(),
reporter = jasmine.createSpyObj('fakeReporter', [
"jasmineDone",
"specDone"
@@ -1809,7 +1809,7 @@ describe("Env integration", function() {
});
it("Custom matchers should be per spec", function(done) {
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
var env = new jasmineUnderTest.Env(),
matchers = {
toFoo: function() {}
};
@@ -1831,7 +1831,7 @@ describe("Env integration", function() {
});
it("Custom matchers should be per suite", function(done) {
var env = new jasmineUnderTest.Env({global: { setTimeout: setTimeout }}),
var env = new jasmineUnderTest.Env(),
matchers = {
toFoo: function() {}
};

View File

@@ -13,9 +13,9 @@ getJasmineRequireObj().Env = function(j$) {
var totalSpecsDefined = 0;
var realSetTimeout = j$.getGlobal().setTimeout;
var realClearTimeout = j$.getGlobal().clearTimeout;
var clearStack = j$.getClearStack(j$.getGlobal());
var realSetTimeout = global.setTimeout;
var realClearTimeout = global.clearTimeout;
var clearStack = j$.getClearStack(global);
this.clock = new j$.Clock(global, function () { return new j$.DelayedFunctionScheduler(); }, new j$.MockDate(global));
var runnableResources = {};