diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9dbc7976..59f285311 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.http2-test-disabled }} OLD_NODE_TEST: ${{ matrix.test-on-old-node }} run: | if [ "$OLD_NODE_TEST" = "1" ]; then diff --git a/Makefile b/Makefile index 7cbc8bf99..0acb194b5 100644 --- a/Makefile +++ b/Makefile @@ -11,13 +11,17 @@ test: @if [ "$(BROWSER)" = "1" ]; then \ echo test on browser; \ make test-browser; \ - fi + fi \ @if [ "$(NODE_TEST)" = "1" ] || [ "x$(BROWSER)" = "x" ]; then \ - echo test on node; \ - make test-node; \ + 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: @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 \ 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()); 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() 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 ' +