You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey. I love your package since it helps me mock complicated data in just a few lines.
Besides using the package for generating mocked data, I decided to use it in my unit/integrational tests that I wrote using Jest. However, when I'm trying to import the createSeedClient, I get an error. Before running tests, I execute npx @snaplet/seed sync.
➜ ✗ npm run test> api@1.0.0 test> jest --coverage --verbose --detectOpenHandles --forceExit
TypeError: Jest: Got error running globalSetup - /Users/.../apps/api/src/lib/jest/setup.ts, reason: Unknown file extension ".ts"for /Users/.../apps/api/src/lib/jest/setup.ts
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9)
at defaultGetFormat (node:internal/modules/esm/get_format:203:36)
at defaultLoad (node:internal/modules/esm/load:143:22)
at async ModuleLoader.load (node:internal/modules/esm/loader:409:7)
at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:45)
at async link (node:internal/modules/esm/module_job:76:21)
npm ERR! Lifecycle script `test` failed with error:
npm ERR! Error: command failed
npm ERR!in workspace: api@1.0.0
npm ERR! at location: /Users/.../apps/api
I'm not sure if the problem is directly related to your package rather than some limitations of the ts-jest library, but I hope you can direct me to the solution or at least a good idea of how to make a workaround for the problem.
importSeedfrom"@snaplet/seed";// here is the problem with an importimport{connectToDatabase,db}from"../database";exportdefaultasyncfunction(){constseed=awaitSeed.createSeedClient({dryRun: false});awaitconnectToDatabase();}
Hey. I love your package since it helps me mock complicated data in just a few lines.
Besides using the package for generating mocked data, I decided to use it in my unit/integrational tests that I wrote using Jest. However, when I'm trying to import the
createSeedClient
, I get an error. Before running tests, I executenpx @snaplet/seed sync
.I tried literally everything, every combination of Jest configuration (esm), and read every documentation I ever could, but I still can't figure out how to fix that.
I'm not sure if the problem is directly related to your package rather than some limitations of the
ts-jest
library, but I hope you can direct me to the solution or at least a good idea of how to make a workaround for the problem.package.json
:jest.config.ts
:setup.js
:tsconfig.json
:The text was updated successfully, but these errors were encountered: