This directory contains the code examples for JavaScript Testing Recipes. Everything you need to run the examples is here, including all third-party libraries. All the examples should run successfully out of the box.
The examples from the book are in the browser/
and node/
directories. Within
those directories, any file named test.html
can be opened in a web browser and
it will run the tests for that example. Similarly, any file named test.js
can
be run with Node.js.
You can also run any of the browser examples using PhantomJS, using this
command, replacing hello_world
with the name of the example you want to run:
$ phantomjs phantom.js browser/hello_world/test.html
The node_modules/
and vendor/
directories contain third-party libraries, and
package.json
contains project meatadata that's used to install all the
dependencies the examples rely on. You should not need to modify any of these
files.
You can use test-phantom.sh
to run all the browser tests using phantomjs.
You can use test-node.sh
to run all the node tests using nodejs.
You can change the test output format using FORMAT= variable (spec, xml, html, json etc)
FORMAT=spec ./test-node.sh
FORMAT=spec ./test-phantom.sh
You can run specific tests which match a string.
TEST=PatternMatcher ./test-node.sh # only runs it/describe suites with PatternMatcher in their descriptive string.
TEST=_only_ ./test-node.sh # simulate it.only or describe.only by adding _only_ to the test name
You can construct index.html
for running the tests in browser:
find browser/ -name '*.html' | sort | perl -pne '
BEGIN {print "<html>\n<head>\n<title>Browser Based Test Plans</title>\n<style>\nbody {\nbackground: black;\ncolor: yellow;\n}\n</style>\n</head>\n<body>\n<h4>Browser Based Test Plans</h4>\n<ul>\n"; }
END { print "</ul>\n</body>\n</html>\n"; }
chomp;
m{browser/(.+)/(.+)\.html}xms;
$name = $1;
$type = $2;
$type = ($type eq "test") ? "test suite": "$type page";
$_ = qq{<li><a href="$_">$name $type</a></li>\n}
' > index.html
- AsciiDoc text based document generation
- DocBook Project publish to HTML, pdf, or e-book formats
- Pygments syntax highlighter
- XSLT processor tool
- Apache Formatting Objects Processor
- PhantomJS Headless (WebKit) Browser
- NodeJS
- jstest async test API
- node Express app server
- node Request simple way to make http requests
- async module to simplify asynchronous javascript
- Stream Guide James Halliday
- Node Stream Splitter
- Node Websocket Stream Module
- Node Concatenate Stream
- Node Read and Write Stream
- Node Map Stream through async function
- Dominic Tarr many node stream modules author
- Node Stream Composition
- AngularJS Framework augmented HTML elements
- EmberJS Framework
- KnockoutJS MV-VM Framework
- Meteor App Framework
- Facebook React Framework
- Rendr run Backbone app on client or server
- Promises/A+ Specification
- jQuery jqXHR object
- XMLHttpRequest API reference
- sinon fakeServer API
- Socket.IO Library
- CoffeeScript
- Grunt Task Runner
- GNU Make command
- Browserify module packager
- UglifyJS code minimiser/beautifier
- Building JS projects with Make
- Jenkins self-hosted CI
- Travis open source hosted CI
- HtmlUnit GUI-less cross-browser simulator
- dead? EnvJS Pure Javascript browser
- dead? Harmony headless DOM+JS on ruby
- dying - TestSwarm jQuery's cross-browser testing
- inactive? - BusterJS cross-browser testing
- Karma cross-browser test runner
- TestEm cross-browser/node test runner
- ORM Object-Relational Mapping
- PBKDF2 Password Encryption
- Bcrypt Password Encryption
- Scrypt Password Encryption
- CSRF Cross Site Resource Forgery Protection
- Jade Template Lanuage
- Same Origin Policy for JavaScript
- WebKit Open Source Web Browser Engine
- Chromium Blink fork from WebKit
- Slimer JS - A JavaScript Scriptable (Gecko) Browser for Developers
- Gecko Open Source Web Browser Engine
- JSTest running with PhantomJS
- Scripting for PhantomJS and SlimerJS
- WebSocket Protocol (old, in phantomJS)
- WebSocket Protocol recent
- Selenium WebDriver
- Node API for WebDriver
- NightWatch Browser Automated Testign against WebDriver
- Testium Web Testing with PhantomJS or Selenium
- Fast Headless Full Stack testing in Node.js