Skip to content

Commit 5a11aee

Browse files
committed
fix: fix default opts processing
1 parent 576b08d commit 5a11aee

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/main/ts/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,20 @@ import {
1818
IErr,
1919
} from './interface'
2020

21+
export const DEFAULT_CMD_OPTS: ICmdOpts = {cwd: process.cwd()}
22+
2123
export const DEFAULT_OPTS = {
2224
trim: true,
2325
normalizeSpaces: true,
2426
normalizePaths: true,
2527
normalizeEncoding: true,
28+
cmdOpts: DEFAULT_CMD_OPTS,
2629
}
2730

28-
export const DEFAULT_CMD_OPTS: ICmdOpts = {cwd: process.cwd()}
29-
30-
export const processCmdOpts = (opts: ICmdOpts = {}): ICmdOpts => ({...DEFAULT_CMD_OPTS, opts})
31-
3231
export const getExecSnapshot = async(opts: IOpts): Promise<ISnapshot> => new Promise((resolve) => {
3332
const {cmd, cmdOpts} = opts
34-
const _cmdOpts: any = processCmdOpts(cmdOpts)
3533

36-
exec(cmd, _cmdOpts, (_err: ExecException | null, _stdout: string | Buffer, _stderr: string | Buffer) => {
34+
exec(cmd, cmdOpts as any, (_err: ExecException | null, _stdout: string | Buffer, _stderr: string | Buffer) => {
3735
const stdout = _stdout + ''
3836
const stderr = _stderr + ''
3937
const err: IErr = {

src/test/ts/__snapshots__/index.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Object {
88
"signal": null,
99
},
1010
"stderr": "",
11-
"stdout": "/Users/antongolub/projects/stdstream-snapshot/rules/some-rules.ts
11+
"stdout": "/rules/some-rules.ts
1212
2:7 error 'name' is assigned a value but never used no-unused-vars
1313
3:7 error 'name' is already defined no-redeclare",
1414
}

0 commit comments

Comments
 (0)