Skip to main content
Testing is essential when contributing to Meteor. This guide covers running existing tests and writing new ones.

Test Your Local Copy

Always run tests against your checked-out copy of Meteor, not the globally-installed version. Use ./meteor or your alias, not just meteor.
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:
This starts a Meteor app with TinyTest. View results at http://localhost:3000.

Console Output

To see results in the console instead of the browser:
PUPPETEER_DOWNLOAD_PATH is optional but useful to skip downloading Chromium on every run.
This is how tests run on CI (Travis/CircleCI).

Running Specific Package Tests

Test a specific package by name or path:

Filtering Individual Tests

Use TINYTEST_FILTER to run specific tests (supports regex):
You can also use filters with 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 in packages/tracker/, create tests in the Package.onTest section:
tracker_tests.js
Then add it to package.js:
package.js

TinyTest Assertions

Common TinyTest assertions:

Self-Test Example

Self-tests are written differently. See the tool-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: true for internal exports needed only for testing
  • Mock external dependencies

Debugging Tests

Package Tests

Debug TinyTest in the browser:
  1. Run ./meteor test-packages
  2. Open http://localhost:3000 in Chrome
  3. Open DevTools and set breakpoints
  4. Refresh to re-run tests

Self-Tests

Debug self-tests with Node inspector:
Then open chrome://inspect in Chrome.

Debug Test Apps

When self-tests spawn test apps, debug them with:
Use a different port (e.g., 5859) to avoid conflicts with the main tool debugger on port 5858.

Continuous Integration Tests

CI tests are defined in: You can run the same tests locally:

Slow Tests

Some tests are too slow for regular CI and are in the slow designator:

Platform-Specific Testing

Windows

There’s no Windows CI currently. Not all tests work on Windows. Contributions to improve Windows compatibility are welcome!
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