Mocha Test JSON Schema is Valid

OK so it’s important to test your JavaScript applications especially in full-stack JS. I’ve touched on this subject before when I wanted to test if JSON was returned in a valid format. So let’s take this a bit further and look at how you can use Mocha to test your JSON Schema is valid (how …

Mocha Test Silence Log Output

When testing my server I have log output which I don’t want to appear when I run my tests using Mocha. I want to Silence Log Output!!! Ofcourse a solution is suggested by TJ! Let’s take a look… OK, so include this in your server.js file. // api middleware if (process.env.NODE_ENV !== ‘test’) {   …

Nodejs Mocha Test for Valid JSON

Mocha This is how you can use the Node.js test suite Mocha to Test for Valid JSON. This could come in handy when testing if API’s are returning valid JSON – essential part of your web application integration testing. Note: I’ve taken this testing concept further and added tests for JSON Schema as well. See …

How to completely Uninstall node.js on Ubuntu

For some reason or another you want to uninstall node.js. This can depend on how you installed node.js in the first place but here are a couple of methods which you can use to uninstall node.js complete from Ubuntu Linux. Uninstall node.js on Ubuntu – Method 1 Check where your node is installed. which node …

Top Tools to Test Node.js Code Online

Here are some online tools which you can use to test your Node.js web apps code online – pretty cool! 1. JSApp.US JsApp.US is a hosting platform for node.js applications. It is setup to be a platform to coddle to quick, weekend hack like projects. Know of any others? Please leave a comment!

Installing the latest version of node on Ubuntu Linux

Follow these simple steps to installing the latest version of Node.js on Ubuntu Linux. Check your current node version The following command should show you your current node.js version. node –version Install latest node version Run the following commands on your Ubuntu linux box to install node using a package manager. sudo apt-get update sudo …

Quickhand Version of loading Grunt NpmTasks

Going the long way! Why don’t you use this to load your grunt NpmTasks? require(‘matchdep’).filterDev(‘grunt-*’).forEach(grunt.loadNpmTasks); instead of grunt.loadNpmTasks(‘grunt-karma’); grunt.loadNpmTasks(‘grunt-contrib-uglify’); grunt.loadNpmTasks(‘grunt-contrib-watch’); grunt.loadNpmTasks(‘grunt-nodemon’); grunt.loadNpmTasks(‘grunt-concurrent’); grunt.loadNpmTasks(‘grunt-docular’); grunt.loadNpmTasks(‘grunt-ngmin’); grunt.loadNpmTasks(‘grunt-jasmine-node’); This will search the package.json file and automatically add those tasks to your grunt config. Very nice. How it works It uses npm matchdep to filter npm module dependencies by …

Node.js socket.io listen on same web port

Node.js code snippet to get socket.io (and socket.io client) listening on same web port as Express.js 3x. At time of writing (4 Dec 2013) Node.js socket.io version 1.0 has not yet been released. How to set it up To use with Socket.io version 0.9.16, express version 3.4.6 var io = require(’socket.io’)     , app …