diff --git a/tests/UI/config.dist.js b/tests/UI/config.dist.js index 687cebc0de0fbe62b8e22ef8e409f5e6d4006825..c9faa5e425265b3db9a60ee0f64491a82c449039 100644 --- a/tests/UI/config.dist.js +++ b/tests/UI/config.dist.js @@ -30,7 +30,7 @@ exports.php = 'php'; /** * The folder in tests/lib that holds mocha. */ -exports.mocha = 'mocha-2.1.0'; +exports.mocha = 'mocha-2.2.5'; /** * The folder in tests/lib that holds chai. diff --git a/tests/lib/mocha-2.1.0/.editorconfig b/tests/lib/mocha-2.1.0/.editorconfig deleted file mode 100644 index e3a4859eeb8f6532cad1c1dfa348f77a2955cb5f..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/.editorconfig +++ /dev/null @@ -1,18 +0,0 @@ -# This file is for unifying the coding style for different editors and IDEs -# editorconfig.org - -root = true - -[*] -end_of_line = lf -charset = utf-8 -insert_final_newline = true -trim_trailing_whitespace = true -indent_style = space -indent_size = 2 - -[Makefile] -indent_style = tab - -[*.md] -trim_trailing_whitespace = false diff --git a/tests/lib/mocha-2.1.0/.gitignore b/tests/lib/mocha-2.1.0/.gitignore deleted file mode 100644 index aba55e682ed716fcba51b494feae95cc357b6bc1..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -coverage.html -lib-cov -.DS_Store -node_modules -test-outputs -*.sock -testing -_mocha.js -my-reporter.js -*.sw* -lib/browser/diff.js -.idea -*.iml -*.patch -*.diff diff --git a/tests/lib/mocha-2.1.0/.mailmap b/tests/lib/mocha-2.1.0/.mailmap deleted file mode 100644 index 704013125b6cf9671251eb91ddb5da57b0d1cbad..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/.mailmap +++ /dev/null @@ -1 +0,0 @@ -TJ Holowaychuk <tj@vision-media.ca> \ No newline at end of file diff --git a/tests/lib/mocha-2.1.0/.travis.yml b/tests/lib/mocha-2.1.0/.travis.yml deleted file mode 100644 index c33b3fa3a1431d003ffe4130ab04129722958ad3..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: node_js -script: travis_retry npm test -node_js: -- '0.11' -- '0.10' -- '0.8' -notifications: - slack: - secure: Xov4Q/jpmTr6p5E/kYeC0HF1tWm0YqBWvCUbNuJiti3CtFpVmOwXEvxGFcvZNAXApEVrs1uhLZLifuL3oJ/TNdqzM5nT5jDGawPYgf8ly+fTaEiCpsRCdQhFLVqYoN671eyx7QILtre9b51SeaFVVksMrfTmvh4aKJCN01iuJm4= diff --git a/tests/lib/mocha-2.1.0/CONTRIBUTING.md b/tests/lib/mocha-2.1.0/CONTRIBUTING.md deleted file mode 100644 index 6d172f0800a926baf31665cebb8a44e35409f831..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/CONTRIBUTING.md +++ /dev/null @@ -1,49 +0,0 @@ -# Contributing to Mocha - -Hi! We could use your help. Let us help you help us. Or something. - -## General - -1. If you are looking for a place to begin, **please send PRs for bugfixes instead of new features**, and/or **look for issues labeled `PR PLEASE`.** - -2. **Help with documentation and the wiki is always appreciated**. - -3. Please **be courteous and constructive** when commenting on issues, commits, and pull requests. - -## Bug Reports & Issues - -1. When reporting a bug, please **provide steps to reproduce**. If possible, show code. - -2. Please **show all code in JavaScript**. We don't all read `<insert-language-that-compiles-to-JavaScript-here>`. If you do not, you will be asked to. - -3. Because Mocha works with many third-party libraries and tools, **ensure the bug you are reporting is actually within Mocha**. - -4. If you report a bug, and it is inactive for a significant amount of time, it may be closed. **Please respond promptly to requests for more information**. - -## Pull Requests - -1. Before sending a large PR, it's recommended to **create an issue to propose the change**. Nobody wants to write a book of code and throw it away. - -2. Because Mocha should be kept as maintainable as possible, its codebase must be kept slim. Historically, *most PRs for new features are not merged*. New features inevitably increase the size of the codebase, and thus reduce maintainability. Only features *deemed essential* are likely to be merged--this is at the discretion of the maintainer(s). If your PR for a feature is not merged, this doesn't necessarily mean your PR was a bad idea, wouldn't be used, or otherwise sucks. It just means **only essential PRs for new features are likely to be merged**. - -3. Due to the above, before creating a PR for a new feature, **create an issue to propose the feature.** - -4. Please **respect existing coding conventions**, whatever those may be. - -5. If your PR has been waiting in limbo for some time, it's very helpful to **rebase against master**, which will make it easier to merge. - -6. Please **add tests for new code**. - -7. **Always run `npm test` before sending a PR.** If you break the tests, your PR will not be accepted until they are fixed. - -## Source Control - -1. Please **squash your commits** when sending a pull request. If you are unfamiliar with this process, see [this guide](https://help.github.com/articles/about-git-rebase/). If you have already pushed your changesets and are squashing thereafter, this may necessitate the use of a "force push". Please [read the docs](http://git-scm.com/docs/git-push) before you attempt this. - -2. Please **follow the commit message conventions [outlined here](https://medium.com/code-adventures/git-conventions-a940ee20862d).** - -## TL;DR - -**Be kind, be diligent, look before you leap into a PR, and follow common community conventions**. - -*- The Mocha Team* diff --git a/tests/lib/mocha-2.1.0/HISTORY.md b/tests/lib/mocha-2.1.0/HISTORY.md deleted file mode 100644 index 95f0f0f9db138cb53089ef6e6a55df3ad0861d15..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/HISTORY.md +++ /dev/null @@ -1,801 +0,0 @@ - -2.1.0 / 2014-12-23 -================== - - * showDiff: don’t stringify strings - * Clean up unused module dependencies. - * Filter zero-length strings from mocha.opts - * only write to stdout in reporters - * Revert "only write to stdout in reporters" - * Print colored output only to a tty - * update summary in README.md - * rename Readme.md/History.md to README.md/HISTORY.md because neurotic - * add .mailmap to fix "git shortlog" or "git summary" output - * fixes #1461: nyan-reporter now respects Base.useColors, fixed bug where Base.color would not return a string when str wasn't a string. - * Use existing test URL builder in failed replay links - * modify .travis.yml: use travis_retry; closes #1449 - * fix -t 0 behavior; closes #1446 - * fix tests (whoops) - * improve diff behavior - * Preserve pathname when linking to individual tests - * Fix test - * Tiny typo in comments fixed - * after hooks now being called on failed tests when using bail, fixes #1093 - * fix throwing undefined/null now makes tests fail, fixes #1395 - * compiler extensions are added as watched extensions, removed non-standard extensions from watch regex, resolves #1221 - * prefix/namespace for suite titles in markdown reporter, fixes #554 - * fix more bad markdown in CONTRIBUTING.md - * fix bad markdown in CONTRIBUTING.md - * add setImmediate/clearImmediate to globals; closes #1435 - * Fix buffer diffs (closes #1132, closes #1433) - * add a CONTRIBUTING.md. closes #882 - * fix intermittent build failures (maybe). closes #1407 - * add Slack notification to .travis.yml - * Fix slack link - * Add slack room to readme - * Update maintainers - * update maintainers and contributors - * resolves #1393: kill children with more effort on SIGINT - * xunit reporter support for optionally writing to a file - * if a reporter has a .done method, call it before exiting - * add support for reporter options - * only write to stdout in reporters - -2.0.0 / 2014-10-21 -================== - - * remove: support for node 0.6.x, 0.4.x - * fix: landing reporter with non ansi characters (#211) - * fix: html reporter - preserve query params when navigating to suites/tests (#1358) - * fix: json stream reporter add error message to failed test - * fix: fixes for visionmedia -> mochajs - * fix: use stdio, fixes node deprecation warnings (#1391) - -1.21.5 / 2014-10-11 -================== - - * fix: build for NodeJS v0.6.x - * fix: do not attempt to highlight syntax when non-HTML reporter is used - * update: escape-string-regexp to 1.0.2. - * fix: botched indentation in canonicalize() - * fix: .gitignore: ignore .patch and .diff files - * fix: changed 'Catched' to 'Caught' in uncaught exception error handler messages - * add: `pending` field for json reporter - * fix: Runner.prototype.uncaught: don't double-end runnables that already have a state. - * fix: --recursive, broken by f0facd2e - * update: replaces escapeRegexp with the escape-string-regexp package. - * update: commander to 2.3.0. - * update: diff to 1.0.8. - * fix: ability to disable syntax highlighting (#1329) - * fix: added empty object to errorJSON() call to catch when no error is present - * fix: never time out after calling enableTimeouts(false) - * fix: timeout(0) will work at suite level (#1300) - * Fix for --watch+only() issue (#888 ) - * fix: respect err.showDiff, add Base reporter test (#810) - -1.22.1-3 / 2014-07-27 -================== - - * fix: disabling timeouts with this.timeout(0) (#1301) - -1.22.1-3 / 2014-07-27 -================== - - * fix: local uis and reporters (#1288) - * fix: building 1.21.0's changes in the browser (#1284) - -1.21.0 / 2014-07-23 -================== - - * add: --no-timeouts option (#1262, #1268) - * add: --*- deprecation node flags (#1217) - * add: --watch-extensions argument (#1247) - * change: spec reporter is default (#1228) - * fix: diff output showing incorrect +/- (#1182) - * fix: diffs of circular structures (#1179) - * fix: re-render the progress bar when progress has changed only (#1151) - * fix support for environments with global and window (#1159) - * fix: reverting to previously defined onerror handler (#1178) - * fix: stringify non error objects passed to done() (#1270) - * fix: using local ui, reporters (#1267) - * fix: cleaning es6 arrows (#1176) - * fix: don't include attrs in failure tag for xunit (#1244) - * fix: fail tests that return a promise if promise is rejected w/o a reason (#1224) - * fix: showing failed tests in doc reporter (#1117) - * fix: dot reporter dots being off (#1204) - * fix: catch empty throws (#1219) - * fix: honoring timeout for sync operations (#1242) - * update: growl to 1.8.0 - -1.20.1 / 2014-06-03 -================== - - * update: should dev dependency to ~4.0.0 (#1231) - -1.20.0 / 2014-05-28 -================== - - * add: filenames to suite objects (#1222) - -1.19.0 / 2014-05-17 -================== - - * add: browser script option to package.json - * add: export file in Mocha.Test objects (#1174) - * add: add docs for wrapped node flags - * fix: mocha.run() to return error status in browser (#1216) - * fix: clean() to show failure details (#1205) - * fix: regex that generates html for new keyword (#1201) - * fix: sibling suites have inherited but separate contexts (#1164) - - -1.18.2 / 2014-03-18 -================== - - * fix: html runner was prevented from using #mocha as the default root el (#1162) - -1.18.1 / 2014-03-18 -================== - - * fix: named before/after hooks in bdd, tdd, qunit interfaces (#1161) - -1.18.0 / 2014-03-13 -================== - - * add: promise support (#329) - * add: named before/after hooks (#966) - -1.17.1 / 2014-01-22 -================== - - * fix: expected messages in should.js (should.js#168) - * fix: expect errno global in node versions < v0.9.11 (#1111) - * fix: unreliable checkGlobals optimization (#1110) - -1.17.0 / 2014-01-09 -================== - - * add: able to require globals (describe, it, etc.) through mocha (#1077) - * fix: abort previous run on --watch change (#1100) - * fix: reset context for each --watch triggered run (#1099) - * fix: error when cli can't resolve path or pattern (#799) - * fix: canonicalize objects before stringifying and diffing them (#1079) - * fix: make CR call behave like carriage return for non tty (#1087) - - -1.16.2 / 2013-12-23 -================== - - * fix: couple issues with ie 8 (#1082, #1081) - * fix: issue running the xunit reporter in browsers (#1068) - * fix: issue with firefox < 3.5 (#725) - - -1.16.1 / 2013-12-19 -================== - - * fix: recompiled for missed changes from the last release - - -1.16.0 / 2013-12-19 -================== - - * add: Runnable.globals(arr) for per test global whitelist (#1046) - * add: mocha.throwError(err) for assertion libs to call (#985) - * remove: --watch's spinner (#806) - * fix: duplicate test output for multi-line specs in spec reporter (#1006) - * fix: gracefully exit on SIGINT (#1063) - * fix expose the specified ui only in the browser (#984) - * fix: ensure process exit code is preserved when using --no-exit (#1059) - * fix: return true from window.onerror handler (#868) - * fix: xunit reporter to use process.stdout.write (#1068) - * fix: utils.clean(str) indentation (#761) - * fix: xunit reporter returning test duration a NaN (#1039) - -1.15.1 / 2013-12-03 -================== - - * fix: recompiled for missed changes from the last release - -1.15.0 / 2013-12-02 -================== - - * add: `--no-exit` to prevent `process.exit()` (#1018) - * fix: using inline diffs (#1044) - * fix: show pending test details in xunit reporter (#1051) - * fix: faster global leak detection (#1024) - * fix: yui compression (#1035) - * fix: wrapping long lines in test results (#1030, #1031) - * fix: handle errors in hooks (#1043) - -1.14.0 / 2013-11-02 -================== - - * add: unified diff (#862) - * add: set MOCHA_COLORS env var to use colors (#965) - * add: able to override tests links in html reporters (#776) - * remove: teamcity reporter (#954) - * update: commander dependency to 2.0.0 (#1010) - * fix: mocha --ui will try to require the ui if not built in, as --reporter does (#1022) - * fix: send cursor commands only if isatty (#184, #1003) - * fix: include assertion message in base reporter (#993, #991) - * fix: consistent return of it, it.only, and describe, describe.only (#840) - -1.13.0 / 2013-09-15 -================== - - * add: sort test files with --sort (#813) - * update: diff depedency to 1.0.7 - * update: glob dependency to 3.2.3 (#927) - * fix: diffs show whitespace differences (#976) - * fix: improve global leaks (#783) - * fix: firefox window.getInterface leak - * fix: accessing iframe via window[iframeIndex] leak - * fix: faster global leak checking - * fix: reporter pending css selector (#970) - -1.12.1 / 2013-08-29 -================== - - * remove test.js from .gitignore - * update included version of ms.js - -1.12.0 / 2013-07-01 -================== - - * add: prevent diffs for differing types. Closes #900 - * add `Mocha.process` hack for phantomjs - * fix: use compilers with requires - * fix regexps in diffs. Closes #890 - * fix xunit NaN on failure. Closes #894 - * fix: strip tab indentation in `clean` utility method - * fix: textmate bundle installation - -1.11.0 / 2013-06-12 -================== - - * add --prof support - * add --harmony support - * add --harmony-generators support - * add "Uncaught " prefix to uncaught exceptions - * add web workers support - * add `suite.skip()` - * change to output # of pending / passing even on failures. Closes #872 - * fix: prevent hooks from being called if we are bailing - * fix `this.timeout(0)` - -1.10.0 / 2013-05-21 -================== - - * add add better globbing support for windows via `glob` module - * add support to pass through flags such as --debug-brk=1234. Closes #852 - * add test.only, test.skip to qunit interface - * change to always use word-based diffs for now. Closes #733 - * change `mocha init` tests.html to index.html - * fix `process` global leak in the browser - * fix: use resolve() instead of join() for --require - * fix: filterLeaks() condition to not consider indices in global object as leaks - * fix: restrict mocha.css styling to #mocha id - * fix: save timer references to avoid Sinon interfering in the browser build. - -1.9.0 / 2013-04-03 -================== - - * add improved setImmediate implementation - * replace --ignore-leaks with --check-leaks - * change default of ignoreLeaks to true. Closes #791 - * remove scrolling for HTML reporter - * fix retina support - * fix tmbundle, restrict to js scope - -1.8.2 / 2013-03-11 -================== - - * add `setImmediate` support for 0.10.x - * fix mocha -w spinner on windows - -1.8.1 / 2013-01-09 -================== - - * fix .bail() arity check causing it to default to true - -1.8.0 / 2013-01-08 -================== - - * add Mocha() options bail support - * add `Mocha#bail()` method - * add instanceof check back for inheriting from Error - * add component.json - * add diff.js to browser build - * update growl - * fix TAP reporter failures comment :D - -1.7.4 / 2012-12-06 -================== - - * add total number of passes and failures to TAP - * remove .bind() calls. re #680 - * fix indexOf. Closes #680 - -1.7.3 / 2012-11-30 -================== - - * fix uncaught error support for the browser - * revert uncaught "fix" which breaks node - -1.7.2 / 2012-11-28 -================== - - * fix uncaught errors to expose the original error message - -1.7.0 / 2012-11-07 -================== - - * add `--async-only` support to prevent false positives for missing `done()` - * add sorting by filename in code coverage - * add HTML 5 doctype to browser template. - * add play button to html reporter to rerun a single test - * add `this.timeout(ms)` as Suite#timeout(ms). Closes #599 - * update growl dependency to 1.6.x - * fix encoding of test-case ?grep. Closes #637 - * fix unicode chars on windows - * fix dom globals in Opera/IE. Closes #243 - * fix markdown reporter a tags - * fix `this.timeout("5s")` support - -1.6.0 / 2012-10-02 -================== - - * add object diffs when `err.showDiff` is present - * add hiding of empty suites when pass/failures are toggled - * add faster `.length` checks to `checkGlobals()` before performing the filter - -1.5.0 / 2012-09-21 -================== - - * add `ms()` to `.slow()` and `.timeout()` - * add `Mocha#checkLeaks()` to re-enable global leak checks - * add `this.slow()` option [aheckmann] - * add tab, CR, LF to error diffs for now - * add faster `.checkGlobals()` solution [guille] - * remove `fn.call()` from reduce util - * remove `fn.call()` from filter util - * fix forEach. Closes #582 - * fix relaying of signals [TooTallNate] - * fix TAP reporter grep number - -1.4.2 / 2012-09-01 -================== - - * add support to multiple `Mocha#globals()` calls, and strings - * add `mocha.reporter()` constructor support [jfirebaugh] - * add `mocha.timeout()` - * move query-string parser to utils.js - * move highlight code to utils.js - * fix third-party reporter support [exogen] - * fix client-side API to match node-side [jfirebaugh] - * fix mocha in iframe [joliss] - -1.4.1 / 2012-08-28 -================== - - * add missing `Markdown` export - * fix `Mocha#grep()`, escape regexp strings - * fix reference error when `devicePixelRatio` is not defined. Closes #549 - -1.4.0 / 2012-08-22 -================== - - * add mkdir -p to `mocha init`. Closes #539 - * add `.only()`. Closes #524 - * add `.skip()`. Closes #524 - * change str.trim() to use utils.trim(). Closes #533 - * fix HTML progress indicator retina display - * fix url-encoding of click-to-grep HTML functionality - -1.3.2 / 2012-08-01 -================== - - * fix exports double-execution regression. Closes #531 - -1.3.1 / 2012-08-01 -================== - - * add passes/failures toggling to HTML reporter - * add pending state to `xit()` and `xdescribe()` [Brian Moore] - * add the @charset "UTF-8"; to fix #522 with FireFox. [Jonathan Creamer] - * add border-bottom to #stats links - * add check for runnable in `Runner#uncaught()`. Closes #494 - * add 0.4 and 0.6 back to travis.yml - * add `-E, --growl-errors` to growl on failures only - * add prefixes to debug() names. Closes #497 - * add `Mocha#invert()` to js api - * change dot reporter to use sexy unicode dots - * fix error when clicking pending test in HTML reporter - * fix `make tm` - -1.3.0 / 2012-07-05 -================== - - * add window scrolling to `HTML` reporter - * add v8 `--trace-*` option support - * add support for custom reports via `--reporter MODULE` - * add `--invert` switch to invert `--grep` matches - * fix export of `Nyan` reporter. Closes #495 - * fix escaping of `HTML` suite titles. Closes #486 - * fix `done()` called multiple times with an error test - * change `--grep` - regexp escape the input - -1.2.2 / 2012-06-28 -================== - - * Added 0.8.0 support - -1.2.1 / 2012-06-25 -================== - - * Added `this.test.error(err)` support to after each hooks. Closes #287 - * Added: export top-level suite on global mocha object (mocha.suite). Closes #448 - * Fixed `js` code block format error in markdown reporter - * Fixed deprecation warning when using `path.existsSync` - * Fixed --globals with wildcard - * Fixed chars in nyan when his head moves back - * Remove `--growl` from test/mocha.opts. Closes #289 - -1.2.0 / 2012-06-17 -================== - - * Added `nyan` reporter [Atsuya Takagi] - * Added `mocha init <path>` to copy client files - * Added "specify" synonym for "it" [domenic] - * Added global leak wildcard support [nathanbowser] - * Fixed runner emitter leak. closes #432 - * Fixed omission of .js extension. Closes #454 - -1.1.0 / 2012-05-30 -================== - - * Added: check each `mocha(1)` arg for directories to walk - * Added `--recursive` [tricknotes] - * Added `context` for BDD [hokaccha] - * Added styling for new clickable titles - * Added clickable suite titles to HTML reporter - * Added warning when strings are thrown as errors - * Changed: green arrows again in HTML reporter styling - * Changed ul/li elements instead of divs for better copy-and-pasting [joliss] - * Fixed issue #325 - add better grep support to js api - * Fixed: save timer references to avoid Sinon interfering. - -1.0.3 / 2012-04-30 -================== - - * Fixed string diff newlines - * Fixed: removed mocha.css target. Closes #401 - -1.0.2 / 2012-04-25 -================== - - * Added HTML reporter duration. Closes #47 - * Fixed: one postMessage event listener [exogen] - * Fixed: allow --globals to be used multiple times. Closes #100 [brendannee] - * Fixed #158: removes jquery include from browser tests - * Fixed grep. Closes #372 [brendannee] - * Fixed #166 - When grepping don't display the empty suites - * Removed test/browser/style.css. Closes #385 - -1.0.1 / 2012-04-04 -================== - - * Fixed `.timeout()` in hooks - * Fixed: allow callback for `mocha.run()` in client version - * Fixed browser hook error display. Closes #361 - -1.0.0 / 2012-03-24 -================== - - * Added js API. Closes #265 - * Added: initial run of tests with `--watch`. Closes #345 - * Added: mark `location` as a global on the CS. Closes #311 - * Added `markdown` reporter (github flavour) - * Added: scrolling menu to coverage.html. Closes #335 - * Added source line to html report for Safari [Tyson Tate] - * Added "min" reporter, useful for `--watch` [Jakub NeÅ¡etÅ™il] - * Added support for arbitrary compilers via . Closes #338 [Ian Young] - * Added Teamcity export to lib/reporters/index [Michael Riley] - * Fixed chopping of first char in error reporting. Closes #334 [reported by topfunky] - * Fixed terrible FF / Opera stack traces - -0.14.1 / 2012-03-06 -================== - - * Added lib-cov to _.npmignore_ - * Added reporter to `mocha.run([reporter])` as argument - * Added some margin-top to the HTML reporter - * Removed jQuery dependency - * Fixed `--watch`: purge require cache. Closes #266 - -0.14.0 / 2012-03-01 -================== - - * Added string diff support for terminal reporters - -0.13.0 / 2012-02-23 -================== - - * Added preliminary test coverage support. Closes #5 - * Added `HTMLCov` reporter - * Added `JSONCov` reporter [kunklejr] - * Added `xdescribe()` and `xit()` to the BDD interface. Closes #263 (docs * Changed: make json reporter output pretty json - * Fixed node-inspector support, swapped `--debug` for `debug` to match node. -needed) -Closes #247 - -0.12.1 / 2012-02-14 -================== - - * Added `npm docs mocha` support [TooTallNate] - * Added a `Context` object used for hook and test-case this. Closes #253 - * Fixed `Suite#clone()` `.ctx` reference. Closes #262 - -0.12.0 / 2012-02-02 -================== - - * Added .coffee `--watch` support. Closes #242 - * Added support to `--require` files relative to the CWD. Closes #241 - * Added quick n dirty syntax highlighting. Closes #248 - * Changed: made HTML progress indicator smaller - * Fixed xunit errors attribute [dhendo] - -0.10.2 / 2012-01-21 -================== - - * Fixed suite count in reporter stats. Closes #222 - * Fixed `done()` after timeout error reporting [Phil Sung] - * Changed the 0-based errors to 1 - -0.10.1 / 2012-01-17 -================== - - * Added support for node 0.7.x - * Fixed absolute path support. Closes #215 [kompiro] - * Fixed `--no-colors` option [Jussi Virtanen] - * Fixed Arial CSS typo in the correct file - -0.10.0 / 2012-01-13 -================== - - * Added `-b, --bail` to exit on first exception [guillermo] - * Added support for `-gc` / `--expose-gc` [TooTallNate] - * Added `qunit`-inspired interface - * Added MIT LICENSE. Closes #194 - * Added: `--watch` all .js in the CWD. Closes #139 - * Fixed `self.test` reference in runner. Closes #189 - * Fixed double reporting of uncaught exceptions after timeout. Closes #195 - -0.8.2 / 2012-01-05 -================== - - * Added test-case context support. Closes #113 - * Fixed exit status. Closes #187 - * Update commander. Closes #190 - -0.8.1 / 2011-12-30 -================== - - * Fixed reporting of uncaught exceptions. Closes #183 - * Fixed error message defaulting [indutny] - * Changed mocha(1) from bash to node for windows [Nathan Rajlich] - -0.8.0 / 2011-12-28 -================== - - * Added `XUnit` reporter [FeeFighters/visionmedia] - * Added `say(1)` notification support [Maciej MaÅ‚ecki] - * Changed: fail when done() is invoked with a non-Error. Closes #171 - * Fixed `err.stack`, defaulting to message. Closes #180 - * Fixed: `make tm` mkdir -p the dest. Closes #137 - * Fixed mocha(1) --help bin name - * Fixed `-d` for `--debug` support - -0.7.1 / 2011-12-22 -================== - - * Removed `mocha-debug(1)`, use `mocha --debug` - * Fixed CWD relative requires - * Fixed growl issue on windows [Raynos] - * Fixed: platform specific line endings [TooTallNate] - * Fixed: escape strings in HTML reporter. Closes #164 - -0.7.0 / 2011-12-18 -================== - - * Added support for IE{7,8} [guille] - * Changed: better browser nextTick implementation [guille] - -0.6.0 / 2011-12-18 -================== - - * Added setZeroTimeout timeout for browser (nicer stack traces). Closes #153 - * Added "view source" on hover for HTML reporter to make it obvious - * Changed: replace custom growl with growl lib - * Fixed duplicate reporting for HTML reporter. Closes #154 - * Fixed silent hook errors in the HTML reporter. Closes #150 - -0.5.0 / 2011-12-14 -================== - - * Added: push node_modules directory onto module.paths for relative require Closes #93 - * Added teamcity reporter [blindsey] - * Fixed: recover from uncaught exceptions for tests. Closes #94 - * Fixed: only emit "test end" for uncaught within test, not hook - -0.4.0 / 2011-12-14 -================== - - * Added support for test-specific timeouts via `this.timeout(0)`. Closes #134 - * Added guillermo's client-side EventEmitter. Closes #132 - * Added progress indicator to the HTML reporter - * Fixed slow browser tests. Closes #135 - * Fixed "suite" color for light terminals - * Fixed `require()` leak spotted by [guillermo] - -0.3.6 / 2011-12-09 -================== - - * Removed suite merging (for now) - -0.3.5 / 2011-12-08 -================== - - * Added support for `window.onerror` [guillermo] - * Fixed: clear timeout on uncaught exceptions. Closes #131 [guillermo] - * Added `mocha.css` to PHONY list. - * Added `mocha.js` to PHONY list. - -0.3.4 / 2011-12-08 -================== - - * Added: allow `done()` to be called with non-Error - * Added: return Runner from `mocha.run()`. Closes #126 - * Fixed: run afterEach even on failures. Closes #125 - * Fixed clobbering of current runnable. Closes #121 - -0.3.3 / 2011-12-08 -================== - - * Fixed hook timeouts. Closes #120 - * Fixed uncaught exceptions in hooks - -0.3.2 / 2011-12-05 -================== - - * Fixed weird reporting when `err.message` is not present - -0.3.1 / 2011-12-04 -================== - - * Fixed hook event emitter leak. Closes #117 - * Fixed: export `Spec` constructor. Closes #116 - -0.3.0 / 2011-12-04 -================== - - * Added `-w, --watch`. Closes #72 - * Added `--ignore-leaks` to ignore global leak checking - * Added browser `?grep=pattern` support - * Added `--globals <names>` to specify accepted globals. Closes #99 - * Fixed `mocha-debug(1)` on some systems. Closes #232 - * Fixed growl total, use `runner.total` - -0.2.0 / 2011-11-30 -================== - - * Added `--globals <names>` to specify accepted globals. Closes #99 - * Fixed funky highlighting of messages. Closes #97 - * Fixed `mocha-debug(1)`. Closes #232 - * Fixed growl total, use runner.total - -0.1.0 / 2011-11-29 -================== - - * Added `suiteSetup` and `suiteTeardown` to TDD interface [David Henderson] - * Added growl icons. Closes #84 - * Fixed coffee-script support - -0.0.8 / 2011-11-25 -================== - - * Fixed: use `Runner#total` for accurate reporting - -0.0.7 / 2011-11-25 -================== - - * Added `Hook` - * Added `Runnable` - * Changed: `Test` is `Runnable` - * Fixed global leak reporting in hooks - * Fixed: > 2 calls to done() only report the error once - * Fixed: clear timer on failure. Closes #80 - -0.0.6 / 2011-11-25 -================== - - * Fixed return on immediate async error. Closes #80 - -0.0.5 / 2011-11-24 -================== - - * Fixed: make mocha.opts whitespace less picky [kkaefer] - -0.0.4 / 2011-11-24 -================== - - * Added `--interfaces` - * Added `--reporters` - * Added `-c, --colors`. Closes #69 - * Fixed hook timeouts - -0.0.3 / 2011-11-23 -================== - - * Added `-C, --no-colors` to explicitly disable - * Added coffee-script support - -0.0.2 / 2011-11-22 -================== - - * Fixed global leak detection due to Safari bind() change - * Fixed: escape html entities in Doc reporter - * Fixed: escape html entities in HTML reporter - * Fixed pending test support for HTML reporter. Closes #66 - -0.0.1 / 2011-11-22 -================== - - * Added `--timeout` second shorthand support, ex `--timeout 3s`. - * Fixed "test end" event for uncaughtExceptions. Closes #61 - -0.0.1-alpha6 / 2011-11-19 -================== - - * Added travis CI support (needs enabling when public) - * Added preliminary browser support - * Added `make mocha.css` target. Closes #45 - * Added stack trace to TAP errors. Closes #52 - * Renamed tearDown to teardown. Closes #49 - * Fixed: cascading hooksc. Closes #30 - * Fixed some colors for non-tty - * Fixed errors thrown in sync test-cases due to nextTick - * Fixed Base.window.width... again give precedence to 0.6.x - -0.0.1-alpha5 / 2011-11-17 -================== - - * Added `doc` reporter. Closes #33 - * Added suite merging. Closes #28 - * Added TextMate bundle and `make tm`. Closes #20 - -0.0.1-alpha4 / 2011-11-15 -================== - - * Fixed getWindowSize() for 0.4.x - -0.0.1-alpha3 / 2011-11-15 -================== - - * Added `-s, --slow <ms>` to specify "slow" test threshold - * Added `mocha-debug(1)` - * Added `mocha.opts` support. Closes #31 - * Added: default [files] to _test/*.js_ - * Added protection against multiple calls to `done()`. Closes #35 - * Changed: bright yellow for slow Dot reporter tests - -0.0.1-alpha1 / 2011-11-08 -================== - - * Missed this one :) - -0.0.1-alpha1 / 2011-11-08 -================== - - * Initial release diff --git a/tests/lib/mocha-2.1.0/Makefile b/tests/lib/mocha-2.1.0/Makefile deleted file mode 100644 index 72c4814c10c4d09476411ee79e2fcf97d59af202..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/Makefile +++ /dev/null @@ -1,192 +0,0 @@ - -REPORTER ?= spec -TM_BUNDLE = JavaScript\ mocha.tmbundle -SRC = $(shell find lib -name "*.js" -type f | sort) -SUPPORT = $(wildcard support/*.js) - -all: mocha.js - -lib/browser/diff.js: node_modules/diff/diff.js - cp node_modules/diff/diff.js lib/browser/diff.js - -lib/browser/escape-string-regexp.js: node_modules/escape-string-regexp/index.js - cp node_modules/escape-string-regexp/index.js lib/browser/escape-string-regexp.js - -mocha.js: $(SRC) $(SUPPORT) lib/browser/diff.js lib/browser/escape-string-regexp.js - @node support/compile $(SRC) - @cat \ - support/head.js \ - _mocha.js \ - support/tail.js \ - support/foot.js \ - > mocha.js - -clean: - rm -f mocha.js - rm -rf test-outputs - rm -fr lib-cov - rm -f coverage.html - -test-cov: lib-cov - @COV=1 $(MAKE) test REPORTER=html-cov > coverage.html - -lib-cov: - @rm -fr ./$@ - @jscoverage lib $@ - -test: test-unit - -test-all: test-bdd test-tdd test-qunit test-exports test-unit test-grep test-jsapi test-compilers test-sort test-glob test-requires test-reporters test-only test-failing test-regression - -test-jsapi: - @node test/jsapi - -test-unit: - @./bin/mocha \ - --reporter $(REPORTER) \ - test/acceptance/*.js \ - --growl \ - test/*.js - -test-regression: test-outputs/issue1327/case-out.json - @./bin/mocha \ - --reporter $(REPORTER) \ - test/regression/issue*/control.js - -test-outputs/issue1327/case-out.json: test/regression/issue1327/case.js - @mkdir -p $(dir $@) || true - @./bin/mocha --reporter json $< > $@ || true - -test-failing: - ./bin/mocha \ - --reporter $(REPORTER) \ - test/acceptance/failing/timeout.js > /dev/null 2>&1 ; \ - failures="$$?" ; \ - if [ "$$failures" != '2' ] ; then \ - echo 'test-failing:' ; \ - echo " expected 2 failing tests but saw $$failures" ; \ - exit 1 ; \ - fi - -test-compilers: - @./bin/mocha \ - --reporter $(REPORTER) \ - --compilers coffee:coffee-script/register,foo:./test/compiler/foo \ - test/acceptance/test.coffee \ - test/acceptance/test.foo - -test-requires: - @./bin/mocha \ - --reporter $(REPORTER) \ - --compilers coffee:coffee-script/register \ - --require test/acceptance/require/a.js \ - --require test/acceptance/require/b.coffee \ - --require test/acceptance/require/c.js \ - --require test/acceptance/require/d.coffee \ - test/acceptance/require/require.js - -test-bdd: - @./bin/mocha \ - --reporter $(REPORTER) \ - --ui bdd \ - test/acceptance/interfaces/bdd - -test-tdd: - @./bin/mocha \ - --reporter $(REPORTER) \ - --ui tdd \ - test/acceptance/interfaces/tdd - -test-qunit: - @./bin/mocha \ - --reporter $(REPORTER) \ - --ui qunit \ - test/acceptance/interfaces/qunit - -test-exports: - @./bin/mocha \ - --reporter $(REPORTER) \ - --ui exports \ - test/acceptance/interfaces/exports - -test-grep: - @./bin/mocha \ - --reporter $(REPORTER) \ - --grep fast \ - test/acceptance/misc/grep - -test-invert: - @./bin/mocha \ - --reporter $(REPORTER) \ - --grep slow \ - --invert \ - test/acceptance/misc/grep - -test-bail: - @./bin/mocha \ - --reporter $(REPORTER) \ - --bail \ - test/acceptance/misc/bail - -test-async-only: - @./bin/mocha \ - --reporter $(REPORTER) \ - --async-only \ - test/acceptance/misc/asyncOnly - -test-glob: - @./test/acceptance/glob/glob.sh - -test-reporters: - @./bin/mocha \ - --reporter $(REPORTER) \ - test/reporters/*.js - -test-only: - @./bin/mocha \ - --reporter $(REPORTER) \ - --ui tdd \ - test/acceptance/misc/only/tdd - - @./bin/mocha \ - --reporter $(REPORTER) \ - --ui bdd \ - test/acceptance/misc/only/bdd - - @./bin/mocha \ - --reporter $(REPORTER) \ - --ui qunit \ - test/acceptance/misc/only/qunit - -test-sort: - @./bin/mocha \ - --reporter $(REPORTER) \ - --sort \ - test/acceptance/sort - -non-tty: - @./bin/mocha \ - --reporter dot \ - test/acceptance/interfaces/bdd 2>&1 > /tmp/dot.out - - @echo dot: - @cat /tmp/dot.out - - @./bin/mocha \ - --reporter list \ - test/acceptance/interfaces/bdd 2>&1 > /tmp/list.out - - @echo list: - @cat /tmp/list.out - - @./bin/mocha \ - --reporter spec \ - test/acceptance/interfaces/bdd 2>&1 > /tmp/spec.out - - @echo spec: - @cat /tmp/spec.out - -tm: - @open editors/$(TM_BUNDLE) - -.PHONY: test-cov test-jsapi test-compilers watch test test-all test-bdd test-tdd test-qunit test-exports test-unit non-tty test-grep test-failing tm clean diff --git a/tests/lib/mocha-2.1.0/README.md b/tests/lib/mocha-2.1.0/README.md deleted file mode 100644 index 1a3a948936baf16b4eebd6a5ec13ae7bc20bfc62..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/README.md +++ /dev/null @@ -1,226 +0,0 @@ - [](http://travis-ci.org/mochajs/mocha) - - [](http://mochajs.org) - - Mocha is a simple, flexible, fun JavaScript test framework for node.js and the browser. For more information view the [documentation](http://mochajs.org). - -## Contributors - -``` - project : mocha - repo age : 3 years, 4 months - active : 509 days - commits : 1575 - files : 153 - authors : - 977 TJ Holowaychuk 62.0% - 132 Travis Jeffery 8.4% - 63 Christopher Hiller 4.0% - 31 Guillermo Rauch 2.0% - 27 Joshua Appelman 1.7% - 13 Attila Domokos 0.8% - 10 John Firebaugh 0.6% - 8 Nathan Rajlich 0.5% - 8 Jo Liss 0.5% - 6 Mike Pennisi 0.4% - 6 Brendan Nee 0.4% - 6 James Carr 0.4% - 5 Aaron Heckmann 0.3% - 5 Raynos 0.3% - 5 Ryunosuke SATO 0.3% - 4 hokaccha 0.3% - 4 Jonathan Ong 0.3% - 4 Joshua Krall 0.3% - 4 Domenic Denicola 0.3% - 4 Forbes Lindesay 0.3% - 4 Xavier Antoviaque 0.3% - 4 David da Silva 0.3% - 3 Ariel Mashraki 0.2% - 3 Ben Bradley 0.2% - 3 Merrick Christensen 0.2% - 3 Andreas Lind Petersen 0.2% - 3 Nathan Bowser 0.2% - 3 Cory Thomas 0.2% - 3 Benjie Gillam 0.2% - 3 Wil Moore III 0.2% - 3 Ben Lindsey 0.2% - 3 Tyson Tate 0.2% - 3 Paul Miller 0.2% - 3 eiji.ienaga 0.2% - 3 Mathieu Desvé 0.2% - 3 Jesse Dailey 0.2% - 3 fool2fish 0.2% - 3 Fredrik Enestad 0.2% - 3 Sindre Sorhus 0.2% - 3 Valentin Agachi 0.2% - 2 jsdevel 0.1% - 2 Arian Stolwijk 0.1% - 2 Juzer Ali 0.1% - 2 David Henderson 0.1% - 2 Justin DuJardin 0.1% - 2 Paul Armstrong 0.1% - 2 Pete Hawkins 0.1% - 2 Jonas Westerlund 0.1% - 2 Quang Van 0.1% - 2 Simon Gaeremynck 0.1% - 2 travis jeffery 0.1% - 2 Dominique Quatravaux 0.1% - 2 Jacob Wejendorp 0.1% - 2 Shawn Krisman 0.1% - 2 FARKAS Máté 0.1% - 2 Konstantin Käfer 0.1% - 2 Timo Tijhof 0.1% - 2 Sean Lang 0.1% - 2 Quanlong He 0.1% - 2 Glen Mailer 0.1% - 2 Alexander Early 0.1% - 2 Ian Storm Taylor 0.1% - 2 Brian Beck 0.1% - 2 Michael Riley 0.1% - 2 Michael Schoonmaker 0.1% - 2 domenic 0.1% - 2 fcrisci 0.1% - 2 Buck Doyle 0.1% - 2 Nathan Alderson 0.1% - 1 Mal Graty 0.1% - 1 Marc Kuo 0.1% - 1 Matija Marohnić 0.1% - 1 Matt Robenolt 0.1% - 1 Matt Smith 0.1% - 1 Matthew Shanley 0.1% - 1 Mattias Tidlund 0.1% - 1 Michael Jackson 0.1% - 1 Michael Olson 0.1% - 1 Michal Charemza 0.1% - 1 Nathan Black 0.1% - 1 Nick Fitzgerald 0.1% - 1 Noshir Patel 0.1% - 1 Panu Horsmalahti 0.1% - 1 Phil Sung 0.1% - 1 R56 0.1% - 1 Refael Ackermann 0.1% - 1 Richard Dingwall 0.1% - 1 Richard Knop 0.1% - 1 Rob Wu 0.1% - 1 Romain Prieto 0.1% - 1 Roman Neuhauser 0.1% - 1 Roman Shtylman 0.1% - 1 Russ Bradberry 0.1% - 1 Russell Munson 0.1% - 1 Rustem Mustafin 0.1% - 1 Salehen Shovon Rahman 0.1% - 1 Sasha Koss 0.1% - 1 Seiya Konno 0.1% - 1 Shaine Hatch 0.1% - 1 Simon Goumaz 0.1% - 1 Standa Opichal 0.1% - 1 Stephen Mathieson 0.1% - 1 Steve Mason 0.1% - 1 Tapiwa Kelvin 0.1% - 1 Teddy Zeenny 0.1% - 1 Tim Ehat 0.1% - 1 Vadim Nikitin 0.1% - 1 Victor Costan 0.1% - 1 Will Langstroth 0.1% - 1 Yanis Wang 0.1% - 1 Yuest Wang 0.1% - 1 Zsolt Takács 0.1% - 1 abrkn 0.1% - 1 airportyh 0.1% - 1 badunk 0.1% - 1 claudyus 0.1% - 1 dasilvacontin 0.1% - 1 fengmk2 0.1% - 1 gaye 0.1% - 1 grasGendarme 0.1% - 1 lakmeer 0.1% - 1 lodr 0.1% - 1 mrShturman 0.1% - 1 nishigori 0.1% - 1 omardelarosa 0.1% - 1 qiuzuhui 0.1% - 1 samuel goldszmidt 0.1% - 1 sebv 0.1% - 1 startswithaj 0.1% - 1 tgautier@yahoo.com 0.1% - 1 traleig1 0.1% - 1 vlad 0.1% - 1 yuitest 0.1% - 1 zhiyelee 0.1% - 1 Adam Crabtree 0.1% - 1 Andreas Brekken 0.1% - 1 Andrew Nesbitt 0.1% - 1 Andrey Popp 0.1% - 1 Arnaud Brousseau 0.1% - 1 Atsuya Takagi 0.1% - 1 Austin Birch 0.1% - 1 Ben Noordhuis 0.1% - 1 Bjørge Næss 0.1% - 1 Brian Lalor 0.1% - 1 Brian M. Carlson 0.1% - 1 Brian Moore 0.1% - 1 Bryan Donovan 0.1% - 1 C. Scott Ananian 0.1% - 1 Casey Foster 0.1% - 1 ChrisWren 0.1% - 1 Connor Dunn 0.1% - 1 Corey Butler 0.1% - 1 Daniel Stockman 0.1% - 1 Dave McKenna 0.1% - 1 Denis Bardadym 0.1% - 1 Devin Weaver 0.1% - 1 Di Wu 0.1% - 1 Diogo Monteiro 0.1% - 1 Dmitry Shirokov 0.1% - 1 Dr. Travis Jeffery 0.1% - 1 Fedor Indutny 0.1% - 1 Florian Margaine 0.1% - 1 Frederico Silva 0.1% - 1 Fredrik Lindin 0.1% - 1 Gareth Aye 0.1% - 1 Gareth Murphy 0.1% - 1 Gavin Mogan 0.1% - 1 Giovanni Bassi 0.1% - 1 Glen Huang 0.1% - 1 Greg Perkins 0.1% - 1 Harish 0.1% - 1 Harry Brundage 0.1% - 1 Herman Junge 0.1% - 1 Ian Young 0.1% - 1 Ivan 0.1% - 1 JP Bochi 0.1% - 1 Jaakko Salonen 0.1% - 1 Jakub NeÅ¡etÅ™il 0.1% - 1 James Bowes 0.1% - 1 James Lal 0.1% - 1 Jan Kopriva 0.1% - 1 Jason Barry 0.1% - 1 Javier Aranda 0.1% - 1 Jean Ponchon 0.1% - 1 Jeff Kunkle 0.1% - 1 Jeremy Martin 0.1% - 1 Jimmy Cuadra 0.1% - 1 John Doty 0.1% - 1 Jonathan Creamer 0.1% - 1 Jonathan Park 0.1% - 1 Jussi Virtanen 0.1% - 1 Katie Gengler 0.1% - 1 Kazuhito Hokamura 0.1% - 1 Kent C. Dodds 0.1% - 1 Kevin Conway 0.1% - 1 Kirill Korolyov 0.1% - 1 Koen Punt 0.1% - 1 Laszlo Bacsi 0.1% - 1 Liam Newman 0.1% - 1 Linus Unnebäck 0.1% - 1 László Bácsi 0.1% - 1 Maciej MaÅ‚ecki 0.1% -``` - -## Links - - - [Google Group](http://groups.google.com/group/mochajs) - - [Wiki](https://github.com/mochajs/mocha/wiki) - - Mocha [Extensions and reporters](https://github.com/mochajs/mocha/wiki) - -Mocha also has a chat room on [Slack](https://slack.com). If you'd like to join, [shoot us an email](mailto:tj@travisjeffery.com?subject=mocha%20slack%20room%20invite) from the address you want us to invite you under and we'll happily send you an invite! diff --git a/tests/lib/mocha-2.1.0/media/logo.svg b/tests/lib/mocha-2.1.0/media/logo.svg deleted file mode 100644 index bc3cb4b5df9c17e8725ed953a2b07222ef3f8f8f..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/media/logo.svg +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="612px" height="792px" viewBox="0 0 612 792" enable-background="new 0 0 612 792" xml:space="preserve"> -<circle fill="#8A6343" cx="306" cy="396" r="306"/> -<text transform="matrix(1 0 0 1 72.1431 424.7633)" fill="#FFFFFF" font-family="'HelveticaNeue'" font-size="153">mocha</text> -</svg> diff --git a/tests/lib/mocha-2.1.0/test/acceptance/context.js b/tests/lib/mocha-2.1.0/test/acceptance/context.js deleted file mode 100644 index 47c2db7083e459d5f157d78bdcdcc91b7303a991..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/context.js +++ /dev/null @@ -1,72 +0,0 @@ -describe('Context', function(){ - beforeEach(function(){ - this.calls = ['before']; - }) - - describe('nested', function(){ - beforeEach(function(){ - this.calls.push('before two'); - }) - - it('should work', function(){ - this.calls.should.eql(['before', 'before two']); - this.calls.push('test'); - }) - - after(function(){ - this.calls.should.eql(['before', 'before two', 'test']); - this.calls.push('after two'); - }) - }) - - after(function(){ - this.calls.should.eql(['before', 'before two', 'test', 'after two']); - }) -}) - -describe('Context Siblings', function(){ - beforeEach(function(){ - this.calls = ['before']; - }) - - describe('sequestered sibling', function(){ - beforeEach(function(){ - this.calls.push('before two'); - this.hiddenFromSibling = 'This should be hidden'; - }) - - it('should work', function(){ - this.hiddenFromSibling.should.eql('This should be hidden') - }) - }) - - describe('sibling verifiction', function(){ - beforeEach(function(){ - this.calls.push('before sibling'); - }) - - it('should not have value set within a sibling describe', function(){ - 'This should be hidden'.should.not.eql(this.hiddenFromSibling); - this.visibleFromTestSibling = 'Visible from test sibling'; - }) - - it('should allow test siblings to modify shared context', function(){ - 'Visible from test sibling'.should.eql(this.visibleFromTestSibling); - }) - - it('should have reset this.calls before describe', function(){ - this.calls.should.eql(['before', 'before sibling']); - }) - }) - - after(function(){ - this.calls.should.eql(['before', 'before sibling']); - }) - -}) - -describe('timeout()', function(){ - it('should return the timeout', function(){ - this.timeout().should.equal(200); - }); -}); diff --git a/tests/lib/mocha-2.1.0/test/acceptance/diffs.js b/tests/lib/mocha-2.1.0/test/acceptance/diffs.js deleted file mode 100644 index c87ffe0cce46d544571b44ebe6a9ce5482390d85..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/diffs.js +++ /dev/null @@ -1,93 +0,0 @@ -var fs = require('fs') - , cssin = fs.readFileSync('test/acceptance/fixtures/css.in', 'ascii') - , cssout = fs.readFileSync('test/acceptance/fixtures/css.out', 'ascii'); - -describe('diffs', function(){ - // uncomment the assertions, and run with different params to check the output - // ex: --color, --no-color, --unified-diff - - it('should display a diff for small strings', function(){ - var expected = 'foo bar baz' - , actual = 'foo rar baz'; - - // expected.should.eql(actual); - }); - - it('should display a diff of canonicalized objects', function(){ - var actual = { name: 'travis j', age: 23 } - , expected = { age: 23, name: 'travis' }; - - // actual.should.eql(expected); - }); - - it('should display a diff for medium strings', function(){ - var expected = 'foo bar baz\nfoo bar baz\nfoo bar baz' - , actual = 'foo bar baz\nfoo rar baz\nfoo bar raz'; - - // expected.should.eql(actual); - }); - - it('should display a diff for entire object dumps', function(){ - var expected = { name: 'joe', age: 30, address: {city: 'new york', country: 'us' }} - , actual = { name: 'joel', age: 30, address: {city: 'new york', country: 'usa' }}; - - // actual.should.eql(expected); - }); - - it('should display a diff for multi-line strings', function(){ - var expected = 'one two three\nfour five six\nseven eight nine'; - var actual = 'one two three\nfour zzzz six\nseven eight nine'; - - // actual.should.eql(expected); - }); - - it('should display a diff for entire object dumps', function(){ - var expected = { name: 'joe', age: 30, address: {city: 'new york', country: 'us' }} - var actual = { name: 'joel', age: 30, address: {city: 'new york', country: 'usa' }}; - - // actual.should.eql(expected); - }); - - it('should display a full-comparison with escaped special characters', function(){ - var expected = 'one\ttab\ntwo\t\ttabs'; - var actual = 'one\ttab\ntwo\t\t\ttabs'; - - //actual.should.equal(expected); - }); - - it('should display a word diff for large strings', function(){ - // cssin.should.equal(cssout); - }); - - it('should work with objects', function(){ - var tobi = { - name: 'tobi', - species: 'ferret', - color: 'white', - age: 2 - }; - - var loki = { - name: 'loki', - species: 'ferret', - color: 'brown', - age: 2 - }; - - // tobi.should.eql(loki); - }); - - it('should show value diffs and not be affected by commas', function(){ - var obj1 = { a: 123 }; - var obj2 = { a: 123, b: 456 }; - - // obj1.should.equal(obj2); - }); - - it('should display diff by data and not like an objects', function(){ - var buf1 = new Buffer([0x01]); - var buf2 = new Buffer([0x02]); - -// buf1.should.equal(buf2); - }); -}); diff --git a/tests/lib/mocha-2.1.0/test/acceptance/duration.js b/tests/lib/mocha-2.1.0/test/acceptance/duration.js deleted file mode 100644 index 4f319b8a3c321e15038149ec668deab3c159604f..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/duration.js +++ /dev/null @@ -1,25 +0,0 @@ -describe('durations', function(){ - describe('when slow', function(){ - it('should highlight in red', function(done){ - setTimeout(function(){ - done(); - }, 100); - }) - }) - - describe('when reasonable', function(){ - it('should highlight in yellow', function(done){ - setTimeout(function(){ - done(); - }, 50); - }) - }) - - describe('when fast', function(){ - it('should highlight in green', function(done){ - setTimeout(function(){ - done(); - }, 10); - }) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/failing/timeout.js b/tests/lib/mocha-2.1.0/test/acceptance/failing/timeout.js deleted file mode 100644 index e52dde4c24cd955a8f1abd1ab80ccc8a0cacdf0b..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/failing/timeout.js +++ /dev/null @@ -1,17 +0,0 @@ -describe('timeout', function(){ - this.timeout(1); - - it('should be honored with sync suites', function(){ - sleep(2); - }); - - it('should be honored with async suites', function(done){ - sleep(2); - done(); - }); - - function sleep(ms){ - var start = Date.now(); - while(start + ms > Date.now())continue; - } -}); diff --git a/tests/lib/mocha-2.1.0/test/acceptance/fixtures/css.in b/tests/lib/mocha-2.1.0/test/acceptance/fixtures/css.in deleted file mode 100644 index 09a3ca5363e9b1e39b1e3916ad63a92a7adfd640..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/fixtures/css.in +++ /dev/null @@ -1,9 +0,0 @@ -body { - font: "Helvetica Neue", Helvetica, arial, sans-serif; - background: black; - color: white; -} - -a { - color: blue -} diff --git a/tests/lib/mocha-2.1.0/test/acceptance/fixtures/css.out b/tests/lib/mocha-2.1.0/test/acceptance/fixtures/css.out deleted file mode 100644 index 53b3ec906eac52a1fc830d41a64bbacfa44194c6..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/fixtures/css.out +++ /dev/null @@ -1,13 +0,0 @@ -body { - font: "Helvetica Neue", Helvetica, arial, sans-serif; - background: black; - color: #fff; -} - -a { - color: blue; -} - -foo { - bar: 'baz'; -} diff --git a/tests/lib/mocha-2.1.0/test/acceptance/fs.js b/tests/lib/mocha-2.1.0/test/acceptance/fs.js deleted file mode 100644 index cdd32166d5041909b8811cb28de8338d65f6d83c..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/fs.js +++ /dev/null @@ -1,17 +0,0 @@ -var fs = require('fs'); - -describe('fs.readFile()', function(){ - describe('when the file exists', function(){ - it('should succeed', function(done){ - fs.writeFile('/tmp/mocha', 'wahoo', done) - }) - }) - - describe('when the file does not exist', function(){ - it('should fail', function(done){ - // uncomment - // fs.readFile('/tmp/does-not-exist', done); - done(); - }) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/glob/glob.js b/tests/lib/mocha-2.1.0/test/acceptance/glob/glob.js deleted file mode 100644 index 3029ae82ee286c8a5629fac8eb7183aa733435fb..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/glob/glob.js +++ /dev/null @@ -1,5 +0,0 @@ -describe('globbing test', function(){ - it('should find this test', function(){ - // see glob.sh for details - }) -}); diff --git a/tests/lib/mocha-2.1.0/test/acceptance/glob/glob.sh b/tests/lib/mocha-2.1.0/test/acceptance/glob/glob.sh deleted file mode 100644 index a2b8c6fea2b1edf88f1bfc09ffc06200b9ac29fa..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/glob/glob.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -REL_SCRIPT_DIR="`dirname \"$0\"`" -SCRIPT_DIR="`( cd \"$REL_SCRIPT_DIR\" && pwd )`" - -cd $SCRIPT_DIR || { - echo Could not cd to $SCRIPT_DIR from `pwd` - exit 1 -} - -../../../bin/mocha -R json-stream ./*.js > /tmp/mocha-glob.txt || { - echo Globbing ./*.js in `pwd` failed. - exit 1 -} - -cat /tmp/mocha-glob.txt | grep -q -F '["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,' || { - echo Globbing ./*.js in `pwd` should match glob.js with one test inside. - exit 1 -} - -../../../bin/mocha -R json-stream ./*-none.js 2> /tmp/mocha-glob.txt && { - echo Globbing './*-none.js' in `pwd` failed. - exit 1 -} - -cat /tmp/mocha-glob.txt | grep -q -F 'cannot resolve path' || { - echo Globbing './*-none.js' in `pwd` should match no files and run no tests. - exit 1 -} - -# Globbing in windows command-shell differs completely from unix-style globbing. -# In bash, the shell expands globs and passes the result to executables. -# In windows, the shell passes globs unexpanded, executables do expansion if they support it. -# Adding single-quotes around the glob below makes bash pass glob unexpanded, -# allowing us to test windows-style globbing in bash. -../../../bin/mocha -R json-stream './*.js' > /tmp/mocha-glob.txt || { - echo Globbing './*.js' in `pwd` failed. - exit 1 -} - -cat /tmp/mocha-glob.txt | grep -q -F '["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,' || { - echo Globbing './*.js' in `pwd` should match glob.js with one test inside. - exit 1 -} - -../../../bin/mocha -R json-stream './*-none.js' 2> /tmp/mocha-glob.txt && { - echo Globbing './*-none.js' in `pwd` failed. - exit 1 -} - -cat /tmp/mocha-glob.txt | grep -q -F 'cannot resolve path' || { - echo Globbing './*-none.js' in `pwd` should match no files and run no tests. - exit 1 -} - -echo Glob-test passed. diff --git a/tests/lib/mocha-2.1.0/test/acceptance/globals.js b/tests/lib/mocha-2.1.0/test/acceptance/globals.js deleted file mode 100644 index f8ef804b23bf2e66ad67ddfca27ec09e17b15ebc..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/globals.js +++ /dev/null @@ -1,41 +0,0 @@ -describe('global leaks', function(){ - before(function(){ - // uncomment to test - // foo = 'hey'; - // bar = 'hey'; - }) - - beforeEach(function(){ - // uncomment to test - // foo = 'bar' - }); - - it('should cause tests to fail', function(){ - // uncomment to test - // foo = 'bar'; - // bar = 'baz'; - // baz = 'raz'; - }); - - it('should pass when accepted', function(){ - global.okGlobalA = 1; - global.okGlobalB = 1; - global.okGlobalC = 1; - }) - - it('should pass with wildcard', function(){ - global.callback123 = 'foo'; - global.callback345 = 'bar'; - }); - - it('should pass when prefixed "mocha-"', function(){ - // Opera and IE do this for HTML element IDs anyway - // but to sure we can assert this in any browser, simulate it. - global['mocha-example'] = { nodeType: 1 }; - }); - - afterEach(function(){ - // uncomment to test - // foo = 'bar' - }); -}); diff --git a/tests/lib/mocha-2.1.0/test/acceptance/http.js b/tests/lib/mocha-2.1.0/test/acceptance/http.js deleted file mode 100644 index 1dfa9146a4463c38c3505381c2ba6fcd2b1ad32b..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/http.js +++ /dev/null @@ -1,16 +0,0 @@ -var http = require('http'); - -var server = http.createServer(function(req, res){ - res.end('Hello World\n'); -}) - -server.listen(8888); - -describe('http', function(){ - it('should provide an example', function(done){ - http.get({ path: '/', port: 8888 }, function(res){ - res.should.have.property('statusCode', 200); - done(); - }) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/interfaces/bdd.js b/tests/lib/mocha-2.1.0/test/acceptance/interfaces/bdd.js deleted file mode 100644 index bea1db229558908215743979a05eebe6cbc565b9..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/interfaces/bdd.js +++ /dev/null @@ -1,34 +0,0 @@ -describe('Array', function(){ - describe('#indexOf()', function(){ - it('should return -1 when the value is not present', function(){ - [1,2,3].indexOf(5).should.equal(-1); - [1,2,3].indexOf(0).should.equal(-1); - }) - - it('should return the correct index when the value is present', function(){ - [1,2,3].indexOf(1).should.equal(0); - [1,2,3].indexOf(2).should.equal(1); - [1,2,3].indexOf(3).should.equal(2); - }) - }) -}) - -describe('Array', function(){ - describe('#pop()', function(){ - it('should remove and return the last value', function(){ - var arr = [1,2,3]; - arr.pop().should.equal(3); - arr.should.eql([1,2]); - }) - }) -}) - -context('Array', function(){ - beforeEach(function(){ - this.arr = [1,2,3]; - }) - - specify('has a length property', function(){ - this.arr.length.should.equal(3); - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/interfaces/exports.js b/tests/lib/mocha-2.1.0/test/acceptance/interfaces/exports.js deleted file mode 100644 index 38093d50eaf4d1bf5485e4c8c7797afae1a31502..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/interfaces/exports.js +++ /dev/null @@ -1,43 +0,0 @@ -var calls = []; - -exports.Array = { - before: function(){ - calls.push('before'); - }, - - after: function(){ - calls.push('after'); - calls.should.eql([ - 'before' - , 'before each' - , 'one' - , 'after each' - , 'before each' - , 'two' - , 'after each' - , 'after']); - }, - - '#indexOf()': { - beforeEach: function(){ - calls.push('before each'); - }, - - afterEach: function(){ - calls.push('after each'); - }, - - 'should return -1 when the value is not present': function(){ - calls.push('one'); - [1,2,3].indexOf(5).should.equal(-1); - [1,2,3].indexOf(0).should.equal(-1); - }, - - 'should return the correct index when the value is present': function(){ - calls.push('two'); - [1,2,3].indexOf(1).should.equal(0); - [1,2,3].indexOf(2).should.equal(1); - [1,2,3].indexOf(3).should.equal(2); - } - } -}; diff --git a/tests/lib/mocha-2.1.0/test/acceptance/interfaces/qunit.js b/tests/lib/mocha-2.1.0/test/acceptance/interfaces/qunit.js deleted file mode 100644 index 48aa21d6021a67c4239b4aa3fee4afb770a53029..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/interfaces/qunit.js +++ /dev/null @@ -1,23 +0,0 @@ -function ok(expr, msg) { - if (!expr) throw new Error(msg); -} - -suite('Array'); - -test('#length', function(){ - var arr = [1,2,3]; - ok(arr.length == 3); -}); - -test('#indexOf()', function(){ - var arr = [1,2,3]; - ok(arr.indexOf(1) == 0); - ok(arr.indexOf(2) == 1); - ok(arr.indexOf(3) == 2); -}); - -suite('String'); - -test('#length', function(){ - ok('foo'.length == 3); -}); diff --git a/tests/lib/mocha-2.1.0/test/acceptance/interfaces/tdd.js b/tests/lib/mocha-2.1.0/test/acceptance/interfaces/tdd.js deleted file mode 100644 index 1c6885ed42cbca0eb35109a17168b2f88d9f99ab..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/interfaces/tdd.js +++ /dev/null @@ -1,41 +0,0 @@ -suite('Array', function(){ - suite('#indexOf()', function(){ - var initialValue = 32; - - suiteSetup(function(done){ - initialValue.should.eql(32); - initialValue = 42; - done(); - }); - - test('should return -1 when the value is not present', function(){ - initialValue.should.eql(42); - [1,2,3].indexOf(5).should.equal(-1); - [1,2,3].indexOf(0).should.equal(-1); - }); - - test('should return the correct index when the value is present', function(){ - initialValue.should.eql(42); - [1,2,3].indexOf(1).should.equal(0); - [1,2,3].indexOf(2).should.equal(1); - [1,2,3].indexOf(3).should.equal(2); - }); - - test.skip('should skip this test', function(){ - var zero = 0; - zero.should.equal(1, 'this test should have been skipped'); - }); - - suite.skip('should skip this suite', function(){ - test('should skip this test', function(){ - var zero = 0; - zero.should.equal(1, 'this test should have been skipped'); - }); - }); - - suiteTeardown(function(done){ - initialValue.should.eql(42); - done(); - }); - }); -}); diff --git a/tests/lib/mocha-2.1.0/test/acceptance/misc/asyncOnly.js b/tests/lib/mocha-2.1.0/test/acceptance/misc/asyncOnly.js deleted file mode 100644 index 7b7086a7eab5406fcb1076609b6c6cb447743e46..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/misc/asyncOnly.js +++ /dev/null @@ -1,9 +0,0 @@ -describe('asyncOnly', function(){ - it('should display an error', function(){ - - }) - - it('should pass', function(done){ - done(); - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/misc/bail.js b/tests/lib/mocha-2.1.0/test/acceptance/misc/bail.js deleted file mode 100644 index a2c0c1396f57b515ae59597ab9317489997c7ccd..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/misc/bail.js +++ /dev/null @@ -1,20 +0,0 @@ -describe('bail', function(){ - it('should only display this error', function(done){ - throw new Error('this should be displayed'); - }) - - it('should not display this error', function(done){ - throw new Error('this should not be displayed'); - }) -}) - -describe('bail-2', function(){ - - before(function(done){ - throw new Error('this hook should not be displayed'); - }) - - it('should not display this error', function(done){ - throw new Error('this should not be displayed'); - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/misc/cascade.js b/tests/lib/mocha-2.1.0/test/acceptance/misc/cascade.js deleted file mode 100644 index b2dda4df11748f05405b91a95d0791b799fe46a2..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/misc/cascade.js +++ /dev/null @@ -1,57 +0,0 @@ -describe('one', function(){ - before(function(){ - console.log('before one'); - }) - - after(function(){ - console.log('after one'); - }) - - beforeEach(function(){ - console.log(' before each one'); - }) - - afterEach(function(){ - console.log(' after each one'); - }) - - describe('two', function(){ - before(function(){ - console.log(' before two'); - }) - - after(function(){ - console.log(' after two'); - }) - - beforeEach(function(){ - console.log(' before each two'); - }) - - afterEach(function(){ - console.log(' after each two'); - }) - - describe('three', function(){ - before(function(){ - console.log(' before three'); - }) - - after(function(){ - console.log(' after three'); - }) - - beforeEach(function(){ - console.log(' before each three'); - }) - - afterEach(function(){ - console.log(' after each three'); - }) - - it('should three', function(){ - console.log(' TEST three'); - }) - }) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/misc/exit.js b/tests/lib/mocha-2.1.0/test/acceptance/misc/exit.js deleted file mode 100644 index 113e392300145edc41629a956f5dd5d7204cf199..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/misc/exit.js +++ /dev/null @@ -1,18 +0,0 @@ -describe('exit', function(){ - //note --bail works nicely in that it still allows an 'early exit' in an error scenario - it('should not exit even in error scenario if called with --no-exit', function(done){ - done(new Error('failure')); - }) - - it('should take a long time to exit if called with --no-exit', function(done){ - done(); - setTimeout(function() { - console.log('all done'); - }, 2500) - }) - - it('should kill all processes when SIGINT received', function () { - // uncomment to test - //while (true) {} - }); -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/misc/grep.js b/tests/lib/mocha-2.1.0/test/acceptance/misc/grep.js deleted file mode 100644 index ec9f78f3cdfb25d7f2d4d6d9efc14295da0509bb..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/misc/grep.js +++ /dev/null @@ -1,21 +0,0 @@ -describe('grep', function(){ - describe('fast', function(){ - it('should run fast', function(){ - - }) - - it('should run fast again', function(){ - - }) - }) - - describe('slow', function(){ - it('should run slow', function(done){ - setTimeout(done, 1000); - }) - - it('should run slow again', function(done){ - setTimeout(done, 1000); - }) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/misc/many.js b/tests/lib/mocha-2.1.0/test/acceptance/misc/many.js deleted file mode 100644 index 26538bc66e14b665441bf98d6aa6ca324896fb7b..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/misc/many.js +++ /dev/null @@ -1,27 +0,0 @@ -// Useful for testing SIGINT handler -// use env.big_number to tune iterations so that you have time to ctrl+c - -describe('a load of tests', function(){ - it('should fail the first test', function(){ - throw new Error('this should appear in the summary'); - }) - - var iterations = (process.env.big_number || 1e7); - function work() { - var a = 0; - for(var i=0; i<iterations; ++i) { - a += i; - } - } - - function addTest() { - it('should pass test ' + i, function(){ - work(); - }) - } - - for(var i=0; i<500; ++i) { - addTest(); - } - -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/misc/nontty.js b/tests/lib/mocha-2.1.0/test/acceptance/misc/nontty.js deleted file mode 100644 index 2372a660b988043a5474157171c26b718b524cce..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/misc/nontty.js +++ /dev/null @@ -1,9 +0,0 @@ -describe('tests for non-tty', function(){ - it('should pass', function(){ - - }) - - it('should fail', function(){ - throw new Error('oh noes') - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/misc/only/bdd.js b/tests/lib/mocha-2.1.0/test/acceptance/misc/only/bdd.js deleted file mode 100644 index ff14dcdfe35df7be7a39ad425dbba29bf783b07a..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/misc/only/bdd.js +++ /dev/null @@ -1,14 +0,0 @@ -describe('should only run .only test in this bdd suite', function() { - it('should not run this test', function() { - var zero = 0; - zero.should.equal(1, 'this test should have been skipped'); - }); - it.only('should run this test', function() { - var zero = 0; - zero.should.equal(0, 'this .only test should run'); - }); - it('should run this test, not (includes the title of the .only test)', function() { - var zero = 0; - zero.should.equal(1, 'this test should have been skipped'); - }); -}); diff --git a/tests/lib/mocha-2.1.0/test/acceptance/misc/only/qunit.js b/tests/lib/mocha-2.1.0/test/acceptance/misc/only/qunit.js deleted file mode 100644 index 07c240f617d2921de605413e751520ade93a47a0..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/misc/only/qunit.js +++ /dev/null @@ -1,15 +0,0 @@ -function ok(expr, msg) { - if (!expr) throw new Error(msg); -} - -suite('should only run .only test in this qunit suite'); - -test('should not run this test', function() { - ok(0 === 1, 'this test should have been skipped'); -}); -test.only('should run this test', function() { - ok(0 === 0, 'this .only test should run'); -}); -test('should run this test, not (includes the title of the .only test)', function() { - ok(0 === 1, 'this test should have been skipped'); -}); diff --git a/tests/lib/mocha-2.1.0/test/acceptance/misc/only/tdd.js b/tests/lib/mocha-2.1.0/test/acceptance/misc/only/tdd.js deleted file mode 100644 index cb6429a3d6046aaf735add8dd040ab15c6f2262c..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/misc/only/tdd.js +++ /dev/null @@ -1,14 +0,0 @@ -suite('should only run .only test in this tdd suite', function() { - test('should not run this test', function() { - var zero = 0; - zero.should.equal(1, 'this test should have been skipped'); - }); - test.only('should run this test', function() { - var zero = 0; - zero.should.equal(0, 'this .only test should run'); - }); - test('should run this test, not (includes the title of the .only test)', function() { - var zero = 0; - zero.should.equal(1, 'this test should have been skipped'); - }); -}); diff --git a/tests/lib/mocha-2.1.0/test/acceptance/multiple.done.js b/tests/lib/mocha-2.1.0/test/acceptance/multiple.done.js deleted file mode 100644 index 79874995f5dba6210d7b0bb59347b21d48ae66ad..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/multiple.done.js +++ /dev/null @@ -1,23 +0,0 @@ -describe('multiple calls to done()', function(){ - beforeEach(function(done){ - done() - // uncomment - // done() - }) - - it('should fail in a test-case', function(done){ - process.nextTick(function(){ - done(); - // uncomment - // done(); - }); - }) - - it('should produce a reasonable trace', function (done) { - process.nextTick(function() { - done(); - // uncomment - // done() - }) - }); -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/pending.js b/tests/lib/mocha-2.1.0/test/acceptance/pending.js deleted file mode 100644 index 4ef963709c5674092e2555f918715dadb59e609f..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/pending.js +++ /dev/null @@ -1,3 +0,0 @@ -describe('pending', function(){ - it('should be allowed') -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/require/a.js b/tests/lib/mocha-2.1.0/test/acceptance/require/a.js deleted file mode 100644 index 592d827449d656e82a9f0b82dd282366f9144cae..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/require/a.js +++ /dev/null @@ -1,2 +0,0 @@ -global.required = (global.required || []) -global.required.push('a.js') diff --git a/tests/lib/mocha-2.1.0/test/acceptance/require/b.coffee b/tests/lib/mocha-2.1.0/test/acceptance/require/b.coffee deleted file mode 100644 index 045cc7591ba4550f12670e403dde54b58b5a20ed..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/require/b.coffee +++ /dev/null @@ -1,2 +0,0 @@ -global.required ?= [] -global.required.push 'b.coffee' diff --git a/tests/lib/mocha-2.1.0/test/acceptance/require/c.js b/tests/lib/mocha-2.1.0/test/acceptance/require/c.js deleted file mode 100644 index 4e681373a1987a9a8ada11ce3c342c9949bbfd59..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/require/c.js +++ /dev/null @@ -1,2 +0,0 @@ -global.required = (global.required || []) -global.required.push('c.js') diff --git a/tests/lib/mocha-2.1.0/test/acceptance/require/d.coffee b/tests/lib/mocha-2.1.0/test/acceptance/require/d.coffee deleted file mode 100644 index d5ebbf60ed6d1e6f4bdc60104ed3ea0bcef25665..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/require/d.coffee +++ /dev/null @@ -1,2 +0,0 @@ -global.required ?= [] -global.required.push 'd.coffee' diff --git a/tests/lib/mocha-2.1.0/test/acceptance/require/require.js b/tests/lib/mocha-2.1.0/test/acceptance/require/require.js deleted file mode 100644 index 20f3e6d6ef57ea21982f244817b602b88c48e176..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/require/require.js +++ /dev/null @@ -1,9 +0,0 @@ -describe('require test', function(){ - it('should require args in order', function(){ - var req = global.required; - req.indexOf('a.js').should.equal(0); - req.indexOf('b.coffee').should.equal(1); - req.indexOf('c.js').should.equal(2); - req.indexOf('d.coffee').should.equal(3); - }) -}); diff --git a/tests/lib/mocha-2.1.0/test/acceptance/required-tokens.js b/tests/lib/mocha-2.1.0/test/acceptance/required-tokens.js deleted file mode 100644 index 6944cee40ce584e5fe4eb45e7f929a87ee8f6de0..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/required-tokens.js +++ /dev/null @@ -1,10 +0,0 @@ -var assert = require('assert'); -var describe = require('../..').describe; -var it = require('../..').it; - -describe('using imported describe', function () { - it('using imported it', function (done) { - assert.ok(true); - done(); - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/root.js b/tests/lib/mocha-2.1.0/test/acceptance/root.js deleted file mode 100644 index 17738302daca366c8bc90c32cce2bcdf75101bac..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/root.js +++ /dev/null @@ -1,11 +0,0 @@ -var calls = []; - -before(function(){ - calls.push('before'); -}) - -describe('root', function(){ - it('should be a valid suite', function(){ - calls.should.eql(['before']); - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/sort/alpha.js b/tests/lib/mocha-2.1.0/test/acceptance/sort/alpha.js deleted file mode 100644 index 7a5302994f6cd4c9116ee958c75b7966eecd9a49..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/sort/alpha.js +++ /dev/null @@ -1,7 +0,0 @@ -describe('alpha', function(){ - it('should be executed first', function(){ - if (global.beta) { - throw new Error('alpha was not executed first'); - } - }); -}); diff --git a/tests/lib/mocha-2.1.0/test/acceptance/sort/beta.js b/tests/lib/mocha-2.1.0/test/acceptance/sort/beta.js deleted file mode 100644 index 0951f49038deed8f4225cc6e442cb2e8cf1e15a0..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/sort/beta.js +++ /dev/null @@ -1,5 +0,0 @@ -describe('beta', function(){ - it('should be executed second', function(){ - global.beta = 1; - }); -}); diff --git a/tests/lib/mocha-2.1.0/test/acceptance/test.coffee b/tests/lib/mocha-2.1.0/test/acceptance/test.coffee deleted file mode 100644 index 8260940a1e1092f3eb102d09bfa93ad7c239e249..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/test.coffee +++ /dev/null @@ -1,6 +0,0 @@ - -obj = foo: 'bar' - -describe 'coffeescript', -> - it 'should work', -> - obj.should.eql foo: 'bar' diff --git a/tests/lib/mocha-2.1.0/test/acceptance/test.foo b/tests/lib/mocha-2.1.0/test/acceptance/test.foo deleted file mode 100644 index d00491fd7e5bb6fa28c517a0bb32b8b506539d4d..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/test.foo +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests/lib/mocha-2.1.0/test/acceptance/throw.js b/tests/lib/mocha-2.1.0/test/acceptance/throw.js deleted file mode 100644 index ac74f22c4ae2381b7e1da455638218565cbdcb3c..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/throw.js +++ /dev/null @@ -1,111 +0,0 @@ -var mocha = require('../../') - , Suite = mocha.Suite - , Runner = mocha.Runner - , Test = mocha.Test; - -describe('a test that throws', function () { - var suite, runner; - - beforeEach(function(){ - suite = new Suite(null, 'root'); - runner = new Runner(suite); - }) - - this.timeout(50); - - describe('undefined', function (){ - it('should not pass if throwing sync and test is sync', function(done) { - var test = new Test('im sync and throw undefined sync', function(){ - throw undefined; - }); - suite.addTest(test); - runner = new Runner(suite); - runner.on('end', function(){ - runner.failures.should.equal(1); - test.state.should.equal('failed'); - done(); - }); - runner.run(); - }) - - it('should not pass if throwing sync and test is async', function(done){ - var test = new Test('im async and throw undefined sync', function(done2){ - throw undefined; - process.nexTick(done2); - }); - suite.addTest(test); - runner = new Runner(suite); - runner.on('end', function(){ - runner.failures.should.equal(1); - test.state.should.equal('failed'); - done(); - }); - runner.run(); - }); - - it('should not pass if throwing async and test is async', function(done){ - var test = new Test('im async and throw undefined async', function(done2){ - process.nexTick(function(){ - throw undefined; - done2(); - }); - }); - suite.addTest(test); - runner = new Runner(suite); - runner.on('end', function(){ - runner.failures.should.equal(1); - test.state.should.equal('failed'); - done(); - }); - runner.run(); - }) - }) - - describe('null', function (){ - it('should not pass if throwing sync and test is sync', function(done) { - var test = new Test('im sync and throw null sync', function(){ - throw null; - }); - suite.addTest(test); - runner = new Runner(suite); - runner.on('end', function(){ - runner.failures.should.equal(1); - test.state.should.equal('failed'); - done(); - }); - runner.run(); - }) - - it('should not pass if throwing sync and test is async', function(done){ - var test = new Test('im async and throw null sync', function(done2){ - throw null; - process.nexTick(done2); - }); - suite.addTest(test); - runner = new Runner(suite); - runner.on('end', function(){ - runner.failures.should.equal(1); - test.state.should.equal('failed'); - done(); - }); - runner.run(); - }); - - it('should not pass if throwing async and test is async', function(done){ - var test = new Test('im async and throw null async', function(done2){ - process.nexTick(function(){ - throw null; - done2(); - }); - }); - suite.addTest(test); - runner = new Runner(suite); - runner.on('end', function(){ - runner.failures.should.equal(1); - test.state.should.equal('failed'); - done(); - }); - runner.run(); - }) - }) -}) \ No newline at end of file diff --git a/tests/lib/mocha-2.1.0/test/acceptance/timeout.js b/tests/lib/mocha-2.1.0/test/acceptance/timeout.js deleted file mode 100644 index f61c3ba566669fb44c77bf9f37e8f316295e834d..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/timeout.js +++ /dev/null @@ -1,79 +0,0 @@ -describe('timeouts', function(){ - beforeEach(function(done){ - // uncomment - // setTimeout(done, 3000); - done(); - }) - - it('should error on timeout', function(done){ - // uncomment - // setTimeout(done, 3000); - done(); - }) - - it('should allow overriding per-test', function(done){ - this.timeout(1000); - setTimeout(function(){ - done(); - }, 300); - }) - - describe('disabling', function(){ - it('should allow overriding per-test', function(done){ - this.enableTimeouts(false); - this.timeout(1); - setTimeout(done, 2); - }); - - it('should work with timeout(0)', function(done) { - this.timeout(0); - setTimeout(done, 1); - }) - - describe('using beforeEach', function() { - beforeEach(function () { - this.timeout(0); - }) - - it('should work with timeout(0)', function(done) { - setTimeout(done, 1); - }) - }) - - describe('using before', function() { - before(function () { - this.timeout(0); - }) - - it('should work with timeout(0)', function(done) { - setTimeout(done, 1); - }) - }) - - describe('using enableTimeouts(false)', function() { - this.timeout(4); - - it('should suppress timeout(4)', function(done) { - // The test is in the before() call. - this.enableTimeouts(false); - setTimeout(done, 50); - }) - }) - - describe('suite-level', function() { - this.timeout(0); - - it('should work with timeout(0)', function(done) { - setTimeout(done, 1); - }) - - describe('nested suite', function () { - it('should work with timeout(0)', function(done) { - setTimeout(done, 1); - }) - - }) - }) - }); - -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/uncaught.js b/tests/lib/mocha-2.1.0/test/acceptance/uncaught.js deleted file mode 100644 index f228266e4588ad153e15a87641521e0220f5312c..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/uncaught.js +++ /dev/null @@ -1,16 +0,0 @@ -describe('uncaught', function(){ - beforeEach(function(done){ - process.nextTick(function(){ - // throw new Error('oh noes'); - done(); - }); - }) - - it('should report properly', function(done){ - process.nextTick(function(){ - // if you uncomment this :) - // throw new Error("I'm uncaught!"); - done(); - }) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/acceptance/utils.js b/tests/lib/mocha-2.1.0/test/acceptance/utils.js deleted file mode 100644 index 4442c592131e423751699fac6cff4aa577d018db..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/acceptance/utils.js +++ /dev/null @@ -1,263 +0,0 @@ -var utils = require('../../lib/utils'); - -describe('lib/utils', function () { - describe('clean', function () { - it("should format a single line test function", function () { - var fn = [ - "function () {" - , " var a = 1;" - , "}" - ].join("\n"); - utils.clean(fn).should.equal("var a = 1;"); - }); - - it("should format a multi line test indented with spaces", function () { - // and no new lines after curly braces, shouldn't matter - var fn = [ - "function(){ var a = 1;" - , " var b = 2;" // this one has more spaces - , " var c = 3; }" - ].join("\n"); - utils.clean(fn).should.equal("var a = 1;\n var b = 2;\nvar c = 3;"); - }); - - it("should format a multi line test indented with tabs", function () { - var fn = [ - "function (arg1, arg2) {" - , "\tif (true) {" - , "\t\tvar a = 1;" - , "\t}" - , "}" - ].join("\n"); - utils.clean(fn).should.equal("if (true) {\n\tvar a = 1;\n}"); - }); - - it("should format functions saved in windows style - spaces", function () { - var fn = [ - "function (one) {" - , " do {", - , ' "nothing";', - , " } while (false);" - , ' }' - ].join("\r\n"); - utils.clean(fn).should.equal('do {\n "nothing";\n} while (false);'); - }); - - it("should format functions saved in windows style - tabs", function () { - var fn = [ - "function ( ) {" - , "\tif (false) {" - , "\t\tvar json = {" - , '\t\t\tone : 1' - , '\t\t};' - , "\t}" - , "}" - ].join("\r\n"); - utils.clean(fn).should.equal("if (false) {\n\tvar json = {\n\t\tone : 1\n\t};\n}"); - }); - - it("should format es6 arrow functions", function () { - var fn = [ - "() => {", - " var a = 1;", - "}" - ].join("\n"); - utils.clean(fn).should.equal("var a = 1;"); - }); - - it("should format es6 arrow functions with implicit return", function () { - var fn = "() => foo()"; - utils.clean(fn).should.equal("foo()"); - }); - }); - - describe('stringify', function(){ - - var stringify = utils.stringify; - - it('should canonicalize the object', function(){ - var travis = { name: 'travis', age: 24 }; - var travis2 = { age: 24, name: 'travis' }; - - stringify(travis).should.equal(stringify(travis2)); - }); - - it('should handle circular structures in objects', function(){ - var travis = { name: 'travis' }; - travis.whoami = travis; - - stringify(travis).should.equal('{\n "name": "travis"\n "whoami": "[Circular]"\n}'); - }); - - it('should handle circular structures in arrays', function(){ - var travis = ['travis']; - travis.push(travis); - - stringify(travis).should.equal('[\n "travis"\n "[Circular]"\n]'); - }); - - it('should handle circular structures in functions', function(){ - var travis = function () {}; - travis.fn = travis; - - stringify(travis).should.equal('{\n "fn": "[Circular]"\n}'); - }); - - - it('should handle various non-undefined, non-null, non-object, non-array, non-date, and non-function values', function () { - var regexp = new RegExp("(?:)"), - regExpObj = { regexp: regexp }, - regexpString = '/(?:)/'; - - stringify(regExpObj).should.equal('{\n "regexp": "' + regexpString + '"\n}'); - stringify(regexp).should.equal(regexpString); - - var number = 1, - numberObj = { number: number }, - numberString = '1'; - - stringify(numberObj).should.equal('{\n "number": ' + number + '\n}'); - stringify(number).should.equal(numberString); - - var boolean = false, - booleanObj = { boolean: boolean }, - booleanString = 'false'; - - stringify(booleanObj).should.equal('{\n "boolean": ' + boolean + '\n}'); - stringify(boolean).should.equal(booleanString); - - var string = 'sneepy', - stringObj = { string: string }; - - stringify(stringObj).should.equal('{\n "string": "' + string + '"\n}'); - stringify(string).should.equal(string); - - var nullValue = null, - nullObj = { 'null': null }, - nullString = '[null]'; - - stringify(nullObj).should.equal('{\n "null": null\n}'); - stringify(nullValue).should.equal(nullString); - - }); - - it('should handle arrays', function () { - var array = ['dave', 'dave', 'dave', 'dave'], - arrayObj = {array: array}, - arrayString = array.map(function () { - return ' "dave"'; - }).join('\n'); - - stringify(arrayObj).should.equal('{\n "array": [\n' + arrayString + '\n ]\n}'); - stringify(array).should.equal('[' + arrayString.replace(/\s+/g, '\n ') + '\n]'); - }); - - it('should handle functions', function () { - var fn = function() {}, - fnObj = {fn: fn}, - fnString = '[Function]'; - - stringify(fnObj).should.equal('{\n "fn": "' + fnString + '"\n}'); - stringify(fn).should.equal('[Function]'); - }); - - it('should handle empty objects', function () { - stringify({}).should.equal('{}'); - stringify({foo: {}}).should.equal('{\n "foo": {}\n}'); - }); - - it('should handle empty arrays', function () { - stringify([]).should.equal('[]'); - stringify({foo: []}).should.equal('{\n "foo": []\n}'); - }); - - it('should handle non-empty arrays', function () { - stringify(['a', 'b', 'c']).should.equal('[\n "a"\n "b"\n "c"\n]') - }); - - it('should handle empty functions (with no properties)', function () { - stringify(function(){}).should.equal('[Function]'); - stringify({foo: function() {}}).should.equal('{\n "foo": "[Function]"\n}'); - stringify({foo: function() {}, bar: 'baz'}).should.equal('{\n "bar": "baz"\n "foo": "[Function]"\n}'); - }); - - it('should handle functions w/ properties', function () { - var fn = function(){}; - fn.bar = 'baz'; - stringify(fn).should.equal('{\n "bar": "baz"\n}'); - stringify({foo: fn}).should.equal('{\n "foo": {\n "bar": "baz"\n }\n}'); - }); - - it('should handle undefined values', function () { - stringify({foo: undefined}).should.equal('{\n "foo": "[undefined]"\n}'); - stringify({foo: 'bar', baz: undefined}).should.equal('{\n "baz": "[undefined]"\n "foo": "bar"\n}'); - stringify().should.equal('[undefined]'); - }); - - it('should recurse', function () { -stringify({foo: {bar: {baz: {quux: {herp: 'derp'}}}}}).should.equal('{\n "foo": {\n "bar": {\n "baz": {\n "quux": {\n "herp": "derp"\n }\n }\n }\n }\n}'); - }); - - it('might get confusing', function () { - stringify(null).should.equal(stringify('[null]')); - }); - - it('should not freak out if it sees a primitive twice', function () { - stringify({foo: null, bar: null}).should.equal('{\n "bar": null\n "foo": null\n}'); - stringify({foo: 1, bar: 1}).should.equal('{\n "bar": 1\n "foo": 1\n}'); - }); - - it('should stringify dates', function () { - var date = new Date(0); - stringify(date).should.equal('[Date: 1970-01-01T00:00:00.000Z]'); - stringify({date: date}).should.equal('{\n "date": "[Date: 1970-01-01T00:00:00.000Z]"\n}'); - }); - }); - - describe('type', function () { - var type = utils.type; - it('should recognize various types', function () { - type({}).should.equal('object'); - type([]).should.equal('array'); - type(1).should.equal('number'); - type(Infinity).should.equal('number'); - type(null).should.equal('null'); - type(new Date()).should.equal('date'); - type(/foo/).should.equal('regexp'); - type('type').should.equal('string'); - type(global).should.equal('global'); - type(true).should.equal('boolean'); - }); - }); - - describe('lookupFiles', function () { - var fs = require('fs'), - path = require('path'), - existsSync = fs.existsSync || path.existsSync; - - beforeEach(function () { - fs.writeFileSync('/tmp/mocha-utils.js', 'yippy skippy ying yang yow'); - fs.symlinkSync('/tmp/mocha-utils.js', '/tmp/mocha-utils-link.js'); - }); - - it('should not choke on symlinks', function () { - utils.lookupFiles('/tmp', ['js'], false) - .should.containEql('/tmp/mocha-utils-link.js') - .and.containEql('/tmp/mocha-utils.js') - .and.have.lengthOf(2); - existsSync('/tmp/mocha-utils-link.js').should.be.true; - fs.renameSync('/tmp/mocha-utils.js', '/tmp/bob'); - existsSync('/tmp/mocha-utils-link.js').should.be.false; - utils.lookupFiles('/tmp', ['js'], false).should.eql([]); - }); - - afterEach(function () { - ['/tmp/mocha-utils.js', '/tmp/mocha-utils-link.js', '/tmp/bob'].forEach(function (path) { - try { - fs.unlinkSync(path); - } - catch (ignored) {} - }); - }); - }); -}); diff --git a/tests/lib/mocha-2.1.0/test/browser/array.js b/tests/lib/mocha-2.1.0/test/browser/array.js deleted file mode 100644 index 26404f6a909c8e6e7b800f1d802cdcbc28006c3a..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/browser/array.js +++ /dev/null @@ -1,38 +0,0 @@ -describe('Array', function(){ - describe('#push()', function(){ - it('should append a value', function(){ - foo = 'asdf' - var arr = []; - arr.push('foo'); - arr.push('bar'); - arr.push('baz'); - assert('foo' == arr[0]); // to test indentation - assert('bar' == arr[1]); - assert('baz' == arr[2]); - }) - - it('should return the length', function(){ - var arr = []; - assert(1 == arr.push('foo')); - assert(2 == arr.push('bar')); - assert(3 == arr.push('baz')); - }) - }) -}) - -describe('Array', function(){ - describe('#pop()', function(){ - it('should remove and return the last value', function(){ - var arr = [1,2,3]; - assert(arr.pop() == 3); - assert(arr.pop() == 2); - assert(arr.pop() == -1); - }) - - it('should adjust .length', function(){ - var arr = [1,2,3]; - arr.pop(); - assert(arr.length == 2); - }) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/browser/index.html b/tests/lib/mocha-2.1.0/test/browser/index.html deleted file mode 100644 index f10732dd4efe0b0cc30e812d80dd16ed70669439..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/browser/index.html +++ /dev/null @@ -1,32 +0,0 @@ -<html> - <head> - <title>Mocha</title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <link rel="stylesheet" href="../../mocha.css" /> - <script src="../../mocha.js"></script> - <script>mocha.setup('bdd')</script> - <script> - function assert(expr, msg) { - if (!expr) throw new Error(msg || 'failed'); - } - </script> - <script src="array.js"></script> - <script src="../acceptance/duration.js"></script> - <script src="../acceptance/timeout.js"></script> - <script> - onload = function(){ - mocha.checkLeaks(); - mocha.globals(['foo']); - var runner = mocha.run(); - - // runner.on('test end', function(test){ - // console.log(test.fullTitle()); - // }); - }; - </script> - </head> - <body> - <div id="mocha"></div> - </body> -</html> diff --git a/tests/lib/mocha-2.1.0/test/browser/large.html b/tests/lib/mocha-2.1.0/test/browser/large.html deleted file mode 100644 index 1804b3a000d2880b0012b7941b299f9cd91d4b13..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/browser/large.html +++ /dev/null @@ -1,24 +0,0 @@ -<html> - <head> - <title>Mocha</title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <link rel="stylesheet" href="../../mocha.css" /> - <script src="../../mocha.js"></script> - <script>mocha.setup('bdd')</script> - <script> - function assert(expr, msg) { - if (!expr) throw new Error(msg || 'failed'); - } - </script> - <script src="large.js"></script> - <script> - onload = function(){ - mocha.run(); - }; - </script> - </head> - <body> - <div id="mocha"></div> - </body> -</html> diff --git a/tests/lib/mocha-2.1.0/test/browser/large.js b/tests/lib/mocha-2.1.0/test/browser/large.js deleted file mode 100644 index 56757eae275dc3062adb39056b9af47a9db96b35..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/browser/large.js +++ /dev/null @@ -1,48 +0,0 @@ -var n = 30; -while (n--) { - describe('Array ' + n, function(){ - var arr; - - beforeEach(function(){ - arr = [1,2,3]; - }) - - describe('#indexOf()', function(){ - it('should return -1 when the value is not present', function(){ - assert(-1 == arr.indexOf(5)); - }) - - it('should return the correct index when the value is present', function(done){ - assert(0 == arr.indexOf(1)); - assert(1 == arr.indexOf(2)); - done(); - }) - }) - }) -} - -describe('something', function(){ - it('should provide a useful error', function(done){ - setTimeout(function(){ - throw new Error('boom'); - done(); - }, 1); - }) - - it('should provide an even better error on phantomjs', function(done){ - setTimeout(function(){ - var AssertionError = function(message, actual, expected) { - this.message = message; - this.actual = actual; - this.expected = expected; - this.showDiff = true; - }; - AssertionError.prototype = Object.create(Error.prototype); - AssertionError.prototype.name = 'AssertionError'; - AssertionError.prototype.constructor = AssertionError; - - mocha.throwError(new AssertionError('kabooom', 'text with a typo', 'text without a typo')); - done(); - }, 1); - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/browser/opts.html b/tests/lib/mocha-2.1.0/test/browser/opts.html deleted file mode 100644 index ec49a418fc3df45a57cb0a50a1f373f398f73c41..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/browser/opts.html +++ /dev/null @@ -1,30 +0,0 @@ -<html> - <head> - <title>Mocha</title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <link rel="stylesheet" href="../../mocha.css" /> - <script src="../../mocha.js"></script> - <script> - mocha.setup({ - ui: 'bdd', - globals: ['okGlobalA', 'okGlobalB', 'okGlobalC', 'callback*'] - }).timeout(1500) - </script> - <script> - function assert(expr, msg) { - if (!expr) throw new Error(msg || 'failed'); - } - </script> - <script src="opts.js"></script> - <script src="../acceptance/globals.js"></script> - <script> - onload = function(){ - var runner = mocha.run(); - }; - </script> - </head> - <body> - <div id="mocha"></div> - </body> -</html> diff --git a/tests/lib/mocha-2.1.0/test/browser/opts.js b/tests/lib/mocha-2.1.0/test/browser/opts.js deleted file mode 100644 index dbbc9ff172187db598fc263df0cf572e2f1da42a..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/browser/opts.js +++ /dev/null @@ -1,5 +0,0 @@ -describe('Options', function() { - it('should set timeout value', function() { - assert(this.test._timeout === 1500); - }); -}) diff --git a/tests/lib/mocha-2.1.0/test/color.js b/tests/lib/mocha-2.1.0/test/color.js deleted file mode 100644 index 8c7167b0fa9217b8c0d8dc1fd3af1453ec0c77f8..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/color.js +++ /dev/null @@ -1,17 +0,0 @@ -var assert = require('assert'); -var child_process = require('child_process'); - -describe('Mocha', function() { - this.timeout(1000); - - it('should not output colors to pipe', function(cb) { - var command = 'bin/mocha --grep missing-test'; - child_process.exec(command, function(err, stdout, stderr) { - if (err) return cb(err); - - assert(stdout.indexOf('[90m') === -1); - - cb(null); - }); - }); -}); diff --git a/tests/lib/mocha-2.1.0/test/compiler/foo.js b/tests/lib/mocha-2.1.0/test/compiler/foo.js deleted file mode 100644 index b13101a77bdd45d9c5336cbe612e39eda12fb355..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/compiler/foo.js +++ /dev/null @@ -1,8 +0,0 @@ -var fs = require('fs'); -require.extensions['.foo'] = function(module, filename) { - var content; - content = fs.readFileSync(filename, 'utf8'); - var test = 'describe("custom compiler",function(){ it("should work",function() { ' - + content + '.should.eql(1); }); });'; - return module._compile(test, filename); -}; diff --git a/tests/lib/mocha-2.1.0/test/grep.js b/tests/lib/mocha-2.1.0/test/grep.js deleted file mode 100644 index c2a88217f0fc1af3d6ad4b1c923898c4811efc8d..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/grep.js +++ /dev/null @@ -1,41 +0,0 @@ -var Mocha = require('../'); - -describe('Mocha', function(){ - describe('"grep" option', function(){ - it('should add a RegExp to the mocha.options object', function(){ - var mocha = new Mocha({ grep: /foo/ }); - mocha.options.grep.toString().should.equal('/foo/'); - }) - - it('should convert grep string to a RegExp', function(){ - var mocha = new Mocha({ grep: 'foo' }); - mocha.options.grep.toString().should.equal('/foo/'); - }) - }) - - describe('.grep()', function(){ - it('should add a RegExp to the mocha.options object', function(){ - var mocha = new Mocha; - mocha.grep(/foo/); - mocha.options.grep.toString().should.equal('/foo/'); - }) - - it('should convert grep string to a RegExp', function(){ - var mocha = new Mocha; - mocha.grep('foo'); - mocha.options.grep.toString().should.equal('/foo/'); - }) - - it('should return it\'s parent Mocha object for chainability', function(){ - var mocha = new Mocha; - mocha.grep().should.equal(mocha); - }) - }) - - describe('"invert" option', function(){ - it('should add a Boolean to the mocha.options object', function(){ - var mocha = new Mocha({ invert: true }); - mocha.options.invert.should.be.ok; - }) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/hook.async.js b/tests/lib/mocha-2.1.0/test/hook.async.js deleted file mode 100644 index ae6e642d24c6f5a62723f2d6328d11e3ee65778e..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/hook.async.js +++ /dev/null @@ -1,129 +0,0 @@ -describe('async', function(){ - var calls = []; - - before(function(){ - calls.push('root before all'); - }) - - after(function(){ - calls.push('root after all'); - calls.should.eql([ - 'root before all' - , 'before all' - , 'parent before' - , 'before' - , 'before test one' - , 'one' - , 'after' - , 'after test one passed' - , 'parent after' - , 'parent before' - , 'before' - , 'before test two' - , 'two' - , 'after' - , 'after test two passed' - , 'parent after' - , 'parent before' - , 'before' - , 'before test three' - , 'three' - , 'after' - , 'after test three passed' - , 'parent after' - , 'after all' - , 'root after all']); - }) - - beforeEach(function(){ - calls.push('parent before'); - }) - - afterEach(function(){ - calls.push('parent after' ); - }) - - describe('hooks', function(){ - before(function(){ - calls.push('before all'); - }); - - after(function(){ - calls.push('after all'); - }); - - beforeEach(function(done){ - var ctx = this; - process.nextTick(function(){ - calls.push('before'); - if (ctx.currentTest) { - calls.push('before test ' + ctx.currentTest.title); - } - done(); - }) - }) - - it('one', function(done){ - calls.should.eql([ - 'root before all' - , 'before all' - , 'parent before' - , 'before' - , 'before test one']); - calls.push('one'); - process.nextTick(done); - }) - - it('two', function(){ - calls.should.eql([ - 'root before all' - , 'before all' - , 'parent before' - , 'before' - , 'before test one' - , 'one' - , 'after' - , 'after test one passed' - , 'parent after' - , 'parent before' - , 'before' - , 'before test two']); - calls.push('two'); - }) - - it('three', function(){ - calls.should.eql([ - 'root before all' - , 'before all' - , 'parent before' - , 'before' - , 'before test one' - , 'one' - , 'after' - , 'after test one passed' - , 'parent after' - , 'parent before' - , 'before' - , 'before test two' - , 'two' - , 'after' - , 'after test two passed' - , 'parent after' - , 'parent before' - , 'before' - , 'before test three']); - calls.push('three'); - }) - - afterEach(function(done){ - var ctx = this; - process.nextTick(function(){ - calls.push('after'); - if (ctx.currentTest) { - calls.push('after test ' + ctx.currentTest.title + ' ' + ctx.currentTest.state); - } - done(); - }) - }) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/hook.err.js b/tests/lib/mocha-2.1.0/test/hook.err.js deleted file mode 100644 index d7e6c2e46047349b7313fc82040df38843a72f7d..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/hook.err.js +++ /dev/null @@ -1,296 +0,0 @@ -describe('hook error handling', function(){ - // Lines in this test should be uncommented to see actual behavior - // You will also see errors in hooks - describe('before hook error', function() { - var calls = []; - describe('spec 1', function () { - describe('spec 1 nested', function () { - it('should not be called, because hook error was in a parent suite', function() { - calls.push('test nested'); - }) - }) - before(function(){ - calls.push('before'); - // throw new Error('before hook error'); - }) - after(function(){ - calls.push('after'); - }) - it('should not be called because of error in before hook', function() { - calls.push('test'); - }) - }) - describe('spec 2', function () { - before(function(){ - calls.push('before 2'); - }) - after(function(){ - calls.push('after 2'); - }) - it('should be called, because hook error was in a sibling suite', function() { - calls.push('test 2'); - }) - }) - after(function () { - // calls.should.eql(['before', 'after', 'before 2', 'test 2', 'after 2']); - }) - }) - - describe('before each hook error', function() { - var calls = []; - describe('spec 1', function () { - describe('spec 1 nested', function () { - it('should not be called, because hook error was in a parent suite', function() { - calls.push('test nested'); - }) - }) - beforeEach(function(){ - calls.push('before'); - // throw new Error('before each hook error'); - }) - afterEach(function(){ - calls.push('after'); - }) - it('should not be called because of error in before each hook', function() { - calls.push('test'); - }) - }) - describe('spec 2', function () { - before(function(){ - calls.push('before 2'); - }) - after(function(){ - calls.push('after 2'); - }) - it('should be called, because hook error was in a sibling suite', function() { - calls.push('test 2'); - }) - }) - after(function () { - // This should be called ! - // calls.should.eql(['before', 'after', 'before 2', 'test 2', 'after 2']); - }) - }) - - describe('after hook error', function() { - var calls = []; - describe('spec 1', function () { - describe('spec 1 nested', function () { - it('should be called, because hook error will happen after parent suite', function() { - calls.push('test nested'); - }) - }) - before(function(){ - calls.push('before'); - }) - after(function(){ - calls.push('after'); - // throw new Error('after hook error'); - }) - it('should be called because error is in after hook', function() { - calls.push('test'); - }) - }) - describe('spec 2', function () { - before(function(){ - calls.push('before 2'); - }) - after(function(){ - calls.push('after 2'); - }) - it('should be called, because hook error was in a sibling suite', function() { - calls.push('test 2'); - }) - }) - after(function () { - // Even this should be called ! - // calls.should.eql(['before', 'test', 'test nested', 'after', 'before 2', 'test 2', 'after 2']); - }) - }) - - describe('after each hook error', function() { - var calls = []; - describe('spec 1', function () { - describe('spec 1 nested', function () { - it('should not be called, because hook error has already happened in parent suite', function() { - calls.push('test nested'); - }) - }) - beforeEach(function(){ - calls.push('before'); - }) - afterEach(function(){ - calls.push('after'); - // throw new Error('after each hook error'); - }) - it('should be called because error is in after each hook, and this is the first test', function() { - calls.push('test'); - }) - it('should not be called because error is in after each hook, and this is the second test', function() { - calls.push('another test'); - }) - }) - describe('spec 2', function () { - before(function(){ - calls.push('before 2'); - }) - after(function(){ - calls.push('after 2'); - }) - it('should be called, because hook error was in a sibling suite', function() { - calls.push('test 2'); - }) - }) - after(function () { - // This should be called ! - // calls.should.eql(['before', 'test', 'after', 'before 2', 'test 2', 'after 2']); - }) - }) - - describe('multiple hook errors', function() { - var calls = []; - before(function(){ - calls.push("root before"); - }); - beforeEach(function(){ - calls.push("root before each"); - }); - describe('1', function(){ - beforeEach(function() { - calls.push('1 before each') - }) - - describe('1.1', function(){ - before(function() { - calls.push('1.1 before'); - }); - beforeEach(function() { - calls.push('1.1 before each') - // throw new Error('1.1 before each hook failed') - }); - it('1.1 test 1', function () {calls.push('1.1 test 1')}); - it('1.1 test 2', function () {calls.push('1.1 test 2')}); - afterEach(function() { - calls.push("1.1 after each"); - }); - after(function(){ - calls.push("1.1 after"); - // throw new Error('1.1 after hook failed') - }); - }); - - describe('1.2', function(){ - before(function() { - calls.push('1.2 before'); - }); - beforeEach(function() { - calls.push('1.2 before each') - }); - it('1.2 test 1', function () {calls.push('1.2 test 1')}); - it('1.2 test 2', function () {calls.push('1.2 test 2')}); - afterEach(function() { - calls.push("1.2 after each"); - // throw new Error('1.2 after each hook failed') - }); - after(function(){ - calls.push("1.2 after"); - }); - }); - - afterEach(function() { - calls.push('1 after each') - }) - - after(function(){ - calls.push("1 after"); - }); - }) - - describe('2', function(){ - beforeEach(function() { - calls.push('2 before each') - // throw new Error('2 before each hook failed') - }) - - describe('2.1', function(){ - before(function() { - calls.push('2.1 before'); - }); - beforeEach(function() { - calls.push('2.1 before each') - }); - it('2.1 test 1', function () {calls.push('2.1 test 1')}); - it('2.1 test 2', function () {calls.push('2.1 test 2')}); - afterEach(function() { - calls.push("2.1 after each"); - }); - after(function(){ - calls.push("2.1 after"); - }); - }); - - describe('2.2', function(){ - before(function() { - calls.push('2.2 before'); - }); - beforeEach(function() { - calls.push('2.2 before each') - }); - it('2.2 test 1', function () {calls.push('2.2 test 1')}); - it('2.2 test 2', function () {calls.push('2.2 test 2')}); - afterEach(function() { - calls.push("2.2 after each"); - }); - after(function(){ - calls.push("2.2 after"); - }); - }); - - afterEach(function() { - calls.push('2 after each') - // throw new Error('2 after each hook failed') - }) - - after(function(){ - calls.push("2 after"); - }); - }) - - after(function(){ - calls.push("root after"); - /* calls.should.eql([ - "root before", - "1.1 before", - "root before each", - "1 before each", - "1.1 before each", - "1.1 after each", - "1 after each", - "root after each", - "1.1 after", - "1.2 before", - "root before each", - "1 before each", - "1.2 before each", - "1.2 test 1", - "1.2 after each", - "1 after each", - "root after each", - "1.2 after", - "1 after", - "2.1 before", - "root before each", - "2 before each", - "2 after each", - "root after each", - "2.1 after", - "2 after", - "root after" - ]); */ - }); - afterEach(function(){ - calls.push("root after each"); - }); - }) - -}) diff --git a/tests/lib/mocha-2.1.0/test/hook.sync.js b/tests/lib/mocha-2.1.0/test/hook.sync.js deleted file mode 100644 index 1d40f5d0c0bf4a28ba3c3030a7f814be735a784e..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/hook.sync.js +++ /dev/null @@ -1,97 +0,0 @@ -describe('serial', function(){ - var calls = []; - - beforeEach(function(){ - calls.push('parent before'); - }) - - afterEach(function(){ - calls.push('parent after'); - }) - - describe('hooks', function(){ - beforeEach(function(){ - calls.push('before'); - if (this.currentTest) { - calls.push('before test ' + this.currentTest.title); - } - }) - - it('one', function(){ - calls.should.eql([ - 'parent before' - , 'before' - , 'before test one']); - calls.push('one'); - }) - - it('two', function(){ - calls.should.eql([ - 'parent before' - , 'before' - , 'before test one' - , 'one' - , 'after' - , 'after test one passed' - , 'parent after' - , 'parent before' - , 'before' - , 'before test two']); - calls.push('two'); - }) - - it('three', function(){ - calls.should.eql([ - 'parent before' - , 'before' - , 'before test one' - , 'one' - , 'after' - , 'after test one passed' - , 'parent after' - , 'parent before' - , 'before' - , 'before test two' - , 'two' - , 'after' - , 'after test two passed' - , 'parent after' - , 'parent before' - , 'before' - , 'before test three']); - calls.push('three'); - }) - - afterEach(function(){ - calls.push('after'); - if (this.currentTest) { - calls.push('after test ' + this.currentTest.title + ' ' + this.currentTest.state); - } - }) - - after(function(){ - calls.should.eql([ - 'parent before' - , 'before' - , 'before test one' - , 'one' - , 'after' - , 'after test one passed' - , 'parent after' - , 'parent before' - , 'before' - , 'before test two' - , 'two' - , 'after' - , 'after test two passed' - , 'parent after' - , 'parent before' - , 'before' - , 'before test three' - , 'three' - , 'after' - , 'after test three passed' - , 'parent after']); - }) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/hook.sync.nested.js b/tests/lib/mocha-2.1.0/test/hook.sync.nested.js deleted file mode 100644 index b87c22298fbf9b96f8d7b92611259c614f1d5c25..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/hook.sync.nested.js +++ /dev/null @@ -1,98 +0,0 @@ -describe('serial', function(){ - describe('nested', function(){ - var calls = []; - - beforeEach(function(){ - calls.push('parent before'); - if (this.currentTest) { - calls.push('parent before test ' + this.currentTest.title); - } - }) - - afterEach(function(){ - calls.push('parent after'); - if (this.currentTest) { - calls.push('parent after test ' + this.currentTest.title + ' ' + this.currentTest.state); - } - }); - - it('foo', function(){ - calls.should.eql([ - 'parent before' - , 'parent before test foo']); - calls.push('foo'); - }) - - it('bar', function(){ - calls.should.eql([ - 'parent before' - , 'parent before test foo' - , 'foo' - , 'parent after' - , 'parent after test foo passed' - , 'parent before' - , 'parent before test bar']); - }) - - describe('hooks', function(){ - beforeEach(function(){ - calls.push('before'); - if (this.currentTest) { - calls.push('before test ' + this.currentTest.title); - } - }) - - it('one', function(){ - calls.should.eql([ - 'parent before' - , 'parent before test foo' - , 'foo' - , 'parent after' - , 'parent after test foo passed' - , 'parent before' - , 'parent before test bar' - , 'parent after' - , 'parent after test bar passed' - , 'parent before' - , 'parent before test one' - , 'before' - , 'before test one']); - calls.push('one'); - }) - - it('two', function(){ - calls.should.eql([ - 'parent before' - , 'parent before test foo' - , 'foo' - , 'parent after' - , 'parent after test foo passed' - , 'parent before' - , 'parent before test bar' - , 'parent after' - , 'parent after test bar passed' - , 'parent before' - , 'parent before test one' - , 'before' - , 'before test one' - , 'one' - , 'after' - , 'after test one passed' - , 'parent after' - , 'parent after test one passed' - , 'parent before' - , 'parent before test two' - , 'before' - , 'before test two']); - calls.push('two'); - }); - - afterEach(function(){ - calls.push('after'); - if (this.currentTest) { - calls.push('after test ' + this.currentTest.title + ' ' + this.currentTest.state); - } - }) - }) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/hook.timeout.js b/tests/lib/mocha-2.1.0/test/hook.timeout.js deleted file mode 100644 index 155c1e95a6efe0c8c7cc45135a173e56cfc0fe22..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/hook.timeout.js +++ /dev/null @@ -1,8 +0,0 @@ -before(function(done){ - this.timeout(100); - setTimeout(done, 50); -}) - -it('should work', function(done) { - done(); -}); diff --git a/tests/lib/mocha-2.1.0/test/http.meta.2.js b/tests/lib/mocha-2.1.0/test/http.meta.2.js deleted file mode 100644 index 31b779322fdd64bb4a66827099acbc4245c9dcef..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/http.meta.2.js +++ /dev/null @@ -1,82 +0,0 @@ -var http = require('http'); - -var server = http.createServer(function(req, res){ - var accept = req.headers.accept || '' - , json = ~accept.indexOf('json'); - - switch (req.url) { - case '/': - res.end('hello'); - break; - case '/users': - if (json) { - res.end('["tobi","loki","jane"]'); - } else { - res.end('tobi, loki, jane'); - } - break; - } -}) - -server.listen(8899); - -function get(url) { - var fields - , expected - , header = {}; - - function request(done) { - http.get({ path: url, port: 8899, headers: header }, function(res){ - var buf = ''; - res.should.have.property('statusCode', 200); - res.setEncoding('utf8'); - res.on('data', function(chunk){ buf += chunk }); - res.on('end', function(){ - buf.should.equal(expected); - done(); - }); - }) - } - - return { - set: function(field, val){ - header[field] = val; - return this; - }, - - should: { - respond: function(body){ - fields = Object.keys(header).map(function(field){ - return field + ': ' + header[field]; - }).join(', '); - - expected = body; - describe('GET ' + url, function(){ - this.timeout(500); - if (fields) { - describe('when given ' + fields, function(){ - it('should respond with "' + body + '"', request); - }); - } else { - it('should respond with "' + body + '"', request); - } - }); - } - } - }; -} - -describe('http server', function(){ - get('/') - .should - .respond('hello') - - get('/users') - .should - .respond('tobi, loki, jane') - - get('/users') - .set('Accept', 'application/json') - .should - .respond('["tobi","loki","jane"]') -}) diff --git a/tests/lib/mocha-2.1.0/test/http.meta.js b/tests/lib/mocha-2.1.0/test/http.meta.js deleted file mode 100644 index 00c3f9c8b627d91d02d36a24761afeff11c84d0e..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/http.meta.js +++ /dev/null @@ -1,51 +0,0 @@ -var http = require('http'); - -var server = http.createServer(function(req, res){ - var accept = req.headers.accept || '' - , json = ~accept.indexOf('json'); - - switch (req.url) { - case '/': - res.end('hello'); - break; - case '/users': - if (json) { - res.end('["tobi","loki","jane"]'); - } else { - res.end('tobi, loki, jane'); - } - break; - } -}) - -server.listen(8889); - -function get(url, body, header) { - return function(done){ - http.get({ path: url, port: 8889, headers: header }, function(res){ - var buf = ''; - res.should.have.property('statusCode', 200); - res.setEncoding('utf8'); - res.on('data', function(chunk){ buf += chunk }); - res.on('end', function(){ - buf.should.equal(body); - done(); - }); - }) - } -} - -describe('http requests', function(){ - describe('GET /', function(){ - it('should respond with hello', - get('/', 'hello')) - }) - - describe('GET /users', function(){ - it('should respond with users', - get('/users', 'tobi, loki, jane')) - - it('should respond with users', - get('/users', '["tobi","loki","jane"]', { Accept: 'application/json' })) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/jsapi/index.js b/tests/lib/mocha-2.1.0/test/jsapi/index.js deleted file mode 100644 index 2dcdd6dc68c53d04bab73d242420eaddf9697a0e..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/jsapi/index.js +++ /dev/null @@ -1,30 +0,0 @@ -var Mocha = require('../../') - , path = require('path'); - -var mocha = new Mocha({ - ui: 'bdd', - globals: ['okGlobalA', 'okGlobalB', 'okGlobalC', 'callback*'], - // ignoreLeaks: true, - growl: true -}); - -// mocha.reporter('spec'); -require('should'); - -mocha.addFile('test/suite.js'); -mocha.addFile('test/runner.js'); -mocha.addFile('test/runnable.js'); -mocha.addFile('test/hook.sync.js'); -mocha.addFile('test/hook.sync.nested.js'); -mocha.addFile('test/hook.async.js'); -mocha.addFile('test/acceptance/duration.js'); -mocha.addFile('test/acceptance/fs.js'); -mocha.addFile('test/acceptance/globals.js'); -mocha.addFile('test/acceptance/pending.js'); -mocha.addFile('test/acceptance/timeout.js'); - -mocha.run(function(){ - console.log('done'); -}).on('pass', function(test){ - // console.log('... %s', test.title); -}); diff --git a/tests/lib/mocha-2.1.0/test/mocha.opts b/tests/lib/mocha-2.1.0/test/mocha.opts deleted file mode 100644 index 3c2f2cbd020e3360d7a853a8ce8a4759b805d2ff..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/mocha.opts +++ /dev/null @@ -1,7 +0,0 @@ ---require should ---reporter dot ---ui bdd ---globals okGlobalA,okGlobalB ---globals okGlobalC ---globals callback* ---timeout 200 diff --git a/tests/lib/mocha-2.1.0/test/regression/issue1327/case.js b/tests/lib/mocha-2.1.0/test/regression/issue1327/case.js deleted file mode 100644 index 295ec1241395d81f30649fed2118980fd93c01a6..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/regression/issue1327/case.js +++ /dev/null @@ -1,14 +0,0 @@ -var debug = require('debug')('mocha:issue1327'); -it("test 1", function() { - debug("This runs only once."); - process.nextTick(function() { - throw "Too bad"; - }); -}); -it("test 2", function() { - debug("This should run once - Previously wasn't called at all."); -}); -it("test 3", function() { - debug("This used to run twice."); - throw new Error("OUCH"); -}); diff --git a/tests/lib/mocha-2.1.0/test/regression/issue1327/control.js b/tests/lib/mocha-2.1.0/test/regression/issue1327/control.js deleted file mode 100644 index b77555da02547309c0e6acd87fae6d123fb59458..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/regression/issue1327/control.js +++ /dev/null @@ -1,10 +0,0 @@ -var assert = require("assert"), - fs = require("fs"); - -describe("GitHub issue #1327: expected behavior of case.js", function() { - it("should have run 3 tests", function() { - var results = JSON.parse(fs.readFileSync( - "test-outputs/issue1327/case-out.json")); - results.stats.tests.should.equal(3); - }); -}); diff --git a/tests/lib/mocha-2.1.0/test/reporters/base.js b/tests/lib/mocha-2.1.0/test/reporters/base.js deleted file mode 100644 index d285bf8845aa645ea69ec81692582b5451df9095..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/reporters/base.js +++ /dev/null @@ -1,136 +0,0 @@ -var Base = require('../../lib/reporters/base'); - -describe('Base reporter', function () { - - it('should show diffs with showDiff property set', function () { - var err = new Error('test'), - stdout = [], - stdoutWrite = process.stdout.write, - errOut; - - err.actual = "a1"; - err.expected = "e1"; - err.showDiff = true; - var test = { - err: err, - fullTitle: function () { - return 'title'; - } - }; - - process.stdout.write = function (string) { - stdout.push(string); - }; - - Base.list([test]); - - process.stdout.write = stdoutWrite; - - errOut = stdout.join('\n'); - - errOut.should.match(/test/); - errOut.should.match(/actual/); - errOut.should.match(/expected/); - - }); - - - it('should not stringify strings', function () { - var err = new Error('test'), - stdout = [], - stdoutWrite = process.stdout.write, - errOut; - - err.actual = "a1"; - err.expected = "e2"; - err.showDiff = true; - var test = { - err: err, - fullTitle: function () { - return 'title'; - } - }; - - process.stdout.write = function (string) { - stdout.push(string); - }; - - Base.list([test]); - - process.stdout.write = stdoutWrite; - - errOut = stdout.join('\n'); - - errOut.should.not.match(/"/); - errOut.should.match(/test/); - errOut.should.match(/actual/); - errOut.should.match(/expected/); - - }); - - - it('should stringify objects', function () { - var err = new Error('test'), - stdout = [], - stdoutWrite = process.stdout.write, - errOut; - - err.actual = {key:"a1"}; - err.expected = {key:"e1"}; - err.showDiff = true; - var test = { - err: err, - fullTitle: function () { - return 'title'; - } - }; - - process.stdout.write = function (string) { - stdout.push(string); - }; - - Base.list([test]); - - process.stdout.write = stdoutWrite; - - errOut = stdout.join('\n'); - - errOut.should.match(/"key"/); - errOut.should.match(/test/); - errOut.should.match(/actual/); - errOut.should.match(/expected/); - - }); - - it('should not show diffs when showDiff property set', function () { - var err = new Error('test'), - stdout = [], - stdoutWrite = process.stdout.write, - errOut; - - err.actual = "a1"; - err.expected = "e1"; - err.showDiff = false; - var test = { - err: err, - fullTitle: function () { - return 'title'; - } - }; - - process.stdout.write = function (string) { - stdout.push(string); - }; - - Base.list([test]); - - process.stdout.write = stdoutWrite; - - errOut = stdout.join('\n'); - - errOut.should.match(/test/); - errOut.should.not.match(/actual/); - errOut.should.not.match(/expected/); - - }); -}); diff --git a/tests/lib/mocha-2.1.0/test/reporters/json.js b/tests/lib/mocha-2.1.0/test/reporters/json.js deleted file mode 100644 index f071e754803e50219b05050bfab043d7d1ddd74b..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/reporters/json.js +++ /dev/null @@ -1,61 +0,0 @@ -var Mocha = require('../../') - , Suite = Mocha.Suite - , Runner = Mocha.Runner - , Test = Mocha.Test; - -describe('json reporter', function(){ - var suite, runner; - - beforeEach(function(){ - var mocha = new Mocha({ - reporter: 'json' - }); - suite = new Suite('JSON suite', 'root'); - runner = new Runner(suite); - var mochaReporter = new mocha._reporter(runner); - }) - - it('should have 1 test failure', function(done){ - var testTitle = 'json test 1'; - var error = { message: 'oh shit' }; - - suite.addTest(new Test(testTitle, function (done) { - done(new Error(error.message)); - })); - - runner.run(function(failureCount) { - failureCount.should.be.exactly(1); - runner.should.have.property('testResults'); - runner.testResults.should.have.property('failures'); - runner.testResults.failures.should.be.an.instanceOf(Array); - runner.testResults.failures.should.have.a.lengthOf(1); - - var failure = runner.testResults.failures[0]; - failure.should.have.property('title', testTitle); - failure.err.message.should.equal(error.message); - failure.should.have.properties('err'); - - done(); - }); - }) - - it('should have 1 test pending', function(done) { - var testTitle = 'json test 1'; - - suite.addTest(new Test(testTitle)); - - runner.run(function(failureCount) { - failureCount.should.be.exactly(0); - runner.should.have.property('testResults'); - runner.testResults.should.have.property('pending'); - runner.testResults.pending.should.be.an.instanceOf(Array); - runner.testResults.pending.should.have.a.lengthOf(1); - - var pending = runner.testResults.pending[0]; - pending.should.have.property('title', testTitle); - - done(); - }); - }) - -}) diff --git a/tests/lib/mocha-2.1.0/test/reporters/nyan.js b/tests/lib/mocha-2.1.0/test/reporters/nyan.js deleted file mode 100644 index 8a54458961774691f9805c0d9c6cf636f46586e0..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/reporters/nyan.js +++ /dev/null @@ -1,30 +0,0 @@ -var reporters = require('../../').reporters - , NyanCat = reporters.Nyan; - - -describe('nyan face', function () { - it('nyan face:(x .x) when "failures" at least one', function () { - var nyanCat = new NyanCat({on: function(){}}); - nyanCat.stats = { passes: 2, pending: 1, failures: 1 }; - nyanCat.face.call(nyanCat).should.equal('( x .x)'); - }); - - it('expected nyan face:(x .x) when "peinding" at least one and no failing', function () { - var nyanCat = new NyanCat({on: function(){}}); - nyanCat.stats = { passes: 2, pending: 1, failures: 0 }; - nyanCat.face.call(nyanCat).should.equal('( o .o)'); - }); - - it('expected nyan face:(^ .^) when "passing" only', function () { - var nyanCat = new NyanCat({on: function(){}}); - nyanCat.stats = { passes: 1, pending: 0, failures: 0 }; - nyanCat.face.call(nyanCat).should.equal('( ^ .^)'); - }); - - it('nyan face:(- .-) when otherwise', function (done) { - var nyanCat = new NyanCat({on: function(){}}); - nyanCat.stats = { passes: 0, pending: 0, failures: 0 }; - nyanCat.face.call(nyanCat).should.equal('( - .-)'); - done(); - }); -}) diff --git a/tests/lib/mocha-2.1.0/test/runnable.js b/tests/lib/mocha-2.1.0/test/runnable.js deleted file mode 100644 index dd05a7543b8bb102c53f94aa4d5a37119c50bcba..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/runnable.js +++ /dev/null @@ -1,409 +0,0 @@ -var mocha = require('../') - , Runnable = mocha.Runnable - , EventEmitter = require('events').EventEmitter; - -describe('Runnable(title, fn)', function(){ - // For every test we poison the global time-related methods. - // runnable.js etc. should keep its own local copy, in order to fix GH-237. - // NB: we can't poison global.Date because the normal implementation of - // global.setTimeout uses it [1] so if the runnable.js keeps a copy of - // global.setTimeout (like it's supposed to), that will blow up. - // [1]: https://github.com/joyent/node/blob/7fc835afe362ebd30a0dbec81d3360bd24525222/lib/timers.js#L74 - var setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; - - function poisonPill() { - throw new Error("Don't use global time-related stuff."); - } - - beforeEach(function(){ - global.setTimeout = - global.setInterval = - global.clearTimeout = - global.clearInterval = poisonPill; - }) - - afterEach(function(){ - global.setTimeout = setTimeout; - global.setInterval = setInterval; - global.clearTimeout = clearTimeout; - global.clearInterval = clearInterval; - }) - - describe('#timeout(ms)', function(){ - it('should set the timeout', function(){ - var run = new Runnable; - run.timeout(1000) - run.timeout().should.equal(1000); - }) - }) - - describe('#enableTimeouts(enabled)', function(){ - it('should set enabled', function(){ - var run = new Runnable; - run.enableTimeouts(false); - run.enableTimeouts().should.equal(false); - }); - }); - - describe('#slow(ms)', function(){ - it('should set the slow threshold', function(){ - var run = new Runnable; - run.slow(100) - run.slow().should.equal(100); - }) - }) - - describe('.title', function(){ - it('should be present', function(){ - new Runnable('foo').title.should.equal('foo'); - }) - }) - - describe('when arity >= 1', function(){ - it('should be .async', function(){ - var run = new Runnable('foo', function(done){}); - run.async.should.equal(1); - run.sync.should.be.false; - }) - }) - - describe('when arity == 0', function(){ - it('should be .sync', function(){ - var run = new Runnable('foo', function(){}); - run.async.should.be.equal(0); - run.sync.should.be.true; - }) - }) - - describe('#globals', function(){ - it('should allow for whitelisting globals', function(done){ - var test = new Runnable('foo', function(){}); - test.async.should.be.equal(0); - test.sync.should.be.true; - test.globals(['foobar']); - test.run(done); - }) - }) - - describe('.run(fn)', function(){ - describe('when .pending', function(){ - it('should not invoke the callback', function(done){ - var test = new Runnable('foo', function(){ - throw new Error('should not be called'); - }); - - test.pending = true; - test.run(done); - }) - }) - - describe('when sync', function(){ - describe('without error', function(){ - it('should invoke the callback', function(done){ - var calls = 0; - var test = new Runnable('foo', function(){ - ++calls; - }); - - test.run(function(err){ - calls.should.equal(1); - test.duration.should.be.type('number'); - done(err); - }) - }) - }) - - describe('when an exception is thrown', function(){ - it('should invoke the callback', function(done){ - var calls = 0; - var test = new Runnable('foo', function(){ - ++calls; - throw new Error('fail'); - }); - - test.run(function(err){ - calls.should.equal(1); - err.message.should.equal('fail'); - done(); - }) - }) - }) - }) - - describe('when timeouts are disabled', function() { - it('should not error with timeout', function(done) { - var test = new Runnable('foo', function(done){ - setTimeout(process.nextTick.bind(undefined, done), 2); - }); - test.timeout(1); - test.enableTimeouts(false); - test.run(done); - }); - }); - - describe('when async', function(){ - describe('without error', function(){ - it('should invoke the callback', function(done){ - var calls = 0; - var test = new Runnable('foo', function(done){ - process.nextTick(done); - }); - - test.run(done); - }) - }) - - describe('when the callback is invoked several times', function(){ - describe('without an error', function(){ - it('should emit a single "error" event', function(done){ - var calls = 0; - var errCalls = 0; - - var test = new Runnable('foo', function(done){ - process.nextTick(done); - process.nextTick(done); - process.nextTick(done); - process.nextTick(done); - }); - - test.on('error', function(err){ - ++errCalls; - err.message.should.equal('done() called multiple times'); - calls.should.equal(1); - errCalls.should.equal(1); - done(); - }); - - test.run(function(){ - ++calls; - }); - }) - }) - - describe('with an error', function(){ - it('should emit a single "error" event', function(done){ - var calls = 0; - var errCalls = 0; - - var test = new Runnable('foo', function(done){ - done(new Error('fail')); - process.nextTick(done); - done(new Error('fail')); - process.nextTick(done); - process.nextTick(done); - }); - - test.on('error', function(err){ - ++errCalls; - err.message.should.equal('fail'); - calls.should.equal(1); - errCalls.should.equal(1); - done(); - }); - - test.run(function(){ - ++calls; - }); - }) - }) - }) - - describe('when an exception is thrown', function(){ - it('should invoke the callback', function(done){ - var calls = 0; - var test = new Runnable('foo', function(done){ - throw new Error('fail'); - process.nextTick(done); - }); - - test.run(function(err){ - err.message.should.equal('fail'); - done(); - }); - }) - - it('should not throw its own exception if passed a non-object', function (done) { - var test = new Runnable('foo', function(done) { - throw null; - process.nextTick(done); - }); - - test.run(function(err) { - err.message.should.equal('Caught undefined error, did you throw without specifying what?'); - done(); - }) - }); - }) - - describe('when an error is passed', function(){ - it('should invoke the callback', function(done){ - var calls = 0; - var test = new Runnable('foo', function(done){ - done(new Error('fail')); - }); - - test.run(function(err){ - err.message.should.equal('fail'); - done(); - }); - }) - }) - - describe('when done() is invoked with a non-Error object', function(){ - it('should invoke the callback', function(done){ - var test = new Runnable('foo', function(done){ - done({ error: 'Test error' }); - }); - - test.run(function(err){ - err.message.should.equal('done() invoked with non-Error: {"error":"Test error"}'); - done(); - }); - }) - }) - - describe('when done() is invoked with a string', function(){ - it('should invoke the callback', function(done){ - var test = new Runnable('foo', function(done){ - done('Test error'); - }); - - test.run(function(err){ - err.message.should.equal('done() invoked with non-Error: Test error'); - done(); - }); - }) - }) - - it('should allow updating the timeout', function(done){ - var callCount = 0; - var increment = function() { - callCount++; - }; - var test = new Runnable('foo', function(done){ - setTimeout(increment, 1); - setTimeout(increment, 100); - }); - test.timeout(10); - test.run(function(err){ - err.should.be.ok; - callCount.should.equal(1); - done(); - }); - }) - - it('should allow a timeout of 0') - }) - - describe('when fn returns a promise', function(){ - describe('when the promise is fulfilled with no value', function(){ - var fulfilledPromise = { - then: function (fulfilled, rejected) { - process.nextTick(fulfilled); - } - }; - - it('should invoke the callback', function(done){ - var test = new Runnable('foo', function(){ - return fulfilledPromise; - }); - - test.run(done); - }) - }) - - describe('when the promise is fulfilled with a value', function(){ - var fulfilledPromise = { - then: function (fulfilled, rejected) { - process.nextTick(function () { - fulfilled({}); - }); - } - }; - - it('should invoke the callback', function(done){ - var test = new Runnable('foo', function(){ - return fulfilledPromise; - }); - - test.run(done); - }) - }) - - describe('when the promise is rejected', function(){ - var expectedErr = new Error('fail'); - var rejectedPromise = { - then: function (fulfilled, rejected) { - process.nextTick(function () { - rejected(expectedErr); - }); - } - }; - - it('should invoke the callback', function(done){ - var test = new Runnable('foo', function(){ - return rejectedPromise; - }); - - test.run(function(err){ - err.should.equal(expectedErr); - done(); - }); - }) - }) - - describe('when the promise is rejected without a reason', function(){ - var expectedErr = new Error('Promise rejected with no or falsy reason'); - var rejectedPromise = { - then: function (fulfilled, rejected) { - process.nextTick(function () { - rejected(); - }); - } - }; - - it('should invoke the callback', function(done){ - var test = new Runnable('foo', function(){ - return rejectedPromise; - }); - - test.run(function(err){ - err.should.eql(expectedErr); - done(); - }); - }) - }) - - describe('when the promise takes too long to settle', function(){ - var foreverPendingPromise = { - then: function () { } - }; - - it('should give the timeout error', function(done){ - var test = new Runnable('foo', function(){ - return foreverPendingPromise; - }); - - test.timeout(10); - test.run(function(err){ - err.should.be.ok; - done(); - }); - }) - }) - }) - - describe('when fn returns a non-promise', function(){ - it('should invoke the callback', function(done){ - var test = new Runnable('foo', function(){ - return { then: "i ran my tests" }; - }); - - test.run(done); - }) - }) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/runner.js b/tests/lib/mocha-2.1.0/test/runner.js deleted file mode 100644 index a11aeedabfb01fcd339e874094c3e26a24ff121c..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/runner.js +++ /dev/null @@ -1,258 +0,0 @@ -var mocha = require('../') - , Suite = mocha.Suite - , Runner = mocha.Runner - , Test = mocha.Test; - -describe('Runner', function(){ - var suite, runner; - - beforeEach(function(){ - suite = new Suite(null, 'root'); - runner = new Runner(suite); - }) - - describe('.grep()', function(){ - it('should update the runner.total with number of matched tests', function(){ - suite.addTest(new Test('im a test about lions')); - suite.addTest(new Test('im another test about lions')); - suite.addTest(new Test('im a test about bears')); - var newRunner = new Runner(suite); - newRunner.grep(/lions/); - newRunner.total.should.equal(2); - }) - - it('should update the runner.total with number of matched tests when inverted', function(){ - suite.addTest(new Test('im a test about lions')); - suite.addTest(new Test('im another test about lions')); - suite.addTest(new Test('im a test about bears')); - var newRunner = new Runner(suite); - newRunner.grep(/lions/, true); - newRunner.total.should.equal(1); - }) - }) - - describe('.grepTotal()', function(){ - it('should return the total number of matched tests', function(){ - suite.addTest(new Test('im a test about lions')); - suite.addTest(new Test('im another test about lions')); - suite.addTest(new Test('im a test about bears')); - runner.grep(/lions/); - runner.grepTotal(suite).should.equal(2); - }) - - it('should return the total number of matched tests when inverted', function(){ - suite.addTest(new Test('im a test about lions')); - suite.addTest(new Test('im another test about lions')); - suite.addTest(new Test('im a test about bears')); - runner.grep(/lions/, true); - runner.grepTotal(suite).should.equal(1); - }) - }) - - describe('.globalProps()', function(){ - it('should include common non enumerable globals', function() { - var props = runner.globalProps(); - props.should.containEql('setTimeout'); - props.should.containEql('clearTimeout'); - props.should.containEql('setInterval'); - props.should.containEql('clearInterval'); - props.should.containEql('Date'); - props.should.containEql('XMLHttpRequest'); - }); - }); - - describe('.globals()', function(){ - it('should default to the known globals', function(){ - runner.globals().length.should.be.above(16); - }) - - it('should white-list globals', function(){ - runner.globals(['foo', 'bar']); - runner.globals().should.containEql('foo'); - runner.globals().should.containEql('bar'); - }) - }) - - describe('.checkGlobals(test)', function(){ - it('should allow variables that match a wildcard', function(done) { - runner.globals(['foo*', 'giz*']); - global.foo = 'baz'; - global.gizmo = 'quux'; - runner.checkGlobals(); - delete global.foo; - delete global.gizmo; - done() - }) - - it('should emit "fail" when a new global is introduced', function(done){ - runner.checkGlobals(); - global.foo = 'bar'; - runner.on('fail', function(test, err){ - test.should.equal('im a test'); - err.message.should.equal('global leak detected: foo'); - delete global.foo; - done(); - }); - runner.checkGlobals('im a test'); - }) - - it('should emit "fail" when a single new disallowed global is introduced after a single extra global is allowed', function(done) { - var doneCalled = false; - runner.globals('good'); - global.bad = 1; - runner.on('fail', function(test, err) { - delete global.bad; - done(); - doneCalled = true; - }); - runner.checkGlobals('test'); - if (!doneCalled) { - done(Error("Expected test failure did not occur.")); - } - }); - - it ('should not fail when a new common global is introduced', function(){ - // verify that the prop isn't enumerable - delete global.XMLHttpRequest; - global.propertyIsEnumerable('XMLHttpRequest').should.not.be.ok; - - // create a new runner and keep a reference to the test. - var test = new Test('im a test about bears'); - suite.addTest(test); - var newRunner = new Runner(suite); - - // make the prop enumerable again. - global.XMLHttpRequest = function() {}; - global.propertyIsEnumerable('XMLHttpRequest').should.be.ok; - - // verify the test hasn't failed. - newRunner.checkGlobals(test); - test.should.not.have.key('state'); - - // clean up our global space. - delete global.XMLHttpRequest; - }); - - it('should pluralize the error message when several are introduced', function(done){ - runner.checkGlobals(); - global.foo = 'bar'; - global.bar = 'baz'; - runner.on('fail', function(test, err){ - test.should.equal('im a test'); - err.message.should.equal('global leaks detected: foo, bar'); - delete global.foo; - delete global.bar; - done(); - }); - runner.checkGlobals('im a test'); - }) - - it('should respect per test whitelisted globals', function() { - var test = new Test('im a test about lions'); - test.globals(['foo']); - - suite.addTest(test); - var runner = new Runner(suite); - - global.foo = 'bar'; - - // verify the test hasn't failed. - runner.checkGlobals(test); - test.should.not.have.key('state'); - - delete global.foo; - }) - - it('should respect per test whitelisted globals but still detect other leaks', function(done) { - var test = new Test('im a test about lions'); - test.globals(['foo']); - - suite.addTest(test); - - global.foo = 'bar'; - global.bar = 'baz'; - runner.on('fail', function(test, err){ - test.title.should.equal('im a test about lions'); - err.message.should.equal('global leak detected: bar'); - delete global.foo; - done(); - }); - runner.checkGlobals(test); - }) - }) - - describe('.hook(name, fn)', function(){ - it('should execute hooks after failed test if suite bail is true', function(done){ - runner.fail({}); - suite.bail(true); - suite.afterEach(function(){ - suite.afterAll(function() { - done(); - }) - }); - runner.hook('afterEach', function(){}); - runner.hook('afterAll', function(){}); - }) - }) - - describe('.fail(test, err)', function(){ - it('should increment .failures', function(){ - runner.failures.should.equal(0); - runner.fail({}, {}); - runner.failures.should.equal(1); - runner.fail({}, {}); - runner.failures.should.equal(2); - }) - - it('should set test.state to "failed"', function(){ - var test = {}; - runner.fail(test, 'some error'); - test.state.should.equal('failed'); - }) - - it('should emit "fail"', function(done){ - var test = {}, err = {}; - runner.on('fail', function(test, err){ - test.should.equal(test); - err.should.equal(err); - done(); - }); - runner.fail(test, err); - }) - }) - - describe('.failHook(hook, err)', function(){ - it('should increment .failures', function(){ - runner.failures.should.equal(0); - runner.failHook({}, {}); - runner.failures.should.equal(1); - runner.failHook({}, {}); - runner.failures.should.equal(2); - }) - - it('should emit "fail"', function(done){ - var hook = {}, err = {}; - runner.on('fail', function(hook, err){ - hook.should.equal(hook); - err.should.equal(err); - done(); - }); - runner.failHook(hook, err); - }) - - it('should emit "end" if suite bail is true', function(done){ - var hook = {}, err = {}; - suite.bail(true); - runner.on('end', done); - runner.failHook(hook, err); - }) - - it('should not emit "end" if suite bail is not true', function(done){ - var hook = {}, err = {}; - suite.bail(false); - runner.on('end', function() { throw new Error('"end" was emit, but the bail is false'); }); - runner.failHook(hook, err); - done(); - }) - }) -}) diff --git a/tests/lib/mocha-2.1.0/test/suite.js b/tests/lib/mocha-2.1.0/test/suite.js deleted file mode 100644 index 011b3fb2b8c46113809ef795faa4b877a9f7d1bf..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/suite.js +++ /dev/null @@ -1,396 +0,0 @@ -var mocha = require('../') - , Context = mocha.Context - , Suite = mocha.Suite - , Test = mocha.Test; - -describe('Suite', function(){ - describe('.clone()', function(){ - beforeEach(function(){ - this.suite = new Suite('To be cloned'); - this.suite._timeout = 3043; - this.suite._slow = 101; - this.suite._bail = true; - this.suite.suites.push(1); - this.suite.tests.push('hello'); - this.suite._beforeEach.push(2); - this.suite._beforeAll.push(3); - this.suite._afterEach.push(4); - this.suite._afterAll.push(5); - }); - - it('should copy the title', function(){ - this.suite.clone().title.should.equal('To be cloned'); - }); - - it('should copy the timeout value', function(){ - this.suite.clone().timeout().should.equal(3043); - }); - - it('should copy the slow value', function(){ - this.suite.clone().slow().should.equal(101); - }); - - it('should copy the bail value', function(){ - this.suite.clone().bail().should.be.true; - }); - - it('should not copy the values from the suites array', function(){ - this.suite.clone().suites.should.be.empty; - }); - - it('should not copy the values from the tests array', function(){ - this.suite.clone().tests.should.be.empty; - }); - - it('should not copy the values from the _beforeEach array', function(){ - this.suite.clone()._beforeEach.should.be.empty; - }); - - it('should not copy the values from the _beforeAll array', function(){ - this.suite.clone()._beforeAll.should.be.empty; - }); - - it('should not copy the values from the _afterEach array', function(){ - this.suite.clone()._afterEach.should.be.empty; - }); - - it('should not copy the values from the _afterAll array', function(){ - this.suite.clone()._afterAll.should.be.empty; - }); - }); - - describe('.timeout()', function(){ - beforeEach(function(){ - this.suite = new Suite('A Suite'); - }); - - describe('when no argument is passed', function(){ - it('should return the timeout value', function(){ - this.suite.timeout().should.equal(2000); - }); - }); - - describe('when argument is passed', function(){ - it('should return the Suite object', function(){ - var newSuite = this.suite.timeout(5000); - newSuite.timeout().should.equal(5000); - }); - }); - }); - - describe('.slow()', function(){ - beforeEach(function(){ - this.suite = new Suite('A Suite'); - }); - - describe('when given a string', function(){ - it('should parse it', function(){ - this.suite.slow('5 seconds'); - this.suite.slow().should.equal(5000); - }) - }) - - describe('when no argument is passed', function(){ - it('should return the slow value', function(){ - this.suite.slow().should.equal(75); - }); - }); - - describe('when argument is passed', function(){ - it('should return the Suite object', function(){ - var newSuite = this.suite.slow(5000); - newSuite.slow().should.equal(5000); - }); - }); - }); - - describe('.bail()', function(){ - beforeEach(function(){ - this.suite = new Suite('A Suite'); - this.suite._bail = true - }); - - describe('when no argument is passed', function(){ - it('should return the bail value', function(){ - this.suite.bail().should.be.true; - }); - }); - - describe('when argument is passed', function(){ - it('should return the Suite object', function(){ - var newSuite = this.suite.bail(false); - newSuite.bail().should.be.false; - }); - }); - }); - - describe('.beforeAll()', function(){ - beforeEach(function(){ - this.suite = new Suite('A Suite'); - }); - - describe('wraps the passed in function in a Hook', function(){ - it('adds it to _beforeAll', function(){ - var fn = function(){}; - this.suite.beforeAll(fn); - - this.suite._beforeAll.should.have.length(1); - var beforeAllItem = this.suite._beforeAll[0]; - beforeAllItem.title.should.equal('"before all" hook'); - beforeAllItem.fn.should.equal(fn); - }); - - it('appends title to hook', function(){ - var fn = function(){}; - this.suite.beforeAll('test', fn); - - this.suite._beforeAll.should.have.length(1); - var beforeAllItem = this.suite._beforeAll[0]; - beforeAllItem.title.should.equal('"before all" hook: test'); - beforeAllItem.fn.should.equal(fn); - - function namedFn(){} - this.suite.beforeAll(namedFn); - this.suite._beforeAll.should.have.length(2); - beforeAllItem = this.suite._beforeAll[1]; - beforeAllItem.title.should.equal('"before all" hook: namedFn'); - beforeAllItem.fn.should.equal(namedFn); - }); - }); - }); - - describe('.afterAll()', function(){ - beforeEach(function(){ - this.suite = new Suite('A Suite'); - }); - - describe('wraps the passed in function in a Hook', function(){ - it('adds it to _afterAll', function(){ - var fn = function(){}; - this.suite.afterAll(fn); - - this.suite._afterAll.should.have.length(1); - var afterAllItem = this.suite._afterAll[0]; - afterAllItem.title.should.equal('"after all" hook'); - afterAllItem.fn.should.equal(fn); - }); - it('appends title to hook', function(){ - var fn = function(){}; - this.suite.afterAll('test', fn); - - this.suite._afterAll.should.have.length(1); - var beforeAllItem = this.suite._afterAll[0]; - beforeAllItem.title.should.equal('"after all" hook: test'); - beforeAllItem.fn.should.equal(fn); - - function namedFn(){} - this.suite.afterAll(namedFn); - this.suite._afterAll.should.have.length(2); - beforeAllItem = this.suite._afterAll[1]; - beforeAllItem.title.should.equal('"after all" hook: namedFn'); - beforeAllItem.fn.should.equal(namedFn); - }); - }); - }); - - describe('.beforeEach()', function(){ - beforeEach(function(){ - this.suite = new Suite('A Suite'); - }); - - describe('wraps the passed in function in a Hook', function(){ - it('adds it to _beforeEach', function(){ - var fn = function(){}; - this.suite.beforeEach(fn); - - this.suite._beforeEach.should.have.length(1); - var beforeEachItem = this.suite._beforeEach[0]; - beforeEachItem.title.should.equal('"before each" hook'); - beforeEachItem.fn.should.equal(fn); - }); - - it('appends title to hook', function(){ - var fn = function(){}; - this.suite.beforeEach('test', fn); - - this.suite._beforeEach.should.have.length(1); - var beforeAllItem = this.suite._beforeEach[0]; - beforeAllItem.title.should.equal('"before each" hook: test'); - beforeAllItem.fn.should.equal(fn); - - function namedFn(){} - this.suite.beforeEach(namedFn); - this.suite._beforeEach.should.have.length(2); - beforeAllItem = this.suite._beforeEach[1]; - beforeAllItem.title.should.equal('"before each" hook: namedFn'); - beforeAllItem.fn.should.equal(namedFn); - }); - }); - }); - - describe('.afterEach()', function(){ - beforeEach(function(){ - this.suite = new Suite('A Suite'); - }); - - describe('wraps the passed in function in a Hook', function(){ - it('adds it to _afterEach', function(){ - var fn = function(){}; - this.suite.afterEach(fn); - - this.suite._afterEach.should.have.length(1); - var afterEachItem = this.suite._afterEach[0]; - afterEachItem.title.should.equal('"after each" hook'); - afterEachItem.fn.should.equal(fn); - }); - - it('appends title to hook', function(){ - var fn = function(){}; - this.suite.afterEach('test', fn); - - this.suite._afterEach.should.have.length(1); - var beforeAllItem = this.suite._afterEach[0]; - beforeAllItem.title.should.equal('"after each" hook: test'); - beforeAllItem.fn.should.equal(fn); - - function namedFn(){} - this.suite.afterEach(namedFn); - this.suite._afterEach.should.have.length(2); - beforeAllItem = this.suite._afterEach[1]; - beforeAllItem.title.should.equal('"after each" hook: namedFn'); - beforeAllItem.fn.should.equal(namedFn); - }); - }); - }); - - describe('.addSuite()', function(){ - beforeEach(function(){ - this.first = new Suite('First suite'); - this.first.timeout(4002); - this.first.slow(200); - this.second = new Suite('Second suite'); - this.first.addSuite(this.second); - }); - - it('sets the parent on the added Suite', function(){ - this.second.parent.should.equal(this.first); - }); - - it('copies the timeout value', function(){ - this.second.timeout().should.equal(4002); - }); - - it('copies the slow value', function(){ - this.second.slow().should.equal(200); - }); - - it('adds the suite to the suites collection', function(){ - this.first.suites.should.have.length(1); - this.first.suites[0].should.equal(this.second); - }); - }); - - // describe('.addTest()', function(){ - // beforeEach(function(){ - // this.suite = new Suite('A Suite', new Context); - // this.suite.timeout(4002); - // this.test = new Test('test'); - // this.suite.addTest(this.test); - // }); - // - // it('sets the parent on the added test', function(){ - // this.test.parent.should.equal(this.suite); - // }); - // - // it('copies the timeout value', function(){ - // this.test.timeout().should.equal(4002); - // }); - // - // it('adds the test to the tests collection', function(){ - // this.suite.tests.should.have.length(1); - // this.suite.tests[0].should.equal(this.test); - // }); - // }); - - describe('.fullTitle()', function(){ - beforeEach(function(){ - this.suite = new Suite('A Suite'); - }); - - describe('when there is no parent', function(){ - it('returns the suite title', function(){ - this.suite.fullTitle().should.equal('A Suite'); - }); - }); - - describe('when there is a parent', function(){ - it('returns the combination of parent\'s and suite\'s title', function(){ - var parentSuite = new Suite('I am a parent'); - parentSuite.addSuite(this.suite); - this.suite.fullTitle().should.equal('I am a parent A Suite'); - }); - }); - }); - - describe('.total()', function(){ - beforeEach(function(){ - this.suite = new Suite('A Suite'); - }); - - describe('when there are no nested suites or tests', function(){ - it('should return 0', function(){ - this.suite.total().should.equal(0); - }); - }); - - describe('when there are several tests in the suite', function(){ - it('should return the number', function(){ - this.suite.addTest(new Test('a child test')); - this.suite.addTest(new Test('another child test')); - this.suite.total().should.equal(2); - }); - }); - }); - - describe('.eachTest(fn)', function(){ - beforeEach(function(){ - this.suite = new Suite('A Suite'); - }); - - describe('when there are no nested suites or tests', function(){ - it('should return 0', function(){ - var n = 0; - function fn(){ n++; } - this.suite.eachTest(fn); - n.should.equal(0); - }); - }); - - describe('when there are several tests in the suite', function(){ - it('should return the number', function(){ - this.suite.addTest(new Test('a child test')); - this.suite.addTest(new Test('another child test')); - - var n = 0; - function fn(){ n++; } - this.suite.eachTest(fn); - n.should.equal(2); - }); - }); - - describe('when there are several levels of nested suites', function(){ - it('should return the number', function(){ - this.suite.addTest(new Test('a child test')); - var suite = new Suite('a child suite'); - suite.addTest(new Test('a test in a child suite')); - this.suite.addSuite(suite); - - var n = 0; - function fn(){ n++; } - this.suite.eachTest(fn); - n.should.equal(2); - }); - }); - - }); -}); diff --git a/tests/lib/mocha-2.1.0/test/utils.js b/tests/lib/mocha-2.1.0/test/utils.js deleted file mode 100644 index 3810c777b4a2c405f54766f474edffc4eb1b6256..0000000000000000000000000000000000000000 --- a/tests/lib/mocha-2.1.0/test/utils.js +++ /dev/null @@ -1,26 +0,0 @@ -var mocha = require('..'); -var utils = mocha.utils; -var clean = utils.clean; -var isBuffer = utils.isBuffer; - -describe('utils', function() { - describe('.clean()', function(){ - it('should remove the wrapping function declaration', function(){ - clean('function (one, two, three) {\n//code\n}').should.equal('//code'); - }); - - it('should remove space character indentation from the function body', function(){ - clean(' //line1\n //line2').should.equal('//line1\n //line2'); - }); - - it('should remove tab character indentation from the function body', function(){ - clean('\t//line1\n\t\t//line2').should.equal('//line1\n\t//line2'); - }); - }); - describe('.isBuffer()', function(){ - it('should test if object is a Buffer', function() { - isBuffer(new Buffer([0x01])).should.equal(true); - isBuffer({}).should.equal(false); - }) - }); -}); diff --git a/tests/lib/mocha-2.1.0/LICENSE b/tests/lib/mocha-2.2.5/LICENSE old mode 100644 new mode 100755 similarity index 94% rename from tests/lib/mocha-2.1.0/LICENSE rename to tests/lib/mocha-2.2.5/LICENSE index 1c5d7fa873667fc536c9b5ba71de627674e14ebf..ca47f261b3f92d9414ad2ae9b7cc2fb9afcf4f84 --- a/tests/lib/mocha-2.1.0/LICENSE +++ b/tests/lib/mocha-2.2.5/LICENSE @@ -1,6 +1,6 @@ (The MIT License) -Copyright (c) 2011-2014 TJ Holowaychuk <tj@vision-media.ca> +Copyright (c) 2011-2015 TJ Holowaychuk <tj@vision-media.ca> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/tests/lib/mocha-2.2.5/README.md b/tests/lib/mocha-2.2.5/README.md new file mode 100755 index 0000000000000000000000000000000000000000..44692d35140894d717c9080dde11a301a611f827 --- /dev/null +++ b/tests/lib/mocha-2.2.5/README.md @@ -0,0 +1,11 @@ +[](http://travis-ci.org/mochajs/mocha) [](https://gitter.im/mochajs/mocha?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + + [](http://mochajs.org) + + Mocha is a simple, flexible, fun JavaScript test framework for node.js and the browser. For more information view the [documentation](http://mochajs.org). + +## Links + + - [Google Group](http://groups.google.com/group/mochajs) + - [Wiki](https://github.com/mochajs/mocha/wiki) + - Mocha [Extensions and reporters](https://github.com/mochajs/mocha/wiki) diff --git a/tests/lib/mocha-2.1.0/bin/_mocha b/tests/lib/mocha-2.2.5/bin/_mocha old mode 100644 new mode 100755 similarity index 85% rename from tests/lib/mocha-2.1.0/bin/_mocha rename to tests/lib/mocha-2.2.5/bin/_mocha index 49481973949a2f6f1dc7ddb2c95112fe27fe35cb..5b3c0c5b29f3886f2710de08975cdacf06f8334d --- a/tests/lib/mocha-2.1.0/bin/_mocha +++ b/tests/lib/mocha-2.2.5/bin/_mocha @@ -4,16 +4,17 @@ * Module dependencies. */ -var program = require('commander') - , path = require('path') - , fs = require('fs') - , resolve = path.resolve - , exists = fs.existsSync || path.existsSync - , Mocha = require('../') - , utils = Mocha.utils - , join = path.join - , cwd = process.cwd() - , mocha = new Mocha; +var program = require('commander'), + path = require('path'), + fs = require('fs'), + resolve = path.resolve, + exists = fs.existsSync || path.existsSync, + Mocha = require('../'), + utils = Mocha.utils, + join = path.join, + cwd = process.cwd(), + getOptions = require('./options'), + mocha = new Mocha; /** * Save timer references to avoid Sinon interfering (see GH-237). @@ -67,21 +68,28 @@ program .option('-b, --bail', "bail after first test failure") .option('-d, --debug', "enable node's debugger, synonym for node --debug") .option('-g, --grep <pattern>', 'only run tests matching <pattern>') - .option('-gc', '--expose-gc', 'expose gc extension') - .option('-i, --invert', 'inverts --grep matches') + .option('-f, --fgrep <string>', 'only run tests containing <string>') + .option('-gc, --expose-gc', 'expose gc extension') + .option('-i, --invert', 'inverts --grep and --fgrep matches') .option('-r, --require <name>', 'require the given module') .option('-s, --slow <ms>', '"slow" test threshold in milliseconds [75]') .option('-t, --timeout <ms>', 'set test-case timeout in milliseconds [2000]') .option('-u, --ui <name>', 'specify user-interface (bdd|tdd|exports)', 'bdd') .option('-w, --watch', 'watch files for changes') .option('--check-leaks', 'check for global variable leaks') + .option('--full-trace', 'display the full stack trace') .option('--compilers <ext>:<module>,...', 'use the given module(s) to compile files', list, []) .option('--debug-brk', "enable node's debugger breaking on the first line") .option('--globals <names>', 'allow the given comma-delimited global [names]', list, []) .option('--harmony', 'enable all harmony features (except typeof)') + .option('--es_staging', 'enable all staged features') .option('--harmony-collections', 'enable harmony collections (sets, maps, and weak maps)') .option('--harmony-generators', 'enable harmony generators') .option('--harmony-proxies', 'enable harmony proxies') + .option('--harmony_shipping', 'enable all shipped harmony fetaures (iojs)') + .option('--harmony_arrow_functions', 'enable "harmony arrow functions" (iojs)') + .option('--harmony_proxies', 'enable "harmony proxies" (iojs)') + .option('--harmony_classes', 'enable "harmony classes" (iojs)') .option('--inline-diffs', 'display actual/expected differences inline within each string') .option('--interfaces', 'display available interfaces') .option('--no-deprecation', 'silence deprecation warnings') @@ -95,6 +103,7 @@ program .option('--trace', 'trace function calls') .option('--trace-deprecation', 'show stack traces on deprecations') .option('--watch-extensions <ext>,...', 'additional extensions to monitor with --watch', list, []) + .option('--delay', 'wait for async suite definition') program.name = 'mocha'; @@ -167,26 +176,9 @@ program.on('require', function(mod){ requires.push(mod); }); -// --opts +// load mocha.opts into process.argv -var optsPath = process.argv.indexOf('--opts') !== -1 - ? process.argv[process.argv.indexOf('--opts') + 1] - : 'test/mocha.opts'; - -try { - var opts = fs.readFileSync(optsPath, 'utf8') - .trim() - .split(/\s+/) - .filter(function(value) { - return value ? true : false; - }); - - process.argv = process.argv - .slice(0, 2) - .concat(opts.concat(process.argv.slice(2))); -} catch (err) { - // ignore -} +getOptions(); // parse args @@ -264,6 +256,10 @@ mocha.suite.bail(program.bail); if (program.grep) mocha.grep(new RegExp(program.grep)); +// --fgrep + +if (program.fgrep) mocha.grep(program.fgrep); + // --invert if (program.invert) mocha.invert(); @@ -272,6 +268,10 @@ if (program.invert) mocha.invert(); if (program.checkLeaks) mocha.checkLeaks(); +// --stack-trace + +if(program.fullTrace) mocha.fullTrace(); + // --growl if (program.growl) mocha.growl(); @@ -280,6 +280,10 @@ if (program.growl) mocha.growl(); if (program.asyncOnly) mocha.asyncOnly(); +// --delay + +if (program.delay) mocha.delay(); + // --globals mocha.globals(globals); @@ -391,12 +395,32 @@ if (program.watch) { // load mocha.files = files; -runner = mocha.run(program.exit ? process.exit : exitLater); +runner = mocha.run(program.exit ? exit : exitLater); function exitLater(code) { process.on('exit', function() { process.exit(code) }) } +function exit(code) { + // flush output for Node.js Windows pipe bug + // https://github.com/joyent/node/issues/6247 is just one bug example + // https://github.com/visionmedia/mocha/issues/333 has a good discussion + function done() { + if (!(draining--)) process.exit(code); + } + + var draining = 0; + var streams = [process.stdout, process.stderr]; + + streams.forEach(function(stream){ + // submit empty write request and wait for completion + draining += 1; + stream.write('', done); + }); + + done(); +} + process.on('SIGINT', function() { runner.abort(); }) // enable growl notifications @@ -433,7 +457,7 @@ function list(str) { function hideCursor(){ process.stdout.write('\u001b[?25l'); -}; +} /** * Show the cursor. @@ -441,7 +465,7 @@ function hideCursor(){ function showCursor(){ process.stdout.write('\u001b[?25h'); -}; +} /** * Stop play()ing. diff --git a/tests/lib/mocha-2.1.0/bin/mocha b/tests/lib/mocha-2.2.5/bin/mocha old mode 100644 new mode 100755 similarity index 74% rename from tests/lib/mocha-2.1.0/bin/mocha rename to tests/lib/mocha-2.2.5/bin/mocha index 4ab296473c26162cee9bb27926e6338b0b71f1f8..daa8fd910bb43fb7b9872b4f5e26156113551c85 --- a/tests/lib/mocha-2.1.0/bin/mocha +++ b/tests/lib/mocha-2.2.5/bin/mocha @@ -5,8 +5,15 @@ * when found, before invoking the "real" _mocha(1) executable. */ -var spawn = require('child_process').spawn - , args = [ __dirname + '/_mocha' ]; +var spawn = require('child_process').spawn, + path = require('path'), + fs = require('fs'), + args = [path.join(__dirname, '_mocha')], + getOptions = require('./options'); + +// load mocha.opts into process.argv + +getOptions(); process.argv.slice(2).forEach(function(arg){ var flag = arg.split('=')[0]; @@ -28,13 +35,19 @@ process.argv.slice(2).forEach(function(arg){ break; case '--gc-global': case '--harmony': + case '--es_staging': case '--harmony-proxies': case '--harmony-collections': case '--harmony-generators': + case '--harmony_shipping': + case '--harmony_arrow_functions': + case '--harmony_proxies': + case '--harmony_classes': case '--no-deprecation': case '--prof': case '--throw-deprecation': case '--trace-deprecation': + case '--allow-natives-syntax': args.unshift(arg); break; default: @@ -44,7 +57,7 @@ process.argv.slice(2).forEach(function(arg){ } }); -var proc = spawn(process.argv[0], args, { stdio: 'inherit' }); +var proc = spawn(process.execPath, args, { stdio: 'inherit' }); proc.on('exit', function (code, signal) { process.on('exit', function(){ if (signal) { diff --git a/tests/lib/mocha-2.2.5/bin/options.js b/tests/lib/mocha-2.2.5/bin/options.js new file mode 100755 index 0000000000000000000000000000000000000000..3b31798b8d9c6777b139d1017a37eb0b2a95e4da --- /dev/null +++ b/tests/lib/mocha-2.2.5/bin/options.js @@ -0,0 +1,36 @@ +/** + * Dependencies. + */ + +var fs = require('fs'); + +/** + * Export `getOptions`. + */ + +module.exports = getOptions; + +/** + * Get options. + */ + +function getOptions() { + var optsPath = process.argv.indexOf('--opts') !== -1 + ? process.argv[process.argv.indexOf('--opts') + 1] + : 'test/mocha.opts'; + + try { + var opts = fs.readFileSync(optsPath, 'utf8') + .trim() + .split(/\s+/) + .filter(function(value) { + return value ? true : false; + }); + + process.argv = process.argv + .slice(0, 2) + .concat(opts.concat(process.argv.slice(2))); + } catch (err) { + // ignore + } +} diff --git a/tests/lib/mocha-2.1.0/bower.json b/tests/lib/mocha-2.2.5/bower.json old mode 100644 new mode 100755 similarity index 97% rename from tests/lib/mocha-2.1.0/bower.json rename to tests/lib/mocha-2.2.5/bower.json index 3ec9d01958394c7ce53747a9b800d0090fde1b86..f03b076d09e2d5b4d25aa56a46391f888a0f5be3 --- a/tests/lib/mocha-2.1.0/bower.json +++ b/tests/lib/mocha-2.2.5/bower.json @@ -1,6 +1,6 @@ { "name": "mocha", - "version": "2.1.0", + "version": "2.2.5", "homepage": "http://mocha.github.io/mocha", "description": "simple, flexible, fun test framework", "authors": [ diff --git a/tests/lib/mocha-2.1.0/component.json b/tests/lib/mocha-2.2.5/component.json old mode 100644 new mode 100755 similarity index 92% rename from tests/lib/mocha-2.1.0/component.json rename to tests/lib/mocha-2.2.5/component.json index e0c07a2664ade1b9e8c553ccef4ebbf255784ec4..5da3daa25ec5a01bd5bd4116d50cd275a363360e --- a/tests/lib/mocha-2.1.0/component.json +++ b/tests/lib/mocha-2.2.5/component.json @@ -1,6 +1,6 @@ { "name": "mocha", - "version": "2.1.0", + "version": "2.2.5", "repo": "mochajs/mocha", "description": "simple, flexible, fun test framework", "keywords": [ diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - after each.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/bdd - after each.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - after each.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/bdd - after each.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - after.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/bdd - after.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - after.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/bdd - after.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - before each.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/bdd - before each.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - before each.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/bdd - before each.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - before.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/bdd - before.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - before.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/bdd - before.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - describe.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/bdd - describe.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - describe.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/bdd - describe.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - it.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/bdd - it.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - it.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/bdd - it.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_deepEqual.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_deepEqual.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_deepEqual.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_deepEqual.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_equal.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_equal.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_equal.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_equal.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_fail.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_fail.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_fail.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_fail.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_isFunction.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_isFunction.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_isFunction.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_isFunction.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - setup.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - setup.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - setup.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - setup.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - suite.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - suite.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - suite.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - suite.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - teardown.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - teardown.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - teardown.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - teardown.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - test.tmSnippet b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - test.tmSnippet old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - test.tmSnippet rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/Snippets/tdd - test.tmSnippet diff --git a/tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/info.plist b/tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/info.plist old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/editors/JavaScript mocha.tmbundle/info.plist rename to tests/lib/mocha-2.2.5/editors/JavaScript mocha.tmbundle/info.plist diff --git a/tests/lib/mocha-2.1.0/images/error.png b/tests/lib/mocha-2.2.5/images/error.png old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/images/error.png rename to tests/lib/mocha-2.2.5/images/error.png diff --git a/tests/lib/mocha-2.1.0/images/ok.png b/tests/lib/mocha-2.2.5/images/ok.png old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/images/ok.png rename to tests/lib/mocha-2.2.5/images/ok.png diff --git a/tests/lib/mocha-2.1.0/index.js b/tests/lib/mocha-2.2.5/index.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/index.js rename to tests/lib/mocha-2.2.5/index.js diff --git a/tests/lib/mocha-2.1.0/lib/browser/debug.js b/tests/lib/mocha-2.2.5/lib/browser/debug.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/browser/debug.js rename to tests/lib/mocha-2.2.5/lib/browser/debug.js diff --git a/tests/lib/mocha-2.1.0/lib/browser/escape-string-regexp.js b/tests/lib/mocha-2.2.5/lib/browser/escape-string-regexp.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/browser/escape-string-regexp.js rename to tests/lib/mocha-2.2.5/lib/browser/escape-string-regexp.js diff --git a/tests/lib/mocha-2.1.0/lib/browser/events.js b/tests/lib/mocha-2.2.5/lib/browser/events.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/browser/events.js rename to tests/lib/mocha-2.2.5/lib/browser/events.js diff --git a/tests/lib/mocha-2.1.0/lib/browser/fs.js b/tests/lib/mocha-2.2.5/lib/browser/fs.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/browser/fs.js rename to tests/lib/mocha-2.2.5/lib/browser/fs.js diff --git a/tests/lib/mocha-2.1.0/lib/browser/glob.js b/tests/lib/mocha-2.2.5/lib/browser/glob.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/browser/glob.js rename to tests/lib/mocha-2.2.5/lib/browser/glob.js diff --git a/tests/lib/mocha-2.1.0/lib/browser/path.js b/tests/lib/mocha-2.2.5/lib/browser/path.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/browser/path.js rename to tests/lib/mocha-2.2.5/lib/browser/path.js diff --git a/tests/lib/mocha-2.1.0/lib/browser/progress.js b/tests/lib/mocha-2.2.5/lib/browser/progress.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/browser/progress.js rename to tests/lib/mocha-2.2.5/lib/browser/progress.js diff --git a/tests/lib/mocha-2.1.0/lib/browser/tty.js b/tests/lib/mocha-2.2.5/lib/browser/tty.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/browser/tty.js rename to tests/lib/mocha-2.2.5/lib/browser/tty.js diff --git a/tests/lib/mocha-2.1.0/lib/context.js b/tests/lib/mocha-2.2.5/lib/context.js old mode 100644 new mode 100755 similarity index 89% rename from tests/lib/mocha-2.1.0/lib/context.js rename to tests/lib/mocha-2.2.5/lib/context.js index c983b6eb6a17a40e9fc821d80ecd7c6eaca0bfde..3885218db9c70d4d682631980661765a0e730dda --- a/tests/lib/mocha-2.1.0/lib/context.js +++ b/tests/lib/mocha-2.2.5/lib/context.js @@ -67,6 +67,18 @@ Context.prototype.slow = function(ms){ return this; }; +/** + * Mark a test as skipped. + * + * @return {Context} self + * @api private + */ + +Context.prototype.skip = function(){ + this.runnable().skip(); + return this; +}; + /** * Inspect the context void of `._runnable`. * diff --git a/tests/lib/mocha-2.1.0/lib/hook.js b/tests/lib/mocha-2.2.5/lib/hook.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/hook.js rename to tests/lib/mocha-2.2.5/lib/hook.js diff --git a/tests/lib/mocha-2.1.0/lib/interfaces/bdd.js b/tests/lib/mocha-2.2.5/lib/interfaces/bdd.js old mode 100644 new mode 100755 similarity index 80% rename from tests/lib/mocha-2.1.0/lib/interfaces/bdd.js rename to tests/lib/mocha-2.2.5/lib/interfaces/bdd.js index d212da29fa0d53e61ff3536ba67e94197114d448..f9f08a3ed0e2afce6605ffe7ce58bb4051b9e8df --- a/tests/lib/mocha-2.1.0/lib/interfaces/bdd.js +++ b/tests/lib/mocha-2.2.5/lib/interfaces/bdd.js @@ -29,38 +29,13 @@ module.exports = function(suite){ suite.on('pre-require', function(context, file, mocha){ - /** - * Execute before running tests. - */ - - context.before = function(name, fn){ - suites[0].beforeAll(name, fn); - }; - - /** - * Execute after running tests. - */ - - context.after = function(name, fn){ - suites[0].afterAll(name, fn); - }; - - /** - * Execute before each test case. - */ - - context.beforeEach = function(name, fn){ - suites[0].beforeEach(name, fn); - }; - - /** - * Execute after each test case. - */ - - context.afterEach = function(name, fn){ - suites[0].afterEach(name, fn); - }; + var common = require('./common')(suites, context); + context.before = common.before; + context.after = common.after; + context.beforeEach = common.beforeEach; + context.afterEach = common.afterEach; + context.run = mocha.options.delay && common.runWithSuite(suite); /** * Describe a "suite" with the given `title` * and callback `fn` containing nested suites @@ -135,5 +110,6 @@ module.exports = function(suite){ context.it.skip = function(title){ context.it(title); }; + }); }; diff --git a/tests/lib/mocha-2.2.5/lib/interfaces/common.js b/tests/lib/mocha-2.2.5/lib/interfaces/common.js new file mode 100755 index 0000000000000000000000000000000000000000..1ccd3390f72c60c35af327c73c4042c3cb786c01 --- /dev/null +++ b/tests/lib/mocha-2.2.5/lib/interfaces/common.js @@ -0,0 +1,58 @@ +/** + * Functions common to more than one interface + * @module lib/interfaces/common + */ + +'use strict'; + +module.exports = function (suites, context) { + + return { + /** + * This is only present if flag --delay is passed into Mocha. It triggers + * root suite execution. Returns a function which runs the root suite. + */ + runWithSuite: function runWithSuite(suite) { + return function run() { + suite.run(); + }; + }, + + /** + * Execute before running tests. + */ + before: function (name, fn) { + suites[0].beforeAll(name, fn); + }, + + /** + * Execute after running tests. + */ + after: function (name, fn) { + suites[0].afterAll(name, fn); + }, + + /** + * Execute before each test case. + */ + beforeEach: function (name, fn) { + suites[0].beforeEach(name, fn); + }, + + /** + * Execute after each test case. + */ + afterEach: function (name, fn) { + suites[0].afterEach(name, fn); + }, + + test: { + /** + * Pending test case. + */ + skip: function (title) { + context.test(title); + } + } + } +}; diff --git a/tests/lib/mocha-2.1.0/lib/interfaces/exports.js b/tests/lib/mocha-2.2.5/lib/interfaces/exports.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/interfaces/exports.js rename to tests/lib/mocha-2.2.5/lib/interfaces/exports.js diff --git a/tests/lib/mocha-2.1.0/lib/interfaces/index.js b/tests/lib/mocha-2.2.5/lib/interfaces/index.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/interfaces/index.js rename to tests/lib/mocha-2.2.5/lib/interfaces/index.js diff --git a/tests/lib/mocha-2.1.0/lib/interfaces/qunit.js b/tests/lib/mocha-2.2.5/lib/interfaces/qunit.js old mode 100644 new mode 100755 similarity index 72% rename from tests/lib/mocha-2.1.0/lib/interfaces/qunit.js rename to tests/lib/mocha-2.2.5/lib/interfaces/qunit.js index fee8ac4499103be841856ea6cc216c6fd5060b77..6668967ca3fb88f415b8fc9f32d9b5c0fe79968b --- a/tests/lib/mocha-2.1.0/lib/interfaces/qunit.js +++ b/tests/lib/mocha-2.2.5/lib/interfaces/qunit.js @@ -37,38 +37,13 @@ module.exports = function(suite){ suite.on('pre-require', function(context, file, mocha){ - /** - * Execute before running tests. - */ - - context.before = function(name, fn){ - suites[0].beforeAll(name, fn); - }; - - /** - * Execute after running tests. - */ - - context.after = function(name, fn){ - suites[0].afterAll(name, fn); - }; - - /** - * Execute before each test case. - */ - - context.beforeEach = function(name, fn){ - suites[0].beforeEach(name, fn); - }; - - /** - * Execute after each test case. - */ - - context.afterEach = function(name, fn){ - suites[0].afterEach(name, fn); - }; + var common = require('./common')(suites, context); + context.before = common.before; + context.after = common.after; + context.beforeEach = common.beforeEach; + context.afterEach = common.afterEach; + context.run = mocha.options.delay && common.runWithSuite(suite); /** * Describe a "suite" with the given `title`. */ @@ -113,12 +88,7 @@ module.exports = function(suite){ mocha.grep(new RegExp(reString)); }; - /** - * Pending test case. - */ + context.test.skip = common.test.skip; - context.test.skip = function(title){ - context.test(title); - }; }); }; diff --git a/tests/lib/mocha-2.1.0/lib/interfaces/tdd.js b/tests/lib/mocha-2.2.5/lib/interfaces/tdd.js old mode 100644 new mode 100755 similarity index 75% rename from tests/lib/mocha-2.1.0/lib/interfaces/tdd.js rename to tests/lib/mocha-2.2.5/lib/interfaces/tdd.js index 951fc9e1acaa0b349845b662346c4d7ce45f8a02..13bc2a33be11c71d4180c416fdf8682df238769e --- a/tests/lib/mocha-2.1.0/lib/interfaces/tdd.js +++ b/tests/lib/mocha-2.2.5/lib/interfaces/tdd.js @@ -37,38 +37,13 @@ module.exports = function(suite){ suite.on('pre-require', function(context, file, mocha){ - /** - * Execute before each test case. - */ - - context.setup = function(name, fn){ - suites[0].beforeEach(name, fn); - }; - - /** - * Execute after each test case. - */ - - context.teardown = function(name, fn){ - suites[0].afterEach(name, fn); - }; - - /** - * Execute before the suite. - */ - - context.suiteSetup = function(name, fn){ - suites[0].beforeAll(name, fn); - }; - - /** - * Execute after the suite. - */ - - context.suiteTeardown = function(name, fn){ - suites[0].afterAll(name, fn); - }; + var common = require('./common')(suites, context); + context.setup = common.beforeEach; + context.teardown = common.afterEach; + context.suiteSetup = common.before; + context.suiteTeardown = common.after; + context.run = mocha.options.delay && common.runWithSuite(suite); /** * Describe a "suite" with the given `title` * and callback `fn` containing nested suites @@ -129,12 +104,6 @@ module.exports = function(suite){ mocha.grep(new RegExp(reString)); }; - /** - * Pending test case. - */ - - context.test.skip = function(title){ - context.test(title); - }; + context.test.skip = common.test.skip; }); }; diff --git a/tests/lib/mocha-2.1.0/lib/mocha.js b/tests/lib/mocha-2.2.5/lib/mocha.js old mode 100644 new mode 100755 similarity index 90% rename from tests/lib/mocha-2.1.0/lib/mocha.js rename to tests/lib/mocha-2.2.5/lib/mocha.js index 27b45021dfb749fe2a4417315babc85d0db8e4b9..8a11124cb183f471dbad0017ebb1d1aa8b9c0df3 --- a/tests/lib/mocha-2.1.0/lib/mocha.js +++ b/tests/lib/mocha-2.2.5/lib/mocha.js @@ -66,6 +66,7 @@ function image(name) { * - `bail` bail on the first test failure * - `slow` milliseconds to wait before considering a test slow * - `ignoreLeaks` ignore global leaks + * - `fullTrace` display the full stack-trace on failing * - `grep` string or regexp to filter tests with * * @param {Object} options @@ -76,13 +77,14 @@ function Mocha(options) { options = options || {}; this.files = []; this.options = options; - this.grep(options.grep); + if (options.grep) this.grep(new RegExp(options.grep)); + if (options.fgrep) this.grep(options.fgrep); this.suite = new exports.Suite('', new exports.Context); this.ui(options.ui); this.bail(options.bail); this.reporter(options.reporter, options.reporterOptions); if (null != options.timeout) this.timeout(options.timeout); - this.useColors(options.useColors) + this.useColors(options.useColors); if (options.enableTimeouts !== null) this.enableTimeouts(options.enableTimeouts); if (options.slow) this.slow(options.slow); @@ -99,6 +101,7 @@ function Mocha(options) { exports.suite = context.suite || context.describe; exports.teardown = context.teardown || context.afterEach; exports.test = context.test || context.it; + exports.run = context.run; }); } @@ -140,8 +143,12 @@ Mocha.prototype.reporter = function(reporter, reporterOptions){ } else { reporter = reporter || 'spec'; var _reporter; - try { _reporter = require('./reporters/' + reporter); } catch (err) {}; - if (!_reporter) try { _reporter = require(reporter); } catch (err) {}; + try { _reporter = require('./reporters/' + reporter); } catch (err) {} + if (!_reporter) try { _reporter = require(reporter); } catch (err) { + err.message.indexOf('Cannot find module') !== -1 + ? console.warn('"' + reporter + '" reporter not found') + : console.warn('"' + reporter + '" reporter blew up with error:\n' + err.stack); + } if (!_reporter && reporter === 'teamcity') console.warn('The Teamcity reporter was moved to a package named ' + 'mocha-teamcity-reporter ' + @@ -163,7 +170,7 @@ Mocha.prototype.reporter = function(reporter, reporterOptions){ Mocha.prototype.ui = function(name){ name = name || 'bdd'; this._ui = exports.interfaces[name]; - if (!this._ui) try { this._ui = require(name); } catch (err) {}; + if (!this._ui) try { this._ui = require(name); } catch (err) {} if (!this._ui) throw new Error('invalid interface "' + name + '"'); this._ui = this._ui(this.suite); return this; @@ -264,6 +271,18 @@ Mocha.prototype.checkLeaks = function(){ return this; }; +/** + * Display long stack-trace on failing + * + * @return {Mocha} + * @api public + */ + +Mocha.prototype.fullTrace = function() { + this.options.fullStackTrace = true; + return this; +}; + /** * Enable growl support. * @@ -382,6 +401,16 @@ Mocha.prototype.noHighlighting = function() { return this; }; +/** + * Delay root suite execution. + * @returns {Mocha} + * @api public + */ +Mocha.prototype.delay = function delay() { + this.options.delay = true; + return this; +}; + /** * Run tests and invoke `fn()` when complete. * @@ -389,15 +418,15 @@ Mocha.prototype.noHighlighting = function() { * @return {Runner} * @api public */ - Mocha.prototype.run = function(fn){ if (this.files.length) this.loadFiles(); var suite = this.suite; var options = this.options; options.files = this.files; - var runner = new exports.Runner(suite); + var runner = new exports.Runner(suite, options.delay); var reporter = new this._reporter(runner, options); runner.ignoreLeaks = false !== options.ignoreLeaks; + runner.fullStackTrace = options.fullStackTrace; runner.asyncOnly = options.asyncOnly; if (options.grep) runner.grep(options.grep, options.invert); if (options.globals) runner.globals(options.globals); @@ -410,9 +439,7 @@ Mocha.prototype.run = function(fn){ function done(failures) { if (reporter.done) { reporter.done(failures, fn); - } else { - fn(failures); - } + } else fn && fn(failures); } return runner.run(done); diff --git a/tests/lib/mocha-2.1.0/lib/ms.js b/tests/lib/mocha-2.2.5/lib/ms.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/ms.js rename to tests/lib/mocha-2.2.5/lib/ms.js diff --git a/tests/lib/mocha-2.2.5/lib/pending.js b/tests/lib/mocha-2.2.5/lib/pending.js new file mode 100755 index 0000000000000000000000000000000000000000..265ec73c18f3f8d8bb15828a768a970b63ee330c --- /dev/null +++ b/tests/lib/mocha-2.2.5/lib/pending.js @@ -0,0 +1,16 @@ + +/** + * Expose `Pending`. + */ + +module.exports = Pending; + +/** + * Initialize a new `Pending` error with the given message. + * + * @param {String} message + */ + +function Pending(message) { + this.message = message; +} diff --git a/tests/lib/mocha-2.1.0/lib/reporters/base.js b/tests/lib/mocha-2.2.5/lib/reporters/base.js old mode 100644 new mode 100755 similarity index 91% rename from tests/lib/mocha-2.1.0/lib/reporters/base.js rename to tests/lib/mocha-2.2.5/lib/reporters/base.js index 97b12ba5c5e82ce91aa6d37063686d2a15e9ba75..9b719a80e7da0b3189c2faa614d61875e2b267fe --- a/tests/lib/mocha-2.1.0/lib/reporters/base.js +++ b/tests/lib/mocha-2.2.5/lib/reporters/base.js @@ -5,7 +5,8 @@ var tty = require('tty') , diff = require('diff') , ms = require('../ms') - , utils = require('../utils'); + , utils = require('../utils') + , supportsColor = process.env ? require('supports-color') : null; /** * Save timer references to avoid Sinon interfering (see GH-237). @@ -30,10 +31,12 @@ var isatty = tty.isatty(1) && tty.isatty(2); exports = module.exports = Base; /** - * Enable coloring by default. + * Enable coloring by default, except in the browser interface. */ -exports.useColors = isatty || (process.env.MOCHA_COLORS !== undefined); +exports.useColors = process.env + ? (supportsColor || (process.env.MOCHA_COLORS !== undefined)) + : false; /** * Inline diffs instead of +/- @@ -63,8 +66,8 @@ exports.colors = { , 'green': 32 , 'light': 90 , 'diff gutter': 90 - , 'diff added': 42 - , 'diff removed': 41 + , 'diff added': 32 + , 'diff removed': 31 }; /** @@ -165,22 +168,29 @@ exports.list = function(failures){ var err = test.err , message = err.message || '' , stack = err.stack || message - , index = stack.indexOf(message) + message.length - , msg = stack.slice(0, index) + , index = stack.indexOf(message) , actual = err.actual , expected = err.expected , escape = true; + if (index === -1) { + msg = message; + } else { + index += message.length; + msg = stack.slice(0, index); + // remove msg from stack + stack = stack.slice(index + 1); + } // uncaught if (err.uncaught) { msg = 'Uncaught ' + msg; } - // explicitly show diff - if (err.showDiff && sameType(actual, expected)) { + if (err.showDiff !== false && sameType(actual, expected) + && expected !== undefined) { - if ('string' !== typeof actual) { - escape = false; + escape = false; + if (!(utils.isString(actual) && utils.isString(expected))) { err.actual = actual = utils.stringify(actual); err.expected = expected = utils.stringify(expected); } @@ -196,9 +206,8 @@ exports.list = function(failures){ } } - // indent stack trace without msg - stack = stack.slice(index ? index + 1 : index) - .replace(/^/gm, ' '); + // indent stack trace + stack = stack.replace(/^/gm, ' '); console.log(fmt, (i + 1), test.fullTitle(), msg, stack); }); @@ -386,7 +395,7 @@ function unifiedDiff(err, escape) { function notBlank(line) { return line != null; } - msg = diff.createPatch('string', err.actual, err.expected); + var msg = diff.createPatch('string', err.actual, err.expected); var lines = msg.split('\n').splice(4); return '\n ' + colorLines('diff added', '+ expected') + ' ' diff --git a/tests/lib/mocha-2.1.0/lib/reporters/doc.js b/tests/lib/mocha-2.2.5/lib/reporters/doc.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/doc.js rename to tests/lib/mocha-2.2.5/lib/reporters/doc.js diff --git a/tests/lib/mocha-2.1.0/lib/reporters/dot.js b/tests/lib/mocha-2.2.5/lib/reporters/dot.js old mode 100644 new mode 100755 similarity index 97% rename from tests/lib/mocha-2.1.0/lib/reporters/dot.js rename to tests/lib/mocha-2.2.5/lib/reporters/dot.js index 3c7445760df5511589fafd7cf2a7bca501938124..42a45ee2b5a27c3aa25934c62981ba9d1ef711ab --- a/tests/lib/mocha-2.1.0/lib/reporters/dot.js +++ b/tests/lib/mocha-2.2.5/lib/reporters/dot.js @@ -27,7 +27,7 @@ function Dot(runner) { , n = -1; runner.on('start', function(){ - process.stdout.write('\n '); + process.stdout.write('\n'); }); runner.on('pending', function(test){ diff --git a/tests/lib/mocha-2.1.0/lib/reporters/html-cov.js b/tests/lib/mocha-2.2.5/lib/reporters/html-cov.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/html-cov.js rename to tests/lib/mocha-2.2.5/lib/reporters/html-cov.js diff --git a/tests/lib/mocha-2.1.0/lib/reporters/html.js b/tests/lib/mocha-2.2.5/lib/reporters/html.js old mode 100644 new mode 100755 similarity index 98% rename from tests/lib/mocha-2.1.0/lib/reporters/html.js rename to tests/lib/mocha-2.2.5/lib/reporters/html.js index 31ec106106509d3cd81e036b12040e7e41f29313..aec2af0d392c78c32caced6305e384fe9d83ce4f --- a/tests/lib/mocha-2.1.0/lib/reporters/html.js +++ b/tests/lib/mocha-2.2.5/lib/reporters/html.js @@ -183,6 +183,12 @@ function HTML(runner) { */ var makeUrl = function makeUrl(s) { var search = window.location.search; + + // Remove previous grep query parameter if present + if (search) { + search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?'); + } + return window.location.pathname + (search ? search + '&' : '?' ) + 'grep=' + encodeURIComponent(s); }; diff --git a/tests/lib/mocha-2.1.0/lib/reporters/index.js b/tests/lib/mocha-2.2.5/lib/reporters/index.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/index.js rename to tests/lib/mocha-2.2.5/lib/reporters/index.js diff --git a/tests/lib/mocha-2.1.0/lib/reporters/json-cov.js b/tests/lib/mocha-2.2.5/lib/reporters/json-cov.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/json-cov.js rename to tests/lib/mocha-2.2.5/lib/reporters/json-cov.js diff --git a/tests/lib/mocha-2.1.0/lib/reporters/json-stream.js b/tests/lib/mocha-2.2.5/lib/reporters/json-stream.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/json-stream.js rename to tests/lib/mocha-2.2.5/lib/reporters/json-stream.js diff --git a/tests/lib/mocha-2.1.0/lib/reporters/json.js b/tests/lib/mocha-2.2.5/lib/reporters/json.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/json.js rename to tests/lib/mocha-2.2.5/lib/reporters/json.js diff --git a/tests/lib/mocha-2.1.0/lib/reporters/landing.js b/tests/lib/mocha-2.2.5/lib/reporters/landing.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/landing.js rename to tests/lib/mocha-2.2.5/lib/reporters/landing.js diff --git a/tests/lib/mocha-2.1.0/lib/reporters/list.js b/tests/lib/mocha-2.2.5/lib/reporters/list.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/list.js rename to tests/lib/mocha-2.2.5/lib/reporters/list.js diff --git a/tests/lib/mocha-2.1.0/lib/reporters/markdown.js b/tests/lib/mocha-2.2.5/lib/reporters/markdown.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/markdown.js rename to tests/lib/mocha-2.2.5/lib/reporters/markdown.js diff --git a/tests/lib/mocha-2.1.0/lib/reporters/min.js b/tests/lib/mocha-2.2.5/lib/reporters/min.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/min.js rename to tests/lib/mocha-2.2.5/lib/reporters/min.js diff --git a/tests/lib/mocha-2.1.0/lib/reporters/nyan.js b/tests/lib/mocha-2.2.5/lib/reporters/nyan.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/nyan.js rename to tests/lib/mocha-2.2.5/lib/reporters/nyan.js diff --git a/tests/lib/mocha-2.1.0/lib/reporters/progress.js b/tests/lib/mocha-2.2.5/lib/reporters/progress.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/progress.js rename to tests/lib/mocha-2.2.5/lib/reporters/progress.js diff --git a/tests/lib/mocha-2.1.0/lib/reporters/spec.js b/tests/lib/mocha-2.2.5/lib/reporters/spec.js old mode 100644 new mode 100755 similarity index 93% rename from tests/lib/mocha-2.1.0/lib/reporters/spec.js rename to tests/lib/mocha-2.2.5/lib/reporters/spec.js index e74f4ace7cada99002289d2e8bcc92eced258fbd..3debffe26f9eb8e3032d97b7fb9d8084a97936b5 --- a/tests/lib/mocha-2.1.0/lib/reporters/spec.js +++ b/tests/lib/mocha-2.2.5/lib/reporters/spec.js @@ -54,14 +54,14 @@ function Spec(runner) { if ('fast' == test.speed) { var fmt = indent() + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s '); + + color('pass', ' %s'); cursor.CR(); console.log(fmt, test.title); } else { var fmt = indent() + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s ') - + color(test.speed, '(%dms)'); + + color('pass', ' %s') + + color(test.speed, ' (%dms)'); cursor.CR(); console.log(fmt, test.title, test.duration); } diff --git a/tests/lib/mocha-2.1.0/lib/reporters/tap.js b/tests/lib/mocha-2.2.5/lib/reporters/tap.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/tap.js rename to tests/lib/mocha-2.2.5/lib/reporters/tap.js diff --git a/tests/lib/mocha-2.1.0/lib/reporters/templates/coverage.jade b/tests/lib/mocha-2.2.5/lib/reporters/templates/coverage.jade old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/templates/coverage.jade rename to tests/lib/mocha-2.2.5/lib/reporters/templates/coverage.jade diff --git a/tests/lib/mocha-2.1.0/lib/reporters/templates/menu.jade b/tests/lib/mocha-2.2.5/lib/reporters/templates/menu.jade old mode 100644 new mode 100755 similarity index 86% rename from tests/lib/mocha-2.1.0/lib/reporters/templates/menu.jade rename to tests/lib/mocha-2.2.5/lib/reporters/templates/menu.jade index e9ba4648a63a0d84649effe5a0bc8667d69d93f3..c682e3f0eea47cb351b0abd6fd875a73012d13b9 --- a/tests/lib/mocha-2.1.0/lib/reporters/templates/menu.jade +++ b/tests/lib/mocha-2.2.5/lib/reporters/templates/menu.jade @@ -10,4 +10,4 @@ if segments.length span.dirname= segments.join('/') + '/' span.basename= basename - a#logo(href='http://visionmedia.github.io/mocha/') m + a#logo(href='http://mochajs.org/') m diff --git a/tests/lib/mocha-2.1.0/lib/reporters/templates/script.html b/tests/lib/mocha-2.2.5/lib/reporters/templates/script.html old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/templates/script.html rename to tests/lib/mocha-2.2.5/lib/reporters/templates/script.html diff --git a/tests/lib/mocha-2.1.0/lib/reporters/templates/style.html b/tests/lib/mocha-2.2.5/lib/reporters/templates/style.html old mode 100644 new mode 100755 similarity index 99% rename from tests/lib/mocha-2.1.0/lib/reporters/templates/style.html rename to tests/lib/mocha-2.2.5/lib/reporters/templates/style.html index 4b1f6826c6f5df6d09de9bca67650de03f3d4fb0..4c9c37cfd96ef37291d4e5132ff5c18df711d04d --- a/tests/lib/mocha-2.1.0/lib/reporters/templates/style.html +++ b/tests/lib/mocha-2.2.5/lib/reporters/templates/style.html @@ -8,7 +8,7 @@ body { } #coverage { - padding: 60px; + padding: 60px 400px 60px 60px; } h1 a { @@ -124,6 +124,10 @@ footer span { padding: 15px 0; text-align: right; border-left: 1px solid #eee; + max-width: 400px; + overflow: auto; + white-space: nowrap; + -moz-box-shadow: 0 0 2px #888 , inset 5px 0 20px rgba(0,0,0,.5) , inset 5px 0 3px rgba(0,0,0,.3); diff --git a/tests/lib/mocha-2.1.0/lib/reporters/xunit.js b/tests/lib/mocha-2.2.5/lib/reporters/xunit.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/reporters/xunit.js rename to tests/lib/mocha-2.2.5/lib/reporters/xunit.js diff --git a/tests/lib/mocha-2.1.0/lib/runnable.js b/tests/lib/mocha-2.2.5/lib/runnable.js old mode 100644 new mode 100755 similarity index 91% rename from tests/lib/mocha-2.1.0/lib/runnable.js rename to tests/lib/mocha-2.2.5/lib/runnable.js index cad9dc78b20a61ab7f5950a86160b163be77e315..6e4803fd7ff8fec827036acd914fe8f8c69dc97c --- a/tests/lib/mocha-2.1.0/lib/runnable.js +++ b/tests/lib/mocha-2.2.5/lib/runnable.js @@ -4,6 +4,7 @@ var EventEmitter = require('events').EventEmitter , debug = require('debug')('mocha:runnable') + , Pending = require('./pending') , milliseconds = require('./ms') , utils = require('./utils'); @@ -104,6 +105,16 @@ Runnable.prototype.enableTimeouts = function(enabled){ return this; }; +/** + * Halt and mark as pending. + * + * @api private + */ + +Runnable.prototype.skip = function(){ + throw new Pending(); +}; + /** * Return the full title generated by recursively * concatenating the parent's full title. @@ -156,7 +167,7 @@ Runnable.prototype.resetTimeout = function(){ this.clearTimeout(); this.timer = setTimeout(function(){ if (!self._enableTimeouts) return; - self.callback(new Error('timeout of ' + ms + 'ms exceeded')); + self.callback(new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.')); self.timedOut = true; }, ms); }; @@ -200,10 +211,14 @@ Runnable.prototype.run = function(fn){ var ms = self.timeout(); if (self.timedOut) return; if (finished) return multiple(err || self._trace); + + // Discard the resolution if this test has already failed asynchronously + if (self.state) return; + self.clearTimeout(); self.duration = new Date - start; finished = true; - if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded'); + if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.'); fn(err); } diff --git a/tests/lib/mocha-2.1.0/lib/runner.js b/tests/lib/mocha-2.2.5/lib/runner.js old mode 100644 new mode 100755 similarity index 87% rename from tests/lib/mocha-2.1.0/lib/runner.js rename to tests/lib/mocha-2.2.5/lib/runner.js index ba02d9a53e33d4d70d30ed24b8fcbc77de109077..3199dc921a7f7cd1ef18eac1762ca5942b14a27c --- a/tests/lib/mocha-2.1.0/lib/runner.js +++ b/tests/lib/mocha-2.2.5/lib/runner.js @@ -4,10 +4,14 @@ var EventEmitter = require('events').EventEmitter , debug = require('debug')('mocha:runner') + , Pending = require('./pending') , Test = require('./test') , utils = require('./utils') , filter = utils.filter - , keys = utils.keys; + , keys = utils.keys + , type = utils.type + , stringify = utils.stringify + , stackFilter = utils.stackTraceFilter(); /** * Non-enumerable globals. @@ -47,13 +51,17 @@ module.exports = Runner; * - `fail` (test, err) test failed * - `pending` (test) test pending * + * @param {Suite} suite Root suite + * @param {boolean} [delay] Whether or not to delay execution of root suite + * until ready. * @api public */ -function Runner(suite) { +function Runner(suite, delay) { var self = this; this._globals = []; this._abort = false; + this._delay = delay; this.suite = suite; this.total = suite.total(); this.failures = 0; @@ -190,14 +198,18 @@ Runner.prototype.checkGlobals = function(test){ * @api private */ -Runner.prototype.fail = function(test, err){ +Runner.prototype.fail = function(test, err) { ++this.failures; test.state = 'failed'; - if ('string' == typeof err) { - err = new Error('the string "' + err + '" was thrown, throw an Error :)'); + if (!(err instanceof Error)) { + err = new Error('the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)'); } + err.stack = (this.fullStackTrace || !err.stack) + ? err.stack + : stackFilter(err.stack); + this.emit('fail', test, err); }; @@ -261,10 +273,14 @@ Runner.prototype.hook = function(name, fn){ var testError = hook.error(); if (testError) self.fail(self.test, testError); if (err) { - self.failHook(hook, err); + if (err instanceof Pending) { + suite.pending = true; + } else { + self.failHook(hook, err); - // stop executing hooks, notify callee of hook err - return fn(err); + // stop executing hooks, notify callee of hook err + return fn(err); + } } self.emit('hook end', hook); delete hook.ctx.currentTest; @@ -446,6 +462,11 @@ Runner.prototype.runTests = function(suite, fn){ self.emit('test', self.test = test); self.hookDown('beforeEach', function(err, errSuite){ + if (suite.pending) { + self.emit('pending', test); + self.emit('test end', test); + return next(); + } if (err) return hookErr(err, errSuite, false); self.currentRunnable = self.test; @@ -453,8 +474,17 @@ Runner.prototype.runTests = function(suite, fn){ test = self.test; if (err) { - self.fail(test, err); + if (err instanceof Pending) { + self.emit('pending', test); + } else { + self.fail(test, err); + } self.emit('test end', test); + + if (err instanceof Pending) { + return next(); + } + return self.hookUp('afterEach', next); } @@ -546,12 +576,11 @@ Runner.prototype.uncaught = function(err){ var runnable = this.currentRunnable; if (!runnable) return; - var wasAlreadyDone = runnable.state; - this.fail(runnable, err); - runnable.clearTimeout(); - if (wasAlreadyDone) return; + // Ignore errors if complete + if (runnable.state) return; + this.fail(runnable, err); // recover from test if ('test' == runnable.type) { @@ -574,13 +603,23 @@ Runner.prototype.uncaught = function(err){ */ Runner.prototype.run = function(fn){ - var self = this - , fn = fn || function(){}; + var self = this, + rootSuite = this.suite; + + fn = fn || function(){}; function uncaught(err){ self.uncaught(err); } + function start() { + self.emit('start'); + self.runSuite(rootSuite, function(){ + debug('finished running'); + self.emit('end'); + }); + } + debug('start'); // callback @@ -590,16 +629,19 @@ Runner.prototype.run = function(fn){ fn(self.failures); }); - // run suites - this.emit('start'); - this.runSuite(this.suite, function(){ - debug('finished running'); - self.emit('end'); - }); - // uncaught exception process.on('uncaughtException', uncaught); + if (this._delay) { + // for reporters, I guess. + // might be nice to debounce some dots while we wait. + this.emit('waiting', rootSuite); + rootSuite.once('run', start); + } + else { + start(); + } + return this; }; @@ -655,20 +697,20 @@ function filterLeaks(ok, globals) { * @api private */ - function extraGlobals() { - if (typeof(process) === 'object' && - typeof(process.version) === 'string') { +function extraGlobals() { + if (typeof(process) === 'object' && + typeof(process.version) === 'string') { - var nodeVersion = process.version.split('.').reduce(function(a, v) { - return a << 8 | v; - }); - - // 'errno' was renamed to process._errno in v0.9.11. + var nodeVersion = process.version.split('.').reduce(function(a, v) { + return a << 8 | v; + }); - if (nodeVersion < 0x00090B) { - return ['errno']; - } - } + // 'errno' was renamed to process._errno in v0.9.11. - return []; + if (nodeVersion < 0x00090B) { + return ['errno']; + } } + + return []; +} diff --git a/tests/lib/mocha-2.1.0/lib/suite.js b/tests/lib/mocha-2.2.5/lib/suite.js old mode 100644 new mode 100755 similarity index 97% rename from tests/lib/mocha-2.1.0/lib/suite.js rename to tests/lib/mocha-2.2.5/lib/suite.js index 65cdbffc0e163640904243b0476010daae1578f8..edc820e23a6449440297137f80f32cf26af3743c --- a/tests/lib/mocha-2.1.0/lib/suite.js +++ b/tests/lib/mocha-2.2.5/lib/suite.js @@ -62,6 +62,7 @@ function Suite(title, parentContext) { this._enableTimeouts = true; this._slow = 75; this._bail = false; + this.delayed = false; } /** @@ -343,3 +344,12 @@ Suite.prototype.eachTest = function(fn){ }); return this; }; + +/** + * This will run the root suite if we happen to be running in delayed mode. + */ +Suite.prototype.run = function run() { + if (this.root) { + this.emit('run'); + } +}; diff --git a/tests/lib/mocha-2.1.0/lib/template.html b/tests/lib/mocha-2.2.5/lib/template.html old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/template.html rename to tests/lib/mocha-2.2.5/lib/template.html diff --git a/tests/lib/mocha-2.1.0/lib/test.js b/tests/lib/mocha-2.2.5/lib/test.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/lib/test.js rename to tests/lib/mocha-2.2.5/lib/test.js diff --git a/tests/lib/mocha-2.1.0/lib/utils.js b/tests/lib/mocha-2.2.5/lib/utils.js old mode 100644 new mode 100755 similarity index 67% rename from tests/lib/mocha-2.1.0/lib/utils.js rename to tests/lib/mocha-2.2.5/lib/utils.js index c624375025a843f0da1956d6eb62ee032ee1c880..845f84c25d21e1cab74230ed4571d840b3206cd9 --- a/tests/lib/mocha-2.1.0/lib/utils.js +++ b/tests/lib/mocha-2.2.5/lib/utils.js @@ -46,6 +46,17 @@ exports.forEach = function(arr, fn, scope){ fn.call(scope, arr[i], i); }; +/** + * Test if the given obj is type of string + * + * @param {Object} obj + * @returns Boolean + */ + +exports.isString = function(obj) { + return 'string' === typeof obj; +}; + /** * Array#map (<=IE8) * @@ -58,7 +69,7 @@ exports.forEach = function(arr, fn, scope){ exports.map = function(arr, fn, scope){ var result = []; for (var i = 0, l = arr.length; i < l; i++) - result.push(fn.call(scope, arr[i], i)); + result.push(fn.call(scope, arr[i], i, arr)); return result; }; @@ -127,7 +138,7 @@ exports.filter = function(arr, fn){ exports.keys = Object.keys || function(obj) { var keys = [] - , has = Object.prototype.hasOwnProperty // for `window` on <=IE8 + , has = Object.prototype.hasOwnProperty; // for `window` on <=IE8 for (var key in obj) { if (has.call(obj, key)) { @@ -157,6 +168,28 @@ exports.watch = function(files, fn){ }); }; +/** + * Array.isArray (<=IE8) + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ +var isArray = Array.isArray || function (obj) { + return '[object Array]' == {}.toString.call(obj); +}; + +/** + * @description + * Buffer.prototype.toJSON polyfill + * @type {Function} + */ +if(typeof Buffer !== 'undefined' && Buffer.prototype) { + Buffer.prototype.toJSON = Buffer.prototype.toJSON || function () { + return Array.prototype.slice.call(this, 0); + }; +} + /** * Ignored files. */ @@ -179,15 +212,15 @@ exports.files = function(dir, ext, ret){ var re = new RegExp('\\.(' + ext.join('|') + ')$'); fs.readdirSync(dir) - .filter(ignored) - .forEach(function(path){ - path = join(dir, path); - if (fs.statSync(path).isDirectory()) { - exports.files(path, ext, ret); - } else if (path.match(re)) { - ret.push(path); - } - }); + .filter(ignored) + .forEach(function(path){ + path = join(dir, path); + if (fs.statSync(path).isDirectory()) { + exports.files(path, ext, ret); + } else if (path.match(re)) { + ret.push(path); + } + }); return ret; }; @@ -215,7 +248,7 @@ exports.slug = function(str){ exports.clean = function(str) { str = str .replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, '') - .replace(/^function *\(.*\) *{|\(.*\) *=> *{?/, '') + .replace(/^function *\(.*\)\s*{|\(.*\) *=> *{?/, '') .replace(/\s+\}$/, ''); var spaces = str.match(/^\n?( *)/)[1].length @@ -364,30 +397,97 @@ exports.type = function type(value) { */ exports.stringify = function(value) { - var prop, - type = exports.type(value); - - if (type === 'null' || type === 'undefined') { - return '[' + type + ']'; - } - - if (type === 'date') { - return '[Date: ' + value.toISOString() + ']'; - } + var type = exports.type(value); if (!~exports.indexOf(['object', 'array', 'function'], type)) { - return value.toString(); + if(type != 'buffer') { + return jsonStringify(value); + } + var json = value.toJSON(); + // Based on the toJSON result + return jsonStringify(json.data && json.type ? json.data : json, 2) + .replace(/,(\n|$)/g, '$1'); } - for (prop in value) { - if (value.hasOwnProperty(prop)) { - return JSON.stringify(exports.canonicalize(value), null, 2).replace(/,(\n|$)/g, '$1'); + for (var prop in value) { + if (Object.prototype.hasOwnProperty.call(value, prop)) { + return jsonStringify(exports.canonicalize(value), 2).replace(/,(\n|$)/g, '$1'); } } return emptyRepresentation(value, type); }; +/** + * @description + * like JSON.stringify but more sense. + * @param {Object} object + * @param {Number=} spaces + * @param {number=} depth + * @returns {*} + * @private + */ +function jsonStringify(object, spaces, depth) { + if(typeof spaces == 'undefined') return _stringify(object); // primitive types + + depth = depth || 1; + var space = spaces * depth + , str = isArray(object) ? '[' : '{' + , end = isArray(object) ? ']' : '}' + , length = object.length || exports.keys(object).length + , repeat = function(s, n) { return new Array(n).join(s); }; // `.repeat()` polyfill + + function _stringify(val) { + switch (exports.type(val)) { + case 'null': + case 'undefined': + val = '[' + val + ']'; + break; + case 'array': + case 'object': + val = jsonStringify(val, spaces, depth + 1); + break; + case 'boolean': + case 'regexp': + case 'number': + val = val === 0 && (1/val) === -Infinity // `-0` + ? '-0' + : val.toString(); + break; + case 'date': + var sDate = isNaN(val.getTime()) // Invalid date + ? val.toString() + : val.toISOString(); + val = '[Date: ' + sDate + ']'; + break; + case 'buffer': + var json = val.toJSON(); + // Based on the toJSON result + json = json.data && json.type ? json.data : json; + val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']'; + break; + default: + val = (val == '[Function]' || val == '[Circular]') + ? val + : JSON.stringify(val); //string + } + return val; + } + + for(var i in object) { + if(!object.hasOwnProperty(i)) continue; // not my business + --length; + str += '\n ' + repeat(' ', space) + + (isArray(object) ? '' : '"' + i + '": ') // key + + _stringify(object[i]) // value + + (length ? ',' : ''); // comma + } + + return str + (str.length != 1 // [], {} + ? '\n' + repeat(' ', --space) + end + : end); +} + /** * Return if obj is a Buffer * @param {Object} arg @@ -434,8 +534,6 @@ exports.canonicalize = function(value, stack) { switch(type) { case 'undefined': - canonicalizedObj = '[undefined]'; - break; case 'buffer': case 'null': canonicalizedObj = value; @@ -447,9 +545,6 @@ exports.canonicalize = function(value, stack) { }); }); break; - case 'date': - canonicalizedObj = '[Date: ' + value.toISOString() + ']'; - break; case 'function': for (prop in value) { canonicalizedObj = {}; @@ -468,7 +563,9 @@ exports.canonicalize = function(value, stack) { }); }); break; + case 'date': case 'number': + case 'regexp': case 'boolean': canonicalizedObj = value; break; @@ -504,7 +601,7 @@ exports.lookupFiles = function lookupFiles(path, extensions, recursive) { return; } - fs.readdirSync(path).forEach(function(file){ + fs.readdirSync(path).forEach(function(file) { file = join(path, file); try { var stat = fs.statSync(file); @@ -531,7 +628,7 @@ exports.lookupFiles = function lookupFiles(path, extensions, recursive) { * @return {Error} */ -exports.undefinedError = function(){ +exports.undefinedError = function() { return new Error('Caught undefined error, did you throw without specifying what?'); }; @@ -542,7 +639,72 @@ exports.undefinedError = function(){ * @return {Error} */ -exports.getError = function(err){ +exports.getError = function(err) { return err || exports.undefinedError(); }; + +/** + * @summary + * This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`) + * @description + * When invoking this function you get a filter function that get the Error.stack as an input, + * and return a prettify output. + * (i.e: strip Mocha, node_modules, bower and componentJS from stack trace). + * @returns {Function} + */ + +exports.stackTraceFilter = function() { + var slash = '/' + , is = typeof document === 'undefined' + ? { node: true } + : { browser: true } + , cwd = is.node + ? process.cwd() + slash + : location.href.replace(/\/[^\/]*$/, '/'); + + function isNodeModule (line) { + return (~line.indexOf('node_modules')); + } + + function isMochaInternal (line) { + return (~line.indexOf('node_modules' + slash + 'mocha')) || + (~line.indexOf('components' + slash + 'mochajs')) || + (~line.indexOf('components' + slash + 'mocha')); + } + + // node_modules, bower, componentJS + function isBrowserModule(line) { + return (~line.indexOf('node_modules')) || + (~line.indexOf('components')); + } + + function isNodeInternal (line) { + return (~line.indexOf('(timers.js:')) || + (~line.indexOf('(events.js:')) || + (~line.indexOf('(node.js:')) || + (~line.indexOf('(module.js:')) || + (~line.indexOf('GeneratorFunctionPrototype.next (native)')) || + false + } + + return function(stack) { + stack = stack.split('\n'); + + stack = exports.reduce(stack, function(list, line) { + if (is.node && (isNodeModule(line) || + isMochaInternal(line) || + isNodeInternal(line))) + return list; + + if (is.browser && (isBrowserModule(line))) + return list; + + // Clean up cwd(absolute) + list.push(line.replace(cwd, '')); + return list; + }, []); + + return stack.join('\n'); + } +}; \ No newline at end of file diff --git a/tests/lib/mocha-2.1.0/mocha.css b/tests/lib/mocha-2.2.5/mocha.css old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/mocha.css rename to tests/lib/mocha-2.2.5/mocha.css diff --git a/tests/lib/mocha-2.1.0/mocha.js b/tests/lib/mocha-2.2.5/mocha.js old mode 100644 new mode 100755 similarity index 91% rename from tests/lib/mocha-2.1.0/mocha.js rename to tests/lib/mocha-2.2.5/mocha.js index 22d1a9f324d7515f43bb0f6ed2de1096977de2c2..5ff1385758bf6b6d2fb4ec324a31cce612183091 --- a/tests/lib/mocha-2.1.0/mocha.js +++ b/tests/lib/mocha-2.2.5/mocha.js @@ -851,6 +851,18 @@ Context.prototype.slow = function(ms){ return this; }; +/** + * Mark a test as skipped. + * + * @return {Context} self + * @api private + */ + +Context.prototype.skip = function(){ + this.runnable().skip(); + return this; +}; + /** * Inspect the context void of `._runnable`. * @@ -956,38 +968,13 @@ module.exports = function(suite){ suite.on('pre-require', function(context, file, mocha){ - /** - * Execute before running tests. - */ - - context.before = function(name, fn){ - suites[0].beforeAll(name, fn); - }; - - /** - * Execute after running tests. - */ - - context.after = function(name, fn){ - suites[0].afterAll(name, fn); - }; - - /** - * Execute before each test case. - */ - - context.beforeEach = function(name, fn){ - suites[0].beforeEach(name, fn); - }; - - /** - * Execute after each test case. - */ - - context.afterEach = function(name, fn){ - suites[0].afterEach(name, fn); - }; + var common = require('./common')(suites, context); + context.before = common.before; + context.after = common.after; + context.beforeEach = common.beforeEach; + context.afterEach = common.afterEach; + context.run = mocha.options.delay && common.runWithSuite(suite); /** * Describe a "suite" with the given `title` * and callback `fn` containing nested suites @@ -1062,11 +1049,74 @@ module.exports = function(suite){ context.it.skip = function(title){ context.it(title); }; + }); }; }); // module: interfaces/bdd.js +require.register("interfaces/common.js", function(module, exports, require){ +/** + * Functions common to more than one interface + * @module lib/interfaces/common + */ + +'use strict'; + +module.exports = function (suites, context) { + + return { + /** + * This is only present if flag --delay is passed into Mocha. It triggers + * root suite execution. Returns a function which runs the root suite. + */ + runWithSuite: function runWithSuite(suite) { + return function run() { + suite.run(); + }; + }, + + /** + * Execute before running tests. + */ + before: function (name, fn) { + suites[0].beforeAll(name, fn); + }, + + /** + * Execute after running tests. + */ + after: function (name, fn) { + suites[0].afterAll(name, fn); + }, + + /** + * Execute before each test case. + */ + beforeEach: function (name, fn) { + suites[0].beforeEach(name, fn); + }, + + /** + * Execute after each test case. + */ + afterEach: function (name, fn) { + suites[0].afterEach(name, fn); + }, + + test: { + /** + * Pending test case. + */ + skip: function (title) { + context.test(title); + } + } + } +}; + +}); // module: interfaces/common.js + require.register("interfaces/exports.js", function(module, exports, require){ /** * Module dependencies. @@ -1180,38 +1230,13 @@ module.exports = function(suite){ suite.on('pre-require', function(context, file, mocha){ - /** - * Execute before running tests. - */ - - context.before = function(name, fn){ - suites[0].beforeAll(name, fn); - }; - - /** - * Execute after running tests. - */ - - context.after = function(name, fn){ - suites[0].afterAll(name, fn); - }; - - /** - * Execute before each test case. - */ - - context.beforeEach = function(name, fn){ - suites[0].beforeEach(name, fn); - }; - - /** - * Execute after each test case. - */ - - context.afterEach = function(name, fn){ - suites[0].afterEach(name, fn); - }; + var common = require('./common')(suites, context); + context.before = common.before; + context.after = common.after; + context.beforeEach = common.beforeEach; + context.afterEach = common.afterEach; + context.run = mocha.options.delay && common.runWithSuite(suite); /** * Describe a "suite" with the given `title`. */ @@ -1256,13 +1281,8 @@ module.exports = function(suite){ mocha.grep(new RegExp(reString)); }; - /** - * Pending test case. - */ + context.test.skip = common.test.skip; - context.test.skip = function(title){ - context.test(title); - }; }); }; @@ -1308,38 +1328,13 @@ module.exports = function(suite){ suite.on('pre-require', function(context, file, mocha){ - /** - * Execute before each test case. - */ - - context.setup = function(name, fn){ - suites[0].beforeEach(name, fn); - }; - - /** - * Execute after each test case. - */ - - context.teardown = function(name, fn){ - suites[0].afterEach(name, fn); - }; - - /** - * Execute before the suite. - */ - - context.suiteSetup = function(name, fn){ - suites[0].beforeAll(name, fn); - }; - - /** - * Execute after the suite. - */ - - context.suiteTeardown = function(name, fn){ - suites[0].afterAll(name, fn); - }; + var common = require('./common')(suites, context); + context.setup = common.beforeEach; + context.teardown = common.afterEach; + context.suiteSetup = common.before; + context.suiteTeardown = common.after; + context.run = mocha.options.delay && common.runWithSuite(suite); /** * Describe a "suite" with the given `title` * and callback `fn` containing nested suites @@ -1400,13 +1395,7 @@ module.exports = function(suite){ mocha.grep(new RegExp(reString)); }; - /** - * Pending test case. - */ - - context.test.skip = function(title){ - context.test(title); - }; + context.test.skip = common.test.skip; }); }; @@ -1481,6 +1470,7 @@ function image(name) { * - `bail` bail on the first test failure * - `slow` milliseconds to wait before considering a test slow * - `ignoreLeaks` ignore global leaks + * - `fullTrace` display the full stack-trace on failing * - `grep` string or regexp to filter tests with * * @param {Object} options @@ -1491,13 +1481,14 @@ function Mocha(options) { options = options || {}; this.files = []; this.options = options; - this.grep(options.grep); + if (options.grep) this.grep(new RegExp(options.grep)); + if (options.fgrep) this.grep(options.fgrep); this.suite = new exports.Suite('', new exports.Context); this.ui(options.ui); this.bail(options.bail); this.reporter(options.reporter, options.reporterOptions); if (null != options.timeout) this.timeout(options.timeout); - this.useColors(options.useColors) + this.useColors(options.useColors); if (options.enableTimeouts !== null) this.enableTimeouts(options.enableTimeouts); if (options.slow) this.slow(options.slow); @@ -1514,6 +1505,7 @@ function Mocha(options) { exports.suite = context.suite || context.describe; exports.teardown = context.teardown || context.afterEach; exports.test = context.test || context.it; + exports.run = context.run; }); } @@ -1555,8 +1547,12 @@ Mocha.prototype.reporter = function(reporter, reporterOptions){ } else { reporter = reporter || 'spec'; var _reporter; - try { _reporter = require('./reporters/' + reporter); } catch (err) {}; - if (!_reporter) try { _reporter = require(reporter); } catch (err) {}; + try { _reporter = require('./reporters/' + reporter); } catch (err) {} + if (!_reporter) try { _reporter = require(reporter); } catch (err) { + err.message.indexOf('Cannot find module') !== -1 + ? console.warn('"' + reporter + '" reporter not found') + : console.warn('"' + reporter + '" reporter blew up with error:\n' + err.stack); + } if (!_reporter && reporter === 'teamcity') console.warn('The Teamcity reporter was moved to a package named ' + 'mocha-teamcity-reporter ' + @@ -1578,7 +1574,7 @@ Mocha.prototype.reporter = function(reporter, reporterOptions){ Mocha.prototype.ui = function(name){ name = name || 'bdd'; this._ui = exports.interfaces[name]; - if (!this._ui) try { this._ui = require(name); } catch (err) {}; + if (!this._ui) try { this._ui = require(name); } catch (err) {} if (!this._ui) throw new Error('invalid interface "' + name + '"'); this._ui = this._ui(this.suite); return this; @@ -1679,6 +1675,18 @@ Mocha.prototype.checkLeaks = function(){ return this; }; +/** + * Display long stack-trace on failing + * + * @return {Mocha} + * @api public + */ + +Mocha.prototype.fullTrace = function() { + this.options.fullStackTrace = true; + return this; +}; + /** * Enable growl support. * @@ -1797,6 +1805,16 @@ Mocha.prototype.noHighlighting = function() { return this; }; +/** + * Delay root suite execution. + * @returns {Mocha} + * @api public + */ +Mocha.prototype.delay = function delay() { + this.options.delay = true; + return this; +}; + /** * Run tests and invoke `fn()` when complete. * @@ -1804,15 +1822,15 @@ Mocha.prototype.noHighlighting = function() { * @return {Runner} * @api public */ - Mocha.prototype.run = function(fn){ if (this.files.length) this.loadFiles(); var suite = this.suite; var options = this.options; options.files = this.files; - var runner = new exports.Runner(suite); + var runner = new exports.Runner(suite, options.delay); var reporter = new this._reporter(runner, options); runner.ignoreLeaks = false !== options.ignoreLeaks; + runner.fullStackTrace = options.fullStackTrace; runner.asyncOnly = options.asyncOnly; if (options.grep) runner.grep(options.grep, options.invert); if (options.globals) runner.globals(options.globals); @@ -1825,9 +1843,7 @@ Mocha.prototype.run = function(fn){ function done(failures) { if (reporter.done) { reporter.done(failures, fn); - } else { - fn(failures); - } + } else fn && fn(failures); } return runner.run(done); @@ -1948,6 +1964,26 @@ function plural(ms, n, name) { }); // module: ms.js +require.register("pending.js", function(module, exports, require){ + +/** + * Expose `Pending`. + */ + +module.exports = Pending; + +/** + * Initialize a new `Pending` error with the given message. + * + * @param {String} message + */ + +function Pending(message) { + this.message = message; +} + +}); // module: pending.js + require.register("reporters/base.js", function(module, exports, require){ /** * Module dependencies. @@ -1956,7 +1992,8 @@ require.register("reporters/base.js", function(module, exports, require){ var tty = require('browser/tty') , diff = require('browser/diff') , ms = require('../ms') - , utils = require('../utils'); + , utils = require('../utils') + , supportsColor = process.env ? require('supports-color') : null; /** * Save timer references to avoid Sinon interfering (see GH-237). @@ -1981,10 +2018,12 @@ var isatty = tty.isatty(1) && tty.isatty(2); exports = module.exports = Base; /** - * Enable coloring by default. + * Enable coloring by default, except in the browser interface. */ -exports.useColors = isatty || (process.env.MOCHA_COLORS !== undefined); +exports.useColors = process.env + ? (supportsColor || (process.env.MOCHA_COLORS !== undefined)) + : false; /** * Inline diffs instead of +/- @@ -2116,19 +2155,26 @@ exports.list = function(failures){ var err = test.err , message = err.message || '' , stack = err.stack || message - , index = stack.indexOf(message) + message.length - , msg = stack.slice(0, index) + , index = stack.indexOf(message) , actual = err.actual , expected = err.expected , escape = true; + if (index === -1) { + msg = message; + } else { + index += message.length; + msg = stack.slice(0, index); + // remove msg from stack + stack = stack.slice(index + 1); + } // uncaught if (err.uncaught) { msg = 'Uncaught ' + msg; } - // explicitly show diff - if (err.showDiff && sameType(actual, expected)) { + if (err.showDiff !== false && sameType(actual, expected) + && expected !== undefined) { if ('string' !== typeof actual) { escape = false; @@ -2147,9 +2193,8 @@ exports.list = function(failures){ } } - // indent stack trace without msg - stack = stack.slice(index ? index + 1 : index) - .replace(/^/gm, ' '); + // indent stack trace + stack = stack.replace(/^/gm, ' '); console.log(fmt, (i + 1), test.fullTitle(), msg, stack); }); @@ -2337,7 +2382,7 @@ function unifiedDiff(err, escape) { function notBlank(line) { return line != null; } - msg = diff.createPatch('string', err.actual, err.expected); + var msg = diff.createPatch('string', err.actual, err.expected); var lines = msg.split('\n').splice(4); return '\n ' + colorLines('diff added', '+ expected') + ' ' @@ -2505,7 +2550,7 @@ function Dot(runner) { , n = -1; runner.on('start', function(){ - process.stdout.write('\n '); + process.stdout.write('\n'); }); runner.on('pending', function(test){ @@ -2785,6 +2830,12 @@ function HTML(runner) { */ var makeUrl = function makeUrl(s) { var search = window.location.search; + + // Remove previous grep query parameter if present + if (search) { + search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?'); + } + return window.location.pathname + (search ? search + '&' : '?' ) + 'grep=' + encodeURIComponent(s); }; @@ -3972,14 +4023,14 @@ function Spec(runner) { if ('fast' == test.speed) { var fmt = indent() + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s '); + + color('pass', ' %s'); cursor.CR(); console.log(fmt, test.title); } else { var fmt = indent() + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s ') - + color(test.speed, '(%dms)'); + + color('pass', ' %s') + + color(test.speed, ' (%dms)'); cursor.CR(); console.log(fmt, test.title, test.duration); } @@ -4245,6 +4296,7 @@ require.register("runnable.js", function(module, exports, require){ var EventEmitter = require('browser/events').EventEmitter , debug = require('browser/debug')('mocha:runnable') + , Pending = require('./pending') , milliseconds = require('./ms') , utils = require('./utils'); @@ -4349,6 +4401,16 @@ Runnable.prototype.enableTimeouts = function(enabled){ return this; }; +/** + * Halt and mark as pending. + * + * @api private + */ + +Runnable.prototype.skip = function(){ + throw new Pending(); +}; + /** * Return the full title generated by recursively * concatenating the parent's full title. @@ -4401,7 +4463,7 @@ Runnable.prototype.resetTimeout = function(){ this.clearTimeout(); this.timer = setTimeout(function(){ if (!self._enableTimeouts) return; - self.callback(new Error('timeout of ' + ms + 'ms exceeded')); + self.callback(new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.')); self.timedOut = true; }, ms); }; @@ -4445,10 +4507,14 @@ Runnable.prototype.run = function(fn){ var ms = self.timeout(); if (self.timedOut) return; if (finished) return multiple(err || self._trace); + + // Discard the resolution if this test has already failed asynchronously + if (self.state) return; + self.clearTimeout(); self.duration = new Date - start; finished = true; - if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded'); + if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.'); fn(err); } @@ -4518,10 +4584,14 @@ require.register("runner.js", function(module, exports, require){ var EventEmitter = require('browser/events').EventEmitter , debug = require('browser/debug')('mocha:runner') + , Pending = require('./pending') , Test = require('./test') , utils = require('./utils') , filter = utils.filter - , keys = utils.keys; + , keys = utils.keys + , type = utils.type + , stringify = utils.stringify + , stackFilter = utils.stackTraceFilter(); /** * Non-enumerable globals. @@ -4561,13 +4631,17 @@ module.exports = Runner; * - `fail` (test, err) test failed * - `pending` (test) test pending * + * @param {Suite} suite Root suite + * @param {boolean} [delay] Whether or not to delay execution of root suite + * until ready. * @api public */ -function Runner(suite) { +function Runner(suite, delay) { var self = this; this._globals = []; this._abort = false; + this._delay = delay; this.suite = suite; this.total = suite.total(); this.failures = 0; @@ -4708,14 +4782,18 @@ Runner.prototype.checkGlobals = function(test){ * @api private */ -Runner.prototype.fail = function(test, err){ +Runner.prototype.fail = function(test, err) { ++this.failures; test.state = 'failed'; - if ('string' == typeof err) { - err = new Error('the string "' + err + '" was thrown, throw an Error :)'); + if (!(err instanceof Error)) { + err = new Error('the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)'); } + err.stack = (this.fullStackTrace || !err.stack) + ? err.stack + : stackFilter(err.stack); + this.emit('fail', test, err); }; @@ -4779,10 +4857,14 @@ Runner.prototype.hook = function(name, fn){ var testError = hook.error(); if (testError) self.fail(self.test, testError); if (err) { - self.failHook(hook, err); + if (err instanceof Pending) { + suite.pending = true; + } else { + self.failHook(hook, err); - // stop executing hooks, notify callee of hook err - return fn(err); + // stop executing hooks, notify callee of hook err + return fn(err); + } } self.emit('hook end', hook); delete hook.ctx.currentTest; @@ -4964,6 +5046,11 @@ Runner.prototype.runTests = function(suite, fn){ self.emit('test', self.test = test); self.hookDown('beforeEach', function(err, errSuite){ + if (suite.pending) { + self.emit('pending', test); + self.emit('test end', test); + return next(); + } if (err) return hookErr(err, errSuite, false); self.currentRunnable = self.test; @@ -4971,8 +5058,17 @@ Runner.prototype.runTests = function(suite, fn){ test = self.test; if (err) { - self.fail(test, err); + if (err instanceof Pending) { + self.emit('pending', test); + } else { + self.fail(test, err); + } self.emit('test end', test); + + if (err instanceof Pending) { + return next(); + } + return self.hookUp('afterEach', next); } @@ -5064,12 +5160,11 @@ Runner.prototype.uncaught = function(err){ var runnable = this.currentRunnable; if (!runnable) return; - var wasAlreadyDone = runnable.state; - this.fail(runnable, err); - runnable.clearTimeout(); - if (wasAlreadyDone) return; + // Ignore errors if complete + if (runnable.state) return; + this.fail(runnable, err); // recover from test if ('test' == runnable.type) { @@ -5092,13 +5187,23 @@ Runner.prototype.uncaught = function(err){ */ Runner.prototype.run = function(fn){ - var self = this - , fn = fn || function(){}; + var self = this, + rootSuite = this.suite; + + fn = fn || function(){}; function uncaught(err){ self.uncaught(err); } + function start() { + self.emit('start'); + self.runSuite(rootSuite, function(){ + debug('finished running'); + self.emit('end'); + }); + } + debug('start'); // callback @@ -5108,16 +5213,19 @@ Runner.prototype.run = function(fn){ fn(self.failures); }); - // run suites - this.emit('start'); - this.runSuite(this.suite, function(){ - debug('finished running'); - self.emit('end'); - }); - // uncaught exception process.on('uncaughtException', uncaught); + if (this._delay) { + // for reporters, I guess. + // might be nice to debounce some dots while we wait. + this.emit('waiting', rootSuite); + rootSuite.once('run', start); + } + else { + start(); + } + return this; }; @@ -5173,24 +5281,24 @@ function filterLeaks(ok, globals) { * @api private */ - function extraGlobals() { - if (typeof(process) === 'object' && - typeof(process.version) === 'string') { - - var nodeVersion = process.version.split('.').reduce(function(a, v) { - return a << 8 | v; - }); +function extraGlobals() { + if (typeof(process) === 'object' && + typeof(process.version) === 'string') { - // 'errno' was renamed to process._errno in v0.9.11. + var nodeVersion = process.version.split('.').reduce(function(a, v) { + return a << 8 | v; + }); - if (nodeVersion < 0x00090B) { - return ['errno']; - } - } + // 'errno' was renamed to process._errno in v0.9.11. - return []; + if (nodeVersion < 0x00090B) { + return ['errno']; + } } + return []; +} + }); // module: runner.js require.register("suite.js", function(module, exports, require){ @@ -5258,6 +5366,7 @@ function Suite(title, parentContext) { this._enableTimeouts = true; this._slow = 75; this._bail = false; + this.delayed = false; } /** @@ -5544,6 +5653,15 @@ Suite.prototype.eachTest = function(fn){ return this; }; +/** + * This will run the root suite if we happen to be running in delayed mode. + */ +Suite.prototype.run = function run() { + if (this.root) { + this.emit('run'); + } +}; + }); // module: suite.js require.register("test.js", function(module, exports, require){ @@ -5646,7 +5764,7 @@ exports.forEach = function(arr, fn, scope){ exports.map = function(arr, fn, scope){ var result = []; for (var i = 0, l = arr.length; i < l; i++) - result.push(fn.call(scope, arr[i], i)); + result.push(fn.call(scope, arr[i], i, arr)); return result; }; @@ -5715,7 +5833,7 @@ exports.filter = function(arr, fn){ exports.keys = Object.keys || function(obj) { var keys = [] - , has = Object.prototype.hasOwnProperty // for `window` on <=IE8 + , has = Object.prototype.hasOwnProperty; // for `window` on <=IE8 for (var key in obj) { if (has.call(obj, key)) { @@ -5745,6 +5863,28 @@ exports.watch = function(files, fn){ }); }; +/** + * Array.isArray (<=IE8) + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ +var isArray = Array.isArray || function (obj) { + return '[object Array]' == {}.toString.call(obj); +}; + +/** + * @description + * Buffer.prototype.toJSON polyfill + * @type {Function} + */ +if(typeof Buffer !== 'undefined' && Buffer.prototype) { + Buffer.prototype.toJSON = Buffer.prototype.toJSON || function () { + return Array.prototype.slice.call(this, 0); + }; +} + /** * Ignored files. */ @@ -5767,15 +5907,15 @@ exports.files = function(dir, ext, ret){ var re = new RegExp('\\.(' + ext.join('|') + ')$'); fs.readdirSync(dir) - .filter(ignored) - .forEach(function(path){ - path = join(dir, path); - if (fs.statSync(path).isDirectory()) { - exports.files(path, ext, ret); - } else if (path.match(re)) { - ret.push(path); - } - }); + .filter(ignored) + .forEach(function(path){ + path = join(dir, path); + if (fs.statSync(path).isDirectory()) { + exports.files(path, ext, ret); + } else if (path.match(re)) { + ret.push(path); + } + }); return ret; }; @@ -5803,7 +5943,7 @@ exports.slug = function(str){ exports.clean = function(str) { str = str .replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, '') - .replace(/^function *\(.*\) *{|\(.*\) *=> *{?/, '') + .replace(/^function *\(.*\)\s*{|\(.*\) *=> *{?/, '') .replace(/\s+\}$/, ''); var spaces = str.match(/^\n?( *)/)[1].length @@ -5952,30 +6092,94 @@ exports.type = function type(value) { */ exports.stringify = function(value) { - var prop, - type = exports.type(value); - - if (type === 'null' || type === 'undefined') { - return '[' + type + ']'; - } - - if (type === 'date') { - return '[Date: ' + value.toISOString() + ']'; - } + var type = exports.type(value); if (!~exports.indexOf(['object', 'array', 'function'], type)) { - return value.toString(); + if(type != 'buffer') { + return jsonStringify(value); + } + var json = value.toJSON(); + // Based on the toJSON result + return jsonStringify(json.data && json.type ? json.data : json, 2) + .replace(/,(\n|$)/g, '$1'); } - for (prop in value) { - if (value.hasOwnProperty(prop)) { - return JSON.stringify(exports.canonicalize(value), null, 2).replace(/,(\n|$)/g, '$1'); + for (var prop in value) { + if (Object.prototype.hasOwnProperty.call(value, prop)) { + return jsonStringify(exports.canonicalize(value), 2).replace(/,(\n|$)/g, '$1'); } } return emptyRepresentation(value, type); }; +/** + * @description + * like JSON.stringify but more sense. + * @param {Object} object + * @param {Number=} spaces + * @param {number=} depth + * @returns {*} + * @private + */ +function jsonStringify(object, spaces, depth) { + if(typeof spaces == 'undefined') return _stringify(object); // primitive types + + depth = depth || 1; + var space = spaces * depth + , str = isArray(object) ? '[' : '{' + , end = isArray(object) ? ']' : '}' + , length = object.length || exports.keys(object).length + , repeat = function(s, n) { return new Array(n).join(s); }; // `.repeat()` polyfill + + function _stringify(val) { + switch (exports.type(val)) { + case 'null': + case 'undefined': + val = '[' + val + ']'; + break; + case 'array': + case 'object': + val = jsonStringify(val, spaces, depth + 1); + break; + case 'boolean': + case 'regexp': + case 'number': + val = val === 0 && (1/val) === -Infinity // `-0` + ? '-0' + : val.toString(); + break; + case 'date': + val = '[Date: ' + val.toISOString() + ']'; + break; + case 'buffer': + var json = val.toJSON(); + // Based on the toJSON result + json = json.data && json.type ? json.data : json; + val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']'; + break; + default: + val = (val == '[Function]' || val == '[Circular]') + ? val + : '"' + val + '"'; //string + } + return val; + } + + for(var i in object) { + if(!object.hasOwnProperty(i)) continue; // not my business + --length; + str += '\n ' + repeat(' ', space) + + (isArray(object) ? '' : '"' + i + '": ') // key + + _stringify(object[i]) // value + + (length ? ',' : ''); // comma + } + + return str + (str.length != 1 // [], {} + ? '\n' + repeat(' ', --space) + end + : end); +} + /** * Return if obj is a Buffer * @param {Object} arg @@ -6022,8 +6226,6 @@ exports.canonicalize = function(value, stack) { switch(type) { case 'undefined': - canonicalizedObj = '[undefined]'; - break; case 'buffer': case 'null': canonicalizedObj = value; @@ -6035,9 +6237,6 @@ exports.canonicalize = function(value, stack) { }); }); break; - case 'date': - canonicalizedObj = '[Date: ' + value.toISOString() + ']'; - break; case 'function': for (prop in value) { canonicalizedObj = {}; @@ -6056,7 +6255,9 @@ exports.canonicalize = function(value, stack) { }); }); break; + case 'date': case 'number': + case 'regexp': case 'boolean': canonicalizedObj = value; break; @@ -6092,7 +6293,7 @@ exports.lookupFiles = function lookupFiles(path, extensions, recursive) { return; } - fs.readdirSync(path).forEach(function(file){ + fs.readdirSync(path).forEach(function(file) { file = join(path, file); try { var stat = fs.statSync(file); @@ -6119,7 +6320,7 @@ exports.lookupFiles = function lookupFiles(path, extensions, recursive) { * @return {Error} */ -exports.undefinedError = function(){ +exports.undefinedError = function() { return new Error('Caught undefined error, did you throw without specifying what?'); }; @@ -6130,11 +6331,75 @@ exports.undefinedError = function(){ * @return {Error} */ -exports.getError = function(err){ +exports.getError = function(err) { return err || exports.undefinedError(); }; +/** + * @summary + * This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`) + * @description + * When invoking this function you get a filter function that get the Error.stack as an input, + * and return a prettify output. + * (i.e: strip Mocha, node_modules, bower and componentJS from stack trace). + * @returns {Function} + */ + +exports.stackTraceFilter = function() { + var slash = '/' + , is = typeof document === 'undefined' + ? { node: true } + : { browser: true } + , cwd = is.node + ? process.cwd() + slash + : location.href.replace(/\/[^\/]*$/, '/'); + + function isNodeModule (line) { + return (~line.indexOf('node_modules')); + } + + function isMochaInternal (line) { + return (~line.indexOf('node_modules' + slash + 'mocha')) || + (~line.indexOf('components' + slash + 'mochajs')) || + (~line.indexOf('components' + slash + 'mocha')); + } + + // node_modules, bower, componentJS + function isBrowserModule(line) { + return (~line.indexOf('node_modules')) || + (~line.indexOf('components')); + } + + function isNodeInternal (line) { + return (~line.indexOf('(timers.js:')) || + (~line.indexOf('(events.js:')) || + (~line.indexOf('(node.js:')) || + (~line.indexOf('(module.js:')) || + (~line.indexOf('GeneratorFunctionPrototype.next (native)')) || + false + } + + return function(stack) { + stack = stack.split('\n'); + + stack = exports.reduce(stack, function(list, line) { + if (is.node && (isNodeModule(line) || + isMochaInternal(line) || + isNodeInternal(line))) + return list; + + if (is.browser && (isBrowserModule(line))) + return list; + + // Clean up cwd(absolute) + list.push(line.replace(cwd, '')); + return list; + }, []); + + return stack.join('\n'); + } +}; }); // module: utils.js // The global object is "self" in Web Workers. var global = (function() { return this; })(); @@ -6277,7 +6542,8 @@ mocha.run = function(fn){ mocha.globals('location'); var query = Mocha.utils.parseQuery(global.location.search || ''); - if (query.grep) mocha.grep(query.grep); + if (query.grep) mocha.grep(new RegExp(query.grep)); + if (query.fgrep) mocha.grep(query.fgrep); if (query.invert) mocha.invert(); return Mocha.prototype.run.call(mocha, function(err){ diff --git a/tests/lib/mocha-2.1.0/package.json b/tests/lib/mocha-2.2.5/package.json old mode 100644 new mode 100755 similarity index 80% rename from tests/lib/mocha-2.1.0/package.json rename to tests/lib/mocha-2.2.5/package.json index 8c4a148b47739e18c9c8403fc23f05bf0ffd608a..28e16ffd420fb7b65dc590469affb069c9b0ee97 --- a/tests/lib/mocha-2.1.0/package.json +++ b/tests/lib/mocha-2.2.5/package.json @@ -1,6 +1,6 @@ { "name": "mocha", - "version": "2.1.0", + "version": "2.2.5", "description": "simple, flexible, fun test framework", "keywords": [ "mocha", @@ -12,14 +12,15 @@ "author": "TJ Holowaychuk <tj@vision-media.ca>", "contributors": [ "Joshua Appelman <joshua@jbna.nl>", - "Oleg Gaidarenko <markelog@gmail.com>", "Christoffer Hallas <christoffer.hallas@gmail.com>", "Christopher Hiller <chiller@badwing.com>", "Travis Jeffery <tj@travisjeffery.com>", - "Johnathan Ong <me@jongleberry.com>", - "Guillermo Rauch <rauchg@gmail.com>", - "Nathan Rajlich <nathan@tootallnate.net>" + "Daniel St. Jules <danielst.jules@gmail.com>", + "David da Silva ContÃn <dasilvacontin@gmail.com>", + "Ariel Mashraki <ariel@mashraki.co.il>", + "Pawel Kozlowski <pkozlowski.opensource@gmail.com>" ], + "license": "MIT", "repository": { "type": "git", "url": "git://github.com/mochajs/mocha.git" @@ -44,12 +45,13 @@ "dependencies": { "commander": "2.3.0", "debug": "2.0.0", - "diff": "1.0.8", + "diff": "1.4.0", "escape-string-regexp": "1.0.2", "glob": "3.2.3", "growl": "1.8.1", "jade": "0.26.3", - "mkdirp": "0.5.0" + "mkdirp": "0.5.0", + "supports-color": "~1.2.0" }, "devDependencies": { "coffee-script": "~1.8.0", diff --git a/tests/lib/mocha-2.1.0/support/compile.js b/tests/lib/mocha-2.2.5/support/compile.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/support/compile.js rename to tests/lib/mocha-2.2.5/support/compile.js diff --git a/tests/lib/mocha-2.1.0/support/foot.js b/tests/lib/mocha-2.2.5/support/foot.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/support/foot.js rename to tests/lib/mocha-2.2.5/support/foot.js diff --git a/tests/lib/mocha-2.1.0/support/head.js b/tests/lib/mocha-2.2.5/support/head.js old mode 100644 new mode 100755 similarity index 100% rename from tests/lib/mocha-2.1.0/support/head.js rename to tests/lib/mocha-2.2.5/support/head.js diff --git a/tests/lib/mocha-2.1.0/support/tail.js b/tests/lib/mocha-2.2.5/support/tail.js old mode 100644 new mode 100755 similarity index 97% rename from tests/lib/mocha-2.1.0/support/tail.js rename to tests/lib/mocha-2.2.5/support/tail.js index e9c0c0d22ff0eaf6c2d955952e0dd65b7cec1494..030177aad719e468fed2d2aef6a7213406fb26b7 --- a/tests/lib/mocha-2.1.0/support/tail.js +++ b/tests/lib/mocha-2.2.5/support/tail.js @@ -139,7 +139,8 @@ mocha.run = function(fn){ mocha.globals('location'); var query = Mocha.utils.parseQuery(global.location.search || ''); - if (query.grep) mocha.grep(query.grep); + if (query.grep) mocha.grep(new RegExp(query.grep)); + if (query.fgrep) mocha.grep(query.fgrep); if (query.invert) mocha.invert(); return Mocha.prototype.run.call(mocha, function(err){ diff --git a/tests/lib/mocha-2.2.5/test.js b/tests/lib/mocha-2.2.5/test.js new file mode 100755 index 0000000000000000000000000000000000000000..47de23e5e6b27d65d62f9379cced11abfc354def --- /dev/null +++ b/tests/lib/mocha-2.2.5/test.js @@ -0,0 +1,9 @@ +function usedToBeAsync (cb) { + cb() +} + +it('test', function() { + this.timeout(4294967296); + usedToBeAsync(done) +}); + diff --git a/tests/lib/screenshot-testing/support/mocha-loader.js b/tests/lib/screenshot-testing/support/mocha-loader.js index 24ea744a84ae8ff552d9b891b8ad8ca400b1486f..c5baf7e2d09b81053c568a36529b261ed112acce 100644 --- a/tests/lib/screenshot-testing/support/mocha-loader.js +++ b/tests/lib/screenshot-testing/support/mocha-loader.js @@ -73,5 +73,6 @@ mocha.constructor.process.stdout = { mocha.setup({ ui: 'bdd', reporter: config.reporter, - bail: false + bail: false, + useColors: true });