-
Notifications
You must be signed in to change notification settings - Fork 168
docs: improve testing instructions in README (closes #357) #481
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
Open
nicolv
wants to merge
1
commit into
meteor:master
Choose a base branch
from
nicolv:doc/improve-testing-instructions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,18 +2,76 @@ | |
|
|
||
| Meteor packages for a great React developer experience | ||
|
|
||
| ### Linting | ||
| [](http://www.repostatus.org/#wip) | ||
|
|
||
| Run | ||
| ## Linting | ||
|
|
||
| Run | ||
| ``` | ||
| npm run lint | ||
| ``` | ||
|
|
||
| Note this does not yet all lint. Working on it. | ||
| Note: this does not yet lint all files. Working on it. | ||
|
|
||
| ## Testing | ||
|
|
||
| Meteor packages in this repo (e.g., `react-runtime`, `react-meteor-data`) have **peer dependencies** installed via NPM (see each package's `package.json`). | ||
|
|
||
| Due to how Meteor handles peer dependencies, **you cannot run `meteor test-packages` directly from this repo**. Instead, tests are run inside **test harness apps** located in the `tests/` directory. | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Meteor >= 3.1.2 | ||
| - Node >= 18 (v18 recommended for Meteor 3.x) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be at least 22 for the current version of Meteor. |
||
| - If you're on Apple Silicon (M1/M2/M3), you may need to run Meteor CLI under Rosetta: `arch -x86_64 meteor` | ||
|
|
||
| ### Test Harnesses | ||
|
|
||
| | Harness app | Tests | | ||
| |---|---| | ||
| | `tests/react-meteor-data-harness/` | `react-meteor-data` package | | ||
| | `tests/react-meteor-accounts-harness/` | `react-meteor-accounts` package | | ||
|
|
||
| ### Running Tests Locally (Browser Mode) | ||
|
|
||
| 1. Open a terminal and `cd` into the harness app directory: | ||
| ```bash | ||
| # Example for react-meteor-data: | ||
| cd tests/react-meteor-data-harness | ||
| meteor npm install | ||
| METEOR_PACKAGE_DIRS=../../packages meteor run | ||
| ``` | ||
|
|
||
| 2. In a new terminal window, run the tests: | ||
| ```bash | ||
| cd tests/react-meteor-data-harness | ||
| METEOR_PACKAGE_DIRS=../../packages meteor test-packages --driver-package meteortesting:mocha ./packages/react-meteor-data | ||
| ``` | ||
|
|
||
| 3. Open your browser and visit `http://localhost:3000` to see the test results. | ||
|
|
||
| > **Tip:** The `METEOR_PACKAGE_DIRS=../../packages` environment variable tells Meteor to load the local package source (from this repo's `packages/` directory) instead of the published version. | ||
|
|
||
| ### Running Tests in CI / Headless Mode | ||
|
|
||
| This repo uses [`@zodern/mtest`](https://github.com/zodern/mtest) for headless testing in CI. | ||
|
|
||
| To run all package tests headlessly (same as CI): | ||
|
|
||
| ```bash | ||
| npx @zodern/mtest | ||
| ``` | ||
|
|
||
| To run tests for a specific package only: | ||
|
|
||
| ```bash | ||
| npx @zodern/mtest --package ./packages/react-meteor-data | ||
| ``` | ||
|
|
||
| ### Testing | ||
| See `.github/workflows/test-react-packages.yml` for the full CI configuration. | ||
|
|
||
| Due to difficulties in testing packages with "peer" NPM dependencies, we've worked around by moving package tests into harness test apps. You can find them in `tests/`. | ||
| ### Common Issues | ||
|
|
||
| To run tests for a Meteor react package, navigate to its `tests/*` app and execute `npm test`. | ||
| - **`Cannot find module 'react'`**: Make sure you ran `meteor npm install` inside the harness app directory first. React is a peer dependency and must be installed via NPM. | ||
| - **Tests hang / M1/M2 Mac**: Try running Meteor under Rosetta: `arch -x86_64 meteor test-packages ...` | ||
| - **`@zodern/mtest` not found**: Run `npx @zodern/mtest` from the repo root. If it still fails, check that Node >= 18 is installed. | ||
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.
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.
Repo status should be active