diff --git a/packages/replay/src/bin.ts b/packages/replay/src/bin.ts index d7141daa..9d0f744e 100644 --- a/packages/replay/src/bin.ts +++ b/packages/replay/src/bin.ts @@ -108,7 +108,9 @@ commandWithGlobalOptions("rm-all") .action(commandRemoveAllRecordings); commandWithGlobalOptions("update-browsers") - .description("Update your installed Replay runtimes. Optional argument: Comma-separated list of replay runtimes. Possible values: chromium,firefox.\n Node not yet supported.") + .description( + "Update your installed Replay runtimes. Optional argument: Comma-separated list of replay runtimes. Possible values: chromium,firefox.\n Node not yet supported." + ) .arguments("[]") .action(commandUpdateBrowsers); @@ -309,7 +311,11 @@ async function commandUpdateBrowsers( try { debug("Options", opts); - await updateBrowsers({ ...opts, browsers: browsers?.split(",").map(fuzzyBrowserName), verbose: true }); + await updateBrowsers({ + ...opts, + browsers: browsers?.split(",").map(fuzzyBrowserName), + verbose: true, + }); process.exit(0); } catch (e) { console.error("Failed to updated browsers"); diff --git a/packages/replay/src/cli/__snapshots__/formatRecordings.test.ts.snap b/packages/replay/src/cli/__snapshots__/formatRecordings.test.ts.snap index 7e8aa445..97d6765d 100644 --- a/packages/replay/src/cli/__snapshots__/formatRecordings.test.ts.snap +++ b/packages/replay/src/cli/__snapshots__/formatRecordings.test.ts.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`formatAllRecordingsHumanReadable formats one basic recording 1`] = ` -"ID Status Title Created At -1 onDisk 2020-01-01T00:00:00.000Z" +"ID Status Title Created +1 onDisk 2 days ago" `; exports[`formatAllRecordingsHumanReadable sorts recording by createTime, most recent recording first 1`] = ` -"ID Status Title Created At -2 onDisk Replay of test 2020-01-02T00:00:00.000Z -1 onDisk Replay of test 2020-01-01T00:00:00.000Z" +"ID Status Title Created +2 onDisk Replay of test 1 day ago +1 onDisk Replay of test 2 days ago" `; exports[`formatAllRecordingsHumanReadable uses the metadata title when it exists 1`] = ` -"ID Status Title Created At -1 onDisk A Node Recording 2020-01-01T00:00:00.000Z" +"ID Status Title Created +1 onDisk A Node Recording 2 days ago" `; exports[`formatAllReordingsJson matches snapshot 1`] = ` diff --git a/packages/replay/src/cli/formatRecordings.test.ts b/packages/replay/src/cli/formatRecordings.test.ts index c5fcce16..76bb8200 100644 --- a/packages/replay/src/cli/formatRecordings.test.ts +++ b/packages/replay/src/cli/formatRecordings.test.ts @@ -2,6 +2,15 @@ import { ExternalRecordingEntry } from "../types"; import { formatAllRecordingsHumanReadable, formatAllRecordingsJson } from "./formatRecordings"; describe("formatAllRecordingsHumanReadable", () => { + let now = Date.now; + beforeEach(() => { + Date.now = jest.fn(() => new Date("2020-01-03").getTime()); + }); + + afterEach(() => { + Date.now = now; + }); + it("formats one basic recording", () => { const recordings: ExternalRecordingEntry[] = [ {