Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ladjs/supertest
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.1.5
Choose a base ref
...
head repository: ladjs/supertest
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.1.6
Choose a head ref
  • 3 commits
  • 4 files changed
  • 2 contributors

Commits on Aug 12, 2021

  1. Copy the full SHA
    ed0f68d View commit details

Commits on Aug 17, 2021

  1. Copy the full SHA
    28116f9 View commit details
  2. 6.1.6

    niftylettuce committed Aug 17, 2021
    Copy the full SHA
    f1b92fb View commit details
Showing with 14 additions and 3 deletions.
  1. +1 −1 lib/test.js
  2. +1 −1 package-lock.json
  3. +1 −1 package.json
  4. +11 −0 test/supertest.js
2 changes: 1 addition & 1 deletion lib/test.js
Original file line number Diff line number Diff line change
@@ -128,7 +128,7 @@ Test.prototype.expect = function(a, b, c) {
}

// multiple statuses
if (Array.isArray(a) && a.every(val => typeof val === 'number')) {
if (Array.isArray(a) && a.length > 0 && a.every(val => typeof val === 'number')) {
this._asserts.push(wrapAssertFn(this._assertStatusArray.bind(this, a)));
return this;
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supertest",
"version": "6.1.5",
"version": "6.1.6",
"description": "SuperAgent driven library for testing HTTP servers",
"main": "index.js",
"author": "TJ Holowaychuk",
11 changes: 11 additions & 0 deletions test/supertest.js
Original file line number Diff line number Diff line change
@@ -584,6 +584,17 @@ describe('request(app)', function () {
.expect(['a', { id: 1 }], done);
});

it('should support empty array responses', function (done) {
const app = express();
app.get('/', function (req, res) {
res.status(200).json([]);
});

request(app)
.get('/')
.expect([], done);
});

it('should support regular expressions', function (done) {
const app = express();