diff --git a/bin/binary-config.js b/bin/binary-config.js index 460611a2..c239c223 100644 --- a/bin/binary-config.js +++ b/bin/binary-config.js @@ -11,7 +11,7 @@ let os = process.platform let config = { name: 'sandbox-binary', bin: { - cli: 'binary-entry.js' + cli: 'binary-entry.js', }, pkg: { // Don't manually include runtimes/deno.js in scripts, as it fails on pkg#997 @@ -26,8 +26,8 @@ let config = { '../src/tables/_aws-lite-dynamodb-vendor.js', ], targets: [], - outputPath: 'bin' - } + outputPath: 'bin', + }, } let nodeVer = `node18` @@ -51,7 +51,7 @@ else { config.pkg.targets = [ p('linux'), p('darwin'), - p('win32') + p('win32'), ].filter(Boolean) } diff --git a/package.json b/package.json index dd296811..dd0adab9 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "ws": "~8.16.0" }, "devDependencies": { - "@architect/eslint-config": "~2.1.2", + "@architect/eslint-config": "~3.0.0-RC.0", "@architect/functions": "~8.1.0", "@architect/req-res-fixtures": "git+https://github.com/architect/req-res-fixtures.git", "@aws-lite/apigatewaymanagementapi": "~0.0.8", diff --git a/src/arc/_runtime-api/index.js b/src/arc/_runtime-api/index.js index 0510f9f7..be126c1d 100644 --- a/src/arc/_runtime-api/index.js +++ b/src/arc/_runtime-api/index.js @@ -22,7 +22,7 @@ function runtimeAPI ({ body }, params, req, res) { `[${requestID}] Incoming runtime API request`, `URL: ${url}`, `Headers: ${JSON.stringify(req.headers)}`, - `Body: ${body ? `'${body}'` : '[no body]'} ${body ? `(${Buffer.byteLength(body)}b)` : ''}` + `Body: ${body ? `'${body}'` : '[no body]'} ${body ? `(${Buffer.byteLength(body)}b)` : ''}`, ) // Don't respond to unknown request ID roots @@ -80,7 +80,7 @@ function runtimeAPI ({ body }, params, req, res) { update.debug.status(`[${requestID}] Missing request ID in /response request`) return res.end() } - invocations[requestID].response = body && JSON.parse(body) || undefined + invocations[requestID].response = (body && JSON.parse(body)) || undefined res.statusCode = accepted res.end() update.debug.status(`[${requestID}] Received /response request`) diff --git a/src/arc/_ssm/index.js b/src/arc/_ssm/index.js index 20b1563a..17bdca32 100644 --- a/src/arc/_ssm/index.js +++ b/src/arc/_ssm/index.js @@ -58,7 +58,7 @@ module.exports = function _ssm ({ body, services }, params, req, res) { Type: 'String', Value, Version: 1, - ARN: 'Architect Sandbox' + ARN: 'Architect Sandbox', }) // ssm.getParametersByPath() diff --git a/src/cli/_stdin.js b/src/cli/_stdin.js index f47fbe54..492a6d8f 100644 --- a/src/cli/_stdin.js +++ b/src/cli/_stdin.js @@ -14,7 +14,7 @@ module.exports = function handleStdin (params) { rehydrate({ timer: 'rehydrateAll', msg: 'Rehydrating all shared files...', - force: true + force: true, }) } if (input === 'S') { @@ -22,7 +22,7 @@ module.exports = function handleStdin (params) { timer: 'rehydrateShared', only: 'shared', msg: 'Rehydrating src/shared...', - force: true + force: true, }) } if (input === 'V') { @@ -30,7 +30,7 @@ module.exports = function handleStdin (params) { timer: 'rehydrateViews', only: 'views', msg: 'Rehydrating src/views...', - force: true + force: true, }) } if (key.sequence === '\u0003' || key.sequence === '\u0004') { diff --git a/src/cli/_watcher.js b/src/cli/_watcher.js index a02f6018..773756c3 100644 --- a/src/cli/_watcher.js +++ b/src/cli/_watcher.js @@ -103,11 +103,11 @@ module.exports = function runWatcher (args, params) { * Watch for pertinent filesystem changes */ watcher.on('all', function (event, filename) { - if (ignoredEvents.includes(event)){ + if (ignoredEvents.includes(event)) { update.debug.status(`Watcher: ignored '${event}' on ${filename}`) return } - if (pluginsRunning || paused && existsSync(pauseFile)) { + if (pluginsRunning || (paused && existsSync(pauseFile))) { return } if (!paused && existsSync(pauseFile)) { @@ -124,7 +124,7 @@ module.exports = function runWatcher (args, params) { rehydrate({ timer: 'rehydrateAll', msg: 'Restoring shared file symlinks...', - force: true + force: true, }, liveReloadClients) } } @@ -199,7 +199,7 @@ module.exports = function runWatcher (args, params) { rehydrate({ timer: 'rehydrateShared', only: 'shared', - msg: 'Shared file changed, rehydrating functions...' + msg: 'Shared file changed, rehydrating functions...', }, liveReloadClients) } @@ -211,7 +211,7 @@ module.exports = function runWatcher (args, params) { rehydrate({ timer: 'rehydrateViews', only: 'views', - msg: 'Views file changed, rehydrating views...' + msg: 'Views file changed, rehydrating views...', }, liveReloadClients) } diff --git a/src/cli/cli.js b/src/cli/cli.js index c0cbe0ba..30496346 100755 --- a/src/cli/cli.js +++ b/src/cli/cli.js @@ -16,8 +16,8 @@ update({ pkg, shouldNotifyInNpmScript: true }) align: 'center', borderColor: 'green', borderStyle: 'round', - dimBorder: true - } + dimBorder: true, + }, }) // Hit it diff --git a/src/events/_listener.js b/src/events/_listener.js index 70d1061f..84cd2716 100644 --- a/src/events/_listener.js +++ b/src/events/_listener.js @@ -69,7 +69,7 @@ module.exports = function eventBusListener (params, req, res) { if (err?.message === 'lambda_not_found') { update.warn( `@${arcType} ${name} missing Lambda handler file\n` + - `Please create a handler file, or run [npx] arc init, or add 'autocreate true' to your project preferences file's '@create' pragma` + `Please create a handler file, or run [npx] arc init, or add 'autocreate true' to your project preferences file's '@create' pragma`, ) } else if (err) { diff --git a/src/http/index.js b/src/http/index.js index a489af99..733985b1 100644 --- a/src/http/index.js +++ b/src/http/index.js @@ -72,7 +72,7 @@ function start (params, callback) { let httpPort = params.ports.http // Node.js 17+ changed DNS lookup behavior for host binding; prefer host to be undefined unless manually specified httpServer.listen(httpPort, host, callback) - } + }, ], callback) } diff --git a/src/http/invoke-http/http/_req-fmt.js b/src/http/invoke-http/http/_req-fmt.js index e02fa57e..9909ea8a 100644 --- a/src/http/invoke-http/http/_req-fmt.js +++ b/src/http/invoke-http/http/_req-fmt.js @@ -12,7 +12,7 @@ module.exports = function requestFormatter ({ method, path, req }) { // Here we go! let request = { - version: '2.0' + version: '2.0', } // Resource may be manually supplied via ASAP @@ -73,7 +73,7 @@ module.exports = function requestFormatter ({ method, path, req }) { }, // requestId // TODO add me maybe routeKey, - timeEpoch: Math.floor(Date.now() / 1000) + timeEpoch: Math.floor(Date.now() / 1000), } // Path parameters diff --git a/src/http/invoke-http/http/_res-header-fmt.js b/src/http/invoke-http/http/_res-header-fmt.js index 7469d794..36bdf942 100644 --- a/src/http/invoke-http/http/_res-header-fmt.js +++ b/src/http/invoke-http/http/_res-header-fmt.js @@ -13,7 +13,7 @@ module.exports = function responseHeaderFormatter (normalizedHeaders) { 'content-length', 'date', 'upgrade', - 'transfer-encoding' + 'transfer-encoding', ] for (let [ key, value ] of Object.entries(normalizedHeaders)) { diff --git a/src/http/invoke-http/rest/_req-fmt.js b/src/http/invoke-http/rest/_req-fmt.js index e7f939f0..4bb139d9 100644 --- a/src/http/invoke-http/rest/_req-fmt.js +++ b/src/http/invoke-http/rest/_req-fmt.js @@ -77,9 +77,9 @@ module.exports = function requestFormatter ({ method, path, req }, httpApi) { protocol: `HTTP/${req.httpVersion}`, identity: { sourceIp, - userAgent: headers['User-Agent'] || headers['user-agent'] || null + userAgent: headers['User-Agent'] || headers['user-agent'] || null, }, - } + }, } // Base64 encoding status set by binary handler middleware diff --git a/src/http/invoke-http/rest/_res-header-fmt.js b/src/http/invoke-http/rest/_res-header-fmt.js index 6f6bf2bf..0d176b1a 100644 --- a/src/http/invoke-http/rest/_res-header-fmt.js +++ b/src/http/invoke-http/rest/_res-header-fmt.js @@ -8,7 +8,7 @@ module.exports = function responseHeaderFormatter (normalizedHeaders, httpApi) { let headers = {} let drops = [ 'upgrade', // Technically not dropped, but header is validated by APIG and impl can cause HTTP issues, so we'll sidestep in Sandbox - 'transfer-encoding' + 'transfer-encoding', ] if (httpApi) { diff --git a/src/http/invoke-http/rest/_res-validate.js b/src/http/invoke-http/rest/_res-validate.js index 8fc13409..ae7d4661 100644 --- a/src/http/invoke-http/rest/_res-validate.js +++ b/src/http/invoke-http/rest/_res-validate.js @@ -12,7 +12,7 @@ module.exports = function responseValidator ({ res, result }, httpApi) { 'body', 'headers', 'multiValueHeaders', - 'isBase64Encoded' + 'isBase64Encoded', ] // Malformed returns – must be an object diff --git a/src/http/invoke-http/utils/livereload.js b/src/http/invoke-http/utils/livereload.js index 41c85d3a..9c9f9c6b 100644 --- a/src/http/invoke-http/utils/livereload.js +++ b/src/http/invoke-http/utils/livereload.js @@ -73,7 +73,7 @@ function compressor (direction, type, body) { let exec = { gzip: compress ? gzipSync : gunzipSync, br: compress ? brotliCompressSync : brotliDecompressSync, - deflate: compress ? deflateSync : inflateSync + deflate: compress ? deflateSync : inflateSync, } if (!exec[type]) return body diff --git a/src/http/invoke-http/utils/validate.js b/src/http/invoke-http/utils/validate.js index 31760e92..2a175ab3 100644 --- a/src/http/invoke-http/utils/validate.js +++ b/src/http/invoke-http/utils/validate.js @@ -27,7 +27,7 @@ autocreate true other: (title, body) => `${head}
${body}
`, chonky: size => `
Responses must be 6MB or less; this response is ${size}
` +Responses must be 6MB or less; this response is ${size}
`, } function invalid (res, body) { @@ -36,12 +36,12 @@ function invalid (res, body) { res.setHeader('cache-control', 'no-cache, no-store, must-revalidate, max-age=0, s-maxage=0') return { valid: false, - body + body, } } module.exports = { isBuffer, errors, - invalid + invalid, } diff --git a/src/http/invoke-ws/_req-fmt.js b/src/http/invoke-ws/_req-fmt.js index f5db2e22..ba0ff0a6 100644 --- a/src/http/invoke-ws/_req-fmt.js +++ b/src/http/invoke-ws/_req-fmt.js @@ -37,7 +37,7 @@ module.exports = function requestFormatter (params) { stage: process.env.ARC_ENV || 'testing', identity: { sourceIp }, }, - isBase64Encoded: false + isBase64Encoded: false, } if (name === 'disconnect') { diff --git a/src/http/register-websocket/connection.js b/src/http/register-websocket/connection.js index 5050123d..c3936592 100644 --- a/src/http/register-websocket/connection.js +++ b/src/http/register-websocket/connection.js @@ -9,7 +9,7 @@ module.exports = function connection (params, connectionId, ws) { pool.register(connectionId, ws) const respondToError = (err, response) => { - if (err || response && response.statusCode >= 400) { + if (err || (response && response.statusCode >= 400)) { ws.send(JSON.stringify({ 'message': 'Internal server error', connectionId, 'requestId': 'xxxxxx=' }), noop) } } diff --git a/src/http/register-websocket/pool.js b/src/http/register-websocket/pool.js index c4e5d088..d4ba25d8 100644 --- a/src/http/register-websocket/pool.js +++ b/src/http/register-websocket/pool.js @@ -9,7 +9,7 @@ let pool = { register (connectionId, ws) { pool.connections[connectionId] = { ws, - connectedAt: Date.now() + connectedAt: Date.now(), } }, delete (connectionId) { @@ -17,7 +17,7 @@ let pool = { }, reset () { pool.connections = {} - } + }, } module.exports = pool diff --git a/src/http/register-websocket/upgrade.js b/src/http/register-websocket/upgrade.js index c830638e..fbbd1f37 100644 --- a/src/http/register-websocket/upgrade.js +++ b/src/http/register-websocket/upgrade.js @@ -33,7 +33,7 @@ module.exports = function upgrade (wss, params) { socket.destroy() return } - else if (statusCode >= 200 && statusCode <= 208 || statusCode === 226) { + else if ((statusCode >= 200 && statusCode <= 208) || statusCode === 226) { wss.handleUpgrade(req, socket, head, (ws) => { wss.emit('connection', connectionId, ws) }) diff --git a/src/invoke-lambda/_plugin.js b/src/invoke-lambda/_plugin.js index d4730e1d..e9c0f81b 100644 --- a/src/invoke-lambda/_plugin.js +++ b/src/invoke-lambda/_plugin.js @@ -27,7 +27,7 @@ module.exports = async function _invoke (params, options) { let msg = `Plugin invoke: @${pragma} ${name} missing Lambda handler file` update.warn( `${msg}\n` + - `Please create a handler file, or run [npx] arc init, or add 'autocreate true' to your project preferences file's '@create' pragma` + `Please create a handler file, or run [npx] arc init, or add 'autocreate true' to your project preferences file's '@create' pragma`, ) err.message = msg return rej(err) diff --git a/src/invoke-lambda/exec/index.js b/src/invoke-lambda/exec/index.js index 3f4261c9..5ab1c76e 100644 --- a/src/invoke-lambda/exec/index.js +++ b/src/invoke-lambda/exec/index.js @@ -20,7 +20,7 @@ module.exports = function exec (lambda, params, callback) { // `sandboxPath` named differently because `staticPath` was too vague within ASAP sandboxPath: context.staticPath, // Pick up SPA setting (which may be overridden by process ARC_STATIC_SPA within ASAP) - spa: context.inventory.inv?.static?.spa + spa: context.inventory.inv?.static?.spa, }) asap(invocations[requestID].request) .then(result => { diff --git a/src/invoke-lambda/exec/runtimes/deno.mjs b/src/invoke-lambda/exec/runtimes/deno.mjs index 77246109..cb0fa96b 100644 --- a/src/invoke-lambda/exec/runtimes/deno.mjs +++ b/src/invoke-lambda/exec/runtimes/deno.mjs @@ -1,4 +1,4 @@ -/* eslint semi: [ 'error', 'always' ] */ +/* eslint @stylistic/js/semi: [ 'error', 'always' ] */ /* global Deno */ const { __ARC_CONFIG__, __ARC_CONTEXT__, AWS_LAMBDA_RUNTIME_API: runtimeAPI } = Deno.env.toObject(); const url = p => runtimeAPI + '/2018-06-01/runtime/' + p; diff --git a/src/invoke-lambda/exec/runtimes/node-esm.mjs b/src/invoke-lambda/exec/runtimes/node-esm.mjs index 5f505bf7..6f763135 100644 --- a/src/invoke-lambda/exec/runtimes/node-esm.mjs +++ b/src/invoke-lambda/exec/runtimes/node-esm.mjs @@ -1,4 +1,4 @@ -/* eslint semi: [ 'error', 'always' ] */ +/* eslint @stylistic/js/semi: [ 'error', 'always' ] */ let { __ARC_CONFIG__, __ARC_CONTEXT__, AWS_LAMBDA_RUNTIME_API: runtimeAPI } = process.env; let url = p => runtimeAPI + '/2018-06-01/runtime/' + p; @@ -17,7 +17,7 @@ function client (method, params) { body = JSON.stringify(params.body); headers['content-length'] = Buffer.byteLength(body); } - let req = http.request(params.url, { method, headers, }, res => { + let req = http.request(params.url, { method, headers }, res => { let { statusCode } = res; if (statusCode < 200 || statusCode > 202) { return reject(Error('Runtime API error:', statusCode)); @@ -30,7 +30,7 @@ function client (method, params) { try { resolve({ headers: res.headers, - body: JSON.parse(body) + body: JSON.parse(body), }); } catch (err) { @@ -58,7 +58,7 @@ function client (method, params) { let isPromise = obj => obj && typeof obj.then === 'function'; - async function run (){ + async function run () { let next = url('invocation/next'); let invocation = await get({ url: next }); let { headers, body: event } = invocation; diff --git a/src/invoke-lambda/exec/runtimes/node.js b/src/invoke-lambda/exec/runtimes/node.js index 4e255eda..4c1f9051 100644 --- a/src/invoke-lambda/exec/runtimes/node.js +++ b/src/invoke-lambda/exec/runtimes/node.js @@ -1,4 +1,4 @@ -/* eslint semi: [ 'error', 'always' ] */ +/* eslint @stylistic/js/semi: [ 'error', 'always' ] */ let { __ARC_CONFIG__, __ARC_CONTEXT__, AWS_LAMBDA_RUNTIME_API: runtimeAPI } = process.env; let url = p => runtimeAPI + '/2018-06-01/runtime/' + p; @@ -17,7 +17,7 @@ function client (method, params) { body = JSON.stringify(params.body); headers['content-length'] = Buffer.byteLength(body); } - let req = http.request(params.url, { method, headers, }, res => { + let req = http.request(params.url, { method, headers }, res => { let { statusCode } = res; if (statusCode < 200 || statusCode > 202) { return reject(Error('Runtime API error:', statusCode)); @@ -30,7 +30,7 @@ function client (method, params) { try { resolve({ headers: res.headers, - body: JSON.parse(body) + body: JSON.parse(body), }); } catch (err) { diff --git a/src/invoke-lambda/index.js b/src/invoke-lambda/index.js index 67979550..9157dca4 100644 --- a/src/invoke-lambda/index.js +++ b/src/invoke-lambda/index.js @@ -21,8 +21,8 @@ module.exports = function invokeLambda (params, callback) { // Next check payload size is within limits let maxSize = 1000 * 6000 let { body, Records } = event - let bodySize = body && JSON.stringify(body).length || 0 - let payloadSize = Records && JSON.stringify(Records).length || 0 + let bodySize = (body && JSON.stringify(body).length) || 0 + let payloadSize = (Records && JSON.stringify(Records).length) || 0 if (bodySize > maxSize || payloadSize > maxSize) { let err = Error('Maximum event body exceeded: Lambda allows up to 6MB payloads (base64-encoded)') return callback(err) diff --git a/src/lib/errors.js b/src/lib/errors.js index d87120d8..63053d1e 100644 --- a/src/lib/errors.js +++ b/src/lib/errors.js @@ -2,7 +2,7 @@ let template = require('./template') let { head } = template let headers = { 'content-type': 'text/html; charset=utf8;', - 'cache-control': 'no-cache, no-store, must-revalidate, max-age=0, s-maxage=0' + 'cache-control': 'no-cache, no-store, must-revalidate, max-age=0, s-maxage=0', } module.exports = function errors ({ lambdaError, lambda, type = 'error' }) { diff --git a/src/lib/runtime-eval.js b/src/lib/runtime-eval.js index 87a8379d..163fb721 100644 --- a/src/lib/runtime-eval.js +++ b/src/lib/runtime-eval.js @@ -53,5 +53,5 @@ module.exports = { command: 'ruby', args: script, } - } + }, } diff --git a/src/sandbox/check-runtimes/version-check.js b/src/sandbox/check-runtimes/version-check.js index 25cdf7b4..789f36f2 100644 --- a/src/sandbox/check-runtimes/version-check.js +++ b/src/sandbox/check-runtimes/version-check.js @@ -59,7 +59,7 @@ function check (configured, localRuntimes) { return { local, ok: major(runtimeVer) <= major(local), - runtime: alias ? `${runtime} (aliased to ${configured})` : runtime + runtime: alias ? `${runtime} (aliased to ${configured})` : runtime, } } if (runtime.startsWith('python')) { @@ -69,7 +69,7 @@ function check (configured, localRuntimes) { local, ok: major(runtimeVer) === major(local) && minor(runtimeVer) === minor(local), - runtime: alias ? `${runtime} (aliased to ${configured})` : runtime + runtime: alias ? `${runtime} (aliased to ${configured})` : runtime, } } if (runtime.startsWith('ruby')) { diff --git a/src/sandbox/env/_user-env.js b/src/sandbox/env/_user-env.js index d52b9063..d7f3a4cc 100644 --- a/src/sandbox/env/_user-env.js +++ b/src/sandbox/env/_user-env.js @@ -42,7 +42,7 @@ module.exports = function validateUserEnv (params, callback) { if (envOption) { let probs = [] try { - Object.entries(envOption).forEach(([ key, /* value */ ]) => { + Object.entries(envOption).forEach(([ key /* value */ ]) => { if (!validName.test(key)) { probs.push(`- Env var '${key}' is invalid, must be [a-zA-Z0-9_]`) } @@ -66,7 +66,7 @@ module.exports = function validateUserEnv (params, callback) { let dotEnv = existsSync(dotEnvPath) && dotEnvPath let local = proj?.localPreferences?.env?.[environment] && proj.localPreferencesFile let global = proj?.globalPreferences?.env?.[environment] && proj.globalPreferencesFile - let filepath = (dotEnv) && basename(dotEnv) || + let filepath = (dotEnv && basename(dotEnv)) || (local && basename(local)) || (global && `~${sep}${basename(global)}`) foundEnv = true diff --git a/src/sandbox/ports.js b/src/sandbox/ports.js index ed687c8c..ec71a002 100644 --- a/src/sandbox/ports.js +++ b/src/sandbox/ports.js @@ -15,7 +15,7 @@ module.exports = function getPorts (params, callback) { ARC_HTTP_PORT, PORT, ARC_EVENTS_PORT, ARC_TABLES_PORT, ARC_DB_EXTERNAL, - ARC_INTERNAL_PORT + ARC_INTERNAL_PORT, } = process.env let ports = {} diff --git a/src/tables/_get-db-client.js b/src/tables/_get-db-client.js index fcd6b6d6..0fb361a9 100644 --- a/src/tables/_get-db-client.js +++ b/src/tables/_get-db-client.js @@ -7,7 +7,7 @@ module.exports = function initDynamoClient ({ creds, inventory, ports }, callbac process.pkg // eslint-disable-next-line ? require(join(__dirname, '_aws-lite-dynamodb-vendor.js')) - : import('@aws-lite/dynamodb') + : import('@aws-lite/dynamodb'), ] let config = { autoloadPlugins: false, diff --git a/src/tables/create-table/_create-table.js b/src/tables/create-table/_create-table.js index 4bbe0112..3df2b699 100644 --- a/src/tables/create-table/_create-table.js +++ b/src/tables/create-table/_create-table.js @@ -17,8 +17,8 @@ module.exports = function _createTable (params, callback) { KeySchema: getKeySchema(table), ProvisionedThroughput: { ReadCapacityUnits: 5, - WriteCapacityUnits: 5 - } + WriteCapacityUnits: 5, + }, } // Handle global secondary index stuff let gsi = getGSI({ name, inventory }) diff --git a/src/tables/create-table/_get-attribute-definitions.js b/src/tables/create-table/_get-attribute-definitions.js index 3bfdee4f..f144faf8 100644 --- a/src/tables/create-table/_get-attribute-definitions.js +++ b/src/tables/create-table/_get-attribute-definitions.js @@ -18,7 +18,7 @@ module.exports = function getAttributeDefinitions (params) { if (!hasDef(partitionKey)) { defs.push({ AttributeName: partitionKey, - AttributeType: convert(partitionKeyType) + AttributeType: convert(partitionKeyType), }) } @@ -26,7 +26,7 @@ module.exports = function getAttributeDefinitions (params) { if (sortKey && !hasDef(sortKey)) { defs.push({ AttributeName: sortKey, - AttributeType: convert(sortKeyType) + AttributeType: convert(sortKeyType), }) } }) @@ -37,6 +37,6 @@ module.exports = function getAttributeDefinitions (params) { function convert (v) { return ({ 'String': 'S', - 'Number': 'N' + 'Number': 'N', })[v] } diff --git a/src/tables/create-table/_get-global-secondary-index.js b/src/tables/create-table/_get-global-secondary-index.js index fba8d805..6237b1d2 100644 --- a/src/tables/create-table/_get-global-secondary-index.js +++ b/src/tables/create-table/_get-global-secondary-index.js @@ -23,14 +23,14 @@ module.exports = function _getGSI (params) { // Always add the partition key (HASH) let KeySchema = [ { AttributeName: partitionKey, - KeyType: 'HASH' + KeyType: 'HASH', } ] // Maybe add the sort key (RANGE) if (sortKey) { KeySchema.push({ AttributeName: sortKey, - KeyType: 'RANGE' + KeyType: 'RANGE', }) } @@ -38,12 +38,12 @@ module.exports = function _getGSI (params) { IndexName, KeySchema, Projection: { - ProjectionType: 'ALL' + ProjectionType: 'ALL', }, ProvisionedThroughput: { ReadCapacityUnits: 5, - WriteCapacityUnits: 5 - } + WriteCapacityUnits: 5, + }, } return params }) diff --git a/src/tables/create-table/_get-key-schema.js b/src/tables/create-table/_get-key-schema.js index 571c2ffc..1ee2bede 100644 --- a/src/tables/create-table/_get-key-schema.js +++ b/src/tables/create-table/_get-key-schema.js @@ -4,7 +4,7 @@ let hashkeys = [ 'HashString', 'HashNumber', 'PartitionString', - 'PartitionNumber' + 'PartitionNumber', ] let rangekeys = [ 'String', @@ -12,7 +12,7 @@ let rangekeys = [ 'RangeString', 'RangeNumber', 'SortString', - 'SortNumber' + 'SortNumber', ] function validate (k, keys) { if (!keys.includes(k)) throw Error(`Unknown key type: ${k}`) @@ -25,7 +25,7 @@ module.exports = function getKeySchema (table) { validate(partitionKeyType, hashkeys) let schema = [ { AttributeName: partitionKey, - KeyType: 'HASH' + KeyType: 'HASH', } ] // Handle sort key if necessary @@ -33,7 +33,7 @@ module.exports = function getKeySchema (table) { validate(sortKeyType, rangekeys) schema.push({ AttributeName: sortKey, - KeyType: 'RANGE' + KeyType: 'RANGE', }) } diff --git a/src/tables/create-table/index.js b/src/tables/create-table/index.js index ca36684a..661119f4 100644 --- a/src/tables/create-table/index.js +++ b/src/tables/create-table/index.js @@ -19,15 +19,15 @@ module.exports = function createTables (params, callback) { staging: (callback) => { create({ TableName: `${app}-staging-${table.name}`, - table, ...params + table, ...params, }, callback) }, production: (callback) => { create({ TableName: `${app}-production-${table.name}`, - table, ...params + table, ...params, }, callback) - } + }, }, callback) } }) diff --git a/src/tables/index.js b/src/tables/index.js index 33151788..13d83945 100644 --- a/src/tables/index.js +++ b/src/tables/index.js @@ -33,7 +33,7 @@ function start (params, callback) { function (callback) { init(params, callback) - } + }, ], function _started (err) { if (err) callback(err) diff --git a/test/integration/__dep-warn-test.js b/test/integration/__dep-warn-test.js index 76b813cb..575b734a 100644 --- a/test/integration/__dep-warn-test.js +++ b/test/integration/__dep-warn-test.js @@ -62,7 +62,7 @@ function runTests (runType, t ) { t.plan(5) setup() tiny.get({ - url: url + '/deps-in-lambda' + url: url + '/deps-in-lambda', }, function _got (err) { teardown() if (err) t.end(err) @@ -82,7 +82,7 @@ function runTests (runType, t ) { t.plan(5) setup() tiny.get({ - url: url + '/deps-in-root' + url: url + '/deps-in-root', }, function _got (err) { teardown() if (err) t.end(err) @@ -102,7 +102,7 @@ function runTests (runType, t ) { t.plan(5) setup() tiny.get({ - url: url + '/deps-in-shared' + url: url + '/deps-in-shared', }, function _got (err) { teardown() if (err) t.end(err) @@ -122,7 +122,7 @@ function runTests (runType, t ) { t.plan(1) setup() tiny.get({ - url: url + '/deps-found' + url: url + '/deps-found', }, function _got (err) { teardown() if (err) t.end(err) @@ -136,7 +136,7 @@ function runTests (runType, t ) { t.test(`[Dependency warnings (basic) ${mode}] Deps missing`, t => { t.plan(2) tiny.get({ - url: url + '/deps-missing' + url: url + '/deps-missing', }, function _got (err) { if (err) { t.ok(err, 'Got a failure') @@ -159,7 +159,7 @@ function runTests (runType, t ) { t.plan(1) setup() tiny.get({ - url: url + '/shared' + url: url + '/shared', }, function _got (err) { teardown() if (err) t.end(err) @@ -174,7 +174,7 @@ function runTests (runType, t ) { t.plan(1) setup() tiny.get({ - url: url + '/views' + url: url + '/views', }, function _got (err) { teardown() if (err) t.end(err) @@ -198,7 +198,7 @@ function runTests (runType, t ) { t.plan(5) setup() tiny.get({ - url: url + '/shared' + url: url + '/shared', }, function _got (err) { teardown() if (err) t.end(err) @@ -218,7 +218,7 @@ function runTests (runType, t ) { t.plan(5) setup() tiny.get({ - url: url + '/views' + url: url + '/views', }, function _got (err) { teardown() if (err) t.end(err) @@ -247,7 +247,7 @@ function runTests (runType, t ) { t.plan(5) setup() tiny.get({ - url: url + '/shared' + url: url + '/shared', }, function _got (err) { teardown() if (err) t.end(err) @@ -267,7 +267,7 @@ function runTests (runType, t ) { t.plan(5) setup() tiny.get({ - url: url + '/views' + url: url + '/views', }, function _got (err) { teardown() if (err) t.end(err) @@ -296,7 +296,7 @@ function runTests (runType, t ) { t.plan(6) setup() tiny.get({ - url: url + '/shared' + url: url + '/shared', }, function _got (err) { teardown() if (err) t.end(err) @@ -318,7 +318,7 @@ function runTests (runType, t ) { t.plan(6) setup() tiny.get({ - url: url + '/views' + url: url + '/views', }, function _got (err) { teardown() if (err) t.end(err) diff --git a/test/integration/env-test.js b/test/integration/env-test.js index aec17ecc..b0324c9c 100644 --- a/test/integration/env-test.js +++ b/test/integration/env-test.js @@ -10,10 +10,10 @@ let systemEnvVars = [ 'ARC_APP_NAME', 'ARC_ENV', 'ARC_ROLE', 'ARC_SANDBOX', 'ARC_SESSION_TABLE_NAME', // Lambda + system stuff - 'LAMBDA_TASK_ROOT', 'PATH', 'TZ' + 'LAMBDA_TASK_ROOT', 'PATH', 'TZ', ] let shouldBeFiltered = [ - '__ARC_CONTEXT__', '__ARC_CONFIG__' + '__ARC_CONTEXT__', '__ARC_CONFIG__', ] function checkSystemEnvVars (env, t) { systemEnvVars.forEach(v => { @@ -102,7 +102,7 @@ function runTests (runType, t) { env: { DOTENV_USERLAND_ENV_VAR: 'Why hello there from overridden .env!', ENV_OPTION_USERLAND_ENV_VAR: 'Why hello there from env option!', - } + }, }) }) diff --git a/test/integration/events-test.js b/test/integration/events-test.js index 2b48f05d..53fe241a 100644 --- a/test/integration/events-test.js +++ b/test/integration/events-test.js @@ -112,7 +112,7 @@ function runTests (runType, t) { setup(t) arc.events.publish({ name: 'invalid-event', - payload: {} + payload: {}, }, function done (err) { if (err) { @@ -128,7 +128,7 @@ function runTests (runType, t) { let req = http.request({ method: 'POST', port: eventsPort, - path: '/' + path: '/', }, function done (res) { let data = '' res.resume() @@ -171,7 +171,7 @@ function runTests (runType, t) { setup(t) arc.queues.publish({ name: 'invalid-queue', - payload: {} + payload: {}, }, function done (err) { if (err) { diff --git a/test/integration/http/http-test.js b/test/integration/http/http-test.js index 2992e638..09809b46 100644 --- a/test/integration/http/http-test.js +++ b/test/integration/http/http-test.js @@ -25,7 +25,7 @@ function runTests (runType, t) { t.test(`${mode} get /`, t => { t.plan(16) tiny.get({ - url + url, }, function _got (err, result) { if (err) t.end(err) else { @@ -46,7 +46,7 @@ function runTests (runType, t) { functionVersion: '$LATEST', invokedFunctionArn: 'sandbox', memoryLimitInMB: 1152, - } + }, }) } }) @@ -56,7 +56,7 @@ function runTests (runType, t) { t.plan(15) let rawQueryString = 'whats=up' tiny.get({ - url: url + '/?' + rawQueryString + url: url + '/?' + rawQueryString, }, function _got (err, result) { if (err) t.end(err) else { @@ -80,7 +80,7 @@ function runTests (runType, t) { t.plan(15) let rawQueryString = 'whats=up&whats=there' tiny.get({ - url: url + '/?' + rawQueryString + url: url + '/?' + rawQueryString, }, function _got (err, result) { if (err) t.end(err) else { @@ -105,7 +105,7 @@ function runTests (runType, t) { let cookie = 'a=cookie' tiny.get({ url, - headers: { cookie } + headers: { cookie }, }, function _got (err, result) { if (err) t.end(err) else { @@ -128,14 +128,14 @@ function runTests (runType, t) { t.test(`${mode} get /multi-cookies-res`, t => { t.plan(1) tiny.get({ - url: url + '/multi-cookies-res' + url: url + '/multi-cookies-res', }, function _got (err, result) { if (err) t.end(err) else { t.deepEqual( result.headers['set-cookie'], [ 'c1=v1', 'c2=v2' ], - 'Response contains 2 set-cookie headers' + 'Response contains 2 set-cookie headers', ) } }) @@ -145,7 +145,7 @@ function runTests (runType, t) { t.plan(15) let rawPath = '/binary' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { @@ -170,7 +170,7 @@ function runTests (runType, t) { t.plan(15) let rawPath = '/nodejs20.x' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { @@ -194,7 +194,7 @@ function runTests (runType, t) { t.plan(15) let rawPath = '/nodejs18.x' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { @@ -218,7 +218,7 @@ function runTests (runType, t) { t.plan(15) let rawPath = '/node-esm' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { @@ -242,7 +242,7 @@ function runTests (runType, t) { t.plan(16) let rawPath = '/python3.11' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (isWindowsPythonStalling(err, t)) return else if (err) t.end(err) @@ -264,7 +264,7 @@ function runTests (runType, t) { function_version: '$LATEST', invoked_function_arn: 'sandbox', memory_limit_in_mb: 1152, - } + }, }) } }) @@ -274,7 +274,7 @@ function runTests (runType, t) { t.plan(16) let rawPath = '/python3.8' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (isWindowsPythonStalling(err, t)) return else if (err) t.end(err) @@ -296,7 +296,7 @@ function runTests (runType, t) { function_version: '$LATEST', invoked_function_arn: 'sandbox', memory_limit_in_mb: 1152, - } + }, }) } }) @@ -306,7 +306,7 @@ function runTests (runType, t) { t.plan(16) let rawPath = '/ruby3.2' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { @@ -327,7 +327,7 @@ function runTests (runType, t) { function_version: '$LATEST', invoked_function_arn: 'sandbox', memory_limit_in_mb: 1152, - } + }, }) } }) @@ -337,7 +337,7 @@ function runTests (runType, t) { t.plan(15) let rawPath = '/deno' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { @@ -361,7 +361,7 @@ function runTests (runType, t) { t.plan(15) let rawPath = '/get-c/hello/there' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { @@ -385,7 +385,7 @@ function runTests (runType, t) { t.plan(15) let rawPath = '/get-p-c/why/hello/there' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { @@ -397,7 +397,7 @@ function runTests (runType, t) { queryStringParameters: undefined, pathParameters: { param: 'why', - proxy: 'hello/there' + proxy: 'hello/there', }, rawQueryString: '', headers: '🤷🏽♀️', @@ -412,7 +412,7 @@ function runTests (runType, t) { t.plan(3) let rawPath = '/no-return' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { @@ -429,7 +429,7 @@ function runTests (runType, t) { t.plan(2) let rawPath = '/promise-return' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { @@ -444,7 +444,7 @@ function runTests (runType, t) { t.plan(15) let rawPath = '/custom' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { @@ -596,7 +596,7 @@ function runTests (runType, t) { t.plan(15) let rawPath = '/head' tiny.head({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { @@ -620,7 +620,7 @@ function runTests (runType, t) { t.plan(15) let rawPath = '/options' tiny.options({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { @@ -873,7 +873,7 @@ function runTests (runType, t) { t.test(`${mode} get /reject-promise should fail`, t => { t.plan(2) tiny.get({ - url: url + '/reject-promise' + url: url + '/reject-promise', }, function _got (err) { if (err) { t.equal(err.statusCode, 500, 'Got 500 for function error') @@ -888,7 +888,7 @@ function runTests (runType, t) { t.test(`${mode} get /throw-sync-error should fail`, t => { t.plan(2) tiny.get({ - url: url + '/throw-sync-error' + url: url + '/throw-sync-error', }, function _got (err) { if (err) { t.equal(err.statusCode, 500, 'Got 500 for function error') @@ -903,7 +903,7 @@ function runTests (runType, t) { t.test(`${mode} get /python-error should fail`, t => { t.plan(2) tiny.get({ - url: url + '/python-error' + url: url + '/python-error', }, function _got (err) { if (isWindowsPythonStalling(err, t)) return else if (err) { @@ -919,7 +919,7 @@ function runTests (runType, t) { t.test(`${mode} get /ruby-error should fail`, t => { t.plan(2) tiny.get({ - url: url + '/ruby-error' + url: url + '/ruby-error', }, function _got (err) { if (err) { t.equal(err.statusCode, 500, 'Got 500 for function error') @@ -978,7 +978,7 @@ function runTests (runType, t) { t.plan(2) rmPublic(t) tiny.get({ - url + url, }, function _got (err, result) { if (err) t.equal(err.statusCode, 404, 'Got 404 for missing file') else t.end(result) @@ -999,7 +999,7 @@ function runTests (runType, t) { t.test(`${mode} get / without defining get / should succeed if index.html is present`, t => { t.plan(2) tiny.get({ - url + url, }, function _got (err, result) { if (err) t.end(err) else { @@ -1024,7 +1024,7 @@ function runTests (runType, t) { t.test(`${mode} get /missing should fail if missing its handler file`, t => { t.plan(2) tiny.get({ - url: url + '/missing' + url: url + '/missing', }, function _got (err, result) { if (err) { t.equal(err.statusCode, 502, 'Got 502 for missing file') diff --git a/test/integration/http/httpv1-test.js b/test/integration/http/httpv1-test.js index 36cf57f6..4e2c8d83 100644 --- a/test/integration/http/httpv1-test.js +++ b/test/integration/http/httpv1-test.js @@ -25,7 +25,7 @@ function runTests (runType, t) { t.test(`${mode} get /`, t => { t.plan(17) tiny.get({ - url + url, }, function _got (err, result) { if (err) t.end(err) else { @@ -47,7 +47,7 @@ function runTests (runType, t) { functionVersion: '$LATEST', invokedFunctionArn: 'sandbox', memoryLimitInMB: 1152, - } + }, }) } }) @@ -56,7 +56,7 @@ function runTests (runType, t) { t.test(`${mode} get /?whats=up`, t => { t.plan(16) tiny.get({ - url: url + '/?whats=up' + url: url + '/?whats=up', }, function _got (err, result) { if (err) t.end(err) else { @@ -80,7 +80,7 @@ function runTests (runType, t) { t.test(`${mode} get /?whats=up&whats=there`, t => { t.plan(16) tiny.get({ - url: url + '/?whats=up&whats=there' + url: url + '/?whats=up&whats=there', }, function _got (err, result) { if (err) t.end(err) else { @@ -105,7 +105,7 @@ function runTests (runType, t) { t.plan(17) let path = '/binary' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -132,7 +132,7 @@ function runTests (runType, t) { t.plan(16) let path = '/nodejs20.x' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -157,7 +157,7 @@ function runTests (runType, t) { t.plan(16) let path = '/nodejs18.x' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -182,7 +182,7 @@ function runTests (runType, t) { t.plan(16) let path = '/node-esm' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -207,7 +207,7 @@ function runTests (runType, t) { t.plan(17) let path = '/python3.11' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (isWindowsPythonStalling(err, t)) return else if (err) t.end(err) @@ -230,7 +230,7 @@ function runTests (runType, t) { function_version: '$LATEST', invoked_function_arn: 'sandbox', memory_limit_in_mb: 1152, - } + }, }) } }) @@ -239,7 +239,7 @@ function runTests (runType, t) { t.plan(17) let path = '/python3.8' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (isWindowsPythonStalling(err, t)) return else if (err) t.end(err) @@ -262,7 +262,7 @@ function runTests (runType, t) { function_version: '$LATEST', invoked_function_arn: 'sandbox', memory_limit_in_mb: 1152, - } + }, }) } }) @@ -272,7 +272,7 @@ function runTests (runType, t) { t.plan(17) let path = '/ruby3.2' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -294,7 +294,7 @@ function runTests (runType, t) { function_version: '$LATEST', invoked_function_arn: 'sandbox', memory_limit_in_mb: 1152, - } + }, }) } }) @@ -304,7 +304,7 @@ function runTests (runType, t) { t.plan(16) let path = '/deno' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -329,7 +329,7 @@ function runTests (runType, t) { t.plan(16) let path = '/get-c/hello/there' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -354,7 +354,7 @@ function runTests (runType, t) { t.plan(16) let path = '/get-p-c/why/hello/there' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -369,7 +369,7 @@ function runTests (runType, t) { multiValueQueryStringParameters: null, pathParameters: { param: 'why', - proxy: 'hello/there' + proxy: 'hello/there', }, body: null, isBase64Encoded: false, @@ -381,7 +381,7 @@ function runTests (runType, t) { t.test(`${mode} get /no-return (noop)`, t => { t.plan(2) tiny.get({ - url: url + '/no-return' + url: url + '/no-return', }, function _got (err, result) { if (err) { let message = 'No response found' @@ -396,7 +396,7 @@ function runTests (runType, t) { t.plan(16) let path = '/custom' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -526,7 +526,7 @@ function runTests (runType, t) { t.plan(16) let path = '/head' tiny.head({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -551,7 +551,7 @@ function runTests (runType, t) { t.plan(16) let path = '/options' tiny.options({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -805,7 +805,7 @@ function runTests (runType, t) { t.test(`${mode} get /python-error should fail`, t => { t.plan(2) tiny.get({ - url: url + '/python-error' + url: url + '/python-error', }, function _got (err) { if (isWindowsPythonStalling(err, t)) return else if (err) { @@ -821,7 +821,7 @@ function runTests (runType, t) { t.test(`${mode} get /ruby-error should fail`, t => { t.plan(2) tiny.get({ - url: url + '/ruby-error' + url: url + '/ruby-error', }, function _got (err) { if (err) { t.equal(err.statusCode, 500, 'Got 500 for function error') @@ -880,7 +880,7 @@ function runTests (runType, t) { t.plan(2) rmPublic(t) tiny.get({ - url + url, }, function _got (err, result) { if (err) t.equal(err.statusCode, 404, 'Got 404 for missing file') else t.end(result) @@ -901,7 +901,7 @@ function runTests (runType, t) { t.test(`${mode} get / without defining get / should succeed if index.html is present`, t => { t.plan(2) tiny.get({ - url + url, }, function _got (err, result) { if (err) t.end(err) else { @@ -926,7 +926,7 @@ function runTests (runType, t) { t.test(`${mode} get /missing should fail if missing its handler file`, t => { t.plan(2) tiny.get({ - url: url + '/missing' + url: url + '/missing', }, function _got (err, result) { if (err) { t.equal(err.statusCode, 502, 'Got 502 for missing file') diff --git a/test/integration/http/misc-http-test.js b/test/integration/http/misc-http-test.js index ffa0762e..1733711e 100644 --- a/test/integration/http/misc-http-test.js +++ b/test/integration/http/misc-http-test.js @@ -25,7 +25,7 @@ function runTests (runType, t) { t.plan(2) let path = '/path' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) { let message = '@http get /path' @@ -40,7 +40,7 @@ function runTests (runType, t) { t.plan(3) let path = '/get-c/' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -56,7 +56,7 @@ function runTests (runType, t) { t.plan(3) let path = '/get-c/hi' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -72,7 +72,7 @@ function runTests (runType, t) { t.plan(3) let path = '/get-c/hi/' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -88,7 +88,7 @@ function runTests (runType, t) { t.plan(3) let path = '/get-c/hi/there/wonderful/person' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -104,7 +104,7 @@ function runTests (runType, t) { t.test(`[Timeout / ${runType}] get /times-out`, t => { t.plan(3) tiny.get({ - url: url + '/times-out' + url: url + '/times-out', }, function _got (err, result) { if (err) { let message = 'Timeout error' @@ -120,7 +120,7 @@ function runTests (runType, t) { t.test(`[context.getRemainingTimeInMillis() / ${runType}] get /context-remaining-ms-node-cjs`, t => { t.plan(1) tiny.get({ - url: url + '/context-remaining-ms-node-cjs' + url: url + '/context-remaining-ms-node-cjs', }, function _got (err, result) { if (err) t.end(err) else { @@ -134,7 +134,7 @@ function runTests (runType, t) { t.test(`[context.getRemainingTimeInMillis() / ${runType}] get /context-remaining-ms-node-esm`, t => { t.plan(1) tiny.get({ - url: url + '/context-remaining-ms-node-esm' + url: url + '/context-remaining-ms-node-esm', }, function _got (err, result) { if (err) t.end(err) else { @@ -148,7 +148,7 @@ function runTests (runType, t) { t.test(`[Big, but not oversized response / ${runType}] get /big`, t => { t.plan(1) tiny.get({ - url: url + '/big' + url: url + '/big', }, function _got (err, result) { if (err) t.end(err) else { @@ -162,7 +162,7 @@ function runTests (runType, t) { t.test(`[Big, but not oversized response / ${runType}] get /big-unicode`, t => { t.plan(1) tiny.get({ - url: url + '/big-unicode' + url: url + '/big-unicode', }, function _got (err, result) { if (err) t.end(err) else { @@ -176,7 +176,7 @@ function runTests (runType, t) { t.test(`[Oversized response / ${runType}] get /chonky`, t => { t.plan(2) tiny.get({ - url: url + '/chonky' + url: url + '/chonky', }, function _got (err, result) { if (err) { let message = 'Invalid payload size' @@ -193,7 +193,7 @@ function runTests (runType, t) { let body = { text: '.'.repeat(validSize) } tiny.post({ url: url + '/big', - body + body, }, function _got (err, result) { if (err) t.end(err) else t.deepEqual(body, result.body, 'Did not fail on a very large request') @@ -206,7 +206,7 @@ function runTests (runType, t) { let body = { text: '.'.repeat(validSize) } tiny.post({ url: url + '/big', - body + body, }, function _got (err, result) { if (err) { let message = 'Maximum event body exceeded' @@ -221,7 +221,7 @@ function runTests (runType, t) { t.plan(2) let path = '/_static/hi.txt' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -236,7 +236,7 @@ function runTests (runType, t) { t.plan(3) let path = '/_static/foo/hi.json' tiny.get({ - url: url + path + url: url + path, }, function _got (err) { if (err) { let { body, statusCode } = err @@ -260,7 +260,7 @@ function runTests (runType, t) { t.plan(2) let path = '/_static/foo/hi.txt' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -275,7 +275,7 @@ function runTests (runType, t) { t.plan(3) let path = '/_static/hi.txt' tiny.get({ - url: url + path + url: url + path, }, function _got (err) { if (err) { let { body, statusCode } = err @@ -335,7 +335,7 @@ function runTests (runType, t) { t.plan(2) let start = Date.now() tiny.get({ - url: url + '/chonk' + url: url + '/chonk', }, function _got (err, result) { if (err) t.end(err) else { diff --git a/test/integration/http/rest-test.js b/test/integration/http/rest-test.js index 149bf9c6..bc091e2b 100644 --- a/test/integration/http/rest-test.js +++ b/test/integration/http/rest-test.js @@ -25,7 +25,7 @@ function runTests (runType) { test(`${mode} get /`, t => { t.plan(17) tiny.get({ - url + url, }, function _got (err, result) { if (err) t.end(err) else { @@ -47,7 +47,7 @@ function runTests (runType) { functionVersion: '$LATEST', invokedFunctionArn: 'sandbox', mem: 1152, - } + }, }) } }) @@ -56,7 +56,7 @@ function runTests (runType) { test(`${mode} get /?whats=up`, t => { t.plan(16) tiny.get({ - url: url + '/?whats=up' + url: url + '/?whats=up', }, function _got (err, result) { if (err) t.end(err) else { @@ -80,7 +80,7 @@ function runTests (runType) { test(`${mode} get /?whats=up&whats=there`, t => { t.plan(16) tiny.get({ - url: url + '/?whats=up&whats=there' + url: url + '/?whats=up&whats=there', }, function _got (err, result) { if (err) t.end(err) else { @@ -105,7 +105,7 @@ function runTests (runType) { t.plan(17) let path = '/binary' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -132,7 +132,7 @@ function runTests (runType) { t.plan(16) let path = '/nodejs20.x' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -157,7 +157,7 @@ function runTests (runType) { t.plan(16) let path = '/nodejs18.x' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -182,7 +182,7 @@ function runTests (runType) { t.plan(17) let path = '/python3.11' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (isWindowsPythonStalling(err, t)) return else if (err) t.end(err) @@ -205,7 +205,7 @@ function runTests (runType) { function_version: '$LATEST', invoked_function_arn: 'sandbox', memory_limit_in_mb: 1152, - } + }, }) } }) @@ -215,7 +215,7 @@ function runTests (runType) { t.plan(17) let path = '/python3.8' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (isWindowsPythonStalling(err, t)) return else if (err) t.end(err) @@ -238,7 +238,7 @@ function runTests (runType) { function_version: '$LATEST', invoked_function_arn: 'sandbox', memory_limit_in_mb: 1152, - } + }, }) } }) @@ -248,7 +248,7 @@ function runTests (runType) { t.plan(17) let path = '/ruby3.2' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -270,7 +270,7 @@ function runTests (runType) { function_version: '$LATEST', invoked_function_arn: 'sandbox', memory_limit_in_mb: 1152, - } + }, }) } }) @@ -280,7 +280,7 @@ function runTests (runType) { t.plan(16) let path = '/deno' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -304,7 +304,7 @@ function runTests (runType) { test(`${mode} get /no-return (noop)`, t => { t.plan(2) tiny.get({ - url: url + '/no-return' + url: url + '/no-return', }, function _got (err, result) { if (err) { let message = 'No response found' @@ -468,7 +468,7 @@ function runTests (runType) { t.plan(16) let path = '/path/hello/there' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -493,7 +493,7 @@ function runTests (runType) { t.plan(16) let path = '/any' tiny.get({ - url: url + path + url: url + path, }, function _got (err, result) { if (err) t.end(err) else { @@ -517,7 +517,7 @@ function runTests (runType) { test(`${mode} get /python-error should fail`, t => { t.plan(2) tiny.get({ - url: url + '/python-error' + url: url + '/python-error', }, function _got (err) { if (isWindowsPythonStalling(err, t)) return else if (err) { @@ -533,7 +533,7 @@ function runTests (runType) { test(`${mode} get /ruby-error should fail`, t => { t.plan(2) tiny.get({ - url: url + '/ruby-error' + url: url + '/ruby-error', }, function _got (err) { if (err) { t.equal(err.statusCode, 500, 'Got 500 for function error') @@ -560,7 +560,7 @@ function runTests (runType) { t.plan(2) rmPublic(t) tiny.get({ - url + url, }, function _got (err, result) { if (err) t.equal(err.statusCode, 404, 'Got 404 for missing file') else t.end(result) @@ -581,7 +581,7 @@ function runTests (runType) { test(`${mode} get / without defining get / should succeed if index.html is present`, t => { t.plan(2) tiny.get({ - url + url, }, function _got (err, result) { if (err) t.end(err) else { @@ -606,7 +606,7 @@ function runTests (runType) { test(`${mode} get /missing should fail if missing its handler file`, t => { t.plan(2) tiny.get({ - url: url + '/missing' + url: url + '/missing', }, function _got (err, result) { if (err) { t.equal(err.statusCode, 502, 'Got 502 for missing file') diff --git a/test/integration/lambda-termination-test.js b/test/integration/lambda-termination-test.js index 80ddaa7d..b150df36 100644 --- a/test/integration/lambda-termination-test.js +++ b/test/integration/lambda-termination-test.js @@ -80,7 +80,7 @@ function runTests (runType, t) { arc.events.publish({ name: 'event-does-not-timeout', - payload: { path: fine } + payload: { path: fine }, }, function done (err) { if (err) t.end(err) @@ -98,7 +98,7 @@ function runTests (runType, t) { setup(t) arc.events.publish({ name: 'event-timeout-async', - payload + payload, }, function done (err) { if (err) t.end(err) @@ -111,7 +111,7 @@ function runTests (runType, t) { setup(t) arc.events.publish({ name: 'event-timeout-async-child', - payload + payload, }, function done (err) { if (err) t.end(err) @@ -125,7 +125,7 @@ function runTests (runType, t) { setup(t) arc.events.publish({ name: 'event-timeout-async-settimeout', - payload + payload, }, function done (err) { if (err) t.end(err) @@ -138,7 +138,7 @@ function runTests (runType, t) { setup(t) arc.events.publish({ name: 'event-timeout-sync', - payload + payload, }, function done (err) { if (err) t.end(err) @@ -151,7 +151,7 @@ function runTests (runType, t) { setup(t) arc.events.publish({ name: 'event-timeout-sync-child', - payload + payload, }, function done (err) { if (err) t.end(err) @@ -164,7 +164,7 @@ function runTests (runType, t) { setup(t) arc.events.publish({ name: 'event-no-exit-after-return', - payload + payload, }, function done (err) { if (err) t.end(err) @@ -180,7 +180,7 @@ function runTests (runType, t) { process.env.AWS_LAMBDA_FUNCTION_NAME = 'yep' arc.events.publish({ name: 'event-timeout-sync-child', - payload + payload, }, function done (err) { if (err) t.end(err) diff --git a/test/integration/misc-test.js b/test/integration/misc-test.js index 778e3df1..bf6e1060 100644 --- a/test/integration/misc-test.js +++ b/test/integration/misc-test.js @@ -25,12 +25,12 @@ function runTests (runType, t) { t.plan(6) let rawPath = '/deno/index.js' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { checkResult(t, result.body, { - message: 'Hello from get /deno/index.js' + message: 'Hello from get /deno/index.js', }) } }) @@ -40,12 +40,12 @@ function runTests (runType, t) { t.plan(6) let rawPath = '/deno/index.ts' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { checkResult(t, result.body, { - message: 'Hello from get /deno/index.ts' + message: 'Hello from get /deno/index.ts', }) } }) @@ -55,12 +55,12 @@ function runTests (runType, t) { t.plan(6) let rawPath = '/deno/index.tsx' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { checkResult(t, result.body, { - message: 'Hello from get /deno/index.tsx' + message: 'Hello from get /deno/index.tsx', }) } }) @@ -70,12 +70,12 @@ function runTests (runType, t) { t.plan(6) let rawPath = '/deno/mod.js' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { checkResult(t, result.body, { - message: 'Hello from get /deno/mod.js' + message: 'Hello from get /deno/mod.js', }) } }) @@ -85,12 +85,12 @@ function runTests (runType, t) { t.plan(6) let rawPath = '/deno/mod.ts' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { checkResult(t, result.body, { - message: 'Hello from get /deno/mod.ts' + message: 'Hello from get /deno/mod.ts', }) } }) @@ -100,12 +100,12 @@ function runTests (runType, t) { t.plan(6) let rawPath = '/deno/mod.tsx' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { checkResult(t, result.body, { - message: 'Hello from get /deno/mod.tsx' + message: 'Hello from get /deno/mod.tsx', }) } }) @@ -116,12 +116,12 @@ function runTests (runType, t) { t.plan(6) let rawPath = '/node/esm/index.js' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { checkResult(t, result.body, { - message: 'Hello from get /node/esm/index.js' + message: 'Hello from get /node/esm/index.js', }) } }) @@ -131,12 +131,12 @@ function runTests (runType, t) { t.plan(6) let rawPath = '/node/esm/index.mjs' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { checkResult(t, result.body, { - message: 'Hello from get /node/esm/index.mjs' + message: 'Hello from get /node/esm/index.mjs', }) } }) @@ -146,12 +146,12 @@ function runTests (runType, t) { t.plan(6) let rawPath = '/node/cjs/index.cjs' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { checkResult(t, result.body, { - message: 'Hello from get /node/cjs/index.cjs' + message: 'Hello from get /node/cjs/index.cjs', }) } }) @@ -161,12 +161,12 @@ function runTests (runType, t) { t.plan(6) let rawPath = '/node/cjs/index.js' tiny.get({ - url: url + rawPath + url: url + rawPath, }, function _got (err, result) { if (err) t.end(err) else { checkResult(t, result.body, { - message: 'Hello from get /node/cjs/index.js' + message: 'Hello from get /node/cjs/index.js', }) } }) @@ -183,7 +183,7 @@ function runTests (runType, t) { t.test(`[Misc / ${runType}] Check multitenant Lambda on get /hello`, t => { t.plan(16) tiny.get({ - url: url + '/hello' + url: url + '/hello', }, function _got (err, result) { if (err) t.end(err) else { @@ -204,7 +204,7 @@ function runTests (runType, t) { functionVersion: '$LATEST', invokedFunctionArn: 'sandbox', memoryLimitInMB: 1152, - } + }, }) } }) @@ -213,7 +213,7 @@ function runTests (runType, t) { t.test(`[Misc / ${runType}] Check multitenant Lambda on get /hi`, t => { t.plan(16) tiny.get({ - url: url + '/hi' + url: url + '/hi', }, function _got (err, result) { if (err) t.end(err) else { @@ -234,7 +234,7 @@ function runTests (runType, t) { functionVersion: '$LATEST', invokedFunctionArn: 'sandbox', memoryLimitInMB: 1152, - } + }, }) } }) diff --git a/test/integration/tables-test.js b/test/integration/tables-test.js index 732f246a..37c12035 100644 --- a/test/integration/tables-test.js +++ b/test/integration/tables-test.js @@ -68,8 +68,8 @@ function runTests (runType, t) { TableName, Item: { accountID: 'mock-account-id', - email: 'person@email.lol' - } + email: 'person@email.lol', + }, }) t.ok(result, `Got result: ${str(result)}`) teardown(t) @@ -79,7 +79,7 @@ function runTests (runType, t) { t.plan(1) setup(t) let result = await dynamo.DescribeTable({ - TableName + TableName, }) t.equal(result.Table.GlobalSecondaryIndexes[0].IndexName, 'email-index', 'Got index: email-index') teardown(t) @@ -89,7 +89,7 @@ function runTests (runType, t) { t.plan(3) setup(t) let result = await dynamo.DescribeTable({ - TableName: TableName2 + TableName: TableName2, }) let indexes = result.Table.GlobalSecondaryIndexes t.equal(indexes.length, 2, 'Got back two indexes') @@ -104,8 +104,8 @@ function runTests (runType, t) { let result = await dynamo.GetItem({ TableName, Key: { - accountID: 'fake-account-id' - } + accountID: 'fake-account-id', + }, }) t.ok(result, `Got result: ${str(result)}`) teardown(t) @@ -120,9 +120,9 @@ function runTests (runType, t) { KeyConditions: { email: { AttributeValueList: [ { S: 'person@email.lol' } ], - ComparisonOperator: 'EQ' - } - } + ComparisonOperator: 'EQ', + }, + }, }) t.ok(result, `Got result: ${str(result)}`) teardown(t) diff --git a/test/unit/src/arc/_ssm/index-test.js b/test/unit/src/arc/_ssm/index-test.js index 2a6887a3..a157f421 100644 --- a/test/unit/src/arc/_ssm/index-test.js +++ b/test/unit/src/arc/_ssm/index-test.js @@ -17,7 +17,7 @@ function reset (t) { resBody = body t.pass('HTTP response end invoked') }, - setHeader: () => {} + setHeader: () => {}, } } @@ -40,8 +40,8 @@ test('ssm module should return JSON containing all parameters for a stack if onl body: '{"Path":"/MyAppTesting"}', services: { tables: { 'my-table': 'my-app-staging-my-table' }, - someplugin: { pluginService: 'some:other:arn' } - } + someplugin: { pluginService: 'some:other:arn' }, + }, }, params, req, res) t.equals(res.statusCode, 200, 'response statuscode set to 200') let body = JSON.parse(resBody) @@ -56,8 +56,8 @@ test('ssm module should return JSON containing all service type-specific paramet body: '{"Path":"/MyAppTesting/someplugin"}', services: { tables: { 'my-table': 'my-app-staging-my-table' }, - someplugin: { pluginService: 'some:other:arn' } - } + someplugin: { pluginService: 'some:other:arn' }, + }, }, params, req, res) t.equals(res.statusCode, 200, 'response statuscode set to 200') let body = JSON.parse(resBody) diff --git a/test/unit/src/arc/_ssm/services-test.js b/test/unit/src/arc/_ssm/services-test.js index ecc0aa80..95adbd34 100644 --- a/test/unit/src/arc/_ssm/services-test.js +++ b/test/unit/src/arc/_ssm/services-test.js @@ -15,7 +15,7 @@ test('Services should populate with plugin variables', t => { plugins: { _methods: { deploy: { services: [ pluginOne, pluginTwo, - ] + ], } } } } } services({ inventory }, (err, services) => { if (err) t.end(err) diff --git a/test/unit/src/arc/_ws/index-test.js b/test/unit/src/arc/_ws/index-test.js index ad6a6a6b..e17a5f60 100644 --- a/test/unit/src/arc/_ws/index-test.js +++ b/test/unit/src/arc/_ws/index-test.js @@ -18,11 +18,11 @@ let makeFakeSocket = () => { } let makePool = () => ({ - getConnection (id){ + getConnection (id) { console.log({ id, ws: pool.data[id]?.ws }) return pool.data[id]?.ws }, - getConnectedAt (id){ + getConnectedAt (id) { console.log({ id, connectedAt: pool.data[id]?.connectedAt }) return pool.data[id]?.connectedAt }, @@ -39,7 +39,7 @@ let makePool = () => ({ let pool = makePool() let ws = proxyquire('../../../../../src/arc/_ws', { - '../../http/register-websocket/pool': pool + '../../http/register-websocket/pool': pool, }) let req @@ -55,7 +55,7 @@ function reset (t) { resBody = body t.pass('HTTP response end invoked') }, - setHeader: () => {} + setHeader: () => {}, } } diff --git a/test/unit/src/arc/listener-test.js b/test/unit/src/arc/listener-test.js index 9aef3f8b..8fa72276 100644 --- a/test/unit/src/arc/listener-test.js +++ b/test/unit/src/arc/listener-test.js @@ -4,7 +4,7 @@ let proxyquire = require('proxyquire') let params = null let listener = proxyquire('../../../../src/arc/_listener', { './_ssm': (ps, p, req, res) => { params = ps; params.service = 'ssm'; res.end() }, - './_ws': (ps, req, res) => { params = ps; params.service = 'ws'; res.end() } + './_ws': (ps, req, res) => { params = ps; params.service = 'ws'; res.end() }, }) let req let res diff --git a/test/unit/src/db/create-table/_get-global-secondary-index-test.js b/test/unit/src/db/create-table/_get-global-secondary-index-test.js index fd0993a5..b417f5ae 100644 --- a/test/unit/src/db/create-table/_get-global-secondary-index-test.js +++ b/test/unit/src/db/create-table/_get-global-secondary-index-test.js @@ -7,12 +7,12 @@ let getGSI = require(sut) function checkBoilerplate (t, gsi) { let boilerplate = { Projection: { ProjectionType: 'ALL' }, - ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 } + ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 }, } gsi.forEach(i => { t.deepEqual({ Projection: i.Projection, - ProvisionedThroughput: i.ProvisionedThroughput + ProvisionedThroughput: i.ProvisionedThroughput, }, boilerplate, 'Got back boilerplate projection + provisioned throughput params') }) } @@ -44,7 +44,7 @@ test('Get DynamoDB GSI (normal)', t => { t.deepEqual( gsi[0].KeySchema, [ { AttributeName: 'email', KeyType: 'HASH' } ], - 'Got correct key schema' + 'Got correct key schema', ) t.equal(gsi[0].IndexName, 'email-index', `Got back correct index name: ${gsi[0].IndexName}`) checkBoilerplate(t, gsi) @@ -55,16 +55,16 @@ test('Get DynamoDB GSI (normal)', t => { t.deepEqual( gsi[0].KeySchema, [ { AttributeName: 'petID', KeyType: 'HASH' } ], - 'Got correct key schema' + 'Got correct key schema', ) t.equal(gsi[0].IndexName, 'petID-index', `Got back correct index name: ${gsi[0].IndexName}`) t.deepEqual( gsi[1].KeySchema, [ { AttributeName: 'accountID', KeyType: 'HASH' }, - { AttributeName: 'petID', KeyType: 'RANGE' } + { AttributeName: 'petID', KeyType: 'RANGE' }, ], - 'Got correct key schema' + 'Got correct key schema', ) t.equal(gsi[1].IndexName, 'accountID-petID-index', `Got back correct index name: ${gsi[0].IndexName}`) checkBoilerplate(t, gsi) @@ -76,9 +76,9 @@ test('Get DynamoDB GSI (normal)', t => { gsi[0].KeySchema, [ { AttributeName: 'location', KeyType: 'HASH' }, - { AttributeName: 'altitude', KeyType: 'RANGE' } + { AttributeName: 'altitude', KeyType: 'RANGE' }, ], - 'Got correct key schema' + 'Got correct key schema', ) t.equal(gsi[0].IndexName, 'ByAltitude', `Got back correct user-specified index name: ${gsi[0].IndexName}`) }) diff --git a/test/unit/src/http/invoke-http/http/_req-header-fmt-test.js b/test/unit/src/http/invoke-http/http/_req-header-fmt-test.js index 7f7e3197..d35f91bf 100644 --- a/test/unit/src/http/invoke-http/http/_req-header-fmt-test.js +++ b/test/unit/src/http/invoke-http/http/_req-header-fmt-test.js @@ -24,7 +24,7 @@ test('Header mangling & cookies (HTTP)', t => { let reqHeaders = { authorization: 'whatev', cookie: 'foo=bar; fiz=buz', - Foo: 'bar' + Foo: 'bar', } let { headers, cookies } = requestHeaderFormatter(reqHeaders, params) // Positive casing checks diff --git a/test/unit/src/http/invoke-http/http/_res-validate-test.js b/test/unit/src/http/invoke-http/http/_res-validate-test.js index c6e4fc5f..b7dd1ffc 100644 --- a/test/unit/src/http/invoke-http/http/_res-validate-test.js +++ b/test/unit/src/http/invoke-http/http/_res-validate-test.js @@ -5,7 +5,7 @@ let responseValidator = require(sut) function newRes () { return { - setHeader: () => {} + setHeader: () => {}, } } @@ -29,7 +29,7 @@ test('Arc v6 control response (HTTP)', t => { body: 'hi', headers: data, cookies: [ 'hi', 'there' ], - isBase64Encoded: true + isBase64Encoded: true, } let check = responseValidator({ res, result }) t.notOk(res.statusCode, `Valid response did not set error statusCode: ${res.statusCode}`) @@ -68,7 +68,7 @@ test('Arc v6 response validity (HTTP)', t => { res = newRes() result = { statusCode: 200, - body: Buffer.from('hi') + body: Buffer.from('hi'), } check = responseValidator({ res, result }) t.equal(res.statusCode, 502, `Invalid response did not set error statusCode: ${res.statusCode}`) @@ -78,7 +78,7 @@ test('Arc v6 response validity (HTTP)', t => { res = newRes() result = { statusCode: 200, - body: data + body: data, } check = responseValidator({ res, result }) t.equal(res.statusCode, 502, `Invalid response did not set error statusCode: ${res.statusCode}`) diff --git a/test/unit/src/http/invoke-http/index-req-test.js b/test/unit/src/http/invoke-http/index-req-test.js index b6c2cd75..9c1c0353 100644 --- a/test/unit/src/http/invoke-http/index-req-test.js +++ b/test/unit/src/http/invoke-http/index-req-test.js @@ -3,7 +3,7 @@ let proxyquire = require('proxyquire') let { join } = require('path') let sut = join(process.cwd(), 'src', 'http', 'invoke-http') let invoke = proxyquire(sut, { - '../../invoke-lambda': params => event = params.event + '../../invoke-lambda': params => event = params.event, }) let { arc7, arc6, headers } = require('@architect/req-res-fixtures').http.req @@ -72,7 +72,7 @@ function checkArcV7HttpResult (mock, t) { t.equal( str(event[param]), str(ref), - match(`${param}`, event[param]) + match(`${param}`, event[param]), ) }) teardown() @@ -206,7 +206,7 @@ test('Architect v7 (HTTP API mode): get /:activities/{proxy+} (/nature/hiking/wi headers, params: { activities: 'nature', - '0': mock.pathParameters.proxy + '0': mock.pathParameters.proxy, }, httpVersion, } @@ -394,7 +394,7 @@ function checkArcV6RestResult (params, mock, t) { t.equal( str(event[param]), str(mock[param]), - match(`${param}`, event[param]) + match(`${param}`, event[param]), ) }) checkMultiValueHeaders(mock, t) @@ -541,7 +541,7 @@ test('Architect v7 (HTTP + Lambda 1.0 payload): get /:activities/{proxy+} (/natu headers, params: { activities: 'nature', - '0': mock.pathParameters.proxy + '0': mock.pathParameters.proxy, }, httpVersion, } diff --git a/test/unit/src/http/invoke-http/index-res-test.js b/test/unit/src/http/invoke-http/index-res-test.js index ce663c8b..8d71f092 100644 --- a/test/unit/src/http/invoke-http/index-res-test.js +++ b/test/unit/src/http/invoke-http/index-res-test.js @@ -8,7 +8,7 @@ let invoke = proxyquire(sut, { '../../invoke-lambda': (params, callback) => { if (returnError) return callback(returnError) else callback(null, response) - } + }, }) let b64dec = i => Buffer.from(i, 'base64').toString() @@ -38,13 +38,13 @@ function getInvoker (params, _response, callback) { url, body: {}, headers: { 'Accept-Encoding': 'gzip' }, - params: {} + params: {}, } // Mocked res object let output = { getHeaders: () => ({ 'content-type': 'application/json; charset=utf-8' }), setHeader: (header, value) => headers[header] = value, - end: i => body = i + end: i => body = i, } let handler = invoke(params) handler(input, output) diff --git a/test/unit/src/http/invoke-http/index-test.js b/test/unit/src/http/invoke-http/index-test.js index c291835f..f498adcc 100644 --- a/test/unit/src/http/invoke-http/index-test.js +++ b/test/unit/src/http/invoke-http/index-test.js @@ -6,7 +6,7 @@ let sut = join(process.cwd(), 'src', 'http', 'invoke-http') let invokeResult, headers = {}, body let lambdaStub = (params, callback) => callback(null, invokeResult) let invoke = proxyquire(sut, { - '../../invoke-lambda': lambdaStub + '../../invoke-lambda': lambdaStub, }) let { headers: _headers } = require('@architect/req-res-fixtures').http.req @@ -33,7 +33,7 @@ let input = { url: url(), body: {}, headers: _headers, - params: {} + params: {}, } test('Live reload passes through', t => { @@ -61,7 +61,7 @@ test('Live reload passes through', t => { invokeResult = { statusCode: 200, headers: { 'content-type': 'text/html' }, - body: 'hi' + body: 'hi', } handler(input, response) t.equal(body, invokeResult.body, 'HTML body is unmutated') @@ -73,7 +73,7 @@ test('Live reload passes through', t => { invokeResult = { statusCode: 200, headers: { 'content-type': 'text/html' }, - body: 'hi' + body: 'hi', } handler(input, response) t.equal(body, invokeResult.body, 'HTML body is unmutated with live reload enabled') @@ -91,7 +91,7 @@ test('Live reload injects script when enabled', t => { invokeResult = { statusCode: 200, headers: { 'content-type': 'text/html' }, - body: 'henlo' + body: 'henlo', } handler(input, response) t.notEqual(body, invokeResult.body, 'HTML body mutated with live reload enabled') diff --git a/test/unit/src/http/invoke-http/rest/_req-header-fmt-test.js b/test/unit/src/http/invoke-http/rest/_req-header-fmt-test.js index f496a680..188647df 100644 --- a/test/unit/src/http/invoke-http/rest/_req-header-fmt-test.js +++ b/test/unit/src/http/invoke-http/rest/_req-header-fmt-test.js @@ -29,7 +29,7 @@ test('Header mangling (HTTP + Lambda 1.0 payload)', t => { host: 'whatev', 'user-agent': 'whatev', date: 'whatev', - Foo: 'bar' + Foo: 'bar', } let { headers, multiValueHeaders } = headerFormatter(reqHeaders, true, params) // Positive casing checks @@ -97,7 +97,7 @@ test('Header mangling (REST)', t => { host: 'whatev', 'user-agent': 'whatev', date: 'whatev', - Foo: 'bar' + Foo: 'bar', } let { headers, multiValueHeaders } = headerFormatter(reqHeaders, undefined, params) // Positive casing checks diff --git a/test/unit/src/http/invoke-http/rest/_res-validate-test.js b/test/unit/src/http/invoke-http/rest/_res-validate-test.js index b67929f0..49dcf905 100644 --- a/test/unit/src/http/invoke-http/rest/_res-validate-test.js +++ b/test/unit/src/http/invoke-http/rest/_res-validate-test.js @@ -5,7 +5,7 @@ let responseValidator = require(sut) function newRes () { return { - setHeader: () => {} + setHeader: () => {}, } } @@ -29,7 +29,7 @@ test('Arc v6 control response (HTTP + Lambda 1.0 payload)', t => { body: 'hi', headers: data, multiValueHeaders: { hi: [ 'there', 'friend' ] }, - isBase64Encoded: true + isBase64Encoded: true, } let check = responseValidator({ res, result }, true) t.notOk(res.statusCode, `Valid response did not set error statusCode: ${res.statusCode}`) @@ -164,7 +164,7 @@ test('Arc v6 control response (REST API mode)', t => { body: 'hi', headers: data, multiValueHeaders: { hi: [ 'there', 'friend' ] }, - isBase64Encoded: true + isBase64Encoded: true, } let check = responseValidator({ res, result }) t.notOk(res.statusCode, `Valid response did not set error statusCode: ${res.statusCode}`) diff --git a/test/unit/src/http/invoke-ws/invoke-req-test.js b/test/unit/src/http/invoke-ws/invoke-req-test.js index cbb45012..c7d92ce6 100644 --- a/test/unit/src/http/invoke-ws/invoke-req-test.js +++ b/test/unit/src/http/invoke-ws/invoke-req-test.js @@ -5,7 +5,7 @@ function lambdaStub (params, callback) { } let invoke = proxyquire('../../../../../src/http/invoke-ws', { - '../../invoke-lambda': lambdaStub + '../../invoke-lambda': lambdaStub, }) let { arc6 } = require('@architect/req-res-fixtures').http.req let str = i => JSON.stringify(i) @@ -36,7 +36,7 @@ test('Internal WebSocket events: body (WS message), no req', t => { let params = { lambda: { name: 'default', - src: 'src/ws/default' + src: 'src/ws/default', }, // not a real action body, connectionId: 'much-unique-uuid', @@ -69,10 +69,10 @@ test('WebSocket connect / disconnect event: get /', t => { let params = { lambda: { name: 'connect', - src: 'src/ws/connect' + src: 'src/ws/connect', }, // not a real action connectionId, - req: request + req: request, } invoke(params, function compare (err, result) { if (err) { /* linter */ } @@ -92,7 +92,7 @@ test('WebSocket connect / disconnect event: get /?whats=up', t => { let params = { lambda: { name: 'connect', - src: 'src/ws/connect' + src: 'src/ws/connect', }, // not a real action req: request, connectionId, diff --git a/test/unit/src/invoke-lambda/index-test.js b/test/unit/src/invoke-lambda/index-test.js index 5a88fbf5..f5262d00 100644 --- a/test/unit/src/invoke-lambda/index-test.js +++ b/test/unit/src/invoke-lambda/index-test.js @@ -13,7 +13,7 @@ let runtimes = { deno: 0, node: 0, python: 0, - ruby: 0 + ruby: 0, } let execPassedParams let exec = (lambda, params, callback) => { diff --git a/test/utils/_check-result.js b/test/utils/_check-result.js index aba8d702..90622939 100644 --- a/test/utils/_check-result.js +++ b/test/utils/_check-result.js @@ -11,7 +11,7 @@ let { b64dec, data } = require('./_lib') let msgs = { correct: 'Returned correct param', returned: 'Returned unverified param', - notReturned: 'Did not return' + notReturned: 'Did not return', } function checkHttpResult (t, result, checks) { @@ -43,14 +43,14 @@ function checkHttpResult (t, result, checks) { if (!result[param].awsRequestId) t.fail('Missing awsRequestId!') t.deepEqual({ ...checks[param], - awsRequestId: result[param].awsRequestId + awsRequestId: result[param].awsRequestId, }, result[param], 'Got correct Lambda context') } if (checks[param].aws_request_id) { if (!result[param].aws_request_id) t.fail('Missing aws_request_id!') t.deepEqual({ ...checks[param], - aws_request_id: result[param].aws_request_id + aws_request_id: result[param].aws_request_id, }, result[param], 'Got correct Lambda context') } } @@ -95,14 +95,14 @@ function checkRestResult (t, result, checks) { if (!result[param].awsRequestId) t.fail('Missing awsRequestId!') t.deepEqual({ ...checks[param], - awsRequestId: result[param].awsRequestId + awsRequestId: result[param].awsRequestId, }, result[param], 'Got correct Lambda context') } if (checks[param].aws_request_id) { if (!result[param].aws_request_id) t.fail('Missing aws_request_id!') t.deepEqual({ ...checks[param], - aws_request_id: result[param].aws_request_id + aws_request_id: result[param].aws_request_id, }, result[param], 'Got correct Lambda context') } } diff --git a/test/utils/_lib.js b/test/utils/_lib.js index 4a021279..e3deda1c 100644 --- a/test/utils/_lib.js +++ b/test/utils/_lib.js @@ -24,7 +24,7 @@ function isWindowsPythonStalling (err, t) { `Windows GitHub Actions sometimes fails to execute our Python script in a reasonable amount of ` + `time, failing to get past the import statements of builtins in multiple seconds. After dozens ` + `of attempts to pin down why, we are adding this highly specific and extremely disconcerting ` + - `workaround. Help wanted!` + `workaround. Help wanted!`, ) return true } diff --git a/test/utils/_sidechannel.js b/test/utils/_sidechannel.js index c7008960..bf9f7992 100644 --- a/test/utils/_sidechannel.js +++ b/test/utils/_sidechannel.js @@ -42,7 +42,7 @@ let makeSideChannel = async (port = 3433) => { }, reset () { events = [] - } + }, } } diff --git a/test/utils/_startup-shutdown.js b/test/utils/_startup-shutdown.js index 77098ab8..0a217333 100644 --- a/test/utils/_startup-shutdown.js +++ b/test/utils/_startup-shutdown.js @@ -35,8 +35,8 @@ let startup = { env: { ARC_API_TYPE: options.apigateway, PORT: port, - ...process.env - } + ...process.env, + }, }) t.ok(child, 'Sandbox child process started') let started = false @@ -56,7 +56,7 @@ let startup = { child.on('error', err => { t.fail(err) }) - } + }, } let shutdown = { @@ -95,7 +95,7 @@ let shutdown = { } } check() - } + }, } let asyncify = obj => { @@ -104,7 +104,7 @@ let asyncify = obj => { try { obj[type](...params, resolve) } - catch (err){ + catch (err) { reject(err) } }) @@ -128,7 +128,7 @@ verifyShutdown.async = (...params) => new Promise((resolve, reject) => { try { verifyShutdown(...params, resolve) } - catch (err){ + catch (err) { reject(err) } })