Skip to content

Commit 605077c

Browse files
authored
test: fix unstable build watch case (#504)
1 parent 97909c2 commit 605077c

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ node_modules/
55
.eslintcache
66

77
dist/
8-
dist-types/
8+
dist-*/
99
compiled/
1010
coverage/
1111
doc_build/
@@ -22,4 +22,4 @@ test-results
2222
.idea/
2323
.nx/
2424
**/@mf-types
25-
**/@mf-types/**
25+
**/@mf-types/**

tests/integration/cli/build-watch/build.test.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ import { describe, test } from 'vitest';
77
describe('build --watch command', async () => {
88
test('basic', async () => {
99
const distPath = path.join(__dirname, 'dist');
10+
const dist1Path = path.join(__dirname, 'dist-1');
1011
fse.removeSync(distPath);
1112

13+
fse.removeSync(dist1Path);
14+
15+
const distEsmIndexFile = path.join(__dirname, 'dist/esm/index.js');
16+
const dist1EsmIndexFile = path.join(__dirname, 'dist-1/esm/index.js');
17+
1218
const tempConfigFile = path.join(__dirname, 'test-temp-rslib.config.mjs');
1319

1420
fse.outputFileSync(
@@ -26,24 +32,26 @@ export default defineConfig({
2632
cwd: __dirname,
2733
});
2834

29-
const distEsmIndexFile = path.join(__dirname, 'dist/esm/index.js');
30-
3135
await awaitFileExists(distEsmIndexFile);
3236

33-
fse.removeSync(distPath);
34-
3537
fse.outputFileSync(
3638
tempConfigFile,
3739
`import { defineConfig } from '@rslib/core';
3840
import { generateBundleEsmConfig } from 'test-helper';
3941
4042
export default defineConfig({
41-
lib: [generateBundleEsmConfig()],
43+
lib: [generateBundleEsmConfig({
44+
output: {
45+
distPath: {
46+
root: './dist-1/esm',
47+
},
48+
},
49+
})],
4250
});
4351
`,
4452
);
4553

46-
await awaitFileExists(distEsmIndexFile);
54+
await awaitFileExists(dist1EsmIndexFile);
4755

4856
process.kill();
4957
});

0 commit comments

Comments
 (0)