MCPcopy Index your code
hub / github.com/BuilderIO/SSDiff / constructor

Method constructor

packages/ssdiff/src/index.ts:62–94  ·  view source on GitHub ↗
(config: SSDiffConfig)

Source from the content-addressed store, hash-verified

60 fileNameDifferenceMap: Map<string, number> = new Map(); // result of the comparison
61
62 constructor(config: SSDiffConfig) {
63 const defaultScreenshotConfig: ScreenshotConfig = {
64 type: "png",
65 };
66 const defaultBrowserConfig: BrowserConfig = {
67 defaultViewport: {
68 width: 1294,
69 height: 1280,
70 },
71 };
72 const defaultPageConfig: PageConfig = {
73 waitUntil: "networkidle0",
74 timeout: 0,
75 };
76 this.url1 = config.url1;
77 this.url2 = config.url2;
78 this.pathnames = config.pathnames;
79 this.failInCaseOfDifferentSize = config.failInCaseOfDifferentSize ?? false;
80 this.debug = config.debug ?? false;
81 this.outputFile = config.outputFile ?? false;
82 this.browserConfig = config.browserConfig ?? defaultBrowserConfig;
83 this.screenshotConfig = config.screenshotConfig ?? defaultScreenshotConfig;
84 this.pageConfig = config.pageConfig ?? defaultPageConfig;
85 this.browser = null;
86 this.screenshotsFolder = process.cwd() + "/screenshots";
87 const todaysDate = new Date().toISOString().split("T")[0];
88 this.todaysScreenshotFolder = this.screenshotsFolder + "/" + todaysDate;
89 this.diffScreenshots = this.todaysScreenshotFolder + "/diff";
90 if (!fs.existsSync(this.diffScreenshots)) {
91 fs.mkdirSync(this.diffScreenshots, { recursive: true });
92 this.log("Created diff folder for todays ss");
93 }
94 }
95 log(text: string) {
96 if (this.debug) {
97 debugLogger.debug(text);

Callers

nothing calls this directly

Calls 1

logMethod · 0.95

Tested by

no test coverage detected