{"_id":"@embedunit/core","_rev":"3-942eb8c68514ed9ae5c19892e290bb2f","name":"@embedunit/core","dist-tags":{"latest":"0.5.0"},"versions":{"0.1.0":{"name":"@embedunit/core","version":"0.1.0","keywords":["test","testing","test-runner","embedded","javascript","runtime","jest","describe","it","hooks"],"author":{"name":"Vladislav Remin","email":"vuliad@users.noreply.github.com"},"license":"MIT","_id":"@embedunit/core@0.1.0","maintainers":[{"name":"vuliad","email":"vuliad@gmail.com"}],"homepage":"https://github.com/embedunit/embedunit#readme","bugs":{"url":"https://github.com/embedunit/embedunit/issues"},"dist":{"shasum":"d4f7a4746fef8ded9958e826d8567148e038185a","tarball":"https://registry.npmjs.org/@embedunit/core/-/core-0.1.0.tgz","fileCount":29,"integrity":"sha512-y4+Tnmb8rXMv6NDTbYcBXeXHcK/BY/5Gn/Y5gP2Ch94AdbxGR+4Z4ZFNGb6WciJTh7YG4gs9T5UOjp8+HtkDPw==","signatures":[{"sig":"MEQCIAtvO8R7RODKpGV8wUaW/ldecV3NIsYzhL2qz2vigro+AiAO5L6HRqrRypXLvrHbJ8dafb43wgSh1DAVPZ2GDm6TNQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":548797},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"fb5a5de5b9a5e8e9a9a8e668d6a9eeb1ef79f4c5","scripts":{"test":"tsx test/run.ts","build":"rollup -c","clean":"rm -rf dist","build:types":"rollup -c --configTypes"},"_npmUser":{"name":"vuliad","email":"vuliad@gmail.com"},"repository":{"url":"git+https://github.com/embedunit/embedunit.git","type":"git","directory":"packages/core"},"_npmVersion":"11.5.1","description":"Tiny test runner core for embedded JavaScript runtimes","directories":{},"sideEffects":false,"_nodeVersion":"24.7.0","dependencies":{"source-map-js":"^1.2.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@embedunit/assert":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/core_0.1.0_1768073047225_0.4539293557193165","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@embedunit/core","version":"0.4.0","keywords":["test","testing","test-runner","embedded","javascript","runtime","jest","describe","it","hooks"],"author":{"name":"Vladislav Remin","email":"vuliad@users.noreply.github.com"},"license":"MIT","_id":"@embedunit/core@0.4.0","maintainers":[{"name":"vuliad","email":"vuliad@gmail.com"}],"homepage":"https://github.com/embedunit/embedunit#readme","bugs":{"url":"https://github.com/embedunit/embedunit/issues"},"dist":{"shasum":"0f9e7b83ecabf2f740b60304c6f98b11d3b81c88","tarball":"https://registry.npmjs.org/@embedunit/core/-/core-0.4.0.tgz","fileCount":30,"integrity":"sha512-OdZsWM6qXrpIbKbbHg9o/xOMwGol4Z8z/r4k1cpQpqdvSuU3djZNLhRpBqdmZ5Gr2pKk2vybFGc+kuVtfJoY3w==","signatures":[{"sig":"MEQCIB5fYGUsg7hc3ibFX/jPErnk7i/JkTCLXKw567ouPEvtAiBStsAAPjODVMajevzqzwTkM3VDlEKnqxFEC/yxYZGqbQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@embedunit%2fcore@0.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":549886},"main":"./dist/index.cjs","type":"module","_from":"file:embedunit-core-0.4.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"test":"tsx test/run.ts","build":"rollup -c","clean":"rm -rf dist","build:types":"rollup -c --configTypes"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:7159aed7-0598-4101-81d2-e47b6afe2cdd"}},"_resolved":"/tmp/a7343c7d28134cd3e66fd9a738537108/embedunit-core-0.4.0.tgz","_integrity":"sha512-OdZsWM6qXrpIbKbbHg9o/xOMwGol4Z8z/r4k1cpQpqdvSuU3djZNLhRpBqdmZ5Gr2pKk2vybFGc+kuVtfJoY3w==","repository":{"url":"git+https://github.com/embedunit/embedunit.git","type":"git","directory":"packages/core"},"_npmVersion":"11.7.0","description":"Tiny test runner core for embedded JavaScript runtimes","directories":{},"sideEffects":false,"_nodeVersion":"20.19.6","dependencies":{"source-map-js":"^1.2.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@embedunit/assert":"0.4.0"},"_npmOperationalInternal":{"tmp":"tmp/core_0.4.0_1768082111809_0.740216848702415","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@embedunit/core","version":"0.5.0","description":"Tiny test runner core for embedded JavaScript runtimes","license":"MIT","author":{"name":"Vladislav Remin","email":"vuliad@users.noreply.github.com"},"repository":{"type":"git","url":"git+https://github.com/embedunit/embedunit.git","directory":"packages/core"},"bugs":{"url":"https://github.com/embedunit/embedunit/issues"},"homepage":"https://github.com/embedunit/embedunit#readme","keywords":["test","testing","test-runner","embedded","javascript","runtime","jest","describe","it","hooks"],"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs","types":"./dist/index.d.ts"}},"sideEffects":false,"publishConfig":{"access":"public"},"devDependencies":{"@embedunit/assert":"0.5.0"},"scripts":{"build":"rollup -c","build:types":"rollup -c --configTypes","clean":"rm -rf dist","test":"tsx test/run.ts"},"_id":"@embedunit/core@0.5.0","_integrity":"sha512-/xEcXvzmtlpoAfoLVLl7X9AcRqlHoXDPyKN55spns7u/wWCr5sGuAyI8jeBqckGKRUF1OpmMPCTU+YPcLmZhFg==","_resolved":"/tmp/59a231a2d431e6349f5b7443fe5989c1/embedunit-core-0.5.0.tgz","_from":"file:embedunit-core-0.5.0.tgz","_nodeVersion":"20.19.6","_npmVersion":"11.7.0","dist":{"integrity":"sha512-/xEcXvzmtlpoAfoLVLl7X9AcRqlHoXDPyKN55spns7u/wWCr5sGuAyI8jeBqckGKRUF1OpmMPCTU+YPcLmZhFg==","shasum":"21fc4a9388d8d28e3d0d0b012d97706529438f21","tarball":"https://registry.npmjs.org/@embedunit/core/-/core-0.5.0.tgz","fileCount":30,"unpackedSize":540624,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@embedunit%2fcore@0.5.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHewNIEJw9YKdZWJ+Cd8js7cphtd+EYOpA6G/6KqbQb1AiEAtLSmsVavcWvtx6Qn+gOkTlfVGup9r0ntQl/xKJeNGKg="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:7159aed7-0598-4101-81d2-e47b6afe2cdd"}},"directories":{},"maintainers":[{"name":"vuliad","email":"vuliad@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_0.5.0_1768221700607_0.3176061529112719"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-10T19:24:07.146Z","modified":"2026-01-12T12:41:41.151Z","0.1.0":"2026-01-10T19:24:07.385Z","0.4.0":"2026-01-10T21:55:11.955Z","0.5.0":"2026-01-12T12:41:40.795Z"},"bugs":{"url":"https://github.com/embedunit/embedunit/issues"},"author":{"name":"Vladislav Remin","email":"vuliad@users.noreply.github.com"},"license":"MIT","homepage":"https://github.com/embedunit/embedunit#readme","keywords":["test","testing","test-runner","embedded","javascript","runtime","jest","describe","it","hooks"],"repository":{"type":"git","url":"git+https://github.com/embedunit/embedunit.git","directory":"packages/core"},"description":"Tiny test runner core for embedded JavaScript runtimes","maintainers":[{"name":"vuliad","email":"vuliad@gmail.com"}],"readme":"# @embedunit/core\n\nTest runner core for embedded JavaScript runtimes. Provides a Jest/JUnit-style API (describe, it, hooks) designed to run inside engines, SDKs, and other non-Node environments.\n\n## Installation\n\n```bash\nnpm install @embedunit/core\n```\n\n## Basic Usage\n\n```typescript\nimport { describe, it, runTests } from '@embedunit/core';\n\ndescribe('Calculator', () => {\n  it('adds numbers', () => {\n    if (1 + 2 !== 3) throw new Error('Addition failed');\n  });\n\n  it('multiplies numbers', () => {\n    if (2 * 3 !== 6) throw new Error('Multiplication failed');\n  });\n});\n\n// Run all registered tests\nconst results = await runTests();\nconsole.log(results.summary); // { total: 2, passed: 2, failed: 0, ... }\n```\n\n## Key Exports\n\n### Test DSL\n\n- `describe(name, fn, timeout?)` - Create a test suite\n- `it(name, fn, timeout?)` / `test(name, fn, timeout?)` - Define a test case\n- `beforeAll(fn)` - Run once before all tests in suite\n- `beforeEach(fn)` - Run before each test\n- `afterEach(fn)` - Run after each test\n- `afterAll(fn)` - Run once after all tests in suite\n\n### Runner\n\n- `runTests(options?)` - Execute tests and return results\n- `getTestList(options?)` - Get list of registered tests without running\n\n### Configuration\n\n- `setConfig(config)` - Update global configuration\n- `getConfig()` - Get current configuration\n- `resetConfig()` - Reset to defaults\n\n## Lifecycle Hooks\n\n```typescript\ndescribe('Database tests', () => {\n  let db;\n\n  beforeAll(async () => {\n    db = await connectToDatabase();\n  });\n\n  afterAll(async () => {\n    await db.close();\n  });\n\n  beforeEach(() => {\n    db.beginTransaction();\n  });\n\n  afterEach(() => {\n    db.rollback();\n  });\n\n  it('queries data', async () => {\n    const result = await db.query('SELECT 1');\n    // assertions...\n  });\n});\n```\n\n## Timeout Configuration\n\n### Global Default\n\n```typescript\nimport { setConfig } from '@embedunit/core';\n\nsetConfig({\n  defaultTimeout: 10000, // 10 seconds for all tests\n  hookTimeout: 5000      // 5 seconds for hooks\n});\n```\n\n### Per-Suite Timeout\n\n```typescript\ndescribe('Slow tests', () => {\n  // All tests in this suite get 30s timeout\n}, 30000);\n```\n\n### Per-Test Timeout\n\n```typescript\nit('long running test', async () => {\n  await someLongOperation();\n}, 60000); // 60 second timeout\n```\n\n## Skip and Only\n\n### Skipping Tests\n\n```typescript\ndescribe.skip('Broken feature', () => {\n  it('will not run', () => {});\n});\n\nit.skip('temporarily disabled', () => {});\n\n// Aliases\nxdescribe('also skipped', () => {});\nxit('also skipped', () => {});\n```\n\n### Focusing Tests\n\n```typescript\ndescribe.only('Only this suite runs', () => {\n  it('will run', () => {});\n});\n\nit.only('only this test runs', () => {});\n\n// Aliases\nfdescribe('focused suite', () => {});\nfit('focused test', () => {});\n```\n\n## Parameterized Tests\n\n### Array of Arrays\n\n```typescript\nit.each([\n  [1, 1, 2],\n  [1, 2, 3],\n  [2, 2, 4]\n])('adds %d + %d to equal %d', (a, b, expected) => {\n  if (a + b !== expected) throw new Error('Failed');\n});\n```\n\n### Array of Objects\n\n```typescript\nit.each([\n  { input: 'hello', expected: 5 },\n  { input: 'world', expected: 5 }\n])('$input has length $expected', ({ input, expected }) => {\n  if (input.length !== expected) throw new Error('Failed');\n});\n```\n\n### With describe.each\n\n```typescript\ndescribe.each([\n  ['admin', true],\n  ['guest', false]\n])('User role: %s', (role, canDelete) => {\n  it('has correct permissions', () => {\n    // test using role and canDelete\n  });\n});\n```\n\n## Filtering Tests\n\n### By Suite/Test Name\n\n```typescript\nconst results = await runTests({\n  only: { suite: 'Calculator' }\n});\n\n// Multiple suites\nconst results = await runTests({\n  only: { suites: ['Calculator', 'Parser'] }\n});\n```\n\n### By Pattern (grep)\n\n```typescript\nconst results = await runTests({\n  grep: /should.*correctly/\n});\n```\n\n### By Tags\n\n```typescript\ndescribe('@integration Database', () => {\n  it('@slow queries large dataset', () => {});\n});\n\n// Run only integration tests\nawait runTests({ tags: ['integration'] });\n\n// Exclude slow tests\nawait runTests({ excludeTags: ['slow'] });\n```\n\n### Custom Filter\n\n```typescript\nconst results = await runTests({\n  filter: (suite, test) => suite.includes('critical')\n});\n```\n\n## Run Options\n\n```typescript\nconst results = await runTests({\n  bail: true,           // Stop on first failure\n  includePassed: true,  // Include passed tests in results\n  includeSkipped: true, // Include skipped tests in results\n  verboseErrors: true,  // Full error details with stack traces\n  onEvent: (event) => {\n    // Handle test events: start, pass, fail, skip, complete\n    console.log(event.type, event.test);\n  }\n});\n```\n\n## Result Structure\n\n```typescript\ninterface TestRunResult {\n  summary: {\n    total: number;\n    passed: number;\n    failed: number;\n    skipped: number;\n    duration: number;\n    success: boolean;\n  };\n  failures: Array<{\n    suite: string;\n    test: string;\n    error: { message: string; file?: string; line?: number };\n    duration: number;\n  }>;\n  passed?: Array<{ suite: string; test: string; duration: number }>;\n  skipped?: Array<{ suite: string; test: string }>;\n}\n```\n\n## Extended DSL\n\nConditional test helpers for platform-specific tests:\n\n```typescript\nimport { itIf, describeIf, platform, env } from '@embedunit/core';\n\n// Run test only in browser\nitIf(platform.isBrowser)('uses localStorage', () => {});\n\n// Run suite only when env var is set\ndescribeIf(env('CI'))('CI-only tests', () => {});\n\n// Skip test based on condition\nitSkipIf(platform.isNode)('browser-only feature', () => {});\n```\n\n## Links\n\n- [Main Repository](https://github.com/nicobrinkkemper/embedunit)\n- [Full Documentation](https://github.com/nicobrinkkemper/embedunit#readme)\n","readmeFilename":"README.md"}