Coder Social home page Coder Social logo

amd-testing's Introduction

AMD Testing

purpose

Demonstrate how to test async modules (AMD) both in the browser and in NodeJS. RequireJS is the AMD loader, and several testing frameworks will be evaluated. The goal is to find the very best test frameworks for testing AMD modules in both environments.

Mocha

Mocha is working in the browser. Mocha doesn't come with an assertion library, so I'm using the excellent chai.js.

Browser Testing

Open mocha/runner.html in your browser

Jasmine

Jasmine is working.

Browser Testing

Open jasmine/SpecRunner.html in your browser

Node Testing

node runner.js

Make sure you've installed the RequireJS npm package. This allows you to use your AMD modules in Node. NOTE: there are a couple of ways to run Jasmine in Node: 1. use the regular standalone jasmine.js file or 2. use the 3rd party jasmine-node command-line tool. I was not able to get it working with the command-line tool, because it searches for all tests in a specified folder and runs them, and our tests themselves are AMD modules. If jasmine-node could run programmatically this would be no problem, but it doesn't. I did however get the regular jasmine.js to work, creating my own runner.js file. It sets up the global jasmine variables and the RequireJS stuff. Just run node runner.js.

amd-testing's People

Contributors

geddski avatar davemo avatar bryant1410 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.