├── .gitignore ├── nodeunit ├── node_modules │ ├── .bin │ │ ├── r.js │ │ └── nodeunit │ ├── requirejs │ │ ├── .npmignore │ │ └── package.json │ └── nodeunit │ │ ├── test │ │ ├── fixtures │ │ │ ├── raw_jscode3.js │ │ │ ├── mock_module1.js │ │ │ ├── mock_module2.js │ │ │ ├── dir │ │ │ │ ├── mock_module3.js │ │ │ │ └── mock_module4.js │ │ │ ├── raw_jscode1.js │ │ │ ├── raw_jscode2.js │ │ │ └── coffee │ │ │ │ └── mock_coffee_module.coffee │ │ ├── test.html │ │ ├── test-sandbox.js │ │ ├── test-runtest.js │ │ ├── test-httputil.js │ │ ├── test-failing-callbacks.js │ │ ├── test-runmodule.js │ │ ├── test-base.js │ │ ├── test-runfiles.js │ │ └── test-testcase.js │ │ ├── .npmignore │ │ ├── .gitignore │ │ ├── nodelint.cfg │ │ ├── img │ │ ├── example_fail.png │ │ └── example_pass.png │ │ ├── index.js │ │ ├── share │ │ ├── license.js │ │ ├── junit.xml.ejs │ │ └── nodeunit.css │ │ ├── bin │ │ ├── nodeunit.json │ │ └── nodeunit │ │ ├── lib │ │ ├── reporters │ │ │ ├── index.js │ │ │ ├── skip_passed.js │ │ │ ├── minimal.js │ │ │ ├── html.js │ │ │ ├── default.js │ │ │ ├── browser.js │ │ │ └── junit.js │ │ ├── track.js │ │ ├── nodeunit.js │ │ ├── types.js │ │ ├── utils.js │ │ ├── core.js │ │ └── assert.js │ │ ├── examples │ │ └── browser │ │ │ ├── suite1.js │ │ │ ├── test.html │ │ │ └── suite2.js │ │ ├── LICENSE │ │ ├── deps │ │ ├── console.log.js │ │ └── ejs.js │ │ ├── package.json │ │ ├── CONTRIBUTORS.md │ │ ├── doc │ │ └── nodeunit.md │ │ ├── man1 │ │ └── nodeunit.1 │ │ └── Makefile ├── js │ ├── SampleModule.js │ ├── moduletest-backup.js │ ├── moduletest.js │ └── lib │ │ └── require.js ├── scripttest.js ├── runner.js ├── runner.html ├── runner-backup.js └── nodeunit.css ├── buster ├── js │ ├── cheese.js │ ├── module-one.js │ ├── module-three.js │ ├── pizza.js │ ├── module-two.js │ └── lib │ │ └── wrap.js └── spec │ ├── script │ └── script.test.js │ ├── buster.js │ └── module │ ├── test.module.extension.js │ └── test.module.js ├── mocha ├── js │ ├── lib │ │ └── module-b.js │ ├── SampleModule.js │ └── spec │ │ ├── test.script.js │ │ └── test.module.js ├── runner.html └── mocha.css ├── jasmine ├── js │ ├── lib │ │ ├── module-b.js │ │ ├── jasmine-1.1.0.rc1 │ │ │ ├── jasmine_favicon.png │ │ │ ├── MIT.LICENSE │ │ │ ├── jasmine.css │ │ │ └── jasmine-html.js │ │ ├── consoleJasmineReporter.js │ │ ├── consoleJasmineReporter2.js │ │ └── require.js │ ├── SampleModule.js │ ├── spec │ │ └── ModuleSpec.js │ └── runner.js └── SpecRunner.html ├── qunit ├── js │ ├── samplemodule.js │ ├── moduletest.js │ └── lib │ │ ├── qunit.css │ │ └── require.js ├── runner.js └── runner.html └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /nodeunit/node_modules/.bin/r.js: -------------------------------------------------------------------------------- 1 | ../requirejs/bin/r.js -------------------------------------------------------------------------------- /buster/js/cheese.js: -------------------------------------------------------------------------------- 1 | cheese = { 2 | name:"cheese" 3 | }; -------------------------------------------------------------------------------- /nodeunit/node_modules/requirejs/.npmignore: -------------------------------------------------------------------------------- 1 | README.md 2 | -------------------------------------------------------------------------------- /nodeunit/node_modules/.bin/nodeunit: -------------------------------------------------------------------------------- 1 | ../nodeunit/bin/nodeunit -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/fixtures/raw_jscode3.js: -------------------------------------------------------------------------------- 1 | var t=t?t+1:1; 2 | -------------------------------------------------------------------------------- /mocha/js/lib/module-b.js: -------------------------------------------------------------------------------- 1 | define([], function(){ 2 | return {name: "Module B"}; 3 | }); -------------------------------------------------------------------------------- /jasmine/js/lib/module-b.js: -------------------------------------------------------------------------------- 1 | define([], function(){ 2 | return {name: "Module B"}; 3 | }); -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/.npmignore: -------------------------------------------------------------------------------- 1 | dist 2 | stamp-build 3 | test/fixtures/dir2 4 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | stamp-build 3 | *~ 4 | gmon.out 5 | v8.log 6 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/fixtures/mock_module1.js: -------------------------------------------------------------------------------- 1 | exports.name = 'mock_module1'; 2 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/fixtures/mock_module2.js: -------------------------------------------------------------------------------- 1 | exports.name = 'mock_module2'; 2 | -------------------------------------------------------------------------------- /buster/js/module-one.js: -------------------------------------------------------------------------------- 1 | define([], function(){ 2 | return { 3 | name: "Module One" 4 | } 5 | }); -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/fixtures/dir/mock_module3.js: -------------------------------------------------------------------------------- 1 | exports.name = 'mock_module3'; 2 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/fixtures/dir/mock_module4.js: -------------------------------------------------------------------------------- 1 | exports.name = 'mock_module4'; 2 | -------------------------------------------------------------------------------- /buster/js/module-three.js: -------------------------------------------------------------------------------- 1 | define([], function(){ 2 | return { 3 | name: "Module Three" 4 | } 5 | }); -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/nodelint.cfg: -------------------------------------------------------------------------------- 1 | var options = { 2 | indent: 4, 3 | onevar: false 4 | }; 5 | -------------------------------------------------------------------------------- /nodeunit/js/SampleModule.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return { 3 | name: "sample", 4 | purpose: "AMD testing" 5 | } 6 | }); -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/fixtures/raw_jscode1.js: -------------------------------------------------------------------------------- 1 | function hello_world(arg) { 2 | return "_" + arg + "_"; 3 | } 4 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/fixtures/raw_jscode2.js: -------------------------------------------------------------------------------- 1 | function get_a_variable() { 2 | return typeof a_variable; 3 | } 4 | -------------------------------------------------------------------------------- /buster/js/pizza.js: -------------------------------------------------------------------------------- 1 | pizza = { 2 | name: "pizza", 3 | ingredients: [cheese] //depends on the global cheese.js being available 4 | }; -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/img/example_fail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geddski/amd-testing/HEAD/nodeunit/node_modules/nodeunit/img/example_fail.png -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/img/example_pass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geddski/amd-testing/HEAD/nodeunit/node_modules/nodeunit/img/example_pass.png -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/fixtures/coffee/mock_coffee_module.coffee: -------------------------------------------------------------------------------- 1 | j = 0 2 | j += i for i in [0..5] 3 | 4 | exports.name = "mock_coffee_#{j}" 5 | -------------------------------------------------------------------------------- /buster/js/module-two.js: -------------------------------------------------------------------------------- 1 | define(['module-one'], function(moduleOne){ 2 | return { 3 | name: "Module Two", 4 | dependencies: [moduleOne] 5 | } 6 | }); -------------------------------------------------------------------------------- /jasmine/js/lib/jasmine-1.1.0.rc1/jasmine_favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geddski/amd-testing/HEAD/jasmine/js/lib/jasmine-1.1.0.rc1/jasmine_favicon.png -------------------------------------------------------------------------------- /qunit/js/samplemodule.js: -------------------------------------------------------------------------------- 1 | define(["jquery"], function($){ 2 | return { 3 | name: "sample", 4 | purpose: "AMD testing", 5 | jq_version: $().jquery 6 | }; 7 | }); -------------------------------------------------------------------------------- /mocha/js/SampleModule.js: -------------------------------------------------------------------------------- 1 | define(['lib/module-b'], function(moduleB){ 2 | return { 3 | name: "sample", 4 | purpose: "AMD testing", 5 | dependency: moduleB.name 6 | }; 7 | }); -------------------------------------------------------------------------------- /jasmine/js/SampleModule.js: -------------------------------------------------------------------------------- 1 | define(['lib/module-b'], function(moduleB){ 2 | return { 3 | name: "sample", 4 | purpose: "AMD testing", 5 | dependency: moduleB.name 6 | }; 7 | }); -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/index.js: -------------------------------------------------------------------------------- 1 | // This file is just added for convenience so this repository can be 2 | // directly checked out into a project's deps folder 3 | module.exports = require('./lib/nodeunit'); 4 | -------------------------------------------------------------------------------- /qunit/runner.js: -------------------------------------------------------------------------------- 1 | console.log('running QUnit from Node'); 2 | var qunit = require('./js/lib/qunit').QUnit; 3 | //todo this seems to work but doesn't report anything 4 | qunit.test("a Sample Module", function() { 5 | qunit.ok(true, "this test is fine"); 6 | }); 7 | qunit.init(); -------------------------------------------------------------------------------- /nodeunit/scripttest.js: -------------------------------------------------------------------------------- 1 | exports.testSomething = function(test) { 2 | test.expect(1); 3 | test.ok(true, "this assertion should pass"); 4 | test.done(); 5 | }; 6 | 7 | exports.testSomethingElse = function(test) { 8 | test.ok(false, "this assertion should fail"); 9 | test.done(); 10 | }; -------------------------------------------------------------------------------- /nodeunit/runner.js: -------------------------------------------------------------------------------- 1 | var requirejs = require('requirejs'); 2 | requirejs.config({ 3 | nodeRequire: require, 4 | baseUrl: 'js' 5 | }); 6 | 7 | //bring in and list all the tests to be run 8 | requirejs(['moduletest'], function(ModuleTest){ 9 | exports.ModuleTest = ModuleTest; 10 | }); 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/share/license.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Nodeunit 3 | * https://github.com/caolan/nodeunit 4 | * Copyright (c) 2010 Caolan McMahon 5 | * MIT Licensed 6 | * 7 | * json2.js 8 | * http://www.JSON.org/json2.js 9 | * Public Domain. 10 | * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. 11 | */ 12 | -------------------------------------------------------------------------------- /buster/spec/script/script.test.js: -------------------------------------------------------------------------------- 1 | buster.spec.expose(); 2 | 3 | describe('tests', function () { 4 | 5 | before(function () { 6 | console.log('before is happening'); 7 | }); 8 | 9 | describe('script test', function () { 10 | it('should work', function () { 11 | expect(true).toEqual(true); 12 | }); 13 | }); 14 | }); -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/bin/nodeunit.json: -------------------------------------------------------------------------------- 1 | { 2 | "error_prefix": "\u001B[31m", 3 | "error_suffix": "\u001B[39m", 4 | "ok_prefix": "\u001B[32m", 5 | "ok_suffix": "\u001B[39m", 6 | "bold_prefix": "\u001B[1m", 7 | "bold_suffix": "\u001B[22m", 8 | "assertion_prefix": "\u001B[35m", 9 | "assertion_suffix": "\u001B[39m" 10 | } 11 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/lib/reporters/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'junit': require('./junit'), 3 | 'default': require('./default'), 4 | 'skip_passed': require('./skip_passed'), 5 | 'minimal': require('./minimal'), 6 | 'html': require('./html') 7 | // browser test reporter is not listed because it cannot be used 8 | // with the command line tool, only inside a browser. 9 | }; 10 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/examples/browser/suite1.js: -------------------------------------------------------------------------------- 1 | this.suite1 = { 2 | 'test one': function (test) { 3 | test.ok(true, 'everythings ok'); 4 | setTimeout(function () { 5 | test.done(); 6 | }, 10); 7 | }, 8 | 'apples and oranges': function (test) { 9 | test.equal('apples', 'oranges', 'comparing apples and oranges'); 10 | test.done(); 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /mocha/js/spec/test.script.js: -------------------------------------------------------------------------------- 1 | Object.prototype.should = { 2 | equal:function () { 3 | return -1; 4 | } 5 | }; 6 | 7 | describe('tests', function () { 8 | 9 | beforeEach(function () { 10 | console.log('before is happening'); 11 | }); 12 | 13 | describe('script test', function () { 14 | it('should work', function () { 15 | expect("chewy").to.be.a('string'); 16 | expect(4).to.be.a('number'); 17 | }); 18 | }); 19 | }); -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/examples/browser/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Example tests 4 | 5 | 6 | 7 | 8 | 9 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /nodeunit/js/moduletest-backup.js: -------------------------------------------------------------------------------- 1 | define(function(require, exports, module) { 2 | var testCase = require('nodeunit').testCase; 3 | 4 | exports.testSomething = function(test) { 5 | test.expect(1); 6 | test.ok(true, "this assertion should pass"); 7 | test.done(); 8 | }; 9 | exports.testSomethingElse = function(test) { 10 | test.ok(true, "yay!"); 11 | test.ok(1 < 3, "wow you're good at math"); 12 | test.done(); 13 | }; 14 | }); 15 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/examples/browser/suite2.js: -------------------------------------------------------------------------------- 1 | this.suite2 = { 2 | 'another test': function (test) { 3 | setTimeout(function () { 4 | // lots of assertions 5 | test.ok(true, 'everythings ok'); 6 | test.ok(true, 'everythings ok'); 7 | test.ok(true, 'everythings ok'); 8 | test.ok(true, 'everythings ok'); 9 | test.ok(true, 'everythings ok'); 10 | test.done(); 11 | }, 10); 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /buster/spec/buster.js: -------------------------------------------------------------------------------- 1 | var config = module.exports; 2 | 3 | // config["Browser Tests With Extension"] = { 4 | // environment:"browser", 5 | // rootPath:"../", 6 | // libs:["js/lib/require.js"], 7 | // tests:[ 8 | // "spec/module/test.module.extension.js" 9 | // ], 10 | // sources:['**/*.js'], 11 | // extensions: [require("buster-amd")] 12 | // }; 13 | 14 | config["Browser Tests"] = { 15 | environment:"browser", 16 | rootPath:"../", 17 | libs:["js/lib/require.js"], 18 | tests:[ 19 | "spec/module/test.module.js" 20 | ], 21 | resources:['**/*.js'] 22 | }; -------------------------------------------------------------------------------- /jasmine/js/spec/ModuleSpec.js: -------------------------------------------------------------------------------- 1 | define(["../SampleModule"], function(SampleModule) { 2 | 3 | describe("Sample Module", function() { 4 | it('should have a name', function() { 5 | expect(SampleModule.name).toBe("sample"); 6 | }); 7 | 8 | it('should state the purpose', function() { 9 | expect(SampleModule.purpose).toBe("AMD testing"); 10 | }); 11 | 12 | it('should have its own dependencies', function() { 13 | expect(SampleModule.dependency).toBe("Module B"); 14 | }); 15 | }); 16 | 17 | return { 18 | name: "modulespec" 19 | } 20 | }); -------------------------------------------------------------------------------- /qunit/js/moduletest.js: -------------------------------------------------------------------------------- 1 | define(['samplemodule'], function(SampleModule) { 2 | console.log("moduletest"); 3 | test("sanity", function() { 4 | ok(true, "this test is fine"); 5 | }); 6 | 7 | test("the module name", function() { 8 | equal(SampleModule.name, "sample", "name should be sample"); 9 | }); 10 | 11 | test("the module purpose", function() { 12 | equal(SampleModule.purpose, "AMD testing", "purpose should be 'AMD testing'"); 13 | }); 14 | 15 | test("the module jquery version", function() { 16 | equal(SampleModule.jq_version, "1.6", "jq_version should be '1.6'"); 17 | }); 18 | }); -------------------------------------------------------------------------------- /nodeunit/runner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | AMD Testing 4 | 5 | 6 | 7 | 8 | 9 | 10 | 20 | 21 | 22 |

Example Test Suite

23 | 24 | -------------------------------------------------------------------------------- /mocha/js/spec/test.module.js: -------------------------------------------------------------------------------- 1 | define(["SampleModule"], function(SampleModule) { 2 | describe("Sample Module", function() { 3 | it('should have a name', function() { 4 | expect(SampleModule.name).to.be.a("string"); 5 | expect(SampleModule.name).to.equal("sample"); 6 | }); 7 | 8 | it('should state the purpose', function() { 9 | expect(SampleModule.purpose).to.equal("AMD testing"); 10 | }); 11 | 12 | it('should have its own dependencies', function() { 13 | expect(SampleModule.dependency).to.equal("Module B"); 14 | }); 15 | 16 | it('should have its own dependencies', function() { 17 | expect(SampleModule.dependency).to.equal("Module B"); 18 | }); 19 | }); 20 | 21 | return { 22 | name: "modulespec" 23 | } 24 | }); -------------------------------------------------------------------------------- /nodeunit/runner-backup.js: -------------------------------------------------------------------------------- 1 | //todo will this work in the browser still? 2 | var requirejs = require('requirejs'); 3 | 4 | require.paths.unshift(__dirname + '/deps'); 5 | try { 6 | var reporter = require('nodeunit').reporters.default; 7 | } 8 | catch(e) { 9 | console.log("Cannot find nodeunit module."); 10 | console.log("You can download submodules for this project by doing:"); 11 | console.log(""); 12 | console.log(" git submodule init"); 13 | console.log(" git submodule update"); 14 | console.log(""); 15 | process.exit(); 16 | } 17 | 18 | process.chdir(__dirname); 19 | 20 | requirejs(['moduletest'], function(moduletest){ 21 | console.log('moduletest: ', moduletest); 22 | reporter.run({ 23 | 'Sample Module' : moduletest 24 | }); 25 | }); 26 | //reporter.run(['scripttest.js']); -------------------------------------------------------------------------------- /nodeunit/node_modules/requirejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "requirejs", 3 | "description": "Node adapter for RequireJS, for loading AMD modules. Includes RequireJS optimizer", 4 | "version": "0.26.0", 5 | "homepage": "http://github.com/jrburke/r.js", 6 | "author": "James Burke (http://github.com/jrburke)", 7 | "licenses": [ 8 | { 9 | "type": "BSD", 10 | "url": "https://github.com/jrburke/r.js/blob/master/LICENSE" 11 | }, 12 | { 13 | "type": "MIT", 14 | "url": "https://github.com/jrburke/r.js/blob/master/LICENSE" 15 | } 16 | ], 17 | "main": "./bin/r.js", 18 | "bin": { 19 | "r.js": "./bin/r.js" 20 | }, 21 | "engines": { 22 | "node": ">=0.4.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/share/junit.xml.ejs: -------------------------------------------------------------------------------- 1 | 2 | <% for (var i=0; i < suites.length; i++) { %> 3 | <% var suite=suites[i]; %> 4 | 8 | <% for (var j=0; j < suite.testcases.length; j++) { %> 9 | <% var testcase=suites[i].testcases[j]; %> 10 | 11 | <% if (testcase.failure) { %> 12 | 13 | <% if (testcase.failure.backtrace) { %><%= testcase.failure.backtrace %><% } %> 14 | 15 | <% } %> 16 | 17 | <% } %> 18 | 19 | <% } %> 20 | -------------------------------------------------------------------------------- /qunit/runner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AMD Tests 6 | 7 | 8 | 9 |

Tests

10 |

11 |
12 |

13 |
    14 |
    test markup, will be hidden
    15 | 16 | 17 | 18 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /nodeunit/js/moduletest.js: -------------------------------------------------------------------------------- 1 | define(['./SampleModule', 'nodeunit'], function(SampleModule, nodeunitNode) { 2 | //browsers have the global nodeunit already available 3 | var nu = nodeunitNode || nodeunit; 4 | 5 | return nu.testCase({ 6 | setUp: function (callback) { 7 | this.foo = "hi"; 8 | callback(); 9 | }, 10 | tearDown: function (callback) { 11 | this.foo = ""; 12 | callback(); 13 | }, 14 | 'AMD Module': function(test){ 15 | test.ok(SampleModule.name == 'sample'); 16 | test.done(); 17 | }, 18 | testSomething : function(test) { 19 | test.ok(this.foo == 'hi', 'foo should be hi'); 20 | test.ok(true, "this assertion should pass"); 21 | test.done(); 22 | }, 23 | testSomethingElse : function(test) { 24 | test.ok(true, "yay!"); 25 | test.ok(1 < 3, "wow you're good at math"); 26 | test.done(); 27 | } 28 | }) 29 | }); -------------------------------------------------------------------------------- /mocha/runner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 27 | 28 | 29 |
    30 | 31 | -------------------------------------------------------------------------------- /jasmine/js/runner.js: -------------------------------------------------------------------------------- 1 | var requirejs = require('requirejs'); 2 | requirejs.config({ 3 | nodeRequire: require 4 | // baseUrl: 'js' 5 | }); 6 | 7 | //make define available globally like it is in the browser 8 | global.define = require('requirejs'); 9 | 10 | //make jasmine available globally like it is in the browser 11 | global.describe = require('./lib/jasmine-1.1.0.rc1/jasmine').describe; 12 | global.it = require('./lib/jasmine-1.1.0.rc1/jasmine').it; 13 | global.expect = require('./lib/jasmine-1.1.0.rc1/jasmine').expect; 14 | 15 | 16 | //bring in and list all the tests to be run 17 | requirejs(['./spec/ModuleSpec'], function(ModuleSpec) { 18 | console.log("ModuleSpec: ", ModuleSpec); 19 | var jasmine = require('./lib/jasmine-1.1.0.rc1/jasmine').jasmine; 20 | var ConsoleJasmineReporter2 = require('./lib/consoleJasmineReporter2').ConsoleJasmineReporter; 21 | jasmine.getEnv().addReporter(new ConsoleJasmineReporter2()); 22 | jasmine.getEnv().execute(); 23 | }); -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Nodeunit Test Suite 4 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

    Nodeunit Test Suite

    17 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /jasmine/SpecRunner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Jasmine Spec Runner 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Caolan McMahon 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /jasmine/js/lib/jasmine-1.1.0.rc1/MIT.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008-2011 Pivotal Labs 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/test-sandbox.js: -------------------------------------------------------------------------------- 1 | var nodeunit = require('../lib/nodeunit'); 2 | var sandbox = require('../lib/utils').sandbox; 3 | var testCase = nodeunit.testCase; 4 | 5 | exports.testSimpleSandbox = function (test) { 6 | var raw_jscode1 = sandbox(__dirname + '/fixtures/raw_jscode1.js'); 7 | test.equal(raw_jscode1.hello_world('foo'), '_foo_', 'evaluation ok'); 8 | test.done(); 9 | }; 10 | 11 | exports.testSandboxContext = function (test) { 12 | var a_variable = 42; // should not be visible in the sandbox 13 | var raw_jscode2 = sandbox(__dirname + '/fixtures/raw_jscode2.js'); 14 | a_variable = 42; // again for the win 15 | test.equal( 16 | raw_jscode2.get_a_variable(), 17 | 'undefined', 18 | 'the variable should not be defined' 19 | ); 20 | test.done(); 21 | }; 22 | 23 | exports.testSandboxMultiple = function (test) { 24 | var raw_jscode3 = sandbox([ 25 | __dirname + '/fixtures/raw_jscode3.js', 26 | __dirname + '/fixtures/raw_jscode3.js', 27 | __dirname + '/fixtures/raw_jscode3.js' 28 | ]); 29 | test.equal(raw_jscode3.t, 3, 'two files loaded'); 30 | test.done(); 31 | }; 32 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # AMD Testing 2 | 3 | ## purpose 4 | 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. 5 | The goal is to find the very best test frameworks for testing AMD modules in both environments. 6 | 7 | ## Mocha 8 | Mocha is working in the browser. Mocha doesn't come with an assertion library, so I'm using the excellent [chai.js](http://chaijs.com/). 9 | ###Browser Testing 10 | Open mocha/runner.html in your browser 11 | 12 | ## Jasmine 13 | Jasmine is working. 14 | ### Browser Testing 15 | Open jasmine/SpecRunner.html in your browser 16 | ### Node Testing 17 | `node runner.js` 18 | 19 | Make sure you've installed the RequireJS npm package. This allows you to use your AMD modules in Node. 20 | 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. 21 | 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. 22 | If jasmine-node could run programmatically this would be no problem, but it doesn't. 23 | 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. 24 | Just run `node runner.js`. 25 | 26 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/lib/track.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Simple util module to track tests. Adds a process.exit hook to print 3 | * the undone tests. 4 | */ 5 | 6 | 7 | exports.createTracker = function (on_exit) { 8 | var names = {}; 9 | var tracker = { 10 | names: function () { 11 | var arr = []; 12 | for (var k in names) { 13 | if (names.hasOwnProperty(k)) { 14 | arr.push(k); 15 | } 16 | } 17 | return arr; 18 | }, 19 | unfinished: function () { 20 | return tracker.names().length; 21 | }, 22 | put: function (testname) { 23 | names[testname] = testname; 24 | }, 25 | remove: function (testname) { 26 | delete names[testname]; 27 | } 28 | }; 29 | 30 | process.on('exit', function() { 31 | on_exit = on_exit || exports.default_on_exit; 32 | on_exit(tracker); 33 | }); 34 | 35 | return tracker; 36 | }; 37 | 38 | exports.default_on_exit = function (tracker) { 39 | if (tracker.unfinished()) { 40 | console.log(''); 41 | console.log('Undone tests (or their setups/teardowns): '); 42 | var names = tracker.names(); 43 | for (var i = 0; i < names.length; i += 1) { 44 | console.log(names[i]); 45 | } 46 | process.reallyExit(tracker.unfinished()); 47 | } 48 | }; 49 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/deps/console.log.js: -------------------------------------------------------------------------------- 1 | /* 2 | A console.log that won't leave you hanging when node exits 3 | 90% of this file was ripped from node.js 4 | 5 | License: see: https://github.com/joyent/node/blob/master/lib/console.js 6 | */ 7 | 8 | // console object 9 | var formatRegExp = /%[sdj]/g; 10 | function format(f) { 11 | var util = require('util'); 12 | 13 | if (typeof f !== 'string') { 14 | var objects = []; 15 | for (var i = 0; i < arguments.length; i++) { 16 | objects.push(util.inspect(arguments[i])); 17 | } 18 | return objects.join(' '); 19 | } 20 | 21 | 22 | var i = 1; 23 | var args = arguments; 24 | var str = String(f).replace(formatRegExp, function(x) { 25 | switch (x) { 26 | case '%s': return String(args[i++]); 27 | case '%d': return Number(args[i++]); 28 | case '%j': return JSON.stringify(args[i++]); 29 | default: 30 | return x; 31 | } 32 | }); 33 | for (var len = args.length, x = args[i]; i < len; x = args[++i]) { 34 | if (x === null || typeof x !== 'object') { 35 | str += ' ' + x; 36 | } else { 37 | str += ' ' + util.inspect(x); 38 | } 39 | } 40 | return str; 41 | } 42 | 43 | console.log = function() { 44 | var res = process.stdout.write(format.apply(this, arguments) + '\n'); 45 | 46 | // this is the first time stdout got backed up 47 | if (!res && !process.stdout.pendingWrite) { 48 | process.stdout.pendingWrite = true; 49 | 50 | // magic sauce: keep node alive until stdout has flushed 51 | process.stdout.once('drain', function () { 52 | process.stdout.draining = false; 53 | }); 54 | } 55 | }; 56 | -------------------------------------------------------------------------------- /nodeunit/nodeunit.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Styles taken from qunit.css 3 | */ 4 | 5 | h1#nodeunit-header, h1.nodeunit-header { 6 | padding: 15px; 7 | font-size: large; 8 | background-color: #06b; 9 | color: white; 10 | font-family: 'trebuchet ms', verdana, arial; 11 | margin: 0; 12 | } 13 | 14 | h1#nodeunit-header a { 15 | color: white; 16 | } 17 | 18 | h2#nodeunit-banner { 19 | height: 2em; 20 | border-bottom: 1px solid white; 21 | background-color: #eee; 22 | margin: 0; 23 | font-family: 'trebuchet ms', verdana, arial; 24 | } 25 | h2#nodeunit-banner.pass { 26 | background-color: green; 27 | } 28 | h2#nodeunit-banner.fail { 29 | background-color: red; 30 | } 31 | 32 | h2#nodeunit-userAgent, h2.nodeunit-userAgent { 33 | padding: 10px; 34 | background-color: #eee; 35 | color: black; 36 | margin: 0; 37 | font-size: small; 38 | font-weight: normal; 39 | font-family: 'trebuchet ms', verdana, arial; 40 | font-size: 10pt; 41 | } 42 | 43 | div#nodeunit-testrunner-toolbar { 44 | background: #eee; 45 | border-top: 1px solid black; 46 | padding: 10px; 47 | font-family: 'trebuchet ms', verdana, arial; 48 | margin: 0; 49 | font-size: 10pt; 50 | } 51 | 52 | ol#nodeunit-tests { 53 | font-family: 'trebuchet ms', verdana, arial; 54 | font-size: 10pt; 55 | } 56 | ol#nodeunit-tests li strong { 57 | cursor:pointer; 58 | } 59 | ol#nodeunit-tests .pass { 60 | color: green; 61 | } 62 | ol#nodeunit-tests .fail { 63 | color: red; 64 | } 65 | 66 | p#nodeunit-testresult { 67 | margin-left: 1em; 68 | font-size: 10pt; 69 | font-family: 'trebuchet ms', verdana, arial; 70 | } 71 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/share/nodeunit.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Styles taken from qunit.css 3 | */ 4 | 5 | h1#nodeunit-header, h1.nodeunit-header { 6 | padding: 15px; 7 | font-size: large; 8 | background-color: #06b; 9 | color: white; 10 | font-family: 'trebuchet ms', verdana, arial; 11 | margin: 0; 12 | } 13 | 14 | h1#nodeunit-header a { 15 | color: white; 16 | } 17 | 18 | h2#nodeunit-banner { 19 | height: 2em; 20 | border-bottom: 1px solid white; 21 | background-color: #eee; 22 | margin: 0; 23 | font-family: 'trebuchet ms', verdana, arial; 24 | } 25 | h2#nodeunit-banner.pass { 26 | background-color: green; 27 | } 28 | h2#nodeunit-banner.fail { 29 | background-color: red; 30 | } 31 | 32 | h2#nodeunit-userAgent, h2.nodeunit-userAgent { 33 | padding: 10px; 34 | background-color: #eee; 35 | color: black; 36 | margin: 0; 37 | font-size: small; 38 | font-weight: normal; 39 | font-family: 'trebuchet ms', verdana, arial; 40 | font-size: 10pt; 41 | } 42 | 43 | div#nodeunit-testrunner-toolbar { 44 | background: #eee; 45 | border-top: 1px solid black; 46 | padding: 10px; 47 | font-family: 'trebuchet ms', verdana, arial; 48 | margin: 0; 49 | font-size: 10pt; 50 | } 51 | 52 | ol#nodeunit-tests { 53 | font-family: 'trebuchet ms', verdana, arial; 54 | font-size: 10pt; 55 | } 56 | ol#nodeunit-tests li strong { 57 | cursor:pointer; 58 | } 59 | ol#nodeunit-tests .pass { 60 | color: green; 61 | } 62 | ol#nodeunit-tests .fail { 63 | color: red; 64 | } 65 | 66 | p#nodeunit-testresult { 67 | margin-left: 1em; 68 | font-size: 10pt; 69 | font-family: 'trebuchet ms', verdana, arial; 70 | } 71 | -------------------------------------------------------------------------------- /mocha/mocha.css: -------------------------------------------------------------------------------- 1 | 2 | body { 3 | font: 20px/1.5 "Helvetica Neue", Helvetica, Aria;, sans-serif; 4 | padding: 60px 50px; 5 | } 6 | 7 | h1, h2 { 8 | margin: 0; 9 | } 10 | 11 | h1 { 12 | font-size: 1em; 13 | font-weight: 200; 14 | } 15 | 16 | .suite .suite h1 { 17 | font-size: .8em; 18 | } 19 | 20 | h2 { 21 | font-size: 12px; 22 | font-weight: normal; 23 | cursor: pointer; 24 | } 25 | 26 | .suite { 27 | margin-left: 15px; 28 | } 29 | 30 | .test { 31 | margin-left: 15px; 32 | } 33 | 34 | .test.pass::before { 35 | content: '◦'; 36 | font-size: 12px; 37 | display: block; 38 | float: left; 39 | margin-right: 5px; 40 | } 41 | 42 | .test.pass{ 43 | color: green; 44 | } 45 | 46 | .test.fail { 47 | color: #c00; 48 | } 49 | 50 | .test.fail pre { 51 | color: black; 52 | } 53 | 54 | .test.fail::before { 55 | content: '✖'; 56 | font-size: 12px; 57 | display: block; 58 | float: left; 59 | margin-right: 5px; 60 | color: #c00; 61 | } 62 | 63 | .test pre.error { 64 | color: #c00; 65 | } 66 | 67 | .test pre { 68 | display: inline-block; 69 | font: 12px/1.5 monaco, monospace; 70 | margin: 5px; 71 | padding: 15px; 72 | border: 1px solid #eee; 73 | border-bottom-color: #ddd; 74 | -webkit-border-radius: 3px; 75 | -webkit-box-shadow: 0 1px 3px #eee; 76 | } 77 | 78 | #error { 79 | color: #c00; 80 | font-size: 1.5 em; 81 | font-weight: 100; 82 | letter-spacing: 1px; 83 | } 84 | 85 | #stats { 86 | position: fixed; 87 | top: 15px; 88 | right: 30px; 89 | font-size: 12px; 90 | margin: 0; 91 | color: #888; 92 | } 93 | 94 | 95 | #stats em { 96 | color: black; 97 | } 98 | #stats li { 99 | list-style: none; 100 | } -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/package.json: -------------------------------------------------------------------------------- 1 | { "name": "nodeunit" 2 | , "description": "Easy unit testing for node.js and the browser." 3 | , "maintainers": 4 | [ { "name": "Caolan McMahon" 5 | , "web": "https://github.com/caolan" 6 | } 7 | ] 8 | , "contributors" : 9 | [ { "name": "Alex Gorbatchev" 10 | , "web": "https://github.com/alexgorbatchev" 11 | } 12 | , { "name": "Alex Wolfe" 13 | , "web": "https://github.com/alexkwolfe" 14 | } 15 | , { "name": "Carl Fürstenberg" 16 | , "web": "https://github.com/azatoth" 17 | } 18 | , { "name": "Gerad Suyderhoud" 19 | , "web": "https://github.com/gerad" 20 | } 21 | , { "name": "Kadir Pekel" 22 | , "web": "https://github.com/coffeemate" 23 | } 24 | , { "name": "Oleg Efimov" 25 | , "web": "https://github.com/Sannis" 26 | } 27 | , { "name": "Orlando Vazquez" 28 | , "web": "https://github.com/orlandov" 29 | } 30 | , { "name": "Ryan Dahl" 31 | , "web": "https://github.com/ry" 32 | } 33 | , { "name": "Sam Stephenson" 34 | , "web": "https://github.com/sstephenson" 35 | } 36 | , { "name": "Thomas Mayfield" 37 | , "web": "https://github.com/thegreatape" 38 | } 39 | , { "name": "Elijah Insua ", 40 | "web": "http://tmpvar.com" 41 | } 42 | ] 43 | , "version": "0.5.3" 44 | , "repository" : 45 | { "type" : "git" 46 | , "url" : "http://github.com/caolan/nodeunit.git" 47 | } 48 | , "bugs" : { "web" : "http://github.com/caolan/nodeunit/issues" } 49 | , "licenses" : 50 | [ { "type" : "MIT" 51 | , "url" : "http://github.com/caolan/nodeunit/raw/master/LICENSE" 52 | } 53 | ] 54 | , "directories" : { "lib": "./lib", "doc" : "./doc", "man" : "./man1" } 55 | , "bin" : { "nodeunit" : "./bin/nodeunit" } 56 | } 57 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/test-runtest.js: -------------------------------------------------------------------------------- 1 | /* THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! 2 | * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build. 3 | * Only code on that line will be removed, its mostly to avoid requiring code 4 | * that is node specific 5 | */ 6 | 7 | var nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER 8 | 9 | 10 | exports.testArgs = function (test) { 11 | test.ok(test.expect instanceof Function, 'test.expect'); 12 | test.ok(test.done instanceof Function, 'test.done'); 13 | test.ok(test.ok instanceof Function, 'test.ok'); 14 | test.ok(test.same instanceof Function, 'test.same'); 15 | test.ok(test.equals instanceof Function, 'test.equals'); 16 | test.done(); 17 | }; 18 | 19 | exports.testDoneCallback = function (test) { 20 | test.expect(4); 21 | nodeunit.runTest('testname', exports.testArgs, { 22 | testDone: function (name, assertions) { 23 | test.equals(assertions.failures(), 0, 'failures'); 24 | test.equals(assertions.length, 5, 'length'); 25 | test.ok(typeof assertions.duration === "number"); 26 | test.equals(name, 'testname'); 27 | } 28 | }, test.done); 29 | }; 30 | 31 | exports.testThrowError = function (test) { 32 | test.expect(3); 33 | var err = new Error('test'); 34 | var testfn = function (test) { 35 | throw err; 36 | }; 37 | nodeunit.runTest('testname', testfn, { 38 | log: function (assertion) { 39 | test.same(assertion.error, err, 'assertion.error'); 40 | }, 41 | testDone: function (name, assertions) { 42 | test.equals(assertions.failures(), 1); 43 | test.equals(assertions.length, 1); 44 | } 45 | }, test.done); 46 | }; 47 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | Nodeunit contributors (sorted alphabeticaly) 2 | ============================================ 3 | 4 | * **[Alex Gorbatchev](https://github.com/alexgorbatchev)** 5 | 6 | * Deeper default object inspection 7 | * Timeout to ensure flushing of console output (default reporter) 8 | 9 | * **[Alex Wolfe](https://github.com/alexkwolfe)** 10 | 11 | * HTML test reporter 12 | 13 | * **[Caolan McMahon](https://github.com/caolan)** 14 | 15 | * Author and maintainer 16 | * Most features develpopment 17 | 18 | * **[Carl Fürstenberg](https://github.com/azatoth)** 19 | 20 | * Debian-friendly Makefile, supports both 'node' and 'nodejs' executables 21 | * Sandbox utility 22 | * Minimal test reporter 23 | 24 | * **[Gerad Suyderhoud](https://github.com/gerad)** 25 | 26 | * First comand-line tool 27 | 28 | * **[Kadir Pekel](https://github.com/coffeemate)** 29 | 30 | * Improvements to default test reporter 31 | * HTTP test utility 32 | 33 | * **[Matthias Lübken](https://github.com/luebken)** 34 | 35 | * Utility functions for tracking incomplete tests on exit 36 | 37 | * **[Oleg Efimov](https://github.com/Sannis)** 38 | 39 | * Adding 'make lint' and fixing nodelint errors 40 | * Option parsing, --help text and config file support 41 | * Reporters option for command-line tool 42 | 43 | * **[Orlando Vazquez](https://github.com/orlandov)** 44 | 45 | * Added jUnit XML reporter 46 | 47 | * **[Ryan Dahl](https://github.com/ry)** 48 | 49 | * Add package.json 50 | 51 | * **[Sam Stephenson](https://github.com/sstephenson)** 52 | 53 | * Coffee-script support 54 | 55 | * **[Thomas Mayfield](https://github.com/thegreatape)** 56 | 57 | * Async setUp and tearDown support for testCase 58 | 59 | **[Full contributors list](https://github.com/caolan/nodeunit/contributors).** 60 | 61 | -------------------------------------------------------------------------------- /jasmine/js/lib/consoleJasmineReporter.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | 3 | function red(s){ return ["\033[31m", s, "\033[0m"].join('') } 4 | function green(s){ return ["\033[32m", s, "\033[0m"].join('') } 5 | function cyan(s){ return ["\033[36m", s, "\033[0m"].join('') } 6 | function yellow(s){ return ["\033[33m", s, "\033[0m"].join('') } 7 | function blue(s){ return ["\033[34m", s, "\033[0m"].join('') } 8 | 9 | function ConsoleJasmineReporter(){ 10 | } 11 | 12 | ConsoleJasmineReporter.prototype.reportRunnerResults = function(runner){ 13 | var output = [], 14 | results = runner.results(), 15 | specs = runner.specs() 16 | var msg = [specs.length, 'specs,', results.failedCount, 'failures.'].join(' ') 17 | if (results.failedCount > 0) 18 | msg = red(msg) 19 | else 20 | msg = green(msg) 21 | output.push(msg) 22 | 23 | 24 | for (var i = 0; i < specs.length; i++) { 25 | var spec = specs[i] 26 | var results = spec.results() 27 | if (results.failedCount > 0){ 28 | var items = results.getItems() 29 | var numItems = items.length 30 | for (var j = 0; j < numItems; j++){ 31 | var result = items[j] 32 | if (result.type == 'log') 33 | output.push(' LOG: ' + result.toString()) 34 | else if (result.type == 'expect' && 35 | result.passed && !result.passed()){ 36 | output.push(spec.getFullName()) 37 | output.push(' ' + red(result.message)) 38 | } 39 | } 40 | } 41 | } 42 | console.log(output.join('\n')) 43 | } 44 | 45 | window.ConsoleJasmineReporter = ConsoleJasmineReporter 46 | 47 | }()) -------------------------------------------------------------------------------- /jasmine/js/lib/consoleJasmineReporter2.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | 3 | function red(s){ return ["\033[31m", s, "\033[0m"].join('') } 4 | function green(s){ return ["\033[32m", s, "\033[0m"].join('') } 5 | function cyan(s){ return ["\033[36m", s, "\033[0m"].join('') } 6 | function yellow(s){ return ["\033[33m", s, "\033[0m"].join('') } 7 | function blue(s){ return ["\033[34m", s, "\033[0m"].join('') } 8 | 9 | function ConsoleJasmineReporter(){ 10 | } 11 | 12 | ConsoleJasmineReporter.prototype.reportRunnerResults = function(runner){ 13 | var output = [], 14 | results = runner.results(), 15 | specs = runner.specs(); 16 | var msg = [specs.length, 'specs,', results.failedCount, 'failures.'].join(' '); 17 | if (results.failedCount > 0) 18 | msg = red(msg); 19 | else 20 | msg = green(msg); 21 | output.push(msg); 22 | 23 | 24 | for (var i = 0; i < specs.length; i++) { 25 | var spec = specs[i]; 26 | var results = spec.results(); 27 | if (results.failedCount > 0){ 28 | var items = results.getItems(); 29 | var numItems = items.length; 30 | for (var j = 0; j < numItems; j++){ 31 | var result = items[j] 32 | if (result.type == 'log') 33 | output.push(' LOG: ' + result.toString()); 34 | else if (result.type == 'expect' && 35 | result.passed && !result.passed()){ 36 | output.push(spec.getFullName()); 37 | output.push(' ' + red(result.message)) 38 | } 39 | } 40 | } 41 | } 42 | console.log(output.join('\n')) 43 | }; 44 | 45 | exports.ConsoleJasmineReporter = ConsoleJasmineReporter 46 | 47 | }()); -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/doc/nodeunit.md: -------------------------------------------------------------------------------- 1 | nodeunit(1) -- simple node.js unit testing tool 2 | =============================================== 3 | 4 | ## SYNOPSIS 5 | 6 | nodeunit [options] [ ...] 7 | 8 | ## DESCRIPTION 9 | 10 | Nodeunit is a simple unit testing tool based on the node.js assert module. 11 | 12 | * Simple to use 13 | * Just export the tests from a module 14 | * Helps you avoid common pitfalls when testing asynchronous code 15 | * Easy to add test cases with setUp and tearDown functions if you wish 16 | * Allows the use of mocks and stubs 17 | 18 | ## OPTIONS 19 | 20 | __--config FILE__: 21 | Load config options from a JSON file, allows the customisation 22 | of color schemes for the default test reporter etc. 23 | See bin/nodeunit.json for current available options. 24 | 25 | __--reporter FILE__: 26 | You can set the test reporter to a custom module or on of the modules 27 | in nodeunit/lib/reporters, when omitted, the default test runner is used. 28 | 29 | __--list-reporters__: 30 | List available build-in reporters. 31 | 32 | __-h__, __--help__: 33 | Display the help and exit. 34 | 35 | __-v__, __--version__: 36 | Output version information and exit. 37 | 38 | ____: 39 | You can run nodeunit on specific files or on all *\*.js* files inside 40 | a directory. 41 | 42 | ## AUTHORS 43 | 44 | Written by Caolan McMahon and other nodeunit contributors. 45 | Contributors list: . 46 | 47 | ## REPORTING BUGS 48 | 49 | Report nodeunit bugs to . 50 | 51 | ## COPYRIGHT 52 | 53 | Copyright © 2010 Caolan McMahon. 54 | Nodeunit has been released under the MIT license: 55 | . 56 | 57 | ## SEE ALSO 58 | 59 | node(1) 60 | 61 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/test-httputil.js: -------------------------------------------------------------------------------- 1 | var nodeunit = require('../lib/nodeunit'); 2 | var httputil = require('../lib/utils').httputil; 3 | 4 | exports.testHttpUtilBasics = function (test) { 5 | 6 | test.expect(6); 7 | 8 | httputil(function (req, resp) { 9 | test.equal(req.method, 'PUT'); 10 | test.equal(req.url, '/newpair'); 11 | test.equal(req.headers.foo, 'bar'); 12 | 13 | resp.writeHead(500, {'content-type': 'text/plain'}); 14 | resp.end('failed'); 15 | }, function (server, client) { 16 | client.fetch('PUT', '/newpair', {'foo': 'bar'}, function (resp) { 17 | test.equal(resp.statusCode, 500); 18 | test.equal(resp.headers['content-type'], 'text/plain'); 19 | test.equal(resp.body, 'failed'); 20 | 21 | server.close(); 22 | test.done(); 23 | }); 24 | }); 25 | }; 26 | 27 | exports.testHttpUtilJsonHandling = function (test) { 28 | 29 | test.expect(9); 30 | 31 | httputil(function (req, resp) { 32 | test.equal(req.method, 'GET'); 33 | test.equal(req.url, '/'); 34 | test.equal(req.headers.foo, 'bar'); 35 | 36 | var testdata = {foo1: 'bar', foo2: 'baz'}; 37 | 38 | resp.writeHead(200, {'content-type': 'application/json'}); 39 | resp.end(JSON.stringify(testdata)); 40 | 41 | }, function (server, client) { 42 | client.fetch('GET', '/', {'foo': 'bar'}, function (resp) { 43 | test.equal(resp.statusCode, 200); 44 | test.equal(resp.headers['content-type'], 'application/json'); 45 | 46 | test.ok(resp.bodyAsObject); 47 | test.equal(typeof resp.bodyAsObject, 'object'); 48 | test.equal(resp.bodyAsObject.foo1, 'bar'); 49 | test.equal(resp.bodyAsObject.foo2, 'baz'); 50 | 51 | server.close(); 52 | test.done(); 53 | }); 54 | }); 55 | }; 56 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/lib/nodeunit.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Nodeunit 3 | * Copyright (c) 2010 Caolan McMahon 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Module dependencies 9 | */ 10 | 11 | var async = require('../deps/async'), 12 | types = require('./types'), 13 | utils = require('./utils'), 14 | core = require('./core'), 15 | reporters = require('./reporters'), 16 | assert = require('./assert'), 17 | path = require('path'); 18 | 19 | 20 | /** 21 | * Export sub-modules. 22 | */ 23 | 24 | exports.types = types; 25 | exports.utils = utils; 26 | exports.reporters = reporters; 27 | exports.assert = assert; 28 | 29 | // backwards compatibility 30 | exports.testrunner = { 31 | run: function () { 32 | console.log( 33 | 'WARNING: nodeunit.testrunner is going to be deprecated, please ' + 34 | 'use nodeunit.reporters.default instead!' 35 | ); 36 | return reporters['default'].run.apply(this, arguments); 37 | } 38 | }; 39 | 40 | 41 | /** 42 | * Export all core functions 43 | */ 44 | 45 | for (var k in core) { 46 | exports[k] = core[k]; 47 | }; 48 | 49 | 50 | /** 51 | * Load modules from paths array and run all exported tests in series. If a path 52 | * is a directory, load all supported file types inside it as modules. This only 53 | * reads 1 level deep in the directory and does not recurse through 54 | * sub-directories. 55 | * 56 | * @param {Array} paths 57 | * @param {Object} opt 58 | * @api public 59 | */ 60 | 61 | exports.runFiles = function (paths, opt) { 62 | var all_assertions = []; 63 | var options = types.options(opt); 64 | var start = new Date().getTime(); 65 | 66 | if (!paths.length) { 67 | return options.done(types.assertionList(all_assertions)); 68 | } 69 | 70 | utils.modulePaths(paths, function (err, files) { 71 | if (err) throw err; 72 | async.concatSeries(files, function (file, cb) { 73 | var name = path.basename(file); 74 | exports.runModule(name, require(file), options, cb); 75 | }, 76 | function (err, all_assertions) { 77 | var end = new Date().getTime(); 78 | options.done(types.assertionList(all_assertions, end - start)); 79 | }); 80 | }); 81 | 82 | }; 83 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/man1/nodeunit.1: -------------------------------------------------------------------------------- 1 | .\" Generated with Ronnjs/v0.1 2 | .\" http://github.com/kapouer/ronnjs/ 3 | . 4 | .TH "NODEUNIT" "1" "October 2010" "" "" 5 | . 6 | .SH "NAME" 7 | \fBnodeunit\fR \-\- simple node\.js unit testing tool 8 | . 9 | .SH "SYNOPSIS" 10 | . 11 | .nf 12 | nodeunit [options] [ \.\.\.] 13 | . 14 | .fi 15 | . 16 | .SH "DESCRIPTION" 17 | Nodeunit is a simple unit testing tool based on the node\.js assert module\. 18 | . 19 | .IP "\(bu" 4 20 | Simple to use 21 | . 22 | .IP "\(bu" 4 23 | Just export the tests from a module 24 | . 25 | .IP "\(bu" 4 26 | Helps you avoid common pitfalls when testing asynchronous code 27 | . 28 | .IP "\(bu" 4 29 | Easy to add test cases with setUp and tearDown functions if you wish 30 | . 31 | .IP "\(bu" 4 32 | Allows the use of mocks and stubs 33 | . 34 | .IP "" 0 35 | . 36 | .SH "OPTIONS" 37 | \fB\-\-config FILE\fR: 38 | . 39 | .br 40 | Load config options from a JSON file, allows the customisation 41 | of color schemes for the default test reporter etc\. 42 | See bin/nodeunit\.json for current available options\. 43 | . 44 | .P 45 | \fB\-\-reporter FILE\fR: 46 | . 47 | .br 48 | You can set the test reporter to a custom module or on of the modules 49 | in nodeunit/lib/reporters, when omitted, the default test runner is used\. 50 | . 51 | .P 52 | \fB\-\-list\-reporters\fR: 53 | . 54 | .br 55 | List available build\-in reporters\. 56 | . 57 | .P 58 | \fB\-h\fR, \fB\-\-help\fR: 59 | . 60 | .br 61 | Display the help and exit\. 62 | . 63 | .P 64 | \fB\-v\fR, \fB\-\-version\fR: 65 | . 66 | .br 67 | Output version information and exit\. 68 | . 69 | .P 70 | \fB\fR: 71 | You can run nodeunit on specific files or on all \fI*\.js\fR files inside 72 | . 73 | .br 74 | a directory\. 75 | . 76 | .SH "AUTHORS" 77 | Written by Caolan McMahon and other nodeunit contributors\. 78 | . 79 | .br 80 | Contributors list: \fIhttp://github\.com/caolan/nodeunit/contributors\fR\|\. 81 | . 82 | .SH "REPORTING BUGS" 83 | Report nodeunit bugs to \fIhttp://github\.com/caolan/nodeunit/issues\fR\|\. 84 | . 85 | .SH "COPYRIGHT" 86 | Copyright © 2010 Caolan McMahon\. 87 | . 88 | .br 89 | Nodeunit has been released under the MIT license: 90 | . 91 | .br 92 | \fIhttp://github\.com/caolan/nodeunit/raw/master/LICENSE\fR\|\. 93 | . 94 | .SH "SEE ALSO" 95 | node(1) 96 | -------------------------------------------------------------------------------- /buster/spec/module/test.module.extension.js: -------------------------------------------------------------------------------- 1 | /* 2 | Tests without using run(), meant to be used with AMD extension 3 | TODO run these with the AMD extension to avoid the error: 4 | Uncaught TypeError: Cannot read property 'tests' of undefined 5 | */ 6 | 7 | buster.spec.expose(); 8 | require.config({ 9 | baseUrl: 'js/' //MUST be the same as the modules you're testing 10 | }); 11 | 12 | define('single', ['module-one'], function(moduleOne){ 13 | describe('single dependency', function(){ 14 | it('should work', function () { 15 | expect(moduleOne.name).toEqual("Module One"); 16 | }); 17 | }); 18 | }); 19 | 20 | define('multiple', ['module-one', 'module-three'], function(moduleOne, moduleThree){ 21 | describe('multiple dependencies', function(){ 22 | it('should work', function () { 23 | expect(moduleOne.name).toEqual("Module One"); 24 | expect(moduleThree.name).toEqual("Module Three"); 25 | }); 26 | }); 27 | }); 28 | 29 | /* module-two depends on module-one */ 30 | define('own', ['module-two'], function(moduleTwo){ 31 | describe('module with own dependency', function(){ 32 | it('should work', function () { 33 | expect(moduleTwo.name).toEqual("Module Two"); 34 | expect(moduleTwo.dependencies[0].name).toEqual("Module One"); 35 | }); 36 | }); 37 | }); 38 | 39 | /* !! TEST BEING SKIPPED FOR SOME REASON !! */ 40 | define('using-plugins', [], function(){ 41 | describe('requirejs plugins', function(){ 42 | require.config({ 43 | paths: {'wrap': 'lib/wrap', 'text': 'lib/text'}, 44 | wrapJS: { 45 | 'pizza': { 46 | deps: ['cheese'], 47 | attach: 'pizza' 48 | } 49 | } 50 | }); 51 | require(['wrap!pizza'], function(pizza){ 52 | it('should work', function(){ 53 | expect(pizza.ingredients[0].name).toEqual("cheese"); 54 | expect(true).toEqual(false); //getting skipped still... :( 55 | }); 56 | }); 57 | }); 58 | }); 59 | 60 | /* USING REQUIRE() CAUSES ERROR: 61 | Uncaught exception: /bust...bundle-0.3.1.js:5691 Uncaught TypeError: Cannot read property 'tests' of undefined 62 | */ 63 | define('nested', ['require'], function(require){ 64 | describe('nested requires', function(){ 65 | require(['module-one'], function(moduleOne){ 66 | it('should work', function(){ 67 | expect(moduleOne.name).toEqual("Module One"); 68 | }); 69 | }); 70 | }); 71 | }); 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /buster/js/lib/wrap.js: -------------------------------------------------------------------------------- 1 | /* wrap.js RequireJS plugin 2 | * Copyright 2012, Dave Geddes (@geddesign) 3 | * wrap.js may be freely distributed under the MIT license. 4 | * version 0.2.1 5 | */ 6 | 7 | define(['text'], function (text) { 8 | return { 9 | buildMap:{}, 10 | load:function (name, req, load, config) { 11 | var _this = this, 12 | module = config.wrapJS && config.wrapJS[name], 13 | //use the `path` attribute if specified 14 | path = config.wrapJS[name].path || name; 15 | 16 | // if no module to load return early. 17 | if (!module) { 18 | return load(); 19 | } 20 | 21 | // load the wrapped script's dependencies 22 | req(module.deps || [], function () { 23 | //for the build, get the contents with the text plugin and store the contents of the script for the write() function 24 | if (config.isBuild) { 25 | text.get(req.toUrl(path), function (scriptContent) { 26 | _this.buildMap[name] = { 27 | content:scriptContent, 28 | deps:module.deps || [], 29 | attach:config.wrapJS[name].attach 30 | }; 31 | return load(); 32 | }); 33 | } 34 | else { 35 | // load the script now that dependencies are loaded. 36 | req([path], function () { 37 | // Attach property 38 | return load(getAttach(config.wrapJS[name].attach)); 39 | }); 40 | } 41 | }); 42 | }, 43 | 44 | /* write the output during the build, effectively turning the script into an AMD module */ 45 | write:function (pluginName, name, write) { 46 | var module = this.buildMap[name], 47 | deps = module.deps.map(toQuotes).join(', '), 48 | attach = module.attach, 49 | //immediate function that executes the attach function or returns the global 50 | writeAttach = "(function () {\n" + 51 | "var attach = "+attach+"; \n" + 52 | "return (typeof attach === 'function') ? attach.apply(this) : attach; \n" + 53 | "}())", 54 | output = '/* script wrapped by the wrap! plugin */\n'+ 55 | 'define("' + pluginName + '!' + name + '", ['+ deps + '], function(){ \n' + 56 | module.content + '\n' + 57 | 'return ' + writeAttach + ';\n' + 58 | '});\n'; 59 | write(output); 60 | } 61 | }; 62 | 63 | function toQuotes(val) { 64 | return "\"" + val + "\""; 65 | } 66 | 67 | // return the correct attached object 68 | function getAttach(attach){ 69 | return (typeof attach === 'function') ? attach.apply(this, arguments) : this[attach]; 70 | } 71 | }); -------------------------------------------------------------------------------- /buster/spec/module/test.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Tests using the run() syntax 3 | TODO find reliable way to test that ALL tests were run, none skipped 4 | TODO figure out why a single run() for multiple describes doesn't work 5 | */ 6 | 7 | 8 | buster.spec.expose(); 9 | require.config({ 10 | baseUrl: 'js/' //MUST be the same as the modules you're testing 11 | }); 12 | 13 | describe('run syntax with no dependencies', function(run) { 14 | require([], function() { 15 | run(function() { 16 | it('should work', function() { 17 | expect(true).toEqual(true); 18 | }); 19 | }); 20 | }); 21 | }); 22 | 23 | describe('single dependency', function(run) { 24 | require(['module-one'], function(moduleOne) { 25 | run(function() { 26 | it('should work', function() { 27 | expect(moduleOne.name).toEqual("Module One"); 28 | }); 29 | }); 30 | }); 31 | }); 32 | 33 | describe('multiple dependencies', function(run) { 34 | require(['module-one', 'module-three'], function(moduleOne, moduleThree) { 35 | run(function() { 36 | it('should work', function() { 37 | expect(moduleOne.name).toEqual("Module One"); 38 | expect(moduleThree.name).toEqual("Module Three"); 39 | }); 40 | }); 41 | }); 42 | }); 43 | 44 | /* module-two depends on module-one */ 45 | describe('module with own dependency', function(run) { 46 | require(['module-two'], function(moduleTwo) { 47 | run(function() { 48 | it('should work', function() { 49 | expect(moduleTwo.name).toEqual("Module Two"); 50 | expect(moduleTwo.dependencies[0].name).toEqual("Module One"); 51 | }); 52 | }); 53 | }); 54 | }); 55 | 56 | /* !! TEST BEING OCASSIONALLY SKIPPED FOR SOME REASON !! */ 57 | describe('requirejs plugins', function(run) { 58 | require.config({ 59 | paths: { 60 | 'wrap': 'lib/wrap', 61 | 'text': 'lib/text' 62 | }, 63 | wrapJS: { 64 | 'pizza': { 65 | deps: ['cheese'], 66 | attach: 'pizza' 67 | } 68 | } 69 | }); 70 | require(['wrap!pizza'], function(pizza) { 71 | run(function() { 72 | it('should work', function() { 73 | expect(true).toEqual(true); //sometimes skipped, sometimes not skipped 74 | expect(pizza.ingredients[0].name).toEqual("cheese"); 75 | }); 76 | }); 77 | }); 78 | }); 79 | 80 | describe('nested requires', function(run) { 81 | require(['require'], function(require) { 82 | require(['module-one'], function(moduleOne) { 83 | run(function(){ 84 | it('should work', function() { 85 | expect(moduleOne.name).toEqual("Module One"); 86 | }); 87 | }); 88 | }); 89 | }) 90 | }); -------------------------------------------------------------------------------- /jasmine/js/lib/jasmine-1.1.0.rc1/jasmine.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; 3 | } 4 | 5 | 6 | .jasmine_reporter a:visited, .jasmine_reporter a { 7 | color: #303; 8 | } 9 | 10 | .jasmine_reporter a:hover, .jasmine_reporter a:active { 11 | color: blue; 12 | } 13 | 14 | .run_spec { 15 | float:right; 16 | padding-right: 5px; 17 | font-size: .8em; 18 | text-decoration: none; 19 | } 20 | 21 | .jasmine_reporter { 22 | margin: 0 5px; 23 | } 24 | 25 | .banner { 26 | color: #303; 27 | background-color: #fef; 28 | padding: 5px; 29 | } 30 | 31 | .logo { 32 | float: left; 33 | font-size: 1.1em; 34 | padding-left: 5px; 35 | } 36 | 37 | .logo .version { 38 | font-size: .6em; 39 | padding-left: 1em; 40 | } 41 | 42 | .runner.running { 43 | background-color: yellow; 44 | } 45 | 46 | 47 | .options { 48 | text-align: right; 49 | font-size: .8em; 50 | } 51 | 52 | 53 | 54 | 55 | .suite { 56 | border: 1px outset gray; 57 | margin: 5px 0; 58 | padding-left: 1em; 59 | } 60 | 61 | .suite .suite { 62 | margin: 5px; 63 | } 64 | 65 | .suite.passed { 66 | background-color: #dfd; 67 | } 68 | 69 | .suite.failed { 70 | background-color: #fdd; 71 | } 72 | 73 | .spec { 74 | margin: 5px; 75 | padding-left: 1em; 76 | clear: both; 77 | } 78 | 79 | .spec.failed, .spec.passed, .spec.skipped { 80 | padding-bottom: 5px; 81 | border: 1px solid gray; 82 | } 83 | 84 | .spec.failed { 85 | background-color: #fbb; 86 | border-color: red; 87 | } 88 | 89 | .spec.passed { 90 | background-color: #bfb; 91 | border-color: green; 92 | } 93 | 94 | .spec.skipped { 95 | background-color: #bbb; 96 | } 97 | 98 | .messages { 99 | border-left: 1px dashed gray; 100 | padding-left: 1em; 101 | padding-right: 1em; 102 | } 103 | 104 | .passed { 105 | background-color: #cfc; 106 | display: none; 107 | } 108 | 109 | .failed { 110 | background-color: #fbb; 111 | } 112 | 113 | .skipped { 114 | color: #777; 115 | background-color: #eee; 116 | display: none; 117 | } 118 | 119 | 120 | /*.resultMessage {*/ 121 | /*white-space: pre;*/ 122 | /*}*/ 123 | 124 | .resultMessage span.result { 125 | display: block; 126 | line-height: 2em; 127 | color: black; 128 | } 129 | 130 | .resultMessage .mismatch { 131 | color: black; 132 | } 133 | 134 | .stackTrace { 135 | white-space: pre; 136 | font-size: .8em; 137 | margin-left: 10px; 138 | max-height: 5em; 139 | overflow: auto; 140 | border: 1px inset red; 141 | padding: 1em; 142 | background: #eef; 143 | } 144 | 145 | .finished-at { 146 | padding-left: 1em; 147 | font-size: .6em; 148 | } 149 | 150 | .show-passed .passed, 151 | .show-skipped .skipped { 152 | display: block; 153 | } 154 | 155 | 156 | #jasmine_content { 157 | position:fixed; 158 | right: 100%; 159 | } 160 | 161 | .runner { 162 | border: 1px solid gray; 163 | display: block; 164 | margin: 5px 0; 165 | padding: 2px 0 2px 10px; 166 | } 167 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/deps/ejs.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * EJS 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var sys = require('sys'); 13 | 14 | /** 15 | * Library version. 16 | */ 17 | 18 | exports.version = '0.0.3'; 19 | 20 | /** 21 | * Intermediate js cache. 22 | * 23 | * @type Object 24 | */ 25 | 26 | var cache = {}; 27 | 28 | /** 29 | * Clear intermediate js cache. 30 | * 31 | * @api public 32 | */ 33 | 34 | exports.clearCache = function(){ 35 | cache = {}; 36 | }; 37 | 38 | /** 39 | * Escape the given string of `html`. 40 | * 41 | * @param {String} html 42 | * @return {String} 43 | * @api private 44 | */ 45 | 46 | function escape(html){ 47 | return String(html) 48 | .replace(/&(?!\w+;)/g, '&') 49 | .replace(//g, '>') 51 | .replace(/"/g, '"'); 52 | } 53 | 54 | /** 55 | * Parse the given `str` of ejs, returning the function body. 56 | * 57 | * @param {String} str 58 | * @return {String} 59 | * @api public 60 | */ 61 | 62 | var parse = exports.parse = function(str){ 63 | return 'var buf = [];\n' 64 | + "with (locals) {\nbuf.push('" 65 | + String(str) 66 | .replace(/[\r\t]/g, " ") 67 | .replace(/\n/g, "\\n") 68 | .split("<%").join("\t") 69 | .replace(/((^|%>)[^\t]*)'/g, "$1\r") 70 | .replace(/\t=(.*?)%>/g, "', escape($1) ,'") 71 | .replace(/\t-(.*?)%>/g, "', $1 ,'") 72 | .split("\t").join("');") 73 | .split("%>").join("buf.push('") 74 | .split("\r").join("\\'") 75 | + "');\n}\nreturn buf.join('');"; 76 | }; 77 | 78 | /** 79 | * Compile the given `str` of ejs into a `Function`. 80 | * 81 | * @param {String} str 82 | * @param {Object} options 83 | * @return {Function} 84 | * @api public 85 | */ 86 | 87 | var compile = exports.compile = function(str, options){ 88 | if (options.debug) sys.puts(parse(str)); 89 | return new Function('locals, escape', parse(str)); 90 | }; 91 | 92 | /** 93 | * Render the given `str` of ejs. 94 | * 95 | * Options: 96 | * 97 | * - `locals` Local variables object 98 | * - `cache` Compiled functions are cached, requires `filename` 99 | * - `filename` Used by `cache` to key caches 100 | * - `context|scope` Function execution context 101 | * - `debug` Output generated function body 102 | * 103 | * @param {String} str 104 | * @param {Object} options 105 | * @return {String} 106 | * @api public 107 | */ 108 | 109 | exports.render = function(str, options){ 110 | var fn, 111 | options = options || {}; 112 | if (options.cache) { 113 | if (options.filename) { 114 | fn = cache[options.filename] = compile(str, options); 115 | } else { 116 | throw new Error('"cache" option requires "filename".'); 117 | } 118 | } else { 119 | fn = compile(str, options); 120 | } 121 | return fn.call( 122 | options.context || options.scope, 123 | options.locals || {}, 124 | escape); 125 | }; -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/lib/reporters/skip_passed.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Nodeunit 3 | * Copyright (c) 2010 Caolan McMahon 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Module dependencies 9 | */ 10 | 11 | var nodeunit = require('../nodeunit'), 12 | utils = require('../utils'), 13 | fs = require('fs'), 14 | path = require('path'), 15 | AssertionError = require('assert').AssertionError; 16 | 17 | /** 18 | * Reporter info string 19 | */ 20 | 21 | exports.info = "Skip passed tests output"; 22 | 23 | /** 24 | * Run all tests within each module, reporting the results to the command-line. 25 | * 26 | * @param {Array} files 27 | * @api public 28 | */ 29 | 30 | exports.run = function (files, options) { 31 | 32 | if (!options) { 33 | // load default options 34 | var content = fs.readFileSync( 35 | __dirname + '/../../bin/nodeunit.json', 'utf8' 36 | ); 37 | options = JSON.parse(content); 38 | } 39 | 40 | var error = function (str) { 41 | return options.error_prefix + str + options.error_suffix; 42 | }; 43 | var ok = function (str) { 44 | return options.ok_prefix + str + options.ok_suffix; 45 | }; 46 | var bold = function (str) { 47 | return options.bold_prefix + str + options.bold_suffix; 48 | }; 49 | var assertion_message = function (str) { 50 | return options.assertion_prefix + str + options.assertion_suffix; 51 | }; 52 | 53 | var start = new Date().getTime(); 54 | var paths = files.map(function (p) { 55 | return path.join(process.cwd(), p); 56 | }); 57 | 58 | nodeunit.runFiles(paths, { 59 | testspec: options.testspec, 60 | moduleStart: function (name) { 61 | console.log('\n' + bold(name)); 62 | }, 63 | testDone: function (name, assertions) { 64 | if (assertions.failures()) { 65 | console.log(error('✖ ' + name) + '\n'); 66 | assertions.forEach(function (a) { 67 | if (a.failed()) { 68 | a = utils.betterErrors(a); 69 | if (a.error instanceof AssertionError && a.message) { 70 | console.log( 71 | 'Assertion Message: ' + assertion_message(a.message) 72 | ); 73 | } 74 | console.log(a.error.stack + '\n'); 75 | } 76 | }); 77 | } 78 | }, 79 | moduleDone: function (name, assertions) { 80 | if (!assertions.failures()) { 81 | console.log('✔ all tests passed'); 82 | } 83 | else { 84 | console.log(error('✖ some tests failed')); 85 | } 86 | }, 87 | done: function (assertions) { 88 | var end = new Date().getTime(); 89 | var duration = end - start; 90 | if (assertions.failures()) { 91 | console.log( 92 | '\n' + bold(error('FAILURES: ')) + assertions.failures() + 93 | '/' + assertions.length + ' assertions failed (' + 94 | assertions.duration + 'ms)' 95 | ); 96 | } 97 | else { 98 | console.log( 99 | '\n' + bold(ok('OK: ')) + assertions.length + 100 | ' assertions (' + assertions.duration + 'ms)' 101 | ); 102 | } 103 | } 104 | }); 105 | }; 106 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/lib/reporters/minimal.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Nodeunit 3 | * Copyright (c) 2010 Caolan McMahon 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Module dependencies 9 | */ 10 | 11 | var nodeunit = require('../nodeunit'), 12 | utils = require('../utils'), 13 | fs = require('fs'), 14 | path = require('path'), 15 | AssertionError = require('assert').AssertionError; 16 | 17 | /** 18 | * Reporter info string 19 | */ 20 | 21 | exports.info = "Pretty minimal output"; 22 | 23 | /** 24 | * Run all tests within each module, reporting the results to the command-line. 25 | * 26 | * @param {Array} files 27 | * @api public 28 | */ 29 | 30 | exports.run = function (files, options) { 31 | 32 | if (!options) { 33 | // load default options 34 | var content = fs.readFileSync( 35 | __dirname + '/../../bin/nodeunit.json', 'utf8' 36 | ); 37 | options = JSON.parse(content); 38 | } 39 | 40 | var red = function (str) { 41 | return options.error_prefix + str + options.error_suffix; 42 | }; 43 | var green = function (str) { 44 | return options.ok_prefix + str + options.ok_suffix; 45 | }; 46 | var magenta = function (str) { 47 | return options.assertion_prefix + str + options.assertion_suffix; 48 | }; 49 | var bold = function (str) { 50 | return options.bold_prefix + str + options.bold_suffix; 51 | }; 52 | 53 | var start = new Date().getTime(); 54 | var paths = files.map(function (p) { 55 | return path.join(process.cwd(), p); 56 | }); 57 | 58 | nodeunit.runFiles(paths, { 59 | testspec: options.testspec, 60 | moduleStart: function (name) { 61 | process.stdout.write(bold(name) + ': '); 62 | }, 63 | moduleDone: function (name, assertions) { 64 | console.log(''); 65 | if (assertions.failures()) { 66 | assertions.forEach(function (a) { 67 | if (a.failed()) { 68 | a = utils.betterErrors(a); 69 | if (a.error instanceof AssertionError && a.message) { 70 | console.log( 71 | 'Assertion in test ' + bold(a.testname) + ': ' + 72 | magenta(a.message) 73 | ); 74 | } 75 | console.log(a.error.stack + '\n'); 76 | } 77 | }); 78 | } 79 | 80 | }, 81 | testStart: function () { 82 | }, 83 | testDone: function (name, assertions) { 84 | if (!assertions.failures()) { 85 | process.stdout.write('.'); 86 | } 87 | else { 88 | process.stdout.write(red('F')); 89 | assertions.forEach(function (assertion) { 90 | assertion.testname = name; 91 | }); 92 | } 93 | }, 94 | done: function (assertions) { 95 | var end = new Date().getTime(); 96 | var duration = end - start; 97 | if (assertions.failures()) { 98 | console.log( 99 | '\n' + bold(red('FAILURES: ')) + assertions.failures() + 100 | '/' + assertions.length + ' assertions failed (' + 101 | assertions.duration + 'ms)' 102 | ); 103 | } 104 | else { 105 | console.log( 106 | '\n' + bold(green('OK: ')) + assertions.length + 107 | ' assertions (' + assertions.duration + 'ms)' 108 | ); 109 | } 110 | } 111 | }); 112 | }; 113 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/lib/reporters/html.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Nodeunit 3 | * Copyright (c) 2010 Caolan McMahon 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Module dependencies 9 | */ 10 | 11 | var nodeunit = require('../nodeunit'), 12 | utils = require('../utils'), 13 | fs = require('fs'), 14 | path = require('path'), 15 | AssertionError = require('assert').AssertionError; 16 | 17 | /** 18 | * Reporter info string 19 | */ 20 | 21 | exports.info = "Report tests result as HTML"; 22 | 23 | /** 24 | * Run all tests within each module, reporting the results to the command-line. 25 | * 26 | * @param {Array} files 27 | * @api public 28 | */ 29 | 30 | exports.run = function (files, options) { 31 | 32 | var start = new Date().getTime(); 33 | var paths = files.map(function (p) { 34 | return path.join(process.cwd(), p); 35 | }); 36 | 37 | console.log(''); 38 | console.log(''); 39 | console.log(''); 40 | console.log(''); 54 | console.log(''); 55 | console.log(''); 56 | nodeunit.runFiles(paths, { 57 | testspec: options.testspec, 58 | moduleStart: function (name) { 59 | console.log('

    ' + name + '

    '); 60 | console.log('
      '); 61 | }, 62 | testDone: function (name, assertions) { 63 | if (!assertions.failures()) { 64 | console.log('
    1. ' + name + '
    2. '); 65 | } 66 | else { 67 | console.log('
    3. ' + name); 68 | assertions.forEach(function (a) { 69 | if (a.failed()) { 70 | a = utils.betterErrors(a); 71 | if (a.error instanceof AssertionError && a.message) { 72 | console.log('
      ' + 73 | 'Assertion Message: ' + a.message + 74 | '
      '); 75 | } 76 | console.log('
      ');
       77 |                         console.log(a.error.stack);
       78 |                         console.log('
      '); 79 | } 80 | }); 81 | console.log('
    4. '); 82 | } 83 | }, 84 | moduleDone: function () { 85 | console.log('
    '); 86 | }, 87 | done: function (assertions) { 88 | var end = new Date().getTime(); 89 | var duration = end - start; 90 | if (assertions.failures()) { 91 | console.log( 92 | '

    FAILURES: ' + assertions.failures() + 93 | '/' + assertions.length + ' assertions failed (' + 94 | assertions.duration + 'ms)

    ' 95 | ); 96 | } 97 | else { 98 | console.log( 99 | '

    OK: ' + assertions.length + 100 | ' assertions (' + assertions.duration + 'ms)

    ' 101 | ); 102 | } 103 | console.log(''); 104 | } 105 | }); 106 | 107 | }; 108 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/test-failing-callbacks.js: -------------------------------------------------------------------------------- 1 | var nodeunit = require('../lib/nodeunit'); 2 | 3 | 4 | exports.testFailingLog = function (test) { 5 | test.expect(3); 6 | 7 | // this is meant to bubble to the top, and will be ignored for the purposes 8 | // of testing: 9 | var ignored_error = new Error('ignore this callback error'); 10 | var err_handler = function (err) { 11 | if (err && err.message !== ignored_error.message) { 12 | throw err; 13 | } 14 | }; 15 | process.addListener('uncaughtException', err_handler); 16 | 17 | // A failing callback should not affect the test outcome 18 | var testfn = function (test) { 19 | test.ok(true, 'test.ok'); 20 | test.done(); 21 | }; 22 | nodeunit.runTest('testname', testfn, { 23 | log: function (assertion) { 24 | test.ok(true, 'log called'); 25 | throw ignored_error; 26 | }, 27 | testDone: function (name, assertions) { 28 | test.equals(assertions.failures(), 0, 'failures'); 29 | test.equals(assertions.length, 1, 'total'); 30 | process.removeListener('uncaughtException', err_handler); 31 | } 32 | }, test.done); 33 | }; 34 | 35 | exports.testFailingTestDone = function (test) { 36 | test.expect(2); 37 | 38 | var ignored_error = new Error('ignore this callback error'); 39 | var err_handler = function (err) { 40 | if (err && err.message !== ignored_error.message) { 41 | throw err; 42 | } 43 | }; 44 | process.addListener('uncaughtException', err_handler); 45 | 46 | // A failing callback should not affect the test outcome 47 | var testfn = function (test) { 48 | test.done(); 49 | }; 50 | nodeunit.runTest('testname', testfn, { 51 | log: function (assertion) { 52 | test.ok(false, 'log should not be called'); 53 | }, 54 | testDone: function (name, assertions) { 55 | test.equals(assertions.failures(), 0, 'failures'); 56 | test.equals(assertions.length, 0, 'total'); 57 | process.nextTick(function () { 58 | process.removeListener('uncaughtException', err_handler); 59 | test.done(); 60 | }); 61 | throw ignored_error; 62 | } 63 | }, function () {}); 64 | }; 65 | 66 | exports.testAssertionObj = function (test) { 67 | test.expect(4); 68 | var testfn = function (test) { 69 | test.ok(true, 'ok true'); 70 | test.done(); 71 | }; 72 | nodeunit.runTest('testname', testfn, { 73 | log: function (assertion) { 74 | test.ok(assertion.passed() === true, 'assertion.passed'); 75 | test.ok(assertion.failed() === false, 'assertion.failed'); 76 | }, 77 | testDone: function (name, assertions) { 78 | test.equals(assertions.failures(), 0, 'failures'); 79 | test.equals(assertions.length, 1, 'total'); 80 | } 81 | }, test.done); 82 | }; 83 | 84 | exports.testLogOptional = function (test) { 85 | test.expect(2); 86 | var testfn = function (test) { 87 | test.ok(true, 'ok true'); 88 | test.done(); 89 | }; 90 | nodeunit.runTest('testname', testfn, { 91 | testDone: function (name, assertions) { 92 | test.equals(assertions.failures(), 0, 'failures'); 93 | test.equals(assertions.length, 1, 'total'); 94 | } 95 | }, test.done); 96 | }; 97 | 98 | exports.testExpectWithFailure = function (test) { 99 | test.expect(3); 100 | var testfn = function (test) { 101 | test.expect(1); 102 | test.ok(false, 'test.ok'); 103 | test.done(); 104 | }; 105 | nodeunit.runTest('testname', testfn, { 106 | log: function (assertion) { 107 | test.equals(assertion.method, 'ok', 'assertion.method'); 108 | }, 109 | testDone: function (name, assertions) { 110 | test.equals(assertions.failures(), 1, 'failures'); 111 | test.equals(assertions.length, 1, 'total'); 112 | } 113 | }, test.done); 114 | }; 115 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/lib/reporters/default.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Nodeunit 3 | * Copyright (c) 2010 Caolan McMahon 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Module dependencies 9 | */ 10 | 11 | var nodeunit = require('../nodeunit'), 12 | utils = require('../utils'), 13 | fs = require('fs'), 14 | track = require('../track'), 15 | path = require('path'); 16 | AssertionError = require('../assert').AssertionError; 17 | 18 | /** 19 | * Reporter info string 20 | */ 21 | 22 | exports.info = "Default tests reporter"; 23 | 24 | 25 | /** 26 | * Run all tests within each module, reporting the results to the command-line. 27 | * 28 | * @param {Array} files 29 | * @api public 30 | */ 31 | 32 | exports.run = function (files, options) { 33 | 34 | if (!options) { 35 | // load default options 36 | var content = fs.readFileSync( 37 | __dirname + '/../../bin/nodeunit.json', 'utf8' 38 | ); 39 | options = JSON.parse(content); 40 | } 41 | 42 | var error = function (str) { 43 | return options.error_prefix + str + options.error_suffix; 44 | }; 45 | var ok = function (str) { 46 | return options.ok_prefix + str + options.ok_suffix; 47 | }; 48 | var bold = function (str) { 49 | return options.bold_prefix + str + options.bold_suffix; 50 | }; 51 | var assertion_message = function (str) { 52 | return options.assertion_prefix + str + options.assertion_suffix; 53 | }; 54 | 55 | var start = new Date().getTime(); 56 | var paths = files.map(function (p) { 57 | return path.join(process.cwd(), p); 58 | }); 59 | var tracker = track.createTracker(function (tracker) { 60 | if (tracker.unfinished()) { 61 | console.log(''); 62 | console.log(error(bold( 63 | 'FAILURES: Undone tests (or their setups/teardowns): ' 64 | ))); 65 | var names = tracker.names(); 66 | for (var i = 0; i < names.length; i += 1) { 67 | console.log('- ' + names[i]); 68 | } 69 | console.log(''); 70 | console.log('To fix this, make sure all tests call test.done()'); 71 | process.reallyExit(tracker.unfinished()); 72 | } 73 | }); 74 | 75 | nodeunit.runFiles(paths, { 76 | testspec: options.testspec, 77 | moduleStart: function (name) { 78 | console.log('\n' + bold(name)); 79 | }, 80 | testDone: function (name, assertions) { 81 | tracker.remove(name); 82 | 83 | if (!assertions.failures()) { 84 | console.log('✔ ' + name); 85 | } 86 | else { 87 | console.log(error('✖ ' + name) + '\n'); 88 | assertions.forEach(function (a) { 89 | if (a.failed()) { 90 | a = utils.betterErrors(a); 91 | if (a.error instanceof AssertionError && a.message) { 92 | console.log( 93 | 'Assertion Message: ' + 94 | assertion_message(a.message) 95 | ); 96 | } 97 | console.log(a.error.stack + '\n'); 98 | } 99 | }); 100 | } 101 | }, 102 | done: function (assertions, end) { 103 | var end = end || new Date().getTime(); 104 | var duration = end - start; 105 | if (assertions.failures()) { 106 | console.log( 107 | '\n' + bold(error('FAILURES: ')) + assertions.failures() + 108 | '/' + assertions.length + ' assertions failed (' + 109 | assertions.duration + 'ms)' 110 | ); 111 | } 112 | else { 113 | console.log( 114 | '\n' + bold(ok('OK: ')) + assertions.length + 115 | ' assertions (' + assertions.duration + 'ms)' 116 | ); 117 | } 118 | }, 119 | testStart: function(name) { 120 | tracker.put(name); 121 | } 122 | }); 123 | }; 124 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/lib/reporters/browser.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Nodeunit 3 | * Copyright (c) 2010 Caolan McMahon 4 | * MIT Licensed 5 | * 6 | * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! 7 | * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build. 8 | * Only code on that line will be removed, its mostly to avoid requiring code 9 | * that is node specific 10 | */ 11 | 12 | 13 | /** 14 | * NOTE: this test runner is not listed in index.js because it cannot be 15 | * used with the command-line tool, only inside the browser. 16 | */ 17 | 18 | 19 | /** 20 | * Reporter info string 21 | */ 22 | 23 | exports.info = "Browser-based test reporter"; 24 | 25 | 26 | /** 27 | * Run all tests within each module, reporting the results 28 | * 29 | * @param {Array} files 30 | * @api public 31 | */ 32 | 33 | exports.run = function (modules, options) { 34 | var start = new Date().getTime(); 35 | 36 | function setText(el, txt) { 37 | if ('innerText' in el) { 38 | el.innerText = txt; 39 | } 40 | else if ('textContent' in el){ 41 | el.textContent = txt; 42 | } 43 | } 44 | 45 | function getOrCreate(tag, id) { 46 | var el = document.getElementById(id); 47 | if (!el) { 48 | el = document.createElement(tag); 49 | el.id = id; 50 | document.body.appendChild(el); 51 | } 52 | return el; 53 | }; 54 | 55 | var header = getOrCreate('h1', 'nodeunit-header'); 56 | var banner = getOrCreate('h2', 'nodeunit-banner'); 57 | var userAgent = getOrCreate('h2', 'nodeunit-userAgent'); 58 | var tests = getOrCreate('ol', 'nodeunit-tests'); 59 | var result = getOrCreate('p', 'nodeunit-testresult'); 60 | 61 | setText(userAgent, navigator.userAgent); 62 | 63 | nodeunit.runModules(modules, { 64 | moduleStart: function (name) { 65 | /*var mheading = document.createElement('h2'); 66 | mheading.innerText = name; 67 | results.appendChild(mheading); 68 | module = document.createElement('ol'); 69 | results.appendChild(module);*/ 70 | }, 71 | testDone: function (name, assertions) { 72 | var test = document.createElement('li'); 73 | var strong = document.createElement('strong'); 74 | strong.innerHTML = name + ' (' + 75 | '' + assertions.failures() + ', ' + 76 | '' + assertions.passes() + ', ' + 77 | assertions.length + 78 | ')'; 79 | test.className = assertions.failures() ? 'fail': 'pass'; 80 | test.appendChild(strong); 81 | 82 | var aList = document.createElement('ol'); 83 | aList.style.display = 'none'; 84 | test.onclick = function () { 85 | var d = aList.style.display; 86 | aList.style.display = (d == 'none') ? 'block': 'none'; 87 | }; 88 | for (var i=0; i' + (a.error.stack || a.error) + ''; 94 | li.className = 'fail'; 95 | } 96 | else { 97 | li.innerHTML = a.message || a.method || 'no message'; 98 | li.className = 'pass'; 99 | } 100 | aList.appendChild(li); 101 | } 102 | test.appendChild(aList); 103 | tests.appendChild(test); 104 | }, 105 | done: function (assertions) { 106 | var end = new Date().getTime(); 107 | var duration = end - start; 108 | 109 | var failures = assertions.failures(); 110 | banner.className = failures ? 'fail': 'pass'; 111 | 112 | result.innerHTML = 'Tests completed in ' + duration + 113 | ' milliseconds.
    ' + 114 | assertions.passes() + ' assertions of ' + 115 | '' + assertions.length + ' passed, ' + 116 | assertions.failures() + ' failed.'; 117 | } 118 | }); 119 | }; 120 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/bin/nodeunit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var 4 | fs = require('fs'), 5 | path = require('path'); 6 | 7 | // TODO: remove this when https://github.com/joyent/node/pull/1312 8 | // lands in core. 9 | // 10 | // Until then, use console.log from npm (https://gist.github.com/1077544) 11 | require('../deps/console.log'); 12 | 13 | require.paths.push(process.cwd()); 14 | var args = process.ARGV.slice(2); 15 | 16 | var files = []; 17 | 18 | var testrunner, 19 | config_file, 20 | config_param_found = false, 21 | output_param_found = false, 22 | reporter_file = 'default', 23 | reporter_param_found = false, 24 | testspec_param_found = false; 25 | 26 | var usage = "Usage: nodeunit [options] testmodule1.js testfolder [...] \n" + 27 | "Options:\n\n" + 28 | " --config FILE the path to a JSON file with options\n" + 29 | " --reporter FILE optional path to a reporter file to customize the output\n" + 30 | " --list-reporters list available build-in reporters\n" + 31 | " -t name, specify a test to run\n" + 32 | " -h, --help display this help and exit\n" + 33 | " -v, --version output version information and exit"; 34 | 35 | 36 | // load default options 37 | var content = fs.readFileSync(__dirname + '/nodeunit.json', 'utf8'); 38 | var options = JSON.parse(content); 39 | 40 | // a very basic pseudo --options parser 41 | args.forEach(function (arg) { 42 | if (arg.slice(0, 9) === "--config=") { 43 | config_file = arg.slice(9); 44 | } else if (arg === '--config') { 45 | config_param_found = true; 46 | } else if (config_param_found) { 47 | config_file = arg; 48 | config_param_found = false; 49 | } else if (arg.slice(0, 9) === "--output=") { 50 | options.output = arg.slice(9); 51 | } else if (arg === '--output') { 52 | output_param_found = true; 53 | } else if (output_param_found) { 54 | options.output = arg; 55 | output_param_found = false; 56 | } else if (arg.slice(0, 11) === "--reporter=") { 57 | reporter_file = arg.slice(11); 58 | } else if (arg === '--reporter') { 59 | reporter_param_found = true; 60 | } else if (reporter_param_found) { 61 | reporter_file = arg; 62 | reporter_param_found = false; 63 | } else if (arg === '-t') { 64 | testspec_param_found = true; 65 | } else if (testspec_param_found) { 66 | options.testspec = arg; 67 | testspec_param_found = false; 68 | } else if (arg === '--list-reporters') { 69 | var reporters = fs.readdirSync(__dirname + '/../lib/reporters'); 70 | reporters = reporters.filter(function (reporter_file) { 71 | return (/\.js$/).test(reporter_file); 72 | }).map(function (reporter_file) { 73 | return reporter_file.replace(/\.js$/, ''); 74 | }).filter(function (reporter_file) { 75 | return reporter_file !== 'index'; 76 | }); 77 | console.log('Build-in reporters: '); 78 | reporters.forEach(function (reporter_file) { 79 | var reporter = require('../lib/reporters/' + reporter_file); 80 | console.log(' * ' + reporter_file + (reporter.info ? ': ' + reporter.info : '')); 81 | }); 82 | process.exit(0); 83 | } else if ((arg === '-v') || (arg === '--version')) { 84 | var content = fs.readFileSync(__dirname + '/../package.json', 'utf8'); 85 | var pkg = JSON.parse(content); 86 | console.log(pkg.version); 87 | process.exit(0); 88 | } else if ((arg === '-h') || (arg === '--help')) { 89 | console.log(usage); 90 | process.exit(0); 91 | } else { 92 | files.push(arg); 93 | } 94 | }); 95 | 96 | if (files.length === 0) { 97 | console.log('Files required.'); 98 | console.log(usage); 99 | process.exit(1); 100 | } 101 | 102 | if (config_file) { 103 | content = fs.readFileSync(config_file, 'utf8'); 104 | var custom_options = JSON.parse(content); 105 | 106 | for (var option in custom_options) { 107 | if (typeof option === 'string') { 108 | options[option] = custom_options[option]; 109 | } 110 | } 111 | } 112 | 113 | var builtin_reporters = require(__dirname + '/../lib/reporters'); 114 | if (reporter_file in builtin_reporters) { 115 | testrunner = builtin_reporters[reporter_file]; 116 | } 117 | else { 118 | testrunner = require(reporter_file); 119 | } 120 | testrunner.run(files, options); 121 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/Makefile: -------------------------------------------------------------------------------- 1 | PACKAGE = nodeunit 2 | NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node) 3 | 4 | PREFIX ?= /usr/local 5 | BINDIR ?= $(PREFIX)/bin 6 | DATADIR ?= $(PREFIX)/share 7 | MANDIR ?= $(PREFIX)/share/man 8 | LIBDIR ?= $(PREFIX)/lib 9 | NODEJSLIBDIR ?= $(LIBDIR)/$(NODEJS) 10 | 11 | BUILDDIR = dist 12 | 13 | DOCS = $(shell find doc -name '*.md' \ 14 | |sed 's|.md|.1|g' \ 15 | |sed 's|doc/|man1/|g' \ 16 | ) 17 | 18 | 19 | $(shell if [ ! -d $(BUILDDIR) ]; then mkdir $(BUILDDIR); fi) 20 | 21 | all: build doc 22 | 23 | browser: 24 | # super hacky build script for browser version! 25 | mkdir -p $(BUILDDIR)/browser 26 | rm -rf $(BUILDDIR)/browser/* 27 | # build browser version of nodeunit.js 28 | cat share/license.js >> $(BUILDDIR)/browser/nodeunit.js 29 | echo "nodeunit = (function(){" >> $(BUILDDIR)/browser/nodeunit.js 30 | cat deps/json2.js >> $(BUILDDIR)/browser/nodeunit.js 31 | # make assert global 32 | echo "var assert = this.assert = {};" >> $(BUILDDIR)/browser/nodeunit.js 33 | echo "var types = {};" >> $(BUILDDIR)/browser/nodeunit.js 34 | echo "var core = {};" >> $(BUILDDIR)/browser/nodeunit.js 35 | echo "var nodeunit = {};" >> $(BUILDDIR)/browser/nodeunit.js 36 | echo "var reporter = {};" >> $(BUILDDIR)/browser/nodeunit.js 37 | cat deps/async.js >> $(BUILDDIR)/browser/nodeunit.js 38 | echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js 39 | cat lib/assert.js >> $(BUILDDIR)/browser/nodeunit.js 40 | echo "})(assert);" >> $(BUILDDIR)/browser/nodeunit.js 41 | echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js 42 | cat lib/types.js >> $(BUILDDIR)/browser/nodeunit.js 43 | echo "})(types);" >> $(BUILDDIR)/browser/nodeunit.js 44 | echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js 45 | cat lib/core.js >> $(BUILDDIR)/browser/nodeunit.js 46 | echo "})(core);" >> $(BUILDDIR)/browser/nodeunit.js 47 | echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js 48 | cat lib/reporters/browser.js >> $(BUILDDIR)/browser/nodeunit.js 49 | echo "})(reporter);" >> $(BUILDDIR)/browser/nodeunit.js 50 | echo "nodeunit = core;" >> $(BUILDDIR)/browser/nodeunit.js 51 | echo "nodeunit.assert = assert;" >> $(BUILDDIR)/browser/nodeunit.js 52 | echo "nodeunit.reporter = reporter;" >> $(BUILDDIR)/browser/nodeunit.js 53 | echo "nodeunit.run = reporter.run;" >> $(BUILDDIR)/browser/nodeunit.js 54 | echo "return nodeunit; })();" >> $(BUILDDIR)/browser/nodeunit.js 55 | sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/nodeunit.js 56 | # copy nodeunit.css 57 | cp share/nodeunit.css $(BUILDDIR)/browser/nodeunit.css 58 | # create nodeunit.min.js 59 | uglifyjs $(BUILDDIR)/browser/nodeunit.js > $(BUILDDIR)/browser/nodeunit.min.js 60 | # create test scripts 61 | mkdir -p $(BUILDDIR)/browser/test 62 | cp test/test.html $(BUILDDIR)/browser/test/test.html 63 | # test-base.js 64 | echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-base.js 65 | cat test/test-base.js >> $(BUILDDIR)/browser/test/test-base.js 66 | echo "})(this.test_base = {});" >> $(BUILDDIR)/browser/test/test-base.js 67 | sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-base.js 68 | # test-runmodule.js 69 | echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-runmodule.js 70 | cat test/test-runmodule.js >> $(BUILDDIR)/browser/test/test-runmodule.js 71 | echo "})(this.test_runmodule = {});" >> $(BUILDDIR)/browser/test/test-runmodule.js 72 | sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-runmodule.js 73 | # test-runtest.js 74 | echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-runtest.js 75 | cat test/test-runtest.js >> $(BUILDDIR)/browser/test/test-runtest.js 76 | echo "})(this.test_runtest = {});" >> $(BUILDDIR)/browser/test/test-runtest.js 77 | sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-runtest.js 78 | # test-testcase.js 79 | echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-testcase.js 80 | cat test/test-testcase.js >> $(BUILDDIR)/browser/test/test-testcase.js 81 | echo "})(this.test_testcase = {});" >> $(BUILDDIR)/browser/test/test-testcase.js 82 | sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-testcase.js 83 | # copy nodeunit.js to dist/browser/test to make it easier for me to host and 84 | # run on windows VMs with IE 85 | cp $(BUILDDIR)/browser/nodeunit.js $(BUILDDIR)/browser/test/nodeunit.js 86 | cp $(BUILDDIR)/browser/nodeunit.css $(BUILDDIR)/browser/test/nodeunit.css 87 | 88 | build: stamp-build 89 | 90 | stamp-build: $(wildcard deps/* lib/*.js) 91 | touch $@; 92 | mkdir -p $(BUILDDIR)/nodeunit 93 | cp -R bin deps index.js lib package.json $(BUILDDIR)/nodeunit 94 | printf '#!/bin/sh\n$(NODEJS) $(NODEJSLIBDIR)/$(PACKAGE)/bin/nodeunit $$@' > $(BUILDDIR)/nodeunit.sh 95 | 96 | test: 97 | $(NODEJS) ./bin/nodeunit test 98 | 99 | install: build 100 | install -d $(NODEJSLIBDIR) 101 | cp -a $(BUILDDIR)/nodeunit $(NODEJSLIBDIR) 102 | install -m 0755 $(BUILDDIR)/nodeunit.sh $(BINDIR)/nodeunit 103 | install -d $(MANDIR)/man1/ 104 | cp -a man1/nodeunit.1 $(MANDIR)/man1/ 105 | 106 | uninstall: 107 | rm -rf $(NODEJSLIBDIR)/nodeunit $(NODEJSLIBDIR)/nodeunit.js $(BINDIR)/nodeunit 108 | rm -rf $(MANDIR)/man1/nodeunit.1 109 | 110 | clean: 111 | rm -rf $(BUILDDIR) stamp-build 112 | 113 | lint: 114 | nodelint --config nodelint.cfg ./index.js ./bin/nodeunit ./bin/nodeunit.json ./lib/*.js ./lib/reporters/*.js ./test/*.js 115 | 116 | doc: man1 $(DOCS) 117 | @true 118 | 119 | man1: 120 | @if ! test -d man1 ; then mkdir -p man1 ; fi 121 | 122 | # use `npm install ronn` for this to work. 123 | man1/%.1: doc/%.md 124 | ronn --roff $< > $@ 125 | 126 | .PHONY: browser test install uninstall build all 127 | -------------------------------------------------------------------------------- /qunit/js/lib/qunit.css: -------------------------------------------------------------------------------- 1 | /** 2 | * QUnit - A JavaScript Unit Testing Framework 3 | * 4 | * http://docs.jquery.com/QUnit 5 | * 6 | * Copyright (c) 2011 John Resig, Jörn Zaefferer 7 | * Dual licensed under the MIT (MIT-LICENSE.txt) 8 | * or GPL (GPL-LICENSE.txt) licenses. 9 | * Pulled Live from Git Fri Sep 9 21:15:01 UTC 2011 10 | * Last Commit: ecf1ffd3be78969bc4739c3b237d12780454726e 11 | */ 12 | 13 | /** Font Family and Sizes */ 14 | 15 | #qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { 16 | font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; 17 | } 18 | 19 | #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } 20 | #qunit-tests { font-size: smaller; } 21 | 22 | 23 | /** Resets */ 24 | 25 | #qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult { 26 | margin: 0; 27 | padding: 0; 28 | } 29 | 30 | 31 | /** Header */ 32 | 33 | #qunit-header { 34 | padding: 0.5em 0 0.5em 1em; 35 | 36 | color: #8699a4; 37 | background-color: #0d3349; 38 | 39 | font-size: 1.5em; 40 | line-height: 1em; 41 | font-weight: normal; 42 | 43 | border-radius: 15px 15px 0 0; 44 | -moz-border-radius: 15px 15px 0 0; 45 | -webkit-border-top-right-radius: 15px; 46 | -webkit-border-top-left-radius: 15px; 47 | } 48 | 49 | #qunit-header a { 50 | text-decoration: none; 51 | color: #c2ccd1; 52 | } 53 | 54 | #qunit-header a:hover, 55 | #qunit-header a:focus { 56 | color: #fff; 57 | } 58 | 59 | #qunit-banner { 60 | height: 5px; 61 | } 62 | 63 | #qunit-testrunner-toolbar { 64 | padding: 0.5em 0 0.5em 2em; 65 | color: #5E740B; 66 | background-color: #eee; 67 | } 68 | 69 | #qunit-userAgent { 70 | padding: 0.5em 0 0.5em 2.5em; 71 | background-color: #2b81af; 72 | color: #fff; 73 | text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; 74 | } 75 | 76 | 77 | /** Tests: Pass/Fail */ 78 | 79 | #qunit-tests { 80 | list-style-position: inside; 81 | } 82 | 83 | #qunit-tests li { 84 | padding: 0.4em 0.5em 0.4em 2.5em; 85 | border-bottom: 1px solid #fff; 86 | list-style-position: inside; 87 | } 88 | 89 | #qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { 90 | display: none; 91 | } 92 | 93 | #qunit-tests li strong { 94 | cursor: pointer; 95 | } 96 | 97 | #qunit-tests li a { 98 | padding: 0.5em; 99 | color: #c2ccd1; 100 | text-decoration: none; 101 | } 102 | #qunit-tests li a:hover, 103 | #qunit-tests li a:focus { 104 | color: #000; 105 | } 106 | 107 | #qunit-tests ol { 108 | margin-top: 0.5em; 109 | padding: 0.5em; 110 | 111 | background-color: #fff; 112 | 113 | border-radius: 15px; 114 | -moz-border-radius: 15px; 115 | -webkit-border-radius: 15px; 116 | 117 | box-shadow: inset 0px 2px 13px #999; 118 | -moz-box-shadow: inset 0px 2px 13px #999; 119 | -webkit-box-shadow: inset 0px 2px 13px #999; 120 | } 121 | 122 | #qunit-tests table { 123 | border-collapse: collapse; 124 | margin-top: .2em; 125 | } 126 | 127 | #qunit-tests th { 128 | text-align: right; 129 | vertical-align: top; 130 | padding: 0 .5em 0 0; 131 | } 132 | 133 | #qunit-tests td { 134 | vertical-align: top; 135 | } 136 | 137 | #qunit-tests pre { 138 | margin: 0; 139 | white-space: pre-wrap; 140 | word-wrap: break-word; 141 | } 142 | 143 | #qunit-tests del { 144 | background-color: #e0f2be; 145 | color: #374e0c; 146 | text-decoration: none; 147 | } 148 | 149 | #qunit-tests ins { 150 | background-color: #ffcaca; 151 | color: #500; 152 | text-decoration: none; 153 | } 154 | 155 | /*** Test Counts */ 156 | 157 | #qunit-tests b.counts { color: black; } 158 | #qunit-tests b.passed { color: #5E740B; } 159 | #qunit-tests b.failed { color: #710909; } 160 | 161 | #qunit-tests li li { 162 | margin: 0.5em; 163 | padding: 0.4em 0.5em 0.4em 0.5em; 164 | background-color: #fff; 165 | border-bottom: none; 166 | list-style-position: inside; 167 | } 168 | 169 | /*** Passing Styles */ 170 | 171 | #qunit-tests li li.pass { 172 | color: #5E740B; 173 | background-color: #fff; 174 | border-left: 26px solid #C6E746; 175 | } 176 | 177 | #qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } 178 | #qunit-tests .pass .test-name { color: #366097; } 179 | 180 | #qunit-tests .pass .test-actual, 181 | #qunit-tests .pass .test-expected { color: #999999; } 182 | 183 | #qunit-banner.qunit-pass { background-color: #C6E746; } 184 | 185 | /*** Failing Styles */ 186 | 187 | #qunit-tests li li.fail { 188 | color: #710909; 189 | background-color: #fff; 190 | border-left: 26px solid #EE5757; 191 | white-space: pre; 192 | } 193 | 194 | #qunit-tests > li:last-child { 195 | border-radius: 0 0 15px 15px; 196 | -moz-border-radius: 0 0 15px 15px; 197 | -webkit-border-bottom-right-radius: 15px; 198 | -webkit-border-bottom-left-radius: 15px; 199 | } 200 | 201 | #qunit-tests .fail { color: #000000; background-color: #EE5757; } 202 | #qunit-tests .fail .test-name, 203 | #qunit-tests .fail .module-name { color: #000000; } 204 | 205 | #qunit-tests .fail .test-actual { color: #EE5757; } 206 | #qunit-tests .fail .test-expected { color: green; } 207 | 208 | #qunit-banner.qunit-fail { background-color: #EE5757; } 209 | 210 | 211 | /** Result */ 212 | 213 | #qunit-testresult { 214 | padding: 0.5em 0.5em 0.5em 2.5em; 215 | 216 | color: #2b81af; 217 | background-color: #D2E0E6; 218 | 219 | border-bottom: 1px solid white; 220 | } 221 | 222 | /** Fixture */ 223 | 224 | #qunit-fixture { 225 | position: absolute; 226 | top: -10000px; 227 | left: -10000px; 228 | } 229 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/lib/types.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Nodeunit 3 | * Copyright (c) 2010 Caolan McMahon 4 | * MIT Licensed 5 | * 6 | * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! 7 | * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build. 8 | * Only code on that line will be removed, its mostly to avoid requiring code 9 | * that is node specific 10 | */ 11 | 12 | /** 13 | * Module dependencies 14 | */ 15 | 16 | var assert = require('./assert'), //@REMOVE_LINE_FOR_BROWSER 17 | async = require('../deps/async'); //@REMOVE_LINE_FOR_BROWSER 18 | 19 | 20 | /** 21 | * Creates assertion objects representing the result of an assert call. 22 | * Accepts an object or AssertionError as its argument. 23 | * 24 | * @param {object} obj 25 | * @api public 26 | */ 27 | 28 | exports.assertion = function (obj) { 29 | return { 30 | method: obj.method || '', 31 | message: obj.message || (obj.error && obj.error.message) || '', 32 | error: obj.error, 33 | passed: function () { 34 | return !this.error; 35 | }, 36 | failed: function () { 37 | return Boolean(this.error); 38 | } 39 | }; 40 | }; 41 | 42 | /** 43 | * Creates an assertion list object representing a group of assertions. 44 | * Accepts an array of assertion objects. 45 | * 46 | * @param {Array} arr 47 | * @param {Number} duration 48 | * @api public 49 | */ 50 | 51 | exports.assertionList = function (arr, duration) { 52 | var that = arr || []; 53 | that.failures = function () { 54 | var failures = 0; 55 | for (var i=0; i= timeout) { 31 | throw e; 32 | } 33 | else { 34 | async.nextTick(function () { 35 | waitFor(fn, timeout, callback, start); 36 | }); 37 | } 38 | } 39 | else { 40 | throw e; 41 | } 42 | } 43 | }; 44 | 45 | 46 | // TESTS: 47 | 48 | // Are exported tests actually run? - store completed tests in this variable 49 | // for checking later 50 | var tests_called = {}; 51 | 52 | // most basic test that should run, the tests_called object is tested 53 | // at the end of this module to ensure the tests were actually run by nodeunit 54 | exports.testCalled = function (test) { 55 | tests_called.testCalled = true; 56 | test.done(); 57 | }; 58 | 59 | // generates test functions for nodeunit assertions 60 | var makeTest = function (method, args_pass, args_fail) { 61 | return function (test) { 62 | var test1_called = false; 63 | var test2_called = false; 64 | 65 | // test pass 66 | nodeunit.runTest( 67 | 'testname', 68 | function (test) { 69 | test[method].apply(test, args_pass); 70 | test.done(); 71 | }, 72 | {testDone: function (name, assertions) { 73 | assert.equal(assertions.length, 1); 74 | assert.equal(assertions.failures(), 0); 75 | }}, 76 | function () { 77 | test1_called = true; 78 | } 79 | ); 80 | 81 | // test failure 82 | nodeunit.runTest( 83 | 'testname', 84 | function (test) { 85 | test[method].apply(test, args_fail); 86 | test.done(); 87 | }, 88 | {testDone: function (name, assertions) { 89 | assert.equal(assertions.length, 1); 90 | assert.equal(assertions.failures(), 1); 91 | }}, 92 | function () { 93 | test2_called = true; 94 | } 95 | ); 96 | 97 | // ensure tests were run 98 | waitFor(function () { 99 | assert.ok(test1_called); 100 | assert.ok(test2_called); 101 | tests_called[method] = true; 102 | }, 500, test.done); 103 | }; 104 | }; 105 | 106 | // ensure basic assertions are working: 107 | exports.testOk = makeTest('ok', [true], [false]); 108 | exports.testEquals = makeTest('equals', [1, 1], [1, 2]); 109 | exports.testSame = makeTest('same', 110 | [{test: 'test'}, {test: 'test'}], 111 | [{test: 'test'}, {monkey: 'penguin'}] 112 | ); 113 | 114 | // from the assert module: 115 | exports.testEqual = makeTest('equal', [1, 1], [1, 2]); 116 | exports.testNotEqual = makeTest('notEqual', [1, 2], [1, 1]); 117 | exports.testDeepEqual = makeTest('deepEqual', 118 | [{one: 1}, {one: 1}], [{one: 1}, {two: 2}] 119 | ); 120 | exports.testNotDeepEqual = makeTest('notDeepEqual', 121 | [{one: 1}, {two: 2}], [{one: 1}, {one: 1}] 122 | ); 123 | exports.testStrictEqual = makeTest('strictEqual', [1, 1], [1, true]); 124 | exports.testNotStrictEqual = makeTest('notStrictEqual', [true, 1], [1, 1]); 125 | exports.testThrows = makeTest('throws', 126 | [function () { 127 | throw new Error('test'); 128 | }], 129 | [function () { 130 | return; 131 | }] 132 | ); 133 | exports.testDoesNotThrows = makeTest('doesNotThrow', 134 | [function () { 135 | return; 136 | }], 137 | [function () { 138 | throw new Error('test'); 139 | }] 140 | ); 141 | exports.testIfError = makeTest('ifError', [false], [new Error('test')]); 142 | 143 | 144 | exports.testExpect = function (test) { 145 | var test1_called = false, 146 | test2_called = false, 147 | test3_called = false; 148 | 149 | // correct number of tests run 150 | nodeunit.runTest( 151 | 'testname', 152 | function (test) { 153 | test.expect(2); 154 | test.ok(true); 155 | test.ok(true); 156 | test.done(); 157 | }, 158 | {testDone: function (name, assertions) { 159 | test.equals(assertions.length, 2); 160 | test.equals(assertions.failures(), 0); 161 | }}, 162 | function () { 163 | test1_called = true; 164 | } 165 | ); 166 | 167 | // no tests run 168 | nodeunit.runTest( 169 | 'testname', 170 | function (test) { 171 | test.expect(2); 172 | test.done(); 173 | }, 174 | {testDone: function (name, assertions) { 175 | test.equals(assertions.length, 1); 176 | test.equals(assertions.failures(), 1); 177 | }}, 178 | function () { 179 | test2_called = true; 180 | } 181 | ); 182 | 183 | // incorrect number of tests run 184 | nodeunit.runTest( 185 | 'testname', 186 | function (test) { 187 | test.expect(2); 188 | test.ok(true); 189 | test.ok(true); 190 | test.ok(true); 191 | test.done(); 192 | }, 193 | {testDone: function (name, assertions) { 194 | test.equals(assertions.length, 4); 195 | test.equals(assertions.failures(), 1); 196 | }}, 197 | function () { 198 | test3_called = true; 199 | } 200 | ); 201 | 202 | // ensure callbacks fired 203 | waitFor(function () { 204 | assert.ok(test1_called); 205 | assert.ok(test2_called); 206 | assert.ok(test3_called); 207 | tests_called.expect = true; 208 | }, 500, test.done); 209 | }; 210 | 211 | 212 | // tests are async, so wait for them to be called 213 | waitFor(function () { 214 | assert.ok(tests_called.testCalled); 215 | assert.ok(tests_called.ok); 216 | assert.ok(tests_called.equals); 217 | assert.ok(tests_called.same); 218 | assert.ok(tests_called.expect); 219 | }, 10000); 220 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/test-runfiles.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | fs = require('fs'), 3 | path = require('path'), 4 | nodeunit = require('../lib/nodeunit'); 5 | 6 | 7 | var setup = function (fn) { 8 | return function (test) { 9 | process.chdir(__dirname); 10 | require.paths.push(__dirname); 11 | var env = { 12 | mock_module1: require('./fixtures/mock_module1'), 13 | mock_module2: require('./fixtures/mock_module2'), 14 | mock_module3: require('./fixtures/dir/mock_module3'), 15 | mock_module4: require('./fixtures/dir/mock_module4') 16 | }; 17 | fn.call(env, test); 18 | }; 19 | }; 20 | 21 | 22 | exports.testRunFiles = setup(function (test) { 23 | test.expect(24); 24 | var runModule_copy = nodeunit.runModule; 25 | 26 | var runModule_calls = []; 27 | var modules = []; 28 | 29 | var opts = { 30 | moduleStart: function () { 31 | return 'moduleStart'; 32 | }, 33 | testDone: function () { 34 | return 'testDone'; 35 | }, 36 | testStart: function () { 37 | return 'testStart'; 38 | }, 39 | log: function () { 40 | return 'log'; 41 | }, 42 | done: function (assertions) { 43 | test.equals(assertions.failures(), 0, 'failures'); 44 | test.equals(assertions.length, 4, 'length'); 45 | test.ok(typeof assertions.duration === "number"); 46 | 47 | var called_with = function (name) { 48 | return runModule_calls.some(function (m) { 49 | return m.name === name; 50 | }); 51 | }; 52 | test.ok(called_with('mock_module1'), 'mock_module1 ran'); 53 | test.ok(called_with('mock_module2'), 'mock_module2 ran'); 54 | test.ok(called_with('mock_module3'), 'mock_module3 ran'); 55 | test.ok(called_with('mock_module4'), 'mock_module4 ran'); 56 | test.equals(runModule_calls.length, 4); 57 | 58 | nodeunit.runModule = runModule_copy; 59 | test.done(); 60 | } 61 | }; 62 | 63 | nodeunit.runModule = function (name, mod, options, callback) { 64 | test.equals(options.testDone, opts.testDone); 65 | test.equals(options.testStart, opts.testStart); 66 | test.equals(options.log, opts.log); 67 | test.ok(typeof name === "string"); 68 | runModule_calls.push(mod); 69 | var m = [{failed: function () { 70 | return false; 71 | }}]; 72 | modules.push(m); 73 | callback(null, m); 74 | }; 75 | 76 | nodeunit.runFiles( 77 | ['fixtures/mock_module1.js', 'fixtures/mock_module2.js', 'fixtures/dir'], 78 | opts 79 | ); 80 | }); 81 | 82 | exports.testRunFilesEmpty = function (test) { 83 | test.expect(3); 84 | nodeunit.runFiles([], { 85 | moduleStart: function () { 86 | test.ok(false, 'should not be called'); 87 | }, 88 | testDone: function () { 89 | test.ok(false, 'should not be called'); 90 | }, 91 | testStart: function () { 92 | test.ok(false, 'should not be called'); 93 | }, 94 | log: function () { 95 | test.ok(false, 'should not be called'); 96 | }, 97 | done: function (assertions) { 98 | test.equals(assertions.failures(), 0, 'failures'); 99 | test.equals(assertions.length, 0, 'length'); 100 | test.ok(typeof assertions.duration === "number"); 101 | test.done(); 102 | } 103 | }); 104 | }; 105 | 106 | 107 | exports.testEmptyDir = function (test) { 108 | var dir2 = __dirname + '/fixtures/dir2'; 109 | 110 | // git doesn't like empty directories, so we have to create one 111 | path.exists(dir2, function (exists) { 112 | if (!exists) { 113 | fs.mkdirSync(dir2, 0777); 114 | } 115 | 116 | // runFiles on empty directory: 117 | nodeunit.runFiles([dir2], { 118 | moduleStart: function () { 119 | test.ok(false, 'should not be called'); 120 | }, 121 | testDone: function () { 122 | test.ok(false, 'should not be called'); 123 | }, 124 | testStart: function () { 125 | test.ok(false, 'should not be called'); 126 | }, 127 | log: function () { 128 | test.ok(false, 'should not be called'); 129 | }, 130 | done: function (assertions) { 131 | test.equals(assertions.failures(), 0, 'failures'); 132 | test.equals(assertions.length, 0, 'length'); 133 | test.ok(typeof assertions.duration === "number"); 134 | test.done(); 135 | } 136 | }); 137 | }); 138 | }; 139 | 140 | 141 | var CoffeeScript; 142 | try { 143 | CoffeeScript = require('coffee-script'); 144 | } catch (e) { 145 | } 146 | 147 | if (CoffeeScript) { 148 | exports.testCoffeeScript = function (test) { 149 | process.chdir(__dirname); 150 | require.paths.push(__dirname); 151 | var env = { 152 | mock_coffee_module: require('./fixtures/coffee/mock_coffee_module') 153 | }; 154 | 155 | test.expect(9); 156 | var runModule_copy = nodeunit.runModule; 157 | 158 | var runModule_calls = []; 159 | var modules = []; 160 | 161 | var opts = { 162 | moduleStart: function () { 163 | return 'moduleStart'; 164 | }, 165 | testDone: function () { 166 | return 'testDone'; 167 | }, 168 | testStart: function () { 169 | return 'testStart'; 170 | }, 171 | log: function () { 172 | return 'log'; 173 | }, 174 | done: function (assertions) { 175 | test.equals(assertions.failures(), 0, 'failures'); 176 | test.equals(assertions.length, 1, 'length'); 177 | test.ok(typeof assertions.duration === "number"); 178 | 179 | var called_with = function (name) { 180 | return runModule_calls.some(function (m) { 181 | return m.name === name; 182 | }); 183 | }; 184 | test.ok( 185 | called_with('mock_coffee_15'), 186 | 'mock_coffee_module ran' 187 | ); 188 | test.equals(runModule_calls.length, 1); 189 | 190 | nodeunit.runModule = runModule_copy; 191 | test.done(); 192 | } 193 | }; 194 | 195 | nodeunit.runModule = function (name, mod, options, callback) { 196 | test.equals(options.testDone, opts.testDone); 197 | test.equals(options.testStart, opts.testStart); 198 | test.equals(options.log, opts.log); 199 | test.ok(typeof name === "string"); 200 | runModule_calls.push(mod); 201 | var m = [{failed: function () { 202 | return false; 203 | }}]; 204 | modules.push(m); 205 | callback(null, m); 206 | }; 207 | 208 | nodeunit.runFiles( 209 | ['fixtures/coffee/mock_coffee_module.coffee'], 210 | opts 211 | ); 212 | }; 213 | } 214 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/test/test-testcase.js: -------------------------------------------------------------------------------- 1 | /* THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! 2 | * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build. 3 | * Only code on that line will be removed, its mostly to avoid requiring code 4 | * that is node specific 5 | */ 6 | 7 | var nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER 8 | var testCase = nodeunit.testCase; 9 | 10 | exports.testTestCase = function (test) { 11 | test.expect(7); 12 | var call_order = []; 13 | var s = testCase({ 14 | setUp: function (callback) { 15 | call_order.push('setUp'); 16 | test.equals(this.one, undefined); 17 | this.one = 1; 18 | callback(); 19 | }, 20 | tearDown: function (callback) { 21 | call_order.push('tearDown'); 22 | test.ok(true, 'tearDown called'); 23 | callback(); 24 | }, 25 | test1: function (t) { 26 | call_order.push('test1'); 27 | test.equals(this.one, 1); 28 | this.one = 2; 29 | t.done(); 30 | }, 31 | test2: function (t) { 32 | call_order.push('test2'); 33 | test.equals(this.one, 1); 34 | t.done(); 35 | } 36 | }); 37 | nodeunit.runSuite(null, s, {}, function () { 38 | test.same(call_order, [ 39 | 'setUp', 'test1', 'tearDown', 40 | 'setUp', 'test2', 'tearDown' 41 | ]); 42 | test.done(); 43 | }); 44 | }; 45 | 46 | exports.tearDownAfterError = function (test) { 47 | test.expect(1); 48 | var s = testCase({ 49 | tearDown: function (callback) { 50 | test.ok(true, 'tearDown called'); 51 | callback(); 52 | }, 53 | test: function (t) { 54 | throw new Error('some error'); 55 | } 56 | }); 57 | nodeunit.runSuite(null, s, {}, function () { 58 | test.done(); 59 | }); 60 | }; 61 | 62 | exports.catchSetUpError = function (test) { 63 | test.expect(2); 64 | var test_error = new Error('test error'); 65 | var s = testCase({ 66 | setUp: function (callback) { 67 | throw test_error; 68 | }, 69 | test: function (t) { 70 | test.ok(false, 'test function should not be called'); 71 | t.done(); 72 | } 73 | }); 74 | nodeunit.runSuite(null, s, {}, function (err, assertions) { 75 | test.equal(assertions.length, 1); 76 | test.equal(assertions[0].error, test_error); 77 | test.done(); 78 | }); 79 | }; 80 | 81 | exports.setUpErrorCallback = function (test) { 82 | test.expect(2); 83 | var test_error = new Error('test error'); 84 | var s = testCase({ 85 | setUp: function (callback) { 86 | callback(test_error); 87 | }, 88 | test: function (t) { 89 | test.ok(false, 'test function should not be called'); 90 | t.done(); 91 | } 92 | }); 93 | nodeunit.runSuite(null, s, {}, function (err, assertions) { 94 | test.equal(assertions.length, 1); 95 | test.equal(assertions[0].error, test_error); 96 | test.done(); 97 | }); 98 | }; 99 | 100 | exports.catchTearDownError = function (test) { 101 | test.expect(2); 102 | var test_error = new Error('test error'); 103 | var s = testCase({ 104 | tearDown: function (callback) { 105 | throw test_error; 106 | }, 107 | test: function (t) { 108 | t.done(); 109 | } 110 | }); 111 | nodeunit.runSuite(null, s, {}, function (err, assertions) { 112 | test.equal(assertions.length, 1); 113 | test.equal(assertions[0].error, test_error); 114 | test.done(); 115 | }); 116 | }; 117 | 118 | exports.tearDownErrorCallback = function (test) { 119 | test.expect(2); 120 | var test_error = new Error('test error'); 121 | var s = testCase({ 122 | tearDown: function (callback) { 123 | callback(test_error); 124 | }, 125 | test: function (t) { 126 | t.done(); 127 | } 128 | }); 129 | nodeunit.runSuite(null, s, {}, function (err, assertions) { 130 | test.equal(assertions.length, 1); 131 | test.equal(assertions[0].error, test_error); 132 | test.done(); 133 | }); 134 | }; 135 | 136 | exports.testErrorAndtearDownError = function (test) { 137 | test.expect(3); 138 | var error1 = new Error('test error one'); 139 | var error2 = new Error('test error two'); 140 | var s = testCase({ 141 | tearDown: function (callback) { 142 | callback(error2); 143 | }, 144 | test: function (t) { 145 | t.done(error1); 146 | } 147 | }); 148 | nodeunit.runSuite(null, s, {}, function (err, assertions) { 149 | test.equal(assertions.length, 2); 150 | test.equal(assertions[0].error, error1); 151 | test.equal(assertions[1].error, error2); 152 | test.done(); 153 | }); 154 | }; 155 | 156 | exports.testCaseGroups = function (test) { 157 | var call_order = []; 158 | var s = testCase({ 159 | setUp: function (callback) { 160 | call_order.push('setUp'); 161 | callback(); 162 | }, 163 | tearDown: function (callback) { 164 | call_order.push('tearDown'); 165 | callback(); 166 | }, 167 | test1: function (test) { 168 | call_order.push('test1'); 169 | test.done(); 170 | }, 171 | group1: { 172 | test2: function (test) { 173 | call_order.push('group1.test2'); 174 | test.done(); 175 | } 176 | } 177 | }); 178 | nodeunit.runSuite(null, s, {}, function (err, assertions) { 179 | test.same(call_order, [ 180 | 'setUp', 181 | 'test1', 182 | 'tearDown', 183 | 'setUp', 184 | 'group1.test2', 185 | 'tearDown' 186 | ]); 187 | test.done(); 188 | }); 189 | }; 190 | 191 | exports.nestedTestCases = function (test) { 192 | var call_order = []; 193 | var s = testCase({ 194 | setUp: function (callback) { 195 | call_order.push('setUp'); 196 | callback(); 197 | }, 198 | tearDown: function (callback) { 199 | call_order.push('tearDown'); 200 | callback(); 201 | }, 202 | test1: function (test) { 203 | call_order.push('test1'); 204 | test.done(); 205 | }, 206 | group1: testCase({ 207 | setUp: function (callback) { 208 | call_order.push('group1.setUp'); 209 | callback(); 210 | }, 211 | tearDown: function (callback) { 212 | call_order.push('group1.tearDown'); 213 | callback(); 214 | }, 215 | test2: function (test) { 216 | call_order.push('group1.test2'); 217 | test.done(); 218 | } 219 | }) 220 | }); 221 | nodeunit.runSuite(null, s, {}, function (err, assertions) { 222 | test.same(call_order, [ 223 | 'setUp', 224 | 'test1', 225 | 'tearDown', 226 | 'setUp', 227 | 'group1.setUp', 228 | 'group1.test2', 229 | 'group1.tearDown', 230 | 'tearDown' 231 | ]); 232 | test.done(); 233 | }); 234 | }; 235 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/lib/core.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Nodeunit 3 | * Copyright (c) 2010 Caolan McMahon 4 | * MIT Licensed 5 | * 6 | * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! 7 | * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build. 8 | * Only code on that line will be removed, its mostly to avoid requiring code 9 | * that is node specific 10 | */ 11 | 12 | /** 13 | * Module dependencies 14 | */ 15 | 16 | var async = require('../deps/async'), //@REMOVE_LINE_FOR_BROWSER 17 | types = require('./types'); //@REMOVE_LINE_FOR_BROWSER 18 | 19 | 20 | /** 21 | * Added for browser compatibility 22 | */ 23 | 24 | var _keys = function(obj){ 25 | if(Object.keys) return Object.keys(obj); 26 | var keys = []; 27 | for(var k in obj){ 28 | if(obj.hasOwnProperty(k)) keys.push(k); 29 | } 30 | return keys; 31 | }; 32 | 33 | 34 | var _copy = function(obj){ 35 | var nobj = Object(); 36 | var keys = _keys(obj); 37 | for (var i = 0; i < keys.length; i++){ 38 | nobj[keys[i]] = obj[keys[i]]; 39 | } 40 | return nobj; 41 | } 42 | 43 | 44 | /** 45 | * Runs a test function (fn) from a loaded module. After the test function 46 | * calls test.done(), the callback is executed with an assertionList as its 47 | * second argument. 48 | * 49 | * @param {String} name 50 | * @param {Function} fn 51 | * @param {Object} opt 52 | * @param {Function} callback 53 | * @api public 54 | */ 55 | 56 | exports.runTest = function (name, fn, opt, callback) { 57 | var options = types.options(opt); 58 | 59 | options.testStart(name); 60 | var start = new Date().getTime(); 61 | var test = types.test(name, start, options, callback); 62 | 63 | try { 64 | fn(test); 65 | } 66 | catch (e) { 67 | test.done(e); 68 | } 69 | }; 70 | 71 | /** 72 | * Takes an object containing test functions or other test suites as properties 73 | * and runs each in series. After all tests have completed, the callback is 74 | * called with a list of all assertions as the second argument. 75 | * 76 | * If a name is passed to this function it is prepended to all test and suite 77 | * names that run within it. 78 | * 79 | * @param {String} name 80 | * @param {Object} suite 81 | * @param {Object} opt 82 | * @param {Function} callback 83 | * @api public 84 | */ 85 | 86 | exports.runSuite = function (name, suite, opt, callback) { 87 | var keys = _keys(suite); 88 | 89 | async.concatSeries(keys, function (k, cb) { 90 | var prop = suite[k], _name; 91 | 92 | _name = name ? [].concat(name, k) : [k]; 93 | 94 | _name.toString = function () { 95 | // fallback for old one 96 | return this.join(' - '); 97 | }; 98 | 99 | if (typeof prop === 'function') { 100 | if (!opt.testspec || _name.indexOf(opt.testspec) != -1){ 101 | if (opt.moduleStart) 102 | opt.moduleStart(); 103 | exports.runTest(_name, suite[k], opt, cb); 104 | } else 105 | return cb(); 106 | } 107 | else { 108 | exports.runSuite(_name, suite[k], opt, cb); 109 | } 110 | }, callback); 111 | }; 112 | 113 | /** 114 | * Run each exported test function or test suite from a loaded module. 115 | * 116 | * @param {String} name 117 | * @param {Object} mod 118 | * @param {Object} opt 119 | * @param {Function} callback 120 | * @api public 121 | */ 122 | 123 | exports.runModule = function (name, mod, opt, callback) { 124 | var options = _copy(types.options(opt)); 125 | 126 | var _run = false; 127 | var _moduleStart = options.moduleStart; 128 | function run_once(){ 129 | if (!_run){ 130 | _run = true; 131 | _moduleStart(name); 132 | } 133 | } 134 | options.moduleStart = run_once; 135 | 136 | var start = new Date().getTime(); 137 | 138 | exports.runSuite(null, mod, options, function (err, a_list) { 139 | var end = new Date().getTime(); 140 | var assertion_list = types.assertionList(a_list, end - start); 141 | options.moduleDone(name, assertion_list); 142 | callback(null, a_list); 143 | }); 144 | }; 145 | 146 | /** 147 | * Treats an object literal as a list of modules keyed by name. Runs each 148 | * module and finished with calling 'done'. You can think of this as a browser 149 | * safe alternative to runFiles in the nodeunit module. 150 | * 151 | * @param {Object} modules 152 | * @param {Object} opt 153 | * @api public 154 | */ 155 | 156 | // TODO: add proper unit tests for this function 157 | exports.runModules = function (modules, opt) { 158 | var all_assertions = []; 159 | var options = types.options(opt); 160 | var start = new Date().getTime(); 161 | 162 | async.concatSeries(_keys(modules), function (k, cb) { 163 | exports.runModule(k, modules[k], options, cb); 164 | }, 165 | function (err, all_assertions) { 166 | var end = new Date().getTime(); 167 | options.done(types.assertionList(all_assertions, end - start)); 168 | }); 169 | }; 170 | 171 | 172 | /** 173 | * Wraps a test function with setUp and tearDown functions. 174 | * Used by testCase. 175 | * 176 | * @param {Function} setUp 177 | * @param {Function} tearDown 178 | * @param {Function} fn 179 | * @api private 180 | */ 181 | 182 | var wrapTest = function (setUp, tearDown, fn) { 183 | return function (test) { 184 | var context = {}; 185 | if (tearDown) { 186 | var done = test.done; 187 | test.done = function (err) { 188 | try { 189 | tearDown.call(context, function (err2) { 190 | if (err && err2) { 191 | test._assertion_list.push( 192 | types.assertion({error: err}) 193 | ); 194 | return done(err2); 195 | } 196 | done(err || err2); 197 | }); 198 | } 199 | catch (e) { 200 | done(e); 201 | } 202 | }; 203 | } 204 | if (setUp) { 205 | setUp.call(context, function (err) { 206 | if (err) { 207 | return test.done(err); 208 | } 209 | fn.call(context, test); 210 | }); 211 | } 212 | else { 213 | fn.call(context, test); 214 | } 215 | } 216 | }; 217 | 218 | 219 | /** 220 | * Wraps a group of tests with setUp and tearDown functions. 221 | * Used by testCase. 222 | * 223 | * @param {Function} setUp 224 | * @param {Function} tearDown 225 | * @param {Object} group 226 | * @api private 227 | */ 228 | 229 | var wrapGroup = function (setUp, tearDown, group) { 230 | var tests = {}; 231 | var keys = _keys(group); 232 | for (var i=0; i 0) ? "runner failed" : "runner passed"; 93 | this.runnerDiv.setAttribute("class", className); 94 | //do it twice for IE 95 | this.runnerDiv.setAttribute("className", className); 96 | var specs = runner.specs(); 97 | var specCount = 0; 98 | for (var i = 0; i < specs.length; i++) { 99 | if (this.specFilter(specs[i])) { 100 | specCount++; 101 | } 102 | } 103 | var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); 104 | message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"; 105 | this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild); 106 | 107 | this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString())); 108 | }; 109 | 110 | jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { 111 | var results = suite.results(); 112 | var status = results.passed() ? 'passed' : 'failed'; 113 | if (results.totalCount === 0) { // todo: change this to check results.skipped 114 | status = 'skipped'; 115 | } 116 | this.suiteDivs[suite.id].className += " " + status; 117 | }; 118 | 119 | jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) { 120 | if (this.logRunningSpecs) { 121 | this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...'); 122 | } 123 | }; 124 | 125 | jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { 126 | var results = spec.results(); 127 | var status = results.passed() ? 'passed' : 'failed'; 128 | if (results.skipped) { 129 | status = 'skipped'; 130 | } 131 | var specDiv = this.createDom('div', { className: 'spec ' + status }, 132 | this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), 133 | this.createDom('a', { 134 | className: 'description', 135 | href: '?spec=' + encodeURIComponent(spec.getFullName()), 136 | title: spec.getFullName() 137 | }, spec.description)); 138 | 139 | 140 | var resultItems = results.getItems(); 141 | var messagesDiv = this.createDom('div', { className: 'messages' }); 142 | for (var i = 0; i < resultItems.length; i++) { 143 | var result = resultItems[i]; 144 | 145 | if (result.type == 'log') { 146 | messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString())); 147 | } else if (result.type == 'expect' && result.passed && !result.passed()) { 148 | messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message)); 149 | 150 | if (result.trace.stack) { 151 | messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack)); 152 | } 153 | } 154 | } 155 | 156 | if (messagesDiv.childNodes.length > 0) { 157 | specDiv.appendChild(messagesDiv); 158 | } 159 | 160 | this.suiteDivs[spec.suite.id].appendChild(specDiv); 161 | }; 162 | 163 | jasmine.TrivialReporter.prototype.log = function() { 164 | var console = jasmine.getGlobal().console; 165 | if (console && console.log) { 166 | if (console.log.apply) { 167 | console.log.apply(console, arguments); 168 | } else { 169 | console.log(arguments); // ie fix: console.log.apply doesn't exist on ie 170 | } 171 | } 172 | }; 173 | 174 | jasmine.TrivialReporter.prototype.getLocation = function() { 175 | return this.document.location; 176 | }; 177 | 178 | jasmine.TrivialReporter.prototype.specFilter = function(spec) { 179 | var paramMap = {}; 180 | var params = this.getLocation().search.substring(1).split('&'); 181 | for (var i = 0; i < params.length; i++) { 182 | var p = params[i].split('='); 183 | paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); 184 | } 185 | 186 | if (!paramMap.spec) { 187 | return true; 188 | } 189 | return spec.getFullName().indexOf(paramMap.spec) === 0; 190 | }; 191 | -------------------------------------------------------------------------------- /nodeunit/node_modules/nodeunit/lib/assert.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is based on the node.js assert module, but with some small 3 | * changes for browser-compatibility 4 | * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! 5 | */ 6 | 7 | 8 | /** 9 | * Added for browser compatibility 10 | */ 11 | 12 | var _keys = function(obj){ 13 | if(Object.keys) return Object.keys(obj); 14 | var keys = []; 15 | for(var k in obj){ 16 | if(obj.hasOwnProperty(k)) keys.push(k); 17 | } 18 | return keys; 19 | }; 20 | 21 | 22 | 23 | // http://wiki.commonjs.org/wiki/Unit_Testing/1.0 24 | // 25 | // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! 26 | // 27 | // Originally from narwhal.js (http://narwhaljs.org) 28 | // Copyright (c) 2009 Thomas Robinson <280north.com> 29 | // 30 | // Permission is hereby granted, free of charge, to any person obtaining a copy 31 | // of this software and associated documentation files (the 'Software'), to 32 | // deal in the Software without restriction, including without limitation the 33 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 34 | // sell copies of the Software, and to permit persons to whom the Software is 35 | // furnished to do so, subject to the following conditions: 36 | // 37 | // The above copyright notice and this permission notice shall be included in 38 | // all copies or substantial portions of the Software. 39 | // 40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 41 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 42 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 43 | // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 44 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 45 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 46 | 47 | 48 | var pSlice = Array.prototype.slice; 49 | 50 | // 1. The assert module provides functions that throw 51 | // AssertionError's when particular conditions are not met. The 52 | // assert module must conform to the following interface. 53 | 54 | var assert = exports; 55 | 56 | // 2. The AssertionError is defined in assert. 57 | // new assert.AssertionError({message: message, actual: actual, expected: expected}) 58 | 59 | assert.AssertionError = function AssertionError (options) { 60 | this.name = "AssertionError"; 61 | this.message = options.message; 62 | this.actual = options.actual; 63 | this.expected = options.expected; 64 | this.operator = options.operator; 65 | var stackStartFunction = options.stackStartFunction || fail; 66 | 67 | if (Error.captureStackTrace) { 68 | Error.captureStackTrace(this, stackStartFunction); 69 | } 70 | }; 71 | // code from util.inherits in node 72 | assert.AssertionError.super_ = Error; 73 | 74 | 75 | // EDITED FOR BROWSER COMPATIBILITY: replaced Object.create call 76 | // TODO: test what effect this may have 77 | var ctor = function () { this.constructor = assert.AssertionError; }; 78 | ctor.prototype = Error.prototype; 79 | assert.AssertionError.prototype = new ctor(); 80 | 81 | 82 | assert.AssertionError.prototype.toString = function() { 83 | if (this.message) { 84 | return [this.name+":", this.message].join(' '); 85 | } else { 86 | return [ this.name+":" 87 | , JSON.stringify(this.expected ) 88 | , this.operator 89 | , JSON.stringify(this.actual) 90 | ].join(" "); 91 | } 92 | }; 93 | 94 | // assert.AssertionError instanceof Error 95 | 96 | assert.AssertionError.__proto__ = Error.prototype; 97 | 98 | // At present only the three keys mentioned above are used and 99 | // understood by the spec. Implementations or sub modules can pass 100 | // other keys to the AssertionError's constructor - they will be 101 | // ignored. 102 | 103 | // 3. All of the following functions must throw an AssertionError 104 | // when a corresponding condition is not met, with a message that 105 | // may be undefined if not provided. All assertion methods provide 106 | // both the actual and expected values to the assertion error for 107 | // display purposes. 108 | 109 | function fail(actual, expected, message, operator, stackStartFunction) { 110 | throw new assert.AssertionError({ 111 | message: message, 112 | actual: actual, 113 | expected: expected, 114 | operator: operator, 115 | stackStartFunction: stackStartFunction 116 | }); 117 | } 118 | 119 | // EXTENSION! allows for well behaved errors defined elsewhere. 120 | assert.fail = fail; 121 | 122 | // 4. Pure assertion tests whether a value is truthy, as determined 123 | // by !!guard. 124 | // assert.ok(guard, message_opt); 125 | // This statement is equivalent to assert.equal(true, guard, 126 | // message_opt);. To test strictly for the value true, use 127 | // assert.strictEqual(true, guard, message_opt);. 128 | 129 | assert.ok = function ok(value, message) { 130 | if (!!!value) fail(value, true, message, "==", assert.ok); 131 | }; 132 | 133 | // 5. The equality assertion tests shallow, coercive equality with 134 | // ==. 135 | // assert.equal(actual, expected, message_opt); 136 | 137 | assert.equal = function equal(actual, expected, message) { 138 | if (actual != expected) fail(actual, expected, message, "==", assert.equal); 139 | }; 140 | 141 | // 6. The non-equality assertion tests for whether two objects are not equal 142 | // with != assert.notEqual(actual, expected, message_opt); 143 | 144 | assert.notEqual = function notEqual(actual, expected, message) { 145 | if (actual == expected) { 146 | fail(actual, expected, message, "!=", assert.notEqual); 147 | } 148 | }; 149 | 150 | // 7. The equivalence assertion tests a deep equality relation. 151 | // assert.deepEqual(actual, expected, message_opt); 152 | 153 | assert.deepEqual = function deepEqual(actual, expected, message) { 154 | if (!_deepEqual(actual, expected)) { 155 | fail(actual, expected, message, "deepEqual", assert.deepEqual); 156 | } 157 | }; 158 | 159 | function _deepEqual(actual, expected) { 160 | // 7.1. All identical values are equivalent, as determined by ===. 161 | if (actual === expected) { 162 | return true; 163 | // 7.2. If the expected value is a Date object, the actual value is 164 | // equivalent if it is also a Date object that refers to the same time. 165 | } else if (actual instanceof Date && expected instanceof Date) { 166 | return actual.getTime() === expected.getTime(); 167 | 168 | // 7.3. Other pairs that do not both pass typeof value == "object", 169 | // equivalence is determined by ==. 170 | } else if (typeof actual != 'object' && typeof expected != 'object') { 171 | return actual == expected; 172 | 173 | // 7.4. For all other Object pairs, including Array objects, equivalence is 174 | // determined by having the same number of owned properties (as verified 175 | // with Object.prototype.hasOwnProperty.call), the same set of keys 176 | // (although not necessarily the same order), equivalent values for every 177 | // corresponding key, and an identical "prototype" property. Note: this 178 | // accounts for both named and indexed properties on Arrays. 179 | } else { 180 | return objEquiv(actual, expected); 181 | } 182 | } 183 | 184 | function isUndefinedOrNull (value) { 185 | return value === null || value === undefined; 186 | } 187 | 188 | function isArguments (object) { 189 | return Object.prototype.toString.call(object) == '[object Arguments]'; 190 | } 191 | 192 | function objEquiv (a, b) { 193 | if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) 194 | return false; 195 | // an identical "prototype" property. 196 | if (a.prototype !== b.prototype) return false; 197 | //~~~I've managed to break Object.keys through screwy arguments passing. 198 | // Converting to array solves the problem. 199 | if (isArguments(a)) { 200 | if (!isArguments(b)) { 201 | return false; 202 | } 203 | a = pSlice.call(a); 204 | b = pSlice.call(b); 205 | return _deepEqual(a, b); 206 | } 207 | try{ 208 | var ka = _keys(a), 209 | kb = _keys(b), 210 | key, i; 211 | } catch (e) {//happens when one is a string literal and the other isn't 212 | return false; 213 | } 214 | // having the same number of owned properties (keys incorporates hasOwnProperty) 215 | if (ka.length != kb.length) 216 | return false; 217 | //the same set of keys (although not necessarily the same order), 218 | ka.sort(); 219 | kb.sort(); 220 | //~~~cheap key test 221 | for (i = ka.length - 1; i >= 0; i--) { 222 | if (ka[i] != kb[i]) 223 | return false; 224 | } 225 | //equivalent values for every corresponding key, and 226 | //~~~possibly expensive deep test 227 | for (i = ka.length - 1; i >= 0; i--) { 228 | key = ka[i]; 229 | if (!_deepEqual(a[key], b[key] )) 230 | return false; 231 | } 232 | return true; 233 | } 234 | 235 | // 8. The non-equivalence assertion tests for any deep inequality. 236 | // assert.notDeepEqual(actual, expected, message_opt); 237 | 238 | assert.notDeepEqual = function notDeepEqual(actual, expected, message) { 239 | if (_deepEqual(actual, expected)) { 240 | fail(actual, expected, message, "notDeepEqual", assert.notDeepEqual); 241 | } 242 | }; 243 | 244 | // 9. The strict equality assertion tests strict equality, as determined by ===. 245 | // assert.strictEqual(actual, expected, message_opt); 246 | 247 | assert.strictEqual = function strictEqual(actual, expected, message) { 248 | if (actual !== expected) { 249 | fail(actual, expected, message, "===", assert.strictEqual); 250 | } 251 | }; 252 | 253 | // 10. The strict non-equality assertion tests for strict inequality, as determined by !==. 254 | // assert.notStrictEqual(actual, expected, message_opt); 255 | 256 | assert.notStrictEqual = function notStrictEqual(actual, expected, message) { 257 | if (actual === expected) { 258 | fail(actual, expected, message, "!==", assert.notStrictEqual); 259 | } 260 | }; 261 | 262 | function _throws (shouldThrow, block, err, message) { 263 | var exception = null, 264 | threw = false, 265 | typematters = true; 266 | 267 | message = message || ""; 268 | 269 | //handle optional arguments 270 | if (arguments.length == 3) { 271 | if (typeof(err) == "string") { 272 | message = err; 273 | typematters = false; 274 | } 275 | } else if (arguments.length == 2) { 276 | typematters = false; 277 | } 278 | 279 | try { 280 | block(); 281 | } catch (e) { 282 | threw = true; 283 | exception = e; 284 | } 285 | 286 | if (shouldThrow && !threw) { 287 | fail( "Missing expected exception" 288 | + (err && err.name ? " ("+err.name+")." : '.') 289 | + (message ? " " + message : "") 290 | ); 291 | } 292 | if (!shouldThrow && threw && typematters && exception instanceof err) { 293 | fail( "Got unwanted exception" 294 | + (err && err.name ? " ("+err.name+")." : '.') 295 | + (message ? " " + message : "") 296 | ); 297 | } 298 | if ((shouldThrow && threw && typematters && !(exception instanceof err)) || 299 | (!shouldThrow && threw)) { 300 | throw exception; 301 | } 302 | }; 303 | 304 | // 11. Expected to throw an error: 305 | // assert.throws(block, Error_opt, message_opt); 306 | 307 | assert.throws = function(block, /*optional*/error, /*optional*/message) { 308 | _throws.apply(this, [true].concat(pSlice.call(arguments))); 309 | }; 310 | 311 | // EXTENSION! This is annoying to write outside this module. 312 | assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { 313 | _throws.apply(this, [false].concat(pSlice.call(arguments))); 314 | }; 315 | 316 | assert.ifError = function (err) { if (err) {throw err;}}; 317 | -------------------------------------------------------------------------------- /jasmine/js/lib/require.js: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 1.0.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(){function J(b){return M.call(b)==="[object Function]"}function E(b){return M.call(b)==="[object Array]"}function Z(b,c,i){for(var j in c)if(!(j in K)&&(!(j in b)||i))b[j]=c[j];return d}function N(b,c,d){b=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);if(d)b.originalError=d;return b}function $(b,c,d){var j,l,q;for(j=0;q=c[j];j++){q=typeof q==="string"?{name:q}:q;l=q.location;if(d&&(!l||l.indexOf("/")!==0&&l.indexOf(":")===-1))l=d+"/"+(l||q.name);b[q.name]={name:q.name,location:l|| 8 | q.name,main:(q.main||"main").replace(da,"").replace(aa,"")}}}function V(b,c){b.holdReady?b.holdReady(c):c?b.readyWait+=1:b.ready(!0)}function ea(b){function c(a,h){var e,s;if(a&&a.charAt(0)==="."&&h){p.pkgs[h]?h=[h]:(h=h.split("/"),h=h.slice(0,h.length-1));e=a=h.concat(a.split("/"));var b;for(s=0;b=e[s];s++)if(b===".")e.splice(s,1),s-=1;else if(b==="..")if(s===1&&(e[2]===".."||e[0]===".."))break;else s>0&&(e.splice(s-1,2),s-=2);s=p.pkgs[e=a[0]];a=a.join("/");s&&a===e+"/"+s.main&&(a=e)}return a}function i(a, 9 | h){var e=a?a.indexOf("!"):-1,b=null,d=h?h.name:null,f=a,k,i;e!==-1&&(b=a.substring(0,e),a=a.substring(e+1,a.length));b&&(b=c(b,d));a&&(b?k=(e=n[b])&&e.normalize?e.normalize(a,function(a){return c(a,d)}):c(a,d):(k=c(a,d),i=E[k],i||(i=g.nameToUrl(k,null,h),E[k]=i)));return{prefix:b,name:k,parentMap:h,url:i,originalName:f,fullName:b?b+"!"+(k||""):k}}function j(){var a=!0,h=p.priorityWait,e,b;if(h){for(b=0;e=h[b];b++)if(!t[e]){a=!1;break}a&&delete p.priorityWait}return a}function l(a,h,e){return function(){var b= 10 | ga.call(arguments,0),c;if(e&&J(c=b[b.length-1]))c.__requireJsBuild=!0;b.push(h);return a.apply(null,b)}}function q(a,h){var e=l(g.require,a,h);Z(e,{nameToUrl:l(g.nameToUrl,a),toUrl:l(g.toUrl,a),defined:l(g.requireDefined,a),specified:l(g.requireSpecified,a),isBrowser:d.isBrowser});return e}function o(a){var h,e,b;b=a.callback;var c=a.map,f=c.fullName,k=a.deps,fa=a.listeners;if(b&&J(b)){if(p.catchError.define)try{e=d.execCb(f,a.callback,k,n[f])}catch(j){h=j}else e=d.execCb(f,a.callback,k,n[f]);if(f)a.cjsModule&& 11 | a.cjsModule.exports!==void 0?e=n[f]=a.cjsModule.exports:e===void 0&&a.usingExports?e=n[f]:(n[f]=e,F[f]&&(Q[f]=!0))}else f&&(e=n[f]=b,F[f]&&(Q[f]=!0));if(D[a.id])delete D[a.id],a.isDone=!0,g.waitCount-=1,g.waitCount===0&&(I=[]);delete R[f];if(d.onResourceLoad&&!a.placeholder)d.onResourceLoad(g,c,a.depArray);if(h)return e=(f?i(f).url:"")||h.fileName||h.sourceURL,b=h.moduleTree,h=N("defineerror",'Error evaluating module "'+f+'" at location "'+e+'":\n'+h+"\nfileName:"+e+"\nlineNumber: "+(h.lineNumber|| 12 | h.line),h),h.moduleName=f,h.moduleTree=b,d.onError(h);for(h=0;b=fa[h];h++)b(e)}function r(a,h){return function(b){a.depDone[h]||(a.depDone[h]=!0,a.deps[h]=b,a.depCount-=1,a.depCount||o(a))}}function v(a,h){var b=h.map,c=b.fullName,i=b.name,f=L[a]||(L[a]=n[a]),k;if(!h.loading)h.loading=!0,k=function(a){h.callback=function(){return a};o(h);t[h.id]=!0;x()},k.fromText=function(a,h){var b=O;t[a]=!1;g.scriptCount+=1;g.fake[a]=!0;b&&(O=!1);d.exec(h);b&&(O=!0);g.completeLoad(a)},c in n?k(n[c]):f.load(i,q(b.parentMap, 13 | !0),k,p)}function w(a){D[a.id]||(D[a.id]=a,I.push(a),g.waitCount+=1)}function C(a){this.listeners.push(a)}function u(a,b){var e=a.fullName,c=a.prefix,d=c?L[c]||(L[c]=n[c]):null,f,k;e&&(f=R[e]);if(!f&&(k=!0,f={id:(c&&!d?M++ +"__p@:":"")+(e||"__r@"+M++),map:a,depCount:0,depDone:[],depCallbacks:[],deps:[],listeners:[],add:C},z[f.id]=!0,e&&(!c||L[c])))R[e]=f;c&&!d?(e=u(i(c),!0),e.add(function(){var b=i(a.originalName,a.parentMap),b=u(b,!0);f.placeholder=!0;b.add(function(a){f.callback=function(){return a}; 14 | o(f)})})):k&&b&&(t[f.id]=!1,g.paused.push(f),w(f));return f}function y(a,b,e,c){var a=i(a,c),d=a.name,f=a.fullName,k=u(a),j=k.id,l=k.deps,m;if(f){if(f in n||t[j]===!0||f==="jquery"&&p.jQuery&&p.jQuery!==e().fn.jquery)return;z[j]=!0;t[j]=!0;f==="jquery"&&e&&S(e())}k.depArray=b;k.callback=e;for(e=0;e0)){if(p.priorityWait)if(j())x();else return;for(i in t)if(!(i in K)&&(e=!0,!t[i]))if(b)a+=i+" ";else{c=!0;break}if(e||g.waitCount){if(b&&a)return i=N("timeout","Load timeout for modules: "+a),i.requireType="timeout",i.requireModules=a,d.onError(i);if(c||g.scriptCount){if((G||ba)&&!W)W=setTimeout(function(){W=0;B()},50)}else{if(g.waitCount){for(H=0;a=I[H];H++)A(a,{});g.paused.length&&x();X<5&&(X+=1,B())}X=0;d.checkReadyState()}}}} 17 | var g,x,p={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},catchError:{}},P=[],z={require:!0,exports:!0,module:!0},E={},n={},t={},D={},I=[],T={},M=0,R={},L={},F={},Q={},Y=0;S=function(a){if(!g.jQuery&&(a=a||(typeof jQuery!=="undefined"?jQuery:null))&&!(p.jQuery&&a.fn.jquery!==p.jQuery)&&("holdReady"in a||"readyWait"in a))if(g.jQuery=a,m(["jquery",[],function(){return jQuery}]),g.scriptCount)V(a,!0),g.jQueryIncremented=!0};x=function(){var a,b,e,c,i,f;Y+=1;if(g.scriptCount<=0)g.scriptCount=0;for(;P.length;)if(a= 18 | P.shift(),a[0]===null)return d.onError(N("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));else m(a);if(!p.priorityWait||j())for(;g.paused.length;){i=g.paused;g.pausedCount+=i.length;g.paused=[];for(c=0;a=i[c];c++)b=a.map,e=b.url,f=b.fullName,b.prefix?v(b.prefix,a):!T[e]&&!t[f]&&(d.load(g,f,e),T[e]=!0);g.startTime=(new Date).getTime();g.pausedCount-=i.length}Y===1&&B();Y-=1};g={contextName:b,config:p,defQueue:P,waiting:D,waitCount:0,specified:z,loaded:t,urlMap:E,urlFetched:T,scriptCount:0, 19 | defined:n,paused:[],pausedCount:0,plugins:L,needFullExec:F,fake:{},fullExec:Q,managerCallbacks:R,makeModuleMap:i,normalize:c,configure:function(a){var b,e,c;a.baseUrl&&a.baseUrl.charAt(a.baseUrl.length-1)!=="/"&&(a.baseUrl+="/");b=p.paths;c=p.pkgs;Z(p,a,!0);if(a.paths){for(e in a.paths)e in K||(b[e]=a.paths[e]);p.paths=b}if((b=a.packagePaths)||a.packages){if(b)for(e in b)e in K||$(c,b[e],e);a.packages&&$(c,a.packages);p.pkgs=c}if(a.priority)e=g.requireWait,g.requireWait=!1,g.takeGlobalQueue(),x(), 20 | g.require(a.priority),x(),g.requireWait=e,p.priorityWait=a.priority;if(a.deps||a.callback)g.require(a.deps||[],a.callback)},requireDefined:function(a,b){return i(a,b).fullName in n},requireSpecified:function(a,b){return i(a,b).fullName in z},require:function(a,c,e){if(typeof a==="string"){if(J(c))return d.onError(N("requireargs","Invalid require call"));if(d.get)return d.get(g,a,c);c=i(a,c);a=c.fullName;return!(a in n)?d.onError(N("notloaded","Module name '"+c.fullName+"' has not been loaded yet for context: "+ 21 | b)):n[a]}(a&&a.length||c)&&y(null,a,c,e);if(!g.requireWait)for(;!g.scriptCount&&g.paused.length;)g.takeGlobalQueue(),x();return g.require},takeGlobalQueue:function(){U.length&&(ha.apply(g.defQueue,[g.defQueue.length-1,0].concat(U)),U=[])},completeLoad:function(a){var b;for(g.takeGlobalQueue();P.length;)if(b=P.shift(),b[0]===null){b[0]=a;break}else if(b[0]===a)break;else m(b),b=null;b?m(b):m([a,[],a==="jquery"&&typeof jQuery!=="undefined"?function(){return jQuery}:null]);S();d.isAsync&&(g.scriptCount-= 22 | 1);x();d.isAsync||(g.scriptCount-=1)},toUrl:function(a,b){var c=a.lastIndexOf("."),d=null;c!==-1&&(d=a.substring(c,a.length),a=a.substring(0,c));return g.nameToUrl(a,d,b)},nameToUrl:function(a,b,e){var i,j,f,k,l=g.config,a=c(a,e&&e.fullName);if(d.jsExtRegExp.test(a))b=a+(b?b:"");else{i=l.paths;j=l.pkgs;e=a.split("/");for(k=e.length;k>0;k--)if(f=e.slice(0,k).join("/"),i[f]){e.splice(0,k,i[f]);break}else if(f=j[f]){a=a===f.name?f.location+"/"+f.main:f.location;e.splice(0,k,a);break}b=e.join("/")+(b|| 23 | ".js");b=(b.charAt(0)==="/"||b.match(/^\w+:/)?"":l.baseUrl)+b}return l.urlArgs?b+((b.indexOf("?")===-1?"?":"&")+l.urlArgs):b}};g.jQueryCheck=S;g.resume=x;return g}function ia(){var b,c,d;if(m&&m.readyState==="interactive")return m;b=document.getElementsByTagName("script");for(c=b.length-1;c>-1&&(d=b[c]);c--)if(d.readyState==="interactive")return m=d;return null}var ja=/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,ka=/require\(\s*["']([^'"\s]+)["']\s*\)/g,da=/^\.\//,aa=/\.js$/,M=Object.prototype.toString,r=Array.prototype, 24 | ga=r.slice,ha=r.splice,G=!!(typeof window!=="undefined"&&navigator&&document),ba=!G&&typeof importScripts!=="undefined",la=G&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,ca=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",K={},u={},U=[],m=null,X=0,O=!1,d,r={},I,w,y,z,v,A,B,H,C,S,W;if(typeof define==="undefined"){if(typeof requirejs!=="undefined")if(J(requirejs))return;else r=requirejs,requirejs=void 0;typeof require!=="undefined"&&!J(require)&&(r=require, 25 | require=void 0);d=requirejs=function(b,c,d){var j="_",l;!E(b)&&typeof b!=="string"&&(l=b,E(c)?(b=c,c=d):b=[]);if(l&&l.context)j=l.context;d=u[j]||(u[j]=ea(j));l&&d.configure(l);return d.require(b,c)};d.config=function(b){return d(b)};require||(require=d);d.toUrl=function(b){return u._.toUrl(b)};d.version="1.0.0";d.jsExtRegExp=/^\/|:|\?|\.js$/;w=d.s={contexts:u,skipAsync:{}};if(d.isAsync=d.isBrowser=G)if(y=w.head=document.getElementsByTagName("head")[0],z=document.getElementsByTagName("base")[0])y= 26 | w.head=z.parentNode;d.onError=function(b){throw b;};d.load=function(b,c,i){d.resourcesReady(!1);b.scriptCount+=1;d.attach(i,b,c);if(b.jQuery&&!b.jQueryIncremented)V(b.jQuery,!0),b.jQueryIncremented=!0};define=function(b,c,d){var j,l;typeof b!=="string"&&(d=c,c=b,b=null);E(c)||(d=c,c=[]);!c.length&&J(d)&&d.length&&(d.toString().replace(ja,"").replace(ka,function(b,d){c.push(d)}),c=(d.length===1?["require"]:["require","exports","module"]).concat(c));if(O&&(j=I||ia()))b||(b=j.getAttribute("data-requiremodule")), 27 | l=u[j.getAttribute("data-requirecontext")];(l?l.defQueue:U).push([b,c,d])};define.amd={multiversion:!0,plugins:!0,jQuery:!0};d.exec=function(b){return eval(b)};d.execCb=function(b,c,d,j){return c.apply(j,d)};d.addScriptToDom=function(b){I=b;z?y.insertBefore(b,z):y.appendChild(b);I=null};d.onScriptLoad=function(b){var c=b.currentTarget||b.srcElement,i;if(b.type==="load"||c&&la.test(c.readyState))m=null,b=c.getAttribute("data-requirecontext"),i=c.getAttribute("data-requiremodule"),u[b].completeLoad(i), 28 | c.detachEvent&&!ca?c.detachEvent("onreadystatechange",d.onScriptLoad):c.removeEventListener("load",d.onScriptLoad,!1)};d.attach=function(b,c,i,j,l,m){var o;if(G)return j=j||d.onScriptLoad,o=c&&c.config&&c.config.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"),o.type=l||"text/javascript",o.charset="utf-8",o.async=!w.skipAsync[b],c&&o.setAttribute("data-requirecontext",c.contextName),o.setAttribute("data-requiremodule",i),o.attachEvent&& 29 | !ca?(O=!0,m?o.onreadystatechange=function(){if(o.readyState==="loaded")o.onreadystatechange=null,o.attachEvent("onreadystatechange",j),m(o)}:o.attachEvent("onreadystatechange",j)):o.addEventListener("load",j,!1),o.src=b,m||d.addScriptToDom(o),o;else ba&&(importScripts(b),c.completeLoad(i));return null};if(G){v=document.getElementsByTagName("script");for(H=v.length-1;H>-1&&(A=v[H]);H--){if(!y)y=A.parentNode;if(B=A.getAttribute("data-main")){if(!r.baseUrl)v=B.split("/"),A=v.pop(),v=v.length?v.join("/")+ 30 | "/":"./",r.baseUrl=v,B=A.replace(aa,"");r.deps=r.deps?r.deps.concat(B):[B];break}}}d.checkReadyState=function(){var b=w.contexts,c;for(c in b)if(!(c in K)&&b[c].waitCount)return;d.resourcesReady(!0)};d.resourcesReady=function(b){var c,i;d.resourcesDone=b;if(d.resourcesDone)for(i in b=w.contexts,b)if(!(i in K)&&(c=b[i],c.jQueryIncremented))V(c.jQuery,!1),c.jQueryIncremented=!1};d.pageLoaded=function(){if(document.readyState!=="complete")document.readyState="complete"};if(G&&document.addEventListener&& 31 | !document.readyState)document.readyState="loading",window.addEventListener("load",d.pageLoaded,!1);d(r);if(d.isAsync&&typeof setTimeout!=="undefined")C=w.contexts[r.context||"_"],C.requireWait=!0,setTimeout(function(){C.requireWait=!1;C.takeGlobalQueue();C.jQueryCheck();C.scriptCount||C.resume();d.checkReadyState()},0)}})(); -------------------------------------------------------------------------------- /qunit/js/lib/require.js: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 1.0.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(){function J(b){return M.call(b)==="[object Function]"}function E(b){return M.call(b)==="[object Array]"}function Z(b,c,i){for(var j in c)if(!(j in K)&&(!(j in b)||i))b[j]=c[j];return d}function N(b,c,d){b=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);if(d)b.originalError=d;return b}function $(b,c,d){var j,l,q;for(j=0;q=c[j];j++){q=typeof q==="string"?{name:q}:q;l=q.location;if(d&&(!l||l.indexOf("/")!==0&&l.indexOf(":")===-1))l=d+"/"+(l||q.name);b[q.name]={name:q.name,location:l|| 8 | q.name,main:(q.main||"main").replace(da,"").replace(aa,"")}}}function V(b,c){b.holdReady?b.holdReady(c):c?b.readyWait+=1:b.ready(!0)}function ea(b){function c(a,h){var e,s;if(a&&a.charAt(0)==="."&&h){p.pkgs[h]?h=[h]:(h=h.split("/"),h=h.slice(0,h.length-1));e=a=h.concat(a.split("/"));var b;for(s=0;b=e[s];s++)if(b===".")e.splice(s,1),s-=1;else if(b==="..")if(s===1&&(e[2]===".."||e[0]===".."))break;else s>0&&(e.splice(s-1,2),s-=2);s=p.pkgs[e=a[0]];a=a.join("/");s&&a===e+"/"+s.main&&(a=e)}return a}function i(a, 9 | h){var e=a?a.indexOf("!"):-1,b=null,d=h?h.name:null,f=a,k,i;e!==-1&&(b=a.substring(0,e),a=a.substring(e+1,a.length));b&&(b=c(b,d));a&&(b?k=(e=n[b])&&e.normalize?e.normalize(a,function(a){return c(a,d)}):c(a,d):(k=c(a,d),i=E[k],i||(i=g.nameToUrl(k,null,h),E[k]=i)));return{prefix:b,name:k,parentMap:h,url:i,originalName:f,fullName:b?b+"!"+(k||""):k}}function j(){var a=!0,h=p.priorityWait,e,b;if(h){for(b=0;e=h[b];b++)if(!t[e]){a=!1;break}a&&delete p.priorityWait}return a}function l(a,h,e){return function(){var b= 10 | ga.call(arguments,0),c;if(e&&J(c=b[b.length-1]))c.__requireJsBuild=!0;b.push(h);return a.apply(null,b)}}function q(a,h){var e=l(g.require,a,h);Z(e,{nameToUrl:l(g.nameToUrl,a),toUrl:l(g.toUrl,a),defined:l(g.requireDefined,a),specified:l(g.requireSpecified,a),isBrowser:d.isBrowser});return e}function o(a){var h,e,b;b=a.callback;var c=a.map,f=c.fullName,k=a.deps,fa=a.listeners;if(b&&J(b)){if(p.catchError.define)try{e=d.execCb(f,a.callback,k,n[f])}catch(j){h=j}else e=d.execCb(f,a.callback,k,n[f]);if(f)a.cjsModule&& 11 | a.cjsModule.exports!==void 0?e=n[f]=a.cjsModule.exports:e===void 0&&a.usingExports?e=n[f]:(n[f]=e,F[f]&&(Q[f]=!0))}else f&&(e=n[f]=b,F[f]&&(Q[f]=!0));if(D[a.id])delete D[a.id],a.isDone=!0,g.waitCount-=1,g.waitCount===0&&(I=[]);delete R[f];if(d.onResourceLoad&&!a.placeholder)d.onResourceLoad(g,c,a.depArray);if(h)return e=(f?i(f).url:"")||h.fileName||h.sourceURL,b=h.moduleTree,h=N("defineerror",'Error evaluating module "'+f+'" at location "'+e+'":\n'+h+"\nfileName:"+e+"\nlineNumber: "+(h.lineNumber|| 12 | h.line),h),h.moduleName=f,h.moduleTree=b,d.onError(h);for(h=0;b=fa[h];h++)b(e)}function r(a,h){return function(b){a.depDone[h]||(a.depDone[h]=!0,a.deps[h]=b,a.depCount-=1,a.depCount||o(a))}}function v(a,h){var b=h.map,c=b.fullName,i=b.name,f=L[a]||(L[a]=n[a]),k;if(!h.loading)h.loading=!0,k=function(a){h.callback=function(){return a};o(h);t[h.id]=!0;x()},k.fromText=function(a,h){var b=O;t[a]=!1;g.scriptCount+=1;g.fake[a]=!0;b&&(O=!1);d.exec(h);b&&(O=!0);g.completeLoad(a)},c in n?k(n[c]):f.load(i,q(b.parentMap, 13 | !0),k,p)}function w(a){D[a.id]||(D[a.id]=a,I.push(a),g.waitCount+=1)}function C(a){this.listeners.push(a)}function u(a,b){var e=a.fullName,c=a.prefix,d=c?L[c]||(L[c]=n[c]):null,f,k;e&&(f=R[e]);if(!f&&(k=!0,f={id:(c&&!d?M++ +"__p@:":"")+(e||"__r@"+M++),map:a,depCount:0,depDone:[],depCallbacks:[],deps:[],listeners:[],add:C},z[f.id]=!0,e&&(!c||L[c])))R[e]=f;c&&!d?(e=u(i(c),!0),e.add(function(){var b=i(a.originalName,a.parentMap),b=u(b,!0);f.placeholder=!0;b.add(function(a){f.callback=function(){return a}; 14 | o(f)})})):k&&b&&(t[f.id]=!1,g.paused.push(f),w(f));return f}function y(a,b,e,c){var a=i(a,c),d=a.name,f=a.fullName,k=u(a),j=k.id,l=k.deps,m;if(f){if(f in n||t[j]===!0||f==="jquery"&&p.jQuery&&p.jQuery!==e().fn.jquery)return;z[j]=!0;t[j]=!0;f==="jquery"&&e&&S(e())}k.depArray=b;k.callback=e;for(e=0;e0)){if(p.priorityWait)if(j())x();else return;for(i in t)if(!(i in K)&&(e=!0,!t[i]))if(b)a+=i+" ";else{c=!0;break}if(e||g.waitCount){if(b&&a)return i=N("timeout","Load timeout for modules: "+a),i.requireType="timeout",i.requireModules=a,d.onError(i);if(c||g.scriptCount){if((G||ba)&&!W)W=setTimeout(function(){W=0;B()},50)}else{if(g.waitCount){for(H=0;a=I[H];H++)A(a,{});g.paused.length&&x();X<5&&(X+=1,B())}X=0;d.checkReadyState()}}}} 17 | var g,x,p={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},catchError:{}},P=[],z={require:!0,exports:!0,module:!0},E={},n={},t={},D={},I=[],T={},M=0,R={},L={},F={},Q={},Y=0;S=function(a){if(!g.jQuery&&(a=a||(typeof jQuery!=="undefined"?jQuery:null))&&!(p.jQuery&&a.fn.jquery!==p.jQuery)&&("holdReady"in a||"readyWait"in a))if(g.jQuery=a,m(["jquery",[],function(){return jQuery}]),g.scriptCount)V(a,!0),g.jQueryIncremented=!0};x=function(){var a,b,e,c,i,f;Y+=1;if(g.scriptCount<=0)g.scriptCount=0;for(;P.length;)if(a= 18 | P.shift(),a[0]===null)return d.onError(N("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));else m(a);if(!p.priorityWait||j())for(;g.paused.length;){i=g.paused;g.pausedCount+=i.length;g.paused=[];for(c=0;a=i[c];c++)b=a.map,e=b.url,f=b.fullName,b.prefix?v(b.prefix,a):!T[e]&&!t[f]&&(d.load(g,f,e),T[e]=!0);g.startTime=(new Date).getTime();g.pausedCount-=i.length}Y===1&&B();Y-=1};g={contextName:b,config:p,defQueue:P,waiting:D,waitCount:0,specified:z,loaded:t,urlMap:E,urlFetched:T,scriptCount:0, 19 | defined:n,paused:[],pausedCount:0,plugins:L,needFullExec:F,fake:{},fullExec:Q,managerCallbacks:R,makeModuleMap:i,normalize:c,configure:function(a){var b,e,c;a.baseUrl&&a.baseUrl.charAt(a.baseUrl.length-1)!=="/"&&(a.baseUrl+="/");b=p.paths;c=p.pkgs;Z(p,a,!0);if(a.paths){for(e in a.paths)e in K||(b[e]=a.paths[e]);p.paths=b}if((b=a.packagePaths)||a.packages){if(b)for(e in b)e in K||$(c,b[e],e);a.packages&&$(c,a.packages);p.pkgs=c}if(a.priority)e=g.requireWait,g.requireWait=!1,g.takeGlobalQueue(),x(), 20 | g.require(a.priority),x(),g.requireWait=e,p.priorityWait=a.priority;if(a.deps||a.callback)g.require(a.deps||[],a.callback)},requireDefined:function(a,b){return i(a,b).fullName in n},requireSpecified:function(a,b){return i(a,b).fullName in z},require:function(a,c,e){if(typeof a==="string"){if(J(c))return d.onError(N("requireargs","Invalid require call"));if(d.get)return d.get(g,a,c);c=i(a,c);a=c.fullName;return!(a in n)?d.onError(N("notloaded","Module name '"+c.fullName+"' has not been loaded yet for context: "+ 21 | b)):n[a]}(a&&a.length||c)&&y(null,a,c,e);if(!g.requireWait)for(;!g.scriptCount&&g.paused.length;)g.takeGlobalQueue(),x();return g.require},takeGlobalQueue:function(){U.length&&(ha.apply(g.defQueue,[g.defQueue.length-1,0].concat(U)),U=[])},completeLoad:function(a){var b;for(g.takeGlobalQueue();P.length;)if(b=P.shift(),b[0]===null){b[0]=a;break}else if(b[0]===a)break;else m(b),b=null;b?m(b):m([a,[],a==="jquery"&&typeof jQuery!=="undefined"?function(){return jQuery}:null]);S();d.isAsync&&(g.scriptCount-= 22 | 1);x();d.isAsync||(g.scriptCount-=1)},toUrl:function(a,b){var c=a.lastIndexOf("."),d=null;c!==-1&&(d=a.substring(c,a.length),a=a.substring(0,c));return g.nameToUrl(a,d,b)},nameToUrl:function(a,b,e){var i,j,f,k,l=g.config,a=c(a,e&&e.fullName);if(d.jsExtRegExp.test(a))b=a+(b?b:"");else{i=l.paths;j=l.pkgs;e=a.split("/");for(k=e.length;k>0;k--)if(f=e.slice(0,k).join("/"),i[f]){e.splice(0,k,i[f]);break}else if(f=j[f]){a=a===f.name?f.location+"/"+f.main:f.location;e.splice(0,k,a);break}b=e.join("/")+(b|| 23 | ".js");b=(b.charAt(0)==="/"||b.match(/^\w+:/)?"":l.baseUrl)+b}return l.urlArgs?b+((b.indexOf("?")===-1?"?":"&")+l.urlArgs):b}};g.jQueryCheck=S;g.resume=x;return g}function ia(){var b,c,d;if(m&&m.readyState==="interactive")return m;b=document.getElementsByTagName("script");for(c=b.length-1;c>-1&&(d=b[c]);c--)if(d.readyState==="interactive")return m=d;return null}var ja=/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,ka=/require\(\s*["']([^'"\s]+)["']\s*\)/g,da=/^\.\//,aa=/\.js$/,M=Object.prototype.toString,r=Array.prototype, 24 | ga=r.slice,ha=r.splice,G=!!(typeof window!=="undefined"&&navigator&&document),ba=!G&&typeof importScripts!=="undefined",la=G&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,ca=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",K={},u={},U=[],m=null,X=0,O=!1,d,r={},I,w,y,z,v,A,B,H,C,S,W;if(typeof define==="undefined"){if(typeof requirejs!=="undefined")if(J(requirejs))return;else r=requirejs,requirejs=void 0;typeof require!=="undefined"&&!J(require)&&(r=require, 25 | require=void 0);d=requirejs=function(b,c,d){var j="_",l;!E(b)&&typeof b!=="string"&&(l=b,E(c)?(b=c,c=d):b=[]);if(l&&l.context)j=l.context;d=u[j]||(u[j]=ea(j));l&&d.configure(l);return d.require(b,c)};d.config=function(b){return d(b)};require||(require=d);d.toUrl=function(b){return u._.toUrl(b)};d.version="1.0.0";d.jsExtRegExp=/^\/|:|\?|\.js$/;w=d.s={contexts:u,skipAsync:{}};if(d.isAsync=d.isBrowser=G)if(y=w.head=document.getElementsByTagName("head")[0],z=document.getElementsByTagName("base")[0])y= 26 | w.head=z.parentNode;d.onError=function(b){throw b;};d.load=function(b,c,i){d.resourcesReady(!1);b.scriptCount+=1;d.attach(i,b,c);if(b.jQuery&&!b.jQueryIncremented)V(b.jQuery,!0),b.jQueryIncremented=!0};define=function(b,c,d){var j,l;typeof b!=="string"&&(d=c,c=b,b=null);E(c)||(d=c,c=[]);!c.length&&J(d)&&d.length&&(d.toString().replace(ja,"").replace(ka,function(b,d){c.push(d)}),c=(d.length===1?["require"]:["require","exports","module"]).concat(c));if(O&&(j=I||ia()))b||(b=j.getAttribute("data-requiremodule")), 27 | l=u[j.getAttribute("data-requirecontext")];(l?l.defQueue:U).push([b,c,d])};define.amd={multiversion:!0,plugins:!0,jQuery:!0};d.exec=function(b){return eval(b)};d.execCb=function(b,c,d,j){return c.apply(j,d)};d.addScriptToDom=function(b){I=b;z?y.insertBefore(b,z):y.appendChild(b);I=null};d.onScriptLoad=function(b){var c=b.currentTarget||b.srcElement,i;if(b.type==="load"||c&&la.test(c.readyState))m=null,b=c.getAttribute("data-requirecontext"),i=c.getAttribute("data-requiremodule"),u[b].completeLoad(i), 28 | c.detachEvent&&!ca?c.detachEvent("onreadystatechange",d.onScriptLoad):c.removeEventListener("load",d.onScriptLoad,!1)};d.attach=function(b,c,i,j,l,m){var o;if(G)return j=j||d.onScriptLoad,o=c&&c.config&&c.config.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"),o.type=l||"text/javascript",o.charset="utf-8",o.async=!w.skipAsync[b],c&&o.setAttribute("data-requirecontext",c.contextName),o.setAttribute("data-requiremodule",i),o.attachEvent&& 29 | !ca?(O=!0,m?o.onreadystatechange=function(){if(o.readyState==="loaded")o.onreadystatechange=null,o.attachEvent("onreadystatechange",j),m(o)}:o.attachEvent("onreadystatechange",j)):o.addEventListener("load",j,!1),o.src=b,m||d.addScriptToDom(o),o;else ba&&(importScripts(b),c.completeLoad(i));return null};if(G){v=document.getElementsByTagName("script");for(H=v.length-1;H>-1&&(A=v[H]);H--){if(!y)y=A.parentNode;if(B=A.getAttribute("data-main")){if(!r.baseUrl)v=B.split("/"),A=v.pop(),v=v.length?v.join("/")+ 30 | "/":"./",r.baseUrl=v,B=A.replace(aa,"");r.deps=r.deps?r.deps.concat(B):[B];break}}}d.checkReadyState=function(){var b=w.contexts,c;for(c in b)if(!(c in K)&&b[c].waitCount)return;d.resourcesReady(!0)};d.resourcesReady=function(b){var c,i;d.resourcesDone=b;if(d.resourcesDone)for(i in b=w.contexts,b)if(!(i in K)&&(c=b[i],c.jQueryIncremented))V(c.jQuery,!1),c.jQueryIncremented=!1};d.pageLoaded=function(){if(document.readyState!=="complete")document.readyState="complete"};if(G&&document.addEventListener&& 31 | !document.readyState)document.readyState="loading",window.addEventListener("load",d.pageLoaded,!1);d(r);if(d.isAsync&&typeof setTimeout!=="undefined")C=w.contexts[r.context||"_"],C.requireWait=!0,setTimeout(function(){C.requireWait=!1;C.takeGlobalQueue();C.jQueryCheck();C.scriptCount||C.resume();d.checkReadyState()},0)}})(); -------------------------------------------------------------------------------- /nodeunit/js/lib/require.js: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 0.26.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(){function M(a){return $.call(a)==="[object Function]"}function E(a){return $.call(a)==="[object Array]"}function V(a,c,g){for(var e in c)if(!(e in J)&&(!(e in a)||g))a[e]=c[e];return d}function R(a,c,d){a=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+a);if(d)a.originalError=d;return a}function aa(a,c,d){var e,x,j;for(e=0;j=c[e];e++){j=typeof j==="string"?{name:j}:j;x=j.location;if(d&&(!x||x.indexOf("/")!==0&&x.indexOf(":")===-1))x=d+"/"+(x||j.name);a[j.name]={name:j.name,location:x|| 8 | j.name,main:(j.main||"main").replace(fa,"").replace(ba,"")}}}function W(a,d){a.holdReady?a.holdReady(d):d?a.readyWait+=1:a.ready(!0)}function ga(a){function c(b,h){var n,o;if(b&&b.charAt(0)==="."&&h){p.pkgs[h]?h=[h]:(h=h.split("/"),h=h.slice(0,h.length-1));n=b=h.concat(b.split("/"));var a;for(o=0;a=n[o];o++)if(a===".")n.splice(o,1),o-=1;else if(a==="..")if(o===1&&(n[2]===".."||n[0]===".."))break;else o>0&&(n.splice(o-1,2),o-=2);o=p.pkgs[n=b[0]];b=b.join("/");o&&b===n+"/"+o.main&&(b=n)}return b}function g(b, 9 | h){var n=b?b.indexOf("!"):-1,o=null,a=h?h.name:null,ha=b,g,l;n!==-1&&(o=b.substring(0,n),b=b.substring(n+1,b.length));o&&(o=c(o,a));b&&(g=o?(n=m[o])?n.normalize?n.normalize(b,function(b){return c(b,a)}):c(b,a):"__$p"+a+"@"+(b||""):c(b,a),l=E[g],l||(l=d.toModuleUrl?d.toModuleUrl(f,g,h):f.nameToUrl(g,null,h),E[g]=l));return{prefix:o,name:g,parentMap:h,url:l,originalName:ha,fullName:o?o+"!"+(g||""):g}}function e(){var b=!0,h=p.priorityWait,n,a;if(h){for(a=0;n=h[a];a++)if(!s[n]){b=!1;break}b&&delete p.priorityWait}return b} 10 | function x(b){return function(h){b.exports=h}}function j(b,h,n){return function(){var a=[].concat(ia.call(arguments,0)),d;if(n&&M(d=a[a.length-1]))d.__requireJsBuild=!0;a.push(h);return b.apply(null,a)}}function q(b,h){var a=j(f.require,b,h);V(a,{nameToUrl:j(f.nameToUrl,b),toUrl:j(f.toUrl,b),defined:j(f.requireDefined,b),specified:j(f.requireSpecified,b),ready:d.ready,isBrowser:d.isBrowser});if(d.paths)a.paths=d.paths;return a}function v(b){var h=b.prefix,a=b.fullName;y[a]||a in m||(h&&!K[h]&&(K[h]= 11 | void 0,(S[h]||(S[h]=[])).push(b),(t[h]||(t[h]=[])).push({onDep:function(b){if(b===h){var a,n,d,c,f,e,j=S[h];if(j)for(d=0;a=j[d];d++)if(b=a.fullName,a=g(a.originalName,a.parentMap),a=a.fullName,n=t[b]||[],c=t[a],a!==b){b in y&&(delete y[b],y[a]=!0);t[a]=c?c.concat(n):n;delete t[b];for(c=0;c0)){if(p.priorityWait)if(e())G();else return;for(k in s)if(!(k in J)&&(c=!0,!s[k]))if(a)b+=k+" ";else{g=!0;break}if(c||f.waitCount){if(a&&b)return k=R("timeout","Load timeout for modules: "+b),k.requireType="timeout",k.requireModules= 16 | b,d.onError(k);if(g||f.scriptCount){if((B||ca)&&!X)X=setTimeout(function(){X=0;A()},50)}else{if(f.waitCount){for(H=0;b=I[H];H++)C(b,{});Y<5&&(Y+=1,A())}Y=0;d.checkReadyState()}}}}function D(b,a){var c=a.name,e=a.fullName,g;if(!(e in m||e in s))K[b]||(K[b]=m[b]),s[e]||(s[e]=!1),g=function(g){if(d.onPluginLoad)d.onPluginLoad(f,b,c,g);w({prefix:a.prefix,name:a.name,fullName:a.fullName,callback:function(){return g}});s[e]=!0},g.fromText=function(b,a){var c=N;f.loaded[b]=!1;f.scriptCount+=1;c&&(N=!1); 17 | d.exec(a);c&&(N=!0);f.completeLoad(b)},K[b].load(c,q(a.parentMap,!0),g,p)}function L(b){b.prefix&&b.name&&b.name.indexOf("__$p")===0&&m[b.prefix]&&(b=g(b.originalName,b.parentMap));var a=b.prefix,c=b.fullName,e=f.urlFetched;!y[c]&&!s[c]&&(y[c]=!0,a?m[a]?D(a,b):(O[a]||(O[a]=[],(t[a]||(t[a]=[])).push({onDep:function(b){if(b===a){for(var c,d=O[a],b=0;b0;m--)if(i=e.slice(0,m).join("/"),g[i]){e.splice(0,m,g[i]);break}else if(i=j[i]){b=b===i.name?i.location+"/"+i.main:i.location;e.splice(0,m,b);break}a=e.join("/")+(a||".js");a=(a.charAt(0)==="/"||a.match(/^\w+:/)?"":l.baseUrl)+a}return l.urlArgs?a+((a.indexOf("?")===-1?"?":"&")+l.urlArgs):a}};f.jQueryCheck=T;f.resume=G;return f}function la(){var a, 24 | c,d;if(C&&C.readyState==="interactive")return C;a=document.getElementsByTagName("script");for(c=a.length-1;c>-1&&(d=a[c]);c--)if(d.readyState==="interactive")return C=d;return null}var ma=/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,na=/require\(\s*["']([^'"\s]+)["']\s*\)/g,fa=/^\.\//,ba=/\.js$/,$=Object.prototype.toString,q=Array.prototype,ia=q.slice,ka=q.splice,B=!!(typeof window!=="undefined"&&navigator&&document),ca=!B&&typeof importScripts!=="undefined",oa=B&&navigator.platform==="PLAYSTATION 3"?/^complete$/: 25 | /^(complete|loaded)$/,da=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",ja="_r@@",J={},z={},U=[],C=null,Y=0,N=!1,d,q={},I,i,u,L,v,A,D,H,Q,ea,w,T,X;if(typeof define==="undefined"){if(typeof requirejs!=="undefined")if(M(requirejs))return;else q=requirejs,requirejs=void 0;typeof require!=="undefined"&&!M(require)&&(q=require,require=void 0);d=requirejs=function(a,c,d){var e="_",i;!E(a)&&typeof a!=="string"&&(i=a,E(c)?(a=c,c=d):a=[]);if(i&&i.context)e=i.context;d=z[e]||(z[e]=ga(e));i&& 26 | d.configure(i);return d.require(a,c)};d.config=function(a){return d(a)};typeof require==="undefined"&&(require=d);d.toUrl=function(a){return z._.toUrl(a)};d.version="0.26.0";d.isArray=E;d.isFunction=M;d.mixin=V;d.jsExtRegExp=/^\/|:|\?|\.js$/;i=d.s={contexts:z,skipAsync:{},isPageLoaded:!B,readyCalls:[]};if(d.isAsync=d.isBrowser=B)if(u=i.head=document.getElementsByTagName("head")[0],L=document.getElementsByTagName("base")[0])u=i.head=L.parentNode;d.onError=function(a){throw a;};d.load=function(a,c, 27 | g){var e=a.loaded;e[c]||(e[c]=!1);a.scriptCount+=1;d.attach(g,a,c);if(a.jQuery&&!a.jQueryIncremented)W(a.jQuery,!0),a.jQueryIncremented=!0};define=d.def=function(a,c,g){var e,i;typeof a!=="string"&&(g=c,c=a,a=null);d.isArray(c)||(g=c,c=[]);!a&&!c.length&&d.isFunction(g)&&g.length&&(g.toString().replace(ma,"").replace(na,function(a,d){c.push(d)}),c=(g.length===1?["require"]:["require","exports","module"]).concat(c));if(N&&(e=I||la()))a||(a=e.getAttribute("data-requiremodule")),i=z[e.getAttribute("data-requirecontext")]; 28 | (i?i.defQueue:U).push([a,c,g])};define.amd={multiversion:!0,plugins:!0,jQuery:!0};d.exec=function(a){return eval(a)};d.execCb=function(a,c,d,e){return c.apply(e,d)};d.onScriptLoad=function(a){var c=a.currentTarget||a.srcElement,g;if(a.type==="load"||oa.test(c.readyState))C=null,a=c.getAttribute("data-requirecontext"),g=c.getAttribute("data-requiremodule"),z[a].completeLoad(g),c.detachEvent&&!da?c.detachEvent("onreadystatechange",d.onScriptLoad):c.removeEventListener("load",d.onScriptLoad,!1)};d.attach= 29 | function(a,c,g,e,q){var j;if(B)return e=e||d.onScriptLoad,j=c&&c.config&&c.config.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"),j.type=q||"text/javascript",j.charset="utf-8",j.async=!i.skipAsync[a],c&&j.setAttribute("data-requirecontext",c.contextName),j.setAttribute("data-requiremodule",g),j.attachEvent&&!da?(N=!0,j.attachEvent("onreadystatechange",e)):j.addEventListener("load",e,!1),j.src=a,I=j,L?u.insertBefore(j,L):u.appendChild(j), 30 | I=null,j;else if(ca)e=c.loaded,e[g]=!1,importScripts(a),c.completeLoad(g);return null};if(B){v=document.getElementsByTagName("script");for(H=v.length-1;H>-1&&(A=v[H]);H--){if(!u)u=A.parentNode;if(D=A.getAttribute("data-main")){if(!q.baseUrl)v=D.split("/"),A=v.pop(),v=v.length?v.join("/")+"/":"./",q.baseUrl=v,D=A.replace(ba,"");q.deps=q.deps?q.deps.concat(D):[D];break}}}i.baseUrl=q.baseUrl;d.pageLoaded=function(){if(!i.isPageLoaded){i.isPageLoaded=!0;Q&&clearInterval(Q);if(ea)document.readyState="complete"; 31 | d.callReady()}};d.checkReadyState=function(){var a=i.contexts,c;for(c in a)if(!(c in J)&&a[c].waitCount)return;i.isDone=!0;d.callReady()};d.callReady=function(){var a=i.readyCalls,c,d,e;if(i.isPageLoaded&&i.isDone){if(a.length){i.readyCalls=[];for(c=0;d=a[c];c++)d()}a=i.contexts;for(e in a)if(!(e in J)&&(c=a[e],c.jQueryIncremented))W(c.jQuery,!1),c.jQueryIncremented=!1}};d.ready=function(a){i.isPageLoaded&&i.isDone?a():i.readyCalls.push(a);return d};if(B){if(document.addEventListener){if(document.addEventListener("DOMContentLoaded", 32 | d.pageLoaded,!1),window.addEventListener("load",d.pageLoaded,!1),!document.readyState)ea=!0,document.readyState="loading"}else window.attachEvent&&(window.attachEvent("onload",d.pageLoaded),self===self.top&&(Q=setInterval(function(){try{document.body&&(document.documentElement.doScroll("left"),d.pageLoaded())}catch(a){}},30)));document.readyState==="complete"&&d.pageLoaded()}d(q);if(d.isAsync&&typeof setTimeout!=="undefined")w=i.contexts[q.context||"_"],w.requireWait=!0,setTimeout(function(){w.requireWait= 33 | !1;w.takeGlobalQueue();w.jQueryCheck();w.scriptCount||w.resume();d.checkReadyState()},0)}})(); 34 | --------------------------------------------------------------------------------