2024-01-25 11:17:31 -05:00
|
|
|
import * as assert from 'node:assert/strict';
|
|
|
|
import { describe, it, before, after } from 'node:test';
|
2023-05-01 09:08:18 -05:00
|
|
|
import nodejs from '../dist/index.js';
|
|
|
|
import { loadFixture } from './test-utils.js';
|
|
|
|
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();
|
|
|
|
});
|
2024-01-25 11:17:31 -05:00
|
|
|
let devPreview;
|
2023-05-01 09:08:18 -05:00
|
|
|
|
2024-01-25 11:17:31 -05:00
|
|
|
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);
|
2023-05-01 09:08:18 -05:00
|
|
|
|
2024-01-25 11:17:31 -05:00
|
|
|
assert.equal($('p').text().trim(), 'Internal server error');
|
2023-05-01 09:08:18 -05:00
|
|
|
});
|
|
|
|
});
|