Support running tests in the browser, Node, or both #30
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.
Currently, the monorepo only supports building and running tests for the browser. However, we're on the verge of introducing some new build tools that only run in Node.js environments. We also need to get more of the packages running in Node to support SSR use cases.
The recent refactor to build tests with Rollup makes testing in Node a relatively incremental step. In this PR, the tests are compiled and run against the CommonJS build of the packages.
To facilitate easily writing packages that work in both environments, there is a convention for organizing tests according to the environment they should be run in:
test/node/**/*-test.ts
run only in Node.test/browser/**/*-test.ts
run only in the browser.test/**/*-test.ts
runs in both environments.To start off I moved most tests into the
browser
directory because they fail in Node, but many of these are due to accidental coupling to the DOM and we can migrate them piecemeal to run in both as we work on the public SSR API.