sanctuary-js / sanctuary

:see_no_evil: Refuge from unsafe JavaScript
https://sanctuary.js.org
MIT License
3.03k stars 94 forks source link

convert test modules to ES modules #740

Closed davidchambers closed 6 months ago

davidchambers commented 6 months ago

This pull request converts all files in the test directory from CommonJS modules to ECMAScript modules.

test/internal/List and test/internal/Sum are used by doctests in the main module, which remains a CommonJS module, so they must also remain CommonJS modules for now. I first renamed them:

$ git mv test/internal/List.{js,cjs}
$ git mv test/internal/Sum.{js,cjs}

I then created wrapper modules for use within the test suite:

$ touch test/internal/{List,Sum}.mjs
$ git add test/internal/{List,Sum}.mjs

The only other non-trivial change involved using module.createRequire to keep the NODE_ENV tests working.