Skip to content

Commit e8f9481

Browse files
authored
fix packaging watch test on windows (#4923)
1 parent 754ea7c commit e8f9481

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

packages/kit/src/packaging/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export async function watch(config, cwd = process.cwd()) {
109109
let timeout;
110110

111111
const watcher = chokidar.watch(lib, { ignoreInitial: true });
112+
const ready = new Promise((resolve) => watcher.on('ready', resolve));
112113

113114
watcher.on('all', async (type, path) => {
114115
const file = analyze(config, relative(lib, path));
@@ -176,6 +177,7 @@ export async function watch(config, cwd = process.cwd()) {
176177

177178
return {
178179
watcher,
180+
ready,
179181
settled: () =>
180182
new Promise((fulfil, reject) => {
181183
fulfillers.push(fulfil);

packages/kit/src/packaging/test/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ if (!process.env.CI) {
154154
const config = await load_config({ cwd });
155155
config.kit.package.dir = resolve(cwd, config.kit.package.dir);
156156

157-
const { watcher, settled } = await watch(config, cwd);
157+
const { watcher, ready, settled } = await watch(config, cwd);
158158

159159
/** @param {string} file */
160160
function compare(file) {
@@ -181,6 +181,8 @@ if (!process.env.CI) {
181181
}
182182

183183
try {
184+
await ready;
185+
184186
// completes initial build
185187
compare('index.js');
186188

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"compilerOptions": {
33
"allowJs": true,
4-
"checkJs": true
4+
"checkJs": true,
5+
"newLine": "lf"
56
}
67
}

0 commit comments

Comments
 (0)