app-entrypoint-css.test.js — astro Source File
Architecture documentation for app-entrypoint-css.test.js, a javascript file in the astro codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR efdb2308_8bf7_329e_6663_4339329797ec["app-entrypoint-css.test.js"] 1c3a6eaf_e190_a7a7_4e0d_f3970df5bd14["test-utils.js"] efdb2308_8bf7_329e_6663_4339329797ec --> 1c3a6eaf_e190_a7a7_4e0d_f3970df5bd14 95df8b4a_03a9_ecbd_280c_bf8530b728ba["loadFixture"] efdb2308_8bf7_329e_6663_4339329797ec --> 95df8b4a_03a9_ecbd_280c_bf8530b728ba e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] efdb2308_8bf7_329e_6663_4339329797ec --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] efdb2308_8bf7_329e_6663_4339329797ec --> 6b0635f9_51ea_77aa_767b_7857878e98a6 deb87372_5629_35f8_9a54_e755a08f776a["cheerio"] efdb2308_8bf7_329e_6663_4339329797ec --> deb87372_5629_35f8_9a54_e755a08f776a style efdb2308_8bf7_329e_6663_4339329797ec fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import * as assert from 'node:assert/strict';
import { after, before, describe, it } from 'node:test';
import { load as cheerioLoad } from 'cheerio';
import { loadFixture } from './test-utils.js';
describe('App Entrypoint CSS', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
before(async () => {
fixture = await loadFixture({
root: './fixtures/app-entrypoint-css/',
});
});
describe('build', () => {
before(async () => {
await fixture.build();
});
it('injects styles referenced in appEntrypoint', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerioLoad(html);
// test 1: basic component renders
assert.equal($('#foo > #bar').text(), 'works');
// test 2: injects the global style on the page
assert.equal($('style').first().text().trim(), ':root{background-color:red}');
});
it('does not inject styles to pages without a Vue component', async () => {
const html = await fixture.readFile('/unrelated/index.html');
const $ = cheerioLoad(html);
assert.equal($('style').length, 0);
assert.equal($('link[rel="stylesheet"]').length, 0);
});
});
describe('dev', () => {
let devServer;
before(async () => {
devServer = await fixture.startDevServer();
});
after(async () => {
await devServer.stop();
});
it('loads during SSR', async () => {
const html = await fixture.fetch('/').then((res) => res.text());
const $ = cheerioLoad(html);
// test 1: basic component renders
assert.equal($('#foo > #bar').text(), 'works');
// test 2: injects the global style on the page
assert.equal($('style').first().text().replace(/\s+/g, ''), ':root{background-color:red;}');
});
it('does not inject styles to pages without a Vue component', async () => {
const html = await fixture.fetch('/unrelated').then((res) => res.text());
const $ = cheerioLoad(html);
assert.equal($('style').length, 0);
assert.equal($('link[rel="stylesheet"]').length, 0);
});
});
});
Domain
Dependencies
- cheerio
- loadFixture
- node:test
- strict
- test-utils.js
Source
Frequently Asked Questions
What does app-entrypoint-css.test.js do?
app-entrypoint-css.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does app-entrypoint-css.test.js depend on?
app-entrypoint-css.test.js imports 5 module(s): cheerio, loadFixture, node:test, strict, test-utils.js.
Where is app-entrypoint-css.test.js in the architecture?
app-entrypoint-css.test.js is located at packages/integrations/vue/test/app-entrypoint-css.test.js (domain: CoreAstro, directory: packages/integrations/vue/test).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free