From 332f24261ecb22c8a35dc5ff7babd7abaee6afdc Mon Sep 17 00:00:00 2001 From: Roman Lamsal Date: Fri, 7 Oct 2022 12:40:06 +0200 Subject: [PATCH] fix(watch): relative paths in --ignore flag (#115) Co-authored-by: hiroki osame --- src/watch/index.ts | 1 + tests/specs/watch.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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, ], });