-
Notifications
You must be signed in to change notification settings - Fork 341
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
feat: export the adb utilities to be used in third party nodejs scripts #2116
Conversation
@rpl Am I seem to be on the correct path here? Also I do have some doubts related to your recent comment
export type adbParam{|
adbBin?: string
|} but with this I was having to call the function with an empty object something like:
Shouldn't this function also take a deviceId of which GeckoView packages we may like to see? |
@rpl Just a friendly reminder for the comment above. Looking to get some insight :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the comments below (the main one is about making sure to load the adb module as lazily as possible), we may also start to think to the testing coverage.
You may take a look to the test that is already covering importing web-ext as a library:
- tests/functional/test.lib.imports.js
- tests/fixtures/require-as-cjs/test-require.js
- tests/fixtures/import-as-esm/test-import.mjs
As usually, feel free to ask me more questions once you have some questions or doubts about what to test and what strategy to use.
@rpl I have added some basic tests to check if functions are being exposed correctly. How are tests looking so far? Few questions:
Thank you!... |
@ankushduacodes Yeah, this sounds like a good idea, we could just add an helper function in a separate module file and load it in both to avoid repeating the same assertion in both the test files.
I think that one possible way to explicitly test that the adb module is lazily loaded may be to use the You may try it interactively by running
Using this strategy we may do inside the test helper that you are going to create (the one that will be used by both test-import.mjs and test-require.js) something like the following right after requiring/importing 'web-ext':
This last assertion will also make us sure that if we will ever change the dependency the test will fail and that will remind us to update the test with the new dependency (it will be basically a safety net to be sure that the test doesn't turn itself into an "always passing even if broken" kind of test without being noticed ;-)). Let me know if this pointers were helpful or if you have any further doubts or questions. |
Codecov Report
@@ Coverage Diff @@
## master #2116 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 32 32
Lines 1567 1573 +6
=========================================
+ Hits 1567 1573 +6
Continue to review full report at Codecov.
|
@rpl I have a doubt about imports:
It gave me an error and the test of importing web-ext as ESM module failed
the test passes. Why is that so? Edit: I did some reading on it. So to my understanding first import statement fails because it looks for |
@rpl I was looking into implementing an interactive node repl to execute above commands and the check for then assert for the statements above. I did look into spawning a child process and processing the data something like following:
But the issue I am facing, in this case, is that event is triggered every time new data is sent to stdout even if it consists of I hope I am making some sense here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ankushduacodes follows a new round of review comments (you may also remove the Draft from this PR, it is on the right track, and also actively developed and reviewed) with some more details about how to cover with the functional test the expected lazy loading behavior of the 'adb.js' module (plus some other nits and a comment related to some more test coverage needed in this pull request).
Let me know how it goes (and if you have any further doubts or questions).
On it. Thank you. (PS: If there is anything left, do let me know. I don't delete branches until after a PR is merged. :)) |
Thanks @ankushduacodes for handling the last few nits as well, I just merged this on the main branch! 🚀 \o/ |
Thank you @rpl for the guidance along the way and patiently explaining my (sometimes silly) doubts. I am learning so much. Many more to go. |
attempts to resolve #1999