This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This looks like a lot of changes, but most of it is just update requires. I decided to avoid using the special "devtools" module path. The reason is that there's no good way in node to add this alias, so it makes it much harder when running tests under node. This, combined with using the babel compiler directly from the mocha option, allows us to remove webpack entirely from the testing process.
Removing webpack speeds up tests 10x (don't ask for me to backup that number). It's a whole lot faster. If we ever move files from gecko-dev to here, we'll have to update the requires. But that's extremely straight-forward, so it's not a big deal. It happens rarely anyway.
There's a lot less magic this way.
There is still some weirdness: the ff-devtools-libs essentially depends on itself. All the requires inside it assume that
ff-devtools-libs
is a top-level modules so all requires are of the formff-devtools-libs/util/foo.js
. This is very against the normal node pattern. However, it's pretty simple to solve: install the module normally, and anything that runs the code needs to setNODE_PATH
tonode_modules
so that the magical top-levelff-devtools-libs
name will be resolved anywhere. You can see this inwebpack.config.js
too: we point a root tonode_modules
so it'll resolve. Running tests undernpm test
automatically set theNODE_PATH
to node_modules so it magically works when running under npm scripts, so you shouldn't have to think about it unless working on the build/testing system.Now there are two commands for running mocha:
npm test
- runs all the tests (note: I think the path selector I used only works under zsh, that might be a problem?)npm run test-paths <path>...
- runs tests found at the specified paths (can be directories or single files)I'm sure there are things to discuss here, we'll talk about it tomorrow.