forked from snychka/javascript-promises-async-await
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.js
26 lines (23 loc) · 714 Bytes
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const fs = require('fs');
const path = require('path');
const expect = require('chai').expect;
module.exports = {
checkFileExists: function checkFileExists(fileToCheck = 'index') {
let file;
if (fileToCheck === 'index') {
file = fs.existsSync(path.join(process.cwd(), 'src/index.js'));
expect(file).to.not.equal(
false,
'It seems you have not created the `index.js` file in `src/`.',
);
}
if (fileToCheck === 'services') {
file = fs.existsSync(path.join(process.cwd(), 'src/services.js'));
expect(file).to.not.equal(
false,
'It seems you have not created the `services.js` file in `src/`.',
);
}
return file;
},
};