mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fix(validate) corruption of config when root not found
This commit is contained in:
parent
4ff7973d43
commit
eb6a79cf97
2 changed files with 14 additions and 11 deletions
|
|
@ -50,10 +50,12 @@ test('validate: root: /home', (t) => {
|
|||
|
||||
test('validate: root: stat', (t) => {
|
||||
const fn = sinon.stub();
|
||||
const {stat} = fs;
|
||||
const {statSync} = fs;
|
||||
|
||||
const error = 'ENOENT';
|
||||
fs.stat = (dir, fn) => fn(Error(error));
|
||||
fs.statSync = () => {
|
||||
throw Error(error);
|
||||
};
|
||||
|
||||
mockRequire(exitPath, fn);
|
||||
|
||||
|
|
@ -62,7 +64,7 @@ test('validate: root: stat', (t) => {
|
|||
root('hello', fn);
|
||||
|
||||
const msg = 'cloudcmd --root: %s';
|
||||
fs.stat = stat;
|
||||
fs.statSync = statSync;
|
||||
|
||||
mockRequire.stop(exitPath);
|
||||
t.ok(fn.calledWith(msg, error), 'should call fn');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue