@ogcio/o11y-sdk-react 0.4.0 → 0.6.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/sdk-core/index.d.ts +2 -0
- package/dist/sdk-core/index.d.ts.map +1 -0
- package/dist/sdk-core/index.js +2 -0
- package/dist/sdk-core/index.js.map +1 -0
- package/dist/sdk-core/lib/index.d.ts +3 -0
- package/dist/sdk-core/lib/index.d.ts.map +1 -0
- package/dist/sdk-core/lib/index.js +3 -0
- package/dist/sdk-core/lib/index.js.map +1 -0
- package/dist/sdk-core/lib/redaction/basic-redactor.d.ts +8 -0
- package/dist/sdk-core/lib/redaction/basic-redactor.d.ts.map +1 -0
- package/dist/sdk-core/lib/redaction/basic-redactor.js +19 -0
- package/dist/sdk-core/lib/redaction/basic-redactor.js.map +1 -0
- package/dist/sdk-core/lib/redaction/email-redactor.d.ts +9 -0
- package/dist/sdk-core/lib/redaction/email-redactor.d.ts.map +1 -0
- package/dist/sdk-core/lib/redaction/email-redactor.js +18 -0
- package/dist/sdk-core/lib/redaction/email-redactor.js.map +1 -0
- package/dist/sdk-core/lib/redaction/index.d.ts +10 -0
- package/dist/sdk-core/lib/redaction/index.d.ts.map +1 -0
- package/dist/sdk-core/lib/redaction/index.js +5 -0
- package/dist/sdk-core/lib/redaction/index.js.map +1 -0
- package/dist/sdk-core/lib/redaction/ip-redactor.d.ts +10 -0
- package/dist/sdk-core/lib/redaction/ip-redactor.d.ts.map +1 -0
- package/dist/sdk-core/lib/redaction/ip-redactor.js +24 -0
- package/dist/sdk-core/lib/redaction/ip-redactor.js.map +1 -0
- package/dist/sdk-core/lib/redaction/ppsn-redactor.d.ts +9 -0
- package/dist/sdk-core/lib/redaction/ppsn-redactor.d.ts.map +1 -0
- package/dist/sdk-core/lib/redaction/ppsn-redactor.js +18 -0
- package/dist/sdk-core/lib/redaction/ppsn-redactor.js.map +1 -0
- package/dist/sdk-core/lib/utils/data-structures.d.ts +16 -0
- package/dist/sdk-core/lib/utils/data-structures.d.ts.map +1 -0
- package/dist/sdk-core/lib/utils/data-structures.js +58 -0
- package/dist/sdk-core/lib/utils/data-structures.js.map +1 -0
- package/dist/sdk-core/lib/utils/index.d.ts +3 -0
- package/dist/sdk-core/lib/utils/index.d.ts.map +1 -0
- package/dist/sdk-core/lib/utils/index.js +3 -0
- package/dist/sdk-core/lib/utils/index.js.map +1 -0
- package/dist/sdk-core/lib/utils/string-decoding.d.ts +8 -0
- package/dist/sdk-core/lib/utils/string-decoding.d.ts.map +1 -0
- package/dist/sdk-core/lib/utils/string-decoding.js +23 -0
- package/dist/sdk-core/lib/utils/string-decoding.js.map +1 -0
- package/dist/sdk-react/index.d.ts +7 -0
- package/dist/sdk-react/index.d.ts.map +1 -0
- package/dist/{index.js → sdk-react/index.js} +1 -0
- package/dist/sdk-react/index.js.map +1 -0
- package/dist/{lib → sdk-react/lib}/index.d.ts +12 -0
- package/dist/sdk-react/lib/index.d.ts.map +1 -0
- package/dist/sdk-react/lib/index.js +2 -0
- package/dist/sdk-react/lib/index.js.map +1 -0
- package/dist/{lib → sdk-react/lib}/instrumentation.faro.d.ts +1 -0
- package/dist/sdk-react/lib/instrumentation.faro.d.ts.map +1 -0
- package/dist/{lib → sdk-react/lib}/instrumentation.faro.js +7 -1
- package/dist/sdk-react/lib/instrumentation.faro.js.map +1 -0
- package/dist/sdk-react/lib/internals/hooks.d.ts +4 -0
- package/dist/sdk-react/lib/internals/hooks.d.ts.map +1 -0
- package/dist/sdk-react/lib/internals/hooks.js +8 -0
- package/dist/sdk-react/lib/internals/hooks.js.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/email.d.ts +6 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/email.d.ts.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/email.js +22 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/email.js.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/index.d.ts +5 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/index.d.ts.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/index.js +9 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/index.js.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ip.d.ts +6 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ip.d.ts.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ip.js +23 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ip.js.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.d.ts +8 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.d.ts.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.js +21 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.js.map +1 -0
- package/dist/{vitest.config.d.ts → sdk-react/vitest.config.d.ts} +1 -0
- package/dist/sdk-react/vitest.config.d.ts.map +1 -0
- package/dist/{vitest.config.js → sdk-react/vitest.config.js} +3 -2
- package/dist/sdk-react/vitest.config.js.map +1 -0
- package/package.json +13 -9
- package/CHANGELOG.md +0 -77
- package/dist/index.d.ts +0 -5
- package/dist/lib/index.js +0 -1
- package/dist/lib/internals/hooks.d.ts +0 -3
- package/dist/lib/internals/hooks.js +0 -34
- package/dist/lib/internals/redaction/pii-detection.d.ts +0 -19
- package/dist/lib/internals/redaction/pii-detection.js +0 -39
- package/dist/lib/internals/redaction/redactors/email.d.ts +0 -8
- package/dist/lib/internals/redaction/redactors/email.js +0 -55
- package/dist/lib/internals/redaction/redactors/index.d.ts +0 -4
- package/dist/lib/internals/redaction/redactors/index.js +0 -6
- package/dist/lib/internals/redaction/redactors/ip.d.ts +0 -10
- package/dist/lib/internals/redaction/redactors/ip.js +0 -61
- package/index.ts +0 -10
- package/lib/index.ts +0 -63
- package/lib/instrumentation.faro.ts +0 -102
- package/lib/internals/hooks.ts +0 -55
- package/lib/internals/redaction/pii-detection.ts +0 -52
- package/lib/internals/redaction/redactors/email.ts +0 -68
- package/lib/internals/redaction/redactors/index.ts +0 -12
- package/lib/internals/redaction/redactors/ip.ts +0 -78
- package/test/config.test.ts +0 -215
- package/test/lib/hooks.test.ts +0 -150
- package/test/lib/internals/redactors/email.test.ts +0 -81
- package/test/lib/internals/redactors/ip.test.ts +0 -86
- package/test/lib/pii-detection.test.ts +0 -79
- package/test/validation.test.ts +0 -65
- package/tsconfig.json +0 -14
- package/vitest.config.ts +0 -26
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi, beforeEach, afterAll } from "vitest";
|
|
2
|
-
|
|
3
|
-
import { emailRedactor } from "../../../../lib/internals/redaction/redactors/email";
|
|
4
|
-
import { ipRedactor } from "../../../../lib/internals/redaction/redactors/ip";
|
|
5
|
-
import { faro, TransportItemType } from "@grafana/faro-web-sdk";
|
|
6
|
-
|
|
7
|
-
// Mock faro.api.pushMeasurement
|
|
8
|
-
vi.mock("@grafana/faro-web-sdk", async () => {
|
|
9
|
-
const actual = await vi.importActual<any>("@grafana/faro-web-sdk");
|
|
10
|
-
return {
|
|
11
|
-
...actual,
|
|
12
|
-
faro: {
|
|
13
|
-
api: {
|
|
14
|
-
pushMeasurement: vi.fn(),
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe("Email Redaction utils", () => {
|
|
21
|
-
afterAll(() => {
|
|
22
|
-
vi.restoreAllMocks();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe("tracks metrics", () => {
|
|
26
|
-
beforeEach(() => {
|
|
27
|
-
vi.clearAllMocks();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("redacts plain PII and tracks redaction with metric", () => {
|
|
31
|
-
const input = "admin@example.com";
|
|
32
|
-
const output = emailRedactor(input, "log", "string");
|
|
33
|
-
|
|
34
|
-
expect(output).toBe("[REDACTED EMAIL]");
|
|
35
|
-
expect(faro.api.pushMeasurement).toHaveBeenCalledWith(
|
|
36
|
-
{
|
|
37
|
-
type: "faro_o11y_pii_redaction",
|
|
38
|
-
values: { redacted: 1 },
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
context: {
|
|
42
|
-
pii_type: "email",
|
|
43
|
-
redaction_source: TransportItemType.LOG,
|
|
44
|
-
pii_email_domain: "example.com",
|
|
45
|
-
pii_format: "string",
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it("handles strings without PII unchanged", () => {
|
|
52
|
-
const input = "hello world";
|
|
53
|
-
const output = ipRedactor(input, "log", "string");
|
|
54
|
-
|
|
55
|
-
expect(output).toBe("hello world");
|
|
56
|
-
expect(faro.api.pushMeasurement).not.toHaveBeenCalled();
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
describe("Redacts email addresses", () => {
|
|
61
|
-
it.each`
|
|
62
|
-
value | expectedRedactedValue
|
|
63
|
-
${"user+tag@example.com"} | ${"[REDACTED EMAIL]"}
|
|
64
|
-
${"user.name+tag+sorting@example.com"} | ${"[REDACTED EMAIL]"}
|
|
65
|
-
${"x@example.museum"} | ${"[REDACTED EMAIL]"}
|
|
66
|
-
${"a.b-c_d@example.co.uk"} | ${"[REDACTED EMAIL]"}
|
|
67
|
-
${"üser@example.de"} | ${"[REDACTED EMAIL]"}
|
|
68
|
-
${"john.doe@xn--exmple-cua.com"} | ${"[REDACTED EMAIL]"}
|
|
69
|
-
${"üser@example.de"} | ${"[REDACTED EMAIL]"}
|
|
70
|
-
${"plainaddress"} | ${"plainaddress"}
|
|
71
|
-
${"@missinglocal.org"} | ${"@missinglocal.org"}
|
|
72
|
-
${"user@invalid_domain.com"} | ${"user@invalid_domain.com"}
|
|
73
|
-
`(
|
|
74
|
-
"returns $expectedRedactedValue for value '$value'",
|
|
75
|
-
async ({ value, expectedRedactedValue }: Record<string, string>) => {
|
|
76
|
-
const result = emailRedactor(value, "log", "string");
|
|
77
|
-
expect(result).toBe(expectedRedactedValue);
|
|
78
|
-
},
|
|
79
|
-
);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi, afterAll } from "vitest";
|
|
2
|
-
|
|
3
|
-
import { faro } from "@grafana/faro-web-sdk";
|
|
4
|
-
import { ipRedactor } from "../../../../lib/internals/redaction/redactors/ip";
|
|
5
|
-
|
|
6
|
-
// Mock faro.api.pushMeasurement
|
|
7
|
-
vi.mock("@grafana/faro-web-sdk", async () => {
|
|
8
|
-
const actual = await vi.importActual<any>("@grafana/faro-web-sdk");
|
|
9
|
-
return {
|
|
10
|
-
...actual,
|
|
11
|
-
faro: {
|
|
12
|
-
api: {
|
|
13
|
-
pushMeasurement: vi.fn(),
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
describe("IP Redaction utils", () => {
|
|
20
|
-
afterAll(() => {
|
|
21
|
-
vi.restoreAllMocks();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
describe("tracks metrics", () => {
|
|
25
|
-
it("redacts plain PII and tracks redaction with metric", () => {
|
|
26
|
-
const input = "255.255.255.255";
|
|
27
|
-
const output = ipRedactor(input, "log", "string");
|
|
28
|
-
|
|
29
|
-
expect(output).toBe("[REDACTED IPV4]");
|
|
30
|
-
expect(faro.api.pushMeasurement).toHaveBeenCalledWith(
|
|
31
|
-
{
|
|
32
|
-
type: "faro_o11y_pii_redaction",
|
|
33
|
-
values: {
|
|
34
|
-
redacted: 1,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
context: {
|
|
39
|
-
pii_format: "string",
|
|
40
|
-
pii_type: "IPv4",
|
|
41
|
-
redaction_source: "log",
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it("handles strings without PII unchanged", () => {
|
|
48
|
-
const input = "hello world";
|
|
49
|
-
const output = ipRedactor(input, "log", "string");
|
|
50
|
-
|
|
51
|
-
expect(output).toBe("hello world");
|
|
52
|
-
expect(faro.api.pushMeasurement).not.toHaveBeenCalled();
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
describe("Redacts IPv4 and IPv6", () => {
|
|
57
|
-
it.each`
|
|
58
|
-
value | expectedRedactedValue
|
|
59
|
-
${"hello world"} | ${"hello world"}
|
|
60
|
-
${"hello 127.0.0.1"} | ${"hello [REDACTED IPV4]"}
|
|
61
|
-
${"127.0.0.1, hello!"} | ${"[REDACTED IPV4], hello!"}
|
|
62
|
-
${"127.0.0.1,127.0.0.1"} | ${"[REDACTED IPV4],[REDACTED IPV4]"}
|
|
63
|
-
${"127.0.0.1127.0.0.1"} | ${"127.0.0.1127.0.0.1"}
|
|
64
|
-
${"256.1.1.1"} | ${"256.1.1.1"}
|
|
65
|
-
${"0.0.0.0!"} | ${"[REDACTED IPV4]!"}
|
|
66
|
-
${"text0.0.0.0"} | ${"text[REDACTED IPV4]"}
|
|
67
|
-
${"0.0.text0.0"} | ${"0.0.text0.0"}
|
|
68
|
-
${"2001:0db8::1"} | ${"[REDACTED IPV6]"}
|
|
69
|
-
${"::1"} | ${"[REDACTED IPV6]"}
|
|
70
|
-
${"text::1"} | ${"text[REDACTED IPV6]"}
|
|
71
|
-
${"::1text"} | ${"[REDACTED IPV6]text"}
|
|
72
|
-
${"sentence ending with f::1"} | ${"sentence ending with [REDACTED IPV6]"}
|
|
73
|
-
${"sentence ending with :::1"} | ${"sentence ending with :::1"}
|
|
74
|
-
${"2001:0DB8:85A3:0000:0000:8A2E:0370:7334::1"} | ${"2001:0DB8:85A3:0000:0000:8A2E:0370:7334::1"}
|
|
75
|
-
${"2001:0DB8:85A3:0000:text:8A2E:0370:7334"} | ${"2001:0DB8:85A3:0000:text:8A2E:0370:7334"}
|
|
76
|
-
${"2001:0db8::12001:0db8::1"} | ${"2001:0db8::12001:0db8::1"}
|
|
77
|
-
${"2001:0db8::1,2001:0db8::1"} | ${"[REDACTED IPV6],[REDACTED IPV6]"}
|
|
78
|
-
`(
|
|
79
|
-
"returns $expectedRedactedValue for value '$value'",
|
|
80
|
-
async ({ value, expectedRedactedValue }: Record<string, string>) => {
|
|
81
|
-
const result = ipRedactor(value, "log", "string");
|
|
82
|
-
expect(result).toBe(expectedRedactedValue);
|
|
83
|
-
},
|
|
84
|
-
);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { TransportItemType } from "@grafana/faro-web-sdk";
|
|
2
|
-
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
-
import { _cleanStringPII } from "../../lib/internals/redaction/pii-detection";
|
|
4
|
-
|
|
5
|
-
// Mock faro.api.pushMeasurement
|
|
6
|
-
vi.mock("@grafana/faro-web-sdk", async () => {
|
|
7
|
-
const actual = await vi.importActual<any>("@grafana/faro-web-sdk");
|
|
8
|
-
return {
|
|
9
|
-
...actual,
|
|
10
|
-
faro: {
|
|
11
|
-
api: {
|
|
12
|
-
pushMeasurement: vi.fn(),
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
import { faro } from "@grafana/faro-web-sdk";
|
|
19
|
-
import { redactors } from "../../lib/internals/redaction/redactors";
|
|
20
|
-
|
|
21
|
-
describe("_cleanStringPII", () => {
|
|
22
|
-
beforeEach(() => {
|
|
23
|
-
vi.clearAllMocks();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("should redact email and call pushMeasurement", () => {
|
|
27
|
-
const input = "Contact me at alice@example.com.";
|
|
28
|
-
const result = _cleanStringPII(input, TransportItemType.LOG, [
|
|
29
|
-
redactors.email,
|
|
30
|
-
]);
|
|
31
|
-
|
|
32
|
-
expect(result).toBe("Contact me at [REDACTED EMAIL].");
|
|
33
|
-
expect(faro.api.pushMeasurement).toHaveBeenCalledOnce();
|
|
34
|
-
expect(faro.api.pushMeasurement).toHaveBeenCalledWith(
|
|
35
|
-
{
|
|
36
|
-
type: "faro_o11y_pii_redaction",
|
|
37
|
-
values: { redacted: 1 },
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
context: {
|
|
41
|
-
pii_type: "email",
|
|
42
|
-
redaction_source: TransportItemType.LOG,
|
|
43
|
-
pii_email_domain: "example.com",
|
|
44
|
-
pii_format: "string",
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("should decode and redact URI-encoded emails", () => {
|
|
51
|
-
const encoded = "mailto%3Ajohn.doe%40gmail.com";
|
|
52
|
-
const result = _cleanStringPII(encoded, TransportItemType.EXCEPTION, [
|
|
53
|
-
redactors.email,
|
|
54
|
-
]);
|
|
55
|
-
|
|
56
|
-
expect(result).toBe("mailto:[REDACTED EMAIL]");
|
|
57
|
-
expect(faro.api.pushMeasurement).toHaveBeenCalledOnce();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it("should return same string when no email present", () => {
|
|
61
|
-
const input = "Just a normal message.";
|
|
62
|
-
const result = _cleanStringPII(input, TransportItemType.LOG, [
|
|
63
|
-
redactors.email,
|
|
64
|
-
]);
|
|
65
|
-
|
|
66
|
-
expect(result).toBe(input);
|
|
67
|
-
expect(faro.api.pushMeasurement).not.toHaveBeenCalled();
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it("should return same string when decodeURIComponent fail", () => {
|
|
71
|
-
const input = "mailto%john.doe%4gmail.com";
|
|
72
|
-
const result = _cleanStringPII(input, TransportItemType.LOG, [
|
|
73
|
-
redactors.email,
|
|
74
|
-
]);
|
|
75
|
-
|
|
76
|
-
expect(result).toBe(input);
|
|
77
|
-
expect(faro.api.pushMeasurement).not.toHaveBeenCalled();
|
|
78
|
-
});
|
|
79
|
-
});
|
package/test/validation.test.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { test, describe, assert, vi, expect } from "vitest";
|
|
2
|
-
import buildFaroInstrumentation from "../lib/instrumentation.faro.js";
|
|
3
|
-
import { Faro } from "@grafana/faro-react";
|
|
4
|
-
import { instrumentFaro } from "../index.js";
|
|
5
|
-
|
|
6
|
-
describe("validation config: should return without breaking the execution", () => {
|
|
7
|
-
test("should call buildFaroInstrumentation without config and skip instrumentation", async () => {
|
|
8
|
-
const consoleWarnSpy = vi
|
|
9
|
-
.spyOn(console, "warn")
|
|
10
|
-
.mockImplementation(vi.fn());
|
|
11
|
-
|
|
12
|
-
instrumentFaro();
|
|
13
|
-
|
|
14
|
-
expect(consoleWarnSpy).toHaveBeenCalled();
|
|
15
|
-
expect(consoleWarnSpy).toHaveBeenCalledWith(
|
|
16
|
-
"observability config not set. Skipping Faro OpenTelemetry instrumentation.",
|
|
17
|
-
);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test("faro instrumentation: url undefined", () => {
|
|
21
|
-
let sdk: Faro | undefined = undefined;
|
|
22
|
-
|
|
23
|
-
const consoleWarnSpy = vi
|
|
24
|
-
.spyOn(console, "warn")
|
|
25
|
-
.mockImplementation(vi.fn());
|
|
26
|
-
const consoleLogSpy = vi.spyOn(console, "log").mockImplementation(vi.fn());
|
|
27
|
-
|
|
28
|
-
assert.doesNotThrow(() => {
|
|
29
|
-
sdk = buildFaroInstrumentation({
|
|
30
|
-
collectorUrl: undefined!,
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
assert.equal(sdk, undefined);
|
|
35
|
-
|
|
36
|
-
expect(consoleWarnSpy).toHaveBeenCalled();
|
|
37
|
-
expect(consoleWarnSpy).toHaveBeenCalledWith(
|
|
38
|
-
"collectorUrl not set. Skipping Faro OpenTelemetry instrumentation.",
|
|
39
|
-
);
|
|
40
|
-
expect(consoleLogSpy).not.toHaveBeenCalled();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test("faro instrumentation: invalid url", () => {
|
|
44
|
-
let sdk: Faro | undefined = undefined;
|
|
45
|
-
|
|
46
|
-
const consoleErrorSpy = vi
|
|
47
|
-
.spyOn(console, "error")
|
|
48
|
-
.mockImplementation(vi.fn());
|
|
49
|
-
const consoleLogSpy = vi.spyOn(console, "log").mockImplementation(vi.fn());
|
|
50
|
-
|
|
51
|
-
assert.doesNotThrow(() => {
|
|
52
|
-
sdk = buildFaroInstrumentation({
|
|
53
|
-
collectorUrl: "notavalidURL",
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
assert.equal(sdk, undefined);
|
|
58
|
-
|
|
59
|
-
expect(consoleErrorSpy).toHaveBeenCalled();
|
|
60
|
-
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
61
|
-
"collectorUrl does not use a valid format. Skipping Faro OpenTelemetry instrumentation.",
|
|
62
|
-
);
|
|
63
|
-
expect(consoleLogSpy).not.toHaveBeenCalled();
|
|
64
|
-
});
|
|
65
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
4
|
-
"module": "NodeNext" /* Specify what module code is generated. */,
|
|
5
|
-
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
|
6
|
-
"moduleResolution": "NodeNext",
|
|
7
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
8
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
9
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
10
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
|
11
|
-
"declaration": true
|
|
12
|
-
},
|
|
13
|
-
"exclude": ["**/test/**"]
|
|
14
|
-
}
|
package/vitest.config.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vitest/config";
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
test: {
|
|
5
|
-
globals: true,
|
|
6
|
-
watch: false,
|
|
7
|
-
include: ["**/*.test.ts"],
|
|
8
|
-
exclude: ["**/fixtures/**", "**/dist/**"],
|
|
9
|
-
poolOptions: {
|
|
10
|
-
threads: {
|
|
11
|
-
maxThreads: 8,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
clearMocks: true,
|
|
15
|
-
testTimeout: 30_000,
|
|
16
|
-
coverage: {
|
|
17
|
-
enabled: true,
|
|
18
|
-
provider: "v8",
|
|
19
|
-
reportsDirectory: "coverage",
|
|
20
|
-
reporter: ["lcov", "cobertura"],
|
|
21
|
-
clean: true,
|
|
22
|
-
},
|
|
23
|
-
reporters: ["default", ["junit", { outputFile: "test-report.xml" }]],
|
|
24
|
-
environment: "node",
|
|
25
|
-
},
|
|
26
|
-
});
|