Home / File/ vue-component.test.js — astro Source File

vue-component.test.js — astro Source File

Architecture documentation for vue-component.test.js, a javascript file in the astro codebase. 5 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  bbdb4f7e_e2e9_6fa3_2235_3af4fbfd9a5b["vue-component.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  bbdb4f7e_e2e9_6fa3_2235_3af4fbfd9a5b --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  bbdb4f7e_e2e9_6fa3_2235_3af4fbfd9a5b --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  bbdb4f7e_e2e9_6fa3_2235_3af4fbfd9a5b --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  bbdb4f7e_e2e9_6fa3_2235_3af4fbfd9a5b --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  bbdb4f7e_e2e9_6fa3_2235_3af4fbfd9a5b --> deb87372_5629_35f8_9a54_e755a08f776a
  style bbdb4f7e_e2e9_6fa3_2235_3af4fbfd9a5b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert/strict';
import { after, before, describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import { isWindows, loadFixture } from './test-utils.js';

describe.skip('Vue component build', { todo: 'This test currently times out, investigate' }, () => {
	let fixture;

	before(async () => {
		fixture = await loadFixture({
			root: './fixtures/vue-component/',
		});
		await fixture.build();
	});

	it('Can load Vue', async () => {
		const html = await fixture.readFile('/index.html');
		const $ = cheerio.load(html);

		const allPreValues = $('pre')
			.toArray()
			.map((el) => $(el).text());

		// test 1: renders all components correctly
		assert.deepEqual(allPreValues, ['0', '1', '1', '1', '10', '100', '1000']);

		// test 2: renders 3 <astro-island>s
		assert.equal($('astro-island').length, 6);

		// test 3: all <astro-island>s have uid attributes
		assert.equal($('astro-island[uid]').length, 6);

		// test 4: treats <my-button> as a custom element
		assert.equal($('my-button').length, 7);

		// test 5: components with identical render output and props have been deduplicated
		const uniqueRootUIDs = $('astro-island').map((_i, el) => $(el).attr('uid'));
		assert.equal(new Set(uniqueRootUIDs).size, 5);

		// test 6: import public files work
		assert.ok($('#vue-img'));
	});
});

if (!isWindows) {
	describe.skip('Vue component dev', { todo: 'This test currently times out, investigate' }, () => {
		let devServer;
		let fixture;

		before(async () => {
			fixture = await loadFixture({
				root: './fixtures/vue-component/',
			});
			devServer = await fixture.startDevServer();
		});

		after(async () => {
			await devServer.stop();
		});

		it('scripts proxy correctly', async () => {
			const html = await fixture.fetch('/').then((res) => res.text());
			const $ = cheerio.load(html);

			for (const script of $('script').toArray()) {
				const { src } = script.attribs;
				if (!src) continue;
				const response = await fixture.fetch(src);
				assert.equal(response.status, 200, `404: ${src}`);
			}
		});
	});
}

Dependencies

Frequently Asked Questions

What does vue-component.test.js do?
vue-component.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does vue-component.test.js depend on?
vue-component.test.js imports 5 module(s): cheerio, loadFixture, node:test, strict, test-utils.js.
Where is vue-component.test.js in the architecture?
vue-component.test.js is located at packages/astro/test/vue-component.test.js (domain: IntegrationAdapters, directory: packages/astro/test).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free