Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
- Update dependencies as part of process to drop support for versions of Node.js below 4

Closes karma-runner#1812
Closes karma-runner#2688
  • Loading branch information
wesleycho committed May 6, 2017
1 parent 2a847c2 commit 7791970
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 48 deletions.
2 changes: 1 addition & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ var Config = function () {
this.LOG_DEBUG = constant.LOG_DEBUG

this.set = function (newConfig) {
_.merge(config, newConfig, function (obj, src) {
_.mergeWith(config, newConfig, function (obj, src) {
// Overwrite arrays to keep consistent with #283
if (_.isArray(src)) {
return src
Expand Down
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@
"graceful-fs": "^4.1.2",
"http-proxy": "^1.13.0",
"isbinaryfile": "^3.0.0",
"lodash": "^3.8.0",
"log4js": "^0.6.31",
"lodash": "^4.17.4",
"log4js": "^1.1.1",
"mime": "^1.3.4",
"minimatch": "^3.0.2",
"optimist": "^0.6.1",
Expand All @@ -363,12 +363,14 @@
"chai-as-promised": "^6.0.0",
"chai-subset": "^1.2.2",
"coffee-script": "^1.12.4",
"cucumber": "^1.2.0",
"cucumber": "^2.0.0-rc.9",
"eslint": "^3.15.0",
"eslint-config-standard": "^7.0.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-node": "^4.2.2",
"eslint-plugin-promise": "^3.4.2",
"eslint-plugin-react": "^6.10.0",
"eslint-plugin-standard": "^2.0.1",
"eslint-plugin-react": "^7.0.0",
"eslint-plugin-standard": "^3.0.1",
"grunt": "^1.0.0",
"grunt-auto-release": "^0.0.7",
"grunt-browserify": "^5.0.0",
Expand Down Expand Up @@ -414,7 +416,7 @@
"proxyquire": "^1.7.11",
"qunitjs": "^2.1.1",
"requirejs": "^2.1.20",
"sinon": "^1.17.5",
"sinon": "^2.2.0",
"sinon-chai": "^2.7.0",
"supertest": "^3.0.0",
"timer-shim": "^0.3.0",
Expand Down
2 changes: 1 addition & 1 deletion test/unit/completion.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('completion', () => {
}

beforeEach(() => {
sinon.stub(console, 'log', (msg) => completion.push(msg))
sinon.stub(console, 'log').callsFake((msg) => completion.push(msg))
completion = []
})

Expand Down
2 changes: 1 addition & 1 deletion test/unit/config.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var loadFile = require('mocks').loadFile
import path from 'path'
var loadFile = require('mocks').loadFile
var helper = require('../../lib/helper')
var logger = require('../../lib/logger.js')

Expand Down
36 changes: 26 additions & 10 deletions test/unit/file-list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import config from '../../lib/config'
var patterns = (...strings) => strings.map((str) => new config.Pattern(str))

function pathsFrom (files) {
return _.pluck(from(files), 'path')
return _.map(from(files), 'path')
}

function findFile (path, files) {
Expand Down Expand Up @@ -279,7 +279,7 @@ describe('FileList', () => {

it('cancels refreshs', () => {
var checkResult = (files) => {
expect(_.pluck(files.served, 'path')).to.contain('/some/a.js', '/some/b.js', '/some/c.js')
expect(_.map(files.served, 'path')).to.contain('/some/a.js', '/some/b.js', '/some/c.js')
}

var p1 = list.refresh().then(checkResult)
Expand Down Expand Up @@ -486,9 +486,15 @@ describe('FileList', () => {
return list.refresh().then(() => {
modified.reset()

return list.addFile('/some/d.js').then(() => {
expect(modified).to.have.been.calledOnce
})
return list.addFile('/some/d.js')
.then(() => new Promise((resolve) => {
_.defer(() => {
resolve()
})
}))
.then(() => {
expect(modified).to.have.been.calledOnce
})
})
})

Expand Down Expand Up @@ -569,10 +575,16 @@ describe('FileList', () => {
mockFs._touchFile('/some/b.js', '2020-01-01')
modified.reset()

return list.changeFile('/some/b.js').then((files) => {
expect(modified).to.have.been.calledOnce
expect(findFile('/some/b.js', files.served).mtime).to.be.eql(new Date('2020-01-01'))
})
return list.changeFile('/some/b.js')
.then((files) => new Promise((resolve) => {
_.defer(() => {
resolve(files)
})
}))
.then((files) => {
expect(modified).to.have.been.calledOnce
expect(findFile('/some/b.js', files.served).mtime).to.be.eql(new Date('2020-01-01'))
})
})
})

Expand Down Expand Up @@ -662,7 +674,11 @@ describe('FileList', () => {
return list.refresh().then((files) => {
modified.reset()
return list.removeFile('/some/a.js')
}).then((files) => {
}).then((files) => new Promise((resolve) => {
_.defer(() => {
resolve(files)
})
})).then((files) => {
expect(pathsFrom(files.served)).to.be.eql([
'/some/b.js',
'/a.txt'
Expand Down
6 changes: 3 additions & 3 deletions test/unit/launcher.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var stubPromise = (obj, method, stubAction) => {
obj[method].resolve = resolve
})

sinon.stub(obj, method, () => {
sinon.stub(obj, method).callsFake(() => {
if (stubAction) stubAction()

return promise
Expand All @@ -30,7 +30,7 @@ class FakeBrowser {

baseBrowserDecorator(this)
FakeBrowser._instances.push(this)
sinon.stub(this, 'start', () => {
sinon.stub(this, 'start').callsFake(() => {
this.state = this.STATE_BEING_CAPTURED
this._done()
})
Expand All @@ -52,7 +52,7 @@ class ScriptBrowser {

baseBrowserDecorator(this)
ScriptBrowser._instances.push(this)
sinon.stub(this, 'start', () => {
sinon.stub(this, 'start').callsFake(() => {
this.state = this.STATE_BEING_CAPTURED
this._done()
})
Expand Down
2 changes: 1 addition & 1 deletion test/unit/logger.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('logger', () => {
filename: 'test/unit/test.log'
}])

expect(m.log4js.appenders).to.have.keys(['console', 'file'])
expect(m.log4js.appenders).to.have.keys(['console', 'file', 'stdout'])
})
})
})
18 changes: 9 additions & 9 deletions test/unit/middleware/runner.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('middleware.runner', () => {

it('should trigger test run and stream the reporter', (done) => {
capturedBrowsers.add(new Browser())
sinon.stub(capturedBrowsers, 'areAllReady', () => true)
sinon.stub(capturedBrowsers, 'areAllReady').callsFake(() => true)

response.once('end', () => {
expect(nextSpy).to.not.have.been.called
Expand All @@ -86,7 +86,7 @@ describe('middleware.runner', () => {

it('should set the empty to 0 if empty results', (done) => {
capturedBrowsers.add(new Browser())
sinon.stub(capturedBrowsers, 'areAllReady', () => true)
sinon.stub(capturedBrowsers, 'areAllReady').callsFake(() => true)

response.once('end', () => {
expect(nextSpy).to.not.have.been.called
Expand All @@ -102,7 +102,7 @@ describe('middleware.runner', () => {

it('should set the empty to 1 if successful tests', (done) => {
capturedBrowsers.add(new Browser())
sinon.stub(capturedBrowsers, 'areAllReady', () => true)
sinon.stub(capturedBrowsers, 'areAllReady').callsFake(() => true)

response.once('end', () => {
expect(nextSpy).to.not.have.been.called
Expand All @@ -118,7 +118,7 @@ describe('middleware.runner', () => {

it('should set the empty to 1 if failed tests', (done) => {
capturedBrowsers.add(new Browser())
sinon.stub(capturedBrowsers, 'areAllReady', () => true)
sinon.stub(capturedBrowsers, 'areAllReady').callsFake(() => true)

response.once('end', () => {
expect(nextSpy).to.not.have.been.called
Expand Down Expand Up @@ -215,7 +215,7 @@ describe('middleware.runner', () => {
clientArgsRuns.forEach(function (run) {
it(run.desc, (done) => {
capturedBrowsers.add(new Browser())
sinon.stub(capturedBrowsers, 'areAllReady', () => true)
sinon.stub(capturedBrowsers, 'areAllReady').callsFake(() => true)
if (run.existingConfig) {
config = _.merge(config, {client: {args: run.existingConfig}})
}
Expand All @@ -242,7 +242,7 @@ describe('middleware.runner', () => {

it('should refresh explicit files if specified', (done) => {
capturedBrowsers.add(new Browser())
sinon.stub(capturedBrowsers, 'areAllReady', () => true)
sinon.stub(capturedBrowsers, 'areAllReady').callsFake(() => true)
sinon.stub(fileListMock, 'refresh')
sinon.stub(fileListMock, 'addFile')
sinon.stub(fileListMock, 'changeFile')
Expand Down Expand Up @@ -276,7 +276,7 @@ describe('middleware.runner', () => {

it('should wait for refresh to finish if applicable before scheduling execution', (done) => {
capturedBrowsers.add(new Browser())
sinon.stub(capturedBrowsers, 'areAllReady', () => true)
sinon.stub(capturedBrowsers, 'areAllReady').callsFake(() => true)

var res = null
var fileListPromise = new Promise((resolve, reject) => {
Expand All @@ -303,7 +303,7 @@ describe('middleware.runner', () => {

it('should schedule execution if no refresh', (done) => {
capturedBrowsers.add(new Browser())
sinon.stub(capturedBrowsers, 'areAllReady', () => true)
sinon.stub(capturedBrowsers, 'areAllReady').callsFake(() => true)

sinon.spy(fileListMock, 'refresh')
sinon.stub(executor, 'schedule')
Expand Down Expand Up @@ -331,7 +331,7 @@ describe('middleware.runner', () => {
config.autoWatch = true

capturedBrowsers.add(new Browser())
sinon.stub(capturedBrowsers, 'areAllReady', () => true)
sinon.stub(capturedBrowsers, 'areAllReady').callsFake(() => true)

sinon.spy(fileListMock, 'refresh')
sinon.stub(executor, 'schedule')
Expand Down
2 changes: 1 addition & 1 deletion test/unit/preprocessor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('preprocessor', () => {
var mockFs
var emitterSetting
// mimic first few bytes of a pdf file
var binarydata = new Buffer([0x25, 0x50, 0x44, 0x66, 0x46, 0x00])
var binarydata = new Buffer([0x25, 0x50, 0x44, 0x66, 0x46, 0x00]) // eslint-disable-line node/no-deprecated-api

beforeEach(() => {
mockFs = mocks.fs.create({
Expand Down
24 changes: 12 additions & 12 deletions test/unit/runner.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ describe('runner', () => {
var EXIT = constant.EXIT_CODE

it('should return 0 exit code if present in the buffer', () => {
var result = m.parseExitCode(new Buffer(`something\nfake${EXIT}10`))
var result = m.parseExitCode(new Buffer(`something\nfake${EXIT}10`)) // eslint-disable-line node/no-deprecated-api
expect(result.exitCode).to.equal(0)
})

it('should remove the exit code part of the returned buffer', () => {
var buffer = new Buffer(`some${EXIT}01`)
var buffer = new Buffer(`some${EXIT}01`) // eslint-disable-line node/no-deprecated-api
var result = m.parseExitCode(buffer)

expect(buffer.toString()).to.equal(`some${EXIT}01`)
Expand All @@ -27,7 +27,7 @@ describe('runner', () => {

it('should not touch buffer without exit code and return default', () => {
var msg = 'some nice \n messgae {}'
var buffer = new Buffer(msg)
var buffer = new Buffer(msg) // eslint-disable-line node/no-deprecated-api
var result = m.parseExitCode(buffer, 10)

expect(result.buffer.toString()).to.equal(msg)
Expand All @@ -52,21 +52,21 @@ describe('runner', () => {
})

it('should parse any single digit exit code', () => {
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}01`)).exitCode).to.equal(1)
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}17`)).exitCode).to.equal(7)
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}01`)).exitCode).to.equal(1) // eslint-disable-line node/no-deprecated-api
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}17`)).exitCode).to.equal(7) // eslint-disable-line node/no-deprecated-api
})

it('should return exit code 0 if failOnEmptyTestSuite is false and and non-empty int is 0', () => {
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}01`), undefined, false).exitCode).to.equal(0)
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}01`), undefined, false).exitCode).to.equal(0) // eslint-disable-line node/no-deprecated-api
})

it('should return exit code if failOnEmptyTestSuite is true', () => {
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}00`), undefined, true).exitCode).to.equal(0)
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}01`), undefined, true).exitCode).to.equal(1)
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}07`), undefined, true).exitCode).to.equal(7)
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}10`), undefined, true).exitCode).to.equal(0)
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}11`), undefined, true).exitCode).to.equal(1)
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}17`), undefined, true).exitCode).to.equal(7)
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}00`), undefined, true).exitCode).to.equal(0) // eslint-disable-line node/no-deprecated-api
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}01`), undefined, true).exitCode).to.equal(1) // eslint-disable-line node/no-deprecated-api
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}07`), undefined, true).exitCode).to.equal(7) // eslint-disable-line node/no-deprecated-api
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}10`), undefined, true).exitCode).to.equal(0) // eslint-disable-line node/no-deprecated-api
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}11`), undefined, true).exitCode).to.equal(1) // eslint-disable-line node/no-deprecated-api
expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}17`), undefined, true).exitCode).to.equal(7) // eslint-disable-line node/no-deprecated-api
})
})
})
2 changes: 1 addition & 1 deletion test/unit/server.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ describe('server', () => {
fileListOnResolve()

function mockProcess (process) {
sinon.stub(process, 'kill', (pid, ev) => process.emit(ev))
sinon.stub(process, 'kill').callsFake((pid, ev) => process.emit(ev))
}
})
})
Expand Down
2 changes: 1 addition & 1 deletion test/unit/web-server.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require('core-js')
import 'core-js'
import {EventEmitter} from 'events'
import request from 'supertest'
import di from 'di'
Expand Down

0 comments on commit 7791970

Please sign in to comment.