Skip to content

ci: add nodejs v18 - v24 to test matrix #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
36 changes: 35 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 }}
Expand Down
24 changes: 21 additions & 3 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

util.isError reached EOL in Node v23 and Error.isError was introduced in Node 24 so we don't have a isError function in Node 23. We could use a instanceof Error check but i am not sure if we should or if we should just disable the test for Node 23.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in favor of using instanceof Error, I don't think we should disable the test.


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 () {
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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']()))
})
})
Loading