Meteor Tracker is a dependency tracking system from Meteor. Together with Meteor ReactiveVar, it makes it easy to rerun code when dependencies change.
This NPM package @edemaine/meteor-tracker
offers a drop-in replacement for
the meteor/tracker
and meteor/reactive-var
modules available in
Meteor with the tracker
and
reactive-var
packages,
so that it can be used in other JavaScript projects,
in particular for testing NPM packages that are intended for Meteor
but testing from outside Meteor (e.g. via Jest).
The code consists of a few one-line changes to Meteor's source code
(see CHANGE FOR NPM
in the code),
to make the Node module imports and exports match those in Meteor.
For a more complete set of Meteor ports, check out Blast on NPM.
The intent is to track the latest version of Meteor Tracker. If the latter changes, please open an issue to update this package.
NPM version | Meteor versions |
---|---|
1.0.x | tracker 1.2.0 |
1.1.x | tracker 1.2.0, reactive-var 1.0.11 |
To install:
npm install meteor-tracker
In your JavaScript code, you can use:
import {Tracker} from '@edemaine/meteor-tracker';
import {ReactiveVar} from '@edemaine/meteor-tracker';
To install:
npm install --save-dev meteor-tracker
To use this module for testing in Jest as a substitute for meteor/tracker
,
add the following to your Jest configuration:
moduleNameMapper: {
'^meteor/tracker$': '@edemaine/meteor-tracker',
'^meteor/reactive-var$': '@edemaine/meteor-tracker',
},