Skip to content

Commit 33ff7a9

Browse files
escapedcatmarionebl
authored andcommitted
feat(load): display warning when config is empty conventional-changelog#107
1 parent 2f31524 commit 33ff7a9

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
@@ -7,6 +7,7 @@ import merge from 'lodash.merge';
77
import mergeWith from 'lodash.mergewith';
88
import pick from 'lodash.pick';
99
import resolveFrom from 'resolve-from';
10+
// Import chalk from 'chalk';
1011

1112
const w = (a, b) => (Array.isArray(b) ? b : undefined);
1213
const valid = input =>
@@ -99,6 +100,13 @@ async function loadConfig(cwd, configPath) {
99100
if (local) {
100101
return local;
101102
}
103+
// Because local is `null`
104+
// throw new Error(`123`);
105+
106+
console.log('NEIN DER ZWERG DAS IST JA OTTO');
107+
108+
// This does not show up in tests
109+
// chalk.yellow(`⚠ ${chalk.bold('config file')} may not be empty.`);
102110

103111
return {};
104112
}

@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)