Skip to content

Commit 7a27b4f

Browse files
authored
fix: providing cwd matching the root dir and filter option conflicted preventing functions to be discovered (#7366)
1 parent 73a7d46 commit 7a27b4f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/commands/base-command.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,21 @@ export default class BaseCommand extends Command {
500500
private async init(actionCommand: BaseCommand) {
501501
debug(`${actionCommand.name()}:init`)('start')
502502
const flags = actionCommand.opts()
503+
503504
// here we actually want to use the process.cwd as we are setting the workingDir
504505
// eslint-disable-next-line no-restricted-properties
505-
this.workingDir = flags.cwd ? resolve(flags.cwd) : process.cwd()
506+
const processCwd = process.cwd()
507+
508+
if (flags.cwd) {
509+
const resolvedCwd = resolve(flags.cwd)
510+
this.workingDir = resolvedCwd
511+
512+
// if cwd matches process.cwd, act like cwd wasn't provided
513+
if (resolvedCwd === processCwd) {
514+
delete flags.cwd
515+
this.workingDir = processCwd
516+
}
517+
}
506518

507519
// ==================================================
508520
// Create a Project and run the Heuristics to detect

0 commit comments

Comments
 (0)