Closed
Description
cli-testing-library
version: 2.0.2- Testing Framework and version: Node test runner @ v23.4.0
Relevant code or config:
Importing as an ESM module:
import { render } from 'cli-testing-library'
What you did:
Just set up the tool using mjs
.
What happened:

Problem description:
Node ESM modules doesn't support __dirname
.
https://github.com/crutchcorn/cli-testing-library/blob/main/src/pure.ts#L20
Suggested solution:
Replace __dirname
by
import path from 'path'
import { fileURLToPath } from 'url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
The current workaround was using cjs
.
Metadata
Metadata
Assignees
Labels
No labels