prisma / ecosystem-tests

🥼🧬🧪🔬🧫🦠 - Continuously tests Prisma Client with various operating systems, frameworks, platforms, databases and more.
186 stars 24 forks source link

Svelte Kit #2690

Open tnzk opened 2 years ago

tnzk commented 2 years ago

@janpio brought me here in https://github.com/prisma/prisma/pull/12907. In Svelte Kit, if we import Prisma in the way the documentation suggests:

import { PrismaClient } from '@prisma/client'

const prisma = new PrismaClient()

we get this error in production build:

import Prisma, { PrismaClient } from "@prisma/client";
                 ^^^^^^^^^^^^
SyntaxError: Named export 'PrismaClient' not found. The requested module '@prisma/client' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@prisma/client';
const { PrismaClient } = pkg;

I have a reproduction repo already, which I guess I can use as a project to add into /frameworks.

As for tests, are they supposed to be executed only on CI, or is there a way to run it locally before PR? Seems like README doesn't mention to run tests locally.

janpio commented 2 years ago

Thanks for opening the issue here.

Indeed, I usually mostly test on CI. You might have noticed that the "tests" are not real tests via a test framework, but a convention for shell scripts that another script in CI calls in a specified order. (We would probably not set this up the same way today, but it works fine so why touch it to much.) So if you run the shell scripts locally, and make sure the correct database env var is available, this should also work just fine. (In some tests this depends on external services and accounts, so that is harder - but frameworks and waht you want to add should be straigtforward.) To turn it into a usable PR then you only need to add it to the GH Actions workflow as well and a PR should do its things automatically.

janpio commented 2 years ago

Discussion continued in PRs: https://github.com/prisma/ecosystem-tests/pull/2692 + https://github.com/prisma/ecosystem-tests/pull/2695