MCPcopy Create free account
hub / github.com/npm/cli / err

Function err

test/lib/cli/exit-handler.js:144–154  ·  view source on GitHub ↗
(message = '', options = {}, noStack = false)

Source from the content-addressed store, hash-verified

142
143// Create errors with properties to be used in tests
144const err = (message = '', options = {}, noStack = false) => {
145 const e = Object.assign(
146 new Error(message),
147 typeof options !== 'object' ? { code: options } : options
148 )
149 e.stack = options.stack || `Error: ${message}`
150 if (noStack) {
151 delete e.stack
152 }
153 return e
154}
155
156t.test('handles unknown error with logs and debug file', async (t) => {
157 const { exitHandler, debugFile, logs } = await mockExitHandler(t, {

Callers 1

exit-handler.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected