astro/packages/astro/test/error-bad-js.test.js
2022-09-12 18:43:54 +00:00

34 lines
761 B
JavaScript

import { expect } from 'chai';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
describe('Errors in JavaScript', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
/** @type {import('./test-utils').DevServer} */
let devServer;
before(async () => {
fixture = await loadFixture({
root: './fixtures/error-bad-js',
});
devServer = await fixture.startDevServer();
});
after(async () => {
await devServer.stop();
});
it('Does not crash the dev server', async () => {
let res = await fixture.fetch('/');
let html = await res.text();
expect(html).to.include('ReferenceError');
res = await fixture.fetch('/');
await res.text();
expect(html).to.include('ReferenceError');
});
});