lukeed / trouter

:fish: A fast, small-but-mighty, familiar fish...errr, router*
MIT License
634 stars 23 forks source link

Cannot run tests (Cannot use import statement outside a module error in uvu when running npm test) #24

Open aral opened 2 months ago

aral commented 2 months ago

With Node 22.1.0 (tried with 10.3.0 as that’s mentioned in the benchmarks but also got an error).

  1. Clone trouter
  2. npm i
  3. npm test

Result:

> trouter@4.0.0 test
> uvu -r esm test

(node:3170012) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
/var/home/aral/Projects/kitten/forks/trouter/test/index.js:1
(function (exports, require, module, __filename, __dirname) { import { test } from 'uvu';
                                                              ^^^^^^

SyntaxError: Cannot use import statement outside a module
    at makeContextifyScript (node:internal/vm:185:14)
    at wrapSafe (node:internal/modules/cjs/loader:1362:20)
    at Module._compile (node:internal/modules/cjs/loader:1425:20)
    at Module._extensions..js (node:internal/modules/cjs/loader:1564:10)
    at Module.load (node:internal/modules/cjs/loader:1287:32)
    at Module._load (node:internal/modules/cjs/loader:1103:12)
    at Module.require (node:internal/modules/cjs/loader:1310:19)
    at require (node:internal/modules/helpers:179:18)
    at /var/home/aral/Projects/kitten/forks/trouter/node_modules/uvu/run/index.js:9:3
    at Array.forEach (<anonymous>)