diff --git a/.github/workflows/ci-module.yml b/.github/workflows/ci-module.yml index 54426ca..44369c8 100644 --- a/.github/workflows/ci-module.yml +++ b/.github/workflows/ci-module.yml @@ -4,11 +4,10 @@ on: push: branches: - master + - next pull_request: workflow_dispatch: jobs: test: - uses: hapijs/.github/.github/workflows/ci-module.yml@master - with: - min-node-version: 14 + uses: hapijs/.github/.github/workflows/ci-module.yml@min-node-18-hapi-21 diff --git a/test/index.js b/test/index.js index 4ff9852..c30cfe3 100755 --- a/test/index.js +++ b/test/index.js @@ -1366,9 +1366,13 @@ describe('read()', () => { it('handles requests that close early', async (flags) => { let readPromise; + let readError; const handler = (req, res) => { - readPromise = Wreck.read(req); + readPromise = Wreck.read(req).catch((err) => { + + readError = err; + }); promise.req.abort(); }; @@ -1389,8 +1393,9 @@ describe('read()', () => { const server = await internals.server(handler); const promise = Wreck.request('post', `http://localhost:${server.address().port}`, { payload, headers }); await expect(promise).to.reject(); - const err = await expect(readPromise).to.reject(Error, 'Payload stream closed prematurely'); - expect(err.isBoom).to.equal(true); + await readPromise; + expect(readError).to.be.an.error('Payload stream closed prematurely'); + expect(readError.isBoom).to.equal(true); }); it('errors on partial payload transfers', async (flags) => { @@ -2111,7 +2116,8 @@ describe('gunzip', () => { const options = { json: true }; const err = await expect(Wreck.get(`http://localhost:${server.address().port}`, options)).to.reject(); - expect(err).to.be.an.error('Unexpected token \u001f in JSON at position 0'); + expect(err).to.be.an.error(/Unexpected token/); + expect(Boom.isBoom(err)).to.be.true(); expect(err.data.res.statusCode).to.equal(200); expect(err.data.payload).to.equal(Zlib.gzipSync(JSON.stringify({ foo: 'bar' }))); flags.onCleanup = () => server.close();