Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict'

module.exports = require('@mia-platform/eslint-config-mia')
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ async function decorateRequestAndFastifyInstance(fastify, { asyncInitFunction, s
})
}


function initCustomServiceEnvironment(envSchema) {
return function customService(asyncInitFunction, serviceOptions) {
async function index(fastify, opts) {
Expand Down
4 changes: 2 additions & 2 deletions lib/httpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class HttpClient {
}
const errToReturn = new Error(error.message)
errToReturn.code = error.code
// eslint-disable-next-line id-blacklist
// eslint-disable-next-line id-denylist
logger.error({ err: errToReturn }, 'generic request error')
throw errToReturn
}
Expand Down Expand Up @@ -196,7 +196,7 @@ function getErrorMessage(response, returnAs, errorMessageKey) {
case 'BUFFER':
try {
return JSON.parse(data)[errorMessageKey]
} catch (error) {
} catch {
return DEFAULT_ERROR_MESSAGE
}
case 'JSON':
Expand Down
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function getUserProperties(userPropertiesAsString) {

try {
return JSON.parse(userPropertiesAsString)
} catch (error) {
} catch {
return null
}
}
Expand Down
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"checkonly": "! grep -R '\\.only' tests/",
"coverage": "npm run unit && tap report --allow-incomplete-coverage text-summary",
"postcoverage": "tap report --allow-incomplete-coverage html --no-browser",
"lint": "eslint . --ignore-path .gitignore",
"lint": "eslint .",
"start": "echo 'unable to start the library directly' && exit 1",
"test": "npm run lint && npm run unit && npm run checkonly && npm run typescript",
"typescript": "tsc --project ./tests/types/tsconfig.json",
Expand All @@ -55,9 +55,9 @@
},
"devDependencies": {
"@fastify/routes": "^6.0.2",
"@mia-platform/eslint-config-mia": "^9.0.0",
"@mia-platform/eslint-config-mia": "^10.0.0",
"@types/node": "^24.1.0",
"eslint": "^9.0.0",
"eslint": "^10.0.0",
"fastify": "^5.6.1",
"hpagent": "^1.2.0",
"nock": "^13.3.1",
Expand All @@ -69,8 +69,5 @@
},
"engines": {
"node": ">=22"
},
"eslintConfig": {
"extends": "@mia-platform/eslint-config-mia"
}
}
2 changes: 1 addition & 1 deletion tests/getHttpClient.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ tap.test('getHttpClient throws on invalid url', async t => {
const invalidUrl = 'httpnot-a-complete-url'
try {
getHttpClient.call(fastifyMock, invalidUrl)
} catch (error) {
} catch {
t.notOk(true, 'The function should not throw anymore if the url is not a valid one, bet return the standard proxy')
}
})
16 changes: 2 additions & 14 deletions tests/httpClient.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-sync */
'use strict'

const cp = require('child_process')
Expand Down Expand Up @@ -1242,7 +1241,6 @@ tap.test('httpClient', test => {
assert.end()
})


innerTest.end()
})

Expand Down Expand Up @@ -1321,7 +1319,7 @@ tap.test('httpClient', test => {
try {
await service.get('/foo')
assert.fail()
} catch (error) {
} catch {
assert.pass()
}

Expand Down Expand Up @@ -1681,7 +1679,6 @@ tap.test('httpClient', test => {
})
}, expectedError)


myServiceNameScope.done()
assert.end()
})
Expand Down Expand Up @@ -1831,7 +1828,6 @@ tap.test('httpClient', test => {
assert.end()
})


test.test('tls options', async assert => {
nock.enableNetConnect('localhost:3200')
assert.teardown(() => {
Expand All @@ -1846,16 +1842,11 @@ tap.test('httpClient', test => {
const caPath = cp.execSync(`mkcert -CAROOT`).toString()
.trim()

// eslint-disable-next-line no-sync
const serverCa = fs.readFileSync(path.join(caPath, 'rootCA.pem'))
// eslint-disable-next-line no-sync
const serverKey = fs.readFileSync('tests/fixtures/keys/key.pem')
// eslint-disable-next-line no-sync
const serverCert = fs.readFileSync('tests/fixtures/keys/cert.pem')

// eslint-disable-next-line no-sync
const clientKey = fs.readFileSync('tests/fixtures/keys/client-key.pem')
// eslint-disable-next-line no-sync
const clientCert = fs.readFileSync('tests/fixtures/keys/client-cert.pem')

async function createServer() {
Expand Down Expand Up @@ -1903,7 +1894,6 @@ tap.test('httpClient', test => {
assert.end()
})


assert.test('returnAs: BUFFER', async assert => {
const server = await createServer()

Expand Down Expand Up @@ -1935,7 +1925,6 @@ tap.test('httpClient', test => {
assert.end()
})


assert.test('returnAs: STREAM', async assert => {
const server = await createServer()

Expand Down Expand Up @@ -2223,7 +2212,6 @@ tap.test('httpClient', test => {
assert.equal(error.statusCode, 500)
}


myServiceNameScope.done()
})

Expand All @@ -2249,7 +2237,7 @@ tap.test('httpClient', test => {
assert.match(afterRequest, {
level: 50,
msg: /^generic request error$/,
// eslint-disable-next-line id-blacklist
// eslint-disable-next-line id-denylist
err: {
type: 'Error',
message: 'timeout of 100ms exceeded',
Expand Down
1 change: 0 additions & 1 deletion tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

const tap = require('tap')
const lc39 = require('@mia-platform/lc39')

const fs = require('fs')
const { promisify } = require('util')

Expand Down
1 change: 0 additions & 1 deletion tests/oas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ tap.test('create a valid docs with the support of $ref schema', async t => {
t.end()
})


tap.test('create a valid docs with custom vocabulary', async t => {
const fastify = await setupFastify('./tests/services/service-with-formats.js', baseEnv)

Expand Down