Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into ryan/scs-1583-errors-…
Browse files Browse the repository at this point in the history
…not-returned-by-backend
  • Loading branch information
ryanjduffy committed Nov 20, 2023
2 parents ec9a563 + 04d357b commit deaeee9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
10 changes: 8 additions & 2 deletions packages/replay/src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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("[<browsers...>]")
.action(commandUpdateBrowsers);

Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
@@ -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`] = `
Expand Down
9 changes: 9 additions & 0 deletions packages/replay/src/cli/formatRecordings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
{
Expand Down

0 comments on commit deaeee9

Please sign in to comment.