From 96b26a27e5714b2e4f699853910f3d11c5e4aab3 Mon Sep 17 00:00:00 2001 From: reaper Date: Mon, 19 Aug 2024 20:08:44 +0530 Subject: [PATCH] fix: remove user paths --- index.js | 4 +++- snapshots/tests/index.test.snap.cjs | 6 +++--- tests/index.test.js | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 1f9770c..c54989a 100644 --- a/index.js +++ b/index.js @@ -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) @@ -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) + diff --git a/snapshots/tests/index.test.snap.cjs b/snapshots/tests/index.test.snap.cjs index 0151478..911a454 100644 --- a/snapshots/tests/index.test.snap.cjs +++ b/snapshots/tests/index.test.snap.cjs @@ -3,14 +3,14 @@ exports[`spawn with reporter 1`] = `" √ all passing  x level 1 fails  x fail 1 - /home/reaper/code/node-reporter-minimal/tests/__spec__/basic.test.js:17:3 + tests/__spec__/basic.test.js:17:3  Error [ERR_TEST_FAILURE]: The expression evaluated to a falsy value: assert.ok(!1) x level 1 multi assertion, single failure  x fail 1 - /home/reaper/code/node-reporter-minimal/tests/__spec__/basic.test.js:27:3 + tests/__spec__/basic.test.js:27:3  Error [ERR_TEST_FAILURE]: The expression evaluated to a falsy value: assert.ok(!1) @@ -18,7 +18,7 @@ exports[`spawn with reporter 1`] = `" x level 2 fails  x nested level  x failed level 1 - /home/reaper/code/node-reporter-minimal/tests/__spec__/basic.test.js:43:5 + tests/__spec__/basic.test.js:43:5  Error [ERR_TEST_FAILURE]: The expression evaluated to a falsy value: assert.ok(!1) diff --git a/tests/index.test.js b/tests/index.test.js index 871c355..c1a6d61 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -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