complete-cli 1.3.6 → 1.3.8

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.
@@ -0,0 +1,89 @@
1
+ import { strictEqual } from "node:assert";
2
+ import { describe, test } from "node:test";
3
+ import { getTruncatedText } from "./getTruncatedText.js";
4
+ describe("getTruncatedText", () => {
5
+ test("no markers", () => {
6
+ const templateText = `
7
+ line 1
8
+ line 2
9
+ line 3
10
+ `.trim();
11
+ const { text } = getTruncatedText("test", templateText, new Set(), new Set());
12
+ strictEqual(text, templateText);
13
+ });
14
+ test("customization marker", () => {
15
+ const templateText = `
16
+ line 1
17
+ @template-customization-start
18
+ line 2
19
+ @template-customization-end
20
+ line 3
21
+ `.trim();
22
+ const expectedTemplateText = `
23
+ line 1
24
+ line 3
25
+ `.trim();
26
+ const { text } = getTruncatedText("test", templateText, new Set(), new Set());
27
+ strictEqual(text, expectedTemplateText);
28
+ });
29
+ test("ignore block marker part 1", () => {
30
+ const templateText = `
31
+ line 1
32
+ @template-ignore-block-start
33
+ // line 2
34
+ @template-ignore-block-end
35
+ line 3
36
+ `.trim();
37
+ const parsedTemplateText = `
38
+ line 1
39
+ line 3
40
+ `.trim();
41
+ const { text, ignoreLines } = getTruncatedText("test", templateText, new Set(), new Set());
42
+ strictEqual(text, parsedTemplateText);
43
+ strictEqual(ignoreLines.size, 1);
44
+ strictEqual([...ignoreLines][0], "line 2");
45
+ });
46
+ test("ignore block marker part 2", () => {
47
+ const templateText = `
48
+ line 1
49
+ line 2
50
+ line 3
51
+ `.trim();
52
+ const expectedTemplateText = `
53
+ line 1
54
+ line 3
55
+ `.trim();
56
+ const { text } = getTruncatedText("test", templateText, new Set(["line 2"]), new Set());
57
+ strictEqual(text, expectedTemplateText);
58
+ });
59
+ test("ignore next line part 1", () => {
60
+ const templateText = `
61
+ line 1
62
+ @template-ignore-next-line
63
+ line 2
64
+ line 3
65
+ `.trim();
66
+ const expectedTemplateText = `
67
+ line 1
68
+ line 3
69
+ `.trim();
70
+ const { text, linesBeforeIgnore } = getTruncatedText("test", templateText, new Set(), new Set());
71
+ strictEqual(linesBeforeIgnore.size, 1);
72
+ strictEqual([...linesBeforeIgnore][0], "line 1");
73
+ strictEqual(text, expectedTemplateText);
74
+ });
75
+ test("ignore next line part 2", () => {
76
+ const templateText = `
77
+ line 1
78
+ line 2
79
+ line 3
80
+ `.trim();
81
+ const expectedTemplateText = `
82
+ line 1
83
+ line 3
84
+ `.trim();
85
+ const { text } = getTruncatedText("test", templateText, new Set(), new Set(["line 1"]));
86
+ strictEqual(text, expectedTemplateText);
87
+ });
88
+ });
89
+ //# sourceMappingURL=getTruncatedText.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTruncatedText.test.js","sourceRoot":"","sources":["../../../../../src/commands/check/getTruncatedText.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE;QACtB,MAAM,YAAY,GAAG;;;;CAIxB,CAAC,IAAI,EAAE,CAAC;QAEL,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAC/B,MAAM,EACN,YAAY,EACZ,IAAI,GAAG,EAAE,EACT,IAAI,GAAG,EAAE,CACV,CAAC;QACF,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAChC,MAAM,YAAY,GAAG;;;;;;GAMtB,CAAC,IAAI,EAAE,CAAC;QAEP,MAAM,oBAAoB,GAAG;;;GAG9B,CAAC,IAAI,EAAE,CAAC;QAEP,MAAM,EAAE,I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G9B,CAAC,IAAI,EAAE,CAAC;QAEP,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CAClD,MAAM,EACN,YAAY,EACZ,IAAI,GAAG,EAAE,EACT,IAAI,GAAG,EAAE,CACV,CAAC;QACF,WAAW,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACvC,WAAW,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QACjD,WAAW,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACnC,MAAM,YAAY,GAAG;;;;GAItB,CAAC,IAAI,EAAE,CAAC;QAEP,MAAM,oBAAoB,GAAG;;;GAG9B,CAAC,IAAI,EAAE,CAAC;QAEP,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAC/B,MAAM,EACN,YAAY,EACZ,IAAI,GAAG,EAAE,EACT,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CACpB,CAAC;QACF,WAAW,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/dist/constants.js CHANGED
@@ -1,15 +1,15 @@
1
- import { getPackageJSONFieldsMandatory, getPackageRoot, PackageManager, } from "complete-node";
1
+ import { getPackageJSONFieldsMandatory, PackageManager } from "complete-node";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
4
  export const CWD = process.cwd();
5
5
  export const CURRENT_DIRECTORY_NAME = path.basename(CWD);
6
6
  export const HOME_DIR = os.homedir();
7
- const packageRoot = await getPackageRoot();
8
- const { name, version } = await getPackageJSONFieldsMandatory(packageRoot, "name", "version");
7
+ const PACKAGE_ROOT = path.resolve(import.meta.dirname, "..");
8
+ const { name, version } = await getPackageJSONFieldsMandatory(PACKAGE_ROOT, "name", "version");
9
9
  export const PROJECT_NAME = name;
10
10
  export const PROJECT_VERSION = version;
11
11
  export const DEFAULT_PACKAGE_MANAGER = PackageManager.npm;
12
- const TEMPLATES_DIR = path.join(packageRoot, "file-templates");
12
+ const TEMPLATES_DIR = path.join(PACKAGE_ROOT, "file-templates");
13
13
  export const TEMPLATES_STATIC_DIR = path.join(TEMPLATES_DIR, "static");
14
14
  export const TEMPLATES_DYNAMIC_DIR = path.join(TEMPLATES_DIR, "dynamic");
15
15
  export const ACTION_YML = "action.yml";
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,cAAc,EACd,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AACjC,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAEzD,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;AAErC,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;AAC3C,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,6BAA6B,CAC3D,WAAW,EACX,MAAM,EACN,SAAS,CACV,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AACjC,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;AAEvC,MAAM,CAAC,MAAM,uBAAuB,GAAG,cAAc,CAAC,GAAG,CAAC;AAE1D,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,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I,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AAEzE,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC;AACvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,IAAI,CAC/C,qBAAqB,EACrB,SAAS,EACT,WAAW,EACX,OAAO,EACP,UAAU,CACX,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { $, buildScript } from "complete-node";
2
2
 
3
- await buildScript(async () => {
3
+ await buildScript(import.meta.dirname, async () => {
4
4
  await $`tsc`;
5
5
  });
@@ -1,6 +1,6 @@
1
1
  import { $, lintScript } from "complete-node";
2
2
 
3
- await lintScript(async () => {
3
+ await lintScript(import.meta.dirname, async () => {
4
4
  await Promise.all([
5
5
  // Use TypeScript to type-check the code.
6
6
  $`tsc --noEmit`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "complete-cli",
3
- "version": "1.3.6",
3
+ "version": "1.3.8",
4
4
  "description": "A command line tool for bootstrapping TypeScript projects.",
5
5
  "keywords": [
6
6
  "typescript"
@@ -32,10 +32,10 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@clack/prompts": "0.11.0",
35
- "chalk": "5.6.0",
35
+ "chalk": "5.6.2",
36
36
  "clipanion": "4.0.0-rc.4",
37
37
  "complete-common": "2.5.0",
38
- "complete-node": "9.3.2",
38
+ "complete-node": "10.0.0",
39
39
  "klaw-sync": "7.0.0",
40
40
  "source-map-support": "0.5.21",
41
41
  "yaml": "2.8.1"
@@ -47,7 +47,7 @@
47
47
  "ts-loader": "9.5.4",
48
48
  "tsconfig-paths-webpack-plugin": "4.2.0",
49
49
  "typescript": "5.9.2",
50
- "typescript-eslint": "8.42.0",
50
+ "typescript-eslint": "8.43.0",
51
51
  "webpack": "5.101.3",
52
52
  "webpack-cli": "6.0.1",
53
53
  "webpack-shebang-plugin": "1.1.8"
@@ -1,16 +1,25 @@
1
1
  import { strictEqual } from "node:assert";
2
- import test from "node:test";
2
+ import { describe, test } from "node:test";
3
3
  import { getTruncatedText } from "./getTruncatedText.js";
4
- test("no markers", () => {
4
+
5
+ describe("getTruncatedText", () => {
6
+ test("no markers", () => {
5
7
  const templateText = `
6
8
  line 1
7
9
  line 2
8
10
  line 3
9
11
  `.trim();
10
- const { text } = getTruncatedText("test", templateText, new Set(), new Set());
12
+
13
+ const { text } = getTruncatedText(
14
+ "test",
15
+ templateText,
16
+ new Set(),
17
+ new Set(),
18
+ );
11
19
  strictEqual(text, templateText);
12
- });
13
- test("customization marker", () => {
20
+ });
21
+
22
+ test("customization marker", () => {
14
23
  const templateText = `
15
24
  line 1
16
25
  @template-customization-start
@@ -18,14 +27,22 @@ line 2
18
27
  @template-customization-end
19
28
  line 3
20
29
  `.trim();
30
+
21
31
  const expectedTemplateText = `
22
32
  line 1
23
33
  line 3
24
34
  `.trim();
25
- const { text } = getTruncatedText("test", templateText, new Set(), new Set());
35
+
36
+ const { text } = getTruncatedText(
37
+ "test",
38
+ templateText,
39
+ new Set(),
40
+ new Set(),
41
+ );
26
42
  strictEqual(text, expectedTemplateText);
27
- });
28
- test("ignore block marker part 1", () => {
43
+ });
44
+
45
+ test("ignore block marker part 1", () => {
29
46
  const templateText = `
30
47
  line 1
31
48
  @template-ignore-block-start
@@ -33,55 +50,86 @@ line 1
33
50
  @template-ignore-block-end
34
51
  line 3
35
52
  `.trim();
53
+
36
54
  const parsedTemplateText = `
37
55
  line 1
38
56
  line 3
39
57
  `.trim();
40
- const { text, ignoreLines } = getTruncatedText("test", templateText, new Set(), new Set());
58
+
59
+ const { text, ignoreLines } = getTruncatedText(
60
+ "test",
61
+ templateText,
62
+ new Set(),
63
+ new Set(),
64
+ );
41
65
  strictEqual(text, parsedTemplateText);
42
66
  strictEqual(ignoreLines.size, 1);
43
67
  strictEqual([...ignoreLines][0], "line 2");
44
- });
45
- test("ignore block marker part 2", () => {
68
+ });
69
+
70
+ test("ignore block marker part 2", () => {
46
71
  const templateText = `
47
72
  line 1
48
73
  line 2
49
74
  line 3
50
75
  `.trim();
76
+
51
77
  const expectedTemplateText = `
52
78
  line 1
53
79
  line 3
54
80
  `.trim();
55
- const { text } = getTruncatedText("test", templateText, new Set(["line 2"]), new Set());
81
+
82
+ const { text } = getTruncatedText(
83
+ "test",
84
+ templateText,
85
+ new Set(["line 2"]),
86
+ new Set(),
87
+ );
56
88
  strictEqual(text, expectedTemplateText);
57
- });
58
- test("ignore next line part 1", () => {
89
+ });
90
+
91
+ test("ignore next line part 1", () => {
59
92
  const templateText = `
60
93
  line 1
61
94
  @template-ignore-next-line
62
95
  line 2
63
96
  line 3
64
97
  `.trim();
98
+
65
99
  const expectedTemplateText = `
66
100
  line 1
67
101
  line 3
68
102
  `.trim();
69
- const { text, linesBeforeIgnore } = getTruncatedText("test", templateText, new Set(), new Set());
103
+
104
+ const { text, linesBeforeIgnore } = getTruncatedText(
105
+ "test",
106
+ templateText,
107
+ new Set(),
108
+ new Set(),
109
+ );
70
110
  strictEqual(linesBeforeIgnore.size, 1);
71
111
  strictEqual([...linesBeforeIgnore][0], "line 1");
72
112
  strictEqual(text, expectedTemplateText);
73
- });
74
- test("ignore next line part 2", () => {
113
+ });
114
+
115
+ test("ignore next line part 2", () => {
75
116
  const templateText = `
76
117
  line 1
77
118
  line 2
78
119
  line 3
79
120
  `.trim();
121
+
80
122
  const expectedTemplateText = `
81
123
  line 1
82
124
  line 3
83
125
  `.trim();
84
- const { text } = getTruncatedText("test", templateText, new Set(), new Set(["line 1"]));
126
+
127
+ const { text } = getTruncatedText(
128
+ "test",
129
+ templateText,
130
+ new Set(),
131
+ new Set(["line 1"]),
132
+ );
85
133
  strictEqual(text, expectedTemplateText);
134
+ });
86
135
  });
87
- //# sourceMappingURL=check.test.js.map
package/src/constants.ts CHANGED
@@ -1,8 +1,4 @@
1
- import {
2
- getPackageJSONFieldsMandatory,
3
- getPackageRoot,
4
- PackageManager,
5
- } from "complete-node";
1
+ import { getPackageJSONFieldsMandatory, PackageManager } from "complete-node";
6
2
  import os from "node:os";
7
3
  import path from "node:path";
8
4
 
@@ -11,9 +7,9 @@ export const CURRENT_DIRECTORY_NAME = path.basename(CWD);
11
7
 
12
8
  export const HOME_DIR = os.homedir();
13
9
 
14
- const packageRoot = await getPackageRoot();
10
+ const PACKAGE_ROOT = path.resolve(import.meta.dirname, "..");
15
11
  const { name, version } = await getPackageJSONFieldsMandatory(
16
- packageRoot,
12
+ PACKAGE_ROOT,
17
13
  "name",
18
14
  "version",
19
15
  );
@@ -23,7 +19,7 @@ export const PROJECT_VERSION = version;
23
19
 
24
20
  export const DEFAULT_PACKAGE_MANAGER = PackageManager.npm;
25
21
 
26
- const TEMPLATES_DIR = path.join(packageRoot, "file-templates");
22
+ const TEMPLATES_DIR = path.join(PACKAGE_ROOT, "file-templates");
27
23
  export const TEMPLATES_STATIC_DIR = path.join(TEMPLATES_DIR, "static");
28
24
  export const TEMPLATES_DYNAMIC_DIR = path.join(TEMPLATES_DIR, "dynamic");
29
25
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"check.test.js","sourceRoot":"","sources":["../../../../../src/commands/check/check.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE;IACtB,MAAM,YAAY,GAAG;;;;CAItB,CAAC,IAAI,EAAE,CAAC;IAEP,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;IAC9E,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC;A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,oBAAoB,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACnC,MAAM,YAAY,GAAG;;;;;GAKpB,CAAC,IAAI,EAAE,CAAC;IAET,MAAM,oBAAoB,GAAG;;;GAG5B,CAAC,IAAI,EAAE,CAAC;IAET,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CAClD,MAAM,EACN,YAAY,EACZ,IAAI,GAAG,EAAE,EACT,IAAI,GAAG,EAAE,CACV,CAAC;IACF,WAAW,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACvC,WAAW,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACjD,WAAW,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACnC,MAAM,YAAY,GAAG;;;;GAIpB,CAAC,IAAI,EAAE,CAAC;IAET,MAAM,oBAAoB,GAAG;;;GAG5B,CAAC,IAAI,EAAE,CAAC;IAET,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAC/B,MAAM,EACN,YAAY,EACZ,IAAI,GAAG,EAAE,EACT,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CACpB,CAAC;IACF,WAAW,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC"}
@@ -1,123 +0,0 @@
1
- import { strictEqual } from "node:assert";
2
- import test from "node:test";
3
- import { getTruncatedText } from "./getTruncatedText.js";
4
-
5
- test("no markers", () => {
6
- const templateText = `
7
- line 1
8
- line 2
9
- line 3
10
- `.trim();
11
-
12
- const { text } = getTruncatedText("test", templateText, new Set(), new Set());
13
- strictEqual(text, templateText);
14
- });
15
-
16
- test("customization marker", () => {
17
- const templateText = `
18
- line 1
19
- @template-customization-start
20
- line 2
21
- @template-customization-end
22
- line 3
23
- `.trim();
24
-
25
- const expectedTemplateText = `
26
- line 1
27
- line 3
28
- `.trim();
29
-
30
- const { text } = getTruncatedText("test", templateText, new Set(), new Set());
31
- strictEqual(text, expectedTemplateText);
32
- });
33
-
34
- test("ignore block marker part 1", () => {
35
- const templateText = `
36
- line 1
37
- @template-ignore-block-start
38
- // line 2
39
- @template-ignore-block-end
40
- line 3
41
- `.trim();
42
-
43
- const parsedTemplateText = `
44
- line 1
45
- line 3
46
- `.trim();
47
-
48
- const { text, ignoreLines } = getTruncatedText(
49
- "test",
50
- templateText,
51
- new Set(),
52
- new Set(),
53
- );
54
- strictEqual(text, parsedTemplateText);
55
- strictEqual(ignoreLines.size, 1);
56
- strictEqual([...ignoreLines][0], "line 2");
57
- });
58
-
59
- test("ignore block marker part 2", () => {
60
- const templateText = `
61
- line 1
62
- line 2
63
- line 3
64
- `.trim();
65
-
66
- const expectedTemplateText = `
67
- line 1
68
- line 3
69
- `.trim();
70
-
71
- const { text } = getTruncatedText(
72
- "test",
73
- templateText,
74
- new Set(["line 2"]),
75
- new Set(),
76
- );
77
- strictEqual(text, expectedTemplateText);
78
- });
79
-
80
- test("ignore next line part 1", () => {
81
- const templateText = `
82
- line 1
83
- @template-ignore-next-line
84
- line 2
85
- line 3
86
- `.trim();
87
-
88
- const expectedTemplateText = `
89
- line 1
90
- line 3
91
- `.trim();
92
-
93
- const { text, linesBeforeIgnore } = getTruncatedText(
94
- "test",
95
- templateText,
96
- new Set(),
97
- new Set(),
98
- );
99
- strictEqual(linesBeforeIgnore.size, 1);
100
- strictEqual([...linesBeforeIgnore][0], "line 1");
101
- strictEqual(text, expectedTemplateText);
102
- });
103
-
104
- test("ignore next line part 2", () => {
105
- const templateText = `
106
- line 1
107
- line 2
108
- line 3
109
- `.trim();
110
-
111
- const expectedTemplateText = `
112
- line 1
113
- line 3
114
- `.trim();
115
-
116
- const { text } = getTruncatedText(
117
- "test",
118
- templateText,
119
- new Set(),
120
- new Set(["line 1"]),
121
- );
122
- strictEqual(text, expectedTemplateText);
123
- });