Skip to content

Commit

Permalink
chore(test): move @sanity/types to vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge committed Sep 23, 2024
1 parent a05456a commit 597d35a
Show file tree
Hide file tree
Showing 25 changed files with 48 additions and 39 deletions.
6 changes: 0 additions & 6 deletions packages/@sanity/types/jest.config.mjs

This file was deleted.

10 changes: 6 additions & 4 deletions packages/@sanity/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,21 @@
"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": {
"@sanity/client": "^6.21.3",
"@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"
}
}
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/alias.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/array.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/block.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/boolean.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/date.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/datetime.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/document.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/email.test.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/file.test.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/generic.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/geopoint.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/image.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/number.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/object.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/reference.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/slug.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/string.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/text.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/typeMerge.test.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/test/url.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it} from '@jest/globals'
import {describe, it} from 'vitest'

/* eslint-disable @typescript-eslint/no-unused-vars */
/**
Expand Down
6 changes: 6 additions & 0 deletions packages/@sanity/types/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {defineConfig} from '@repo/test-config/vitest'
import react from '@vitejs/plugin-react'

export default defineConfig({
plugins: [react()],
})
24 changes: 15 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vitest.workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export default defineWorkspace([
'packages/@sanity/block-tools',
'packages/@sanity/mutator',
'packages/@sanity/schema',
'packages/@sanity/types',
])

0 comments on commit 597d35a

Please sign in to comment.