Registry / testing / preceptor-core

preceptor-core

JSON →
library0.10.1jsnpmunverified

Preceptor-Core is a foundational JavaScript library designed to provide shared components for the Preceptor test runner and aggregator ecosystem. It exposes a `Base` object intended for inheritance, featuring an `extend` method that supports a `__super` call mechanism for methods, mimicking classical inheritance patterns. Additionally, it offers a `utils` module with common utility functions like `deepExtend` and `combine`, and a centralized `log` management system. Currently at version 0.10.1, the package appears to be unmaintained, with its last update several years ago. Its primary use case was as an internal dependency for the Preceptor project. As such, it does not have an active release cadence and is likely incompatible with modern Node.js versions or ES module environments.

npm install preceptor-core
INSTALL
IMPORT
SIG · PRECEPTOR-CORE
P
preceptor-core
testingjavascriptv0.10.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

core
const core = require('preceptor-core');
import core from 'preceptor-core';
This package is CommonJS-only and does not support ES modules directly. Attempting to import via ESM will result in errors.
Base
const Base = require('preceptor-core').Base;
import { Base } from 'preceptor-core';
The `Base` constructor is a named export from the primary module object, not a direct top-level export in a way that modern ESM expects.
utils
const { utils } = require('preceptor-core');
const utils = require('preceptor-core/utils');
`utils` is exposed as a property on the main module object, not a separate entry point.

Demonstrates installing, requiring, and using `preceptor-core`'s `Base` object for inheritance with its `extend` method, including `__super` calls, and an example of `deepExtend` from the `utils` module.

const core = require('preceptor-core'); const BaseObject = core.Base; // Create a new constructor inheriting from Base const MyComponent = BaseObject.extend( function MyComponent(name) { this.__super(name); // Call parent constructor if needed, though Base's constructor is minimal this.name = name; this.init(); }, { // Prototype properties init: function() { console.log(`MyComponent initialized: ${this.name}`); this.emit('ready', this.name); }, greet: function() { console.log(`Hello from ${this.name}!`); }, // Example of overriding and calling super destroy: function() { console.log(`${this.name} is being destroyed.`); this.__super(); // Call the parent's destroy if it existed this.removeAllListeners(); } }, { // Static properties TYPE: 'MyComponentType' } ); const instance = new MyComponent('MyFancyComponent'); instance.on('ready', (name) => console.log(`Event: ${name} is ready!`)); instance.greet(); instance.destroy(); // Example of using utils const { deepExtend } = core.utils; const obj1 = { a: 1, b: { c: 2 } }; const obj2 = { b: { d: 3 }, e: 4 }; const merged = deepExtend({}, obj1, obj2); console.log('Deep merged object:', merged);
Debug
Known issues
breakingThis package is not actively maintained since its last update several years ago (version 0.10.1). It is highly likely to be incompatible with modern Node.js versions (e.g., Node.js 16+ or ESM-only projects) due to breaking changes in core Node.js APIs or assumptions about the runtime environment.
fix
Avoid using this package in new projects. For existing projects, consider migrating to a modern, actively maintained testing framework or utility library. If migration is not an option, you may be restricted to older Node.js runtime versions where the package remains compatible.
affects: >=0.10.1
gotchaThe package is written exclusively in CommonJS (CJS) syntax and does not provide ES module (ESM) exports. Attempting to `import` it in an ESM context will result in runtime errors.
fix
Ensure your project is configured for CommonJS or use a CommonJS `require()` call within an ESM context (if supported by your bundler/runtime) to consume this package. E.g., `const core = require('preceptor-core');`
affects: >=0.1.0
gotchaPreceptor-Core does not ship with TypeScript type definitions. Usage in TypeScript projects will require creating manual declaration files (`.d.ts`) or relying on `any` types, reducing type safety.
fix
Create a `preceptor-core.d.ts` file in your project or install community types if available (unlikely for an abandoned package). Example minimal declaration: `declare module 'preceptor-core' { export const Base: any; export const utils: any; export const log: any; }`
affects: >=0.1.0
deprecatedThe `__super` mechanism used for inheritance, while functional within this library, represents an outdated and non-standard JavaScript inheritance pattern. Modern JavaScript prefers class syntax with `extends` and `super()`, or composition.
fix
For new code, adopt standard ES6+ class syntax. If maintaining existing code that uses this, understand its limitations and potential for confusion compared to modern patterns.
affects: >=0.1.0
Errors
Common errors & fixes
ReferenceError: require is not defined
Attempting to import `preceptor-core` using ES module `import` syntax in a Node.js environment that is running in ES module mode (e.g., `"type": "module"` in `package.json` or `.mjs` files).
fix
Modify your code to use the CommonJS `require()` syntax: `const core = require('preceptor-core');`. If your project is primarily ESM, you might need to use dynamic `import()` or configure your build system to handle CJS dependencies.
TypeError: Cannot read properties of undefined (reading 'Base') OR TypeError: preceptor_core_1.default is not a constructor
Incorrectly trying to destructure named exports from an ES module `import` (`import { Base } from 'preceptor-core';`) or accessing properties on a `default` import when the package is CJS.
fix
Access `Base` and `utils` as properties of the main CommonJS module object: `const core = require('preceptor-core'); const Base = core.Base; const utils = core.utils;`
Error: Cannot find module 'preceptor-core'
The package was not installed, or there was an issue during installation, or the Node.js module resolution path is incorrect.
fix
Ensure the package is correctly installed by running `npm install preceptor-core`. Verify that `node_modules` is in your project root or correctly configured in your module resolution paths.
Upgrade
Version history
0.10.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
preceptor-core — npm install preceptor-core · libregistry