diff --git a/.travis.yml b/.travis.yml index a1973db..9b9355d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,8 +51,11 @@ before_install: - | # supertest for testing # - use 1.1.0 for Node.js < 0.10 + # - use 2.0.0 for Node.js < 4 if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -eq 0 && "$(cut -d. -f2 <<< "$TRAVIS_NODE_VERSION")" -lt 10 ]]; then npm install --save-dev supertest@1.1.0 + elif [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 4 ]]; then + npm install --save-dev supertest@2.0.0 fi # Update Node.js modules - | diff --git a/appveyor.yml b/appveyor.yml index eaf8d79..03191d0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -51,9 +51,11 @@ install: - ps: | # mocha for testing # - use 1.1.0 for Node.js < 0.10 - # - use 3.x for Node.js < 4 + # - use 2.0.0 for Node.js < 4 if ([int]$env:nodejs_version.split(".")[0] -eq 0 -and [int]$env:nodejs_version.split(".")[1] -lt 10) { npm install --silent --save-dev supertest@1.1.0 + } elseif ([int]$env:nodejs_version.split(".")[0] -lt 4) { + npm install --silent --save-dev supertest@2.0.0 } # Update Node.js modules - ps: | diff --git a/package.json b/package.json index 71a1d40..430a309 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "eslint-plugin-markdown": "1.0.0", "istanbul": "0.4.5", "mocha": "4.1.0", - "supertest": "2.0.0" + "supertest": "3.4.2" }, "files": [ "public/", diff --git a/test/test.js b/test/test.js index 60fb358..e5a5270 100644 --- a/test/test.js +++ b/test/test.js @@ -48,7 +48,9 @@ describe('serveIndex(root)', function () { request(server) .head('/') - .expect(200, '', done) + .expect(200) + .expect(shouldNotHaveBody()) + .end(done) }) it('should work with OPTIONS requests', function (done) { @@ -843,3 +845,9 @@ function bodyDoesNotContain(text) { assert.equal(res.text.indexOf(text), -1) } } + +function shouldNotHaveBody () { + return function (res) { + assert.ok(res.text === '' || res.text === undefined) + } +}