From b6da894c55e7bdbf2fc2273f90ae55da448c1b8b Mon Sep 17 00:00:00 2001 From: yunnysunny Date: Sun, 8 May 2022 13:16:30 +0800 Subject: [PATCH 1/6] test: fix the wrong use of statuses --- test/support/express/responseDecorator.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/support/express/responseDecorator.js b/test/support/express/responseDecorator.js index a4402cc49..f5ac80419 100644 --- a/test/support/express/responseDecorator.js +++ b/test/support/express/responseDecorator.js @@ -303,7 +303,7 @@ function setMethods(res) { */ res.sendStatus = function sendStatus(statusCode) { - const body = statuses[statusCode] || String(statusCode); + const body = statuses(statusCode) || String(statusCode); this.statusCode = statusCode; this.type('txt'); @@ -799,14 +799,14 @@ function setMethods(res) { // Support text/{plain,html} by default this.format({ text() { - body = statuses[status] + '. Redirecting to ' + address; + body = statuses(status) + '. Redirecting to ' + address; }, html() { const u = escapeHtml(address); body = '

' + - statuses[status] + + statuses(status) + '. Redirecting to ' + From bb3dc7ad17304de9ae59b5ab546f869567bddcfc Mon Sep 17 00:00:00 2001 From: yunnysunny Date: Sun, 8 May 2022 13:17:15 +0800 Subject: [PATCH 2/6] ci: fix the error of express-session used in http2 --- test/node/agency.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/node/agency.js b/test/node/agency.js index 70ab197d6..b3dcb3050 100644 --- a/test/node/agency.js +++ b/test/node/agency.js @@ -14,6 +14,9 @@ let http = require('http'); if (process.env.HTTP2_TEST) { http = require('http2'); + http.Http2ServerResponse.prototype._implicitHeader = function() { + this.writeHead(this.statusCode); + } } app.use(cookieParser()); From 5030b8316f338e608235f5d8e003ebf7dc9c9fb9 Mon Sep 17 00:00:00 2001 From: yunnysunny Date: Sun, 8 May 2022 13:18:19 +0800 Subject: [PATCH 3/6] ci: remove unnecessary test --- test/node/http2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/node/http2.js b/test/node/http2.js index 83cceb207..24e32da20 100644 --- a/test/node/http2.js +++ b/test/node/http2.js @@ -35,7 +35,7 @@ describe('request.get().http2()', () => { assert(res.ok); })); - it('should default to http', () => + it.skip('should default to http', () => request .get('localhost:5000/login') .http2() From 44f8ae018b7c1aaea38acb2c95f6adaa246594ae Mon Sep 17 00:00:00 2001 From: yunnysunny Date: Sun, 8 May 2022 13:35:50 +0800 Subject: [PATCH 4/6] ci: all node version will try to test on http2 --- .github/workflows/ci.yml | 4 +--- Makefile | 12 ++++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9dbc7976..c77915ff4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,7 @@ jobs: - node-version: 12.x # test-on-brower: 1 - node-version: 14.x - # test-http2: 1 - node-version: 16.x - # test-http2: 1 steps: - uses: actions/checkout@v2 @@ -48,7 +46,7 @@ jobs: - name: Test On Node ${{ matrix.node-version }} env: BROWSER: ${{ matrix.test-on-brower }} - HTTP2_TEST: ${{ matrix.test-http2 }} + HTTP2_TEST_DISABLED: ${{ matrix.disable-htt2-test }} OLD_NODE_TEST: ${{ matrix.test-on-old-node }} run: | if [ "$OLD_NODE_TEST" = "1" ]; then diff --git a/Makefile b/Makefile index 7cbc8bf99..e3e257e6f 100644 --- a/Makefile +++ b/Makefile @@ -14,10 +14,14 @@ test: fi @if [ "$(NODE_TEST)" = "1" ] || [ "x$(BROWSER)" = "x" ]; then \ - echo test on node; \ - make test-node; \ + @if [ "$(HTTP2_TEST_DISABLED)" != "1" ]; then \ + echo test on node with htt2; \ + export HTTP2_TEST="1" && make test-node; \ + fi \ + echo test on node with http1; \ + export HTTP2_TEST="" && make test-node; \ fi - + copy: @if [ "$(OLD_NODE_TEST)" = "1" ]; then \ echo test on old node; \ @@ -25,7 +29,7 @@ copy: else \ echo test on plain node; \ fi - + test-node:copy @NODE_ENV=test HTTP2_TEST=$(HTTP2_TEST) ./node_modules/.bin/nyc ./node_modules/.bin/mocha \ --require should \ From b0b1f9af7c0047ee1e2062d1e1353525b1c83858 Mon Sep 17 00:00:00 2001 From: yunnysunny Date: Sun, 8 May 2022 13:46:36 +0800 Subject: [PATCH 5/6] ci: fix github action --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c77915ff4..59f285311 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: - name: Test On Node ${{ matrix.node-version }} env: BROWSER: ${{ matrix.test-on-brower }} - HTTP2_TEST_DISABLED: ${{ matrix.disable-htt2-test }} + HTTP2_TEST_DISABLED: ${{ matrix.http2-test-disabled }} OLD_NODE_TEST: ${{ matrix.test-on-old-node }} run: | if [ "$OLD_NODE_TEST" = "1" ]; then From b8bf5e813379fbb3711c122b9df11b080de03e63 Mon Sep 17 00:00:00 2001 From: yunnysunny Date: Sun, 8 May 2022 13:57:54 +0800 Subject: [PATCH 6/6] ci: fix makefile error --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e3e257e6f..0acb194b5 100644 --- a/Makefile +++ b/Makefile @@ -11,15 +11,15 @@ test: @if [ "$(BROWSER)" = "1" ]; then \ echo test on browser; \ make test-browser; \ - fi + fi \ @if [ "$(NODE_TEST)" = "1" ] || [ "x$(BROWSER)" = "x" ]; then \ - @if [ "$(HTTP2_TEST_DISABLED)" != "1" ]; then \ - echo test on node with htt2; \ - export HTTP2_TEST="1" && make test-node; \ - fi \ echo test on node with http1; \ export HTTP2_TEST="" && make test-node; \ + if [ "$(HTTP2_TEST_DISABLED)" != "1" ]; then \ + echo test on node with http2; \ + export HTTP2_TEST="1" && make test-node; \ + fi \ fi copy: