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

convert test runners to ocaml #762

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

patricoferris
Copy link

This PR converts the three vscode-test runners to OCaml by adding a few extra bindings to the various JS packages. This is in partial fulfilment of #393 (it doesn't bind mocha and the like, this could be a follow-up PR perhaps or I can revisit this PR next week to add that).

cc: @tmattio

@@ -0,0 +1 @@
joo_global_object.fsExtra = require('fs-extra')
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's a shame we have to add a dependency and bindings to the library for a single function. Would it be easy to implement copySync with of standard NodeJS functions?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the quick review :))

https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy-sync.js 🤷

To reduce the number of files perhaps bundling it into the existing FS bindings might be a good idea seeing as they're already an altered form of the "true" Node FS module ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

To reduce the number of files perhaps bundling it into the existing FS bindings might be a good idea seeing as they're already an altered form of the "true" Node FS module ?

Sure, that sounds good 🙂

Copy link
Author

Choose a reason for hiding this comment

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

Actually, unless I'm mistaken, wouldn't this require an extra dependency for the package as fs-extra is only a dev dependency at the moment https://github.com/ocamllabs/vscode-ocaml-platform/blob/master/package.json#L966 ? Maybe not worth it then?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we even need this dependency?

I noticed you added Fs.Sync.copy, can't that be used instead of Fs_extra.copy_sync?

Copy link
Author

Choose a reason for hiding this comment

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

IIUC Fs_extra.copy_sync is used because it copied directories (not just that it is synchronous).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay in that case I personally think we should leave it as-is.

It's a shame we have to add a dependency and bindings to the library for a single function.

@tmattio: It's not adding a dependency since the JS version of the tests also used this library.
We can remove the dependency later in another PR if necessary.

unless I'm mistaken, wouldn't this require an extra dependency for the package as fs-extra is only a dev dependency at the moment

That's right. That means that keeping the bindings to fs-extra separate would not require us to add it as a runtime dependency.

@tmattio
Copy link
Collaborator

tmattio commented Nov 2, 2021

Thanks @patricoferris, this is great!

This is in partial fulfilment of #393 (it doesn't bind mocha and the like, this could be a follow-up PR perhaps or I can revisit this PR next week to add that).

Up to you, we can leave it until next week open if you want to continue working on it, but I'm fine with merging as-is.

@ulugbekna ulugbekna requested a review from mnxn November 2, 2021 16:11
@ulugbekna
Copy link
Collaborator

ulugbekna commented Nov 2, 2021 via email

test/run_esy_tests.ml Outdated Show resolved Hide resolved
@rgrinberg
Copy link
Contributor

@patricoferris is this PR ready?

@patricoferris
Copy link
Author

Sorry for the delay doing some more testing locally first to debug https://github.com/ocamllabs/vscode-ocaml-platform/runs/4082355161?check_suite_focus=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants