fix: make the generated test runner compatible with ESM output#477
fix: make the generated test runner compatible with ESM output#477tichopad wants to merge 2 commits intodenoland:mainfrom
Conversation
Fixes ESM compatibility of the transformed output by changing the generated test_runner.js to a .cjs extension.
|
CI / test pipeline is failing due to a linter issue. The issue's specifically with Since inline imports are allowed in Deno/JS and they're used across the whole project, I assume this is in line with 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"; |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
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:
deno task test) passing with Node versions 18-24