Testing is essential when contributing to Meteor. This guide covers running existing tests and writing new ones.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/meteor/meteor/llms.txt
Use this file to discover all available pages before exploring further.
Test Your Local Copy
This ensures tests run against your development version, not the stable release.Package Tests (TinyTest)
Core Meteor packages use TinyTest for testing.Running All Package Tests
Run the full test suite:http://localhost:3000.
Console Output
To see results in the console instead of the browser:Running Specific Package Tests
Test a specific package by name or path:Filtering Individual Tests
UseTINYTEST_FILTER to run specific tests (supports regex):
test-in-console:
Meteor Tool Self-Tests
The Meteor tool (CLI) uses a custom “self-test” system that can’t use TinyTest. These are end-to-end tests for CLI interactions.Running All Self-Tests
The timeout scale factor depends on your hardware. 3 is a safe choice for automation, but you may need to adjust based on your machine’s speed.
Listing Available Tests
See all available self-tests:Running Specific Tests
Use regex patterns to match test names:Excluding Tests
Exclude specific tests using regex:Avoiding Retries
On CI, tests retry to avoid false failures. In development, disable retries:More Self-Test Options
For complete self-test documentation, see the Meteor Tool README.Writing Tests
When submitting pull requests, include tests that prove your code works.Package Tests Example
For a package inpackages/tracker/, create tests in the Package.onTest section:
tracker_tests.js
package.js:
package.js
TinyTest Assertions
Common TinyTest assertions:Self-Test Example
Self-tests are written differently. See thetool-testing directory for examples.
Basic structure:
Test Best Practices
Coverage
- Test both success and failure cases
- Test edge cases and boundary conditions
- Test client and server code separately where applicable
Clarity
- Use descriptive test names
- Include helpful assertion messages
- Keep tests focused on one behavior
Reliability
- Avoid timing dependencies where possible
- Clean up after tests (close connections, remove data)
- Don’t depend on test execution order
Performance
- Keep tests fast
- Use
testOnly: truefor internal exports needed only for testing - Mock external dependencies
Debugging Tests
Package Tests
Debug TinyTest in the browser:- Run
./meteor test-packages - Open
http://localhost:3000in Chrome - Open DevTools and set breakpoints
- Refresh to re-run tests
Self-Tests
Debug self-tests with Node inspector:chrome://inspect in Chrome.
Debug Test Apps
When self-tests spawn test apps, debug them with:Continuous Integration Tests
CI tests are defined in:circle.yml- CircleCI configurationscripts/ci.sh- Test execution script
Slow Tests
Some tests are too slow for regular CI and are in theslow designator:
Platform-Specific Testing
Windows
If you encounter Windows-specific test failures, please document them and consider submitting fixes.Next Steps
Contributing Packages
Learn how to create and publish packages
Development Setup
Review development environment setup