@utiliread/primitives 1.0.0-74 → 1.0.0-77

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.
Files changed (90) hide show
  1. package/dist/cjs/index.js.map +1 -1
  2. package/dist/cjs/number-formatter.js +2 -4
  3. package/dist/cjs/number-formatter.js.map +1 -1
  4. package/dist/cjs/number-formatter.spec.js +461 -47
  5. package/dist/cjs/number-formatter.spec.js.map +1 -1
  6. package/dist/cjs/precision-number.js +8 -2
  7. package/dist/cjs/precision-number.js.map +1 -1
  8. package/dist/cjs/precision-number.spec.js +1 -1
  9. package/dist/cjs/precision-number.spec.js.map +1 -1
  10. package/dist/cjs/register-convention.js +4 -2
  11. package/dist/cjs/register-convention.js.map +1 -1
  12. package/dist/cjs/register-convention.spec.js +1 -1
  13. package/dist/cjs/register-convention.spec.js.map +1 -1
  14. package/dist/cjs/register-library.js +4 -2
  15. package/dist/cjs/register-library.js.map +1 -1
  16. package/dist/cjs/register-library.spec.js +3 -3
  17. package/dist/cjs/register-library.spec.js.map +1 -1
  18. package/dist/cjs/repository.js.map +1 -1
  19. package/dist/cjs/repository.spec.js +1 -1
  20. package/dist/cjs/repository.spec.js.map +1 -1
  21. package/dist/cjs/step.js +14 -10
  22. package/dist/cjs/step.js.map +1 -1
  23. package/dist/cjs/step.spec.js +2 -2
  24. package/dist/cjs/step.spec.js.map +1 -1
  25. package/dist/cjs/unit-id.js.map +1 -1
  26. package/dist/esm/index.js +1 -1
  27. package/dist/esm/index.js.map +1 -1
  28. package/dist/esm/number-formatter.js +2 -4
  29. package/dist/esm/number-formatter.js.map +1 -1
  30. package/dist/esm/number-formatter.spec.js +462 -48
  31. package/dist/esm/number-formatter.spec.js.map +1 -1
  32. package/dist/esm/precision-number.js +8 -2
  33. package/dist/esm/precision-number.js.map +1 -1
  34. package/dist/esm/precision-number.spec.js +1 -1
  35. package/dist/esm/precision-number.spec.js.map +1 -1
  36. package/dist/esm/register-convention.d.ts +1 -1
  37. package/dist/esm/register-convention.js +4 -2
  38. package/dist/esm/register-convention.js.map +1 -1
  39. package/dist/esm/register-convention.spec.js +1 -1
  40. package/dist/esm/register-convention.spec.js.map +1 -1
  41. package/dist/esm/register-definition.d.ts +1 -1
  42. package/dist/esm/register-library.js +4 -2
  43. package/dist/esm/register-library.js.map +1 -1
  44. package/dist/esm/register-library.spec.js +3 -3
  45. package/dist/esm/register-library.spec.js.map +1 -1
  46. package/dist/esm/repository.js.map +1 -1
  47. package/dist/esm/repository.spec.js +1 -1
  48. package/dist/esm/repository.spec.js.map +1 -1
  49. package/dist/esm/step.js +14 -10
  50. package/dist/esm/step.js.map +1 -1
  51. package/dist/esm/step.spec.js +2 -2
  52. package/dist/esm/step.spec.js.map +1 -1
  53. package/dist/esm/unit-id.js.map +1 -1
  54. package/locales/da/aggregates.json +7 -7
  55. package/locales/da/consumption-types.json +6 -6
  56. package/locales/da/measures.json +15 -15
  57. package/locales/da/registers.json +362 -221
  58. package/locales/da/units.json +92 -92
  59. package/locales/en/aggregates.json +7 -7
  60. package/locales/en/consumption-types.json +6 -6
  61. package/locales/en/measures.json +15 -15
  62. package/locales/en/registers.json +371 -221
  63. package/locales/en/units.json +92 -92
  64. package/package.json +7 -11
  65. package/src/aggregate-id.ts +8 -8
  66. package/src/consumption-type-id.ts +7 -7
  67. package/src/index.ts +39 -35
  68. package/src/measure-id.ts +14 -14
  69. package/src/number-formatter.spec.ts +509 -65
  70. package/src/number-formatter.ts +43 -20
  71. package/src/optional.ts +1 -1
  72. package/src/precision-number.spec.ts +28 -28
  73. package/src/precision-number.ts +44 -36
  74. package/src/register-convention.spec.ts +14 -5
  75. package/src/register-convention.ts +14 -5
  76. package/src/register-definition.ts +23 -23
  77. package/src/register-id.ts +266 -327
  78. package/src/register-library.spec.ts +5 -5
  79. package/src/register-library.ts +13 -7
  80. package/src/register-pack.ts +1 -1
  81. package/src/register-utils.ts +1 -1
  82. package/src/repository.spec.ts +20 -20
  83. package/src/repository.ts +24 -24
  84. package/src/step.spec.ts +13 -6
  85. package/src/step.ts +45 -37
  86. package/src/time-or-rule.ts +17 -17
  87. package/src/unit-id.ts +98 -119
  88. package/tsconfig.json +1 -0
  89. package/web-test-runner.config.mjs +7 -0
  90. package/karma.config.js +0 -32
@@ -3,13 +3,13 @@ import { RegisterId } from "./register-id";
3
3
  import { RegisterPack } from "./register-pack";
4
4
 
5
5
  class Library {
6
- private definitions: Partial<{ [id in RegisterId]: RegisterDefinition }> = {};
6
+ private definitions: Partial<{ [id in RegisterId]: RegisterDefinition }> =
7
+ {};
7
8
  public add(...definitions: (RegisterDefinition | RegisterPack)[]) {
8
9
  for (const definition of definitions) {
9
10
  if (isDefinition(definition)) {
10
11
  this.tryAdd(definition);
11
- }
12
- else {
12
+ } else {
13
13
  for (const definitionInPack of Object.values(definition)) {
14
14
  this.tryAdd(definitionInPack);
15
15
  }
@@ -42,7 +42,7 @@ class Library {
42
42
  }
43
43
 
44
44
  public all() {
45
- return Object.values(this.definitions).map(x => x!);
45
+ return Object.values(this.definitions).map((x) => x!);
46
46
  }
47
47
 
48
48
  public reset() {
@@ -50,8 +50,14 @@ class Library {
50
50
  }
51
51
  }
52
52
 
53
- function isDefinition(definitionOrPack: RegisterDefinition | RegisterPack): definitionOrPack is RegisterDefinition {
54
- return !!(definitionOrPack.id && definitionOrPack.aggregate && definitionOrPack.units);
53
+ function isDefinition(
54
+ definitionOrPack: RegisterDefinition | RegisterPack,
55
+ ): definitionOrPack is RegisterDefinition {
56
+ return !!(
57
+ definitionOrPack.id &&
58
+ definitionOrPack.aggregate &&
59
+ definitionOrPack.units
60
+ );
55
61
  }
56
62
 
57
- export const RegisterLibrary = new Library();
63
+ export const RegisterLibrary = new Library();
@@ -2,4 +2,4 @@ import { RegisterDefinition } from "./register-definition";
2
2
 
3
3
  export interface RegisterPack {
4
4
  [key: string]: RegisterDefinition;
5
- }
5
+ }
@@ -3,4 +3,4 @@ import { RegisterId } from "./register-id";
3
3
 
4
4
  export function getRegisterId(register: RegisterId | RegisterDefinition) {
5
5
  return typeof register === "string" ? register : register.id;
6
- }
6
+ }
@@ -1,20 +1,20 @@
1
- import { expect } from "chai";
2
- import { Repository } from "./repository";
3
-
4
- describe("ctor", () => {
5
- it("creates", () => {
6
- expect(Repository("gpkv", "gjoel")).to.equal("gpkv/gjoel");
7
- expect(Repository("gpkv/gjoel")).to.equal("gpkv/gjoel");
8
- });
9
- it("throws if wrong format", () => {
10
- expect(() => Repository("invalid")).to.throw();
11
- })
12
- });
13
-
14
- describe("split", () => {
15
- it("splits into correct parts", () => {
16
- const { team, name } = Repository.split(Repository("gpkv", "gjoel"));
17
- expect(team).to.equal("gpkv");
18
- expect(name).to.equal("gjoel");
19
- });
20
- });
1
+ import { Repository } from "./repository";
2
+ import { expect } from "@esm-bundle/chai";
3
+
4
+ describe("ctor", () => {
5
+ it("creates", () => {
6
+ expect(Repository("gpkv", "gjoel")).to.equal("gpkv/gjoel");
7
+ expect(Repository("gpkv/gjoel")).to.equal("gpkv/gjoel");
8
+ });
9
+ it("throws if wrong format", () => {
10
+ expect(() => Repository("invalid")).to.throw();
11
+ });
12
+ });
13
+
14
+ describe("split", () => {
15
+ it("splits into correct parts", () => {
16
+ const { team, name } = Repository.split(Repository("gpkv", "gjoel"));
17
+ expect(team).to.equal("gpkv");
18
+ expect(name).to.equal("gjoel");
19
+ });
20
+ });
package/src/repository.ts CHANGED
@@ -1,24 +1,24 @@
1
- // This is clearly not correct but it provides some amazing type safety
2
- export type Repository = "some/repo";
3
-
4
- export function Repository(repo: string): Repository;
5
- export function Repository(team: string, name: string): Repository;
6
- export function Repository(repoOrTeam: string, name?: string): Repository {
7
- if (name) {
8
- return <Repository>`${repoOrTeam}/${name}`;
9
- } else if (repoOrTeam.indexOf("/") > 0) {
10
- return <Repository>repoOrTeam;
11
- } else {
12
- throw new TypeError("Invalid repository format");
13
- }
14
- }
15
-
16
- export namespace Repository {
17
- export function split(repo: Repository) {
18
- const parts = repo.split("/");
19
- return {
20
- team: parts[0],
21
- name: parts[1],
22
- };
23
- }
24
- }
1
+ // This is clearly not correct but it provides some amazing type safety
2
+ export type Repository = "some/repo";
3
+
4
+ export function Repository(repo: string): Repository;
5
+ export function Repository(team: string, name: string): Repository;
6
+ export function Repository(repoOrTeam: string, name?: string): Repository {
7
+ if (name) {
8
+ return <Repository>`${repoOrTeam}/${name}`;
9
+ } else if (repoOrTeam.indexOf("/") > 0) {
10
+ return <Repository>repoOrTeam;
11
+ } else {
12
+ throw new TypeError("Invalid repository format");
13
+ }
14
+ }
15
+
16
+ export namespace Repository {
17
+ export function split(repo: Repository) {
18
+ const parts = repo.split("/");
19
+ return {
20
+ team: parts[0],
21
+ name: parts[1],
22
+ };
23
+ }
24
+ }
package/src/step.spec.ts CHANGED
@@ -1,24 +1,31 @@
1
- import { expect } from "chai";
2
- import { DateTime } from "luxon";
3
1
  import { DayOfWeek, Step } from "./step";
4
2
 
3
+ import { DateTime } from "luxon";
4
+ import { expect } from "@esm-bundle/chai";
5
+
5
6
  describe("startOf", () => {
6
7
  it("returns start of day", () => {
7
8
  const dt = DateTime.fromISO("2020-01-11T05:00:00+01:00");
8
9
  const result = Step.startOf(dt, "day");
9
- expect(+result).to.equal(+DateTime.fromISO("2020-01-11T00:00:00+01:00"));
10
+ expect(+result).to.equal(
11
+ +DateTime.fromISO("2020-01-11T00:00:00+01:00"),
12
+ );
10
13
  });
11
14
 
12
15
  it("returns previous monday from saturday", () => {
13
16
  const dt = DateTime.fromISO("2020-01-11T05:00:00+01:00");
14
17
  const result = Step.startOf(dt, "week", DayOfWeek.Monday);
15
- expect(+result).to.equal(+DateTime.fromISO("2020-01-06T00:00:00+01:00"));
18
+ expect(+result).to.equal(
19
+ +DateTime.fromISO("2020-01-06T00:00:00+01:00"),
20
+ );
16
21
  });
17
22
 
18
23
  it("returns same monday from monday with hour", () => {
19
24
  const dt = DateTime.fromISO("2020-01-13T05:00:00+01:00");
20
25
  const result = Step.startOf(dt, "week", DayOfWeek.Monday);
21
- expect(+result).to.equal(+DateTime.fromISO("2020-01-13T00:00:00+01:00"));
26
+ expect(+result).to.equal(
27
+ +DateTime.fromISO("2020-01-13T00:00:00+01:00"),
28
+ );
22
29
  });
23
30
  });
24
31
 
@@ -27,4 +34,4 @@ describe("asDuration", () => {
27
34
  const duration = Step.asDuration("week");
28
35
  expect(duration.days).to.equal(7);
29
36
  });
30
- });
37
+ });
package/src/step.ts CHANGED
@@ -1,37 +1,45 @@
1
- import { DateTime, Duration } from "luxon";
2
-
3
- export type Step = "hour" | "day" | "week" | "month" | "year";
4
-
5
- export enum DayOfWeek {
6
- Monday = 1,
7
- Tuesday = 2,
8
- Wednesday = 3,
9
- Thursday = 4,
10
- Friday = 5,
11
- Saturday = 6,
12
- Sunday = 7,
13
- };
14
-
15
- export namespace Step {
16
- export function startOf(dateTime: DateTime, step: Step, firstDayOfWeek?: DayOfWeek): DateTime {
17
- if (step === "week") {
18
- const value = dateTime.startOf("day").set({ weekday: firstDayOfWeek ?? DayOfWeek.Monday });
19
- return value > dateTime
20
- ? value.minus({ days: 7 })
21
- : value;
22
- }
23
- else {
24
- return dateTime.startOf(step);
25
- }
26
- }
27
-
28
- export function asDuration(step: Step, amount = 1): Duration {
29
- switch (step) {
30
- case "hour": return Duration.fromObject({ hours: amount });
31
- case "day": return Duration.fromObject({ days: amount });
32
- case "week": return Duration.fromObject({ days: 7 * amount });
33
- case "month": return Duration.fromObject({ months: amount });
34
- case "year": return Duration.fromObject({ years: amount });
35
- }
36
- }
37
- }
1
+ import { DateTime, Duration } from "luxon";
2
+
3
+ export type Step = "hour" | "day" | "week" | "month" | "year";
4
+
5
+ export enum DayOfWeek {
6
+ Monday = 1,
7
+ Tuesday = 2,
8
+ Wednesday = 3,
9
+ Thursday = 4,
10
+ Friday = 5,
11
+ Saturday = 6,
12
+ Sunday = 7,
13
+ }
14
+
15
+ export namespace Step {
16
+ export function startOf(
17
+ dateTime: DateTime,
18
+ step: Step,
19
+ firstDayOfWeek?: DayOfWeek,
20
+ ): DateTime {
21
+ if (step === "week") {
22
+ const value = dateTime
23
+ .startOf("day")
24
+ .set({ weekday: firstDayOfWeek ?? DayOfWeek.Monday });
25
+ return value > dateTime ? value.minus({ days: 7 }) : value;
26
+ } else {
27
+ return dateTime.startOf(step);
28
+ }
29
+ }
30
+
31
+ export function asDuration(step: Step, amount = 1): Duration {
32
+ switch (step) {
33
+ case "hour":
34
+ return Duration.fromObject({ hours: amount });
35
+ case "day":
36
+ return Duration.fromObject({ days: amount });
37
+ case "week":
38
+ return Duration.fromObject({ days: 7 * amount });
39
+ case "month":
40
+ return Duration.fromObject({ months: amount });
41
+ case "year":
42
+ return Duration.fromObject({ years: amount });
43
+ }
44
+ }
45
+ }
@@ -1,17 +1,17 @@
1
- import { DateTime } from "luxon";
2
-
3
- export type TimeOrRule = Date | DateTime | string;
4
-
5
- export namespace TimeOrRule {
6
- export function isTime(input: TimeOrRule): input is Date | DateTime {
7
- return typeof input !== "string";
8
- }
9
-
10
- export function isRule(input: TimeOrRule): input is string {
11
- return typeof input === "string";
12
- }
13
-
14
- export function asJSON(input: TimeOrRule) {
15
- return isRule(input) ? input : input.toJSON();
16
- }
17
- }
1
+ import { DateTime } from "luxon";
2
+
3
+ export type TimeOrRule = Date | DateTime | string;
4
+
5
+ export namespace TimeOrRule {
6
+ export function isTime(input: TimeOrRule): input is Date | DateTime {
7
+ return typeof input !== "string";
8
+ }
9
+
10
+ export function isRule(input: TimeOrRule): input is string {
11
+ return typeof input === "string";
12
+ }
13
+
14
+ export function asJSON(input: TimeOrRule) {
15
+ return isRule(input) ? input : input.toJSON();
16
+ }
17
+ }
package/src/unit-id.ts CHANGED
@@ -1,123 +1,102 @@
1
1
  export type UnitId =
2
- "unitless" |
3
-
4
- "milliWattHour" |
5
- "wattHour" |
6
- "kiloWattHour" |
7
- "megaWattHour" |
8
- "gigaWattHour" |
9
- "calorie" |
10
- "kiloCalorie" |
11
- "megaCalorie" |
12
-
13
- "joule" |
14
- "kiloJoule" |
15
- "megaJoule" |
16
- "gigaJoule" |
17
-
18
- "liter" |
19
- "cubicMeter" |
20
-
21
- "fluidOunce" |
22
- "gallon" |
23
-
24
- "gram" |
25
- "kiloGram" |
26
- "tonne" |
27
-
28
- "ounce" |
29
- "pound" |
30
- "ton" |
31
-
32
- "second" |
33
- "minute" |
34
- "hour" |
35
- "day" |
36
- "week" |
37
- "month" |
38
- "year" |
39
-
40
- "milliWatt" |
41
- "milliWatt2" |
42
- "watt" |
43
- "watt2" |
44
- "kiloWatt" |
45
- "kiloWatt2" |
46
- "megaWatt" |
47
- "megaWatt2" |
48
- "gigaWatt" |
49
- "gigaWatt2" |
50
-
51
- "joulesPerSecond" |
52
- "joulesPerSecond2" |
53
- "joulesPerMinute" |
54
- "joulesPerMinute2" |
55
- "joulesPerHour" |
56
- "joulesPerHour2" |
57
-
58
- "litersPerSecond" |
59
- "litersPerSecond2" |
60
- "litersPerMinute" |
61
- "litersPerMinute2" |
62
- "litersPerHour" |
63
- "litersPerHour2" |
64
-
65
- "cubicMetersPerSecond" |
66
- "cubicMetersPerSecond2" |
67
- "cubicMetersPerMinute" |
68
- "cubicMetersPerMinute2" |
69
- "cubicMetersPerHour" |
70
- "cubicMetersPerHour2" |
71
-
72
- "fluidOuncesPerSecond" |
73
- "fluidOuncesPerSecond2" |
74
- "fluidOuncesPerMinute" |
75
- "fluidOuncesPerMinute2" |
76
- "fluidOuncesPerHour" |
77
- "fluidOuncesPerHour2" |
78
-
79
- "gallonsPerSecond" |
80
- "gallonsPerSecond2" |
81
- "gallonsPerMinute" |
82
- "gallonsPerMinute2" |
83
- "gallonsPerHour" |
84
- "gallonsPerHour2" |
85
-
86
- "gramsPerSecond" |
87
- "gramsPerSecond2" |
88
- "gramsPerMinute" |
89
- "gramsPerMinute2" |
90
- "gramsPerHour" |
91
- "gramsPerHour2" |
92
-
93
- "kiloGramsPerSecond" |
94
- "kiloGramsPerSecond2" |
95
- "kiloGramsPerMinute" |
96
- "kiloGramsPerMinute2" |
97
- "kiloGramsPerHour" |
98
- "kiloGramsPerHour2" |
99
-
100
- "celcius" |
101
- "kelvin" |
102
- "fahrenheit" |
103
-
104
- "bar" |
105
- "bar2" |
106
- "pascal" |
107
- "pascal2" |
108
-
109
- "var" |
110
- "kiloVar" |
111
- "megaVar" |
112
-
113
- "varHour" |
114
- "kiloVarHour" |
115
- "megaVarHour" |
116
-
117
- "percentage" |
118
-
119
- "literCelcius" |
120
- "cubicMeterCelcius";
2
+ | "unitless"
3
+ | "milliWattHour"
4
+ | "wattHour"
5
+ | "kiloWattHour"
6
+ | "megaWattHour"
7
+ | "gigaWattHour"
8
+ | "calorie"
9
+ | "kiloCalorie"
10
+ | "megaCalorie"
11
+ | "joule"
12
+ | "kiloJoule"
13
+ | "megaJoule"
14
+ | "gigaJoule"
15
+ | "liter"
16
+ | "cubicMeter"
17
+ | "fluidOunce"
18
+ | "gallon"
19
+ | "gram"
20
+ | "kiloGram"
21
+ | "tonne"
22
+ | "ounce"
23
+ | "pound"
24
+ | "ton"
25
+ | "second"
26
+ | "minute"
27
+ | "hour"
28
+ | "day"
29
+ | "week"
30
+ | "month"
31
+ | "year"
32
+ | "milliWatt"
33
+ | "milliWatt2"
34
+ | "watt"
35
+ | "watt2"
36
+ | "kiloWatt"
37
+ | "kiloWatt2"
38
+ | "megaWatt"
39
+ | "megaWatt2"
40
+ | "gigaWatt"
41
+ | "gigaWatt2"
42
+ | "joulesPerSecond"
43
+ | "joulesPerSecond2"
44
+ | "joulesPerMinute"
45
+ | "joulesPerMinute2"
46
+ | "joulesPerHour"
47
+ | "joulesPerHour2"
48
+ | "litersPerSecond"
49
+ | "litersPerSecond2"
50
+ | "litersPerMinute"
51
+ | "litersPerMinute2"
52
+ | "litersPerHour"
53
+ | "litersPerHour2"
54
+ | "cubicMetersPerSecond"
55
+ | "cubicMetersPerSecond2"
56
+ | "cubicMetersPerMinute"
57
+ | "cubicMetersPerMinute2"
58
+ | "cubicMetersPerHour"
59
+ | "cubicMetersPerHour2"
60
+ | "fluidOuncesPerSecond"
61
+ | "fluidOuncesPerSecond2"
62
+ | "fluidOuncesPerMinute"
63
+ | "fluidOuncesPerMinute2"
64
+ | "fluidOuncesPerHour"
65
+ | "fluidOuncesPerHour2"
66
+ | "gallonsPerSecond"
67
+ | "gallonsPerSecond2"
68
+ | "gallonsPerMinute"
69
+ | "gallonsPerMinute2"
70
+ | "gallonsPerHour"
71
+ | "gallonsPerHour2"
72
+ | "gramsPerSecond"
73
+ | "gramsPerSecond2"
74
+ | "gramsPerMinute"
75
+ | "gramsPerMinute2"
76
+ | "gramsPerHour"
77
+ | "gramsPerHour2"
78
+ | "kiloGramsPerSecond"
79
+ | "kiloGramsPerSecond2"
80
+ | "kiloGramsPerMinute"
81
+ | "kiloGramsPerMinute2"
82
+ | "kiloGramsPerHour"
83
+ | "kiloGramsPerHour2"
84
+ | "celcius"
85
+ | "kelvin"
86
+ | "fahrenheit"
87
+ | "bar"
88
+ | "bar2"
89
+ | "pascal"
90
+ | "pascal2"
91
+ | "var"
92
+ | "kiloVar"
93
+ | "megaVar"
94
+ | "varHour"
95
+ | "kiloVarHour"
96
+ | "megaVarHour"
97
+ | "percentage"
98
+ | "literCelcius"
99
+ | "cubicMeterCelcius";
121
100
 
122
101
  export const energyUnits: UnitId[] = [
123
102
  "milliWattHour",
package/tsconfig.json CHANGED
@@ -3,6 +3,7 @@
3
3
  "target": "ES2018",
4
4
  "module": "ESNext",
5
5
  "moduleResolution": "Node",
6
+ "esModuleInterop": true,
6
7
  "declaration": true,
7
8
  "sourceMap": true,
8
9
  "experimentalDecorators": true,
@@ -0,0 +1,7 @@
1
+ import { esbuildPlugin } from "@web/dev-server-esbuild";
2
+
3
+ export default {
4
+ nodeResolve: true,
5
+ files: ["src/**/*.spec.ts"],
6
+ plugins: [esbuildPlugin({ ts: true })],
7
+ };
package/karma.config.js DELETED
@@ -1,32 +0,0 @@
1
- const tsconfig = require("./tsconfig.json");
2
-
3
- module.exports = function (config) {
4
- config.set({
5
- frameworks: ["mocha", "chai", "karma-typescript"],
6
- files: ["src/**/*.ts"],
7
- preprocessors: {
8
- "src/**/*.ts": ["karma-typescript"],
9
- },
10
- reporters: ["progress", "karma-typescript"],
11
- browsers: ["ChromeHeadless", "ChromeDebugging", "Chrome"],
12
- customLaunchers: {
13
- ChromeDebugging: {
14
- base: "Chrome",
15
- flags: ["--remote-debugging-port=9222"],
16
- },
17
- },
18
- karmaTypescriptConfig: {
19
- bundlerOptions: {
20
- entrypoints: /\.spec\.ts$/,
21
- sourceMap: tsconfig.compilerOptions.sourceMap,
22
- acornOptions: {
23
- ecmaVersion: "latest",
24
- },
25
- },
26
- coverageOptions: {
27
- instrumentation: false,
28
- },
29
- tsconfig: "./tsconfig.cjs.json",
30
- },
31
- });
32
- };