errors.test.js — astro Source File
Architecture documentation for errors.test.js, a javascript file in the astro codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR acd30a50_5fb9_415b_31a3_91eed1a8a25f["errors.test.js"] 2ca394f6_a63d_3921_1f12_c5a979ea0039["test-utils.js"] acd30a50_5fb9_415b_31a3_91eed1a8a25f --> 2ca394f6_a63d_3921_1f12_c5a979ea0039 e1e769bb_3791_17ce_1de0_e821705ee691["getErrorOverlayContent"] acd30a50_5fb9_415b_31a3_91eed1a8a25f --> e1e769bb_3791_17ce_1de0_e821705ee691 e27f6887_ea47_dd44_7933_5faa0f6bcf4d["testFactory"] acd30a50_5fb9_415b_31a3_91eed1a8a25f --> e27f6887_ea47_dd44_7933_5faa0f6bcf4d f8fbe851_c5d6_c4ee_c044_67a751668c18["test"] acd30a50_5fb9_415b_31a3_91eed1a8a25f --> f8fbe851_c5d6_c4ee_c044_67a751668c18 style acd30a50_5fb9_415b_31a3_91eed1a8a25f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { expect } from '@playwright/test';
import { getErrorOverlayContent, testFactory } from './test-utils.js';
const test = testFactory(import.meta.url, {
root: './fixtures/errors/',
// Only test the error overlay, don't print to console
vite: {
logLevel: 'silent',
},
});
let devServer;
test.beforeAll(async ({ astro }) => {
devServer = await astro.startDevServer();
});
test.afterAll(async ({ astro }) => {
await devServer.stop();
astro.resetAllFiles();
});
test.describe('Error display', () => {
test('detect syntax errors in template', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/astro-syntax-error'), { waitUntil: 'networkidle' });
const message = (await getErrorOverlayContent(page)).message;
expect(message).toMatch('Unexpected "while"');
await Promise.all([
// Wait for page reload
page.waitForNavigation(),
// Edit the component file
await astro.editFile(
'./src/pages/astro-syntax-error.astro',
() => `<h1>No syntax error</h1>`,
),
]);
expect(await page.locator('vite-error-overlay').count()).toEqual(0);
});
test('shows useful error when frontmatter import is not found', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/import-not-found'), { waitUntil: 'networkidle' });
const message = (await getErrorOverlayContent(page)).message;
expect(message).toMatch('Could not import ../abc.astro');
await Promise.all([
// Wait for page reload
page.waitForNavigation(),
// Edit the component file
astro.editFile('./src/pages/import-not-found.astro', () => `<h1>No import error</h1>`),
]);
expect(await page.locator('vite-error-overlay').count()).toEqual(0);
});
test('shows correct file path when a page has an error', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/import-not-found'), { waitUntil: 'networkidle' });
// ... (104 more lines)
Domain
Dependencies
Source
Frequently Asked Questions
What does errors.test.js do?
errors.test.js is a source file in the astro codebase, written in javascript. It belongs to the E2ETesting domain.
What does errors.test.js depend on?
errors.test.js imports 4 module(s): getErrorOverlayContent, test, test-utils.js, testFactory.
Where is errors.test.js in the architecture?
errors.test.js is located at packages/astro/e2e/errors.test.js (domain: E2ETesting, directory: packages/astro/e2e).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free