fix: preserve workspace cascade in production build
Some checks failed
Build and tests / test (push) Has been cancelled
Some checks failed
Build and tests / test (push) Has been cancelled
This commit is contained in:
@@ -32,4 +32,21 @@ for (const fileName of ['app.html', 'share.html']) {
|
||||
assert.strictEqual(/vue\.global(?:\.prod)?\.js|axios\.min\.js/.test(html), false, `${fileName} still loads global Vue/Axios`);
|
||||
}
|
||||
|
||||
const builtAppHtml = readFileSync(path.join(outputDirectory, 'app.html'), 'utf8');
|
||||
const runtimeWorkspaceMatch = builtAppHtml.match(
|
||||
/<link rel="stylesheet" href="\/(workspace-[a-f0-9]{12}\.css)" data-workspace-runtime>/
|
||||
);
|
||||
assert.ok(runtimeWorkspaceMatch, 'app.html is missing the hashed runtime workspace stylesheet');
|
||||
|
||||
const runtimeWorkspacePath = path.join(outputDirectory, runtimeWorkspaceMatch[1]);
|
||||
assert.ok(existsSync(runtimeWorkspacePath), 'runtime workspace stylesheet is missing');
|
||||
assert.ok(
|
||||
builtAppHtml.indexOf(runtimeWorkspaceMatch[0]) > builtAppHtml.lastIndexOf('</style>'),
|
||||
'runtime workspace stylesheet must load after every legacy inline style'
|
||||
);
|
||||
|
||||
const runtimeWorkspaceCss = readFileSync(runtimeWorkspacePath, 'utf8');
|
||||
assert.ok(runtimeWorkspaceCss.includes('.mobile-file-create-trigger'), 'runtime workspace stylesheet is incomplete');
|
||||
assert.ok(runtimeWorkspaceCss.includes('@media (max-width: 900px)'), 'runtime workspace mobile breakpoint is missing');
|
||||
|
||||
console.log(`Verified ${htmlFiles.length} HTML entries and their emitted assets.`);
|
||||
|
||||
Reference in New Issue
Block a user