Description: Fix tests to work with ESM/CJS more properly
 They relied on confused pre-nodejs 22 behavior about mixing
 CJS/ESM modules.
Author: Jérémy Lal <kapouer@melix.org>
Forwarded: no, dead upstream
Last-Update: 2025-11-21


--- a/bin.js
+++ b/bin.js
@@ -1,7 +1,7 @@
 #!/usr/bin/env node
-const sade = require('sade');
-const pkg = require('./package');
-const { parse } = require('./parse');
+import { default as sade} from 'sade';
+import * as pkg from './package.json' with { type: 'json' };
+import { parse } from "uvu/parse";
 
 const dimport = x => new Function(`return import(${ JSON.stringify(x) })`).call(0);
 
--- a/package.json
+++ b/package.json
@@ -10,6 +10,7 @@
   "bin": {
     "uvu": "bin.js"
   },
+  "type": "module",
   "exports": {
     ".": {
       "types": "./index.d.ts",
--- a/test/assert.js
+++ b/test/assert.js
@@ -1,6 +1,6 @@
 import { suite } from 'uvu';
 import * as assert from 'uvu/assert';
-import * as $ from '../src/assert';
+import * as $ from '../src/assert.js';
 
 function isError(err, msg, input, expect, operator, details) {
 	assert.instance(err, Error);
--- a/test/diff.js
+++ b/test/diff.js
@@ -1,6 +1,6 @@
 import { suite } from 'uvu';
 import * as assert from 'uvu/assert';
-import * as $ from '../src/diff';
+import * as $ from '../src/diff.js';
 
 const isNode8 = process.versions.node.startsWith('8.');
 const strip = str => str.replace(/[\u001B\u009B][[\]()#;?]*(?:(?:(?:[a-zA-Z\d]*(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)|(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-ntqry=><~]))/g, '');
--- a/test/parse.js
+++ b/test/parse.js
@@ -2,8 +2,10 @@
 import { readdirSync } from 'fs';
 import { isAbsolute } from 'path';
 import * as assert from 'uvu/assert';
-import * as $ from '../parse';
+import * as $ from 'uvu/parse';
 
+const __dirname = decodeURIComponent(new URL('.', import.meta.url).pathname.slice(0, -1));
+console.log(__dirname)
 const FILES = readdirSync(__dirname);
 
 const parse = suite('parse');
--- a/test/uvu.js
+++ b/test/uvu.js
@@ -1,6 +1,6 @@
 import { suite } from 'uvu';
 import * as assert from 'uvu/assert';
-import * as uvu from '../src/index';
+import * as uvu from '../src/index.js';
 
 const ste = suite('suite');
 
