@piwitests/reporter 0.51.0 → 0.52.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.
@@ -807,14 +807,22 @@ function baseUrlFromConfig(config) {
807
807
  return null;
808
808
  }
809
809
  var INSTRUMENTATION_FETCH_TIMEOUT_MS = 5e3;
810
+ function instrumentationManifestUrls(baseUrl) {
811
+ const base = new URL(baseUrl);
812
+ const root = new URL(INSTRUMENTATION_MANIFEST_PATH, base).toString();
813
+ const path6 = base.pathname.replace(/\/+$/, "");
814
+ return path6 ? [new URL(`${path6}${INSTRUMENTATION_MANIFEST_PATH}`, base).toString(), root] : [root];
815
+ }
810
816
  async function fetchInstrumentationManifest(baseUrl, fetchImpl = fetch) {
811
817
  try {
812
818
  const probe = await fetchImpl(baseUrl, { signal: AbortSignal.timeout(INSTRUMENTATION_FETCH_TIMEOUT_MS) });
813
819
  if (!hasInstrumentationHeader(probe.headers)) return null;
814
- const manifestUrl = new URL(INSTRUMENTATION_MANIFEST_PATH, baseUrl).toString();
815
- const res = await fetchImpl(manifestUrl, { signal: AbortSignal.timeout(INSTRUMENTATION_FETCH_TIMEOUT_MS) });
816
- if (!res.ok) return null;
817
- return parseManifestJson(await res.text());
820
+ for (const manifestUrl of instrumentationManifestUrls(baseUrl)) {
821
+ const res = await fetchImpl(manifestUrl, { signal: AbortSignal.timeout(INSTRUMENTATION_FETCH_TIMEOUT_MS) });
822
+ const manifest = res.ok ? parseManifestJson(await res.text()) : null;
823
+ if (manifest) return manifest;
824
+ }
825
+ return null;
818
826
  } catch {
819
827
  return null;
820
828
  }
package/dist/index.js CHANGED
@@ -3990,14 +3990,22 @@ function baseUrlFromConfig(config) {
3990
3990
  return null;
3991
3991
  }
3992
3992
  var INSTRUMENTATION_FETCH_TIMEOUT_MS = 5e3;
3993
+ function instrumentationManifestUrls(baseUrl) {
3994
+ const base = new URL(baseUrl);
3995
+ const root = new URL(INSTRUMENTATION_MANIFEST_PATH, base).toString();
3996
+ const path32 = base.pathname.replace(/\/+$/, "");
3997
+ return path32 ? [new URL(`${path32}${INSTRUMENTATION_MANIFEST_PATH}`, base).toString(), root] : [root];
3998
+ }
3993
3999
  async function fetchInstrumentationManifest(baseUrl, fetchImpl = fetch) {
3994
4000
  try {
3995
4001
  const probe = await fetchImpl(baseUrl, { signal: AbortSignal.timeout(INSTRUMENTATION_FETCH_TIMEOUT_MS) });
3996
4002
  if (!hasInstrumentationHeader(probe.headers)) return null;
3997
- const manifestUrl = new URL(INSTRUMENTATION_MANIFEST_PATH, baseUrl).toString();
3998
- const res = await fetchImpl(manifestUrl, { signal: AbortSignal.timeout(INSTRUMENTATION_FETCH_TIMEOUT_MS) });
3999
- if (!res.ok) return null;
4000
- return parseManifestJson(await res.text());
4003
+ for (const manifestUrl of instrumentationManifestUrls(baseUrl)) {
4004
+ const res = await fetchImpl(manifestUrl, { signal: AbortSignal.timeout(INSTRUMENTATION_FETCH_TIMEOUT_MS) });
4005
+ const manifest = res.ok ? parseManifestJson(await res.text()) : null;
4006
+ if (manifest) return manifest;
4007
+ }
4008
+ return null;
4001
4009
  } catch {
4002
4010
  return null;
4003
4011
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piwitests/reporter",
3
- "version": "0.51.0",
3
+ "version": "0.52.0",
4
4
  "description": "Playwright reporter that streams results, traces and HTML reports to a Piwi Dashboard instance",
5
5
  "url": "https://github.com/PiwiTests/platform",
6
6
  "homepage": "https://piwitests.dev",