{"_id":"@cffnpwr/prisma-mock-vitest","_rev":"4-8256e52663d3f839e91e5a47e4936b2d","name":"@cffnpwr/prisma-mock-vitest","dist-tags":{"latest":"0.10.0-vitest-0.0.5"},"versions":{"0.10.0-vitest-0.0.1":{"name":"@cffnpwr/prisma-mock-vitest","version":"0.10.0-vitest-0.0.1","description":"A mock library of Prisma intended for unit testing feat. vitest.","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/cffnpwr/prisma-mock-vitest.git"},"license":"MIT","types":"lib/","devDependencies":{"@prisma/client":"5.6.0","@types/node":"^20.9.2","@vitest/coverage-v8":"^0.34.6","@vitest/ui":"^0.34.6","cross-spawn":"^7.0.3","env-cmd":"^10.1.0","prisma":"5.6.0","typescript":"^5.2.2","uuid":"^9.0.0","vitest":"^0.34.6"},"peerDependencies":{"@prisma/client":"^3.5.0 || ^4.7.0 || ^5.0.0"},"packageManager":"pnpm@8.10.5","dependencies":{"vitest-mock-extended":"^1.3.1"},"scripts":{"preversion":"tsc","build":"tsc","test":"vitest","watch":"tsc --watch","test:postgres":"env-cmd -e postgres jest --maxWorkers=1"},"bugs":{"url":"https://github.com/cffnpwr/prisma-mock-vitest/issues"},"homepage":"https://github.com/cffnpwr/prisma-mock-vitest#readme","_id":"@cffnpwr/prisma-mock-vitest@0.10.0-vitest-0.0.1","_integrity":"sha512-SWFcOB4OFDTdVrNwU4QLKZftUcSosdv4zEPZpSIypDQ64KT73vkSBDD1eLL1MmJh9R88wE2AxpQQTMJe2g515g==","_resolved":"/tmp/3c6fc2cd9151dcbf0e45c20394994a24/cffnpwr-prisma-mock-vitest-0.10.0-vitest-0.0.1.tgz","_from":"file:cffnpwr-prisma-mock-vitest-0.10.0-vitest-0.0.1.tgz","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-SWFcOB4OFDTdVrNwU4QLKZftUcSosdv4zEPZpSIypDQ64KT73vkSBDD1eLL1MmJh9R88wE2AxpQQTMJe2g515g==","shasum":"12aaa35afb17f4953fc9913df5b179a4999da13f","tarball":"https://registry.npmjs.org/@cffnpwr/prisma-mock-vitest/-/prisma-mock-vitest-0.10.0-vitest-0.0.1.tgz","fileCount":25,"unpackedSize":67102,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDC12nW0GWtn670rd7XG49vUzgczH8zBmWHgcj3heL5CwIgTBYmTAH8X20LuS/x6N2GDn3tLv4eWgEsMp98MHpM/Iw="}]},"_npmUser":{"name":"cffnpwr","email":"cffnpwr@gmail.com"},"directories":{},"maintainers":[{"name":"cffnpwr","email":"cffnpwr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-mock-vitest_0.10.0-vitest-0.0.1_1700456094824_0.21748033268501743"},"_hasShrinkwrap":false},"0.10.0-vitest-0.0.2":{"name":"@cffnpwr/prisma-mock-vitest","version":"0.10.0-vitest-0.0.2","description":"A mock library of Prisma intended for unit testing feat. vitest.","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/cffnpwr/prisma-mock-vitest.git"},"license":"MIT","types":"lib/","devDependencies":{"@prisma/client":"5.6.0","@types/node":"^20.9.2","@vitest/coverage-v8":"^0.34.6","@vitest/ui":"^0.34.6","cross-spawn":"^7.0.3","env-cmd":"^10.1.0","prisma":"5.6.0","typescript":"^5.2.2","uuid":"^9.0.0"},"peerDependencies":{"@prisma/client":"^3.5.0 || ^4.7.0 || ^5.0.0"},"packageManager":"pnpm@8.10.5","dependencies":{"vitest":"1.0.0-beta.5","vitest-mock-extended":"^1.3.1"},"scripts":{"preversion":"tsc","build":"tsc","test":"vitest","watch":"tsc --watch","test:postgres":"env-cmd -e postgres jest --maxWorkers=1"},"bugs":{"url":"https://github.com/cffnpwr/prisma-mock-vitest/issues"},"homepage":"https://github.com/cffnpwr/prisma-mock-vitest#readme","_id":"@cffnpwr/prisma-mock-vitest@0.10.0-vitest-0.0.2","_integrity":"sha512-TVEQy1Io0zabAsQXDAS8rNoObHqFxZozeCfjXbArdxmM6CgDHmVB6Ug+wRH5LexnbrLAneitXteR9jNUfH4wmw==","_resolved":"/tmp/acf238ba7a7a5cea96ee0cc29bc11c19/cffnpwr-prisma-mock-vitest-0.10.0-vitest-0.0.2.tgz","_from":"file:cffnpwr-prisma-mock-vitest-0.10.0-vitest-0.0.2.tgz","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-TVEQy1Io0zabAsQXDAS8rNoObHqFxZozeCfjXbArdxmM6CgDHmVB6Ug+wRH5LexnbrLAneitXteR9jNUfH4wmw==","shasum":"8c867ea7f9ff7b9fe89be979e8a25c7d90902c67","tarball":"https://registry.npmjs.org/@cffnpwr/prisma-mock-vitest/-/prisma-mock-vitest-0.10.0-vitest-0.0.2.tgz","fileCount":25,"unpackedSize":67107,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDu8o/VUudf3tbcYnQRvtFqC2DBdbGFzPJt8UXJyI1VLAiB8EnDfJ3jI0H5NCnre91IqufM9obTI50A5QHzOGv6ZgA=="}]},"_npmUser":{"name":"cffnpwr","email":"cffnpwr@gmail.com"},"directories":{},"maintainers":[{"name":"cffnpwr","email":"cffnpwr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-mock-vitest_0.10.0-vitest-0.0.2_1700491519975_0.939025489281585"},"_hasShrinkwrap":false},"0.10.0-vitest-0.0.3":{"name":"@cffnpwr/prisma-mock-vitest","version":"0.10.0-vitest-0.0.3","description":"A mock library of Prisma intended for unit testing feat. vitest.","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/cffnpwr/prisma-mock-vitest.git"},"license":"MIT","types":"lib/","devDependencies":{"@prisma/client":"5.6.0","@types/node":"^20.9.2","@vitest/coverage-v8":"^0.34.6","@vitest/ui":"^0.34.6","cross-spawn":"^7.0.3","env-cmd":"^10.1.0","prisma":"5.6.0","typescript":"^5.2.2","uuid":"^9.0.0"},"peerDependencies":{"@prisma/client":"^3.5.0 || ^4.7.0 || ^5.0.0"},"packageManager":"pnpm@8.10.5","dependencies":{"vitest":"1.0.0-beta.5","vitest-mock-extended":"^1.3.1"},"scripts":{"preversion":"tsc","build":"tsc","test":"vitest","watch":"tsc --watch","test:postgres":"env-cmd -e postgres jest --maxWorkers=1"},"bugs":{"url":"https://github.com/cffnpwr/prisma-mock-vitest/issues"},"homepage":"https://github.com/cffnpwr/prisma-mock-vitest#readme","_id":"@cffnpwr/prisma-mock-vitest@0.10.0-vitest-0.0.3","_integrity":"sha512-tW0/2XnHZwU4aabnfqv+lGicA57UsnFBR+VSF80QQrSxLbPI9NZhpqkpiP3Q/bG1jTHycDGVY9tP6kNnLpv8jQ==","_resolved":"/tmp/8ea46871c754c1dd2475c8c3862a5561/cffnpwr-prisma-mock-vitest-0.10.0-vitest-0.0.3.tgz","_from":"file:cffnpwr-prisma-mock-vitest-0.10.0-vitest-0.0.3.tgz","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-tW0/2XnHZwU4aabnfqv+lGicA57UsnFBR+VSF80QQrSxLbPI9NZhpqkpiP3Q/bG1jTHycDGVY9tP6kNnLpv8jQ==","shasum":"5289ef1a08097bc61deb8a42ba3ce451f5af1e86","tarball":"https://registry.npmjs.org/@cffnpwr/prisma-mock-vitest/-/prisma-mock-vitest-0.10.0-vitest-0.0.3.tgz","fileCount":93,"unpackedSize":249982,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCIM3SCP/ciHJ0fg/5LB9/UHhWFDv/5ohu27GfWOXJxkAIhALqqQKo5p7Rg8meogxpxMcc5ZkyaREFrEPWFDJA0JQAA"}]},"_npmUser":{"name":"cffnpwr","email":"cffnpwr@gmail.com"},"directories":{},"maintainers":[{"name":"cffnpwr","email":"cffnpwr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-mock-vitest_0.10.0-vitest-0.0.3_1700491626574_0.845772356359457"},"_hasShrinkwrap":false},"0.10.0-vitest-0.0.4":{"name":"@cffnpwr/prisma-mock-vitest","version":"0.10.0-vitest-0.0.4","description":"A mock library of Prisma intended for unit testing feat. vitest.","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/cffnpwr/prisma-mock-vitest.git"},"license":"MIT","type":"module","types":"lib/","devDependencies":{"@prisma/client":"5.6.0","@swc/cli":"^0.1.63","@swc/core":"^1.3.96","@types/node":"^20.9.2","@vitest/coverage-v8":"^0.34.6","@vitest/ui":"^0.34.6","cross-spawn":"^7.0.3","env-cmd":"^10.1.0","prisma":"5.6.0","swc-plugin-import-extension-resolver":"^0.2.3","typescript":"^5.2.2","uuid":"^9.0.0"},"peerDependencies":{"@prisma/client":"^3.5.0 || ^4.7.0 || ^5.0.0"},"packageManager":"pnpm@8.10.5","dependencies":{"vitest":"1.0.0-beta.5","vitest-mock-extended":"^1.3.1"},"scripts":{"preversion":"pnpm run build","build":"pnpm run \"/^build:.*/\"","build:swc":"swc src -d lib -D","build:type":"tsc -p tsconfig.build.json","test":"vitest","watch":"tsc --watch","test:postgres":"env-cmd -e postgres jest --maxWorkers=1"},"bugs":{"url":"https://github.com/cffnpwr/prisma-mock-vitest/issues"},"homepage":"https://github.com/cffnpwr/prisma-mock-vitest#readme","_id":"@cffnpwr/prisma-mock-vitest@0.10.0-vitest-0.0.4","_integrity":"sha512-ig7E4FWpC8ZVHpx1IYHoNbb93EaNH8DTEWIZeZONGDH7gukD6VElCW4gatwIX8vGockm7QRNn2TvmHV0otRdzA==","_resolved":"/tmp/a65298b42a144d0d2566405ab6b94146/cffnpwr-prisma-mock-vitest-0.10.0-vitest-0.0.4.tgz","_from":"file:cffnpwr-prisma-mock-vitest-0.10.0-vitest-0.0.4.tgz","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-ig7E4FWpC8ZVHpx1IYHoNbb93EaNH8DTEWIZeZONGDH7gukD6VElCW4gatwIX8vGockm7QRNn2TvmHV0otRdzA==","shasum":"7ae7212be9390fca187bc727c270118a15aeba74","tarball":"https://registry.npmjs.org/@cffnpwr/prisma-mock-vitest/-/prisma-mock-vitest-0.10.0-vitest-0.0.4.tgz","fileCount":25,"unpackedSize":63336,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF4WS6gGyd5fo/guFPWyRsu6rl45WnBaD9XoJ4lwYrooAiEAmwASupbYitYmSSBPCB+o44Iob374NUTngvsnLutO7OI="}]},"_npmUser":{"name":"cffnpwr","email":"cffnpwr@gmail.com"},"directories":{},"maintainers":[{"name":"cffnpwr","email":"cffnpwr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-mock-vitest_0.10.0-vitest-0.0.4_1700492922476_0.6160584114926566"},"_hasShrinkwrap":false},"0.10.0-vitest-0.0.5":{"name":"@cffnpwr/prisma-mock-vitest","version":"0.10.0-vitest-0.0.5","description":"A mock library of Prisma intended for unit testing feat. vitest.","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/cffnpwr/prisma-mock-vitest.git"},"license":"MIT","type":"commonjs","types":"lib/","devDependencies":{"@prisma/client":"5.6.0","@swc/cli":"^0.1.63","@swc/core":"^1.3.96","@types/node":"^20.9.2","@vitest/coverage-v8":"^0.34.6","@vitest/ui":"^0.34.6","cross-spawn":"^7.0.3","env-cmd":"^10.1.0","prisma":"5.6.0","swc-plugin-import-extension-resolver":"^0.2.3","typescript":"^5.2.2","uuid":"^9.0.0"},"peerDependencies":{"@prisma/client":"^3.5.0 || ^4.7.0 || ^5.0.0"},"packageManager":"pnpm@8.10.5","dependencies":{"vitest":"1.0.0-beta.5","vitest-mock-extended":"^1.3.1"},"scripts":{"preversion":"pnpm run build","build":"pnpm run \"/^build:.*/\"","build:swc":"swc src -d lib -D","build:type":"tsc -p tsconfig.build.json","test":"vitest","watch":"tsc --watch","test:postgres":"env-cmd -e postgres jest --maxWorkers=1"},"bugs":{"url":"https://github.com/cffnpwr/prisma-mock-vitest/issues"},"homepage":"https://github.com/cffnpwr/prisma-mock-vitest#readme","_id":"@cffnpwr/prisma-mock-vitest@0.10.0-vitest-0.0.5","_integrity":"sha512-F5F/Cnx2AiokjLi0jRqlOIXrayQsg4CWBNEWHcFtJI1i1sDuRaMY2xTlyNIscqTJsiOZgNB3ne5hTeUt1dscOA==","_resolved":"/tmp/7a922cda9346e0003dad07109e12813b/cffnpwr-prisma-mock-vitest-0.10.0-vitest-0.0.5.tgz","_from":"file:cffnpwr-prisma-mock-vitest-0.10.0-vitest-0.0.5.tgz","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-F5F/Cnx2AiokjLi0jRqlOIXrayQsg4CWBNEWHcFtJI1i1sDuRaMY2xTlyNIscqTJsiOZgNB3ne5hTeUt1dscOA==","shasum":"33b2117a040a3ec83b9c3a9124e64048a91be929","tarball":"https://registry.npmjs.org/@cffnpwr/prisma-mock-vitest/-/prisma-mock-vitest-0.10.0-vitest-0.0.5.tgz","fileCount":25,"unpackedSize":67485,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBdDFQm7Ff7skCYhUb5waO2PwUvinSZu6tmy3NGQq7FIAiAiOavNL5MCXYlWol5/BdnE++Yfz1EQtBjd80ALM5gNhw=="}]},"_npmUser":{"name":"cffnpwr","email":"cffnpwr@gmail.com"},"directories":{},"maintainers":[{"name":"cffnpwr","email":"cffnpwr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-mock-vitest_0.10.0-vitest-0.0.5_1700494001267_0.2902977092547252"},"_hasShrinkwrap":false}},"time":{"created":"2023-11-20T04:54:54.712Z","0.10.0-vitest-0.0.1":"2023-11-20T04:54:55.030Z","modified":"2023-11-20T15:26:41.580Z","0.10.0-vitest-0.0.2":"2023-11-20T14:45:20.161Z","0.10.0-vitest-0.0.3":"2023-11-20T14:47:06.800Z","0.10.0-vitest-0.0.4":"2023-11-20T15:08:42.616Z","0.10.0-vitest-0.0.5":"2023-11-20T15:26:41.430Z"},"maintainers":[{"name":"cffnpwr","email":"cffnpwr@gmail.com"}],"description":"A mock library of Prisma intended for unit testing feat. vitest.","homepage":"https://github.com/cffnpwr/prisma-mock-vitest#readme","repository":{"type":"git","url":"git+https://github.com/cffnpwr/prisma-mock-vitest.git"},"bugs":{"url":"https://github.com/cffnpwr/prisma-mock-vitest/issues"},"license":"MIT","readme":"# Prisma Mock\n\nThis is a mock of the Prisma API intended for unit testing. All the data is stored in memory.\n\nThe library `jest-mock-extended` is used, which means that if functionality you need is not implemented yet, you can mock it yourself.\n\n# Usage\n\nSimple example how to create a prisma mock instance:\n\n```js\nimport createPrismaMock from \"prisma-mock\"\n\nlet client\n\nbeforeEach(() => {\n  client = createPrismaMock()\n})\n```\n\nAn example how to mock a global prisma instance, as the default export in a \"db\" directory (like blitzjs):\n\n```js\nimport createPrismaMock from \"prisma-mock\"\nimport { mockDeep, mockReset } from \"jest-mock-extended\"\n\njest.mock(\"db\", () => ({\n  __esModule: true,\n  ...jest.requireActual(\"db\"),\n  default: mockDeep(),\n}))\n\nimport db, { Prisma } from \"db\"\n\nbeforeEach(() => {\n  mockReset(db)\n  createPrismaMock({}, Prisma.dmmf.datamodel)\n})\n```\n\n# API\n\n```ts\ncreatePrismaMock(\n  data: PrismaMockData<P> = {},\n  datamodel?: Prisma.DMMF.Datamodel,\n  client = mockDeep<P>(),\n  options: {\n    caseInsensitive?: boolean\n  } = {}\n): Promise<P>\n```\n\n#### Arg: `data`\n\nYou can optionally start up a pre-filled db, by passing in an object containing keys for tables, and values as arrays of objects (though using `create` is preferred). Example:\n\n```js\ncreatePrismaMock({\n  user: [\n    {\n      id: 1,\n      name: \"John Doe\",\n      accountId: 1,\n    },\n  ],\n  account: [\n    {\n      id: 1,\n      name: \"Company\",\n    },\n  ],\n})\n```\n\n#### Arg: `datamodel`\n\nThe datamodel of the prisma client, value of `Prisma.dmmf.datamodel`.\n\n#### Arg: `client`\n\nA `jest-mock-extended` instance. If not provided, a new instance is created.\n\n#### Arg: `caseInsensitive`\n\nIf true, all string comparisons are case insensitive.\n\n\n\n# Supported features\n\nMost common cases are covered, but not everything. Here is a rough list of the supported features:\n\n## Model queries\n\n- findUnique,\n- findUniqueOrThrow,\n- findMany,\n- findFirst,\n- findFirstOrThrow,\n- create,\n- createMany\n- delete,\n- update,\n- deleteMany,\n- updateMany\n- upsert\n- count\n- TODO: aggregate\n- TODO: groupBy\n\n## Model query options\n\n- distinct\n- include\n- where\n- select\n- orderBy\n- select: \\_count\n\n## Nested queries\n\n- create\n- createMany\n- update\n- updateMany\n- delete\n- deleteMany\n- connect\n- disconnect\n- set\n- upsert\n- TODO: connectOrCreate\n\n## Filter conditions and operators\n\n- equals\n- gt\n- gte\n- lt\n- lte\n- not\n- in\n- notIn\n- contains\n- startWith\n- endsWith\n- AND\n- OR\n- NOT\n- mode\n- TODO: search\n\n## Relation filters\n\n- some\n- every\n- none\n- TODO: is\n\n## Scalar list methods\n\nTODO (set, push)\n\n## Scalar list filters\n\nTODO (has, hasEvery, hasSome, isEmpty, equals)\n\n## Atomic number operations\n\n- increment\n- decrement\n- multiply\n- divide\n- set\n\n## JSON filters\n\n- path\n- string_contains\n- string_starts_with \n- string_ends_with\n- array_contains\n- array_starts_with\n- array_ends_with\n\n## Attributes\n\n- @@id\n- @default\n- @unique\n- @@unique (TODO: no error if duplicate)\n- @relation\n- @updatedAt: Partially supported, value is set at creation (TODO: update value on update)\n\n## Attribute functions\n\n- autoincrement()\n- TODO: auto()\n- cuid()\n- uuid()\n- now()\n- TODO: dbgenerated()\n\n## Referential actions\n\n- onDelete (SetNull, Cascade)\n- TODO: onDelete: Restrict, NoAction, SetDefault\n- TODO: onUpdate\n\n## Prisma Client methods\n\n- $transaction\n- $transaction (interactive)\n- TODO: $transaction (isolation)\n\n# Contribution\n\n## Requirements\n\nCreate a `.env-cmdrc` file in the root of your project with the following content:\n\n```json\n{\n  \"postgres\": {\n    \"PROVIDER\": \"postgresql\",\n    \"DATABASE_URL\": \"postgresql://postgres:postgres@localhost:5432/postgres?schema=public\"\n  }\n}\n```\n\n## Writing Tests\nCreate your tests in the `__tests__` directory. You can use snapshot testing with either `expect(res).toMatchSnapshot()` or `expect(res).toMatchInlineSnapshot()`. This captures the result of your tests in a snapshot, which you can use to compare agains prisma-mock results.\n\nNote: If you choose to use snapshot testing, make shore to first run your tests against the real database to create a snapshot of the expected result.\n\n## Running Tests\nTo run tests against a postgres database, run the following command:\n\n```bash\nyarn run test:postgres\n```\n\nTo run tests against prisma-mock (in-memory database), run:\n\n```bash\nyarn test\n```\n","readmeFilename":"README.md"}