diff --git a/packages/@sanity/types/jest.config.mjs b/packages/@sanity/types/jest.config.mjs deleted file mode 100644 index fc29f9a54e1..00000000000 --- a/packages/@sanity/types/jest.config.mjs +++ /dev/null @@ -1,6 +0,0 @@ -import {createJestConfig, readPackageName} from '@repo/test-config/jest' - -export default createJestConfig({ - displayName: readPackageName(import.meta.url), - testEnvironment: 'node', -}) diff --git a/packages/@sanity/types/package.json b/packages/@sanity/types/package.json index 49a0fa7eca1..00b837b2b7e 100644 --- a/packages/@sanity/types/package.json +++ b/packages/@sanity/types/package.json @@ -44,8 +44,8 @@ "check:types": "tsc --project tsconfig.lib.json", "clean": "rimraf lib", "prepublishOnly": "turbo run build", - "test": "jest", - "test:watch": "jest --watchAll", + "test": "vitest run", + "test:watch": "vitest watch", "watch": "pkg-utils watch" }, "dependencies": { @@ -53,10 +53,12 @@ "@types/react": "^18.3.5" }, "devDependencies": { - "@jest/globals": "^29.7.0", "@repo/package.config": "workspace:*", "@repo/test-config": "workspace:*", "@sanity/insert-menu": "1.0.9", - "rimraf": "^3.0.2" + "@vitejs/plugin-react": "^4.3.1", + "react": "^18.3.1", + "rimraf": "^3.0.2", + "vitest": "^2.1.1" } } diff --git a/packages/@sanity/types/test/alias.test.ts b/packages/@sanity/types/test/alias.test.ts index 3717de4d5e1..1b8e622afda 100644 --- a/packages/@sanity/types/test/alias.test.ts +++ b/packages/@sanity/types/test/alias.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/array.test.ts b/packages/@sanity/types/test/array.test.ts index 0931a4aaf00..79424f0ca36 100644 --- a/packages/@sanity/types/test/array.test.ts +++ b/packages/@sanity/types/test/array.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/block.test.ts b/packages/@sanity/types/test/block.test.ts index ef03e058f88..412383439f6 100644 --- a/packages/@sanity/types/test/block.test.ts +++ b/packages/@sanity/types/test/block.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/boolean.test.ts b/packages/@sanity/types/test/boolean.test.ts index c5148ea9f96..1ba1a92abc8 100644 --- a/packages/@sanity/types/test/boolean.test.ts +++ b/packages/@sanity/types/test/boolean.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/date.test.ts b/packages/@sanity/types/test/date.test.ts index f1fe123a44f..bdf09667d74 100644 --- a/packages/@sanity/types/test/date.test.ts +++ b/packages/@sanity/types/test/date.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/datetime.test.ts b/packages/@sanity/types/test/datetime.test.ts index 8ccb21b633c..d3c1202473c 100644 --- a/packages/@sanity/types/test/datetime.test.ts +++ b/packages/@sanity/types/test/datetime.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/document.test.ts b/packages/@sanity/types/test/document.test.ts index c7f6c9ce682..bd032be8e19 100644 --- a/packages/@sanity/types/test/document.test.ts +++ b/packages/@sanity/types/test/document.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/email.test.ts b/packages/@sanity/types/test/email.test.ts index 0e58d2c96e1..c8f1d85eb66 100644 --- a/packages/@sanity/types/test/email.test.ts +++ b/packages/@sanity/types/test/email.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ import {type BooleanDefinition, type EmailDefinition} from '../src/schema/definition' diff --git a/packages/@sanity/types/test/file.test.ts b/packages/@sanity/types/test/file.test.ts index c24ddfcd783..4ab5c464c2a 100644 --- a/packages/@sanity/types/test/file.test.ts +++ b/packages/@sanity/types/test/file.test.ts @@ -1,10 +1,10 @@ -import {describe, it} from '@jest/globals' /* eslint-disable @typescript-eslint/no-unused-vars */ /** * Some of these tests have no expect statement; * use of ts-expect-error serves the same purpose - TypeScript is the testrunner here */ import {type FileDefinition, type StringDefinition} from '@sanity/types' +import {describe, it} from 'vitest' import {defineField, defineType} from '../src/schema/types' diff --git a/packages/@sanity/types/test/generic.test.tsx b/packages/@sanity/types/test/generic.test.tsx index 22cd671e50c..efe75979197 100644 --- a/packages/@sanity/types/test/generic.test.tsx +++ b/packages/@sanity/types/test/generic.test.tsx @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/geopoint.test.ts b/packages/@sanity/types/test/geopoint.test.ts index 6356e1a9bf2..e6341edcf8d 100644 --- a/packages/@sanity/types/test/geopoint.test.ts +++ b/packages/@sanity/types/test/geopoint.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/image.test.ts b/packages/@sanity/types/test/image.test.ts index 4fa41524de8..4221adfc380 100644 --- a/packages/@sanity/types/test/image.test.ts +++ b/packages/@sanity/types/test/image.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/number.test.ts b/packages/@sanity/types/test/number.test.ts index 8b890c5bb93..b9c6935dac0 100644 --- a/packages/@sanity/types/test/number.test.ts +++ b/packages/@sanity/types/test/number.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/object.test.ts b/packages/@sanity/types/test/object.test.ts index 39d891d9ed0..dd25798c244 100644 --- a/packages/@sanity/types/test/object.test.ts +++ b/packages/@sanity/types/test/object.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/reference.test.ts b/packages/@sanity/types/test/reference.test.ts index 8d428d68648..60539411682 100644 --- a/packages/@sanity/types/test/reference.test.ts +++ b/packages/@sanity/types/test/reference.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/slug.test.ts b/packages/@sanity/types/test/slug.test.ts index 0b3cd8f5af7..59b99325669 100644 --- a/packages/@sanity/types/test/slug.test.ts +++ b/packages/@sanity/types/test/slug.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/string.test.ts b/packages/@sanity/types/test/string.test.ts index 843defd403b..f311508e481 100644 --- a/packages/@sanity/types/test/string.test.ts +++ b/packages/@sanity/types/test/string.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/text.test.ts b/packages/@sanity/types/test/text.test.ts index 9dc7c9dc2a1..9e07d2eea9e 100644 --- a/packages/@sanity/types/test/text.test.ts +++ b/packages/@sanity/types/test/text.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/test/typeMerge.test.ts b/packages/@sanity/types/test/typeMerge.test.ts index 6b457a8e344..366ed8bbca6 100644 --- a/packages/@sanity/types/test/typeMerge.test.ts +++ b/packages/@sanity/types/test/typeMerge.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' import {type ExtensionTypeExampleDef, type ObjectDefinition} from '../src/schema/definition' import {defineType} from '../src/schema/types' diff --git a/packages/@sanity/types/test/url.test.ts b/packages/@sanity/types/test/url.test.ts index 2eab9bd0d49..ced13927718 100644 --- a/packages/@sanity/types/test/url.test.ts +++ b/packages/@sanity/types/test/url.test.ts @@ -1,4 +1,4 @@ -import {describe, it} from '@jest/globals' +import {describe, it} from 'vitest' /* eslint-disable @typescript-eslint/no-unused-vars */ /** diff --git a/packages/@sanity/types/vitest.config.mts b/packages/@sanity/types/vitest.config.mts new file mode 100644 index 00000000000..c38d69d9c06 --- /dev/null +++ b/packages/@sanity/types/vitest.config.mts @@ -0,0 +1,6 @@ +import {defineConfig} from '@repo/test-config/vitest' +import react from '@vitejs/plugin-react' + +export default defineConfig({ + plugins: [react()], +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3b5d31f42dc..9f2e2e24e3b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1221,9 +1221,6 @@ importers: specifier: ^18.3.5 version: 18.3.5 devDependencies: - '@jest/globals': - specifier: ^29.7.0 - version: 29.7.0 '@repo/package.config': specifier: workspace:* version: link:../../@repo/package.config @@ -1232,10 +1229,19 @@ importers: version: link:../../@repo/test-config '@sanity/insert-menu': specifier: 1.0.9 - version: 1.0.9(@sanity/types@packages+@sanity+types)(react-dom@19.0.0-rc-f994737d14-20240522(react@19.0.0-rc-f994737d14-20240522))(react-is@19.0.0-rc-a7d1240c-20240731)(react@19.0.0-rc-f994737d14-20240522)(styled-components@6.1.13(react-dom@19.0.0-rc-f994737d14-20240522(react@19.0.0-rc-f994737d14-20240522))(react@19.0.0-rc-f994737d14-20240522)) + version: 1.0.9(@sanity/types@packages+@sanity+types)(react-dom@19.0.0-rc-f994737d14-20240522(react@18.3.1))(react-is@19.0.0-rc-a7d1240c-20240731)(react@18.3.1)(styled-components@6.1.13(react-dom@19.0.0-rc-f994737d14-20240522(react@18.3.1))(react@18.3.1)) + '@vitejs/plugin-react': + specifier: ^4.3.1 + version: 4.3.1(vite@5.4.5(@types/node@22.5.4)(terser@5.32.0)) + react: + specifier: ^18.3.1 + version: 18.3.1 rimraf: specifier: ^3.0.2 version: 3.0.2 + vitest: + specifier: ^2.1.1 + version: 2.1.1(@types/node@22.5.4)(jsdom@23.2.0)(terser@5.32.0) packages/@sanity/util: dependencies: @@ -14985,14 +14991,14 @@ snapshots: transitivePeerDependencies: - styled-components - '@sanity/insert-menu@1.0.9(@sanity/types@packages+@sanity+types)(react-dom@19.0.0-rc-f994737d14-20240522(react@19.0.0-rc-f994737d14-20240522))(react-is@19.0.0-rc-a7d1240c-20240731)(react@19.0.0-rc-f994737d14-20240522)(styled-components@6.1.13(react-dom@19.0.0-rc-f994737d14-20240522(react@19.0.0-rc-f994737d14-20240522))(react@19.0.0-rc-f994737d14-20240522))': + '@sanity/insert-menu@1.0.9(@sanity/types@packages+@sanity+types)(react-dom@19.0.0-rc-f994737d14-20240522(react@18.3.1))(react-is@19.0.0-rc-a7d1240c-20240731)(react@18.3.1)(styled-components@6.1.13(react-dom@19.0.0-rc-f994737d14-20240522(react@18.3.1))(react@18.3.1))': dependencies: - '@sanity/icons': 3.4.0(react@19.0.0-rc-f994737d14-20240522) + '@sanity/icons': 3.4.0(react@18.3.1) '@sanity/types': link:packages/@sanity/types - '@sanity/ui': 2.8.9(react-dom@19.0.0-rc-f994737d14-20240522(react@19.0.0-rc-f994737d14-20240522))(react-is@19.0.0-rc-a7d1240c-20240731)(react@19.0.0-rc-f994737d14-20240522)(styled-components@6.1.13(react-dom@19.0.0-rc-f994737d14-20240522(react@19.0.0-rc-f994737d14-20240522))(react@19.0.0-rc-f994737d14-20240522)) + '@sanity/ui': 2.8.9(react-dom@19.0.0-rc-f994737d14-20240522(react@18.3.1))(react-is@19.0.0-rc-a7d1240c-20240731)(react@18.3.1)(styled-components@6.1.13(react-dom@19.0.0-rc-f994737d14-20240522(react@18.3.1))(react@18.3.1)) lodash.startcase: 4.4.0 - react: 19.0.0-rc-f994737d14-20240522 - react-dom: 19.0.0-rc-f994737d14-20240522(react@19.0.0-rc-f994737d14-20240522) + react: 18.3.1 + react-dom: 19.0.0-rc-f994737d14-20240522(react@18.3.1) react-is: 19.0.0-rc-a7d1240c-20240731 transitivePeerDependencies: - styled-components diff --git a/vitest.workspace.ts b/vitest.workspace.ts index 401ccb5322f..6c94ee2266c 100644 --- a/vitest.workspace.ts +++ b/vitest.workspace.ts @@ -5,4 +5,5 @@ export default defineWorkspace([ 'packages/@sanity/block-tools', 'packages/@sanity/mutator', 'packages/@sanity/schema', + 'packages/@sanity/types', ])