Skip to content

Commit 1f62b28

Browse files
clydinalan-agius4
authored andcommitted
test: improve resilience of asset timestamp E2E test
The test now uses an asset that is already on disk. Using an asset that was just written within the test may cause timestamps to not yet be synced to disk.
1 parent 5c9b371 commit 1f62b28

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/legacy-cli/e2e/tests/build/assets.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const isNodeV22orHigher = Number(process.versions.node.split('.', 1)[0]) >= 22;
1111
export default async function () {
1212
await writeFile('public/.file', '');
1313
await writeFile('public/test.abc', 'hello world');
14-
const originalStats = fs.statSync('public/test.abc', { bigint: true });
14+
15+
const originalStats = fs.statSync('public/favicon.ico', { bigint: true });
1516

1617
await ng('build', '--configuration=development');
1718

@@ -22,9 +23,10 @@ export default async function () {
2223

2324
// Timestamp preservation only supported with application build system on Node.js v22+
2425
if (isNodeV22orHigher && getGlobalVariable('argv')['esbuild']) {
25-
const outputStats = fs.statSync('dist/test-project/browser/test.abc', { bigint: true });
26-
assert(
27-
originalStats.mtimeMs === outputStats.mtimeMs,
26+
const outputStats = fs.statSync('dist/test-project/browser/favicon.ico', { bigint: true });
27+
assert.equal(
28+
originalStats.mtimeMs,
29+
outputStats.mtimeMs,
2830
'Asset file modified timestamp should be preserved.',
2931
);
3032
}

0 commit comments

Comments
 (0)