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
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
test
✓ import { test } from 'elasticdash-test';
✗ const { test } = require('elasticdash-test');
Primary entry point for defining individual test cases. ESM-only usage is enforced by Node.js engine requirement.
describe
✓ import { describe } from 'elasticdash-test';
✗ import describe from 'elasticdash-test'; // 'describe' is a named export
Used for grouping related test cases. ESM-only due to Node.js engine requirement. Ensure it's a named import.
configure
✓ import { configure } from 'elasticdash-test';
✗ const configure = require('elasticdash-test').configure;
Used for global configuration, such as setting API keys or ElasticDash connection details. Essential for AI-native features.
Demonstrates defining a test suite for a user management workflow, including global configuration and basic assertions against simulated ElasticDash API interactions. It highlights the use of `test`, `describe`, and `configure`.
import { test, describe, expect, configure } from 'elasticdash-test';
// Configure the test runner with your ElasticDash API key
// It's recommended to load this from environment variables.
configure({
apiKey: process.env.ELASTICDASH_API_KEY ?? '',
endpoint: process.env.ELASTICDASH_API_ENDPOINT ?? 'https://api.elasticdash.com'
});
describe('User Management Workflow', () => {
test('should create a new user successfully', async () => {
// Simulate interaction with an ElasticDash workflow or API
// In a real scenario, this would involve calling the ElasticDash API client
const newUser = { id: 'user-123', name: 'John Doe', email: 'john.doe@example.com' };
const response = await simulateCreateUser(newUser);
expect(response.status).toBe(200);
expect(response.body.message).toBe('User created');
expect(response.body.user.name).toBe('John Doe');
});
test('should retrieve an existing user', async () => {
const userId = 'user-456';
const user = await simulateGetUser(userId);
expect(user).not.toBeNull();
expect(user.id).toBe(userId);
expect(user.name).toBe('Jane Doe');
});
});
async function simulateCreateUser(user: any) {
// Placeholder for actual ElasticDash API call
return Promise.resolve({
status: 200,
body: { message: 'User created', user }
});
}
async function simulateGetUser(id: string) {
// Placeholder for actual ElasticDash API call
if (id === 'user-456') {
return Promise.resolve({ id: 'user-456', name: 'Jane Doe', email: 'jane.doe@example.com' });
}
return Promise.resolve(null);
}
// To run:
// 1. Save as 'user.test.ts'
// 2. Set ELASTICDASH_API_KEY and ELASTICDASH_API_ENDPOINT environment variables
// 3. Run: npx elasticdash-test user.test.ts
elasticdash-test --version
Errors
Common errors & fixes
Error: Must be run with Node.js version 20.0.0 or higher.
Attempting to run the test runner with an incompatible Node.js version.
fixUpgrade your Node.js environment to version 20.0.0 or later. Use `nvm install 20 && nvm use 20` or similar.
TypeError: test is not a function
The `test` function (or `describe`, `configure`) was imported incorrectly, often via a default import or a CommonJS `require` call in an ESM context.
fixEnsure you are using named ES module imports: `import { test, describe, configure } from 'elasticdash-test';`. Error: ElasticDash API Key not configured. Please set 'apiKey' in configure() or ELASTICDASH_API_KEY environment variable.
The `configure` function was called without an `apiKey` or the `ELASTICDASH_API_KEY` environment variable is missing/empty.
fixProvide a valid API key through `configure({ apiKey: 'your-key' })` or by setting the `ELASTICDASH_API_KEY` environment variable before running tests. SyntaxError: Cannot use import statement outside a module
An ES module file (e.g., your test file) is being run in a CommonJS context without proper configuration.
fixAdd `"type": "module"` to your `package.json` or rename your test files to have a `.mjs` extension. Ensure your test runner command respects ESM.
Audit
Dependencies
@elasticdash/workflow-clientrequiredLikely required for interacting with ElasticDash workflows and APIs for test execution and AI integration. (Assumption based on package description)