Skip to content

Commit

Permalink
feat(load): display warning when config is empty conventional-changel…
Browse files Browse the repository at this point in the history
  • Loading branch information
escapedcat authored and marionebl committed Nov 30, 2018
1 parent 9ebe8a3 commit b347e5f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions @commitlint/load/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import resolveExtends from '@commitlint/resolve-extends';
import cosmiconfig from 'cosmiconfig';
import {toPairs, merge, mergeWith, pick} from 'lodash';
import resolveFrom from 'resolve-from';
// Import chalk from 'chalk';

const w = (a, b) => (Array.isArray(b) ? b : undefined);
const valid = input =>
Expand Down Expand Up @@ -96,6 +97,13 @@ async function loadConfig(cwd, configPath) {
if (local) {
return local;
}
// Because local is `null`
// throw new Error(`123`);

console.log('NEIN DER ZWERG DAS IST JA OTTO');

// This does not show up in tests
// chalk.yellow(`⚠ ${chalk.bold('config file')} may not be empty.`);

return {};
}
16 changes: 16 additions & 0 deletions @commitlint/load/src/index.serial-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,19 @@ test.serial('default cwd option to process.cwd()', async t => {
process.chdir(before);
}
});

// Test.serial('empty cwd option to process.cwd() should throw error message', async t => {
// const cwd = await fix.bootstrap('fixtures/empty-file');
// const before = process.cwd();
// process.chdir(cwd);

// try {
// const actual = await load();
// } catch (err) {
// console.log('-------------------------')
// // t.true(err.includes('OTTO'));
// // throw err;
// } finally {
// process.chdir(before);
// }
// });

0 comments on commit b347e5f

Please sign in to comment.