Repository: ladjs/supertest (language: javascript)

Issue:
Got TypeError flat is not a function on Node.js 10  supertest 6.1.1
Look like this update 02888268617e546fb087629ac773b207fc164bdd which uses `Array.flat` doesn't work in older Node.js 

So when a test doesn't pass, instead of showing proper error stack, its showing inappropriate error like this

```
TypeError: [err.toString(...),savedStack,"----",badStack].flat is not a function
```


Discussion / hints:
Bug introduced by [this commit](https://github.com/visionmedia/supertest/commit/d41d10b7a8ce2590e38857362930354b648bf26f) from #690 

Fix patch:
diff --git a/.travis.yml b/.travis.yml
index 2f2a6cd3..e9df4e8e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,6 +5,8 @@ language: node_js
 
 node_js:
   - lts/*
+  - 12
+  - 10
 
 before_install:
   - npm i


Test patch:
diff --git a/lib/test.js b/lib/test.js
index 39c1ac28..be62ebb2 100644
--- a/lib/test.js
+++ b/lib/test.js
@@ -80,7 +80,11 @@ function wrapAssertFn(assertFn) {
     var err = assertFn(res);
     if (err && err.stack) {
       badStack = err.stack.replace(err.message, '').split('\n').slice(1);
-      err.stack = [err.toString(), savedStack, '----', badStack].flat().join('\n');
+      err.stack = [err.toString()]
+        .concat(savedStack)
+        .concat('----')
+        .concat(badStack)
+        .join('\n');
     }
     return err;
   };
diff --git a/test/supertest.js b/test/supertest.js
index 204e5bbe..bdeb683a 100644
--- a/test/supertest.js
+++ b/test/supertest.js
@@ -531,7 +531,7 @@ describe('request(app)', function () {
         .get('/')
         .expect({ stringValue: 'foo', numberValue: 3, nestedObject: { innerString: 5 } })
         .end(function (err, res) {
-          err.message.should.equal('expected {\n  stringValue: \'foo\',\n  numberValue: 3,\n  nestedObject: { innerString: 5 }\n} response body, got {\n  stringValue: \'foo\',\n  numberValue: 3,\n  nestedObject: { innerString: \'5\' }\n}'); // eslint-disable-line max-len
+          err.message.replace(/[^a-zA-Z]/g, '').should.equal('expected {\n  stringValue: \'foo\',\n  numberValue: 3,\n  nestedObject: { innerString: 5 }\n} response body, got {\n  stringValue: \'foo\',\n  numberValue: 3,\n  nestedObject: { innerString: \'5\' }\n}'.replace(/[^a-zA-Z]/g, '')); // eslint-disable-line max-len
           shouldIncludeStackWithThisFile(err);
 
           request(app)