Skip to content

Commit

Permalink
refactor(adapter): fix static code analysis warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nicojs committed Mar 28, 2018
1 parent 8d2a914 commit a0b3ec8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/adapter.js
Expand Up @@ -161,7 +161,7 @@ function KarmaReporter (tc, jasmineEnv) {
// Save link on native Date object
// because user can mock it
var _Date = Date
var startTimeCurrentSpec = new _Date().getTime();
var startTimeCurrentSpec = new _Date().getTime()

/**
* @param suite
Expand Down Expand Up @@ -234,7 +234,7 @@ function KarmaReporter (tc, jasmineEnv) {
currentSuite = currentSuite.parent
}

this.specStarted = function (specResult) {
this.specStarted = function () {
startTimeCurrentSpec = new _Date().getTime()
}

Expand Down
12 changes: 2 additions & 10 deletions test/adapter.spec.js
Expand Up @@ -253,14 +253,6 @@ describe('jasmine adapter', function () {
it('should report time for every spec', function () {
var counter = 3

function copySpecResult() {
var copy = {}
for(var i in spec.result) {
copy[i] = spec.result[i]
}
return copy
}

spyOn(Date.prototype, 'getTime').and.callFake(function () {
counter += 1
return counter
Expand All @@ -270,8 +262,8 @@ describe('jasmine adapter', function () {
expect(result.time).toBe(1) // 4 - 3
})

reporter.specStarted(copySpecResult())
reporter.specDone(copySpecResult())
reporter.specStarted(Object.assign({}, spec.result))
reporter.specDone(Object.assign({}, spec.result))

expect(karma.result).toHaveBeenCalled()
})
Expand Down

0 comments on commit a0b3ec8

Please sign in to comment.