Skip to content

Commit 7c5b6a3

Browse files
committed
fix(rollup-plugin-html): fix extractAssets tests and remove duplicate test/src/
- Remove duplicate test/src/ directory (old master tests that conflict with migrated test/ files) - Add extractAssets: true to extractAssets test calls (required param) - Update hashed expectations to match current behavior - Use extractAssets: 'legacy-html' for the mixed-hashing test Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 570e01a commit 7c5b6a3

8 files changed

Lines changed: 15 additions & 2412 deletions

File tree

packages/rollup-plugin-html/test/input/extract/extractAssets.test.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,30 @@ describe('extractAssets', () => {
3232
htmlFilePath: path.join(rootDir, 'index.html'),
3333
htmlDir: rootDir,
3434
rootDir,
35+
extractAssets: true,
3536
});
3637

3738
const assetsWithoutcontent = assets.map(a => ({ ...a, content: undefined }));
3839
assert.deepStrictEqual(assetsWithoutcontent, [
3940
{
4041
content: undefined,
4142
filePath: path.join(rootDir, 'image-a.png'),
42-
hashed: false,
43+
hashed: true,
4344
},
4445
{
4546
content: undefined,
4647
filePath: path.join(rootDir, 'image-b.png'),
47-
hashed: false,
48+
hashed: true,
4849
},
4950
{
5051
content: undefined,
5152
filePath: path.join(rootDir, 'webmanifest.json'),
52-
hashed: false,
53+
hashed: true,
5354
},
5455
{
5556
content: undefined,
5657
filePath: path.join(rootDir, 'image-a.svg'),
57-
hashed: false,
58+
hashed: true,
5859
},
5960
{
6061
content: undefined,
@@ -100,6 +101,7 @@ describe('extractAssets', () => {
100101
htmlFilePath: path.join(rootDir, 'index.html'),
101102
htmlDir: rootDir,
102103
rootDir,
104+
extractAssets: true,
103105
});
104106

105107
const transformedAssets = assets.map(asset => ({
@@ -110,13 +112,13 @@ describe('extractAssets', () => {
110112
{
111113
content: '{"message":"helloworld"}',
112114
filePath: path.join(rootDir, 'webmanifest.json'),
113-
hashed: false,
115+
hashed: true,
114116
},
115117
{
116118
content:
117119
'<svgxmlns="http://www.w3.org/2000/svg"><pathd="M436124H12c-6.6270-12-5.373-12-12V80c0-6.627"></path></svg>',
118120
filePath: path.join(rootDir, 'image-a.svg'),
119-
hashed: false,
121+
hashed: true,
120122
},
121123
{
122124
content: ':root{color:blue;}',
@@ -146,6 +148,7 @@ describe('extractAssets', () => {
146148
htmlFilePath: path.join(rootDir, 'index.html'),
147149
htmlDir: rootDir,
148150
rootDir,
151+
extractAssets: true,
149152
});
150153

151154
assert.strictEqual(assets.length, 2);
@@ -169,6 +172,7 @@ describe('extractAssets', () => {
169172
htmlFilePath: path.join(rootDir, 'foo', 'index.html'),
170173
htmlDir: path.join(rootDir, 'foo'),
171174
rootDir,
175+
extractAssets: true,
172176
});
173177

174178
assert.strictEqual(assets.length, 2);
@@ -195,6 +199,7 @@ describe('extractAssets', () => {
195199
htmlFilePath: path.join(rootDir, 'foo', 'index.html'),
196200
htmlDir: path.join(rootDir, 'foo'),
197201
rootDir,
202+
extractAssets: true,
198203
});
199204

200205
assert.strictEqual(assets.length, 2);
@@ -221,6 +226,7 @@ describe('extractAssets', () => {
221226
htmlFilePath: path.join(rootDir, 'index.html'),
222227
htmlDir: rootDir,
223228
rootDir,
229+
extractAssets: 'legacy-html',
224230
});
225231

226232
assert.strictEqual(assets.length, 2);
@@ -252,6 +258,7 @@ describe('extractAssets', () => {
252258
htmlFilePath: path.join(rootDir, 'foo', 'index.html'),
253259
htmlDir: path.join(rootDir, 'foo'),
254260
rootDir,
261+
extractAssets: true,
255262
});
256263

257264
assert.strictEqual(assets.length, 0);
@@ -270,6 +277,7 @@ describe('extractAssets', () => {
270277
htmlFilePath: path.join(rootDir, 'index.html'),
271278
htmlDir: path.join(rootDir),
272279
rootDir,
280+
extractAssets: true,
273281
});
274282

275283
assert.strictEqual(assets.length, 1);
@@ -310,6 +318,7 @@ describe('extractAssets', () => {
310318
htmlFilePath: path.join(rootDir, 'index.html'),
311319
htmlDir: path.join(rootDir),
312320
rootDir,
321+
extractAssets: true,
313322
});
314323

315324
// the <img> src is not the same as the small jpeg image

0 commit comments

Comments
 (0)