Skip to content

Commit 7713a20

Browse files
committed
Clean up error message
1 parent 666655f commit 7713a20

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ function pickEnv(config, opts) {
8585
if (opts.throwOnMissing) {
8686
if (name && name !== 'defaults' && !config[name]) {
8787
throw new BrowserslistError(
88-
'Missing config for Browserslist environment `' + name + '`.'
88+
'Missing config for Browserslist environment `' + name + '`'
8989
)
9090
}
9191
}
92-
92+
9393
return config[name] || config.defaults
9494
}
9595

test/main.test.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,20 +262,27 @@ test('correctly works with not and one-version browsers', () => {
262262

263263
test('throws error on missing env', () => {
264264
throws(
265-
() => browserslist(null, { path: PACKAGE, throwOnMissing: true, env: 'test' }),
266-
"Missing config for Browserslist environment 'test'."
265+
() =>
266+
browserslist(null, { path: PACKAGE, throwOnMissing: true, env: 'test' }),
267+
"Missing config for Browserslist environment 'test'"
267268
)
268269
})
269270

270271
test('does not throw error on missing defaults env', () => {
271272
equal(
272-
browserslist(null, { path: PACKAGE, throwOnMissing: true, env: 'defaults' }), DEFAULTS
273+
browserslist(null, {
274+
path: PACKAGE,
275+
throwOnMissing: true,
276+
env: 'defaults'
277+
}),
278+
DEFAULTS
273279
)
274280
})
275281

276282
test('does not throw error on missing env', () => {
277283
equal(
278-
browserslist(null, { path: PACKAGE, throwOnMissing: false, env: 'test' }), DEFAULTS
284+
browserslist(null, { path: PACKAGE, throwOnMissing: false, env: 'test' }),
285+
DEFAULTS
279286
)
280287
})
281288

0 commit comments

Comments
 (0)