Make static asset regression test build independent
Test, build, and deploy ComfyUI Jobs / deploy (push) Successful in 15s
Test, build, and deploy ComfyUI Jobs / test-build (push) Successful in 4m43s
Test, build, and deploy ComfyUI Jobs / browser-test (push) Successful in 1m35s
Test, build, and deploy ComfyUI Jobs / qa-gate (push) Successful in 4s
Test, build, and deploy ComfyUI Jobs / deploy (push) Successful in 15s
Test, build, and deploy ComfyUI Jobs / test-build (push) Successful in 4m43s
Test, build, and deploy ComfyUI Jobs / browser-test (push) Successful in 1m35s
Test, build, and deploy ComfyUI Jobs / qa-gate (push) Successful in 4s
This commit is contained in:
+5
-3
@@ -6,12 +6,14 @@ const { app, jobFromHistory, statusFromHistory } = require('./server');
|
||||
|
||||
test('serves frontend assets before authentication redirects', async (t) => {
|
||||
const server = app.listen(0);
|
||||
const browserDir = path.join(__dirname, 'frontend', 'dist', 'browser');
|
||||
const asset = '__qa-static-asset.js';
|
||||
fs.mkdirSync(browserDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(browserDir, asset), 'window.__qaStaticAsset = true;\n');
|
||||
t.after(() => server.close());
|
||||
t.after(() => fs.rmSync(path.join(browserDir, asset), { force: true }));
|
||||
await new Promise((resolve) => server.once('listening', resolve));
|
||||
const port = server.address().port;
|
||||
const index = fs.readFileSync(path.join(__dirname, 'frontend', 'dist', 'browser', 'index.html'), 'utf8');
|
||||
const asset = index.match(/src="([^"]+\.js)"/)?.[1];
|
||||
assert.ok(asset, 'the built frontend should reference a JavaScript asset');
|
||||
const response = await fetch(`http://127.0.0.1:${port}/${asset}`);
|
||||
assert.equal(response.status, 200);
|
||||
assert.match(response.headers.get('content-type') || '', /javascript/);
|
||||
|
||||
Reference in New Issue
Block a user