Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Es test #460

Merged
merged 3 commits into from
Feb 1, 2024
Merged

Es test #460

merged 3 commits into from
Feb 1, 2024

Conversation

hildjj
Copy link
Contributor

@hildjj hildjj commented Jan 28, 2024

Allow testing of es modules. Fixes #399

@frostburn
Copy link
Contributor

Tests succeed on my end.
I'm not familiar with the issues in this PR. Is there something that I could test manually that is broken on main and this one fixes?

@hildjj
Copy link
Contributor Author

hildjj commented Jan 29, 2024

This should fail on main, but pass on this branch:

echo "foo = '1'" | bin/peggy.js --format es -t 1

unless you run this branch on node 20.7 or earlier, then it should fail with a version error.

@hildjj
Copy link
Contributor Author

hildjj commented Jan 29, 2024

All of the interesting stuff is now in bin/fromMem.js. It shouldn't actually be security-relevant, even though it looks like it. All of those gyrations are there so that import and require work relative to the output directory (which is the input directory by default).

@frostburn
Copy link
Contributor

This should fail on main, but pass on this branch:

echo "foo = '1'" | bin/peggy.js --format es -t 1

unless you run this branch on node 20.7 or earlier, then it should fail with a version error.

Apparently my version of Ubuntu ships with node version 18.13.0 so I get the expected failure. (Don't feel like messing around with updates right now...)

On main I get:

Error running test
Unexpected token 'export'

@hildjj
Copy link
Contributor Author

hildjj commented Jan 29, 2024

Good, that works as expected. I like to use npm -g install nve and nve 21 ./bin/peggy ... to use different node versions without having to change what is installed globally.

@frostburn
Copy link
Contributor

Thanks!

$ echo "foo = '1'" | nve 21 node --experimental-vm-modules ./bin/peggy.js --format es -t 1
'1'

Copy link
Contributor Author

@hildjj hildjj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check a few things.

bin/fromMem.js Outdated Show resolved Hide resolved
bin/fromMem.js Outdated Show resolved Hide resolved
bin/fromMem.js Outdated Show resolved Hide resolved
bin/fromMem.js Show resolved Hide resolved
bin/fromMem.js Show resolved Hide resolved
bin/fromMem.js Outdated Show resolved Hide resolved
bin/fromMem.js Show resolved Hide resolved
@hildjj hildjj merged commit 126a803 into peggyjs:main Feb 1, 2024
9 checks passed
@hildjj hildjj deleted the es-test branch February 1, 2024 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run tests on es modules
3 participants