Skip to content

Commit 09db533

Browse files
bcomnesclaude
andcommitted
Add CSS asset loader integration fixture and assertions
References a .gif (dataurl loader) and .woff2 (file loader) from global.css. The test now asserts that the output CSS contains a base64-inlined data URL for the image, and that the woff2 font was emitted as a separate file. This catches regressions where esbuild would error on unrecognized file extensions in CSS. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent bd3cfea commit 09db533

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

test-cases/general-features/index.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,21 @@ test.describe('general-features', () => {
103103
const jsChunkFiles = files.filter(f => f.relname.match(/chunks\/js\/chunk-.+\.js$/))
104104
assert.ok(jsChunkFiles.length > 0, 'at least one shared JS chunk was produced with a hashed name')
105105

106+
// Verify that CSS asset loaders work: images inline as data URLs, fonts are emitted as files
107+
const globalCssFile = files.find(f => f.relname.match(/global-([A-Z0-9])\w+\.css$/))
108+
if (globalCssFile) {
109+
const cssContent = await readFile(path.join(dest, globalCssFile.relname), 'utf8')
110+
assert.ok(
111+
cssContent.includes('data:image/gif;base64,'),
112+
'global CSS inlines GIF image as a base64 data URL'
113+
)
114+
} else {
115+
assert.fail('Could not find global CSS output file to verify asset loaders')
116+
}
117+
118+
const woff2Files = files.filter(f => f.relname.endsWith('.woff2'))
119+
assert.ok(woff2Files.length > 0, 'woff2 font file was emitted to the output directory')
120+
106121
// Special test for global.data.js blogPostsHtml
107122
const indexPath = path.join(dest, 'index.html')
108123
try {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
@import 'mine.css/dist/mine.css';
22
@import 'mine.css/dist/layout.css';
3+
4+
.test-asset-icon { background-image: url('./test-icon.gif'); }
5+
@font-face { font-family: 'TestFont'; src: url('./test-font.woff2'); }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
wOF2placeholder
43 Bytes
Loading

0 commit comments

Comments
 (0)