{"id":18854,"library":"test-utils","title":"test-utils","description":"A Node.js package providing MongoDB test utilities. It requires Node >= 8.9.1, Yarn >= 1.3.2, and mtools >= 1.3.2 (Python). The package has infrequent releases; the last stable version is 1.1.1. It integrates with Python-based mtools for MongoDB testing. Key differentiators include dependency on Python ecosystem and explicit version requirements.","status":"active","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/SouthbankSoftware/test-utils","tags":["javascript"],"install":[{"cmd":"npm install test-utils","lang":"bash","label":"npm"},{"cmd":"yarn add test-utils","lang":"bash","label":"yarn"},{"cmd":"pnpm add test-utils","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for MongoDB testing utilities","package":"mtools","optional":false}],"imports":[{"note":"Package likely uses default export; CommonJS require may work but ESM is recommended for modern Node.","wrong":"const testUtils = require('test-utils')","symbol":"defaultExport","correct":"import testUtils from 'test-utils'"}],"quickstart":{"code":"import testUtils from 'test-utils';\n\n// Example: create a test MongoDB instance\nconst mongo = await testUtils.startMongo();\nconsole.log('MongoDB started on port', mongo.port);\n\n// Use the instance\nconst db = await mongo.db('test');\nawait db.collection('test').insertOne({ key: 'value' });\nconst doc = await db.collection('test').findOne({ key: 'value' });\nconsole.log(doc);\n\n// Stop\nawait mongo.stop();","lang":"typescript","description":"Shows how to start a test MongoDB instance, perform operations, and stop it."},"warnings":[{"fix":"Run: pip install mtools pymongo numpy psutil python-dateutil","message":"Requires Python packages (mtools, pymongo, etc.) to be installed via pip.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Upgrade Node to 8.9.1 or later.","message":"Minimum Node version 8.9.1; not compatible with older Node versions.","severity":"gotcha","affected_versions":"<8.9.1"},{"fix":"Install Yarn 1.3.2+.","message":"Minimum Yarn version 1.3.2 required; using older Yarn may cause issues.","severity":"gotcha","affected_versions":"<1.3.2"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run: pip install mtools pymongo numpy psutil python-dateutil","cause":"Python mtools package is not installed.","error":"Error: Cannot find module 'mtools'"},{"fix":"Upgrade Node to version 8.9.1 or later.","cause":"Current Node version is below 8.9.1.","error":"Error: The engine \"node\" is incompatible with this module. Expected version \">= 8.9.1\". Got \"x.x.x\""}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}