Skip to content

Commit 40c5f00

Browse files
TkDodoandrewshie-sentry
authored andcommitted
ref: make sure to include all config files in tsconfig (#88327)
and fix the resulting type errors in jest.config.ts
1 parent a3710c4 commit 40c5f00

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

jest.config.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if (!!JEST_TEST_BALANCER && !CI) {
3939
);
4040
}
4141

42-
let JEST_TESTS;
42+
let JEST_TESTS: string[] | undefined;
4343

4444
// prevents forkbomb as we don't want jest --listTests --json
4545
// to reexec itself here
@@ -99,12 +99,12 @@ function getTestsForGroup(
9999
const SUITE_P50_DURATION_MS = 1500;
100100

101101
// First, iterate over all of the tests we have stats for.
102-
for (const test in testStats) {
103-
if (testStats[test] <= 0) {
102+
Object.entries(testStats).forEach(([test, duration]) => {
103+
if (duration <= 0) {
104104
throw new Error(`Test duration is <= 0 for ${test}`);
105105
}
106-
tests.set(test, testStats[test]);
107-
}
106+
tests.set(test, duration);
107+
});
108108
// Then, iterate over all of the remaining tests and assign them a default duration.
109109
for (const test of allTests) {
110110
if (tests.has(test)) {
@@ -139,15 +139,15 @@ function getTestsForGroup(
139139
// test that may exceed our target duration. For example, if target runtime for each group is
140140
// 10 seconds, we have currently accounted for 9 seconds, and the next test is 5 seconds, we
141141
// want to move that test to the next group so as to avoid a 40% imbalance.
142-
const peek = testsSortedByPath[testsSortedByPath.length - 1];
142+
const peek = testsSortedByPath[testsSortedByPath.length - 1]!;
143143
if (duration + peek[1] > targetDuration && peek[1] > 30_000) {
144144
break;
145145
}
146146
const nextTest = testsSortedByPath.pop();
147147
if (!nextTest) {
148148
throw new TypeError('Received falsy test' + JSON.stringify(nextTest));
149149
}
150-
groups[group].push(nextTest[0]);
150+
groups[group]!.push(nextTest[0]);
151151
duration += nextTest[1];
152152
}
153153
}
@@ -159,7 +159,7 @@ function getTestsForGroup(
159159
if (!nextTest) {
160160
throw new TypeError('Received falsy test' + JSON.stringify(nextTest));
161161
}
162-
groups[i % 4].push(nextTest[0]);
162+
groups[i % 4]!.push(nextTest[0]);
163163
i++;
164164
}
165165

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"allowJs": true
55
},
66
"include": [
7-
"eslint.config.mjs",
7+
"*.config.mjs",
8+
"*.config.ts",
89
"static/app",
910
"static/gsApp",
1011
"static/gsAdmin",

0 commit comments

Comments
 (0)