Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

How can I encapsulate modules I want to unit test in Meteor?

if in a meteor file you have

MyModule = {}

function cantSeeMe() {

MyModule.doesStuff =function() {


in a test you can access it ( and in other files in meteor )

   describe("Modules", function(){
      it("should be exposed", function(){        
MyModule.doesStuff, 'function');
      it("should not be exposed", function(){     

        chai.assert.equal(typeof cantSeeMe,

this is using mike:mocha

basically, global isn't a bad thing. In more traditional languages like java / C#, classes are globals the provide things to instantiate objects. In javascript, you need some object to be global that provides access to functions, or "classes". What you don't want to do, generally, is introduce functions or variables into the global namespace ( or window ) unless they have a good reason for being there.

Categories : Javascript

Related to : How can I encapsulate modules I want to unit test in Meteor?
Rebuild npm modules when deploying Meteor app
I just tried this from a clean checkout of a project that uses npm: Bundle your app to produce a tar.gz file in another directory. When you extract your tar.gz file you should have a directory called bundle. Your custom npm modules will be located in bundle/programs/server/npm/npm-container/node_modules/ To install fibers do: cd bundle/programs/server/ && npm install

Categories : Node Js
Name collision between modules imported within third party modules
Your problem is not just with the imports, but with the fact that you are running as a script. When you run a script, Python adds the directory containing the script to the front of sys.path, and this globally affects all subsequent imports. There is no way to customize anything if you are directly running a file that you don't want to modify. You can't do any sneaky sys.path manipu

Categories : Python
Bots preventing Meteor server from deploying on Digital Ocean with Meteor Up
This shouldn't stop your app from starting. While it is an error and known bug, it only shows up in the logs & does not crash or stop your Meteor app. Its a bit of a nuisance, these bots scan entire IP blocks for open proxies. They don't cause any harm besides the error in your logs.

Categories : Security
How do I create a local Meteor package, with scaffolding? (Meteor 0.9.x+)
You can do the following straight from your project directory: meteor create --package username:my-package-name Source:

Categories : Meteor
Meteor - How to find out if Meteor.user() can be used without raising an error?
On the server, Meteor.users can only be invoked within the context of a method. So it makes sense that it won't work in Meteor.startup. The warning message is, unfortunately, not very helpful. You have two options: try/catch You can modify your autoValue to catch the error if it's called from the wrong context: autoValue: function() { try { var name = Meteor.user(); retur

Categories : Javascript
Recently Add
Busy Indicator while page is loading
parent.document.getElementById and images path
Can not get bootstrap datetime picker to display properly
reading select box jquery issues
DC.JS Pie Chart + Select Deslect from external JavaScript function
Why would I ever need to cancelAnimationFrame()
Angular.ui alert doesn't close
HTML/JS How to position a rectangle relative to 'any' side of the parent canvas element
parse variable to xml
C# Dictionary equivalent in JavaScript
ExtJS Dashboard Panel Fit Panel Vertically
jQuery cross domain ajax call - Interpreted as script but transferred with MIME type text/xml
Reactjs map returns unexpected token }
Working with multiple pages in apache cordova and vs2013
Resize iframe to loaded content
Why 13596*0.1 is different than 13596/10?
AngularJS Validate all forms on application load
javascript open popup without menu/url/titlebar/scrollbar/anything
Can I use Razor syntax inside Javascript included in a ScriptBundle?
How to show a box for comment reply with id
parse name from user input when using jquery serialize
How to parse and load javascript object?
Marionette not navigating to the same url
Adding Google+ Sign in button to website
GRUNT - Install Grunt Packages?
how should I create the path of templateUrl property in Angular ui-router?
Update mysql database with jquery array using ajax
Run the same function on each item in a list / array
Get all ticks values (NVD3)
Button Click Event not Passing input String to MVC Controller Method
© Copyright 2017 Publishing Limited. All rights reserved.