Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/rstack/src/staged.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Options:
--allow-empty Allow empty commits when tasks revert all staged changes
-p, --concurrent <number|boolean> The number of tasks to run concurrently, or false for serial
--cwd <path> Working directory to run all tasks in
-d, --debug Print additional debug information
--no-stash Disable the backup stash. Implies "--no-revert".
-q, --quiet Disable lint-staged's own console output
-r, --relative Pass relative filepaths to tasks
Expand All @@ -26,6 +27,7 @@ export async function runStagedCLI(args: string[]): Promise<void> {
allowEmpty: { type: 'boolean' },
concurrent: { type: 'string', short: 'p' },
cwd: { type: 'string' },
debug: { type: 'boolean', short: 'd' },
help: { type: 'boolean', short: 'h' },
'no-stash': { type: 'boolean' },
quiet: { type: 'boolean', short: 'q' },
Expand Down Expand Up @@ -58,6 +60,7 @@ export async function runStagedCLI(args: string[]): Promise<void> {
concurrent: values.concurrent === undefined ? true : JSON.parse(values.concurrent),
config: stagedConfig,
cwd: values.cwd,
debug: values.debug ?? false,
quiet: values.quiet ?? false,
relative: values.relative ?? false,
stash: !values['no-stash'],
Expand Down
10 changes: 10 additions & 0 deletions packages/rstack/test/cli/staged/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ test('should display the staged help message', ({ execCli, expect }) => {
expect(output).toContain('Runs lint-staged with tasks from define.staged in rstack.config.');
expect(output).toContain('--allow-empty');
expect(output).toContain('--cwd <path>');
expect(output).toContain('-d, --debug');
expect(output).toContain('--no-stash');
expect(output).toContain('-q, --quiet');
expect(output).toContain('-r, --relative');
Expand Down Expand Up @@ -101,6 +102,15 @@ for (const option of ['--concurrent false', '-p 1']) {
});
}

for (const option of ['--debug', '-d']) {
test(`should print debug output with ${option}`, async ({ execCli, expect }) => {
await withGitFixture((cwd) => {
const output = execCli(`staged --allow-empty ${option} 2>&1`, { cwd });
expect(output).toContain('lint-staged:');
});
});
}

for (const option of ['--verbose', '-v']) {
test(`should show successful task output with ${option}`, async ({ execCli, expect }) => {
await withGitFixture((cwd) => {
Expand Down