remy / mit-license

Hosted MIT License with details controlled through this repo
mit-license.org
Other
2.26k stars 1.57k forks source link

How to test? #1514

Closed remy closed 2 years ago

remy commented 2 years ago

@Richienb I've not looked at the code in a while and I see you've turned down the type="module" path… which is fine :) but I've no idea how to test the code (I'm trying to write a test that fixes this issue some users still seeing).

I'm sure there's a flag missing somewhere:

$ yarn test
yarn run v1.22.10
$ node test.js
file:///Users/remy/dev/mit-license/test.js:3
import writeJsonFile from "write-json-file";
       ^^^^^^^^^^^^^
SyntaxError: The requested module 'write-json-file' does not provide an export named 'default'
    at ModuleJob._instantiate (internal/modules/esm/module_job.js:121:21)
    at async ModuleJob.run (internal/modules/esm/module_job.js:166:5)
    at async Loader.import (internal/modules/esm/loader.js:178:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Richienb commented 2 years ago

That semicolon does not exist in the current version:

https://github.com/remy/mit-license/blob/a9335d4310cab619bc063eeadb9556d32a658c7e/test.js#L3

Try git pulling.

remy commented 2 years ago

thought I had, but yep - on it.

remy commented 2 years ago

yeah, it's up to date.

Richienb commented 2 years ago

Discovered it's an API change, fixed now:

https://github.com/remy/mit-license/blob/49f54abe1e82e0052a5fcb8a2f1252ba9e2a3775/test.js#L3