Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting tons of errors when running tests on Templates. #137

Open
serviewcare opened this issue Feb 14, 2014 · 5 comments
Open

Getting tons of errors when running tests on Templates. #137

serviewcare opened this issue Feb 14, 2014 · 5 comments

Comments

@serviewcare
Copy link

So, I'm trying to run rtd on my system for the first time. For some reason I'm getting a load of errors on my Templates:

TypeError: 'undefined' is not an object (evaluating 'Template.cr_notification_area')
at /home/jthomas/git-projects/app/client/care_recipient_client/cr_notification_area.js:6

Every single one of them is on line 6 for every template file, and seem to show up at random for all of my templates.

If I evaluate the same templates from JS console, they return HTML, and work just fine in my application.

@AdrienLemaire
Copy link
Contributor

You need to stub your templates. You are running unit tests, you do not want to load meteor for every single test.

Template.stub('cr_notification_area')

@PSzu
Copy link

PSzu commented Feb 20, 2014

You may consider trying out my oneliner:

grep -r --include *.html "<template name=" app/ | awk -F"<template name=" '{ print $2 }' | cut -d">" -f1 | xargs -I template echo "Template.stub(\""template"\");"

This will generate all template stubs and display them on console:

/scratch/rtd-laika-meteor-boilerplate$ grep -r --include *.html "<template name=" app/ | awk -F"<template name=" '{ print $2 }' | cut -d">" -f1 | xargs -I template echo "Template.stub(\""template"\");"

Template.stub("searchbar");
Template.stub("header");
Template.stub("footer");
Template.stub("notFound");
Template.stub("home");
Template.stub("basicLayout");
Template.stub("slimLayout");

I have an alias in bashrc for that.

@samhatoum
Copy link
Member

Interesting, this should probably just happen automagically. I'll look at adding this in. Thanks!

@samhatoum
Copy link
Member

A pull request is always welcome of course :)

@PSzu
Copy link

PSzu commented Feb 20, 2014

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants