Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vitest-mms

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vitest-mms - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

dist/mongoose/setupFile.cjs

3

dist/setupFile.d.ts

@@ -6,3 +6,2 @@ import { MongoClient, Db } from 'mongodb';

declare const globalContextSymbol: unique symbol;
declare module "vitest" {

@@ -14,3 +13,1 @@ interface TestContext {

}
export { globalContextSymbol };
{
"name": "vitest-mms",
"version": "0.1.7",
"version": "0.1.8",
"description": "mongodb-memory-server integration for vitest",

@@ -20,2 +20,7 @@ "exports": {

"import": "./dist/mmsTest.mjs"
},
"./mongoose/setupFile": {
"types": "./dist/mongoose/setupFile.d.ts",
"require": "./dist/mongoose/setupFile.cjs",
"import": "./dist/mongoose/setupFile.mjs"
}

@@ -47,4 +52,9 @@ },

},
"optionalDependencies": {
"mongoose": "*",
"mongodb": "*"
},
"peerDependencies": {
"mongodb": "*",
"mongoose": "*",
"mongodb-memory-server": "*",

@@ -51,0 +61,0 @@ "vitest": "*"

@@ -132,1 +132,35 @@ # vitest-mms [![NPM Version](https://img.shields.io/npm/v/vitest-mms)](https://www.npmjs.com/package/vitest-mms)

```
## Usage with mongoose
```js
// vitest.config.mjs
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
globalSetup: ["vitest-mms/globalSetup"],
setupFile: ["vitest-mms/mongoose/setupFile"],
},
});
```
```json
// tsconfig.json
{
"compilerOptions": {
"types": ["vitest-mms/mongoose/setupFile"]
}
}
```
```js
// index.test.js
test("my test", async ({ mongoose }) => {
mongoose.connection.db; // use db
const User = mongoose.model("User", new mongoose.Schema({ name: String }));
await User.create({ name: "John" });
expect(await User.countDocuments()).toBe(1);
});
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc