metaltest/lib/stackparser.test.js

22 lines
619 B
JavaScript

import assert from 'node:assert/strict'
import { metaltest } from '../index.js'
import { stackParser } from './stackparser.js'
const test = metaltest('Stack parser')
export { test }
test('Diff', () => {
try {
assert.deepEqual({ name: 'Name' }, { name: 'Name2' })
}
catch (e) {
const stack = stackParser(e.stack)
assert.ok(stack.diff.includes("name: 'Name'"))
assert.ok(stack.diff.includes("name: 'Name2'"))
assert.ok(stack.where.includes('stackparser.test.js'))
}
})
import { runifmain, consolereporter } from '../index.js'
await runifmain(import.meta, () => test.run(consolereporter()))