diff options
author | 2023-05-01 10:08:18 -0400 | |
---|---|---|
committer | 2023-05-01 10:08:18 -0400 | |
commit | c405cef64711a7b6a480e8b4068cd2bf3cf889a9 (patch) | |
tree | d889655a1ccd376e95c8efff81f65b69a8d798fd /packages/integrations/node/test/errors.test.js | |
parent | 649d70934e709bb1aa6e5e7583b12fa1703377cb (diff) | |
download | astro-c405cef64711a7b6a480e8b4068cd2bf3cf889a9.tar.gz astro-c405cef64711a7b6a480e8b4068cd2bf3cf889a9.tar.zst astro-c405cef64711a7b6a480e8b4068cd2bf3cf889a9.zip |
Catch errors that occur within the stream in the Node adapter (#6935)
* Catch errors that occur within the stream in the Node adapter
* Adding a changeset
* Better error message on completely uncaught errors within the stream
* Update test
Diffstat (limited to 'packages/integrations/node/test/errors.test.js')
-rw-r--r-- | packages/integrations/node/test/errors.test.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/packages/integrations/node/test/errors.test.js b/packages/integrations/node/test/errors.test.js new file mode 100644 index 000000000..6bb93023a --- /dev/null +++ b/packages/integrations/node/test/errors.test.js @@ -0,0 +1,33 @@ +import nodejs from '../dist/index.js'; +import { loadFixture } from './test-utils.js'; +import { expect } from 'chai'; +import * as cheerio from 'cheerio'; + +describe('Errors', () => { + let fixture; + before(async () => { + fixture = await loadFixture({ + root: './fixtures/errors/', + output: 'server', + adapter: nodejs({ mode: 'standalone' }), + }); + await fixture.build(); + }); + describe('Within the stream', async () => { + let devPreview; + + before(async () => { + devPreview = await fixture.preview(); + }); + after(async () => { + await devPreview.stop(); + }); + it('when mode is standalone', async () => { + const res = await fixture.fetch('/in-stream'); + const html = await res.text(); + const $ = cheerio.load(html); + + expect($('p').text().trim()).to.equal('Internal server error'); + }); + }); +}); |