Skip to content

Commit 17d9985

Browse files
committed
fix(gen:test:endpoint): jshint function also checks that the file exists
1 parent cfa3152 commit 17d9985

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Diff for: src/test/endpoint.test.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,14 @@ function runEndpointGen(name, opt={}) {
105105

106106
let jshintCmd = path.join(TEST_DIR, '/fixtures/node_modules/.bin/jshint');
107107
function jshint(_path, opt={}) {
108-
let {exclude, config} = opt;
109-
let cmd = `${jshintCmd} ${path.normalize(_path)}`;
110-
if(exclude) cmd += ` --exclude ${exclude}`;
111-
if(config) cmd += ` --config ${config}`;
112-
return runCmd(cmd);
108+
_path = path.normalize(_path);
109+
return fs.accessAsync(_path, fs.R_OK).then(err => {
110+
let {config} = opt;
111+
let cmd = `${jshintCmd} ${path.normalize(_path)}`;
112+
if(config) cmd += ` --config ${config}`;
113+
return runCmd(cmd);
114+
});
115+
}
113116
}
114117

115118
var config;

0 commit comments

Comments
 (0)