@monorepolint/rules 0.6.0-alpha.1 → 0.6.0-alpha.3

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 (87) hide show
  1. package/.turbo/turbo-clean.log +1 -1
  2. package/.turbo/turbo-compile-typescript.log +1 -1
  3. package/.turbo/turbo-lint.log +1 -1
  4. package/.turbo/turbo-test.log +272 -667
  5. package/.turbo/turbo-transpile-typescript.log +5 -5
  6. package/CHANGELOG.md +42 -0
  7. package/build/js/index.js +411 -263
  8. package/build/js/index.js.map +1 -1
  9. package/build/tsconfig.tsbuildinfo +1 -1
  10. package/build/types/__tests__/utils.d.ts +4 -10
  11. package/build/types/__tests__/utils.d.ts.map +1 -1
  12. package/build/types/bannedDependencies.d.ts.map +1 -1
  13. package/build/types/fileContents.d.ts +1 -1
  14. package/build/types/fileContents.d.ts.map +1 -1
  15. package/build/types/index.d.ts +3 -3
  16. package/build/types/index.d.ts.map +1 -1
  17. package/build/types/mustSatisfyPeerDependencies.d.ts.map +1 -1
  18. package/build/types/nestedWorkspaces.d.ts.map +1 -1
  19. package/build/types/packageEntry.d.ts.map +1 -1
  20. package/build/types/packageOrder.d.ts.map +1 -1
  21. package/build/types/packageScript.d.ts.map +1 -1
  22. package/build/types/requireDependency.d.ts +12 -12
  23. package/build/types/requireDependency.d.ts.map +1 -1
  24. package/build/types/standardTsconfig.d.ts.map +1 -1
  25. package/build/types/util/checkAlpha.d.ts.map +1 -1
  26. package/build/types/util/createRuleFactory.d.ts.map +1 -1
  27. package/build/types/util/packageDependencyGraphService.d.ts.map +1 -1
  28. package/coverage/base.css +224 -0
  29. package/coverage/block-navigation.js +87 -0
  30. package/coverage/clover.xml +1887 -0
  31. package/coverage/coverage-final.json +19 -0
  32. package/coverage/favicon.png +0 -0
  33. package/coverage/index.html +131 -0
  34. package/coverage/prettify.css +1 -0
  35. package/coverage/prettify.js +2 -0
  36. package/coverage/sort-arrow-sprite.png +0 -0
  37. package/coverage/sorter.js +196 -0
  38. package/coverage/src/alphabeticalDependencies.ts.html +142 -0
  39. package/coverage/src/alphabeticalScripts.ts.html +136 -0
  40. package/coverage/src/bannedDependencies.ts.html +610 -0
  41. package/coverage/src/consistentDependencies.ts.html +394 -0
  42. package/coverage/src/consistentVersions.ts.html +619 -0
  43. package/coverage/src/fileContents.ts.html +409 -0
  44. package/coverage/src/index.html +311 -0
  45. package/coverage/src/index.ts.html +169 -0
  46. package/coverage/src/mustSatisfyPeerDependencies.ts.html +2605 -0
  47. package/coverage/src/nestedWorkspaces.ts.html +304 -0
  48. package/coverage/src/packageEntry.ts.html +376 -0
  49. package/coverage/src/packageOrder.ts.html +472 -0
  50. package/coverage/src/packageScript.ts.html +436 -0
  51. package/coverage/src/requireDependency.ts.html +349 -0
  52. package/coverage/src/standardTsconfig.ts.html +553 -0
  53. package/coverage/src/util/checkAlpha.ts.html +271 -0
  54. package/coverage/src/util/createRuleFactory.ts.html +196 -0
  55. package/coverage/src/util/index.html +161 -0
  56. package/coverage/src/util/makeDirectory.ts.html +157 -0
  57. package/coverage/src/util/packageDependencyGraphService.ts.html +508 -0
  58. package/package.json +15 -20
  59. package/src/__tests__/alphabeticalScripts.spec.ts +13 -5
  60. package/src/__tests__/bannedDependencies.spec.ts +47 -18
  61. package/src/__tests__/consistentDependencies.spec.ts +12 -6
  62. package/src/__tests__/consistentVersions.spec.ts +74 -20
  63. package/src/__tests__/fileContents.spec.ts +11 -7
  64. package/src/__tests__/mustSatisfyPeerDependencies.spec.ts +193 -78
  65. package/src/__tests__/nestedWorkspaces.spec.ts +12 -8
  66. package/src/__tests__/packageEntry.spec.ts +55 -49
  67. package/src/__tests__/packageOrder.spec.ts +78 -72
  68. package/src/__tests__/packageScript.spec.ts +27 -13
  69. package/src/__tests__/requireDependency.spec.ts +13 -7
  70. package/src/__tests__/utils.ts +18 -9
  71. package/src/bannedDependencies.ts +32 -15
  72. package/src/consistentDependencies.ts +22 -9
  73. package/src/consistentVersions.ts +84 -47
  74. package/src/fileContents.ts +24 -10
  75. package/src/index.ts +3 -3
  76. package/src/mustSatisfyPeerDependencies.ts +162 -66
  77. package/src/nestedWorkspaces.ts +23 -10
  78. package/src/packageEntry.ts +18 -11
  79. package/src/packageOrder.ts +9 -3
  80. package/src/packageScript.ts +37 -19
  81. package/src/requireDependency.ts +28 -11
  82. package/src/standardTsconfig.ts +32 -10
  83. package/src/util/checkAlpha.ts +5 -2
  84. package/src/util/createRuleFactory.ts +6 -2
  85. package/src/util/packageDependencyGraphService.ts +41 -14
  86. package/vitest.config.mjs +17 -0
  87. package/jest.config.cjs +0 -4
@@ -4,12 +4,12 @@
4
4
  * Licensed under the MIT license. See LICENSE file in the project root for details.
5
5
  *
6
6
  */
7
- import { describe, expect, it, beforeEach, jest, afterEach } from "@jest/globals";
8
7
  import { WorkspaceContextImpl } from "@monorepolint/core";
9
8
  import { SimpleHost } from "@monorepolint/utils";
10
9
  import { writeFileSync } from "fs";
11
10
  import * as path from "path";
12
11
  import * as tmp from "tmp";
12
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
13
13
  import { bannedDependencies, Options } from "../bannedDependencies.js";
14
14
  import { makeDirectoryRecursively } from "../util/makeDirectory.js";
15
15
  import { jsonToString } from "./utils.js";
@@ -26,7 +26,7 @@ describe("bannedDependencies", () => {
26
26
  cleanupJobs.push(() => dir.removeCallback());
27
27
  cwd = dir.name;
28
28
 
29
- const spy = jest.spyOn(process, "cwd");
29
+ const spy = vi.spyOn(process, "cwd");
30
30
  spy.mockReturnValue(cwd);
31
31
  });
32
32
 
@@ -46,11 +46,11 @@ describe("bannedDependencies", () => {
46
46
  verbose: false,
47
47
  silent: true,
48
48
  },
49
- new SimpleHost()
49
+ new SimpleHost(),
50
50
  );
51
51
 
52
52
  function checkAndSpy(options: Options) {
53
- const addErrorSpy = jest.spyOn(workspaceContext, "addError");
53
+ const addErrorSpy = vi.spyOn(workspaceContext, "addError");
54
54
  bannedDependencies({ options }).check(workspaceContext);
55
55
  return { addErrorSpy };
56
56
  }
@@ -77,15 +77,21 @@ describe("bannedDependencies", () => {
77
77
  });
78
78
  addFile("./package.json", rootPackageJson);
79
79
 
80
- const { addErrorSpy: addErrorSpy1 } = checkAndSpy({ bannedDependencies: ["ccc"] });
80
+ const { addErrorSpy: addErrorSpy1 } = checkAndSpy({
81
+ bannedDependencies: ["ccc"],
82
+ });
81
83
  expect(addErrorSpy1).toHaveBeenCalledTimes(1);
82
84
  addErrorSpy1.mockReset();
83
85
 
84
- const { addErrorSpy: addErrorSpy2 } = checkAndSpy({ bannedDependencies: ["ddd"] });
86
+ const { addErrorSpy: addErrorSpy2 } = checkAndSpy({
87
+ bannedDependencies: ["ddd"],
88
+ });
85
89
  expect(addErrorSpy2).toHaveBeenCalledTimes(0);
86
90
  addErrorSpy2.mockReset();
87
91
 
88
- const { addErrorSpy: addErrorSpy3 } = checkAndSpy({ bannedDependencies: ["ccc", "ddd"] });
92
+ const { addErrorSpy: addErrorSpy3 } = checkAndSpy({
93
+ bannedDependencies: ["ccc", "ddd"],
94
+ });
89
95
  expect(addErrorSpy3).toHaveBeenCalledTimes(1);
90
96
  addErrorSpy3.mockReset();
91
97
  });
@@ -100,15 +106,21 @@ describe("bannedDependencies", () => {
100
106
  });
101
107
  addFile("./package.json", rootPackageJson);
102
108
 
103
- const { addErrorSpy: addErrorSpy1 } = checkAndSpy({ bannedDependencies: ["c*c"] });
109
+ const { addErrorSpy: addErrorSpy1 } = checkAndSpy({
110
+ bannedDependencies: ["c*c"],
111
+ });
104
112
  expect(addErrorSpy1).toHaveBeenCalledTimes(1);
105
113
  addErrorSpy1.mockReset();
106
114
 
107
- const { addErrorSpy: addErrorSpy2 } = checkAndSpy({ bannedDependencies: ["d*d"] });
115
+ const { addErrorSpy: addErrorSpy2 } = checkAndSpy({
116
+ bannedDependencies: ["d*d"],
117
+ });
108
118
  expect(addErrorSpy2).toHaveBeenCalledTimes(0);
109
119
  addErrorSpy2.mockReset();
110
120
 
111
- const { addErrorSpy: addErrorSpy3 } = checkAndSpy({ bannedDependencies: ["c*c", "d*d"] });
121
+ const { addErrorSpy: addErrorSpy3 } = checkAndSpy({
122
+ bannedDependencies: ["c*c", "d*d"],
123
+ });
112
124
  expect(addErrorSpy3).toHaveBeenCalledTimes(1);
113
125
  addErrorSpy3.mockReset();
114
126
  });
@@ -123,15 +135,21 @@ describe("bannedDependencies", () => {
123
135
  });
124
136
  addFile("./package.json", rootPackageJson);
125
137
 
126
- const { addErrorSpy: addErrorSpy1 } = checkAndSpy({ bannedDependencies: { glob: ["c*c"] } });
138
+ const { addErrorSpy: addErrorSpy1 } = checkAndSpy({
139
+ bannedDependencies: { glob: ["c*c"] },
140
+ });
127
141
  expect(addErrorSpy1).toHaveBeenCalledTimes(1);
128
142
  addErrorSpy1.mockReset();
129
143
 
130
- const { addErrorSpy: addErrorSpy2 } = checkAndSpy({ bannedDependencies: { glob: ["d*d"] } });
144
+ const { addErrorSpy: addErrorSpy2 } = checkAndSpy({
145
+ bannedDependencies: { glob: ["d*d"] },
146
+ });
131
147
  expect(addErrorSpy2).toHaveBeenCalledTimes(0);
132
148
  addErrorSpy2.mockReset();
133
149
 
134
- const { addErrorSpy: addErrorSpy3 } = checkAndSpy({ bannedDependencies: { glob: ["c*c", "d*d"] } });
150
+ const { addErrorSpy: addErrorSpy3 } = checkAndSpy({
151
+ bannedDependencies: { glob: ["c*c", "d*d"] },
152
+ });
135
153
  expect(addErrorSpy3).toHaveBeenCalledTimes(1);
136
154
  addErrorSpy3.mockReset();
137
155
  });
@@ -146,15 +164,21 @@ describe("bannedDependencies", () => {
146
164
  });
147
165
  addFile("./package.json", rootPackageJson);
148
166
 
149
- const { addErrorSpy: addErrorSpy1 } = checkAndSpy({ bannedDependencies: { exact: ["ccc"] } });
167
+ const { addErrorSpy: addErrorSpy1 } = checkAndSpy({
168
+ bannedDependencies: { exact: ["ccc"] },
169
+ });
150
170
  expect(addErrorSpy1).toHaveBeenCalledTimes(1);
151
171
  addErrorSpy1.mockReset();
152
172
 
153
- const { addErrorSpy: addErrorSpy2 } = checkAndSpy({ bannedDependencies: { exact: ["ddd"] } });
173
+ const { addErrorSpy: addErrorSpy2 } = checkAndSpy({
174
+ bannedDependencies: { exact: ["ddd"] },
175
+ });
154
176
  expect(addErrorSpy2).toHaveBeenCalledTimes(0);
155
177
  addErrorSpy2.mockReset();
156
178
 
157
- const { addErrorSpy: addErrorSpy3 } = checkAndSpy({ bannedDependencies: { exact: ["ccc", "ddd"] } });
179
+ const { addErrorSpy: addErrorSpy3 } = checkAndSpy({
180
+ bannedDependencies: { exact: ["ccc", "ddd"] },
181
+ });
158
182
  expect(addErrorSpy3).toHaveBeenCalledTimes(1);
159
183
  addErrorSpy3.mockReset();
160
184
  });
@@ -181,9 +205,14 @@ describe("bannedDependencies", () => {
181
205
  },
182
206
  });
183
207
  addFile("./node_modules/aaa/node_modules/bbb/package.json", bbbPackageJson);
184
- addFile("./node_modules/aaa/node_modules/bbb/node_modules/ddd/package.json", EMPTY_PACKAGE);
208
+ addFile(
209
+ "./node_modules/aaa/node_modules/bbb/node_modules/ddd/package.json",
210
+ EMPTY_PACKAGE,
211
+ );
185
212
  addFile("./node_modules/aaa/node_modules/ccc/package.json", EMPTY_PACKAGE);
186
213
 
187
- expect(checkAndSpy({ bannedTransitiveDependencies: ["ccc", "ddd"] }).addErrorSpy).toHaveBeenCalledTimes(2);
214
+ expect(
215
+ checkAndSpy({ bannedTransitiveDependencies: ["ccc", "ddd"] }).addErrorSpy,
216
+ ).toHaveBeenCalledTimes(2);
188
217
  });
189
218
  });
@@ -9,10 +9,10 @@ import { SimpleHost } from "@monorepolint/utils";
9
9
  import { readFileSync, writeFileSync } from "fs";
10
10
  import * as path from "path";
11
11
  import * as tmp from "tmp";
12
+ import { afterEach, describe, expect, it, vi } from "vitest";
12
13
  import { consistentDependencies, Options } from "../consistentDependencies.js";
13
14
  import { makeDirectoryRecursively } from "../util/makeDirectory.js";
14
15
  import { jsonToString } from "./utils.js";
15
- import { describe, expect, it, afterEach, jest } from "@jest/globals";
16
16
 
17
17
  const PACKAGE_ROOT = jsonToString({
18
18
  workspaces: {
@@ -71,12 +71,14 @@ describe("consistentDependencies", () => {
71
71
  verbose: false,
72
72
  silent: true,
73
73
  },
74
- new SimpleHost()
74
+ new SimpleHost(),
75
75
  );
76
76
 
77
77
  function checkAndSpy(q: string, opts?: Options) {
78
- const context = workspaceContext.createChildContext(path.resolve(dir.name, q));
79
- const addErrorSpy = jest.spyOn(context, "addError");
78
+ const context = workspaceContext.createChildContext(
79
+ path.resolve(dir.name, q),
80
+ );
81
+ const addErrorSpy = vi.spyOn(context, "addError");
80
82
  consistentDependencies({ options: opts }).check(context);
81
83
  return { context, addErrorSpy };
82
84
  }
@@ -97,7 +99,9 @@ describe("consistentDependencies", () => {
97
99
  }
98
100
 
99
101
  it("checks correctly", () => {
100
- const { addFile, workspaceContext, checkAndSpy } = makeWorkspace({ fix: false });
102
+ const { addFile, workspaceContext, checkAndSpy } = makeWorkspace({
103
+ fix: false,
104
+ });
101
105
  addFile("./package.json", PACKAGE_ROOT);
102
106
  addFile("./packages/star/package.json", PACKAGE_CHILD_WITH_STAR);
103
107
  addFile("./packages/latest/package.json", PACKAGE_CHILD_WITH_LATEST);
@@ -136,7 +140,9 @@ describe("consistentDependencies", () => {
136
140
  addFile("./package.json", PACKAGE_ROOT);
137
141
  addFile("./packages/wrong/package.json", PACKAGE_CHILD_WITH_WRONG_VERSION);
138
142
 
139
- const ignored = checkAndSpy("./packages/wrong", { ignoredDependencies: ["foo"] });
143
+ const ignored = checkAndSpy("./packages/wrong", {
144
+ ignoredDependencies: ["foo"],
145
+ });
140
146
  expect(ignored.addErrorSpy).toHaveBeenCalledTimes(0);
141
147
  });
142
148
  });
@@ -9,9 +9,9 @@ import { WorkspaceContextImpl } from "@monorepolint/core";
9
9
  import { Host, PackageJson, SimpleHost } from "@monorepolint/utils";
10
10
  import * as path from "path";
11
11
  import * as tmp from "tmp";
12
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
12
13
  import { consistentVersions, Options } from "../consistentVersions.js";
13
14
  import { makeDirectoryRecursively } from "../util/makeDirectory.js";
14
- import { describe, expect, it, beforeEach, afterEach, jest } from "@jest/globals";
15
15
 
16
16
  describe("consistentVersions", () => {
17
17
  tmp.setGracefulCleanup();
@@ -24,7 +24,7 @@ describe("consistentVersions", () => {
24
24
  cleanupJobs.push(() => dir.removeCallback());
25
25
  cwd = dir.name;
26
26
 
27
- const spy = jest.spyOn(process, "cwd");
27
+ const spy = vi.spyOn(process, "cwd");
28
28
  spy.mockReturnValue(cwd);
29
29
  });
30
30
 
@@ -45,9 +45,9 @@ describe("consistentVersions", () => {
45
45
  verbose: false,
46
46
  silent: true,
47
47
  },
48
- host
48
+ host,
49
49
  );
50
- const addErrorSpy = jest.spyOn(workspaceContext, "addError");
50
+ const addErrorSpy = vi.spyOn(workspaceContext, "addError");
51
51
 
52
52
  function check(options: Options = { matchDependencyVersions: {} }) {
53
53
  consistentVersions({ options }).check(workspaceContext);
@@ -56,7 +56,11 @@ describe("consistentVersions", () => {
56
56
  return { addErrorSpy, check, host };
57
57
  }
58
58
 
59
- function addPackageJson(host: Host, filePath: string, packageJson: PackageJson) {
59
+ function addPackageJson(
60
+ host: Host,
61
+ filePath: string,
62
+ packageJson: PackageJson,
63
+ ) {
60
64
  const dirPath = path.resolve(cwd!, path.dirname(filePath));
61
65
  const resolvedFilePath = path.resolve(cwd!, filePath);
62
66
 
@@ -99,15 +103,24 @@ describe("consistentVersions", () => {
99
103
 
100
104
  it("Fixes packages that have an incorrect dependency version", async () => {
101
105
  const { addErrorSpy, check, host } = makeWorkspace(true);
102
- const readTestPackageJson = addPackageJson(host, "./package.json", testPackageJson);
106
+ const readTestPackageJson = addPackageJson(
107
+ host,
108
+ "./package.json",
109
+ testPackageJson,
110
+ );
103
111
 
104
112
  const requiredGreatLibVersion = "1.2.3";
105
113
  expect(addErrorSpy).toHaveBeenCalledTimes(0);
106
114
  check({
107
- matchDependencyVersions: { both: testPackageJson.dependencies!.both, greatLib: requiredGreatLibVersion },
115
+ matchDependencyVersions: {
116
+ both: testPackageJson.dependencies!.both,
117
+ greatLib: requiredGreatLibVersion,
118
+ },
108
119
  });
109
120
  expect(addErrorSpy).toHaveBeenCalledTimes(1);
110
- expect(readTestPackageJson().dependencies!.greatLib).toEqual(requiredGreatLibVersion);
121
+ expect(readTestPackageJson().dependencies!.greatLib).toEqual(
122
+ requiredGreatLibVersion,
123
+ );
111
124
  });
112
125
 
113
126
  it("Ignores packages that have a correct dependency version", async () => {
@@ -126,13 +139,24 @@ describe("consistentVersions", () => {
126
139
 
127
140
  it("Fixes packages that have an incorrect devDependency version", async () => {
128
141
  const { addErrorSpy, check, host } = makeWorkspace(true);
129
- const readTestPackageJson = addPackageJson(host, "./package.json", testPackageJson);
142
+ const readTestPackageJson = addPackageJson(
143
+ host,
144
+ "./package.json",
145
+ testPackageJson,
146
+ );
130
147
 
131
148
  const requiredElseLibVersion = "1.2.3";
132
149
  expect(addErrorSpy).toHaveBeenCalledTimes(0);
133
- check({ matchDependencyVersions: { both: testPackageJson.dependencies!.both, else: requiredElseLibVersion } });
150
+ check({
151
+ matchDependencyVersions: {
152
+ both: testPackageJson.dependencies!.both,
153
+ else: requiredElseLibVersion,
154
+ },
155
+ });
134
156
  expect(addErrorSpy).toHaveBeenCalledTimes(1);
135
- expect(readTestPackageJson().devDependencies!.else).toEqual(requiredElseLibVersion);
157
+ expect(readTestPackageJson().devDependencies!.else).toEqual(
158
+ requiredElseLibVersion,
159
+ );
136
160
  });
137
161
 
138
162
  it("Ignores packages that have a correct devDependency version", async () => {
@@ -151,14 +175,22 @@ describe("consistentVersions", () => {
151
175
 
152
176
  it("Fixes packages that have an incorrect dependency and devDependency versions", async () => {
153
177
  const { addErrorSpy, check, host } = makeWorkspace(true);
154
- const readTestPackageJson = addPackageJson(host, "./package.json", testPackageJson);
178
+ const readTestPackageJson = addPackageJson(
179
+ host,
180
+ "./package.json",
181
+ testPackageJson,
182
+ );
155
183
 
156
184
  const requiredBothVersion = "1.2.3";
157
185
  expect(addErrorSpy).toHaveBeenCalledTimes(0);
158
186
  check({ matchDependencyVersions: { both: requiredBothVersion } });
159
187
  expect(addErrorSpy).toHaveBeenCalledTimes(2);
160
- expect(readTestPackageJson().dependencies!.both).toEqual(requiredBothVersion);
161
- expect(readTestPackageJson().devDependencies!.both).toEqual(requiredBothVersion);
188
+ expect(readTestPackageJson().dependencies!.both).toEqual(
189
+ requiredBothVersion,
190
+ );
191
+ expect(readTestPackageJson().devDependencies!.both).toEqual(
192
+ requiredBothVersion,
193
+ );
162
194
  });
163
195
  });
164
196
 
@@ -187,13 +219,35 @@ describe("consistentVersions", () => {
187
219
  addPackageJson(host, "./package.json", testPackageJson);
188
220
 
189
221
  expect(addErrorSpy).toHaveBeenCalledTimes(0);
190
- check({ matchDependencyVersions: { greatLib: [testPackageJson.dependencies!.greatLib] } });
222
+ check({
223
+ matchDependencyVersions: {
224
+ greatLib: [testPackageJson.dependencies!.greatLib],
225
+ },
226
+ });
191
227
  expect(addErrorSpy).toHaveBeenCalledTimes(0);
192
- check({ matchDependencyVersions: { greatLib: ["1", "2", testPackageJson.dependencies!.greatLib] } });
228
+ check({
229
+ matchDependencyVersions: {
230
+ greatLib: ["1", "2", testPackageJson.dependencies!.greatLib],
231
+ },
232
+ });
193
233
  expect(addErrorSpy).toHaveBeenCalledTimes(0);
194
- check({ matchDependencyVersions: { greatLib: ["1", "2", testPackageJson.dependencies!.greatLib, "99", "100"] } });
234
+ check({
235
+ matchDependencyVersions: {
236
+ greatLib: [
237
+ "1",
238
+ "2",
239
+ testPackageJson.dependencies!.greatLib,
240
+ "99",
241
+ "100",
242
+ ],
243
+ },
244
+ });
195
245
  expect(addErrorSpy).toHaveBeenCalledTimes(0);
196
- check({ matchDependencyVersions: { greatLib: [testPackageJson.dependencies!.greatLib, "99", "100"] } });
246
+ check({
247
+ matchDependencyVersions: {
248
+ greatLib: [testPackageJson.dependencies!.greatLib, "99", "100"],
249
+ },
250
+ });
197
251
  expect(addErrorSpy).toHaveBeenCalledTimes(0);
198
252
  });
199
253
 
@@ -212,12 +266,12 @@ describe("consistentVersions", () => {
212
266
  expect(addErrorSpy.mock.calls[0][0].message).toEqual(
213
267
  `Expected dependency on both to match one of '["99","100"]', got '${
214
268
  testPackageJson.dependencies!.both
215
- }' instead.`
269
+ }' instead.`,
216
270
  );
217
271
  expect(addErrorSpy.mock.calls[1][0].message).toEqual(
218
272
  `Expected devDependency on both to match one of '["99","100"]', got '${
219
273
  testPackageJson.devDependencies!.both
220
- }' instead.`
274
+ }' instead.`,
221
275
  );
222
276
  });
223
277
  });
@@ -6,17 +6,21 @@
6
6
  */
7
7
 
8
8
  // tslint:disable:no-console
9
- import { createTestingWorkspace, HOST_FACTORIES, TestingWorkspace } from "./utils.js";
10
9
  import { AddErrorOptions, Failure } from "@monorepolint/config";
10
+ import { beforeEach, describe, expect, it, MockInstance, vi } from "vitest";
11
11
  import { fileContents } from "../fileContents.js";
12
- import { describe, expect, it, beforeEach, jest } from "@jest/globals";
12
+ import {
13
+ createTestingWorkspace,
14
+ HOST_FACTORIES,
15
+ TestingWorkspace,
16
+ } from "./utils.js";
13
17
 
14
18
  const EXPECTED_FOO_FILE = "hello world";
15
19
 
16
20
  describe.each(HOST_FACTORIES)("fileContents ($name)", (hostFactory) => {
17
21
  describe("fix: true", () => {
18
22
  let workspace: TestingWorkspace;
19
- let spy: jest.SpiedFunction<(opts: AddErrorOptions) => void>;
23
+ let spy: MockInstance<(opts: AddErrorOptions) => void>;
20
24
 
21
25
  beforeEach(async () => {
22
26
  workspace = await createTestingWorkspace({
@@ -25,7 +29,7 @@ describe.each(HOST_FACTORIES)("fileContents ($name)", (hostFactory) => {
25
29
  });
26
30
  workspace.writeFile("shared/foo-template.txt", EXPECTED_FOO_FILE);
27
31
 
28
- spy = jest.spyOn(workspace.context, "addError");
32
+ spy = vi.spyOn(workspace.context, "addError");
29
33
  });
30
34
 
31
35
  it("works with async generator", async () => {
@@ -44,7 +48,7 @@ describe.each(HOST_FACTORIES)("fileContents ($name)", (hostFactory) => {
44
48
  file: "foo.txt",
45
49
  hasFixer: true,
46
50
  message: "Expect file contents to match",
47
- })
51
+ }),
48
52
  );
49
53
 
50
54
  expect(workspace.readFile("foo.txt")).toEqual(EXPECTED_FOO_FILE);
@@ -68,7 +72,7 @@ describe.each(HOST_FACTORIES)("fileContents ($name)", (hostFactory) => {
68
72
  file: "foo.txt",
69
73
  hasFixer: true,
70
74
  message: "Expect file contents to match",
71
- })
75
+ }),
72
76
  );
73
77
 
74
78
  expect(workspace.readFile("foo.txt")).toEqual(EXPECTED_FOO_FILE);
@@ -92,7 +96,7 @@ describe.each(HOST_FACTORIES)("fileContents ($name)", (hostFactory) => {
92
96
  file: "nested/foo.txt",
93
97
  hasFixer: true,
94
98
  message: "Expect file contents to match",
95
- })
99
+ }),
96
100
  );
97
101
 
98
102
  expect(workspace.readFile("nested/foo.txt")).toEqual(EXPECTED_FOO_FILE);