Seneca Error Test Utility
seneca-error-test is an internal utility package primarily designed for testing error handling mechanisms within the Seneca microservices framework. Released at version 0.2.2, it explicitly states compatibility with Node.js 0.10.31 and Seneca 0.6.0. These are very old versions of both Node.js and Seneca, indicating that the package has not seen active development or maintenance for many years. Consequently, it is highly unlikely to be compatible with modern Node.js versions (v14+) or current stable releases of Seneca (v3+). Its release cadence is effectively zero, as it has remained at 0.2.2 since its initial publication. As an internal test utility, it offers minimal user-facing functionality beyond its specific testing purpose, serving more as a historical artifact or a reference for older Seneca implementations rather than a viable tool for contemporary projects. Its use in new projects is strongly discouraged due to potential compatibility issues and lack of security updates.
Common errors
-
TypeError: seneca.add is not a function
cause Attempting to use an old version of the Seneca framework, or an old plugin with a newer Seneca instance where the `seneca.add` signature has changed significantly.fixEnsure your `seneca` package version matches the expectations of the plugin (Seneca 0.6.0 for this package). For modern Seneca, you cannot directly use this plugin without modification. -
ERR_REQUIRE_ESM: require() of ES Module ... not supported
cause While this package is CommonJS, if it were part of a larger project attempting to use ESM-only dependencies or being imported into an ESM context without proper transpilation/bundling, this error could occur.fixEnsure your project is configured for CommonJS if using old packages, or use a bundler that handles CJS to ESM conversion if necessary. For this package, directly `require()`ing it is the intended method. -
Cannot find module 'seneca-error-test'
cause The package is not installed, or the path in `require()` is incorrect.fixRun `npm install seneca-error-test` or `yarn add seneca-error-test` to install it.
Warnings
- breaking This package was explicitly tested with Node.js 0.10.31 and Seneca 0.6.0. It is highly incompatible with modern Node.js versions (v14+) and Seneca versions (v3+) due to significant API changes and JavaScript syntax evolution.
- deprecated The package has not been updated since its 0.2.2 release and is effectively abandoned. There is no active maintenance, bug fixes, or security patches planned.
- gotcha Using this package with newer Seneca instances may lead to silent failures, unexpected behavior, or TypeErrors due to deprecated Seneca API calls (e.g., `seneca.add` signatures).
Install
-
npm install seneca-error-test -
yarn add seneca-error-test -
pnpm add seneca-error-test
Imports
- senecaErrorTestPlugin
const senecaErrorTestPlugin = require('seneca-error-test')
Quickstart
const Seneca = require('seneca')
const senecaErrorTestPlugin = require('seneca-error-test')
async function runErrorTest() {
const seneca = Seneca({ log: 'silent' })
// Register the error test plugin
seneca.use(senecaErrorTestPlugin)
try {
// Call a command designed to fail
const result = await seneca.post('role:error-test,cmd:fail')
console.log('Unexpected success:', result)
} catch (err) {
console.error('Caught expected error:', err.message)
}
try {
// Call a command that returns an error object
const result = await seneca.post('role:error-test,cmd:errobj,arg:testvalue')
// In older Seneca, this might not throw but return an object with error properties
console.log('Result from errobj (may contain error details):', result)
} catch (err) {
console.error('Caught error from errobj:', err.message)
}
await seneca.close()
}
runErrorTest()