| name | testing |
| description | Use when writing tests, debugging test failures, running the test suite, or setting up test infrastructure. Covers self-test, package tests, and modern E2E tests. |
Testing
Test patterns, commands, and utilities for the Meteor codebase.
Test Commands
./meteor self-test
./meteor self-test "test name"
./meteor self-test --list
./meteor self-test --exclude "^[a-b]"
./meteor self-test --retries 0
./meteor test-packages
./meteor test-packages mongo
TINYTEST_FILTER="collection" ./meteor test-packages
PUPPETEER_DOWNLOAD_PATH=~/.npm/chromium ./packages/test-in-console/run.sh
./packages/test-in-console/run.sh
./packages/test-in-console/run.sh "mongo"
npm run install:e2e
npm run test:e2e
npm run test:e2e -- -t="React"
npm run install:native
npm run test:native:android
npm run test:native:ios
E2E Tests (tools/e2e-tests/)
Jest + Playwright suite for verifying bundler integrations (rspack). Tests cover framework skeletons and build scenarios.
Test apps: apps/{react,vue,svelte,solid,blaze,typescript,babel,coffeescript,monorepo}
Native mobile smoke tests (tools/native-tests/)
Plain Node orchestrator + Maestro YAML flows. Builds a minimal Meteor app for
Cordova, installs it on an iOS Simulator or Android emulator, asserts the app
launches and DDP connects. Runs nightly in CI plus on PRs labeled mobile.
Local prerequisites: Maestro CLI (curl -fsSL https://get.maestro.mobile.dev | bash),
Xcode (iOS), Android SDK + emulator (Android).
Tests: flows/launch.yaml against apps/smoke/.
Test Helpers Package (packages/test-helpers)
Comprehensive testing utilities for Meteor applications.
Async Testing
import { testAsyncMulti, simplePoll, waitUntil } from 'meteor/test-helpers';
await waitUntil(() => someCondition, { timeout: 5000, interval: 100 });
simplePoll(() => isReady(), successCallback, failCallback);
DOM/UI Testing
import { clickElement, simulateEvent, canonicalizeHtml, renderToDiv } from 'meteor/test-helpers';
clickElement(button);
simulateEvent(input, 'keydown', { keyCode: 13 });
const normalized = canonicalizeHtml(html);
Connection Testing
import { makeTestConnection, captureConnectionMessages } from 'meteor/test-helpers';
const conn = makeTestConnection(clientId);
const messages = captureConnectionMessages(server);
Utilities
| Function | Description |
|---|
SeededRandom | Predictable random for deterministic tests |
try_all_permutations() | Test all permutations of inputs |
withCallbackLogger() | Track callback invocations |
mockBehaviours() | Behavior mocking |
Tinytest (packages/tinytest)
Meteor's built-in test framework.
Tinytest.add('my test', function (test) {
test.equal(1 + 1, 2);
test.isTrue(true);
test.throws(function () { throw new Error(); });
});
Tinytest.addAsync('async test', async function (test) {
const result = await asyncOperation();
test.equal(result, expected);
});
Environment Variables
| Variable | Description |
|---|
TEST_METADATA | Test configuration JSON |
METEOR_TEST_PACKAGES | Packages to test |
Debug Commands
METEOR_DEBUG_BUILD=1 ./meteor run
METEOR_PROFILE=1 ./meteor build
./meteor reset && ./meteor run
TOOL_NODE_FLAGS="--inspect-brk" ./meteor
Writing Package Tests
In package.js:
Package.onTest(function(api) {
api.use(['tinytest', 'test-helpers', 'my-package']);
api.addFiles('my-package-tests.js');
});
In my-package-tests.js:
import { MyPackage } from 'meteor/my-package';
Tinytest.add('MyPackage - basic functionality', function (test) {
const result = MyPackage.doSomething();
test.equal(result, expected);
});