Skip to content

Commit b347e5f

Browse files
escapedcatmarionebl
authored andcommitted
feat(load): display warning when config is empty conventional-changelog#107
1 parent 9ebe8a3 commit b347e5f

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

@commitlint/load/src/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import resolveExtends from '@commitlint/resolve-extends';
44
import cosmiconfig from 'cosmiconfig';
55
import {toPairs, merge, mergeWith, pick} from 'lodash';
66
import resolveFrom from 'resolve-from';
7+
// Import chalk from 'chalk';
78

89
const w = (a, b) => (Array.isArray(b) ? b : undefined);
910
const valid = input =>
@@ -96,6 +97,13 @@ async function loadConfig(cwd, configPath) {
9697
if (local) {
9798
return local;
9899
}
100+
// Because local is `null`
101+
// throw new Error(`123`);
102+
103+
console.log('NEIN DER ZWERG DAS IST JA OTTO');
104+
105+
// This does not show up in tests
106+
// chalk.yellow(`⚠ ${chalk.bold('config file')} may not be empty.`);
99107

100108
return {};
101109
}

@commitlint/load/src/index.serial-test.js

+16
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,19 @@ test.serial('default cwd option to process.cwd()', async t => {
1717
process.chdir(before);
1818
}
1919
});
20+
21+
// Test.serial('empty cwd option to process.cwd() should throw error message', async t => {
22+
// const cwd = await fix.bootstrap('fixtures/empty-file');
23+
// const before = process.cwd();
24+
// process.chdir(cwd);
25+
26+
// try {
27+
// const actual = await load();
28+
// } catch (err) {
29+
// console.log('-------------------------')
30+
// // t.true(err.includes('OTTO'));
31+
// // throw err;
32+
// } finally {
33+
// process.chdir(before);
34+
// }
35+
// });

0 commit comments

Comments
 (0)