diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 325921f..e58887a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,4 +14,5 @@ jobs: test: uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3 with: + lint: true license-check: true diff --git a/.taprc b/.taprc index 2188e32..017ea1c 100644 --- a/.taprc +++ b/.taprc @@ -2,3 +2,6 @@ ts: false jsx: false flow: false coverage: true + +files: + - test/**/*.js diff --git a/package.json b/package.json index 9cd4a6a..07d42ea 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,10 @@ "main": "plugin.js", "types": "plugin.d.ts", "scripts": { - "test": "standard && tap test/*.js test/esm/*.js --no-check-coverage && npm run typescript", - "test:ci": "standard && tap test/*.js test/esm/*.js --no-check-coverage --coverage-report=lcovonly && npm run typescript", - "typescript": "tsd" + "lint": "standard", + "test": "npm run test:unit && npm run test:typescript", + "test:unit": "tap", + "test:typescript": "tsd" }, "repository": { "type": "git", @@ -29,7 +30,6 @@ "@types/node": "^18.0.0", "fastify": "^4.0.1", "proxyquire": "^2.1.3", - "semver": "^7.3.7", "standard": "^17.0.0", "tap": "^16.0.1", "tsd": "^0.24.1" diff --git a/test/esm/index.test.js b/test/esm/index.test.js index a3bda28..5941ccc 100644 --- a/test/esm/index.test.js +++ b/test/esm/index.test.js @@ -1,19 +1,11 @@ 'use strict' -const t = require('tap') -const semver = require('semver') - -if (semver.lt(process.versions.node, '13.3.0')) { - t.skip('Skip because Node version <= 13.3.0') - t.end() -} else { - // Node v8 throw a `SyntaxError: Unexpected token import` - // even if this branch is never touch in the code, - // by using `eval` we can avoid this issue. - // eslint-disable-next-line - new Function('module', 'return import(module)')('./esm.mjs').catch((err) => { - process.nextTick(() => { - throw err - }) +// Node v8 throw a `SyntaxError: Unexpected token import` +// even if this branch is never touch in the code, +// by using `eval` we can avoid this issue. +// eslint-disable-next-line +new Function('module', 'return import(module)')('./esm.mjs').catch((err) => { + process.nextTick(() => { + throw err }) -} +}) diff --git a/test/test.js b/test/test.js index 01f8279..c608a16 100644 --- a/test/test.js +++ b/test/test.js @@ -299,7 +299,7 @@ test('should check version when encapsulated', t => { })) fastify.ready(err => { - t.match(err.message, /fastify-plugin: test - expected '<=2.10.0' fastify version, '\d.\d.\d' is installed/) + t.match(err.message, /fastify-plugin: test - expected '<=2.10.0' fastify version, '\d.\d+.\d+' is installed/) }) })