How do you run the meteor tests? - meteor

I made some changes to livedata and would like to run the livedata_test. How do you use tinytest to run the livedata_test?

After doing some digging, I've figured out that you may run meteor from the packages directory of your cloned meteor source.
Source: SFJS #23: Functional Programming and Meteor.js (this is actually a fantastic video in general).
Switch to ... /meteor/packages/
Run meteor
Navigate to http://0.0.0.0:3000/ in the browser.
Tests for individual packages may be run by navigating to the specific package directory and following steps 2 and 3 above.
Presto:

Might be worth nothing that you need to make sure you are running the dev "meteor" script from your working git directory. Simply running meteor will default to the system meteor in your path (if you have meteor installed) and will not pick up any changes to the tests / core code that you make.

Run meteor test-packages, then point your browser at http://localhost:3000 .

Run meteor from in the directory of the package you want to test and view results in browser.

Velocity had been selected as the official testing framework for meteor 1.0. The announcement has been made in the last meteor devshop (june 2014).
Packages developed with velocity:
velocity (the test runner)
jasmine-unit (jasmine syntax)
mocha-web-velocity (for testing collections)
velocity-html-reporter (view the tests in the browser)

git clone git://github.com/meteor/meteor.git
cd meteor
./meteor test-packages <package>
Then navigate to http://localhost:3000/.

You have to pass it a driver package. This is how I ran them:
meteor test --driver-package practicalmeteor:mocha
Then check out the app and you should see a UI with the test results.

Related

Meteor version is different in local folder from global version

I git clone a package from github and checked the version inside that folder:
>meteor --version
Extracting meteor-tool#1.4.2_7... (forever running)
Then I go outside of that folder:
>meteor --version
Meteor 1.4.3.1
How can I run the global version inside a meteor project folder?
It is because that meteor project you checked out from github is targeting 1.4.2_7. Everytime you create a new meteor project, it saves the version that you used to create it (in a file inside the .meteor folder) so that if the api changes in new future versions, your project will still run (since it targets a specific version in time).
Because of this, when you go to run the project later, it will always use the targeted version (the version used to create the project.). If that version is not on your system, then it will download and install it first before running the app. This is what you have observed. It is downloading that certain version and it can take a very long time to do this depending in your connection speed (it often takes 15 - 25 minutes to do this on my machine at home.
One note, the project's meteor version can be changed by calling meteor update

how do I install a previous version of meteor JS?

I'm trying to host a meteor app that uses an old version of meteor.
Every time i try to start the app it will get somewhat through the process of installing the tool, and then i see a message such as:
Killednloading meteor-tool#1.1.3... -
(note how killed somehow overwrites the downloading part of the command line)
Is there a reliable way to install the meteor tool at a specific version?
EDIT:
The Meteor team added a release parameter to their download endpoint. Now you can simply specify the desired version:
curl "https://install.meteor.com/?release=1.3.3.1" | sh
For Windows, a version parameter exists for the choco installer:
choco install meteor --version 1.3.3.1
Original solution
You can use sed for that. Insert it in the middle of curl and sh:
curl https://install.meteor.com/ | sed 's/1.4/1.3.3.1/' | sh
That will replace the release 1.4 (current version) to 1.3.3.1
When you create a meteor app you can specify a release:
meteor create test --release x.y.z
And when you update a meteor app you can do the same:
meteor update --release x.y.z
#Jorge Issa's answer is good if you are installing Meteor from scratch, on a system that never had Meteor installed, however it's subject to change since versions change all the time, so you need to adapt the sed line.
If you have any version of Meteor already installed, as Michel Floyd mentioned, you can always create a project with a specific version by adding the --release flag.
meteor update --release xxxx works fine with you're actually upgrading, but downgrading is a different story.
My recommendation when it comes to upgrading and eventually downgrading, is to use version control (git).
Attempt upgrade and if all is fine, you're in good shape, if not and you want to downgrade, simply clear the file changes in your version control system and use meteor reset to clean your project and rebuild with the previous version.
!Note! meteor reset clears the local mongo database too, so be sure to back that up first if you're going to do that (check mongodump and mongorestore for that)
finally, if you're looking to clean up the clutter from the .meteor folder, you can delete the folder and then run meteor reset in your project: the meteor executable will detect you don't have the needed packages will re-download the packages for the version needed by your project. (This takes a while and if you have many project, can be cumbersome as you need to do this in each project, but if like me you are looking to clear some space, this works fine.)
Try:
meteor update --release x.y.z
Try
choco install meteor --x86 --params="'/RELEASE:1.5.4.4'"

Meteor: How to bypass update/upgrade

Is there a way to bypass the auto update feature of Meteor?
I'm stuck with
Downloading meteor-tool#1.3.0_3... \
When I try to run existing project, or create a new one or simply run "meteor list",..It starts updating, downloads meteor-tool#1.3.0_3... which completes 100% and then countdown vanishes & it remains like that with the spindle rotating.
I tried waiting like mentioned at this link
However, nothing happens even after an hour.
I've same error. I resolve by following steps, please try
Download meteor installation from https://github.com/meteor/meteor/wiki/Meteor-on-Windows:-Alternate-installation
Extract zip & Copy all tool from .meteor/packages/meteor-tool directory
Go To %AppData%/../Local/.meteor/packages/meteor-tool or C:\Users\<your_user_name>\AppData\Local\.meteor\packages\meteor-tool
Paste inside folder (Note: If you can't copy or gives error of long path, use RoboCopy)
Now, you can create new Meteor app.
Go to project > .meteor > release
Change the meteor version to the current one that is installed on your system.
Consider my scenario:
1) System have the Meteor version 1.4.3.1 installed
2) Downloaded the todos(meteor project), developed on version 1.4.2.1
3) On running it gives similar problem
4) Changed the release version to 1.4.3.1
5) Run with command 'meteor'
Considering latest Meteor 1.6 you can use below commands for your best needs
meteor create . --release 1.5 --full to create a scaffolded app.
meteor create . --release 1.5 --bare to create an empty app.
NOTE: Instead of --release 1.5 you could use your version which actually exists.

Can I undo updating Meteor?

I think updating Meteor might have broken my app. It was working, then I ran meteor update, and now it is not working. Can I do something like meteor downgrade?
Meteor 0.6.0 and above ships with a new distribution system. You can now pass the --release argument to any Meteor command and it will run against the requested release. For example, to bundle your app against Meteor 0.6.1, run: meteor bundle --release 0.6.1. Notably, this only works for post-0.6.0 releases.
If you want to pin your app to a specific release, run: meteor update --release <release>. This modifies the .meteor/release file in your app directory. Then simply run Meteor as usual. You'll still get notified when there's a new release available.
UPDATE: As of Meteor 0.6.0, this functionality is available without using Meteorite. See Avital's answer. (for versions > 0.6.0. To use functionality on versions less than 0.6.0 you can still use Meteorite:
If you want to control versions with your apps (so your existing app can still use an older version, or 0.57.1 (with the security bug fix) you can use meteorite: https://github.com/oortcloud/meteorite
Install it via npm install -g meteorite
Its also helpful with loads of other packages from http://atmosphere.meteor.com.
To control the version of your app edit your smart.json to something with:
{
"meteor": {
"tag": "v0.5.7"
}
}
Only the app you've already made will be affected & you can upgrade it when you're ready.
I have tried this and it is very hard. My best advice is to try and copy all the files from an app running the version you want, then paste your app's code in there.
There is no meteor downgrade command from its CLI. The best and easy way if you have version control like GIT, just undo your recent changes by git stash save, and run meteor again.
On Windows, I was able to effectively "downgrade" from a failed upgrade by editing the version number to a previous working release in the file:
C:\Users\Paul\AppData\Local.meteor\meteor.bat
You need to change it to a version which has a corresponding folder in: .meteor\packages\meteor-tool

Can I run Meteor from two paths?

How do I clone and run auth branch with my app, installed at [SRH/meteor/myapp], in addition to having master meteor installed in [usr/local/meteor]?
After having cloned the auth branch, when I attempt to add a package to my app (via meteor add accounts-ui), an error states the package is not available. Clearly, it is looking for the package at: [usr/local/meteor], while I am attempting to run meteor from [SRH/meteor].
Is it OK to have meteor installed at two locations? Obviously, I am confused.
More specifically, how do I clone the auth branch directly to [usr/local] location? Note: I am a newbie to git cloning. Took me a long time to find a tip on how to clone a branch, using:
git clone -b auth git://github.com/meteor/meteor.git
Thanks!
You can do one of two things.
Clone the auth branch to a location (as you have described) and then run meteor via
../../path/to/cloned/auth/branch/meteor run
Use meteorite which was basically created to do this for you.

Resources