Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
Run tests on Node.js 18
Browse files Browse the repository at this point in the history
This required more work than I initially thought. I'll try and explain
all of the changes here.

  1. Updating the CircleCI config to also run on Node.js 18. I took the
     opportunity to make sure we're also running the latest versions of
     Node.js 14 and 16.

  2. Bumping the version of node-fetch that we use, as there are some
     security fixes between 2.6.0 and 2.6.7.

  3. Unfortunately, nock does not mock HTTP requests for `fetch`, which
     meant that the tests were always failing in Node.js 18. To fix this
     I had to drop nock entirely and switch to fetch-mock which works
     with both global `fetch` _and_ node-fetch. This results in a few of
     the tests changing. The fact these run in both Node.js 16 and 18 is
     encouraging.

**Potential future work:** I think it might be sensible to add some
end-to-end tests at some point, which actually connect to Splunk and
verify that sending logs works in all of Node.js 14, 16, and 18. Maybe
that's overkill though, as we'll be deprecating this module at some
point and once all our apps are using log drains we can ditch the Splunk
HEC transport entirely.
  • Loading branch information
rowanmanning committed Sep 21, 2022
1 parent 60ab993 commit 32477e3
Show file tree
Hide file tree
Showing 4 changed files with 352 additions and 239 deletions.
20 changes: 10 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ references:
- image: cimg/node:<< parameters.node-version >>
parameters:
node-version:
default: "16.14"
default: "16.17"
type: string

workspace_root: &workspace_root ~/project
Expand Down Expand Up @@ -148,14 +148,14 @@ workflows:
name: build-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]
node-version: [ "18.9", "16.17", "14.20" ]
- test:
requires:
- build-v<< matrix.node-version >>
name: test-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]
node-version: [ "18.9", "16.17", "14.20" ]

build-test-publish:
jobs:
Expand All @@ -165,7 +165,7 @@ workflows:
name: build-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]
node-version: [ "18.9", "16.17", "14.20" ]
- test:
filters:
<<: *filters_version_tag
Expand All @@ -174,13 +174,13 @@ workflows:
name: test-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]
node-version: [ "18.9", "16.17", "14.20" ]
- publish:
context: npm-publish-token
filters:
<<: *filters_version_tag
requires:
- test-v16.14
- test-v16.17

renovate-nori-build-test:
jobs:
Expand All @@ -194,14 +194,14 @@ workflows:
name: build-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]
node-version: [ "18.9", "16.17", "14.20" ]
- test:
requires:
- build-v<< matrix.node-version >>
name: test-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]
node-version: [ "18.9", "16.17", "14.20" ]

nightly:
triggers:
Expand All @@ -215,15 +215,15 @@ workflows:
name: build-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]
node-version: [ "18.9", "16.17", "14.20" ]
- test:
requires:
- build-v<< matrix.node-version >>
context: next-nightly-build
name: test-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "16.14", "14.19" ]
node-version: [ "18.9", "16.17", "14.20" ]

notify:
webhooks:
Expand Down
Loading

0 comments on commit 32477e3

Please sign in to comment.