diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 84201924a75..a01c126c1d7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,12 +43,20 @@ jobs: run: npm ls --all continue-on-error: true - - name: Run tests + - name: Run tests with coverage + id: coverage + if: inputs.runs-on == 'ubuntu-latest' && inputs.node-version == 20 run: npm run coverage:ci env: CI: true NODE_V8_COVERAGE: ./coverage/tmp + - name: Run tests + if: steps.coverage.outcome == 'skipped' + run: npm run test:javascript + env: + CI: true + - name: Coverage Report if: inputs.runs-on == 'ubuntu-latest' && inputs.node-version == 20 uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 # v4.1.1 diff --git a/test/client-request.js b/test/client-request.js index e71a034408d..4071b484c50 100644 --- a/test/client-request.js +++ b/test/client-request.js @@ -53,6 +53,7 @@ test('request dump', async (t) => { t = tspl(t, { plan: 3 }) const server = createServer((req, res) => { + res.shouldKeepAlive = false res.setHeader('content-length', 5) res.end('hello') }) diff --git a/test/content-length.js b/test/content-length.js index 847e2bca023..ece0747406a 100644 --- a/test/content-length.js +++ b/test/content-length.js @@ -303,6 +303,7 @@ test('request streaming with Readable.from(buf)', async (t) => { test('request DELETE, content-length=0, with body', async (t) => { t = tspl(t, { plan: 5 }) const server = createServer((req, res) => { + res.shouldKeepAlive = false res.end() }) server.on('request', (req, res) => { diff --git a/test/issue-803.js b/test/issue-803.js index 0ab94cd1d37..5c2eb21b6e5 100644 --- a/test/issue-803.js +++ b/test/issue-803.js @@ -8,16 +8,18 @@ const { createServer } = require('node:http') test('https://github.com/nodejs/undici/issues/803', { timeout: 60000 }, async (t) => { t = tspl(t, { plan: 2 }) - const SIZE = 5900373096 - const chunkSize = 65536 - const parts = (SIZE / chunkSize) | 0 - const lastPartSize = SIZE % chunkSize - const chunk = Buffer.allocUnsafe(chunkSize) const server = createServer(async (req, res) => { + const chunkSize = res.writableHighWaterMark << 5 + const parts = (SIZE / chunkSize) | 0 + const lastPartSize = SIZE % chunkSize + const chunk = Buffer.allocUnsafe(chunkSize) + + res.shouldKeepAlive = false res.setHeader('content-length', SIZE) let i = 0 + while (i++ < parts) { if (res.write(chunk) === false) { await once(res, 'drain')