Skip to content

Commit

Permalink
ci: fix errors in ci github action for node 8 and 9 (#523)
Browse files Browse the repository at this point in the history
* ci: fix errors in ci github action for node 8 and 9

* ci: remove minor version on node 22

* ci: remove minor versions

* 🧪 skip query test on node 21

Co-authored-by: Chris de Almeida <ctcpip@users.noreply.github.com>

---------

Co-authored-by: Jon Church <me@jonchurch.com>
Co-authored-by: Chris de Almeida <ctcpip@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 9, 2024
1 parent 9d4e212 commit 83db46a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 27 deletions.
58 changes: 35 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
- Node.js 17.x
- Node.js 18.x
- Node.js 19.x
- Node.js 20.x
- Node.js 21.x
- Node.js 22.x

include:
- name: Node.js 0.8
Expand All @@ -48,77 +51,86 @@ jobs:
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0

- name: io.js 1.x
node-version: "1.8"
node-version: "1"
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0

- name: io.js 2.x
node-version: "2.5"
node-version: "2"
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0

- name: io.js 3.x
node-version: "3.3"
node-version: "3"
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0

- name: Node.js 4.x
node-version: "4.9"
node-version: "4"
npm-i: mocha@5.2.0 nyc@11.9.0 supertest@3.4.2

- name: Node.js 5.x
node-version: "5.12"
node-version: "5"
npm-i: mocha@5.2.0 nyc@11.9.0 supertest@3.4.2

- name: Node.js 6.x
node-version: "6.17"
node-version: "6"
npm-i: mocha@6.2.2 nyc@14.1.1 supertest@6.1.6

- name: Node.js 7.x
node-version: "7.10"
node-version: "7"
npm-i: mocha@6.2.2 nyc@14.1.1 supertest@6.1.6

- name: Node.js 8.x
node-version: "8.17"
npm-i: mocha@7.2.0
node-version: "8"
npm-i: mocha@7.2.0 nyc@14.1.1

- name: Node.js 9.x
node-version: "9.11"
npm-i: mocha@7.2.0
node-version: "9"
npm-i: mocha@7.2.0 nyc@14.1.1

- name: Node.js 10.x
node-version: "10.24"
node-version: "10"
npm-i: mocha@8.4.0

- name: Node.js 11.x
node-version: "11.15"
node-version: "11"
npm-i: mocha@8.4.0

- name: Node.js 12.x
node-version: "12.22"
node-version: "12"
npm-i: mocha@9.2.2

- name: Node.js 13.x
node-version: "13.14"
node-version: "13"
npm-i: mocha@9.2.2

- name: Node.js 14.x
node-version: "14.21"
node-version: "14"

- name: Node.js 15.x
node-version: "15.14"
node-version: "15"

- name: Node.js 16.x
node-version: "16.19"
node-version: "16"

- name: Node.js 17.x
node-version: "17.9"
node-version: "17"

- name: Node.js 18.x
node-version: "18.14"
node-version: "18"

- name: Node.js 19.x
node-version: "19.7"
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"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Node.js ${{ matrix.node-version }}
shell: bash -eo pipefail -l {0}
Expand Down Expand Up @@ -209,7 +221,7 @@ jobs:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install lcov
shell: bash
Expand Down
20 changes: 16 additions & 4 deletions test/body-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,25 @@ describe('bodyParser()', function () {
})
})

function getMajorVersion (versionString) {
return versionString.split('.')[0]
}

function shouldSkipQuery (versionString) {
// Skipping HTTP QUERY tests on Node 21, it is reported in http.METHODS on 21.7.2 but not supported
// update this implementation to run on supported versions of 21 once they exist
// upstream tracking https://github.com/nodejs/node/issues/51562
// express tracking issue: https://github.com/expressjs/express/issues/5615
return getMajorVersion(versionString) === '21'
}

methods.slice().sort().forEach(function (method) {
if (method === 'connect') {
// except CONNECT
return
}
if (method === 'connect') return

it('should support ' + method.toUpperCase() + ' requests', function (done) {
if (method === 'query' && shouldSkipQuery(process.versions.node)) {
this.skip()
}
request(this.server)[method]('/')
.set('Content-Type', 'application/json')
.set('Content-Length', '15')
Expand Down

0 comments on commit 83db46a

Please # to comment.