mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-29 17:21:13 +01:00
Revert NODE_COMPILE_CACHE experiment in frontend script tests
Offline source proof (source-deagws44) showed cold first-child V8
bytecode cache writes pushing the first test in both
check-bundle-size.test.mjs and build-embed-assets.test.mjs past
Vitest's 5000ms default timeout without meaningfully improving steady-state
per-test duration. Restore both test files byte-for-byte to e372097c0e.
Contract-Neutral: Test-only revert restoring frontend script tests to base main; no production code or subsystem contracts changed.
Change-source: pulse-maintainer
This commit is contained in:
@@ -15,15 +15,11 @@ import {
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import { afterAll, afterEach, describe, expect, it } from 'vitest';
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
import { completeBuild } from './build-output-fixture.mjs';
|
||||
|
||||
const repository = fileURLToPath(new URL('../../../', import.meta.url));
|
||||
const roots = [];
|
||||
// Keep every invocation a fresh process running the real CLI, but reuse V8
|
||||
// bytecode compilation for jsdom's unchanged dependency graph within this suite.
|
||||
const compileCache = mkdtempSync(path.join(os.tmpdir(), 'pulse-build-embed-bytecode-'));
|
||||
const childEnv = { ...process.env, NODE_COMPILE_CACHE: compileCache };
|
||||
const previousFiles = completeBuild({
|
||||
'assets/previous.js': 'console.log("previous successful frontend");\n',
|
||||
'docs/previous.md': 'Previously usable help.\n',
|
||||
@@ -155,7 +151,7 @@ syncBuiltinESMExports();
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[...args, path.join(root, 'frontend-modern', 'scripts', name)],
|
||||
{ cwd: root, env: childEnv, encoding: 'utf8', timeout: 15_000 },
|
||||
{ cwd: root, encoding: 'utf8', timeout: 15_000 },
|
||||
);
|
||||
expect(result.error).toBeUndefined();
|
||||
expect(result.signal).toBeNull();
|
||||
@@ -182,10 +178,6 @@ afterEach(() => {
|
||||
for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
rmSync(compileCache, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
describe.each([true, false])('frontend producer with previous output: %s', (previous) => {
|
||||
it.each([
|
||||
{ name: 'complete-looking nonzero output', code: 17, reason: /exited with code 17/ },
|
||||
|
||||
@@ -7,14 +7,10 @@ import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { gzipSync } from 'node:zlib';
|
||||
import { afterAll, afterEach, describe, expect, it } from 'vitest';
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
|
||||
const checker = fileURLToPath(new URL('../check-bundle-size.mjs', import.meta.url));
|
||||
const temporaryRoots = [];
|
||||
// Keep every invocation a fresh process running the real CLI, but reuse V8
|
||||
// bytecode compilation for jsdom's unchanged dependency graph within this suite.
|
||||
const compileCache = mkdtempSync(path.join(os.tmpdir(), 'pulse-bundle-bytecode-'));
|
||||
const childEnv = { ...process.env, NODE_COMPILE_CACHE: compileCache };
|
||||
const digest = (content, algorithm = 'sha384') =>
|
||||
`${algorithm}-${createHash(algorithm).update(content).digest('base64')}`;
|
||||
const inventoryError =
|
||||
@@ -84,7 +80,6 @@ function fixture(algorithm = 'sha384') {
|
||||
const result = spawnSync(process.execPath, [script], {
|
||||
encoding: 'utf8',
|
||||
cwd: root,
|
||||
env: childEnv,
|
||||
timeout: 15000,
|
||||
});
|
||||
expect(result.error).toBeUndefined();
|
||||
@@ -103,10 +98,6 @@ afterEach(() => {
|
||||
while (temporaryRoots.length) rmSync(temporaryRoots.pop(), { recursive: true, force: true });
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
rmSync(compileCache, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
describe('complete asset budget inventory', () => {
|
||||
// Deterministic incompressible content makes each nested asset alone exceed
|
||||
// the unchanged 10 kB fixture total, independently of minifier/clock state.
|
||||
@@ -161,7 +152,7 @@ describe('complete asset budget inventory', () => {
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[path.join(f.root, 'scripts/check-bundle-size.mjs'), '--update-baseline'],
|
||||
{ encoding: 'utf8', cwd: f.root, env: childEnv, timeout: 15000 },
|
||||
{ encoding: 'utf8', cwd: f.root, timeout: 15000 },
|
||||
);
|
||||
expect(result.error).toBeUndefined();
|
||||
expect(result.signal).toBeNull();
|
||||
|
||||
Reference in New Issue
Block a user