{"id":14540,"library":"elasticdash-test","title":"ElasticDash Test Runner","description":"elasticdash-test is an AI-native test runner specifically designed for testing ElasticDash workflows. Currently in early development at version 0.1.19, it provides capabilities for defining, executing, and potentially generating tests with AI assistance, tailored for the ElasticDash ecosystem. Given its `0.x` version, users should expect frequent updates and potential breaking changes as the API and features evolve rapidly. The package differentiates itself by integrating AI directly into the testing process, aiming to streamline workflow validation within ElasticDash environments, contrasting with general-purpose test runners by focusing on this specific use case and its associated data and API structures.","status":"active","version":"0.1.19","language":"javascript","source_language":"en","source_url":"https://github.com/ElasticDash/elasticdash-test-js","tags":["javascript","typescript"],"install":[{"cmd":"npm install elasticdash-test","lang":"bash","label":"npm"},{"cmd":"yarn add elasticdash-test","lang":"bash","label":"yarn"},{"cmd":"pnpm add elasticdash-test","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Likely required for interacting with ElasticDash workflows and APIs for test execution and AI integration. (Assumption based on package description)","package":"@elasticdash/workflow-client","optional":false}],"imports":[{"note":"Primary entry point for defining individual test cases. ESM-only usage is enforced by Node.js engine requirement.","wrong":"const { test } = require('elasticdash-test');","symbol":"test","correct":"import { test } from 'elasticdash-test';"},{"note":"Used for grouping related test cases. ESM-only due to Node.js engine requirement. Ensure it's a named import.","wrong":"import describe from 'elasticdash-test'; // 'describe' is a named export","symbol":"describe","correct":"import { describe } from 'elasticdash-test';"},{"note":"Used for global configuration, such as setting API keys or ElasticDash connection details. Essential for AI-native features.","wrong":"const configure = require('elasticdash-test').configure;","symbol":"configure","correct":"import { configure } from 'elasticdash-test';"}],"quickstart":{"code":"import { test, describe, expect, configure } from 'elasticdash-test';\n\n// Configure the test runner with your ElasticDash API key\n// It's recommended to load this from environment variables.\nconfigure({\n  apiKey: process.env.ELASTICDASH_API_KEY ?? '',\n  endpoint: process.env.ELASTICDASH_API_ENDPOINT ?? 'https://api.elasticdash.com'\n});\n\ndescribe('User Management Workflow', () => {\n  test('should create a new user successfully', async () => {\n    // Simulate interaction with an ElasticDash workflow or API\n    // In a real scenario, this would involve calling the ElasticDash API client\n    const newUser = { id: 'user-123', name: 'John Doe', email: 'john.doe@example.com' };\n    const response = await simulateCreateUser(newUser);\n\n    expect(response.status).toBe(200);\n    expect(response.body.message).toBe('User created');\n    expect(response.body.user.name).toBe('John Doe');\n  });\n\n  test('should retrieve an existing user', async () => {\n    const userId = 'user-456';\n    const user = await simulateGetUser(userId);\n\n    expect(user).not.toBeNull();\n    expect(user.id).toBe(userId);\n    expect(user.name).toBe('Jane Doe');\n  });\n});\n\nasync function simulateCreateUser(user: any) {\n  // Placeholder for actual ElasticDash API call\n  return Promise.resolve({\n    status: 200,\n    body: { message: 'User created', user }\n  });\n}\n\nasync function simulateGetUser(id: string) {\n  // Placeholder for actual ElasticDash API call\n  if (id === 'user-456') {\n    return Promise.resolve({ id: 'user-456', name: 'Jane Doe', email: 'jane.doe@example.com' });\n  }\n  return Promise.resolve(null);\n}\n\n// To run:\n// 1. Save as 'user.test.ts'\n// 2. Set ELASTICDASH_API_KEY and ELASTICDASH_API_ENDPOINT environment variables\n// 3. Run: npx elasticdash-test user.test.ts","lang":"typescript","description":"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`."},"warnings":[{"fix":"Always pin exact versions in `package.json` (e.g., `\"elasticdash-test\": \"0.1.19\"`) and review release notes before upgrading to new `0.x` versions.","message":"The package is in early `0.x` development (current version 0.1.19). Frequent breaking changes to the API, configuration, and underlying AI models are highly probable. Users should pin exact versions and review changelogs carefully.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Upgrade your Node.js environment to version 20.0.0 or later. Use a version manager like `nvm` (`nvm install 20 && nvm use 20`).","message":"This package requires Node.js version 20.0.0 or higher. Running with older Node.js versions will result in errors due to unsupported syntax or APIs.","severity":"breaking","affected_versions":"<=0.1.19"},{"fix":"Ensure `configure({ apiKey: process.env.ELASTICDASH_API_KEY, ... })` is called at the entry point of your test setup, with valid credentials preferably loaded from secure environment variables.","message":"Configuration for ElasticDash API keys and endpoints is critical for the AI-native features to function. Improper or missing configuration will lead to authentication errors or non-functional AI capabilities.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Always use ES module `import` syntax (e.g., `import { test } from 'elasticdash-test';`). Ensure your project is configured for ESM (e.g., `\"type\": \"module\"` in `package.json` or `.mjs` file extension).","message":"As an ESM-only package, CommonJS `require()` statements are not supported for importing `elasticdash-test` modules. Attempting to use `require` will result in runtime errors.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Upgrade your Node.js environment to version 20.0.0 or later. Use `nvm install 20 && nvm use 20` or similar.","cause":"Attempting to run the test runner with an incompatible Node.js version.","error":"Error: Must be run with Node.js version 20.0.0 or higher."},{"fix":"Ensure you are using named ES module imports: `import { test, describe, configure } from 'elasticdash-test';`.","cause":"The `test` function (or `describe`, `configure`) was imported incorrectly, often via a default import or a CommonJS `require` call in an ESM context.","error":"TypeError: test is not a function"},{"fix":"Provide a valid API key through `configure({ apiKey: 'your-key' })` or by setting the `ELASTICDASH_API_KEY` environment variable before running tests.","cause":"The `configure` function was called without an `apiKey` or the `ELASTICDASH_API_KEY` environment variable is missing/empty.","error":"Error: ElasticDash API Key not configured. Please set 'apiKey' in configure() or ELASTICDASH_API_KEY environment variable."},{"fix":"Add `\"type\": \"module\"` to your `package.json` or rename your test files to have a `.mjs` extension. Ensure your test runner command respects ESM.","cause":"An ES module file (e.g., your test file) is being run in a CommonJS context without proper configuration.","error":"SyntaxError: Cannot use import statement outside a module"}],"ecosystem":"npm"}