2022-12-04 23:40:07 -05:00
|
|
|
import assert from 'node:assert/strict'
|
|
|
|
import { metaltest, consolereporter } from './index.js'
|
2022-12-05 16:50:01 -05:00
|
|
|
import { stackParser } from './stackparser.js'
|
2022-12-04 23:40:07 -05:00
|
|
|
|
|
|
|
const test = metaltest('Stack parser')
|
|
|
|
|
|
|
|
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'))
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
await test.run(consolereporter())
|