mirror of
https://github.com/zebrajr/express.git
synced 2026-01-15 12:15:27 +00:00
cleanup: remove AsyncLocalStorage check from tests (#6147)
Co-authored-by: Wes Todd <wes@wesleytodd.com>
This commit is contained in:
@@ -2,8 +2,10 @@ unreleased
|
||||
========================
|
||||
|
||||
* Remove `Object.setPrototypeOf` polyfill
|
||||
* cleanup: remove AsyncLocalStorage check from tests
|
||||
* cleanup: remove unnecessary require for global Buffer
|
||||
|
||||
|
||||
5.0.1 / 2024-10-08
|
||||
==========
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
'use strict'
|
||||
|
||||
var assert = require('assert')
|
||||
var asyncHooks = tryRequire('async_hooks')
|
||||
var AsyncLocalStorage = require('async_hooks').AsyncLocalStorage
|
||||
|
||||
var express = require('..')
|
||||
var request = require('supertest')
|
||||
|
||||
var describeAsyncHooks = typeof asyncHooks.AsyncLocalStorage === 'function'
|
||||
? describe
|
||||
: describe.skip
|
||||
|
||||
describe('express.json()', function () {
|
||||
it('should parse JSON', function (done) {
|
||||
request(createApp())
|
||||
@@ -502,13 +499,13 @@ describe('express.json()', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describeAsyncHooks('async local storage', function () {
|
||||
describe('async local storage', function () {
|
||||
before(function () {
|
||||
var app = express()
|
||||
var store = { foo: 'bar' }
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
req.asyncLocalStorage = new asyncHooks.AsyncLocalStorage()
|
||||
req.asyncLocalStorage = new AsyncLocalStorage()
|
||||
req.asyncLocalStorage.run(store, next)
|
||||
})
|
||||
|
||||
@@ -755,11 +752,3 @@ function shouldContainInBody (str) {
|
||||
'expected \'' + res.text + '\' to contain \'' + str + '\'')
|
||||
}
|
||||
}
|
||||
|
||||
function tryRequire (name) {
|
||||
try {
|
||||
return require(name)
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
'use strict'
|
||||
|
||||
var assert = require('assert')
|
||||
var asyncHooks = tryRequire('async_hooks')
|
||||
var AsyncLocalStorage = require('async_hooks').AsyncLocalStorage
|
||||
|
||||
var express = require('..')
|
||||
var request = require('supertest')
|
||||
|
||||
var describeAsyncHooks = typeof asyncHooks.AsyncLocalStorage === 'function'
|
||||
? describe
|
||||
: describe.skip
|
||||
|
||||
describe('express.raw()', function () {
|
||||
before(function () {
|
||||
this.app = createApp()
|
||||
@@ -327,13 +324,13 @@ describe('express.raw()', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describeAsyncHooks('async local storage', function () {
|
||||
describe('async local storage', function () {
|
||||
before(function () {
|
||||
var app = express()
|
||||
var store = { foo: 'bar' }
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
req.asyncLocalStorage = new asyncHooks.AsyncLocalStorage()
|
||||
req.asyncLocalStorage = new AsyncLocalStorage()
|
||||
req.asyncLocalStorage.run(store, next)
|
||||
})
|
||||
|
||||
@@ -513,11 +510,3 @@ function createApp (options) {
|
||||
|
||||
return app
|
||||
}
|
||||
|
||||
function tryRequire (name) {
|
||||
try {
|
||||
return require(name)
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
'use strict'
|
||||
|
||||
var assert = require('assert')
|
||||
var asyncHooks = tryRequire('async_hooks')
|
||||
var AsyncLocalStorage = require('async_hooks').AsyncLocalStorage
|
||||
|
||||
var express = require('..')
|
||||
var request = require('supertest')
|
||||
|
||||
var describeAsyncHooks = typeof asyncHooks.AsyncLocalStorage === 'function'
|
||||
? describe
|
||||
: describe.skip
|
||||
|
||||
describe('express.text()', function () {
|
||||
before(function () {
|
||||
this.app = createApp()
|
||||
@@ -360,13 +357,13 @@ describe('express.text()', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describeAsyncHooks('async local storage', function () {
|
||||
describe('async local storage', function () {
|
||||
before(function () {
|
||||
var app = express()
|
||||
var store = { foo: 'bar' }
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
req.asyncLocalStorage = new asyncHooks.AsyncLocalStorage()
|
||||
req.asyncLocalStorage = new AsyncLocalStorage()
|
||||
req.asyncLocalStorage.run(store, next)
|
||||
})
|
||||
|
||||
@@ -567,11 +564,3 @@ function createApp (options) {
|
||||
|
||||
return app
|
||||
}
|
||||
|
||||
function tryRequire (name) {
|
||||
try {
|
||||
return require(name)
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
'use strict'
|
||||
|
||||
var assert = require('assert')
|
||||
var asyncHooks = tryRequire('async_hooks')
|
||||
var AsyncLocalStorage = require('async_hooks').AsyncLocalStorage
|
||||
|
||||
var express = require('..')
|
||||
var request = require('supertest')
|
||||
|
||||
var describeAsyncHooks = typeof asyncHooks.AsyncLocalStorage === 'function'
|
||||
? describe
|
||||
: describe.skip
|
||||
|
||||
describe('express.urlencoded()', function () {
|
||||
before(function () {
|
||||
this.app = createApp()
|
||||
@@ -605,13 +602,13 @@ describe('express.urlencoded()', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describeAsyncHooks('async local storage', function () {
|
||||
describe('async local storage', function () {
|
||||
before(function () {
|
||||
var app = express()
|
||||
var store = { foo: 'bar' }
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
req.asyncLocalStorage = new asyncHooks.AsyncLocalStorage()
|
||||
req.asyncLocalStorage = new AsyncLocalStorage()
|
||||
req.asyncLocalStorage.run(store, next)
|
||||
})
|
||||
|
||||
@@ -828,11 +825,3 @@ function expectKeyCount (count) {
|
||||
assert.strictEqual(Object.keys(JSON.parse(res.text)).length, count)
|
||||
}
|
||||
}
|
||||
|
||||
function tryRequire (name) {
|
||||
try {
|
||||
return require(name)
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
var after = require('after');
|
||||
var assert = require('assert')
|
||||
var asyncHooks = tryRequire('async_hooks')
|
||||
var AsyncLocalStorage = require('async_hooks').AsyncLocalStorage
|
||||
|
||||
var express = require('..');
|
||||
var path = require('path')
|
||||
var request = require('supertest');
|
||||
@@ -10,10 +11,6 @@ var utils = require('./support/utils')
|
||||
|
||||
var FIXTURES_PATH = path.join(__dirname, 'fixtures')
|
||||
|
||||
var describeAsyncHooks = typeof asyncHooks.AsyncLocalStorage === 'function'
|
||||
? describe
|
||||
: describe.skip
|
||||
|
||||
describe('res', function(){
|
||||
describe('.download(path)', function(){
|
||||
it('should transfer as an attachment', function(done){
|
||||
@@ -90,14 +87,14 @@ describe('res', function(){
|
||||
.expect(200, cb);
|
||||
})
|
||||
|
||||
describeAsyncHooks('async local storage', function () {
|
||||
describe('async local storage', function () {
|
||||
it('should presist store', function (done) {
|
||||
var app = express()
|
||||
var cb = after(2, done)
|
||||
var store = { foo: 'bar' }
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
req.asyncLocalStorage = new asyncHooks.AsyncLocalStorage()
|
||||
req.asyncLocalStorage = new AsyncLocalStorage()
|
||||
req.asyncLocalStorage.run(store, next)
|
||||
})
|
||||
|
||||
@@ -124,7 +121,7 @@ describe('res', function(){
|
||||
var store = { foo: 'bar' }
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
req.asyncLocalStorage = new asyncHooks.AsyncLocalStorage()
|
||||
req.asyncLocalStorage = new AsyncLocalStorage()
|
||||
req.asyncLocalStorage.run(store, next)
|
||||
})
|
||||
|
||||
@@ -487,11 +484,3 @@ describe('res', function(){
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
function tryRequire (name) {
|
||||
try {
|
||||
return require(name)
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
var after = require('after');
|
||||
var assert = require('assert')
|
||||
var asyncHooks = tryRequire('async_hooks')
|
||||
var AsyncLocalStorage = require('async_hooks').AsyncLocalStorage
|
||||
|
||||
var express = require('../')
|
||||
, request = require('supertest')
|
||||
var onFinished = require('on-finished');
|
||||
@@ -10,10 +11,6 @@ var path = require('path');
|
||||
var fixtures = path.join(__dirname, 'fixtures');
|
||||
var utils = require('./support/utils');
|
||||
|
||||
var describeAsyncHooks = typeof asyncHooks.AsyncLocalStorage === 'function'
|
||||
? describe
|
||||
: describe.skip
|
||||
|
||||
describe('res', function(){
|
||||
describe('.sendFile(path)', function () {
|
||||
it('should error missing path', function (done) {
|
||||
@@ -266,14 +263,14 @@ describe('res', function(){
|
||||
.expect(200, 'got 404 error', done)
|
||||
})
|
||||
|
||||
describeAsyncHooks('async local storage', function () {
|
||||
describe('async local storage', function () {
|
||||
it('should presist store', function (done) {
|
||||
var app = express()
|
||||
var cb = after(2, done)
|
||||
var store = { foo: 'bar' }
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
req.asyncLocalStorage = new asyncHooks.AsyncLocalStorage()
|
||||
req.asyncLocalStorage = new AsyncLocalStorage()
|
||||
req.asyncLocalStorage.run(store, next)
|
||||
})
|
||||
|
||||
@@ -299,7 +296,7 @@ describe('res', function(){
|
||||
var store = { foo: 'bar' }
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
req.asyncLocalStorage = new asyncHooks.AsyncLocalStorage()
|
||||
req.asyncLocalStorage = new AsyncLocalStorage()
|
||||
req.asyncLocalStorage.run(store, next)
|
||||
})
|
||||
|
||||
@@ -900,11 +897,3 @@ function createApp(path, options, fn) {
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
function tryRequire (name) {
|
||||
try {
|
||||
return require(name)
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user