diff --git a/src/watch/index.ts b/src/watch/index.ts index 3eb2504e..73add2e0 100644 --- a/src/watch/index.ts +++ b/src/watch/index.ts @@ -118,6 +118,7 @@ export const watchCommand = command({ const watcher = watch( argv._, { + cwd: process.cwd(), ignoreInitial: true, ignored: [ // Hidden directories like .git diff --git a/tests/specs/watch.ts b/tests/specs/watch.ts index fe202250..69105889 100644 --- a/tests/specs/watch.ts +++ b/tests/specs/watch.ts @@ -161,12 +161,13 @@ export default testSuite(async ({ describe }, fixturePath: string) => { }); const tsxProcess = tsx({ + cwd: fixture.path, args: [ 'watch', '--clear-screen=false', - `--ignore=${path.join(fixture.path, fileA)}`, + `--ignore=${fileA}`, `--ignore=${path.join(fixture.path, 'directory/*')}`, - path.join(fixture.path, entryFile), + entryFile, ], });