Skip to content

Conversation

@tichopad
Copy link

@tichopad tichopad commented Sep 20, 2025

Summary:

Fixes ESM compatibility of the transformed output test runner by changing the generated test_runner.js to a .cjs extension.

Details:

Changing the extension to .cjs makes Node always treat the test runner file as a CJS module no matter the module type of the output package.json ("type": "module", "type": "commonjs" or no "type" specified).

This change should be fully backwards-compatible and non-breaking.

Fixes #476

Checks:

  • Tests (deno task test) passing with Node versions 18-24
  • Formatter passing
  • Linter passing
  • CI passing

Fixes ESM compatibility of the transformed output by changing the generated test_runner.js to a .cjs extension.
@CLAassistant
Copy link

CLAassistant commented Sep 20, 2025

CLA assistant check
All committers have signed the CLA.

@tichopad tichopad changed the title Make the generated test runner compatible with ESM output Fix: make the generated test runner compatible with ESM output Sep 20, 2025
@tichopad tichopad changed the title Fix: make the generated test runner compatible with ESM output fix: make the generated test runner compatible with ESM output Sep 20, 2025
@tichopad
Copy link
Author

CI / test pipeline is failing due to a linter issue.

The issue's specifically with no-import-prefix rule. This rule got added to the default ruleset in Deno 2.5.

Since inline imports are allowed in Deno/JS and they're used across the whole project, I assume this is in line with dnt standards and I'll exclude the no-import-prefix rule instead.

Let me know if that's okay or if you'd prefer replacing the inline imports with deps declared in deno.jsonc 🙏

// Copyright 2018-2024 the Deno authors. MIT license.

import { parse } from "jsr:@std/csv/parse";
import { parse } from "jsr:@std/csv@1.0.6/parse";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter was complaining about unspecified version. I used the latest @std/csv version specified in deno.lock.

"no-explicit-any",
"camelcase"
"camelcase",
"no-import-prefix"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got added to the default ruleset in Deno 2.5. My assumption is this project's okay with inline imports, so I've excluded the rule here.

@tichopad tichopad marked this pull request as ready for review September 20, 2025 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Output is not compatible with ESM with esModule: true

2 participants