Skip to content

Commit

Permalink
fix: removing path from dispaying on unit tests
Browse files Browse the repository at this point in the history
fix: small issue with standard
fix: added a describe block to the error handling tests
  • Loading branch information
mcknasty committed Feb 3, 2024
1 parent abe1d6f commit e05ebf6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
11 changes: 4 additions & 7 deletions lib/load-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,12 @@ function loadConfigFile (path, _di) {
if (error instanceof SyntaxError) {
throw new ConfigParsingError(
path,
'does not export a c8 configuration object.'
)
} else {
// If the user supplied a bad configuration file that we can't figure out how to read, then it's on them to solve it.
// Attempting to use some other config, even a default one, will result in unexpected behavior: aka ignoring the config that was explicitly specified is not intuitive.
throw new UnsupportedFileTypeError(
`Unsupported file type ${ext} while reading file ${path}`
'must contain a valid c8 configuration object.',
error
)
}

throw error
}
} else {
// If the user supplied a bad configuration file that we can't figure out how to read, then it's on them to solve it.
Expand Down
2 changes: 1 addition & 1 deletion test/error-reporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const {
ConfigParsingError
} = require('../lib/error-reporting')

describe(__filename, () => {
describe('c8 error handling', () => {
describe(ConfigParsingError.name, () => {
it('is an Error subclass', () => {
expect(new ConfigParsingError('', '')).to.be.instanceof(Error)
Expand Down
4 changes: 2 additions & 2 deletions test/integration.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ All files | 3.02 | 10.71 | 5.55 | 3.02
sorter.js | 0 | 0 | 0 | 0 | 1-196
c8/lib | 0 | 0 | 0 | 0 |
error-reporting.js | 0 | 0 | 0 | 0 | 1-69
load-config.js | 0 | 0 | 0 | 0 | 1-141
load-config.js | 0 | 0 | 0 | 0 | 1-138
parse-args.js | 0 | 0 | 0 | 0 | 1-225
report.js | 0 | 0 | 0 | 0 | 1-402
source-map-from-file.js | 0 | 0 | 0 | 0 | 1-100
Expand Down Expand Up @@ -541,7 +541,7 @@ All files | 3.02 | 10.71 | 5.55 | 3.02
sorter.js | 0 | 0 | 0 | 0 | 1-196
c8/lib | 0 | 0 | 0 | 0 |
error-reporting.js | 0 | 0 | 0 | 0 | 1-69
load-config.js | 0 | 0 | 0 | 0 | 1-141
load-config.js | 0 | 0 | 0 | 0 | 1-138
parse-args.js | 0 | 0 | 0 | 0 | 1-225
report.js | 0 | 0 | 0 | 0 | 1-402
source-map-from-file.js | 0 | 0 | 0 | 0 | 1-100
Expand Down

0 comments on commit e05ebf6

Please sign in to comment.