Hey, im new to prisma, working through the docs a...
# orm-help
p
Hey, im new to prisma, working through the docs and doing the example for nexus graphql prisma is broken on the testing with db chapter, the test helper funktion is Not right
r
@Philipp Humburg ๐Ÿ‘‹ Could you share the link to the docs? @Alex Ruheni might also have an idea here.
a
Hey Philipp ๐Ÿ‘‹๐Ÿฝ Could you share the error you're encountering while running the tests so that I can replicate it and make the update ๐Ÿ™‚
p
Hey, i Made a github repo with the Code i have from the docs https://github.com/Amnesie91/nexus-graphql-prisma
This page declares a database url and i replaced ist with โ€žfile:Testdbโ€œ as Seen in the repo, to reproduce install dependencies and run the test with yarn test
a
It seems you declared a
DATABASE_URL
in your
__helpers.ts
file which is causing the error. The tutorial uses an in-memory instance of SQLite, and therefore you don't have to define a
DATABASE_URL
. Once you comment out the line or remove it and then run
npm run test -u
, they should work. Since you'd like to define a url to your own database, update the following line that will point to your preferred SQLite db.
Copy code
const client = new Database("./test.db");
Don't hesitate to let me know if you run into any errors. ๐Ÿ™‚
p
@Alex Ruheni when i comment that line out, ist uses the non Test dB, somehow the new mem db isnt connected to prisma, When u run the Test a second time u will notice state being from the dev.db for the Code being used is 1:1 from the tutorial, sadly the pre and After Changes on the Site is inconsistent, so i Took the after changes state of the code, and changed the prisma source to use env database url
you can actually confirm that when u promisify the exec and Console.log the res, ist always Takes the dB which is configured in the prisma/Schema.prisma
I updated my repo with the now properly working test environment, if u wanz you can take a look and Update the docs accordingly
๐Ÿ™Œ๐Ÿพ 1
Nonetheless it seems that sometimes it cannot Remove the DB cause ist seems to be busy when trying to unlink