Screencast on Migrating from Meteor 1.2 to 1.3 with Tests

Hoping to record the first part tonight or tomorrow and the 2nd part right after Christmas (it seems like the beta is stable enough to migrate now). Soon :smile:

1 Like

This is only true for package testing btw, for app testing, Iā€™m not sure exactly how theyā€™re going to do it yet.

Dou you mean module unit testing? With 1.3 I hope I can unit-test using modules instead of packagesā€¦

I mean that practicalmeteor:mocha is a package testing solution only (as things currently stand). It does not work for app-testing. The new changes from the MDG will replace Velocityā€™s ā€œmirrorsā€ with an app-testing mode.

Once this app testing mode is ready, it will allow for tools like the current mike:mocha or sanjo:jasmine to be ported over from Velocity. Iā€™m not sure if the MDG will actually do something here or not, thatā€™s not too clear to me yet.

As for unit testing, with 1.3 modules you no longer need to load the entire Meteor context. Thereā€™s already an example to do that here:

2 Likes

So looking forward to this! I havenā€™t been doing any testing :unamused: and need @SkinnyGeek1010 to whip me into shape.

Only the sanjo:jasmine client unit mode is using Karma. The client intergration mode of sanjo:jasmine and mike:mocha is using a hidden iframe that is injected into the app. In Ci mode it is using PhantomJS.

1 Like

Hello, Are you still working on this.

1 Like

Yep! I did a ā€˜first draftā€™ of the part-1 Thursday but ran into issues using the plain webdriver syntax. Iā€™m going to re-record it today using a set of helpers iā€™ve made that really help out on the race conditions and ā€˜why isnā€™t this workingā€™ moments.

For example, iā€™ll use: fillInput('First Name', 'Adam') instead of using 3 or 4 lines of webdriver code (using things like waitFor a selector).

I wanted to try and not use my opinionated helpers but the 15min video turned into an hour with a ton of work trying to edit out the bad parts. The lib will be uploaded here: https://github.com/AdamBrodzinski/capy-js

You should definitely have a look at the set of UI helpers I developed along with Gagarin, e.g.

2 Likes

The Gagarin UI helpers are very good. Iā€™m torn between which would be the better pathā€¦ extending them so they match the Nightwatch UI helpers; or figure out how to require and add the Nightwatch helpers into Gagarin.

1 Like

I am currently in an porcess of refactoring different parts of Gagarin. I hope that after that it will be much easier to integrate with other testing libraries. In particular, you should be able to easily exchange & hook new helpers in both ways.

Just wanted to pop in and say I havenā€™t forgotten about this. I had a Node service start acting flakey and had to re-write it in my free time over the past couple weeks.

Being that 1.3 isnā€™t prod ready yet I wasnā€™t in too big of a hurry. Should be able to tackle this next week :thumbsup:

7 Likes

@SkinnyGeek1010 looking forward watching these! :smile:

1 Like

I promise iā€™m making these soon :laughing: I think Meteor 1.3 has settled down for the most partā€¦ mainly now there are not globals. I also have to catch up on the changes so farā€¦ I think there are no longer globals? so migrating might be more of a pain that originally planned :frowning:

These wonā€™t happen until the first week of Feb at the earliestā€¦ have to leave on a business trip and wonā€™t be back until then. I donā€™t see 1.3 coming out before then so we should be ok :laughing:

3 Likes

Keep on rolling! :smile:

Do they have an ETA on 1.3 or youā€™re just guessing from the current beta?

just guessing based on the beta github issues and no release candidate yet.

Iā€™m very keen to see what you come up with here @SkinnyGeek1010.

Iā€™ve been working on an app in 1.2 with react and am a little concerned that I didnā€™t start with the 1.3 betaā€¦ not sure what will break when I update to 1.3. not sure how much I will need to change or what will be impacted by the upgrade.

1 Like

Sashko said in the latest weekly podcast that Meteor 1.3 will be backwards compatible with Meteor 1.2. So you can upgrade without making any changes to your app code. After that you can migrate to ES2015 modules if you want. This is also something you can do piece by piece. So no worries.

3 Likes

@cstrat I recently upgraded from 1.1 to 1.3 beta4 and it was very painless. You donā€™t have to import any Meteor modules and all of your code should load up as is. You can leave globals as is and can migrate them as you have time.

I was able to convert the browserify.js file that exposed globals to the 1.3 NPM imports and then for the most part everything stays the same. I had to remove the react package and import react from NPM, and exposed that globally as well. (as well as add the meteor data package back in)

In the future (in my app) iā€™ll work on converting a file from global to imports as I work on it (and also can test it easier). Thereā€™s no real reason to stop everything and import one file at a time.

For the tutorial app it should be a 3 min fix to switch browserify to npm imports and a working app. The rest would be just making it as good as possible (imports, etcā€¦).

At any rate very little will need to be changed. Itā€™s more less a little re-wiring to migrate browserify.

1 Like

Thatā€™s interesting.
Weā€™ve tried today to upgrade our app to 1.3-modules-beta.5 and when trying to run meteor we keep getting errors like:

ReferenceError: later is not defined

related to code that declares some global variables like:
later = function() { }

Any ideas whether this will eventually be backward compatible as well? We know this is not a good style but we have quite a bit of legacy code, and packages, that do declare variables like thisā€¦

Or should we prepare for a big rewrite to get rid of all globals?

Edited:

Ok, I played around with this a bit more and looks like there are more problems (I needed to install packages like jquery or moment through npm, third part libraries that we have in our client/thirdparty folder have problems like:
ā€œCannot set property ā€˜Chosenā€™ of undefinedā€ on a line that looks like:

" this.Chosen = (function(_super) {"

And I suspect there will be many more fixes to do. This is a huge production app (thousands of users at a time) that weā€™ve started in late 2012 learning on the way, switching from spark to blaze, etc. there is obviously quite a bit of code that could use some refactoring, but it works :slight_smile:

So, Iā€™m guessing, ā€œbackward compabilitiyā€ in this case means, ā€œbackward compatible as long as you have a proper es2015 compatible codeā€?