Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
14 lines
488 B
Plaintext
14 lines
488 B
Plaintext
'use strict'
|
|
|
|
const { test } = require('node:test')
|
|
const stringifySafe = require('fast-safe-stringify')
|
|
const prettifyError = require('./prettify-error')
|
|
|
|
test('prettifies error', t => {
|
|
const error = Error('Bad error!')
|
|
const lines = stringifySafe(error, Object.getOwnPropertyNames(error), 2)
|
|
|
|
const prettyError = prettifyError({ keyName: 'errorKey', lines, ident: ' ', eol: '\n' })
|
|
t.assert.match(prettyError, /\s*errorKey: {\n\s*"stack":[\s\S]*"message": "Bad error!"/)
|
|
})
|