Skip to content

Commit

Permalink
fix: remove user paths
Browse files Browse the repository at this point in the history
  • Loading branch information
barelyhuman committed Aug 19, 2024
1 parent 018aa99 commit 96b26a2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const header = (test, duration, passed) =>
dim(` [${duration}ms]`) +
'\n'

const cleanTermLink = link => link.replace(process.cwd(), '').replace(/^\//, '')

const printEvents = (baseTestEvent, depth = baseTestEvent.depth || 0) => {
const children = baseTestEvent.children || []
const hasErrors = children.find(d => d.hasError)
Expand All @@ -41,7 +43,7 @@ const printEvents = (baseTestEvent, depth = baseTestEvent.depth || 0) => {
childTestEvents.name +
'\n' +
pad(depth + childTestEvents.depth + 1) +
dim(childTestEvents.termLink) +
dim(cleanTermLink(childTestEvents.termLink)) +
'\n' +
red(
pad(depth + childTestEvents.depth + 1) +
Expand Down
6 changes: 3 additions & 3 deletions snapshots/tests/index.test.snap.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ exports[`spawn with reporter 1`] = `"
√ all passing 
x level 1 fails 
x fail 1
[2m/home/reaper/code/node-reporter-minimal/tests/__spec__/basic.test.js:17:3[22m
[2mtests/__spec__/basic.test.js:17:3[22m
 Error [ERR_TEST_FAILURE]: The expression evaluated to a falsy value:
assert.ok(!1)
x level 1 multi assertion, single failure 
x fail 1
[2m/home/reaper/code/node-reporter-minimal/tests/__spec__/basic.test.js:27:3[22m
[2mtests/__spec__/basic.test.js:27:3[22m
 Error [ERR_TEST_FAILURE]: The expression evaluated to a falsy value:
assert.ok(!1)
x level 2 fails 
x nested level 
x failed level 1
[2m/home/reaper/code/node-reporter-minimal/tests/__spec__/basic.test.js:43:5[22m
[2mtests/__spec__/basic.test.js:43:5[22m
 Error [ERR_TEST_FAILURE]: The expression evaluated to a falsy value:
assert.ok(!1)
Expand Down
2 changes: 1 addition & 1 deletion tests/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { test, before } = require('node:test')
const { test } = require('node:test')
const { spawnSync } = require('child_process')
const snapshot = require('@barelyhuman/node-snapshot').snapshot

Expand Down

0 comments on commit 96b26a2

Please sign in to comment.