doc-detective 4.6.1 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +57 -6
- package/dist/cli.js.map +1 -1
- package/dist/common/src/schemas/schemas.json +6 -18
- package/dist/common/src/types/generated/config_v3.d.ts +2 -1
- package/dist/common/src/types/generated/config_v3.d.ts.map +1 -1
- package/dist/common/src/types/generated/resolvedTests_v3.d.ts +2 -1
- package/dist/common/src/types/generated/resolvedTests_v3.d.ts.map +1 -1
- package/dist/core/config.d.ts +17 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +218 -63
- package/dist/core/config.js.map +1 -1
- package/dist/debug/command.d.ts +10 -0
- package/dist/debug/command.d.ts.map +1 -0
- package/dist/debug/command.js +72 -0
- package/dist/debug/command.js.map +1 -0
- package/dist/debug/envvars.d.ts +9 -0
- package/dist/debug/envvars.d.ts.map +1 -0
- package/dist/debug/envvars.js +231 -0
- package/dist/debug/envvars.js.map +1 -0
- package/dist/debug/index.d.ts +85 -0
- package/dist/debug/index.d.ts.map +1 -0
- package/dist/debug/index.js +465 -0
- package/dist/debug/index.js.map +1 -0
- package/dist/debug/redact.d.ts +7 -0
- package/dist/debug/redact.d.ts.map +1 -0
- package/dist/debug/redact.js +190 -0
- package/dist/debug/redact.js.map +1 -0
- package/dist/debug/render.d.ts +8 -0
- package/dist/debug/render.d.ts.map +1 -0
- package/dist/debug/render.js +42 -0
- package/dist/debug/render.js.map +1 -0
- package/dist/debug/system.d.ts +24 -0
- package/dist/debug/system.d.ts.map +1 -0
- package/dist/debug/system.js +59 -0
- package/dist/debug/system.js.map +1 -0
- package/dist/debug/tools.d.ts +11 -0
- package/dist/debug/tools.d.ts.map +1 -0
- package/dist/debug/tools.js +170 -0
- package/dist/debug/tools.js.map +1 -0
- package/dist/hints/hints.d.ts.map +1 -1
- package/dist/hints/hints.js +17 -0
- package/dist/hints/hints.js.map +1 -1
- package/dist/index.cjs +264 -130
- package/dist/runtime/installer.d.ts.map +1 -1
- package/dist/runtime/installer.js +44 -9
- package/dist/runtime/installer.js.map +1 -1
- package/dist/runtime/loader.d.ts +20 -0
- package/dist/runtime/loader.d.ts.map +1 -1
- package/dist/runtime/loader.js +50 -0
- package/dist/runtime/loader.js.map +1 -1
- package/dist/utils.d.ts +2 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +38 -11
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9923,7 +9923,8 @@ var init_schemas = __esm({
|
|
|
9923
9923
|
title: "Environment details"
|
|
9924
9924
|
},
|
|
9925
9925
|
debug: {
|
|
9926
|
-
description: "
|
|
9926
|
+
description: "Deprecated and ignored. Previously reserved for an interactive step-through debugger that was never implemented. Retained so existing configs continue to validate. For diagnostics, run `doc-detective debug` or set the `DOC_DETECTIVE_DEBUG` environment variable.",
|
|
9927
|
+
deprecated: true,
|
|
9927
9928
|
anyOf: [
|
|
9928
9929
|
{
|
|
9929
9930
|
type: "boolean"
|
|
@@ -9934,8 +9935,7 @@ var init_schemas = __esm({
|
|
|
9934
9935
|
"stepThrough"
|
|
9935
9936
|
]
|
|
9936
9937
|
}
|
|
9937
|
-
]
|
|
9938
|
-
default: false
|
|
9938
|
+
]
|
|
9939
9939
|
},
|
|
9940
9940
|
dryRun: {
|
|
9941
9941
|
description: "If `true`, fully resolve tests (file/env config merge, schema validation, file detection, inline-test extraction) and emit the resolved test plan as JSON, but do not execute any steps. Equivalent to `--dry-run` on the CLI.",
|
|
@@ -18245,12 +18245,6 @@ var init_schemas = __esm({
|
|
|
18245
18245
|
{
|
|
18246
18246
|
debug: false
|
|
18247
18247
|
},
|
|
18248
|
-
{
|
|
18249
|
-
debug: true
|
|
18250
|
-
},
|
|
18251
|
-
{
|
|
18252
|
-
debug: "stepThrough"
|
|
18253
|
-
},
|
|
18254
18248
|
{
|
|
18255
18249
|
integrations: {
|
|
18256
18250
|
docDetectiveApi: {
|
|
@@ -31882,7 +31876,8 @@ var init_schemas = __esm({
|
|
|
31882
31876
|
title: "Environment details"
|
|
31883
31877
|
},
|
|
31884
31878
|
debug: {
|
|
31885
|
-
description: "
|
|
31879
|
+
description: "Deprecated and ignored. Previously reserved for an interactive step-through debugger that was never implemented. Retained so existing configs continue to validate. For diagnostics, run `doc-detective debug` or set the `DOC_DETECTIVE_DEBUG` environment variable.",
|
|
31880
|
+
deprecated: true,
|
|
31886
31881
|
anyOf: [
|
|
31887
31882
|
{
|
|
31888
31883
|
type: "boolean"
|
|
@@ -31893,8 +31888,7 @@ var init_schemas = __esm({
|
|
|
31893
31888
|
"stepThrough"
|
|
31894
31889
|
]
|
|
31895
31890
|
}
|
|
31896
|
-
]
|
|
31897
|
-
default: false
|
|
31891
|
+
]
|
|
31898
31892
|
},
|
|
31899
31893
|
dryRun: {
|
|
31900
31894
|
description: "If `true`, fully resolve tests (file/env config merge, schema validation, file detection, inline-test extraction) and emit the resolved test plan as JSON, but do not execute any steps. Equivalent to `--dry-run` on the CLI.",
|
|
@@ -40204,12 +40198,6 @@ var init_schemas = __esm({
|
|
|
40204
40198
|
{
|
|
40205
40199
|
debug: false
|
|
40206
40200
|
},
|
|
40207
|
-
{
|
|
40208
|
-
debug: true
|
|
40209
|
-
},
|
|
40210
|
-
{
|
|
40211
|
-
debug: "stepThrough"
|
|
40212
|
-
},
|
|
40213
40201
|
{
|
|
40214
40202
|
integrations: {
|
|
40215
40203
|
docDetectiveApi: {
|
|
@@ -130740,7 +130728,9 @@ var loader_exports = {};
|
|
|
130740
130728
|
__export(loader_exports, {
|
|
130741
130729
|
ensureRuntimeInstalled: () => ensureRuntimeInstalled,
|
|
130742
130730
|
loadHeavyDep: () => loadHeavyDep,
|
|
130743
|
-
resolveHeavyDepPath: () => resolveHeavyDepPath
|
|
130731
|
+
resolveHeavyDepPath: () => resolveHeavyDepPath,
|
|
130732
|
+
resolveHeavyDepSource: () => resolveHeavyDepSource,
|
|
130733
|
+
resolveHeavyDepVersion: () => resolveHeavyDepVersion
|
|
130744
130734
|
});
|
|
130745
130735
|
function tryResolveFromShim(name) {
|
|
130746
130736
|
try {
|
|
@@ -130764,6 +130754,36 @@ function tryResolveFromCache(name, ctx = {}) {
|
|
|
130764
130754
|
function resolveHeavyDepPath(name, ctx = {}) {
|
|
130765
130755
|
return tryResolveFromShim(name) ?? tryResolveFromCache(name, ctx);
|
|
130766
130756
|
}
|
|
130757
|
+
function resolveHeavyDepSource(name, ctx = {}) {
|
|
130758
|
+
if (tryResolveFromShim(name))
|
|
130759
|
+
return "shim";
|
|
130760
|
+
if (tryResolveFromCache(name, ctx))
|
|
130761
|
+
return "cache";
|
|
130762
|
+
return null;
|
|
130763
|
+
}
|
|
130764
|
+
function resolveHeavyDepVersion(name, ctx = {}) {
|
|
130765
|
+
const entry = resolveHeavyDepPath(name, ctx);
|
|
130766
|
+
if (!entry)
|
|
130767
|
+
return null;
|
|
130768
|
+
let dir = import_node_path4.default.dirname(entry);
|
|
130769
|
+
for (let i = 0; i < 12; i++) {
|
|
130770
|
+
const pkgJsonPath = import_node_path4.default.join(dir, "package.json");
|
|
130771
|
+
try {
|
|
130772
|
+
if (import_node_fs4.default.existsSync(pkgJsonPath)) {
|
|
130773
|
+
const parsed = JSON.parse(import_node_fs4.default.readFileSync(pkgJsonPath, "utf8"));
|
|
130774
|
+
if (parsed?.name === name && typeof parsed.version === "string") {
|
|
130775
|
+
return parsed.version;
|
|
130776
|
+
}
|
|
130777
|
+
}
|
|
130778
|
+
} catch {
|
|
130779
|
+
}
|
|
130780
|
+
const parent = import_node_path4.default.dirname(dir);
|
|
130781
|
+
if (parent === dir)
|
|
130782
|
+
break;
|
|
130783
|
+
dir = parent;
|
|
130784
|
+
}
|
|
130785
|
+
return null;
|
|
130786
|
+
}
|
|
130767
130787
|
async function loadHeavyDep(name, options = {}) {
|
|
130768
130788
|
const { autoInstall = true, ctx = {}, deps = {} } = options;
|
|
130769
130789
|
let resolved = tryResolveFromShim(name);
|
|
@@ -131426,6 +131446,7 @@ var config_exports = {};
|
|
|
131426
131446
|
__export(config_exports, {
|
|
131427
131447
|
clearAppCache: () => clearAppCache,
|
|
131428
131448
|
getAvailableApps: () => getAvailableApps,
|
|
131449
|
+
getBrowserDiagnostics: () => getBrowserDiagnostics,
|
|
131429
131450
|
getEnvironment: () => getEnvironment,
|
|
131430
131451
|
resolveConcurrentRunners: () => resolveConcurrentRunners,
|
|
131431
131452
|
setConfig: () => setConfig
|
|
@@ -131619,19 +131640,14 @@ function clearAppCache(config) {
|
|
|
131619
131640
|
}
|
|
131620
131641
|
cachedAppsByDir.delete(cacheKeyFor(config));
|
|
131621
131642
|
}
|
|
131622
|
-
async function
|
|
131623
|
-
const browsersDir = getBrowsersDir({ cacheDir: config?.cacheDir });
|
|
131624
|
-
const key = browsersDir;
|
|
131625
|
-
const hit = cachedAppsByDir.get(key);
|
|
131626
|
-
if (hit)
|
|
131627
|
-
return hit;
|
|
131643
|
+
async function probeBrowserEnvironment({ config, browsersDir }) {
|
|
131628
131644
|
setAppiumHome({ cacheDir: config?.cacheDir });
|
|
131629
131645
|
const cwd = process.cwd();
|
|
131630
131646
|
process.chdir(import_node_path7.default.join(__dirname4, "../.."));
|
|
131631
|
-
|
|
131647
|
+
let installedBrowsers = [];
|
|
131632
131648
|
let browserDetectionFailed = false;
|
|
131649
|
+
let appiumDriverOutput = "";
|
|
131633
131650
|
try {
|
|
131634
|
-
let installedBrowsers = [];
|
|
131635
131651
|
const browsersInstalled = resolveHeavyDepPath("@puppeteer/browsers", {
|
|
131636
131652
|
cacheDir: config?.cacheDir
|
|
131637
131653
|
});
|
|
@@ -131686,47 +131702,165 @@ async function getAvailableApps({ config }) {
|
|
|
131686
131702
|
});
|
|
131687
131703
|
});
|
|
131688
131704
|
});
|
|
131689
|
-
|
|
131690
|
-
const chrome = installedBrowsers.find((browser) => browser.browser === "chrome");
|
|
131691
|
-
const chromeVersion = chrome?.buildId;
|
|
131692
|
-
const chromedriver = installedBrowsers.find((browser) => browser.browser === "chromedriver");
|
|
131693
|
-
const appiumChromium = appiumDriverOutput.match(/\n.*chromium.*installed \(npm\).*\n/);
|
|
131694
|
-
if (chrome && chromedriver && appiumChromium) {
|
|
131695
|
-
apps.push({
|
|
131696
|
-
name: "chrome",
|
|
131697
|
-
version: chromeVersion,
|
|
131698
|
-
path: chrome.executablePath,
|
|
131699
|
-
driver: chromedriver.executablePath
|
|
131700
|
-
});
|
|
131701
|
-
}
|
|
131702
|
-
const firefox = installedBrowsers.find((browser) => browser.browser === "firefox");
|
|
131703
|
-
const appiumFirefox = appiumDriverOutput.match(/\n.*gecko.*installed \(npm\).*\n/);
|
|
131704
|
-
if (firefox && appiumFirefox) {
|
|
131705
|
-
apps.push({
|
|
131706
|
-
name: "firefox",
|
|
131707
|
-
version: firefox.buildId,
|
|
131708
|
-
path: firefox.executablePath
|
|
131709
|
-
});
|
|
131710
|
-
}
|
|
131711
|
-
if (config.environment.platform === "mac") {
|
|
131712
|
-
const safariVersion = await spawnCommand("defaults read /Applications/Safari.app/Contents/Info.plist CFBundleShortVersionString");
|
|
131713
|
-
const appiumSafari = appiumDriverOutput.match(/\n.*safari.*installed \(npm\).*\n/);
|
|
131714
|
-
if (safariVersion.exitCode === 0 && appiumSafari) {
|
|
131715
|
-
apps.push({ name: "safari", version: safariVersion.stdout.trim(), path: "" });
|
|
131716
|
-
}
|
|
131717
|
-
}
|
|
131705
|
+
appiumDriverOutput = installedAppiumDrivers.stdout + "\n" + installedAppiumDrivers.stderr;
|
|
131718
131706
|
} finally {
|
|
131719
131707
|
process.chdir(cwd);
|
|
131720
131708
|
}
|
|
131709
|
+
return { installedBrowsers, appiumDriverOutput, browserDetectionFailed };
|
|
131710
|
+
}
|
|
131711
|
+
async function getAvailableApps({ config }) {
|
|
131712
|
+
const browsersDir = getBrowsersDir({ cacheDir: config?.cacheDir });
|
|
131713
|
+
const key = browsersDir;
|
|
131714
|
+
const hit = cachedAppsByDir.get(key);
|
|
131715
|
+
if (hit)
|
|
131716
|
+
return hit;
|
|
131717
|
+
const { installedBrowsers, appiumDriverOutput, browserDetectionFailed } = await probeBrowserEnvironment({ config, browsersDir });
|
|
131718
|
+
const apps = [];
|
|
131719
|
+
const chrome = installedBrowsers.find((browser) => browser.browser === "chrome");
|
|
131720
|
+
const chromeVersion = chrome?.buildId;
|
|
131721
|
+
const chromedriver = installedBrowsers.find((browser) => browser.browser === "chromedriver");
|
|
131722
|
+
const appiumChromium = appiumDriverOutput.match(/\n.*chromium.*installed \(npm\).*\n/);
|
|
131723
|
+
if (chrome && chromedriver && appiumChromium) {
|
|
131724
|
+
apps.push({
|
|
131725
|
+
name: "chrome",
|
|
131726
|
+
version: chromeVersion,
|
|
131727
|
+
path: chrome.executablePath,
|
|
131728
|
+
driver: chromedriver.executablePath
|
|
131729
|
+
});
|
|
131730
|
+
}
|
|
131731
|
+
const firefox = installedBrowsers.find((browser) => browser.browser === "firefox");
|
|
131732
|
+
const appiumFirefox = appiumDriverOutput.match(/\n.*gecko.*installed \(npm\).*\n/);
|
|
131733
|
+
if (firefox && appiumFirefox) {
|
|
131734
|
+
apps.push({
|
|
131735
|
+
name: "firefox",
|
|
131736
|
+
version: firefox.buildId,
|
|
131737
|
+
path: firefox.executablePath
|
|
131738
|
+
});
|
|
131739
|
+
}
|
|
131740
|
+
if (config.environment.platform === "mac") {
|
|
131741
|
+
const safariVersion = await spawnCommand("defaults read /Applications/Safari.app/Contents/Info.plist CFBundleShortVersionString");
|
|
131742
|
+
const appiumSafari = appiumDriverOutput.match(/\n.*safari.*installed \(npm\).*\n/);
|
|
131743
|
+
if (safariVersion.exitCode === 0 && appiumSafari) {
|
|
131744
|
+
apps.push({ name: "safari", version: safariVersion.stdout.trim(), path: "" });
|
|
131745
|
+
}
|
|
131746
|
+
}
|
|
131721
131747
|
if (!browserDetectionFailed)
|
|
131722
131748
|
cachedAppsByDir.set(key, apps);
|
|
131723
131749
|
return apps;
|
|
131724
131750
|
}
|
|
131725
|
-
|
|
131751
|
+
function probeSafariVersion(timeoutMs) {
|
|
131752
|
+
return new Promise((resolve) => {
|
|
131753
|
+
let child;
|
|
131754
|
+
try {
|
|
131755
|
+
child = (0, import_node_child_process3.spawn)("defaults", [
|
|
131756
|
+
"read",
|
|
131757
|
+
"/Applications/Safari.app/Contents/Info.plist",
|
|
131758
|
+
"CFBundleShortVersionString"
|
|
131759
|
+
], { stdio: ["ignore", "pipe", "ignore"] });
|
|
131760
|
+
} catch {
|
|
131761
|
+
resolve(null);
|
|
131762
|
+
return;
|
|
131763
|
+
}
|
|
131764
|
+
let stdout = "";
|
|
131765
|
+
let settled = false;
|
|
131766
|
+
const finish = (value) => {
|
|
131767
|
+
if (settled)
|
|
131768
|
+
return;
|
|
131769
|
+
settled = true;
|
|
131770
|
+
clearTimeout(timer);
|
|
131771
|
+
try {
|
|
131772
|
+
child.kill();
|
|
131773
|
+
} catch {
|
|
131774
|
+
}
|
|
131775
|
+
resolve(value);
|
|
131776
|
+
};
|
|
131777
|
+
const timer = setTimeout(() => finish(null), timeoutMs);
|
|
131778
|
+
timer.unref?.();
|
|
131779
|
+
child.stdout?.on("data", (c) => {
|
|
131780
|
+
stdout += typeof c === "string" ? c : c.toString("utf8");
|
|
131781
|
+
});
|
|
131782
|
+
child.on("error", () => finish(null));
|
|
131783
|
+
child.on("close", (code) => finish(code === 0 ? stdout.trim() : null));
|
|
131784
|
+
});
|
|
131785
|
+
}
|
|
131786
|
+
async function getBrowserDiagnostics({ config }) {
|
|
131787
|
+
let detectionFailed = false;
|
|
131788
|
+
let record;
|
|
131789
|
+
try {
|
|
131790
|
+
record = readInstalledRecord({ cacheDir: config?.cacheDir });
|
|
131791
|
+
} catch {
|
|
131792
|
+
detectionFailed = true;
|
|
131793
|
+
record = { npmPackages: {}, browsers: {} };
|
|
131794
|
+
}
|
|
131795
|
+
const browsersRec = record.browsers || {};
|
|
131796
|
+
const platform = config?.environment?.platform;
|
|
131797
|
+
const brow = (name) => browsersRec[name];
|
|
131798
|
+
const npmInstalled = (name) => Boolean(resolveHeavyDepPath(name, { cacheDir: config?.cacheDir }));
|
|
131799
|
+
const browsers = [];
|
|
131800
|
+
const chrome = brow("chrome");
|
|
131801
|
+
const chromedriver = brow("chromedriver");
|
|
131802
|
+
const appiumChromium = npmInstalled("appium-chromium-driver");
|
|
131803
|
+
browsers.push({
|
|
131804
|
+
name: "chrome",
|
|
131805
|
+
supported: true,
|
|
131806
|
+
available: Boolean(chrome && chromedriver && appiumChromium),
|
|
131807
|
+
components: [
|
|
131808
|
+
{ label: "chrome browser", installed: Boolean(chrome), detail: chrome?.installedVersion },
|
|
131809
|
+
{ label: "chromedriver", installed: Boolean(chromedriver), detail: chromedriver?.installedVersion },
|
|
131810
|
+
{ label: "appium-chromium-driver", installed: appiumChromium }
|
|
131811
|
+
]
|
|
131812
|
+
});
|
|
131813
|
+
const firefox = brow("firefox");
|
|
131814
|
+
const geckodriver = brow("geckodriver");
|
|
131815
|
+
const appiumGecko = npmInstalled("appium-geckodriver");
|
|
131816
|
+
browsers.push({
|
|
131817
|
+
name: "firefox",
|
|
131818
|
+
supported: true,
|
|
131819
|
+
available: Boolean(firefox && geckodriver && appiumGecko),
|
|
131820
|
+
components: [
|
|
131821
|
+
{ label: "firefox browser", installed: Boolean(firefox), detail: firefox?.installedVersion },
|
|
131822
|
+
{ label: "geckodriver", installed: Boolean(geckodriver), detail: geckodriver?.installedVersion },
|
|
131823
|
+
{ label: "appium-geckodriver", installed: appiumGecko }
|
|
131824
|
+
]
|
|
131825
|
+
});
|
|
131826
|
+
const isMac = platform === "mac";
|
|
131827
|
+
const appiumSafari = npmInstalled("appium-safari-driver");
|
|
131828
|
+
let safariApp = false;
|
|
131829
|
+
let safariVersion;
|
|
131830
|
+
let safaridriver = false;
|
|
131831
|
+
if (isMac) {
|
|
131832
|
+
try {
|
|
131833
|
+
const version = await probeSafariVersion(4e3);
|
|
131834
|
+
safariApp = version !== null;
|
|
131835
|
+
safariVersion = version ?? void 0;
|
|
131836
|
+
safaridriver = import_node_fs7.default.existsSync("/usr/bin/safaridriver");
|
|
131837
|
+
} catch {
|
|
131838
|
+
detectionFailed = true;
|
|
131839
|
+
}
|
|
131840
|
+
}
|
|
131841
|
+
browsers.push({
|
|
131842
|
+
name: "safari",
|
|
131843
|
+
supported: isMac,
|
|
131844
|
+
available: Boolean(isMac && safariApp && safaridriver && appiumSafari),
|
|
131845
|
+
components: [
|
|
131846
|
+
{ label: "Safari app", installed: safariApp, detail: safariVersion },
|
|
131847
|
+
{
|
|
131848
|
+
label: "safaridriver",
|
|
131849
|
+
installed: safaridriver,
|
|
131850
|
+
detail: safaridriver ? "/usr/bin/safaridriver" : void 0
|
|
131851
|
+
},
|
|
131852
|
+
{ label: "appium-safari-driver", installed: appiumSafari }
|
|
131853
|
+
],
|
|
131854
|
+
note: isMac ? void 0 : "Safari is only available on macOS"
|
|
131855
|
+
});
|
|
131856
|
+
return { browsers, detectionFailed };
|
|
131857
|
+
}
|
|
131858
|
+
var import_node_os3, import_node_fs7, import_node_path7, import_node_child_process3, import_node_url5, __dirname4, platformMap, defaultFileTypes, cachedAppsByDir;
|
|
131726
131859
|
var init_config = __esm({
|
|
131727
131860
|
"dist/core/config.js"() {
|
|
131728
131861
|
"use strict";
|
|
131729
131862
|
import_node_os3 = __toESM(require("node:os"), 1);
|
|
131863
|
+
import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
131730
131864
|
init_validate();
|
|
131731
131865
|
init_utils();
|
|
131732
131866
|
import_node_path7 = __toESM(require("node:path"), 1);
|
|
@@ -132399,7 +132533,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
132399
132533
|
init_config();
|
|
132400
132534
|
|
|
132401
132535
|
// dist/core/detectTests.js
|
|
132402
|
-
var
|
|
132536
|
+
var import_node_fs9 = __toESM(require("node:fs"), 1);
|
|
132403
132537
|
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
132404
132538
|
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
132405
132539
|
var import_node_crypto3 = __toESM(require("node:crypto"), 1);
|
|
@@ -133231,7 +133365,7 @@ init_files();
|
|
|
133231
133365
|
init_utils();
|
|
133232
133366
|
|
|
133233
133367
|
// dist/core/integrations/heretto.js
|
|
133234
|
-
var
|
|
133368
|
+
var import_node_fs8 = __toESM(require("node:fs"), 1);
|
|
133235
133369
|
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
133236
133370
|
var import_node_https = __toESM(require("node:https"), 1);
|
|
133237
133371
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
@@ -133392,11 +133526,11 @@ var HerettoUploader = class {
|
|
|
133392
133526
|
return result;
|
|
133393
133527
|
}
|
|
133394
133528
|
}
|
|
133395
|
-
if (!
|
|
133529
|
+
if (!import_node_fs8.default.existsSync(localFilePath)) {
|
|
133396
133530
|
result.description = `Local file not found: ${localFilePath}`;
|
|
133397
133531
|
return result;
|
|
133398
133532
|
}
|
|
133399
|
-
const fileContent =
|
|
133533
|
+
const fileContent = import_node_fs8.default.readFileSync(localFilePath);
|
|
133400
133534
|
const contentType = this.getContentType(localFilePath);
|
|
133401
133535
|
try {
|
|
133402
133536
|
await this.uploadFile({
|
|
@@ -134170,7 +134304,7 @@ async function pollJobStatus(client, fileId, jobId, log3, config) {
|
|
|
134170
134304
|
return null;
|
|
134171
134305
|
}
|
|
134172
134306
|
async function downloadAndExtractOutput(client, fileId, jobId, herettoName, log3, config, deps) {
|
|
134173
|
-
const fsModule = deps?.fsModule ||
|
|
134307
|
+
const fsModule = deps?.fsModule || import_node_fs8.default;
|
|
134174
134308
|
const ZipClass = deps?.ZipClass || import_adm_zip.default;
|
|
134175
134309
|
const tempDir = import_node_path8.default.join(import_node_os4.default.tmpdir(), "doc-detective");
|
|
134176
134310
|
const hash = import_node_crypto2.default.createHash("md5").update(`${herettoName}_${jobId}`).digest("hex");
|
|
@@ -134408,7 +134542,7 @@ async function isValidSourceFile({ config, files, source }) {
|
|
|
134408
134542
|
} else {
|
|
134409
134543
|
beforePath = import_node_path9.default.resolve(test.before);
|
|
134410
134544
|
}
|
|
134411
|
-
if (!
|
|
134545
|
+
if (!import_node_fs9.default.existsSync(beforePath)) {
|
|
134412
134546
|
log(config, "debug", `${beforePath} is specified to run before a test but isn't a valid file. Skipping ${source}.`);
|
|
134413
134547
|
return false;
|
|
134414
134548
|
}
|
|
@@ -134420,7 +134554,7 @@ async function isValidSourceFile({ config, files, source }) {
|
|
|
134420
134554
|
} else {
|
|
134421
134555
|
afterPath = import_node_path9.default.resolve(test.after);
|
|
134422
134556
|
}
|
|
134423
|
-
if (!
|
|
134557
|
+
if (!import_node_fs9.default.existsSync(afterPath)) {
|
|
134424
134558
|
log(config, "debug", `${afterPath} is specified to run after a test but isn't a valid file. Skipping ${source}.`);
|
|
134425
134559
|
return false;
|
|
134426
134560
|
}
|
|
@@ -134438,9 +134572,9 @@ async function processDitaMap({ config, source }) {
|
|
|
134438
134572
|
const hash = import_node_crypto3.default.createHash("md5").update(source).digest("hex");
|
|
134439
134573
|
const tmpBase = import_node_path9.default.join(import_node_os5.default.tmpdir(), "doc-detective");
|
|
134440
134574
|
const outputDir = import_node_path9.default.join(tmpBase, `ditamap_${hash}`);
|
|
134441
|
-
if (!
|
|
134575
|
+
if (!import_node_fs9.default.existsSync(tmpBase)) {
|
|
134442
134576
|
log(config, "debug", `Creating temp directory: ${tmpBase}`);
|
|
134443
|
-
|
|
134577
|
+
import_node_fs9.default.mkdirSync(tmpBase, { recursive: true });
|
|
134444
134578
|
}
|
|
134445
134579
|
const ditaVersion = await spawnCommand("dita", ["--version"]);
|
|
134446
134580
|
if (ditaVersion.exitCode !== 0) {
|
|
@@ -134542,8 +134676,8 @@ async function qualifyFiles({ config }) {
|
|
|
134542
134676
|
let isFile = false;
|
|
134543
134677
|
let isDir = false;
|
|
134544
134678
|
try {
|
|
134545
|
-
isFile =
|
|
134546
|
-
isDir =
|
|
134679
|
+
isFile = import_node_fs9.default.statSync(source).isFile();
|
|
134680
|
+
isDir = import_node_fs9.default.statSync(source).isDirectory();
|
|
134547
134681
|
} catch {
|
|
134548
134682
|
log(config, "warning", `Cannot access path: ${source}. Skipping.`);
|
|
134549
134683
|
continue;
|
|
@@ -134563,13 +134697,13 @@ async function qualifyFiles({ config }) {
|
|
|
134563
134697
|
dirs = [];
|
|
134564
134698
|
dirs[0] = source;
|
|
134565
134699
|
for (const dir of dirs) {
|
|
134566
|
-
const objects =
|
|
134700
|
+
const objects = import_node_fs9.default.readdirSync(dir);
|
|
134567
134701
|
for (const object of objects) {
|
|
134568
134702
|
const content = import_node_path9.default.resolve(dir + "/" + object);
|
|
134569
134703
|
if (content.includes("node_modules"))
|
|
134570
134704
|
continue;
|
|
134571
|
-
const isFile2 =
|
|
134572
|
-
const isDir2 =
|
|
134705
|
+
const isFile2 = import_node_fs9.default.statSync(content).isFile();
|
|
134706
|
+
const isDir2 = import_node_fs9.default.statSync(content).isDirectory();
|
|
134573
134707
|
if (isFile2 && await isValidSourceFile({ config, files, source: content })) {
|
|
134574
134708
|
files.push(import_node_path9.default.resolve(content));
|
|
134575
134709
|
} else if (isDir2 && config.recursive) {
|
|
@@ -134590,7 +134724,7 @@ async function parseTests({ config, files }) {
|
|
|
134590
134724
|
let rawContent;
|
|
134591
134725
|
if (extension === "json" || extension === "yaml" || extension === "yml") {
|
|
134592
134726
|
try {
|
|
134593
|
-
rawContent = await
|
|
134727
|
+
rawContent = await import_node_fs9.default.promises.readFile(file, "utf8");
|
|
134594
134728
|
if (extension === "json") {
|
|
134595
134729
|
content = JSON.parse(rawContent);
|
|
134596
134730
|
} else {
|
|
@@ -136236,7 +136370,7 @@ async function waitForDOMStable(driver, idleTime, timeout) {
|
|
|
136236
136370
|
// dist/core/tests/runShell.js
|
|
136237
136371
|
init_validate();
|
|
136238
136372
|
init_utils();
|
|
136239
|
-
var
|
|
136373
|
+
var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
136240
136374
|
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
136241
136375
|
async function runShell({ config, step }) {
|
|
136242
136376
|
const result = {
|
|
@@ -136311,23 +136445,23 @@ async function runShell({ config, step }) {
|
|
|
136311
136445
|
}
|
|
136312
136446
|
if (step.runShell.path) {
|
|
136313
136447
|
const dir = import_node_path10.default.dirname(step.runShell.path);
|
|
136314
|
-
if (!
|
|
136315
|
-
|
|
136448
|
+
if (!import_node_fs10.default.existsSync(dir)) {
|
|
136449
|
+
import_node_fs10.default.mkdirSync(dir, { recursive: true });
|
|
136316
136450
|
}
|
|
136317
136451
|
let filePath = step.runShell.path;
|
|
136318
136452
|
log(config, "debug", `Saving stdio to file: ${filePath}`);
|
|
136319
|
-
if (!
|
|
136320
|
-
|
|
136453
|
+
if (!import_node_fs10.default.existsSync(filePath)) {
|
|
136454
|
+
import_node_fs10.default.writeFileSync(filePath, result.outputs.stdio.stdout);
|
|
136321
136455
|
} else {
|
|
136322
136456
|
if (step.runShell.overwrite == "false") {
|
|
136323
136457
|
result.description = result.description + ` Didn't save output. File already exists.`;
|
|
136324
136458
|
}
|
|
136325
|
-
const existingFile =
|
|
136459
|
+
const existingFile = import_node_fs10.default.readFileSync(filePath, "utf8");
|
|
136326
136460
|
const fractionalDiff = calculateFractionalDifference(existingFile, result.outputs.stdio.stdout);
|
|
136327
136461
|
log(config, "debug", `Fractional difference: ${fractionalDiff}`);
|
|
136328
136462
|
if (fractionalDiff > step.runShell.maxVariation) {
|
|
136329
136463
|
if (step.runShell.overwrite == "aboveVariation") {
|
|
136330
|
-
|
|
136464
|
+
import_node_fs10.default.writeFileSync(filePath, result.outputs.stdio.stdout);
|
|
136331
136465
|
result.description += ` Saved output to file.`;
|
|
136332
136466
|
}
|
|
136333
136467
|
result.status = "WARNING";
|
|
@@ -136335,7 +136469,7 @@ async function runShell({ config, step }) {
|
|
|
136335
136469
|
return result;
|
|
136336
136470
|
}
|
|
136337
136471
|
if (step.runShell.overwrite == "true") {
|
|
136338
|
-
|
|
136472
|
+
import_node_fs10.default.writeFileSync(filePath, result.outputs.stdio.stdout);
|
|
136339
136473
|
result.description += ` Saved output to file.`;
|
|
136340
136474
|
}
|
|
136341
136475
|
}
|
|
@@ -136520,7 +136654,7 @@ async function checkLink({ config, step }) {
|
|
|
136520
136654
|
init_validate();
|
|
136521
136655
|
init_utils();
|
|
136522
136656
|
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
136523
|
-
var
|
|
136657
|
+
var import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
136524
136658
|
init_loader();
|
|
136525
136659
|
var _pngjs = null;
|
|
136526
136660
|
var _sharp = null;
|
|
@@ -136647,8 +136781,8 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136647
136781
|
const rawBase = import_node_path11.default.basename(urlPathname.split("?")[0].split("#")[0].replace(/\\/g, "/"));
|
|
136648
136782
|
const safeBase = sanitizeFilesystemName(rawBase, `${step.stepId}.png`);
|
|
136649
136783
|
dir = import_node_path11.default.join(process.cwd(), "doc-detective-runs", getOrInitRunTimestamp(config));
|
|
136650
|
-
if (!
|
|
136651
|
-
|
|
136784
|
+
if (!import_node_fs11.default.existsSync(dir)) {
|
|
136785
|
+
import_node_fs11.default.mkdirSync(dir, { recursive: true });
|
|
136652
136786
|
}
|
|
136653
136787
|
const captureId = `${step.stepId || "screenshot"}_${Date.now()}`;
|
|
136654
136788
|
filePath = import_node_path11.default.join(dir, `${captureId}_${safeBase}`);
|
|
@@ -136664,10 +136798,10 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136664
136798
|
}
|
|
136665
136799
|
} else {
|
|
136666
136800
|
dir = import_node_path11.default.dirname(step.screenshot.path);
|
|
136667
|
-
if (!
|
|
136668
|
-
|
|
136801
|
+
if (!import_node_fs11.default.existsSync(dir)) {
|
|
136802
|
+
import_node_fs11.default.mkdirSync(dir, { recursive: true });
|
|
136669
136803
|
}
|
|
136670
|
-
if (
|
|
136804
|
+
if (import_node_fs11.default.existsSync(filePath)) {
|
|
136671
136805
|
if (step.screenshot.overwrite == "false") {
|
|
136672
136806
|
result.status = "SKIPPED";
|
|
136673
136807
|
result.description = `File already exists: ${filePath}`;
|
|
@@ -136763,8 +136897,8 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136763
136897
|
} catch (error) {
|
|
136764
136898
|
result.status = "FAIL";
|
|
136765
136899
|
result.description = `Couldn't save screenshot. ${error}`;
|
|
136766
|
-
if (existFilePath && filePath !== existFilePath &&
|
|
136767
|
-
|
|
136900
|
+
if (existFilePath && filePath !== existFilePath && import_node_fs11.default.existsSync(filePath)) {
|
|
136901
|
+
import_node_fs11.default.unlinkSync(filePath);
|
|
136768
136902
|
}
|
|
136769
136903
|
return result;
|
|
136770
136904
|
}
|
|
@@ -136816,12 +136950,12 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136816
136950
|
width: rect.width,
|
|
136817
136951
|
height: rect.height
|
|
136818
136952
|
}).toFile(croppedPath);
|
|
136819
|
-
|
|
136953
|
+
import_node_fs11.default.renameSync(croppedPath, filePath);
|
|
136820
136954
|
} catch (error) {
|
|
136821
136955
|
result.status = "FAIL";
|
|
136822
136956
|
result.description = `Couldn't crop image. ${error}`;
|
|
136823
|
-
if (existFilePath && filePath !== existFilePath &&
|
|
136824
|
-
|
|
136957
|
+
if (existFilePath && filePath !== existFilePath && import_node_fs11.default.existsSync(filePath)) {
|
|
136958
|
+
import_node_fs11.default.unlinkSync(filePath);
|
|
136825
136959
|
}
|
|
136826
136960
|
return result;
|
|
136827
136961
|
}
|
|
@@ -136829,7 +136963,7 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136829
136963
|
if (existFilePath) {
|
|
136830
136964
|
if (step.screenshot.overwrite == "true" && !isUrlPath) {
|
|
136831
136965
|
result.description += ` Overwrote existing file.`;
|
|
136832
|
-
|
|
136966
|
+
import_node_fs11.default.renameSync(filePath, existFilePath);
|
|
136833
136967
|
result.outputs.screenshotPath = existFilePath;
|
|
136834
136968
|
result.outputs.changed = true;
|
|
136835
136969
|
if (step.screenshot.sourceIntegration) {
|
|
@@ -136842,21 +136976,21 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136842
136976
|
let img1;
|
|
136843
136977
|
let img2;
|
|
136844
136978
|
try {
|
|
136845
|
-
img1 = PNG.sync.read(
|
|
136846
|
-
img2 = PNG.sync.read(
|
|
136979
|
+
img1 = PNG.sync.read(import_node_fs11.default.readFileSync(existFilePath));
|
|
136980
|
+
img2 = PNG.sync.read(import_node_fs11.default.readFileSync(filePath));
|
|
136847
136981
|
} catch (error) {
|
|
136848
136982
|
result.status = "FAIL";
|
|
136849
136983
|
result.description = isUrlPath ? `Couldn't decode PNG for comparison. The URL reference (${redactedUrl}) may not be a valid PNG. ${error}` : `Couldn't decode PNG for comparison. ${error}`;
|
|
136850
|
-
if (!isUrlPath && filePath !== existFilePath &&
|
|
136851
|
-
|
|
136984
|
+
if (!isUrlPath && filePath !== existFilePath && import_node_fs11.default.existsSync(filePath)) {
|
|
136985
|
+
import_node_fs11.default.unlinkSync(filePath);
|
|
136852
136986
|
}
|
|
136853
136987
|
return result;
|
|
136854
136988
|
}
|
|
136855
136989
|
if (!aspectRatiosMatch(img1, img2)) {
|
|
136856
136990
|
result.status = "FAIL";
|
|
136857
136991
|
result.description = `Couldn't compare images. Images have different aspect ratios.`;
|
|
136858
|
-
if (!isUrlPath && filePath !== existFilePath &&
|
|
136859
|
-
|
|
136992
|
+
if (!isUrlPath && filePath !== existFilePath && import_node_fs11.default.existsSync(filePath)) {
|
|
136993
|
+
import_node_fs11.default.unlinkSync(filePath);
|
|
136860
136994
|
}
|
|
136861
136995
|
return result;
|
|
136862
136996
|
}
|
|
@@ -136883,8 +137017,8 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136883
137017
|
} catch (error) {
|
|
136884
137018
|
result.status = "FAIL";
|
|
136885
137019
|
result.description = `Couldn't load screenshot comparison dependency (pixelmatch). ${error?.message ?? error}`;
|
|
136886
|
-
if (!isUrlPath && filePath !== existFilePath &&
|
|
136887
|
-
|
|
137020
|
+
if (!isUrlPath && filePath !== existFilePath && import_node_fs11.default.existsSync(filePath)) {
|
|
137021
|
+
import_node_fs11.default.unlinkSync(filePath);
|
|
136888
137022
|
}
|
|
136889
137023
|
return result;
|
|
136890
137024
|
}
|
|
@@ -136897,7 +137031,7 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136897
137031
|
});
|
|
136898
137032
|
if (fractionalDiff > step.screenshot.maxVariation) {
|
|
136899
137033
|
if (step.screenshot.overwrite == "aboveVariation" && !isUrlPath) {
|
|
136900
|
-
|
|
137034
|
+
import_node_fs11.default.renameSync(filePath, existFilePath);
|
|
136901
137035
|
}
|
|
136902
137036
|
result.status = "WARNING";
|
|
136903
137037
|
result.description += ` The difference between the existing screenshot and new screenshot (${fractionalDiff.toFixed(2)}) is greater than the max accepted variation (${step.screenshot.maxVariation}).`;
|
|
@@ -136923,7 +137057,7 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136923
137057
|
result.outputs.sourceIntegration = step.screenshot.sourceIntegration;
|
|
136924
137058
|
}
|
|
136925
137059
|
if (step.screenshot.overwrite != "true") {
|
|
136926
|
-
|
|
137060
|
+
import_node_fs11.default.unlinkSync(filePath);
|
|
136927
137061
|
}
|
|
136928
137062
|
}
|
|
136929
137063
|
}
|
|
@@ -136943,7 +137077,7 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136943
137077
|
init_validate();
|
|
136944
137078
|
init_utils();
|
|
136945
137079
|
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
136946
|
-
var
|
|
137080
|
+
var import_node_fs12 = __toESM(require("node:fs"), 1);
|
|
136947
137081
|
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
136948
137082
|
async function startRecording({ config, context, step, driver }) {
|
|
136949
137083
|
let result = {
|
|
@@ -136981,10 +137115,10 @@ async function startRecording({ config, context, step, driver }) {
|
|
|
136981
137115
|
let filePath = step.record.path;
|
|
136982
137116
|
const baseName = import_node_path12.default.basename(filePath, import_node_path12.default.extname(filePath));
|
|
136983
137117
|
const dir = import_node_path12.default.dirname(step.record.path);
|
|
136984
|
-
if (!
|
|
136985
|
-
|
|
137118
|
+
if (!import_node_fs12.default.existsSync(dir)) {
|
|
137119
|
+
import_node_fs12.default.mkdirSync(dir, { recursive: true });
|
|
136986
137120
|
}
|
|
136987
|
-
if (
|
|
137121
|
+
if (import_node_fs12.default.existsSync(filePath) && step.record.overwrite == "false") {
|
|
136988
137122
|
result.status = "SKIPPED";
|
|
136989
137123
|
result.description = `File already exists: ${filePath}`;
|
|
136990
137124
|
return result;
|
|
@@ -137108,7 +137242,7 @@ init_validate();
|
|
|
137108
137242
|
init_utils();
|
|
137109
137243
|
var import_node_child_process4 = require("node:child_process");
|
|
137110
137244
|
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
137111
|
-
var
|
|
137245
|
+
var import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
137112
137246
|
init_loader();
|
|
137113
137247
|
async function getFfmpegPath(ctx = {}) {
|
|
137114
137248
|
const mod = await loadHeavyDep("@ffmpeg-installer/ffmpeg", { ctx });
|
|
@@ -137157,11 +137291,11 @@ async function stopRecording({ config, step, driver }) {
|
|
|
137157
137291
|
window.recorder.stop();
|
|
137158
137292
|
});
|
|
137159
137293
|
let waitCount = 0;
|
|
137160
|
-
while (!
|
|
137294
|
+
while (!import_node_fs13.default.existsSync(config.recording.downloadPath) && waitCount < 60) {
|
|
137161
137295
|
await new Promise((r) => setTimeout(r, 1e3));
|
|
137162
137296
|
waitCount++;
|
|
137163
137297
|
}
|
|
137164
|
-
if (!
|
|
137298
|
+
if (!import_node_fs13.default.existsSync(config.recording.downloadPath)) {
|
|
137165
137299
|
result.status = "FAIL";
|
|
137166
137300
|
result.description = "Recording download timed out.";
|
|
137167
137301
|
return result;
|
|
@@ -137186,7 +137320,7 @@ async function stopRecording({ config, step, driver }) {
|
|
|
137186
137320
|
if (code === 0) {
|
|
137187
137321
|
if (targetPath !== downloadPath) {
|
|
137188
137322
|
try {
|
|
137189
|
-
|
|
137323
|
+
import_node_fs13.default.unlinkSync(downloadPath);
|
|
137190
137324
|
} catch {
|
|
137191
137325
|
}
|
|
137192
137326
|
}
|
|
@@ -137232,7 +137366,7 @@ async function loadVariables({ step }) {
|
|
|
137232
137366
|
init_validate();
|
|
137233
137367
|
init_utils();
|
|
137234
137368
|
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
137235
|
-
var
|
|
137369
|
+
var import_node_fs14 = __toESM(require("node:fs"), 1);
|
|
137236
137370
|
async function saveCookie({ config, step, driver }) {
|
|
137237
137371
|
let result = {
|
|
137238
137372
|
status: "PASS",
|
|
@@ -137299,14 +137433,14 @@ async function saveCookie({ config, step, driver }) {
|
|
|
137299
137433
|
if (filePath) {
|
|
137300
137434
|
const outputDirectory = directory || config.output || process.cwd();
|
|
137301
137435
|
const fullPath = import_node_path14.default.resolve(outputDirectory, filePath);
|
|
137302
|
-
if (
|
|
137436
|
+
if (import_node_fs14.default.existsSync(fullPath) && !(overwrite === true || overwrite === "true")) {
|
|
137303
137437
|
result.status = "FAIL";
|
|
137304
137438
|
result.description = `File '${fullPath}' already exists and overwrite is not enabled.`;
|
|
137305
137439
|
return result;
|
|
137306
137440
|
}
|
|
137307
137441
|
const dir = import_node_path14.default.dirname(fullPath);
|
|
137308
|
-
if (!
|
|
137309
|
-
|
|
137442
|
+
if (!import_node_fs14.default.existsSync(dir)) {
|
|
137443
|
+
import_node_fs14.default.mkdirSync(dir, { recursive: true });
|
|
137310
137444
|
}
|
|
137311
137445
|
if (targetCookie) {
|
|
137312
137446
|
const netscapeCookie = formatCookieForNetscape(targetCookie);
|
|
@@ -137314,11 +137448,11 @@ async function saveCookie({ config, step, driver }) {
|
|
|
137314
137448
|
# This is a cookie file saved by Doc Detective
|
|
137315
137449
|
${netscapeCookie}
|
|
137316
137450
|
`;
|
|
137317
|
-
|
|
137451
|
+
import_node_fs14.default.writeFileSync(fullPath, content, "utf8");
|
|
137318
137452
|
result.description = `Saved cookie '${cookieName}' to '${fullPath}'.`;
|
|
137319
137453
|
log(config, "debug", `Saved cookie '${cookieName}' to file: ${fullPath}`);
|
|
137320
137454
|
} else {
|
|
137321
|
-
|
|
137455
|
+
import_node_fs14.default.writeFileSync(fullPath, "# No cookie data\n", "utf8");
|
|
137322
137456
|
result.description = `Created empty cookie file at '${fullPath}'.`;
|
|
137323
137457
|
log(config, "debug", `Created empty cookie file: ${fullPath}`);
|
|
137324
137458
|
}
|
|
@@ -137346,7 +137480,7 @@ function formatCookieForNetscape(cookie) {
|
|
|
137346
137480
|
init_validate();
|
|
137347
137481
|
init_utils();
|
|
137348
137482
|
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
137349
|
-
var
|
|
137483
|
+
var import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
137350
137484
|
async function loadCookie({ config, step, driver }) {
|
|
137351
137485
|
let result = {
|
|
137352
137486
|
status: "PASS",
|
|
@@ -137402,13 +137536,13 @@ async function loadCookie({ config, step, driver }) {
|
|
|
137402
137536
|
} else if (filePath) {
|
|
137403
137537
|
const inputDirectory = directory || config.output || process.cwd();
|
|
137404
137538
|
const fullPath = import_node_path15.default.resolve(inputDirectory, filePath);
|
|
137405
|
-
if (!
|
|
137539
|
+
if (!import_node_fs15.default.existsSync(fullPath)) {
|
|
137406
137540
|
result.status = "FAIL";
|
|
137407
137541
|
result.description = `Cookie file '${fullPath}' not found`;
|
|
137408
137542
|
return result;
|
|
137409
137543
|
}
|
|
137410
137544
|
try {
|
|
137411
|
-
const fileContent =
|
|
137545
|
+
const fileContent = import_node_fs15.default.readFileSync(fullPath, "utf8");
|
|
137412
137546
|
const cookies = parseNetscapeCookieFile(fileContent);
|
|
137413
137547
|
if (cookies.length === 0) {
|
|
137414
137548
|
result.status = "FAIL";
|
|
@@ -137574,7 +137708,7 @@ function isDomainCompatible(currentDomain, cookieDomain) {
|
|
|
137574
137708
|
// dist/core/tests/httpRequest.js
|
|
137575
137709
|
init_validate();
|
|
137576
137710
|
var import_axios5 = __toESM(require("axios"), 1);
|
|
137577
|
-
var
|
|
137711
|
+
var import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
137578
137712
|
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
137579
137713
|
var import_ajv2 = __toESM(require("ajv"), 1);
|
|
137580
137714
|
init_openapi();
|
|
@@ -137881,24 +138015,24 @@ async function httpRequest({ config, step, openApiDefinitions = [] }) {
|
|
|
137881
138015
|
}
|
|
137882
138016
|
if (step.httpRequest.path) {
|
|
137883
138017
|
const dir = import_node_path16.default.dirname(step.httpRequest.path);
|
|
137884
|
-
if (!
|
|
137885
|
-
|
|
138018
|
+
if (!import_node_fs16.default.existsSync(dir)) {
|
|
138019
|
+
import_node_fs16.default.mkdirSync(dir, { recursive: true });
|
|
137886
138020
|
}
|
|
137887
138021
|
let filePath = step.httpRequest.path;
|
|
137888
138022
|
log(config, "debug", `Saving output to file: ${filePath}`);
|
|
137889
|
-
if (!
|
|
137890
|
-
await
|
|
138023
|
+
if (!import_node_fs16.default.existsSync(filePath)) {
|
|
138024
|
+
await import_node_fs16.default.promises.writeFile(filePath, JSON.stringify(response.data, null, 2));
|
|
137891
138025
|
result.description += ` Saved output to file.`;
|
|
137892
138026
|
} else {
|
|
137893
138027
|
if (step.httpRequest.overwrite == "false") {
|
|
137894
138028
|
result.description += ` Didn't save output. File already exists.`;
|
|
137895
138029
|
}
|
|
137896
|
-
const existingFile =
|
|
138030
|
+
const existingFile = import_node_fs16.default.readFileSync(filePath, "utf8");
|
|
137897
138031
|
const fractionalDiff = calculateFractionalDifference(existingFile, JSON.stringify(response.data, null, 2));
|
|
137898
138032
|
log(config, "debug", `Fractional difference: ${fractionalDiff}`);
|
|
137899
138033
|
if (fractionalDiff > step.httpRequest.maxVariation) {
|
|
137900
138034
|
if (step.httpRequest.overwrite == "aboveVariation") {
|
|
137901
|
-
await
|
|
138035
|
+
await import_node_fs16.default.promises.writeFile(filePath, JSON.stringify(response.data, null, 2));
|
|
137902
138036
|
result.description += ` Saved response to file.`;
|
|
137903
138037
|
}
|
|
137904
138038
|
result.status = "WARNING";
|
|
@@ -137906,7 +138040,7 @@ async function httpRequest({ config, step, openApiDefinitions = [] }) {
|
|
|
137906
138040
|
return result;
|
|
137907
138041
|
}
|
|
137908
138042
|
if (step.httpRequest.overwrite == "true") {
|
|
137909
|
-
|
|
138043
|
+
import_node_fs16.default.writeFileSync(filePath, JSON.stringify(response.data, null, 2));
|
|
137910
138044
|
result.description += ` Saved response to file.`;
|
|
137911
138045
|
}
|
|
137912
138046
|
}
|
|
@@ -138083,7 +138217,7 @@ async function clickElement({ config, step, driver }) {
|
|
|
138083
138217
|
// dist/core/tests/runCode.js
|
|
138084
138218
|
init_validate();
|
|
138085
138219
|
init_utils();
|
|
138086
|
-
var
|
|
138220
|
+
var import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
138087
138221
|
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
138088
138222
|
var import_node_os7 = __toESM(require("node:os"), 1);
|
|
138089
138223
|
function createTempScript(code, language) {
|
|
@@ -138107,7 +138241,7 @@ function createTempScript(code, language) {
|
|
|
138107
138241
|
const tmpDir = import_node_os7.default.tmpdir();
|
|
138108
138242
|
const tmpFile = import_node_path17.default.join(tmpDir, `doc-detective-${Date.now()}${extension}`);
|
|
138109
138243
|
try {
|
|
138110
|
-
|
|
138244
|
+
import_node_fs17.default.writeFileSync(tmpFile, code);
|
|
138111
138245
|
} catch (error) {
|
|
138112
138246
|
throw new Error(`Failed to create temporary script: ${error.message}`);
|
|
138113
138247
|
}
|
|
@@ -138191,7 +138325,7 @@ async function runCode({ config, step }) {
|
|
|
138191
138325
|
result.description = error.message;
|
|
138192
138326
|
} finally {
|
|
138193
138327
|
try {
|
|
138194
|
-
|
|
138328
|
+
import_node_fs17.default.unlinkSync(scriptPath);
|
|
138195
138329
|
log(config, "debug", `Removed temporary script: ${scriptPath}`);
|
|
138196
138330
|
} catch (error) {
|
|
138197
138331
|
log(config, "warn", `Failed to remove temporary script: ${scriptPath}`);
|