hmr.test.js — astro Source File
Architecture documentation for hmr.test.js, a javascript file in the astro codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR b7fbb91b_2c1d_1d50_c307_9556e62da99a["hmr.test.js"] acc8cacb_3c42_a097_0b5f_b99e2f87fc52["../../../dist/vite-plugin-astro/hmr.js"] b7fbb91b_2c1d_1d50_c307_9556e62da99a --> acc8cacb_3c42_a097_0b5f_b99e2f87fc52 e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] b7fbb91b_2c1d_1d50_c307_9556e62da99a --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] b7fbb91b_2c1d_1d50_c307_9556e62da99a --> 6b0635f9_51ea_77aa_767b_7857878e98a6 style b7fbb91b_2c1d_1d50_c307_9556e62da99a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import * as assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { isStyleOnlyChanged } from '../../../dist/vite-plugin-astro/hmr.js';
describe('isStyleOnlyChanged', () => {
it('should return false if nothing change', () => {
const oldCode = 'a';
const newCode = 'a';
assert.equal(isStyleOnlyChanged(oldCode, newCode), false);
});
it('should return false if script has changed', () => {
const oldCode = '<script>console.log("Hello");</script><style>body { color: red; }</style>';
const newCode = '<script>console.log("Hi");</script><style>body { color: red; }</style>';
assert.equal(isStyleOnlyChanged(oldCode, newCode), false);
});
it('should return true if only style has changed', () => {
const oldCode = '<style>body { color: red; }</style>';
const newCode = '<style>body { color: blue; }</style>';
assert.equal(isStyleOnlyChanged(oldCode, newCode), true);
});
it('should return false if style tags are added or removed', () => {
const oldCode = '<style>body { color: red; }</style>';
const newCode = '<style>body { color: red; }</style><style>a { color: blue; }</style>';
assert.equal(isStyleOnlyChanged(oldCode, newCode), false);
});
it('should return false if frontmatter has changed', () => {
const oldCode = `
---
title: Hello
---
<style>body { color: red; }</style>`;
const newCode = `
---
title: Hi
---
<style>body { color: red; }</style>`;
assert.equal(isStyleOnlyChanged(oldCode, newCode), false);
});
it('should return false if both frontmatter and style have changed', () => {
const oldCode = `
---
title: Hello
---
<style>body { color: red; }</style>`;
const newCode = `
---
title: Hi
---
<style>body { color: blue; }</style>`;
assert.equal(isStyleOnlyChanged(oldCode, newCode), false);
});
it('should return false if both markup and style have changed', () => {
const oldCode = '<h1>Hello</h1><style>body { color: red; }</style>';
const newCode = '<h1>Hi</h1><style>body { color: blue; }</style>';
assert.equal(isStyleOnlyChanged(oldCode, newCode), false);
});
});
Domain
Dependencies
- ../../../dist/vite-plugin-astro/hmr.js
- node:test
- strict
Source
Frequently Asked Questions
What does hmr.test.js do?
hmr.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does hmr.test.js depend on?
hmr.test.js imports 3 module(s): ../../../dist/vite-plugin-astro/hmr.js, node:test, strict.
Where is hmr.test.js in the architecture?
hmr.test.js is located at packages/astro/test/units/vite-plugin-astro/hmr.test.js (domain: IntegrationAdapters, directory: packages/astro/test/units/vite-plugin-astro).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free