Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module '@auth/prisma-adapter' from 'my.test.ts' #10654

Open
totobest opened this issue Apr 20, 2024 · 0 comments
Open

Cannot find module '@auth/prisma-adapter' from 'my.test.ts' #10654

totobest opened this issue Apr 20, 2024 · 0 comments
Labels
adapters Changes related to the core code concerning database adapters bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@totobest
Copy link

Adapter type

@auth/prisma-adapter

Environment

System:
OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1270P
Memory: 21.23 GB / 30.58 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 20.12.0 - ~/.nvm/versions/node/v20.12.0/bin/node
Yarn: 1.22.19 - /usr/bin/yarn
npm: 10.5.0 - ~/.nvm/versions/node/v20.12.0/bin/npm
Browsers:
Chrome: 122.0.6261.111
npmPackages:
@auth/prisma-adapter: ^2.0.0 => 2.0.0
next-auth: ^4.24.7 => 4.24.7

Reproduction URL

https://github.com/totobest/next-auth-ts-jest

Describe the issue

tsconfig.json

{
  "extends": "@tsconfig/recommended/tsconfig.json"
}

my.test.js

import { PrismaAdapter } from "@auth/prisma-adapter"
import NextAuth from "next-auth"

PrismaAdapter

test("it works", () ={
    expect(3).toBe(3)
})

package.json

{
  "name": "next-auth-ts-jest",
  "version": "1.0.0",
  "dependencies": {
    "@auth/prisma-adapter": "^2.0.0",
    "@prisma/client": "^5.12.1",
    "next-auth": "^4.24.7"
  },
  "devDependencies": {
    "@tsconfig/recommended": "^1.0.6",
    "@types/jest": "^29.5.12",
    "jest": "^29.7.0",
    "prisma": "^5.12.1",
    "ts-jest": "^29.1.2",
    "typescript": "^5.4.5"
  }
}

How to reproduce

$ yarn jest
yarn run v1.22.19
 FAIL  ./my.test.ts
  ● Test suite failed to run

    Cannot find module '@auth/prisma-adapter' from 'my.test.ts'

      1 |
    > 2 | import { PrismaAdapter } from "@auth/prisma-adapter"
        | ^
      3 | import NextAuth from "next-auth"
      4 |
      5 |

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.<anonymous> (my.test.ts:2:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.972 s
Ran all test suites.

Expected behavior

No error

@totobest totobest added adapters Changes related to the core code concerning database adapters bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

1 participant