-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from dword-design/renovate/lock-file-maintenance
chore(deps): lock file maintenance
- Loading branch information
Showing
7 changed files
with
2,808 additions
and
8,442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
export default (args, callback) => { | ||
export default async (args, func) => { | ||
if (typeof args === 'function') { | ||
callback = args | ||
func = args | ||
args = [] | ||
} | ||
|
||
const oldArgv = process.argv | ||
process.argv = [...oldArgv.slice(0, 2), ...args] | ||
|
||
return Promise.resolve().then(callback).finally(() => process.argv = oldArgv) | ||
try { | ||
await func() | ||
} finally { | ||
process.argv = oldArgv | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,37 @@ | ||
import mockArgv from '.' | ||
|
||
export default { | ||
async: () => mockArgv( | ||
['foo', 'bar'], | ||
() => new Promise(resolve => setTimeout(() => { expect(process.argv).toEqual([...process.argv.slice(0, 2), 'foo', 'bar']); return resolve() }, 100)), | ||
), | ||
async: () => | ||
mockArgv( | ||
['foo', 'bar'], | ||
() => | ||
new Promise(resolve => | ||
setTimeout(() => { | ||
expect(process.argv).toEqual([ | ||
...process.argv.slice(0, 2), | ||
'foo', | ||
'bar', | ||
]) | ||
return resolve() | ||
}, 100) | ||
) | ||
), | ||
'empty args': done => { | ||
mockArgv([], () => { expect(process.argv).toEqual(process.argv.slice(0, 2)); done() }) | ||
mockArgv([], () => { | ||
expect(process.argv).toEqual(process.argv.slice(0, 2)) | ||
done() | ||
}) | ||
}, | ||
'has args': done => { | ||
mockArgv(['foo', 'bar'], () => { expect(process.argv).toEqual([...process.argv.slice(0, 2), 'foo', 'bar']); done() }) | ||
mockArgv(['foo', 'bar'], () => { | ||
expect(process.argv).toEqual([...process.argv.slice(0, 2), 'foo', 'bar']) | ||
done() | ||
}) | ||
}, | ||
'missing args': done => { | ||
mockArgv(() => { expect(process.argv).toEqual(process.argv.slice(0, 2)); done() }) | ||
mockArgv(() => { | ||
expect(process.argv).toEqual(process.argv.slice(0, 2)) | ||
done() | ||
}) | ||
}, | ||
} | ||
|
Oops, something went wrong.