From 5f8ccccef9fc19229320df8cbcae9fcea8d31388 Mon Sep 17 00:00:00 2001 From: Gar Date: Wed, 30 Jun 2021 08:40:58 -0700 Subject: [PATCH] chore(tests): clean snapshot for lib/view.js tests Closes https://github.com/npm/cli/issues/1623 PR-URL: https://github.com/npm/cli/pull/3483 Credit: @wraithgar Close: #3483 Reviewed-by: @isaacs --- tap-snapshots/test/lib/view.js.test.cjs | 6 +++--- test/lib/view.js | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tap-snapshots/test/lib/view.js.test.cjs b/tap-snapshots/test/lib/view.js.test.cjs index 9aafe50e41896..41d7a80fe3b16 100644 --- a/tap-snapshots/test/lib/view.js.test.cjs +++ b/tap-snapshots/test/lib/view.js.test.cjs @@ -82,7 +82,7 @@ dist dist-tags: latest: 1.0.0 -published a year ago +published {TIME} ago ` exports[`test/lib/view.js TAP should log info of package in current working dir specific version > must match snapshot 1`] = ` @@ -99,7 +99,7 @@ dist dist-tags: latest: 1.0.0 -published a year ago +published {TIME} ago ` exports[`test/lib/view.js TAP should log package info package from git > must match snapshot 1`] = ` @@ -302,7 +302,7 @@ dist dist-tags: latest: 1.0.0 -published a year ago +published {TIME} ago ` exports[`test/lib/view.js TAP workspaces all workspaces --json > must match snapshot 1`] = ` diff --git a/test/lib/view.js b/test/lib/view.js index 5f2e5a8add5e9..793917adc6476 100644 --- a/test/lib/view.js +++ b/test/lib/view.js @@ -1,5 +1,7 @@ const t = require('tap') +t.cleanSnapshot = str => str.replace(/published .*? ago/g, 'published {TIME} ago') + // run the same as tap does when running directly with node process.stdout.columns = undefined