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

[Important] Made "fake-xml-http-request" universal for deno, node.js & browser #71

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

izelnakri
Copy link

@izelnakri izelnakri commented Jul 30, 2023

Hi @xg-wang ,

Few days ago I've released QUnitX, a universal test runner for JavaScript runtimes. This is a showcase of this test library/framework in action. QUnitX utilizes the default test runner of node.js and deno while having 0 dependencies, it leverages the new conditional import/export feature of node.js.

I was able to rewrite the test suite and implementation while making 0 changes to the actual implementation of the original file. I've divided changes into separate commits so I suggest going over the changes commit-by-commit.

Changes:

  • Made "fake-xml-http-request" npm type "module", as it should be.
  • Add node.js & deno specific shims so the package can be run universally, this does introduce minimal(0-dep) @xmldom/xmldom npm package that is only imported as a dependency on deno & node.js imports for the DOMParser/XMLParser since these runtimes don't have it. In other words this dependency is not included in the distributed file when bundled by browser bundlers like esbuild, when target isn't node or deno.
  • Refactored tests to use qunitx instead of qunit, you'll see changes here are mainly cosmetic. I've used deno formatter to format these files.
  • Removed legacy files like bower, umd distribution, karma test runner, travis CI config file etc.

I could implement a dockerized CI for this, but then I would need to add secrets to be able to deploy them to some registry & re-use containers during CI builds, so instead I've set up a very fast/cached nix based deterministic CI using github actions. CI builds could be near-instant had magic-nix-cache-action cached dependencies on https://cache.nixos.org . You can also run the tests locally, please have a look at changes and let me know what you think, cheers!

@izelnakri izelnakri changed the title [Important] Make "fake-xml-http-request" universal [Important] Made "fake-xml-http-request" universal Jul 30, 2023
@izelnakri izelnakri changed the title [Important] Made "fake-xml-http-request" universal [Important] Made "fake-xml-http-request" universal for deno, node.js & browser Jul 30, 2023
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.

1 participant