Open zaniluca opened 2 years ago
Trying to test my schema i get this error from the nexus-prisma/scalars module. I'm using nexus nexus-prisma and apollo-server-express and I'm testing with jest and ts-jest
nexus-prisma/scalars
nexus
nexus-prisma
apollo-server-express
jest
ts-jest
"dependencies": { "@prisma/client": "^3.7.0", "apollo-server-express": "^3.6.1" "express": "^4.17.2" "graphql": "^14.5.0", "nexus": "^1.1.0", "nexus-prisma": "^0.35.0" }, "devDependencies": { "@types/express": "^4.17.13", "@types/graphql": "^14.5.0", "@types/jest": "^27.4.0", "@types/node": "^17.0.8", "@types/supertest": "^2.0.11", "jest": "^27.4.7", "nodemon": "^2.0.15", "prisma": "^3.7.0", "supertest": "^6.2.1", "ts-jest": "^27.1.3", "ts-node": "^10.4.0" "typescript": "^4.5.4" }
Here is my schema.ts file
schema.ts
import { join } from "path"; import * as types from "./definitions"; import { makeSchema } from "nexus"; import { DateTime } from "nexus-prisma/scalars"; export const schema = makeSchema({ // `NexusPrismaScalars` is for supporting the `DateTime` type types: [types, DateTime], // Where the generated files are placed outputs: { typegen: join(__dirname, "node_modules/@types/nexus-typegen/index.d.ts"), schema: join(__dirname, "./schema.graphql"), }, sourceTypes: { modules: [{ module: ".prisma/client", alias: "PrismaClient" }], }, contextType: { module: join(__dirname, "context.ts"), export: "Context", }, });
And this is my jest.config.js
jest.config.js
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ module.exports = { preset: "ts-jest", testEnvironment: "node", moduleDirectories: ["node_modules", "src"], };
-Make any nexus-prisma project that has NexusPrismaScalars in types array. -run tests with jest
NexusPrismaScalars
Is there any solution to that?
Screenshot
Description
Trying to test my schema i get this error from the
nexus-prisma/scalars
module. I'm usingnexus
nexus-prisma
andapollo-server-express
and I'm testing withjest
andts-jest
Versions:
Here is my
schema.ts
fileAnd this is my
jest.config.js
Repro Steps/Link
-Make any
nexus-prisma
project that hasNexusPrismaScalars
in types array. -run tests with jest