Skip to content

Commit 8a60ef2

Browse files
committed
Add more tests
1 parent b8aaddb commit 8a60ef2

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 10.1.1
2+
3+
## Internal
4+
5+
- Add more tests
6+
17
# 10.1.0
28

39
## Features

src/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { EVENTS, handleEvent } from './events.js'
44
import { getOptions } from './options.js'
55
import { removeWarningListener, restoreWarningListener } from './warnings.js'
66

7+
// eslint-disable-next-line no-duplicate-imports
8+
export { validateOptions } from './options.js'
9+
710
// Add event handling for all process-related errors
811
export default function logProcessErrors(opts) {
912
const optsA = getOptions(opts)

src/options.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import isPlainObj from 'is-plain-obj'
22

3+
// Undocumented named export to validate options
4+
export const validateOptions = function (opts) {
5+
getOptions(opts)
6+
}
7+
38
// Validate options and assign default options
49
export const getOptions = function (opts = {}) {
510
if (!isPlainObj(opts)) {

test/options.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import test from 'ava'
2-
import logProcessErrors from 'log-process-errors'
2+
// eslint-disable-next-line import/named
3+
import logProcessErrors, { validateOptions } from 'log-process-errors'
34
import { each } from 'test-each'
45

56
import { removeProcessListeners } from './helpers/remove.js'
67

78
each(
9+
[logProcessErrors, validateOptions],
810
[true, { exit: 'true' }, { onError: true }, { unknown: true }],
9-
({ title }, options) => {
11+
({ title }, validate, options) => {
1012
test.serial(`should validate options | ${title}`, (t) => {
11-
t.throws(logProcessErrors.bind(undefined, options))
13+
t.throws(validate.bind(undefined, options))
1214
})
1315
},
1416
)

0 commit comments

Comments
 (0)