Skip to content

Commit 78f8434

Browse files
authored
chore: Use linkedom a test instead of happy-dom (#1957)
1 parent 7eaccad commit 78f8434

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/wxt/src/core/builders/vite/plugins/__tests__/devHtmlPrerender.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { describe, expect, it } from 'vitest';
2-
import { Window } from 'happy-dom';
32
import { pointToDevServer } from '../devHtmlPrerender';
43
import {
54
fakeDevServer,
65
fakeResolvedConfig,
76
} from '../../../../utils/testing/fake-objects';
87
import { normalizePath } from '../../../../utils/paths';
98
import { resolve } from 'node:path';
9+
import { parseHTML } from 'linkedom';
1010

1111
describe('Dev HTML Prerender Plugin', () => {
1212
describe('pointToDevServer', () => {
@@ -32,9 +32,7 @@ describe('Dev HTML Prerender Plugin', () => {
3232
// URLs should not be changed
3333
['https://example.com/style.css', 'https://example.com/style.css'],
3434
])('should transform "%s" into "%s"', (input, expected) => {
35-
const { document } = new Window({
36-
url: 'http://localhost',
37-
});
35+
const { document } = parseHTML('<html></html>');
3836
const root = '/some/root';
3937
const config = fakeResolvedConfig({
4038
root,
@@ -55,7 +53,7 @@ describe('Dev HTML Prerender Plugin', () => {
5553
const id = root + '/entrypoints/popup/index.html';
5654

5755
document.head.innerHTML = `<link rel="stylesheet" href="${input}" />`;
58-
pointToDevServer(config, server, id, document as any, 'link', 'href');
56+
pointToDevServer(config, server, id, document, 'link', 'href');
5957

6058
const actual = document.querySelector('link')!;
6159
expect(actual.getAttribute('href')).toBe(expected);

0 commit comments

Comments
 (0)