Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ehmicky/log-process-errors
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 10.1.0
Choose a base ref
...
head repository: ehmicky/log-process-errors
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 10.1.1
Choose a head ref
  • 5 commits
  • 6 files changed
  • 1 contributor

Commits on Oct 9, 2022

  1. Copy the full SHA
    8dda9f5 View commit details
  2. Copy the full SHA
    84fc8be View commit details
  3. Copy the full SHA
    b8aaddb View commit details
  4. Add more tests

    ehmicky committed Oct 9, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    yyx990803 Evan You
    Copy the full SHA
    8a60ef2 View commit details
  5. Release 10.1.1

    ehmicky committed Oct 9, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    734f733 View commit details
Showing with 40 additions and 24 deletions.
  1. +6 −0 CHANGELOG.md
  2. +18 −18 package-lock.json
  3. +3 −3 package.json
  4. +3 −0 src/main.js
  5. +5 −0 src/options.js
  6. +5 −3 test/options.js
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 10.1.1

## Internal

- Add more tests

# 10.1.0

## Features
36 changes: 18 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "log-process-errors",
"version": "10.1.0",
"version": "10.1.1",
"type": "module",
"exports": "./build/src/main.js",
"main": "./build/src/main.js",
@@ -48,8 +48,8 @@
"dependencies": {
"is-error-instance": "^1.1.0",
"is-plain-obj": "^4.1.0",
"normalize-exception": "^2.7.0",
"set-error-message": "^1.2.0"
"normalize-exception": "^2.8.1",
"set-error-message": "^1.3.1"
},
"devDependencies": {
"@ehmicky/dev-tasks": "^1.0.94",
3 changes: 3 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,9 @@ import { EVENTS, handleEvent } from './events.js'
import { getOptions } from './options.js'
import { removeWarningListener, restoreWarningListener } from './warnings.js'

// eslint-disable-next-line no-duplicate-imports
export { validateOptions } from './options.js'

// Add event handling for all process-related errors
export default function logProcessErrors(opts) {
const optsA = getOptions(opts)
5 changes: 5 additions & 0 deletions src/options.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import isPlainObj from 'is-plain-obj'

// Undocumented named export to validate options
export const validateOptions = function (opts) {
getOptions(opts)
}

// Validate options and assign default options
export const getOptions = function (opts = {}) {
if (!isPlainObj(opts)) {
8 changes: 5 additions & 3 deletions test/options.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import test from 'ava'
import logProcessErrors from 'log-process-errors'
// eslint-disable-next-line import/named
import logProcessErrors, { validateOptions } from 'log-process-errors'
import { each } from 'test-each'

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

each(
[logProcessErrors, validateOptions],
[true, { exit: 'true' }, { onError: true }, { unknown: true }],
({ title }, options) => {
({ title }, validate, options) => {
test.serial(`should validate options | ${title}`, (t) => {
t.throws(logProcessErrors.bind(undefined, options))
t.throws(validate.bind(undefined, options))
})
},
)