Skip to content

Commit f9a7b0b

Browse files
Nick WoodwardKent C. Dodds
Nick Woodward
authored and
Kent C. Dodds
committed
fix: default config values for yml files (#171)
* updated various dev dependencies jest-cli seems to have improved the stability of the tests
1 parent b5769c9 commit f9a7b0b

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"all-contributors-cli": "^4.3.0",
3737
"babel-cli": "^6.24.1",
3838
"babel-eslint": "^7.2.3",
39-
"babel-jest": "^20.0.3",
40-
"babel-plugin-module-resolver": "^2.7.1",
39+
"babel-jest": "^22.0.0",
40+
"babel-plugin-module-resolver": "^3.0.0",
4141
"babel-preset-env": "^1.6.0",
4242
"babel-preset-stage-2": "^6.24.1",
4343
"babel-register": "^6.24.1",
@@ -48,8 +48,8 @@
4848
"eslint-plugin-import": "2.7.0",
4949
"eslint-plugin-jest": "20.0.3",
5050
"husky": "0.14.3",
51-
"jest-cli": "^20.0.4",
52-
"lint-staged": "^4.0.1",
51+
"jest-cli": "^22.0.0",
52+
"lint-staged": "^7.0.0",
5353
"nps": "^5.4.0",
5454
"nps-utils": "^1.2.0",
5555
"opt-cli": "^1.5.1",
@@ -62,7 +62,8 @@
6262
"kentcdodds/prettier"
6363
],
6464
"rules": {
65-
"max-len": "off"
65+
"max-len": "off",
66+
"max-lines": "off"
6667
}
6768
},
6869
"lint-staged": {
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
scripts:
22
skywalker: echo "That's impossible!!"
3-
4-
options: {}

src/bin-utils/__tests__/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,16 @@ test('loadConfig: logs a warning when the YAML file cannot be located', () => {
212212
)
213213
})
214214

215-
test('loadConfig: can load config from YML file', () => {
215+
test('loadConfig: can load config from a YML file', () => {
216216
const relativePath = './src/bin-utils/__tests__/fixtures/fake-config.yml'
217217
const val = loadConfig(relativePath)
218218
expect(val).toEqual({
219219
scripts: {
220220
skywalker: `echo "That's impossible!!"`,
221221
},
222-
options: {},
222+
options: {
223+
'help-style': 'all',
224+
},
223225
})
224226
})
225227

src/bin-utils/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ const loadJSConfig = getAttemptModuleRequireFn(function onFail(
6565
*/
6666
// eslint-disable-next-line complexity
6767
function loadConfig(configPath, input) {
68+
let config
6869
if (configPath.endsWith('.yml')) {
69-
return loadYAMLConfig(configPath)
70+
config = loadYAMLConfig(configPath)
71+
} else {
72+
config = loadJSConfig(configPath)
7073
}
7174

72-
let config = loadJSConfig(configPath)
7375
if (isUndefined(config)) {
7476
// let the caller deal with this
7577
return config

src/bin-utils/parser.js

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ function parse(rawArgv) {
117117

118118
// util functions
119119

120+
// eslint-disable-next-line complexity
120121
function showHelp(specifiedScripts) {
121122
if (parsedArgv.help) {
122123
// if --help was specified, then yargs will show the default help

test/jest.src.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
rootDir: '../src',
3+
collectCoverage: true,
34
testEnvironment: 'node',
4-
collectCoverageFrom: ['src/**/*.js'],
55
testPathIgnorePatterns: ['/node_modules/', '/fixtures/', '/helpers/'],
66
coveragePathIgnorePatterns: [
77
'/node_modules/',

0 commit comments

Comments
 (0)