Skip to content

Commit

Permalink
test: improve linting and fix test on node 4
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Nov 25, 2017
1 parent af0efda commit 0e1907d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 34 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -434,7 +434,7 @@
"version": "1.7.1",
"license": "MIT",
"scripts": {
"lint": "eslint client/**/*.js common/**/*.js context/**/*.js gruntfile.js wallaby.js lib/**/*.js test/**/*.js static/debug.js",
"lint": "eslint client/**/*.js common/**/*.js context/**/*.js gruntfile.js wallaby.js lib/**/*.js test/unit/**/*.js test/client/*.js test/e2e/**/*.js static/debug.js",
"test": "grunt test",
"build": "grunt build",
"test:appveyor": "grunt test-appveyor",
Expand Down
24 changes: 14 additions & 10 deletions test/e2e/step_definitions/core_steps.js
@@ -1,13 +1,17 @@
var {defineSupportCode} = require('cucumber')

defineSupportCode(function ({defineParameterType, Given, Then, When}) {
var fs = require('fs')
var path = require('path')
var ref = require('child_process')
var exec = ref.exec
var spawn = ref.spawn
var rimraf = require('rimraf')
var stopper = require('../../../lib/stopper')
var cucumber = require('cucumber')
var fs = require('fs')
var path = require('path')
var ref = require('child_process')
var exec = ref.exec
var spawn = ref.spawn
var rimraf = require('rimraf')
var stopper = require('../../../lib/stopper')

cucumber.defineSupportCode((a) => {
var When = a.When
var Then = a.Then
var Given = a.Given
var defineParameterType = a.defineParameterType

var baseDir = fs.realpathSync(path.join(__dirname, '/../../..'))
var tmpDir = path.join(baseDir, 'tmp', 'sandbox')
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/step_definitions/hooks.js
@@ -1,7 +1,7 @@
var {defineSupportCode} = require('cucumber')
var cucumber = require('cucumber')

defineSupportCode(function ({After}) {
After(function (scenario, callback) {
cucumber.defineSupportCode((a) => {
a.After(function (scenario, callback) {
var running = this.child != null && typeof this.child.kill === 'function'

if (running) {
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/support/env.js
@@ -1,5 +1,5 @@
var {defineSupportCode} = require('cucumber')
var cucumber = require('cucumber')

defineSupportCode(function ({setDefaultTimeout}) {
setDefaultTimeout(60 * 1000)
cucumber.defineSupportCode((a) => {
a.setDefaultTimeout(60 * 1000)
})
6 changes: 3 additions & 3 deletions test/e2e/support/world.js
Expand Up @@ -4,7 +4,7 @@ var path = require('path')
var hasher = require('crypto').createHash
var mkdirp = require('mkdirp')
var _ = require('lodash')
var {defineSupportCode} = require('cucumber')
var cucumber = require('cucumber')

function World () {
this.proxy = require('./proxy')
Expand Down Expand Up @@ -63,6 +63,6 @@ function World () {
}
}

defineSupportCode(function ({setWorldConstructor}) {
setWorldConstructor(World)
cucumber.defineSupportCode((a) => {
a.setWorldConstructor(World)
})
21 changes: 7 additions & 14 deletions test/unit/middleware/source_files.spec.js
Expand Up @@ -128,8 +128,7 @@ describe('middleware.source_files', function () {
.expect(200, 'js-src-a')
.then(function () {
return expect(next).not.to.have.been.called
}
)
})
})

it('should send strict caching headers for js source files with sha', function () {
Expand All @@ -143,8 +142,7 @@ describe('middleware.source_files', function () {
.expect(200)
.then(function () {
return expect(next).not.to.have.been.called
}
)
})
})

it('should send strict caching headers for js source files with sha (in basePath)', function () {
Expand Down Expand Up @@ -174,8 +172,7 @@ describe('middleware.source_files', function () {
.expect(200)
.then(function () {
return expect(next).not.to.have.been.called
}
)
})
})

it('should not serve files that are not in served', function () {
Expand Down Expand Up @@ -208,8 +205,7 @@ describe('middleware.source_files', function () {
.expect(200, 'utf8-file')
.then(function () {
return expect(next).not.to.have.been.called
}
)
})
})

it('should serve js source file from paths containing HTML URL encoded chars', function () {
Expand All @@ -224,8 +220,7 @@ describe('middleware.source_files', function () {
.expect(200, 'utf8-file')
.then(function () {
return expect(next).not.to.have.been.called
}
)
})
})

it('should set content-type headers', function () {
Expand All @@ -252,8 +247,7 @@ describe('middleware.source_files', function () {
.expect(200, 'cached-content')
.then(function () {
return expect(next).not.to.have.been.called
}
)
})
})

return it('should not use cached content if doNotCache is set', function () {
Expand All @@ -270,7 +264,6 @@ describe('middleware.source_files', function () {
.expect(200, 'js-source')
.then(function () {
return expect(next).not.to.have.been.called
}
)
})
})
})

0 comments on commit 0e1907d

Please sign in to comment.