Remove Node.js v8 support (#1402)

This commit is contained in:
Tomas Della Vedova
2021-02-19 08:27:20 +01:00
committed by GitHub
parent 7801b2cc13
commit ab5d8997b8
44 changed files with 258 additions and 302 deletions

View File

@ -30,7 +30,7 @@ const intoStream = require('into-stream')
class MockConnection extends Connection {
request (params, callback) {
var aborted = false
let aborted = false
const stream = intoStream(JSON.stringify({ hello: 'world' }))
stream.statusCode = setStatusCode(params.path)
stream.headers = {
@ -54,7 +54,7 @@ class MockConnection extends Connection {
class MockConnectionTimeout extends Connection {
request (params, callback) {
var aborted = false
let aborted = false
process.nextTick(() => {
if (!aborted) {
callback(new TimeoutError('Request timed out', params), null)
@ -70,7 +70,7 @@ class MockConnectionTimeout extends Connection {
class MockConnectionError extends Connection {
request (params, callback) {
var aborted = false
let aborted = false
process.nextTick(() => {
if (!aborted) {
callback(new ConnectionError('Kaboom'), null)
@ -86,7 +86,7 @@ class MockConnectionError extends Connection {
class MockConnectionSniff extends Connection {
request (params, callback) {
var aborted = false
let aborted = false
const sniffResult = {
nodes: {
'node-1': {
@ -133,11 +133,11 @@ function buildMockConnection (opts) {
class MockConnection extends Connection {
request (params, callback) {
var { body, statusCode } = opts.onRequest(params)
let { body, statusCode } = opts.onRequest(params)
if (typeof body !== 'string') {
body = JSON.stringify(body)
}
var aborted = false
let aborted = false
const stream = intoStream(body)
stream.statusCode = statusCode || 200
stream.headers = {

View File

@ -23,7 +23,7 @@ const debug = require('debug')('elasticsearch-test')
const workq = require('workq')
const buildServer = require('./buildServer')
var id = 0
let id = 0
function buildCluster (options, callback) {
const clusterId = id++
debug(`Booting cluster '${clusterId}'`)
@ -37,7 +37,7 @@ function buildCluster (options, callback) {
const sniffResult = { nodes: {} }
options.numberOfNodes = options.numberOfNodes || 4
for (var i = 0; i < options.numberOfNodes; i++) {
for (let i = 0; i < options.numberOfNodes; i++) {
q.add(bootNode, { id: `node${i}` })
}

View File

@ -35,7 +35,7 @@ const secureOpts = {
cert: readFileSync(join(__dirname, '..', 'fixtures', 'https.cert'), 'utf8')
}
var id = 0
let id = 0
function buildServer (handler, opts, cb) {
const serverId = id++
debug(`Booting server '${serverId}'`)