Skip to content

Commit

Permalink
chore: update vitest version to 2.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
xcfox committed Dec 10, 2024
1 parent eca5c1f commit e238db7
Show file tree
Hide file tree
Showing 26 changed files with 332 additions and 433 deletions.
7 changes: 6 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
"files": {
"ignoreUnknown": false,
"ignore": ["**/dist/**/*", "website/doc_build/", "**/generated/**/*"]
"ignore": [
"**/dist/**/*",
"website/doc_build/",
"**/generated/**/*",
"coverage/"
]
},
"formatter": {
"enabled": true,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
"@biomejs/biome": "1.9.4",
"@graphql-tools/utils": "^10.1.3",
"@types/node": "^20.11.30",
"@vitest/coverage-v8": "^1.5.0",
"@vitest/coverage-v8": "^2.1.8",
"graphql": "^16.8.1",
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
"tsup": "^8.1.0",
"tsx": "^4.7.2",
"typescript": "^5.4.3",
"vitest": "^1.5.0"
"vitest": "^2.1.8"
},
"packageManager": "[email protected]+sha512.c8180b3fbe4e4bca02c94234717896b5529740a6cbadf19fa78254270403ea2f27d4e1d46a08a0f56c89b63dc8ebfd3ee53326da720273794e6200fcf0d184ab",
"pnpm": {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
},
"source": {
"types": "./src/index.ts",
"default": "./src/index.ts"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["src", "test", "../federation/src/mock-ast.ts"]
"include": ["src", "test"]
}
3 changes: 3 additions & 0 deletions packages/core/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { projectConfig } from "../../vitest.config"

export default projectConfig
5 changes: 0 additions & 5 deletions packages/federation/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"paths": {
"@gqloom/core": ["../core/src/index.ts"]
}
},
"include": ["src", "test"]
}
18 changes: 11 additions & 7 deletions packages/federation/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import * as path from "path"
import { defineConfig } from "vitest/config"
import { defineProject, mergeConfig } from "vitest/config"
import { projectConfig } from "../../vitest.config"

export default defineConfig({
resolve: {
alias: {
graphql: path.resolve(__dirname, "./node_modules/graphql"),
export default mergeConfig(
projectConfig,
defineProject({
resolve: {
alias: {
graphql: path.resolve(__dirname, "./node_modules/graphql"),
},
},
},
})
})
)
2 changes: 1 addition & 1 deletion packages/mikro-orm/test/entity-schema.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe("Entity Manager", () => {
return orm.em.removeAndFlush(g3)
})

expect(
await expect(
RequestContext.create(orm.em, async () => {
return orm.em.findOne(GiraffeSchema, { id: g1.id })
})
Expand Down
5 changes: 0 additions & 5 deletions packages/mikro-orm/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"paths": {
"@gqloom/core": ["../core/src/index.ts"]
}
},
"include": ["src", "test"]
}
3 changes: 3 additions & 0 deletions packages/mikro-orm/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { projectConfig } from "../../vitest.config"

export default projectConfig
8 changes: 4 additions & 4 deletions packages/prisma/test/bobbin-resolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe("Bobbin Resolver", () => {
expect(userResolver.upsertUser.resolve).toBeTypeOf("function")
})

it("should be able to weave schema", () => {
it("should be able to weave schema", async () => {
const schema = weaveSchema()

expect(printType(schema.getType("User")!)).toMatchInlineSnapshot(`
Expand All @@ -93,9 +93,9 @@ describe("Bobbin Resolver", () => {
}"
`)

expect(printSchema(lexicographicSortSchema(schema))).toMatchFileSnapshot(
"./bobbin-resolver.spec.gql"
)
await expect(
printSchema(lexicographicSortSchema(schema))
).toMatchFileSnapshot("./bobbin-resolver.spec.gql")
})

describe("mutations", () => {
Expand Down
55 changes: 28 additions & 27 deletions packages/prisma/test/bobbin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ZodWeaver, asInputArgs } from "@gqloom/zod"
import { PrismaClient } from "@prisma/client"
import { printSchema, printType } from "graphql"
import { createYoga } from "graphql-yoga"
import { beforeAll, describe, expect, expectTypeOf, it } from "vitest"
import { beforeEach, describe, expect, expectTypeOf, it } from "vitest"
import { z } from "zod"
import {
type InferPrismaDelegate,
Expand Down Expand Up @@ -89,7 +89,7 @@ describe("PrismaModelBobbin", () => {
})
const schema = weave(r1, r2)
const yoga = createYoga({ schema })
beforeAll(async () => {
beforeEach(async () => {
await db.user.deleteMany()
await db.post.deleteMany()
await db.user.create({
Expand All @@ -102,32 +102,8 @@ describe("PrismaModelBobbin", () => {
},
})
})
it("should be able to create a relationField", () => {
const postsField = UserBobbin.relationField("posts")
expect(postsField).toBeDefined()
expect(postsField.output).toBeTypeOf("object")
expect(postsField.type).toEqual("field")
expect(postsField.resolve).toBeTypeOf("function")

const userField = PostBobbin.relationField("author")
expect(userField).toBeDefined()
expect(userField.output).toBeTypeOf("object")
expect(userField.type).toEqual("field")
expect(userField.resolve).toBeTypeOf("function")
})

it("should be able to weave user schema", () => {
expect(printType(schema.getType("User")!)).toMatchInlineSnapshot(`
"type User {
id: ID!
email: String!
name: String
posts: [Post!]!
}"
`)
})

it("should be able to resolve a relationField", async () => {
it("should be able to resolve a relationField", { retry: 6 }, async () => {
const response = await yoga.fetch("http://localhost/graphql", {
method: "POST",
headers: {
Expand Down Expand Up @@ -171,6 +147,31 @@ describe("PrismaModelBobbin", () => {
},
})
})

it("should be able to create a relationField", () => {
const postsField = UserBobbin.relationField("posts")
expect(postsField).toBeDefined()
expect(postsField.output).toBeTypeOf("object")
expect(postsField.type).toEqual("field")
expect(postsField.resolve).toBeTypeOf("function")

const userField = PostBobbin.relationField("author")
expect(userField).toBeDefined()
expect(userField.output).toBeTypeOf("object")
expect(userField.type).toEqual("field")
expect(userField.resolve).toBeTypeOf("function")
})

it("should be able to weave user schema", () => {
expect(printType(schema.getType("User")!)).toMatchInlineSnapshot(`
"type User {
id: ID!
email: String!
name: String
posts: [Post!]!
}"
`)
})
})

describe("countQuery", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/prisma/test/loader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("EasyDataLoader", () => {
id: number
value: string
}
let batchLoadFn: Mock<[keys: number[]], Promise<(Data | Error)[]>>
let batchLoadFn: Mock<(keys: number[]) => Promise<(Data | Error)[]>>
let dataLoader: EasyDataLoader<number, Data>

beforeEach(() => {
Expand Down
6 changes: 0 additions & 6 deletions packages/prisma/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"paths": {
"@gqloom/core": ["../core/src/index.ts"],
"@gqloom/zod": ["../zod/src/index.ts"]
}
},
"include": ["src", "test"]
}
3 changes: 3 additions & 0 deletions packages/prisma/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { projectConfig } from "../../vitest.config"

export default projectConfig
2 changes: 1 addition & 1 deletion packages/valibot/test/resolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ describe("valibot resolver", () => {
})

it("should throw for invalid input", async () => {
expect(
await expect(
simpleGiraffeResolver.createGiraffe.resolve({
name: "2",
birthday: new Date("2022-2-22"),
Expand Down
5 changes: 0 additions & 5 deletions packages/valibot/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"paths": {
"@gqloom/core": ["../core/src/index.ts"]
}
},
"include": ["src", "test"]
}
3 changes: 3 additions & 0 deletions packages/valibot/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { projectConfig } from "../../vitest.config"

export default projectConfig
5 changes: 0 additions & 5 deletions packages/yup/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"paths": {
"@gqloom/core": ["../core/src/index.ts"]
}
},
"include": ["src", "test"]
}
3 changes: 3 additions & 0 deletions packages/yup/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { projectConfig } from "../../vitest.config"

export default projectConfig
5 changes: 0 additions & 5 deletions packages/zod/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"paths": {
"@gqloom/core": ["../core/src/index.ts"]
}
},
"include": ["src", "test"]
}
3 changes: 3 additions & 0 deletions packages/zod/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { projectConfig } from "../../vitest.config"

export default projectConfig
Loading

0 comments on commit e238db7

Please sign in to comment.