Skip to content

sxlfzhy/Narma

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Narma

Narma allows you to unit test NodeJS and all it's node_modules with Karma and Jasmine (or what have you)

Node runs natively in NW.JS and I kinda like Karma (and Jasmine). So I thought to write a script launcher and unit test my node code in a nodewebkit browser.

To install:

  npm install
  npm install -g nodewebkit

install the cli globally

  npm install -g karma-cli

To run, you must change the path to the launcher script in karam.conf.js

Use bat launcher for windows

Use bash launcher for all the rest

Make sure you use an absolute path and front slashes on windows too.

and then run:

  karma start

Checkout test/test.js and app/weserver.js to see exapmles of what you can do.

You can start a web server, read from the file system and use jQuery, inside a Jasmine suite

describe('somthing to test',function(){
   it('should be ok',function(done){
      var http = require('http');
      var server = http.createServer(function(req,res){
      });
 
      var fs = require('fs');
      fs.writeFile(file,data,function(err,data){
      });

      $.get(url,function(data){
      });
      
      done();
   });
});

About

Unit test NodeJS with Karma, Jasmine and NW.JS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 73.6%
  • Batchfile 19.7%
  • Shell 6.7%