Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions e2e/cases/cli/watch-files/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { awaitFileExists, getRandomPort, rspackOnlyTest } from '@e2e/helper';
import { expect, test } from '@playwright/test';

const dist = path.join(__dirname, 'dist');
const distIndexFile = path.join(__dirname, 'dist/static/js/index.js');
const tempConfigPath = './test-temp-config.ts';
const tempOutputFile = path.join(__dirname, 'test-temp-file.txt');
const extraConfigFile = path.join(__dirname, tempConfigPath);
Expand All @@ -29,7 +30,7 @@ rspackOnlyTest(
});

// the first build
await awaitFileExists(dist);
await awaitFileExists(distIndexFile);

fs.rmSync(tempOutputFile, { force: true });
// temp config changed and trigger rebuild
Expand All @@ -55,9 +56,9 @@ rspackOnlyTest(
},
});

await awaitFileExists(dist);
await awaitFileExists(distIndexFile);

fs.rmSync(dist, { recursive: true });
fs.rmSync(distIndexFile);
// temp config changed
fs.writeFileSync(extraConfigFile, 'export default 2;');

Expand All @@ -79,9 +80,11 @@ rspackOnlyTest(
},
});

await awaitFileExists(dist);
// Fix occasional 'directory not empty' error when wait and rm dist.
// Sometimes the dist directory exists, but the files in the dist directory have not been completely written.
await awaitFileExists(distIndexFile);

fs.rmSync(dist, { recursive: true });
fs.rmSync(distIndexFile);
// temp config changed
fs.writeFileSync(extraConfigFile, 'export default 2;');

Expand Down
Loading