Try always mocking Date.now in our global spec helper

This commit is contained in:
Nathan Sobo
2017-07-31 10:14:44 -06:00
parent 899e9d3f8a
commit f33bca4fd9
2 changed files with 2 additions and 3 deletions

View File

@@ -1350,7 +1350,6 @@ describe('Pane', () => {
let editor1, pane, eventCount
beforeEach(async () => {
jasmine.useMockClock()
editor1 = await atom.workspace.open('sample.txt', {pending: true})
pane = atom.workspace.getActivePane()
eventCount = 0

View File

@@ -65,6 +65,7 @@ beforeEach ->
window.resetTimeouts()
spyOn(_._, "now").andCallFake -> window.now
spyOn(Date, 'now').andCallFake(-> window.now)
spyOn(window, "setTimeout").andCallFake window.fakeSetTimeout
spyOn(window, "clearTimeout").andCallFake window.fakeClearTimeout
@@ -179,6 +180,7 @@ jasmine.useRealClock = ->
jasmine.unspy(window, 'setTimeout')
jasmine.unspy(window, 'clearTimeout')
jasmine.unspy(_._, 'now')
jasmine.unspy(Date, 'now')
# The clock is halfway mocked now in a sad and terrible way... only setTimeout
# and clearTimeout are included. This method will also include setInterval. We
@@ -186,8 +188,6 @@ jasmine.useRealClock = ->
jasmine.useMockClock = ->
spyOn(window, 'setInterval').andCallFake(fakeSetInterval)
spyOn(window, 'clearInterval').andCallFake(fakeClearInterval)
spyOn(Date, 'now').andCallFake(-> window.now)
addCustomMatchers = (spec) ->
spec.addMatchers