doc-detective 4.6.0 → 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 +250 -68
- 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 +283 -134
- 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,23 +131640,32 @@ 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 = [];
|
|
131648
|
+
let browserDetectionFailed = false;
|
|
131649
|
+
let appiumDriverOutput = "";
|
|
131632
131650
|
try {
|
|
131633
|
-
const
|
|
131634
|
-
|
|
131635
|
-
});
|
|
131636
|
-
const installedBrowsers = await browsers.getInstalledBrowsers({
|
|
131637
|
-
cacheDir: browsersDir
|
|
131651
|
+
const browsersInstalled = resolveHeavyDepPath("@puppeteer/browsers", {
|
|
131652
|
+
cacheDir: config?.cacheDir
|
|
131638
131653
|
});
|
|
131654
|
+
if (browsersInstalled) {
|
|
131655
|
+
try {
|
|
131656
|
+
const browsers = await loadHeavyDep("@puppeteer/browsers", {
|
|
131657
|
+
ctx: { cacheDir: config?.cacheDir },
|
|
131658
|
+
autoInstall: false
|
|
131659
|
+
});
|
|
131660
|
+
installedBrowsers = await browsers.getInstalledBrowsers({
|
|
131661
|
+
cacheDir: browsersDir
|
|
131662
|
+
});
|
|
131663
|
+
} catch (err) {
|
|
131664
|
+
browserDetectionFailed = true;
|
|
131665
|
+
log(config, "warning", `Browser detection failed; continuing without detected browsers: ${err?.message ?? err}`);
|
|
131666
|
+
installedBrowsers = [];
|
|
131667
|
+
}
|
|
131668
|
+
}
|
|
131639
131669
|
const appiumEntry = resolveHeavyDepPath("appium", {
|
|
131640
131670
|
cacheDir: config?.cacheDir
|
|
131641
131671
|
});
|
|
@@ -131672,46 +131702,165 @@ async function getAvailableApps({ config }) {
|
|
|
131672
131702
|
});
|
|
131673
131703
|
});
|
|
131674
131704
|
});
|
|
131675
|
-
|
|
131676
|
-
|
|
131677
|
-
|
|
131678
|
-
|
|
131679
|
-
|
|
131680
|
-
|
|
131681
|
-
|
|
131682
|
-
|
|
131683
|
-
|
|
131684
|
-
|
|
131685
|
-
|
|
131686
|
-
|
|
131705
|
+
appiumDriverOutput = installedAppiumDrivers.stdout + "\n" + installedAppiumDrivers.stderr;
|
|
131706
|
+
} finally {
|
|
131707
|
+
process.chdir(cwd);
|
|
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: "" });
|
|
131687
131745
|
}
|
|
131688
|
-
|
|
131689
|
-
|
|
131690
|
-
|
|
131691
|
-
|
|
131692
|
-
|
|
131693
|
-
|
|
131694
|
-
|
|
131695
|
-
|
|
131746
|
+
}
|
|
131747
|
+
if (!browserDetectionFailed)
|
|
131748
|
+
cachedAppsByDir.set(key, apps);
|
|
131749
|
+
return apps;
|
|
131750
|
+
}
|
|
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;
|
|
131696
131763
|
}
|
|
131697
|
-
|
|
131698
|
-
|
|
131699
|
-
|
|
131700
|
-
if (
|
|
131701
|
-
|
|
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 {
|
|
131702
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;
|
|
131703
131839
|
}
|
|
131704
|
-
} finally {
|
|
131705
|
-
process.chdir(cwd);
|
|
131706
131840
|
}
|
|
131707
|
-
|
|
131708
|
-
|
|
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 };
|
|
131709
131857
|
}
|
|
131710
|
-
var import_node_os3, import_node_path7, import_node_child_process3, import_node_url5, __dirname4, platformMap, defaultFileTypes, cachedAppsByDir;
|
|
131858
|
+
var import_node_os3, import_node_fs7, import_node_path7, import_node_child_process3, import_node_url5, __dirname4, platformMap, defaultFileTypes, cachedAppsByDir;
|
|
131711
131859
|
var init_config = __esm({
|
|
131712
131860
|
"dist/core/config.js"() {
|
|
131713
131861
|
"use strict";
|
|
131714
131862
|
import_node_os3 = __toESM(require("node:os"), 1);
|
|
131863
|
+
import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
131715
131864
|
init_validate();
|
|
131716
131865
|
init_utils();
|
|
131717
131866
|
import_node_path7 = __toESM(require("node:path"), 1);
|
|
@@ -132384,7 +132533,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
132384
132533
|
init_config();
|
|
132385
132534
|
|
|
132386
132535
|
// dist/core/detectTests.js
|
|
132387
|
-
var
|
|
132536
|
+
var import_node_fs9 = __toESM(require("node:fs"), 1);
|
|
132388
132537
|
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
132389
132538
|
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
132390
132539
|
var import_node_crypto3 = __toESM(require("node:crypto"), 1);
|
|
@@ -133216,7 +133365,7 @@ init_files();
|
|
|
133216
133365
|
init_utils();
|
|
133217
133366
|
|
|
133218
133367
|
// dist/core/integrations/heretto.js
|
|
133219
|
-
var
|
|
133368
|
+
var import_node_fs8 = __toESM(require("node:fs"), 1);
|
|
133220
133369
|
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
133221
133370
|
var import_node_https = __toESM(require("node:https"), 1);
|
|
133222
133371
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
@@ -133377,11 +133526,11 @@ var HerettoUploader = class {
|
|
|
133377
133526
|
return result;
|
|
133378
133527
|
}
|
|
133379
133528
|
}
|
|
133380
|
-
if (!
|
|
133529
|
+
if (!import_node_fs8.default.existsSync(localFilePath)) {
|
|
133381
133530
|
result.description = `Local file not found: ${localFilePath}`;
|
|
133382
133531
|
return result;
|
|
133383
133532
|
}
|
|
133384
|
-
const fileContent =
|
|
133533
|
+
const fileContent = import_node_fs8.default.readFileSync(localFilePath);
|
|
133385
133534
|
const contentType = this.getContentType(localFilePath);
|
|
133386
133535
|
try {
|
|
133387
133536
|
await this.uploadFile({
|
|
@@ -134155,7 +134304,7 @@ async function pollJobStatus(client, fileId, jobId, log3, config) {
|
|
|
134155
134304
|
return null;
|
|
134156
134305
|
}
|
|
134157
134306
|
async function downloadAndExtractOutput(client, fileId, jobId, herettoName, log3, config, deps) {
|
|
134158
|
-
const fsModule = deps?.fsModule ||
|
|
134307
|
+
const fsModule = deps?.fsModule || import_node_fs8.default;
|
|
134159
134308
|
const ZipClass = deps?.ZipClass || import_adm_zip.default;
|
|
134160
134309
|
const tempDir = import_node_path8.default.join(import_node_os4.default.tmpdir(), "doc-detective");
|
|
134161
134310
|
const hash = import_node_crypto2.default.createHash("md5").update(`${herettoName}_${jobId}`).digest("hex");
|
|
@@ -134393,7 +134542,7 @@ async function isValidSourceFile({ config, files, source }) {
|
|
|
134393
134542
|
} else {
|
|
134394
134543
|
beforePath = import_node_path9.default.resolve(test.before);
|
|
134395
134544
|
}
|
|
134396
|
-
if (!
|
|
134545
|
+
if (!import_node_fs9.default.existsSync(beforePath)) {
|
|
134397
134546
|
log(config, "debug", `${beforePath} is specified to run before a test but isn't a valid file. Skipping ${source}.`);
|
|
134398
134547
|
return false;
|
|
134399
134548
|
}
|
|
@@ -134405,7 +134554,7 @@ async function isValidSourceFile({ config, files, source }) {
|
|
|
134405
134554
|
} else {
|
|
134406
134555
|
afterPath = import_node_path9.default.resolve(test.after);
|
|
134407
134556
|
}
|
|
134408
|
-
if (!
|
|
134557
|
+
if (!import_node_fs9.default.existsSync(afterPath)) {
|
|
134409
134558
|
log(config, "debug", `${afterPath} is specified to run after a test but isn't a valid file. Skipping ${source}.`);
|
|
134410
134559
|
return false;
|
|
134411
134560
|
}
|
|
@@ -134423,9 +134572,9 @@ async function processDitaMap({ config, source }) {
|
|
|
134423
134572
|
const hash = import_node_crypto3.default.createHash("md5").update(source).digest("hex");
|
|
134424
134573
|
const tmpBase = import_node_path9.default.join(import_node_os5.default.tmpdir(), "doc-detective");
|
|
134425
134574
|
const outputDir = import_node_path9.default.join(tmpBase, `ditamap_${hash}`);
|
|
134426
|
-
if (!
|
|
134575
|
+
if (!import_node_fs9.default.existsSync(tmpBase)) {
|
|
134427
134576
|
log(config, "debug", `Creating temp directory: ${tmpBase}`);
|
|
134428
|
-
|
|
134577
|
+
import_node_fs9.default.mkdirSync(tmpBase, { recursive: true });
|
|
134429
134578
|
}
|
|
134430
134579
|
const ditaVersion = await spawnCommand("dita", ["--version"]);
|
|
134431
134580
|
if (ditaVersion.exitCode !== 0) {
|
|
@@ -134527,8 +134676,8 @@ async function qualifyFiles({ config }) {
|
|
|
134527
134676
|
let isFile = false;
|
|
134528
134677
|
let isDir = false;
|
|
134529
134678
|
try {
|
|
134530
|
-
isFile =
|
|
134531
|
-
isDir =
|
|
134679
|
+
isFile = import_node_fs9.default.statSync(source).isFile();
|
|
134680
|
+
isDir = import_node_fs9.default.statSync(source).isDirectory();
|
|
134532
134681
|
} catch {
|
|
134533
134682
|
log(config, "warning", `Cannot access path: ${source}. Skipping.`);
|
|
134534
134683
|
continue;
|
|
@@ -134548,13 +134697,13 @@ async function qualifyFiles({ config }) {
|
|
|
134548
134697
|
dirs = [];
|
|
134549
134698
|
dirs[0] = source;
|
|
134550
134699
|
for (const dir of dirs) {
|
|
134551
|
-
const objects =
|
|
134700
|
+
const objects = import_node_fs9.default.readdirSync(dir);
|
|
134552
134701
|
for (const object of objects) {
|
|
134553
134702
|
const content = import_node_path9.default.resolve(dir + "/" + object);
|
|
134554
134703
|
if (content.includes("node_modules"))
|
|
134555
134704
|
continue;
|
|
134556
|
-
const isFile2 =
|
|
134557
|
-
const isDir2 =
|
|
134705
|
+
const isFile2 = import_node_fs9.default.statSync(content).isFile();
|
|
134706
|
+
const isDir2 = import_node_fs9.default.statSync(content).isDirectory();
|
|
134558
134707
|
if (isFile2 && await isValidSourceFile({ config, files, source: content })) {
|
|
134559
134708
|
files.push(import_node_path9.default.resolve(content));
|
|
134560
134709
|
} else if (isDir2 && config.recursive) {
|
|
@@ -134575,7 +134724,7 @@ async function parseTests({ config, files }) {
|
|
|
134575
134724
|
let rawContent;
|
|
134576
134725
|
if (extension === "json" || extension === "yaml" || extension === "yml") {
|
|
134577
134726
|
try {
|
|
134578
|
-
rawContent = await
|
|
134727
|
+
rawContent = await import_node_fs9.default.promises.readFile(file, "utf8");
|
|
134579
134728
|
if (extension === "json") {
|
|
134580
134729
|
content = JSON.parse(rawContent);
|
|
134581
134730
|
} else {
|
|
@@ -136221,7 +136370,7 @@ async function waitForDOMStable(driver, idleTime, timeout) {
|
|
|
136221
136370
|
// dist/core/tests/runShell.js
|
|
136222
136371
|
init_validate();
|
|
136223
136372
|
init_utils();
|
|
136224
|
-
var
|
|
136373
|
+
var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
136225
136374
|
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
136226
136375
|
async function runShell({ config, step }) {
|
|
136227
136376
|
const result = {
|
|
@@ -136296,23 +136445,23 @@ async function runShell({ config, step }) {
|
|
|
136296
136445
|
}
|
|
136297
136446
|
if (step.runShell.path) {
|
|
136298
136447
|
const dir = import_node_path10.default.dirname(step.runShell.path);
|
|
136299
|
-
if (!
|
|
136300
|
-
|
|
136448
|
+
if (!import_node_fs10.default.existsSync(dir)) {
|
|
136449
|
+
import_node_fs10.default.mkdirSync(dir, { recursive: true });
|
|
136301
136450
|
}
|
|
136302
136451
|
let filePath = step.runShell.path;
|
|
136303
136452
|
log(config, "debug", `Saving stdio to file: ${filePath}`);
|
|
136304
|
-
if (!
|
|
136305
|
-
|
|
136453
|
+
if (!import_node_fs10.default.existsSync(filePath)) {
|
|
136454
|
+
import_node_fs10.default.writeFileSync(filePath, result.outputs.stdio.stdout);
|
|
136306
136455
|
} else {
|
|
136307
136456
|
if (step.runShell.overwrite == "false") {
|
|
136308
136457
|
result.description = result.description + ` Didn't save output. File already exists.`;
|
|
136309
136458
|
}
|
|
136310
|
-
const existingFile =
|
|
136459
|
+
const existingFile = import_node_fs10.default.readFileSync(filePath, "utf8");
|
|
136311
136460
|
const fractionalDiff = calculateFractionalDifference(existingFile, result.outputs.stdio.stdout);
|
|
136312
136461
|
log(config, "debug", `Fractional difference: ${fractionalDiff}`);
|
|
136313
136462
|
if (fractionalDiff > step.runShell.maxVariation) {
|
|
136314
136463
|
if (step.runShell.overwrite == "aboveVariation") {
|
|
136315
|
-
|
|
136464
|
+
import_node_fs10.default.writeFileSync(filePath, result.outputs.stdio.stdout);
|
|
136316
136465
|
result.description += ` Saved output to file.`;
|
|
136317
136466
|
}
|
|
136318
136467
|
result.status = "WARNING";
|
|
@@ -136320,7 +136469,7 @@ async function runShell({ config, step }) {
|
|
|
136320
136469
|
return result;
|
|
136321
136470
|
}
|
|
136322
136471
|
if (step.runShell.overwrite == "true") {
|
|
136323
|
-
|
|
136472
|
+
import_node_fs10.default.writeFileSync(filePath, result.outputs.stdio.stdout);
|
|
136324
136473
|
result.description += ` Saved output to file.`;
|
|
136325
136474
|
}
|
|
136326
136475
|
}
|
|
@@ -136505,7 +136654,7 @@ async function checkLink({ config, step }) {
|
|
|
136505
136654
|
init_validate();
|
|
136506
136655
|
init_utils();
|
|
136507
136656
|
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
136508
|
-
var
|
|
136657
|
+
var import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
136509
136658
|
init_loader();
|
|
136510
136659
|
var _pngjs = null;
|
|
136511
136660
|
var _sharp = null;
|
|
@@ -136632,8 +136781,8 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136632
136781
|
const rawBase = import_node_path11.default.basename(urlPathname.split("?")[0].split("#")[0].replace(/\\/g, "/"));
|
|
136633
136782
|
const safeBase = sanitizeFilesystemName(rawBase, `${step.stepId}.png`);
|
|
136634
136783
|
dir = import_node_path11.default.join(process.cwd(), "doc-detective-runs", getOrInitRunTimestamp(config));
|
|
136635
|
-
if (!
|
|
136636
|
-
|
|
136784
|
+
if (!import_node_fs11.default.existsSync(dir)) {
|
|
136785
|
+
import_node_fs11.default.mkdirSync(dir, { recursive: true });
|
|
136637
136786
|
}
|
|
136638
136787
|
const captureId = `${step.stepId || "screenshot"}_${Date.now()}`;
|
|
136639
136788
|
filePath = import_node_path11.default.join(dir, `${captureId}_${safeBase}`);
|
|
@@ -136649,10 +136798,10 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136649
136798
|
}
|
|
136650
136799
|
} else {
|
|
136651
136800
|
dir = import_node_path11.default.dirname(step.screenshot.path);
|
|
136652
|
-
if (!
|
|
136653
|
-
|
|
136801
|
+
if (!import_node_fs11.default.existsSync(dir)) {
|
|
136802
|
+
import_node_fs11.default.mkdirSync(dir, { recursive: true });
|
|
136654
136803
|
}
|
|
136655
|
-
if (
|
|
136804
|
+
if (import_node_fs11.default.existsSync(filePath)) {
|
|
136656
136805
|
if (step.screenshot.overwrite == "false") {
|
|
136657
136806
|
result.status = "SKIPPED";
|
|
136658
136807
|
result.description = `File already exists: ${filePath}`;
|
|
@@ -136748,8 +136897,8 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136748
136897
|
} catch (error) {
|
|
136749
136898
|
result.status = "FAIL";
|
|
136750
136899
|
result.description = `Couldn't save screenshot. ${error}`;
|
|
136751
|
-
if (existFilePath && filePath !== existFilePath &&
|
|
136752
|
-
|
|
136900
|
+
if (existFilePath && filePath !== existFilePath && import_node_fs11.default.existsSync(filePath)) {
|
|
136901
|
+
import_node_fs11.default.unlinkSync(filePath);
|
|
136753
136902
|
}
|
|
136754
136903
|
return result;
|
|
136755
136904
|
}
|
|
@@ -136801,12 +136950,12 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136801
136950
|
width: rect.width,
|
|
136802
136951
|
height: rect.height
|
|
136803
136952
|
}).toFile(croppedPath);
|
|
136804
|
-
|
|
136953
|
+
import_node_fs11.default.renameSync(croppedPath, filePath);
|
|
136805
136954
|
} catch (error) {
|
|
136806
136955
|
result.status = "FAIL";
|
|
136807
136956
|
result.description = `Couldn't crop image. ${error}`;
|
|
136808
|
-
if (existFilePath && filePath !== existFilePath &&
|
|
136809
|
-
|
|
136957
|
+
if (existFilePath && filePath !== existFilePath && import_node_fs11.default.existsSync(filePath)) {
|
|
136958
|
+
import_node_fs11.default.unlinkSync(filePath);
|
|
136810
136959
|
}
|
|
136811
136960
|
return result;
|
|
136812
136961
|
}
|
|
@@ -136814,7 +136963,7 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136814
136963
|
if (existFilePath) {
|
|
136815
136964
|
if (step.screenshot.overwrite == "true" && !isUrlPath) {
|
|
136816
136965
|
result.description += ` Overwrote existing file.`;
|
|
136817
|
-
|
|
136966
|
+
import_node_fs11.default.renameSync(filePath, existFilePath);
|
|
136818
136967
|
result.outputs.screenshotPath = existFilePath;
|
|
136819
136968
|
result.outputs.changed = true;
|
|
136820
136969
|
if (step.screenshot.sourceIntegration) {
|
|
@@ -136827,21 +136976,21 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136827
136976
|
let img1;
|
|
136828
136977
|
let img2;
|
|
136829
136978
|
try {
|
|
136830
|
-
img1 = PNG.sync.read(
|
|
136831
|
-
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));
|
|
136832
136981
|
} catch (error) {
|
|
136833
136982
|
result.status = "FAIL";
|
|
136834
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}`;
|
|
136835
|
-
if (!isUrlPath && filePath !== existFilePath &&
|
|
136836
|
-
|
|
136984
|
+
if (!isUrlPath && filePath !== existFilePath && import_node_fs11.default.existsSync(filePath)) {
|
|
136985
|
+
import_node_fs11.default.unlinkSync(filePath);
|
|
136837
136986
|
}
|
|
136838
136987
|
return result;
|
|
136839
136988
|
}
|
|
136840
136989
|
if (!aspectRatiosMatch(img1, img2)) {
|
|
136841
136990
|
result.status = "FAIL";
|
|
136842
136991
|
result.description = `Couldn't compare images. Images have different aspect ratios.`;
|
|
136843
|
-
if (!isUrlPath && filePath !== existFilePath &&
|
|
136844
|
-
|
|
136992
|
+
if (!isUrlPath && filePath !== existFilePath && import_node_fs11.default.existsSync(filePath)) {
|
|
136993
|
+
import_node_fs11.default.unlinkSync(filePath);
|
|
136845
136994
|
}
|
|
136846
136995
|
return result;
|
|
136847
136996
|
}
|
|
@@ -136868,8 +137017,8 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136868
137017
|
} catch (error) {
|
|
136869
137018
|
result.status = "FAIL";
|
|
136870
137019
|
result.description = `Couldn't load screenshot comparison dependency (pixelmatch). ${error?.message ?? error}`;
|
|
136871
|
-
if (!isUrlPath && filePath !== existFilePath &&
|
|
136872
|
-
|
|
137020
|
+
if (!isUrlPath && filePath !== existFilePath && import_node_fs11.default.existsSync(filePath)) {
|
|
137021
|
+
import_node_fs11.default.unlinkSync(filePath);
|
|
136873
137022
|
}
|
|
136874
137023
|
return result;
|
|
136875
137024
|
}
|
|
@@ -136882,7 +137031,7 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136882
137031
|
});
|
|
136883
137032
|
if (fractionalDiff > step.screenshot.maxVariation) {
|
|
136884
137033
|
if (step.screenshot.overwrite == "aboveVariation" && !isUrlPath) {
|
|
136885
|
-
|
|
137034
|
+
import_node_fs11.default.renameSync(filePath, existFilePath);
|
|
136886
137035
|
}
|
|
136887
137036
|
result.status = "WARNING";
|
|
136888
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}).`;
|
|
@@ -136908,7 +137057,7 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136908
137057
|
result.outputs.sourceIntegration = step.screenshot.sourceIntegration;
|
|
136909
137058
|
}
|
|
136910
137059
|
if (step.screenshot.overwrite != "true") {
|
|
136911
|
-
|
|
137060
|
+
import_node_fs11.default.unlinkSync(filePath);
|
|
136912
137061
|
}
|
|
136913
137062
|
}
|
|
136914
137063
|
}
|
|
@@ -136928,7 +137077,7 @@ async function saveScreenshot({ config, step, driver }) {
|
|
|
136928
137077
|
init_validate();
|
|
136929
137078
|
init_utils();
|
|
136930
137079
|
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
136931
|
-
var
|
|
137080
|
+
var import_node_fs12 = __toESM(require("node:fs"), 1);
|
|
136932
137081
|
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
136933
137082
|
async function startRecording({ config, context, step, driver }) {
|
|
136934
137083
|
let result = {
|
|
@@ -136966,10 +137115,10 @@ async function startRecording({ config, context, step, driver }) {
|
|
|
136966
137115
|
let filePath = step.record.path;
|
|
136967
137116
|
const baseName = import_node_path12.default.basename(filePath, import_node_path12.default.extname(filePath));
|
|
136968
137117
|
const dir = import_node_path12.default.dirname(step.record.path);
|
|
136969
|
-
if (!
|
|
136970
|
-
|
|
137118
|
+
if (!import_node_fs12.default.existsSync(dir)) {
|
|
137119
|
+
import_node_fs12.default.mkdirSync(dir, { recursive: true });
|
|
136971
137120
|
}
|
|
136972
|
-
if (
|
|
137121
|
+
if (import_node_fs12.default.existsSync(filePath) && step.record.overwrite == "false") {
|
|
136973
137122
|
result.status = "SKIPPED";
|
|
136974
137123
|
result.description = `File already exists: ${filePath}`;
|
|
136975
137124
|
return result;
|
|
@@ -137093,7 +137242,7 @@ init_validate();
|
|
|
137093
137242
|
init_utils();
|
|
137094
137243
|
var import_node_child_process4 = require("node:child_process");
|
|
137095
137244
|
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
137096
|
-
var
|
|
137245
|
+
var import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
137097
137246
|
init_loader();
|
|
137098
137247
|
async function getFfmpegPath(ctx = {}) {
|
|
137099
137248
|
const mod = await loadHeavyDep("@ffmpeg-installer/ffmpeg", { ctx });
|
|
@@ -137142,11 +137291,11 @@ async function stopRecording({ config, step, driver }) {
|
|
|
137142
137291
|
window.recorder.stop();
|
|
137143
137292
|
});
|
|
137144
137293
|
let waitCount = 0;
|
|
137145
|
-
while (!
|
|
137294
|
+
while (!import_node_fs13.default.existsSync(config.recording.downloadPath) && waitCount < 60) {
|
|
137146
137295
|
await new Promise((r) => setTimeout(r, 1e3));
|
|
137147
137296
|
waitCount++;
|
|
137148
137297
|
}
|
|
137149
|
-
if (!
|
|
137298
|
+
if (!import_node_fs13.default.existsSync(config.recording.downloadPath)) {
|
|
137150
137299
|
result.status = "FAIL";
|
|
137151
137300
|
result.description = "Recording download timed out.";
|
|
137152
137301
|
return result;
|
|
@@ -137171,7 +137320,7 @@ async function stopRecording({ config, step, driver }) {
|
|
|
137171
137320
|
if (code === 0) {
|
|
137172
137321
|
if (targetPath !== downloadPath) {
|
|
137173
137322
|
try {
|
|
137174
|
-
|
|
137323
|
+
import_node_fs13.default.unlinkSync(downloadPath);
|
|
137175
137324
|
} catch {
|
|
137176
137325
|
}
|
|
137177
137326
|
}
|
|
@@ -137217,7 +137366,7 @@ async function loadVariables({ step }) {
|
|
|
137217
137366
|
init_validate();
|
|
137218
137367
|
init_utils();
|
|
137219
137368
|
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
137220
|
-
var
|
|
137369
|
+
var import_node_fs14 = __toESM(require("node:fs"), 1);
|
|
137221
137370
|
async function saveCookie({ config, step, driver }) {
|
|
137222
137371
|
let result = {
|
|
137223
137372
|
status: "PASS",
|
|
@@ -137284,14 +137433,14 @@ async function saveCookie({ config, step, driver }) {
|
|
|
137284
137433
|
if (filePath) {
|
|
137285
137434
|
const outputDirectory = directory || config.output || process.cwd();
|
|
137286
137435
|
const fullPath = import_node_path14.default.resolve(outputDirectory, filePath);
|
|
137287
|
-
if (
|
|
137436
|
+
if (import_node_fs14.default.existsSync(fullPath) && !(overwrite === true || overwrite === "true")) {
|
|
137288
137437
|
result.status = "FAIL";
|
|
137289
137438
|
result.description = `File '${fullPath}' already exists and overwrite is not enabled.`;
|
|
137290
137439
|
return result;
|
|
137291
137440
|
}
|
|
137292
137441
|
const dir = import_node_path14.default.dirname(fullPath);
|
|
137293
|
-
if (!
|
|
137294
|
-
|
|
137442
|
+
if (!import_node_fs14.default.existsSync(dir)) {
|
|
137443
|
+
import_node_fs14.default.mkdirSync(dir, { recursive: true });
|
|
137295
137444
|
}
|
|
137296
137445
|
if (targetCookie) {
|
|
137297
137446
|
const netscapeCookie = formatCookieForNetscape(targetCookie);
|
|
@@ -137299,11 +137448,11 @@ async function saveCookie({ config, step, driver }) {
|
|
|
137299
137448
|
# This is a cookie file saved by Doc Detective
|
|
137300
137449
|
${netscapeCookie}
|
|
137301
137450
|
`;
|
|
137302
|
-
|
|
137451
|
+
import_node_fs14.default.writeFileSync(fullPath, content, "utf8");
|
|
137303
137452
|
result.description = `Saved cookie '${cookieName}' to '${fullPath}'.`;
|
|
137304
137453
|
log(config, "debug", `Saved cookie '${cookieName}' to file: ${fullPath}`);
|
|
137305
137454
|
} else {
|
|
137306
|
-
|
|
137455
|
+
import_node_fs14.default.writeFileSync(fullPath, "# No cookie data\n", "utf8");
|
|
137307
137456
|
result.description = `Created empty cookie file at '${fullPath}'.`;
|
|
137308
137457
|
log(config, "debug", `Created empty cookie file: ${fullPath}`);
|
|
137309
137458
|
}
|
|
@@ -137331,7 +137480,7 @@ function formatCookieForNetscape(cookie) {
|
|
|
137331
137480
|
init_validate();
|
|
137332
137481
|
init_utils();
|
|
137333
137482
|
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
137334
|
-
var
|
|
137483
|
+
var import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
137335
137484
|
async function loadCookie({ config, step, driver }) {
|
|
137336
137485
|
let result = {
|
|
137337
137486
|
status: "PASS",
|
|
@@ -137387,13 +137536,13 @@ async function loadCookie({ config, step, driver }) {
|
|
|
137387
137536
|
} else if (filePath) {
|
|
137388
137537
|
const inputDirectory = directory || config.output || process.cwd();
|
|
137389
137538
|
const fullPath = import_node_path15.default.resolve(inputDirectory, filePath);
|
|
137390
|
-
if (!
|
|
137539
|
+
if (!import_node_fs15.default.existsSync(fullPath)) {
|
|
137391
137540
|
result.status = "FAIL";
|
|
137392
137541
|
result.description = `Cookie file '${fullPath}' not found`;
|
|
137393
137542
|
return result;
|
|
137394
137543
|
}
|
|
137395
137544
|
try {
|
|
137396
|
-
const fileContent =
|
|
137545
|
+
const fileContent = import_node_fs15.default.readFileSync(fullPath, "utf8");
|
|
137397
137546
|
const cookies = parseNetscapeCookieFile(fileContent);
|
|
137398
137547
|
if (cookies.length === 0) {
|
|
137399
137548
|
result.status = "FAIL";
|
|
@@ -137559,7 +137708,7 @@ function isDomainCompatible(currentDomain, cookieDomain) {
|
|
|
137559
137708
|
// dist/core/tests/httpRequest.js
|
|
137560
137709
|
init_validate();
|
|
137561
137710
|
var import_axios5 = __toESM(require("axios"), 1);
|
|
137562
|
-
var
|
|
137711
|
+
var import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
137563
137712
|
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
137564
137713
|
var import_ajv2 = __toESM(require("ajv"), 1);
|
|
137565
137714
|
init_openapi();
|
|
@@ -137866,24 +138015,24 @@ async function httpRequest({ config, step, openApiDefinitions = [] }) {
|
|
|
137866
138015
|
}
|
|
137867
138016
|
if (step.httpRequest.path) {
|
|
137868
138017
|
const dir = import_node_path16.default.dirname(step.httpRequest.path);
|
|
137869
|
-
if (!
|
|
137870
|
-
|
|
138018
|
+
if (!import_node_fs16.default.existsSync(dir)) {
|
|
138019
|
+
import_node_fs16.default.mkdirSync(dir, { recursive: true });
|
|
137871
138020
|
}
|
|
137872
138021
|
let filePath = step.httpRequest.path;
|
|
137873
138022
|
log(config, "debug", `Saving output to file: ${filePath}`);
|
|
137874
|
-
if (!
|
|
137875
|
-
await
|
|
138023
|
+
if (!import_node_fs16.default.existsSync(filePath)) {
|
|
138024
|
+
await import_node_fs16.default.promises.writeFile(filePath, JSON.stringify(response.data, null, 2));
|
|
137876
138025
|
result.description += ` Saved output to file.`;
|
|
137877
138026
|
} else {
|
|
137878
138027
|
if (step.httpRequest.overwrite == "false") {
|
|
137879
138028
|
result.description += ` Didn't save output. File already exists.`;
|
|
137880
138029
|
}
|
|
137881
|
-
const existingFile =
|
|
138030
|
+
const existingFile = import_node_fs16.default.readFileSync(filePath, "utf8");
|
|
137882
138031
|
const fractionalDiff = calculateFractionalDifference(existingFile, JSON.stringify(response.data, null, 2));
|
|
137883
138032
|
log(config, "debug", `Fractional difference: ${fractionalDiff}`);
|
|
137884
138033
|
if (fractionalDiff > step.httpRequest.maxVariation) {
|
|
137885
138034
|
if (step.httpRequest.overwrite == "aboveVariation") {
|
|
137886
|
-
await
|
|
138035
|
+
await import_node_fs16.default.promises.writeFile(filePath, JSON.stringify(response.data, null, 2));
|
|
137887
138036
|
result.description += ` Saved response to file.`;
|
|
137888
138037
|
}
|
|
137889
138038
|
result.status = "WARNING";
|
|
@@ -137891,7 +138040,7 @@ async function httpRequest({ config, step, openApiDefinitions = [] }) {
|
|
|
137891
138040
|
return result;
|
|
137892
138041
|
}
|
|
137893
138042
|
if (step.httpRequest.overwrite == "true") {
|
|
137894
|
-
|
|
138043
|
+
import_node_fs16.default.writeFileSync(filePath, JSON.stringify(response.data, null, 2));
|
|
137895
138044
|
result.description += ` Saved response to file.`;
|
|
137896
138045
|
}
|
|
137897
138046
|
}
|
|
@@ -138068,7 +138217,7 @@ async function clickElement({ config, step, driver }) {
|
|
|
138068
138217
|
// dist/core/tests/runCode.js
|
|
138069
138218
|
init_validate();
|
|
138070
138219
|
init_utils();
|
|
138071
|
-
var
|
|
138220
|
+
var import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
138072
138221
|
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
138073
138222
|
var import_node_os7 = __toESM(require("node:os"), 1);
|
|
138074
138223
|
function createTempScript(code, language) {
|
|
@@ -138092,7 +138241,7 @@ function createTempScript(code, language) {
|
|
|
138092
138241
|
const tmpDir = import_node_os7.default.tmpdir();
|
|
138093
138242
|
const tmpFile = import_node_path17.default.join(tmpDir, `doc-detective-${Date.now()}${extension}`);
|
|
138094
138243
|
try {
|
|
138095
|
-
|
|
138244
|
+
import_node_fs17.default.writeFileSync(tmpFile, code);
|
|
138096
138245
|
} catch (error) {
|
|
138097
138246
|
throw new Error(`Failed to create temporary script: ${error.message}`);
|
|
138098
138247
|
}
|
|
@@ -138176,7 +138325,7 @@ async function runCode({ config, step }) {
|
|
|
138176
138325
|
result.description = error.message;
|
|
138177
138326
|
} finally {
|
|
138178
138327
|
try {
|
|
138179
|
-
|
|
138328
|
+
import_node_fs17.default.unlinkSync(scriptPath);
|
|
138180
138329
|
log(config, "debug", `Removed temporary script: ${scriptPath}`);
|
|
138181
138330
|
} catch (error) {
|
|
138182
138331
|
log(config, "warn", `Failed to remove temporary script: ${scriptPath}`);
|