diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d553c1e..3537bcd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,7 @@ jobs: contents: read # for actions/checkout to fetch code runs-on: ubuntu-latest strategy: + fail-fast: false matrix: name: - Node.js 0.8 @@ -36,6 +37,13 @@ jobs: - Node.js 15.x - Node.js 16.x - Node.js 17.x + - Node.js 18.x + - Node.js 19.x + - Node.js 20.x + - Node.js 21.x + - Node.js 22.x + - Node.js 23.x + - Node.js 24.x include: - name: Node.js 0.8 @@ -112,6 +120,27 @@ jobs: - name: Node.js 17.x node-version: "17.2" + + - name: Node.js 18.x + node-version: "18" + + - name: Node.js 19.x + node-version: "19" + + - name: Node.js 20.x + node-version: "20" + + - name: Node.js 21.x + node-version: "21" + + - name: Node.js 22.x + node-version: "22" + + - name: Node.js 23.x + node-version: "23" + + - name: Node.js 24.x + node-version: "24" steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -129,7 +158,12 @@ jobs: dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH" - name: Configure npm - run: npm config set shrinkwrap false + run: | + if [[ "$(npm config get package-lock)" == "true" ]]; then + npm config set package-lock false + else + npm config set shrinkwrap false + fi - name: Remove npm module(s) ${{ matrix.npm-rm }} run: npm rm --silent --save-dev ${{ matrix.npm-rm }} diff --git a/test/test.js b/test/test.js index 7ecd29e..a9a76a6 100644 --- a/test/test.js +++ b/test/test.js @@ -6,9 +6,21 @@ var util = require('util') var createError = require('..') +// eslint-disable-next-line node/no-deprecated-api +var isError = typeof Error.isError === 'function' ? Error.isError : util.isError + +var itErrorIsError = typeof Error.isError === 'function' + ? it + : it.skip + +// eslint-disable-next-line node/no-deprecated-api +var itUtilIsError = typeof util.isError === 'function' + ? it + : it.skip + describe('createError(status)', function () { it('should create error object', function () { - assert.ok(util.isError(createError(500))) // eslint-disable-line node/no-deprecated-api + assert.ok(isError(createError(500))) }) describe('Extending Existing Errors with HTTP Properties', function () { @@ -126,7 +138,7 @@ describe('createError(status, message)', function () { }) it('should create error object', function () { - assert.ok(util.isError(this.error)) // eslint-disable-line node/no-deprecated-api + assert.ok(isError(this.error)) }) it('should have "message" property with message', function () { @@ -419,11 +431,17 @@ describe('HTTP Errors', function () { assert((new createError['500']()) instanceof createError.HttpError) }) - it('should support util.isError()', function () { + itUtilIsError('should support util.isError()', function () { /* eslint-disable node/no-deprecated-api */ assert(util.isError(createError(404))) assert(util.isError(new createError['404']())) assert(util.isError(new createError['500']())) /* eslint-enable node/no-deprecated-api */ }) + + itErrorIsError('should support Error.isError()', function () { + assert(Error.isError(createError(404))) + assert(Error.isError(new createError['404']())) + assert(Error.isError(new createError['500']())) + }) })