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

ENOENT when trying to use generated functions with Jest #17

Open
zacwebb opened this issue Aug 8, 2022 · 9 comments · May be fixed by #25
Open

ENOENT when trying to use generated functions with Jest #17

zacwebb opened this issue Aug 8, 2022 · 9 comments · May be fixed by #25
Assignees

Comments

@zacwebb
Copy link

zacwebb commented Aug 8, 2022

Hey there,

Thanks for the work on this package - looks great! 😁

Any chance you'd know why Jest is struggling to find the generated index.js? I get the following error:
ENOENT: no such file or directory, open '/{path to code}/node_modules/prisma-factory/dist/generated.js'

Example of my code:

import { createUserFactory } from 'prisma-factory/generated';

export const UserFactory = createUserFactory({
    email: '[email protected]',
    password: '123',
    verified: true,
});

I've checked that the generated code is there inside node_modules – not sure if this is an issue with my jest/typescript config or a package issue?

Thanks again

@terrarium789
Copy link

Have you resolved it ?

@kgajera kgajera self-assigned this Dec 4, 2022
@leandrit1
Copy link

leandrit1 commented Jan 17, 2023

Just a bump up to share that it's still going on. Happening on Turborepo monorepo.
Cannot find module '/Users/lea/dev/app/node_modules/prisma-factory/dist/generated/index.js

Basically in the node_modules the dist/generated/index.js can not be seen:
image

@Mozartted
Copy link

Any resolution on this ?

@AlextheYounga
Copy link

I'm experiencing the same issue

@adityaguru149
Copy link

I tried adding a dummy file there but it did not work out for me.
node_modules/prisma-factory/dist/generated.js

module.exports = {};

seems like some build artifact is missing?
Has anyone been able to workaround this?

@fech-dev
Copy link

fech-dev commented Jun 7, 2023

Hi all, I've solved the problem here #25

@marvin-wtt
Copy link

Is there any workaround for this? I'd really love to use this package!

@fech-dev
Copy link

Is there any workaround for this? I'd really love to use this package!

Unfortunately there aren't any workaround....
I've solved the problem with this pr #25, but it seems it is not merged yet...

@marvin-wtt
Copy link

I actually found a working solution for me. Just move the generated output to a local directory.

generator factories {
  provider = "prisma-factory"
  output   = "./generated"
}

I still have a problem because the path to the client is not escaped for Windws OS but that's a different issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants