Skip to content

Commit 695097b

Browse files
authored
chore: update typebox (#15450)
1 parent 008127c commit 695097b

File tree

5 files changed

+47
-47
lines changed

5 files changed

+47
-47
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
- `[jest-runtime]` Support `import.meta.resolve` ([#14930](https://github.com/jestjs/jest/pull/14930))
3939
- `[jest-runtime]` [**BREAKING**] Make it mandatory to pass `globalConfig` to the `Runtime` constructor ([#15044](https://github.com/jestjs/jest/pull/15044))
4040
- `[jest-runtime]` Add `unstable_unmockModule` ([#15080](https://github.com/jestjs/jest/pull/15080))
41-
- `[@jest/schemas]` Upgrade `@sinclair/typebox` to v0.31 ([#14072](https://github.com/jestjs/jest/pull/14072))
41+
- `[@jest/schemas]` Upgrade `@sinclair/typebox` to v0.34 ([#15450](https://github.com/jestjs/jest/pull/15450))
4242
- `[@jest/types]` `test.each()`: Accept a readonly (`as const`) table properly ([#14565](https://github.com/jestjs/jest/pull/14565))
4343
- `[@jest/types]` Improve argument type inference passed to `test` and `describe` callback functions from `each` tables ([#14920](https://github.com/jestjs/jest/pull/14920))
4444
- `[jest-snapshot]` [**BREAKING**] Add support for [Error causes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause) in snapshots ([#13965](https://github.com/facebook/jest/pull/13965))

packages/jest-schemas/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"./package.json": "./package.json"
2020
},
2121
"dependencies": {
22-
"@sinclair/typebox": "^0.33.0"
22+
"@sinclair/typebox": "^0.34.0"
2323
},
2424
"engines": {
2525
"node": "^16.10.0 || ^18.12.0 || >=20.0.0"

packages/jest-schemas/src/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import {type Static, Type} from '@sinclair/typebox';
9-
import {RawFakeTimers, RawInitialOptions, RawSnapshotFormat} from './raw-types';
8+
import type {Static} from '@sinclair/typebox';
9+
import * as types from './raw-types';
1010

11-
export const SnapshotFormat = Type.Strict(RawSnapshotFormat);
12-
export type SnapshotFormat = Static<typeof RawSnapshotFormat>;
11+
export const SnapshotFormat = types.SnapshotFormat;
12+
export type SnapshotFormat = Static<typeof SnapshotFormat>;
1313

14-
export const InitialOptions = Type.Strict(RawInitialOptions);
15-
export type InitialOptions = Static<typeof RawInitialOptions>;
14+
export const InitialOptions = types.InitialOptions;
15+
export type InitialOptions = Static<typeof InitialOptions>;
1616

17-
export const FakeTimers = Type.Strict(RawFakeTimers);
18-
export type FakeTimers = Static<typeof RawFakeTimers>;
17+
export const FakeTimers = types.FakeTimers;
18+
export type FakeTimers = Static<typeof FakeTimers>;

packages/jest-schemas/src/raw-types.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import {type Static, Type} from '@sinclair/typebox';
1111

12-
export const RawSnapshotFormat = Type.Partial(
12+
export const SnapshotFormat = Type.Partial(
1313
Type.Object({
1414
callToJSON: Type.Boolean(),
1515
compareKeys: Type.Null(),
@@ -34,12 +34,12 @@ export const RawSnapshotFormat = Type.Partial(
3434
}),
3535
);
3636

37-
const RawCoverageProvider = Type.Union([
37+
const CoverageProvider = Type.Union([
3838
Type.Literal('babel'),
3939
Type.Literal('v8'),
4040
]);
4141

42-
const RawCoverageThresholdValue = Type.Partial(
42+
const CoverageThresholdValue = Type.Partial(
4343
Type.Object({
4444
branches: Type.Number({minimum: 0, maximum: 100}),
4545
functions: Type.Number({minimum: 0, maximum: 100}),
@@ -48,15 +48,15 @@ const RawCoverageThresholdValue = Type.Partial(
4848
}),
4949
);
5050

51-
const RawCoverageThresholdBase = Type.Object(
52-
{global: RawCoverageThresholdValue},
53-
{additionalProperties: RawCoverageThresholdValue},
51+
const CoverageThresholdBase = Type.Object(
52+
{global: CoverageThresholdValue},
53+
{additionalProperties: CoverageThresholdValue},
5454
);
5555

56-
const RawCoverageThreshold = Type.Unsafe<{
57-
global: Static<typeof RawCoverageThresholdValue>;
58-
[path: string]: Static<typeof RawCoverageThresholdValue>;
59-
}>(RawCoverageThresholdBase);
56+
const CoverageThreshold = Type.Unsafe<{
57+
global: Static<typeof CoverageThresholdValue>;
58+
[path: string]: Static<typeof CoverageThresholdValue>;
59+
}>(CoverageThresholdBase);
6060

6161
// TODO: add type test that these are all the colors available in chalk.ForegroundColor
6262
export const ChalkForegroundColors = Type.Union([
@@ -80,13 +80,13 @@ export const ChalkForegroundColors = Type.Union([
8080
Type.Literal('whiteBright'),
8181
]);
8282

83-
const RawDisplayName = Type.Object({
83+
const DisplayName = Type.Object({
8484
name: Type.String(),
8585
color: ChalkForegroundColors,
8686
});
8787

8888
// TODO: verify these are the names of istanbulReport.ReportOptions
89-
export const RawCoverageReporterNames = Type.Union([
89+
export const CoverageReporterNames = Type.Union([
9090
Type.Literal('clover'),
9191
Type.Literal('cobertura'),
9292
Type.Literal('html-spa'),
@@ -102,17 +102,17 @@ export const RawCoverageReporterNames = Type.Union([
102102
Type.Literal('text-summary'),
103103
]);
104104

105-
const RawCoverageReporters = Type.Array(
105+
const CoverageReporters = Type.Array(
106106
Type.Union([
107-
RawCoverageReporterNames,
107+
CoverageReporterNames,
108108
Type.Tuple([
109-
RawCoverageReporterNames,
109+
CoverageReporterNames,
110110
Type.Record(Type.String(), Type.Unknown()),
111111
]),
112112
]),
113113
);
114114

115-
const RawGlobalFakeTimersConfig = Type.Partial(
115+
const GlobalFakeTimersConfig = Type.Partial(
116116
Type.Object({
117117
enableGlobally: Type.Boolean({
118118
description:
@@ -122,7 +122,7 @@ const RawGlobalFakeTimersConfig = Type.Partial(
122122
}),
123123
);
124124

125-
const RawFakeableAPI = Type.Union([
125+
const FakeableAPI = Type.Union([
126126
Type.Literal('Date'),
127127
Type.Literal('hrtime'),
128128
Type.Literal('nextTick'),
@@ -140,15 +140,15 @@ const RawFakeableAPI = Type.Union([
140140
Type.Literal('clearTimeout'),
141141
]);
142142

143-
const RawFakeTimersConfig = Type.Partial(
143+
const FakeTimersConfig = Type.Partial(
144144
Type.Object({
145145
advanceTimers: Type.Union([Type.Boolean(), Type.Number({minimum: 0})], {
146146
description:
147147
'If set to `true` all timers will be advanced automatically by 20 milliseconds every 20 milliseconds. A custom ' +
148148
'time delta may be provided by passing a number.',
149149
default: false,
150150
}),
151-
doNotFake: Type.Array(RawFakeableAPI, {
151+
doNotFake: Type.Array(FakeableAPI, {
152152
description:
153153
'List of names of APIs (e.g. `Date`, `nextTick()`, `setImmediate()`, `setTimeout()`) that should not be faked.' +
154154
'\n\nThe default is `[]`, meaning all APIs are faked.',
@@ -173,7 +173,7 @@ const RawFakeTimersConfig = Type.Partial(
173173
}),
174174
);
175175

176-
const RawLegacyFakeTimersConfig = Type.Partial(
176+
const LegacyFakeTimersConfig = Type.Partial(
177177
Type.Object({
178178
legacyFakeTimers: Type.Literal(true, {
179179
description:
@@ -183,12 +183,12 @@ const RawLegacyFakeTimersConfig = Type.Partial(
183183
}),
184184
);
185185

186-
export const RawFakeTimers = Type.Intersect([
187-
RawGlobalFakeTimersConfig,
188-
Type.Union([RawFakeTimersConfig, RawLegacyFakeTimersConfig]),
186+
export const FakeTimers = Type.Intersect([
187+
GlobalFakeTimersConfig,
188+
Type.Union([FakeTimersConfig, LegacyFakeTimersConfig]),
189189
]);
190190

191-
const RawHasteConfig = Type.Partial(
191+
const HasteConfig = Type.Partial(
192192
Type.Object({
193193
computeSha1: Type.Boolean({
194194
description: 'Whether to hash files using SHA-1.',
@@ -225,7 +225,7 @@ const RawHasteConfig = Type.Partial(
225225
}),
226226
);
227227

228-
export const RawInitialOptions = Type.Partial(
228+
export const InitialOptions = Type.Partial(
229229
Type.Object({
230230
automock: Type.Boolean(),
231231
bail: Type.Union([Type.Boolean(), Type.Number()]),
@@ -239,16 +239,16 @@ export const RawInitialOptions = Type.Partial(
239239
collectCoverageFrom: Type.Array(Type.String()),
240240
coverageDirectory: Type.String(),
241241
coveragePathIgnorePatterns: Type.Array(Type.String()),
242-
coverageProvider: RawCoverageProvider,
243-
coverageReporters: RawCoverageReporters,
244-
coverageThreshold: RawCoverageThreshold,
242+
coverageProvider: CoverageProvider,
243+
coverageReporters: CoverageReporters,
244+
coverageThreshold: CoverageThreshold,
245245
dependencyExtractor: Type.String(),
246246
detectLeaks: Type.Boolean(),
247247
detectOpenHandles: Type.Boolean(),
248-
displayName: Type.Union([Type.String(), RawDisplayName]),
248+
displayName: Type.Union([Type.String(), DisplayName]),
249249
expand: Type.Boolean(),
250250
extensionsToTreatAsEsm: Type.Array(Type.String()),
251-
fakeTimers: RawFakeTimers,
251+
fakeTimers: FakeTimers,
252252
filter: Type.String(),
253253
findRelatedTests: Type.Boolean(),
254254
forceCoverageMatch: Type.Array(Type.String()),
@@ -257,7 +257,7 @@ export const RawInitialOptions = Type.Partial(
257257
globals: Type.Record(Type.String(), Type.Unknown()),
258258
globalSetup: Type.Union([Type.String(), Type.Null()]),
259259
globalTeardown: Type.Union([Type.String(), Type.Null()]),
260-
haste: RawHasteConfig,
260+
haste: HasteConfig,
261261
id: Type.String(),
262262
injectGlobals: Type.Boolean(),
263263
reporters: Type.Array(
@@ -317,7 +317,7 @@ export const RawInitialOptions = Type.Partial(
317317
slowTestThreshold: Type.Number(),
318318
snapshotResolver: Type.String(),
319319
snapshotSerializers: Type.Array(Type.String()),
320-
snapshotFormat: RawSnapshotFormat,
320+
snapshotFormat: SnapshotFormat,
321321
errorOnDeprecated: Type.Boolean(),
322322
testEnvironment: Type.String(),
323323
testEnvironmentOptions: Type.Record(Type.String(), Type.Unknown()),

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,7 +3413,7 @@ __metadata:
34133413
version: 0.0.0-use.local
34143414
resolution: "@jest/schemas@workspace:packages/jest-schemas"
34153415
dependencies:
3416-
"@sinclair/typebox": ^0.33.0
3416+
"@sinclair/typebox": ^0.34.0
34173417
languageName: unknown
34183418
linkType: soft
34193419

@@ -4916,10 +4916,10 @@ __metadata:
49164916
languageName: node
49174917
linkType: hard
49184918

4919-
"@sinclair/typebox@npm:^0.33.0":
4920-
version: 0.33.7
4921-
resolution: "@sinclair/typebox@npm:0.33.7"
4922-
checksum: 96743096e8f15024148e2fcbaf236ada0cf4dd8d8f0c1b0d49a9de9003bda2b2a2b5084971d5587a2a0c64cd238a1f9dbbafe6c97af4154975f80dadf34ec0c0
4919+
"@sinclair/typebox@npm:^0.34.0":
4920+
version: 0.34.13
4921+
resolution: "@sinclair/typebox@npm:0.34.13"
4922+
checksum: abc841a407396e8f49afe9b42bf60133207029e9ac483861750b40bcc41a5de46b9b1b6026f5f34664de32a1941cad35e0de36e3a6f5f94c15c33a0d59260828
49234923
languageName: node
49244924
linkType: hard
49254925

0 commit comments

Comments
 (0)