Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/mocha-3.1.0')
-rw-r--r--tests/lib/mocha-3.1.0/.editorconfig18
-rw-r--r--tests/lib/mocha-3.1.0/.eslintignore3
-rw-r--r--tests/lib/mocha-3.1.0/.eslintrc129
-rw-r--r--tests/lib/mocha-3.1.0/.gitignore17
-rw-r--r--tests/lib/mocha-3.1.0/.mailmap12
-rw-r--r--tests/lib/mocha-3.1.0/.npmignore2
-rw-r--r--tests/lib/mocha-3.1.0/.travis.yml55
-rw-r--r--tests/lib/mocha-3.1.0/CHANGELOG.md1418
-rw-r--r--tests/lib/mocha-3.1.0/CONTRIBUTING.md49
-rw-r--r--tests/lib/mocha-3.1.0/LICENSE22
-rw-r--r--tests/lib/mocha-3.1.0/Makefile176
-rw-r--r--tests/lib/mocha-3.1.0/README.md84
-rw-r--r--tests/lib/mocha-3.1.0/appveyor.yml26
-rw-r--r--tests/lib/mocha-3.1.0/assets/mocha-banner-192.pngbin15667 -> 0 bytes
-rw-r--r--tests/lib/mocha-3.1.0/assets/mocha-banner.svg160
-rw-r--r--tests/lib/mocha-3.1.0/assets/mocha-logo-128.pngbin7445 -> 0 bytes
-rw-r--r--tests/lib/mocha-3.1.0/assets/mocha-logo-192.pngbin10373 -> 0 bytes
-rw-r--r--tests/lib/mocha-3.1.0/assets/mocha-logo-64.pngbin3275 -> 0 bytes
-rw-r--r--tests/lib/mocha-3.1.0/assets/mocha-logo.svg125
-rw-r--r--tests/lib/mocha-3.1.0/bin/.eslintrc3
-rw-r--r--tests/lib/mocha-3.1.0/bin/_mocha543
-rw-r--r--tests/lib/mocha-3.1.0/bin/mocha81
-rw-r--r--tests/lib/mocha-3.1.0/bin/options.js39
-rw-r--r--tests/lib/mocha-3.1.0/bower.json38
-rw-r--r--tests/lib/mocha-3.1.0/browser-entry.js184
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - after each.tmSnippet18
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - after.tmSnippet18
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - before each.tmSnippet18
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - before.tmSnippet18
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - describe.tmSnippet18
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - it.tmSnippet18
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert.tmSnippet16
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_deepEqual.tmSnippet16
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_equal.tmSnippet16
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_fail.tmSnippet16
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_isFunction.tmSnippet16
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - setup.tmSnippet18
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - suite.tmSnippet18
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - teardown.tmSnippet18
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - test.tmSnippet18
-rwxr-xr-xtests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/info.plist19
-rwxr-xr-xtests/lib/mocha-3.1.0/images/error.pngbin412 -> 0 bytes
-rwxr-xr-xtests/lib/mocha-3.1.0/images/ok.pngbin388 -> 0 bytes
-rw-r--r--tests/lib/mocha-3.1.0/index.js3
-rw-r--r--tests/lib/mocha-3.1.0/karma.conf.js179
-rw-r--r--tests/lib/mocha-3.1.0/lib/browser/debug.js4
-rw-r--r--tests/lib/mocha-3.1.0/lib/browser/events.js193
-rw-r--r--tests/lib/mocha-3.1.0/lib/browser/progress.js117
-rw-r--r--tests/lib/mocha-3.1.0/lib/browser/tty.js11
-rw-r--r--tests/lib/mocha-3.1.0/lib/context.js110
-rw-r--r--tests/lib/mocha-3.1.0/lib/hook.js46
-rw-r--r--tests/lib/mocha-3.1.0/lib/interfaces/bdd.js113
-rw-r--r--tests/lib/mocha-3.1.0/lib/interfaces/common.js158
-rw-r--r--tests/lib/mocha-3.1.0/lib/interfaces/exports.js61
-rwxr-xr-xtests/lib/mocha-3.1.0/lib/interfaces/index.js4
-rw-r--r--tests/lib/mocha-3.1.0/lib/interfaces/qunit.js97
-rw-r--r--tests/lib/mocha-3.1.0/lib/interfaces/tdd.js104
-rw-r--r--tests/lib/mocha-3.1.0/lib/mocha.js520
-rw-r--r--tests/lib/mocha-3.1.0/lib/ms.js128
-rw-r--r--tests/lib/mocha-3.1.0/lib/pending.js15
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/base.js489
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/doc.js62
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/dot.js66
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/html.js344
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/index.js17
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/json-stream.js61
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/json.js90
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/landing.js92
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/list.js61
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/markdown.js97
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/min.js36
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/nyan.js261
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/progress.js89
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/spec.js79
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/tap.js68
-rw-r--r--tests/lib/mocha-3.1.0/lib/reporters/xunit.js166
-rw-r--r--tests/lib/mocha-3.1.0/lib/runnable.js380
-rw-r--r--tests/lib/mocha-3.1.0/lib/runner.js957
-rw-r--r--tests/lib/mocha-3.1.0/lib/suite.js400
-rw-r--r--tests/lib/mocha-3.1.0/lib/template.html18
-rw-r--r--tests/lib/mocha-3.1.0/lib/test.js50
-rw-r--r--tests/lib/mocha-3.1.0/lib/to-iso-string/LICENSE19
-rw-r--r--tests/lib/mocha-3.1.0/lib/to-iso-string/index.js37
-rw-r--r--tests/lib/mocha-3.1.0/lib/utils.js794
-rw-r--r--tests/lib/mocha-3.1.0/media/logo.svg7
-rw-r--r--tests/lib/mocha-3.1.0/mocha.css326
-rw-r--r--tests/lib/mocha-3.1.0/mocha.js15466
-rw-r--r--tests/lib/mocha-3.1.0/package.json357
-rw-r--r--tests/lib/mocha-3.1.0/scripts/dedefine.js26
-rw-r--r--tests/lib/mocha-3.1.0/scripts/travis-after-script.sh9
-rw-r--r--tests/lib/mocha-3.1.0/scripts/travis-before-install.sh5
-rw-r--r--tests/lib/mocha-3.1.0/scripts/travis-before-script.sh7
-rw-r--r--tests/lib/mocha-3.1.0/test/.eslintrc5
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/context.spec.js72
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/duration.spec.js25
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/fs.spec.js20
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/glob/glob.sh66
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/glob/glob.spec.js5
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/globals.spec.js41
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/http.spec.js16
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/interfaces/bdd.spec.js32
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/interfaces/exports.spec.js43
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/interfaces/qunit.spec.js23
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/interfaces/tdd.spec.js40
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/lookup-files.spec.js90
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/misc/exit.spec.js18
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/misc/many.spec.js27
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/misc/nontty.spec.js9
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/misc/only/bdd-require.spec.js18
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/misc/only/bdd.spec.js125
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/misc/only/global/bdd.spec.js12
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/misc/only/global/qunit.spec.js12
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/misc/only/global/tdd.spec.js12
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/misc/only/qunit.spec.js73
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/misc/only/tdd.spec.js125
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/overspecified-async.spec.js8
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/require/a.js2
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/require/b.coffee2
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/require/c.js2
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/require/d.coffee2
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/require/require.spec.js9
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/required-tokens.spec.js10
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/root.spec.js11
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/test.coffee6
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/test.foo1
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/throw.spec.js108
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/timeout.spec.js79
-rw-r--r--tests/lib/mocha-3.1.0/test/acceptance/utils.spec.js406
-rw-r--r--tests/lib/mocha-3.1.0/test/browser-fixtures/bdd.fixture.js4
-rw-r--r--tests/lib/mocha-3.1.0/test/browser-fixtures/exports.fixture.js4
-rw-r--r--tests/lib/mocha-3.1.0/test/browser-fixtures/qunit.fixture.js4
-rw-r--r--tests/lib/mocha-3.1.0/test/browser-fixtures/tdd.fixture.js4
-rw-r--r--tests/lib/mocha-3.1.0/test/browser/array.spec.js38
-rw-r--r--tests/lib/mocha-3.1.0/test/browser/grep.html51
-rw-r--r--tests/lib/mocha-3.1.0/test/browser/grep.spec.js108
-rw-r--r--tests/lib/mocha-3.1.0/test/browser/index.html33
-rw-r--r--tests/lib/mocha-3.1.0/test/browser/large.html24
-rw-r--r--tests/lib/mocha-3.1.0/test/browser/large.spec.js48
-rw-r--r--tests/lib/mocha-3.1.0/test/browser/multiple-done.spec.js16
-rw-r--r--tests/lib/mocha-3.1.0/test/browser/opts.html30
-rw-r--r--tests/lib/mocha-3.1.0/test/browser/opts.spec.js5
-rw-r--r--tests/lib/mocha-3.1.0/test/browser/stack-trace.html24
-rw-r--r--tests/lib/mocha-3.1.0/test/browser/stack-trace.spec.js20
-rw-r--r--tests/lib/mocha-3.1.0/test/browser/ui.html46
-rw-r--r--tests/lib/mocha-3.1.0/test/browser/ui.spec.js31
-rw-r--r--tests/lib/mocha-3.1.0/test/color.spec.js18
-rw-r--r--tests/lib/mocha-3.1.0/test/compiler/foo.js8
-rw-r--r--tests/lib/mocha-3.1.0/test/fixture-expect.js1
-rw-r--r--tests/lib/mocha-3.1.0/test/grep.spec.js65
-rw-r--r--tests/lib/mocha-3.1.0/test/hook-async.spec.js129
-rw-r--r--tests/lib/mocha-3.1.0/test/hook-sync-nested.spec.js98
-rw-r--r--tests/lib/mocha-3.1.0/test/hook-sync.spec.js97
-rw-r--r--tests/lib/mocha-3.1.0/test/hook-timeout.spec.js8
-rw-r--r--tests/lib/mocha-3.1.0/test/http-meta-2.spec.js91
-rw-r--r--tests/lib/mocha-3.1.0/test/http-meta.spec.js61
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/diffs.spec.js44
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/cascade.fixture.js57
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.css.in9
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.css.out13
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.fixture.js84
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/output91
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-async-error.fixture.js19
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-error.fixture.js17
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-async-error.fixture.js19
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-error.fixture.js17
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error-tip.fixture.js11
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error.fixture.js19
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error-tip.fixture.js9
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error.fixture.js17
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-async-error.fixture.js19
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-error.fixture.js17
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-async-error.fixture.js139
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-error.fixture.js129
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-before.fixture.js10
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-beforeEach.fixture.js14
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-specs.fixture.js10
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done.fixture.js18
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-async.fixture.js3
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-sync.fixture.js1
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/options/bail.fixture.js21
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/options/delay-fail.fixture.js5
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/options/delay.fixture.js14
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/options/grep.fixture.js17
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/bdd.fixture.js71
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/qunit.fixture.js26
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/tdd.fixture.js35
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/options/retries.fixture.js5
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/options/sort-alpha.fixture.js7
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/options/sort-beta.fixture.js5
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/passing.fixture.js11
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-before.fixture.js16
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-beforeEach.fixture.js16
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-spec.fixture.js12
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-before.fixture.js13
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-beforeEach.fixture.js13
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-spec.fixture.js10
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/pending/spec.fixture.js3
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/issue-1794.fixture.js3
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/simple-ui.js27
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1327.fixture.js15
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1991.fixture.js47
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2315.js9
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2406.fixture.js15
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2417.fixture.js7
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/retries/async.fixture.js28
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/retries/early-pass.fixture.js11
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/retries/hooks.fixture.js25
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/retries/nested.fixture.js9
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-no-callback.fixture.js1
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-callback.fixture.js1
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-no-callback.fixture.js1
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/timeout.fixture.js17
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught-hook.fixture.js15
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught.fixture.js26
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/helpers.js191
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/hook-err.spec.js215
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/hooks.spec.js43
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/multiple-done.spec.js96
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/only.spec.js45
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/options.spec.js182
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/pending.spec.js100
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/regression.spec.js97
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/reporters.spec.js61
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/retries.spec.js106
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/suite.spec.js42
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/timeout.spec.js16
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/uncaught.spec.js35
-rw-r--r--tests/lib/mocha-3.1.0/test/jsapi/index.js29
-rw-r--r--tests/lib/mocha-3.1.0/test/mocha.opts8
-rw-r--r--tests/lib/mocha-3.1.0/test/mocha.spec.js33
-rw-r--r--tests/lib/mocha-3.1.0/test/ms.spec.js82
-rw-r--r--tests/lib/mocha-3.1.0/test/reporters/base.spec.js214
-rw-r--r--tests/lib/mocha-3.1.0/test/reporters/json.spec.js61
-rw-r--r--tests/lib/mocha-3.1.0/test/reporters/nyan.spec.js30
-rw-r--r--tests/lib/mocha-3.1.0/test/runnable.spec.js470
-rw-r--r--tests/lib/mocha-3.1.0/test/runner.spec.js420
-rw-r--r--tests/lib/mocha-3.1.0/test/sanity/sanity.spec.js9
-rw-r--r--tests/lib/mocha-3.1.0/test/suite.spec.js439
-rw-r--r--tests/lib/mocha-3.1.0/test/test.spec.js76
-rw-r--r--tests/lib/mocha-3.1.0/test/utils.spec.js259
240 files changed, 0 insertions, 33585 deletions
diff --git a/tests/lib/mocha-3.1.0/.editorconfig b/tests/lib/mocha-3.1.0/.editorconfig
deleted file mode 100644
index e3a4859eeb..0000000000
--- a/tests/lib/mocha-3.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-3.1.0/.eslintignore b/tests/lib/mocha-3.1.0/.eslintignore
deleted file mode 100644
index 2b550ca81d..0000000000
--- a/tests/lib/mocha-3.1.0/.eslintignore
+++ /dev/null
@@ -1,3 +0,0 @@
-lib/to-iso-string/
-test/**/*
-!test/runner.js
diff --git a/tests/lib/mocha-3.1.0/.eslintrc b/tests/lib/mocha-3.1.0/.eslintrc
deleted file mode 100644
index d5c733f79f..0000000000
--- a/tests/lib/mocha-3.1.0/.eslintrc
+++ /dev/null
@@ -1,129 +0,0 @@
----
-env:
- node: true
-
-rules:
- brace-style: [2, 1tbs]
- camelcase: 2
- comma-dangle: [2, never]
- comma-spacing: [2, {before: false, after: true}]
- comma-style: [2, last]
- computed-property-spacing: [2, never]
- consistent-return: 0
- consistent-this: [1, self]
- curly: [2, all]
- default-case: 2
- dot-location: [2, property]
- dot-notation: [2, { allowKeywords: true, allowPattern: "^long$" }]
- eol-last: 2
- eqeqeq: 2
- func-style: [2, declaration]
- guard-for-in: 2 # TODO: Change to error
- handle-callback-err: [2, ^(err|error)$]
- indent: [2, 2, { SwitchCase: 1 }]
- key-spacing: [2, { beforeColon: false, afterColon: true }]
- max-len: [0, 80, 2] # TODO: Change to error
- max-params: [1, 4]
- new-cap: 0 # TODO: Change to error
- new-parens: 2
- no-alert: 2
- no-array-constructor: 0
- no-bitwise: 0
- no-caller: 2
- no-catch-shadow: 2
- no-cond-assign: [1, except-parens] # TODO: Change to error
- no-console: 0
- no-constant-condition: 0
- no-control-regex: 2
- no-debugger: 1
- no-delete-var: 2
- no-dupe-args: 2
- no-dupe-keys: 2
- no-duplicate-case: 2
- no-else-return: 2
- no-empty: 2
- no-empty-character-class: 2
- no-eq-null: 0
- no-eval: 2
- no-ex-assign: 2
- no-extend-native: 2
- no-extra-bind: 2
- no-extra-boolean-cast: 2
- no-extra-semi: 2
- no-fallthrough: 2
- no-floating-decimal: 0
- no-func-assign: 2
- no-implied-eval: 2
- no-inner-declarations: [2, functions]
- no-invalid-regexp: 2
- no-irregular-whitespace: 2
- no-iterator: 2
- no-labels: 2
- no-lone-blocks: 2
- no-lonely-if: 2
- no-loop-func: 2
- no-mixed-requires: [0, false]
- no-mixed-spaces-and-tabs: [2, false]
- no-multi-spaces: 2
- no-multi-str: 2
- no-multiple-empty-lines: [2, { max: 1 }]
- no-native-reassign: 2
- no-negated-in-lhs: 2
- no-nested-ternary: 2
- no-new: 2
- no-new-func: 2
- no-new-object: 2
- no-new-require: 2
- no-new-wrappers: 2
- no-obj-calls: 2
- no-octal: 2
- no-octal-escape: 2
- no-path-concat: 2
- no-process-exit: 2
- no-proto: 1 # TODO: Change to error
- no-redeclare: 2
- no-regex-spaces: 2
- no-return-assign: 2
- no-script-url: 2
- no-self-compare: 2
- no-sequences: 2
- no-shadow: 0
- no-shadow-restricted-names: 2
- no-spaced-func: 2
- no-sparse-arrays: 2
- no-trailing-spaces: 2
- no-undef: 2
- no-undef-init: 2
- no-underscore-dangle: 0 # TODO: Change to error
- no-unneeded-ternary: 2
- no-unreachable: 2
- no-unused-expressions: 0
- no-unused-vars: [2, { vars: all, args: after-used }]
- no-use-before-define: 0
- no-void: 2
- no-with: 2
- object-curly-spacing: [2, always]
- one-var: [2, never]
- operator-assignment: [2, always]
- operator-linebreak: [2, before]
- padded-blocks: [2, never]
- quote-props: [2, as-needed]
- quotes: [2, single, avoid-escape]
- radix: 2
- semi: [2, always]
- semi-spacing: [2, { before: false, after: true }]
- space-before-blocks: [2, always]
- space-before-function-paren: [2, never]
- space-in-parens: [2, never]
- space-infix-ops: 2
- keyword-spacing: 2
- space-unary-ops: [2, { words: true, nonwords: false }]
- spaced-comment: [2, always, { exceptions: ['!'] }]
- strict: [0, global] # TODO: Change to error
- use-isnan: 2
- valid-jsdoc: [0, { requireReturn: false }] # TODO: Change to warning
- valid-typeof: 2
- vars-on-top: 0
- wrap-iife: 2
- wrap-regex: 2
- yoda: [2, never]
diff --git a/tests/lib/mocha-3.1.0/.gitignore b/tests/lib/mocha-3.1.0/.gitignore
deleted file mode 100644
index fa1c0b0ccf..0000000000
--- a/tests/lib/mocha-3.1.0/.gitignore
+++ /dev/null
@@ -1,17 +0,0 @@
-.DS_Store
-node_modules
-*.sock
-testing
-_mocha.js
-my-reporter.js
-*.sw*
-lib/browser/diff.js
-.idea
-*.iml
-*.patch
-*.diff
-npm-debug.log*
-.envrc
-.karma/
-*.orig
-
diff --git a/tests/lib/mocha-3.1.0/.mailmap b/tests/lib/mocha-3.1.0/.mailmap
deleted file mode 100644
index 528a26775e..0000000000
--- a/tests/lib/mocha-3.1.0/.mailmap
+++ /dev/null
@@ -1,12 +0,0 @@
-TJ Holowaychuk <tj@vision-media.ca>
-Travis Jeffery <tj@travisjeffery.com> <travisjeffery@gmail.com>
-Travis Jeffery <tj@travisjeffery.com> Dr. Travis Jeffery <tj@travisjeffery.com>
-Christopher Hiller <boneskull@boneskull.com> Christopher Hiller <chiller@badwing.com>
-David da Silva Contín <dasilvacontin@gmail.com> David da Silva <daviddasilvacontin@me.com>
-David da Silva Contín <dasilvacontin@gmail.com> David da Silva <dasilvacontin@gmail.com>
-David da Silva Contín <dasilvacontin@gmail.com> <daviddasilvacontin@gmail.com>
-Ariel Mashraki <ariel@mashraki.co.il> Ariel Mashraki <ariel@codeoasis.com>
-Ariel Mashraki <ariel@mashraki.co.il> Ariel Mashraki <ariel.mashraki@ironsrc.com>
-Forbes Lindesay <forbes@lindesay.co.uk> Forbes Lindesay <fpfl2@cam.ac.uk>
-Ben Bradley <ben@bradleyit.com> Ben Bradley <[ben.bradley@cigna.com|mailto:ben.bradley@cigna.com]>
-Glen Mailer <glenjamin@gmail.com> Glen Mailer <glen.mailer@bskyb.com>
diff --git a/tests/lib/mocha-3.1.0/.npmignore b/tests/lib/mocha-3.1.0/.npmignore
deleted file mode 100644
index e3216decb2..0000000000
--- a/tests/lib/mocha-3.1.0/.npmignore
+++ /dev/null
@@ -1,2 +0,0 @@
-assets/
-
diff --git a/tests/lib/mocha-3.1.0/.travis.yml b/tests/lib/mocha-3.1.0/.travis.yml
deleted file mode 100644
index 29b4c419e5..0000000000
--- a/tests/lib/mocha-3.1.0/.travis.yml
+++ /dev/null
@@ -1,55 +0,0 @@
-# in order to use 'trusty' dist, need this.
-# see https://docs.travis-ci.com/user/trusty-ci-environment/
-sudo: required
-
-# trust dist provides a modern build chain (as opposed to 'precise' dist)
-# which absolves us from having to install compilers and stuff
-dist: trusty
-
-language: node_js
-
-env:
- global:
- # phantomjs hosts binaries @ bitbucket, which has fairly restrictive
- # rate-limiting. pull it from this sketchy site in China instead.
- - PHANTOMJS_CDNURL='https://cnpmjs.org/downloads'
- # we're going to use s3 to temporarily store Karma test bundles for debugging
- - AWS_ACCESS_KEY_ID=AKIAJ3QQTLQXWXYJ6PTA
- - secure: k4musDC734E1NFOWaY5qb/l0B9K1cfusFTvMZFayTMs5ubKjeNYCgct2sDSvO5tO7Un935I0sYOOSRPvANPhs8dP1a/8/x0PnwIfnpoCFQCCaI0bWnIQj7nOZ2TaEB/fngZCerCFpNDlzqI6BmaR+XoMvA74v2YD/vVXnzvXNQk=
-
-matrix:
- fast_finish: true
- include:
- - node_js: '6'
- env: TARGET=test-node
- - node_js: '5'
- env: TARGET=test-node
- - node_js: '4'
- env: TARGET=test-node
- - node_js: 'iojs'
- env: TARGET=test-node
- - node_js: '0.12'
- env: TARGET=test-node
- - node_js: '0.11'
- env: TARGET=test-node
- - node_js: '0.10'
- env: TARGET=test-node
- - node_js: '6'
- env: TARGET=lint
- - node_js: '6'
- env: TARGET=test-browser S3=1
-
-before_install: scripts/travis-before-install.sh
-
-before_script: scripts/travis-before-script.sh
-
-script: make $TARGET
-
-after_script: scripts/travis-after-script.sh
-
-notifications:
- urls:
- # for gitter
- - secure: fUrHenYJs+pTuLtgBRoYyrlyfVekxaIGmLWq7bhUUqBj/7p5eCkQFn13LlPht0/4WWZOiPBcdTN7tKnz3Ho7ATUJhAchvOWDUgL5gtTvOzeCHbPuCvHz/VLK6hMoPdbLA45M864NDLotfHvyh62WgQaVw9iPc80eb+umaDPrYiU=
- on_success: change
- on_failure: always
diff --git a/tests/lib/mocha-3.1.0/CHANGELOG.md b/tests/lib/mocha-3.1.0/CHANGELOG.md
deleted file mode 100644
index 27d04fac00..0000000000
--- a/tests/lib/mocha-3.1.0/CHANGELOG.md
+++ /dev/null
@@ -1,1418 +0,0 @@
-# 3.1.0 / 2016-09-27
-
-## :tada: Enhancement
-
-- [#2357]: Support `--inspect` on command-line ([@simov])
-- [#2194]: Human-friendly error if no files are matched on command-line ([@Munter])
-- [#1744]: Human-friendly error if a Suite has no callback (BDD/TDD only) ([@anton])
-
-## :bug: Bug Fix
-
-- [#2488]: Fix case in which *variables beginning with lowercase "D"* may not have been reported properly as global leaks ([@JustATrick]) :laughing:
-- [#2465]: Always halt execution in async function when `this.skip()` is called ([@boneskull])
-- [#2445]: Exits with expected code 130 when `SIGINT` encountered; exit code can no longer rollover at 256 ([@Munter])
-- [#2315]: Fix uncaught TypeError thrown from callback stack ([@1999])
-- Fix broken `only()`/`skip()` in IE7/IE8 ([@boneskull])
-- [#2502]: Fix broken stack trace filter on Node.js under Windows ([@boneskull])
-- [#2496]: Fix diff output for objects instantiated with `String` constructor ([more](https://youtrack.jetbrains.com/issue/WEB-23383)) ([@boneskull])
-
-[#2496]: https://github.com/mochajs/mocha/issues/2496
-[#2502]: https://github.com/mochajs/mocha/issues/2502
-[#2315]: https://github.com/mochajs/mocha/issues/2315
-[#2445]: https://github.com/mochajs/mocha/pull/2445
-[#2465]: https://github.com/mochajs/mocha/issues/2465
-[#2488]: https://github.com/mochajs/mocha/issues/2488
-[#1744]: https://github.com/mochajs/mocha/issues/1744
-[#2194]: https://github.com/mochajs/mocha/issues/2194
-[#2357]: https://github.com/mochajs/mocha/issues/2357
-[@1999]: https://github.com/1999
-[@JustATrick]: https://github.com/JustATrick
-[@anton]: https://github.com/anton
-[@simov]: https://github.com/simov
-
-# 3.0.2 / 2016-08-08
-
-## :bug: Bug Fix
-
-- [#2424]: Fix error loading Mocha via Require.js ([@boneskull])
-- [#2417]: Fix execution of *deeply* nested `describe.only()` suites ([@not-an-aardvark])
-- Remove references to `json-cov` and `html-cov` reporters in CLI ([@boneskull])
-
-[#2417]: https://github.com/mochajs/mocha/issues/2417
-[#2424]: https://github.com/mochajs/mocha/issues/2424
-
-# 3.0.1 / 2016-08-03
-
-## :bug: Bug Fix
-
-- [#2406]: Restore execution of nested `describe.only()` suites ([@not-an-aardvark])
-
-[#2406]: https://github.com/mochajs/mocha/issues/2406
-[@not-an-aardvark]: https://github.com/not-an-aardvark
-
-# 3.0.0 / 2016-07-31
-
-## :boom: Breaking Changes
-
-- :warning: Due to the increasing difficulty of applying security patches made within its dependency tree, as well as looming incompatibilities with Node.js v7.0, **Mocha no longer supports Node.js v0.8**.
-- :warning: **Mocha may no longer be installed by versions of `npm` less than `1.4.0`.** Previously, this requirement only affected Mocha's development dependencies. In short, this allows Mocha to depend on packages which have dependencies fixed to major versions (`^`).
-- `.only()` is no longer "fuzzy", can be used multiple times, and generally just works like you think it should. :joy:
-- To avoid common bugs, when a test injects a callback function (suggesting asynchronous execution), calls it, *and* returns a `Promise`, Mocha will now throw an exception:
-
- ```js
- const assert = require('assert');
-
- it('should complete this test', function (done) {
- return new Promise(function (resolve) {
- assert.ok(true);
- resolve();
- })
- .then(done);
- });
- ```
-
- The above test will fail with `Error: Resolution method is overspecified. Specify a callback *or* return a Promise; not both.`.
-- When a test timeout value *greater than* `2147483648` is specified in any context (`--timeout`, `mocha.setup()`, per-suite, per-test, etc.), the timeout will be *disabled* and the test(s) will be allowed to run indefinitely. This is equivalent to specifying a timeout value of `0`. See [MDN](https://developer.mozilla.org/docs/Web/API/WindowTimers/setTimeout#Maximum_delay_value) for reasoning.
-- The `dot` reporter now uses more visually distinctive characters when indicating "pending" and "failed" tests.
-- Mocha no longer supports [component](https://www.npmjs.com/package/component).
-- The long-forsaken `HTMLCov` and `JSONCov` reporters--and any relationship to the "node-jscoverage" project--have been removed.
-- `spec` reporter now omits leading carriage returns (`\r`) in non-TTY environment.
-
-## :tada: Enhancements
-
-- [#808]: Allow regular-expression-like strings in `--grep` and browser's `grep` querystring; enables flags such as `i` for case-insensitive matches and `u` for unicode. ([@a8m])
-- [#2000]: Use distinctive characters in `dot` reporter; `,` will denote a "pending" test and `!` will denote a "failing" test. ([@elliottcable])
-- [#1632]: Throw a useful exception when a suite or test lacks a title. ([@a8m])
-- [#1481]: Better `.only()` behavior. ([@a8m])
-- [#2334]: Allow `this.skip()` in async tests and hooks. ([@boneskull])
-- [#1320]: Throw a useful exception when test resolution method is overspecified. ([@jugglinmike])
-- [#2364]: Support `--preserve-symlinks`. ([@rosswarren])
-
-## :bug: Bug Fixes
-
-- [#2259]: Restore ES3 compatibility. Specifically, support an environment lacking `Date.prototype.toISOString()`, `JSON`, or has a non-standard implementation of `JSON`. ([@ndhoule], [@boneskull])
-- [#2286]: Fix `after()` failing to execute if test skipped using `this.skip()` in `beforeEach()`; no longer marks the entire suite as "pending". ([@dasilvacontin], [@boneskull])
-- [#2208]: Fix function name display in `markdown` and `html` (browser) reporters. ([@ScottFreeCode])
-- [#2299]: Fix progress bar in `html` (browser) reporter. ([@AviVahl])
-- [#2307]: Fix `doc` reporter crashing when test fails. ([@jleyba])
-- [#2323]: Ensure browser entry point (`browser-entry.js`) is published to npm (for use with bundlers). ([@boneskull])
-- [#2310]: Ensure custom reporter with an absolute path works in Windows. ([@silentcloud])
-- [#2311]: Fix problem wherein calling `this.slow()` without a value would blast any previously set value. ([@boneskull])
-- [#1813]: Ensure Mocha's own test suite will run in Windows. ([@tswaters], [@TimothyGu], [@boneskull])
-- [#2317]: Ensure all interfaces are displayed in `--help` on CLI. ([@ScottFreeCode])
-- [#1644]: Don't exhibit undefined behavior when calling `this.timeout()` with very large values ([@callumacrae], [@boneskull])
-- [#2361]: Don't truncate name of thrown anonymous exception. ([@boneskull])
-- [#2367]: Fix invalid CSS. ([@bensontrent])
-- [#2401]: Remove carriage return before each test line in spec reporter. ([@Munter])
-
-## :nut_and_bolt: Other
-
-- Upgrade production dependencies to address security advisories (and because now we can): `glob`, `commander`, `escape-string-regexp`,
-and `supports-color`. ([@boneskull], [@RobLoach])
-- Add Windows to CI. ([@boneskull], [@TimothyGu])
-- Ensure appropriate `engines` field in `package.json`. ([@shinnn], [@boneskull])
-- [#2348]: Upgrade ESLint to v2 ([@anthony-redfox])
-
-We :heart: our [backers and sponsors](https://opencollective.com/mochajs)!
-
-:shipit:
-
-[#2401]: https://github.com/mochajs/mocha/pull/2401
-[#2348]: https://github.com/mochajs/mocha/issues/2348
-[#808]: https://github.com/mochajs/mocha/issues/808
-[#2361]: https://github.com/mochajs/mocha/pull/2361
-[#2367]: https://github.com/mochajs/mocha/pull/2367
-[#2364]: https://github.com/mochajs/mocha/pull/2364
-[#1320]: https://github.com/mochajs/mocha/pull/1320
-[#2307]: https://github.com/mochajs/mocha/pull/2307
-[#2259]: https://github.com/mochajs/mocha/pull/2259
-[#2208]: https://github.com/mochajs/mocha/pull/2208
-[#2299]: https://github.com/mochajs/mocha/pull/2299
-[#2286]: https://github.com/mochajs/mocha/issues/2286
-[#1644]: https://github.com/mochajs/mocha/issues/1644
-[#2310]: https://github.com/mochajs/mocha/issues/2310
-[#2311]: https://github.com/mochajs/mocha/issues/2311
-[#2323]: https://github.com/mochajs/mocha/issues/2323
-[#2000]: https://github.com/mochajs/mocha/pull/2000
-[#1632]: https://github.com/mochajs/mocha/issues/1632
-[#1813]: https://github.com/mochajs/mocha/issues/1813
-[#2334]: https://github.com/mochajs/mocha/issues/2334
-[#2317]: https://github.com/mochajs/mocha/issues/2317
-[#1481]: https://github.com/mochajs/mocha/issues/1481
-[@elliottcable]: https://github.com/elliottcable
-[@RobLoach]: https://github.com/robloach
-[@AviVahl]: https://github.com/avivahl
-[@silentcloud]: https://github.com/silentcloud
-[@tswaters]: https://github.com/tswaters
-[@jleyba]: https://github.com/jleyba
-[@TimothyGu]: https://github.com/timothygu
-[@callumacrae]: https://github.com/callumacrae
-[@shinnn]: https://github.com/shinnn
-[@bensontrent]: https://github.com/bensontrent
-[@jugglinmike]: https://github.com/jugglinmike
-[@rosswarren]: https://github.com/rosswarren
-[@anthony-redfox]: https://github.com/anthony-redfox
-[@Munter]: https://github.com/munter
-
-# 2.5.3 / 2016-05-25
-
-- [#2112] - Fix HTML reporter regression causing duplicate error output ([@danielstjules] via 6d24063)
-- [#2119] - Make HTML reporter failure/passed links preventDefault to avoid SPA's hash navigation ([@jimenglish81] via 9e93efc)
-
-[@danielstjules]: https://github.com/danielstjules
-[@jimenglish81]: https://github.com/jimenglish81
-[#2112]: https://github.com/mochajs/mocha/pull/2112
-[#2119]: https://github.com/mochajs/mocha/pull/2119
-
-# 2.5.2 / 2016-05-24
-
-- [#2178] - Avoid double and triple xUnit XML escaping ([@graingert] via 49b5ff1)
-
-[@graingert]: https://github.com/graingert
-[#2178]: https://github.com/mochajs/mocha/pull/2178
-
-# 2.5.1 / 2016-05-23
-
-- Fix [to-iso-string](https://npmjs.com/package/to-iso-string) dependency ([@boneskull] via bd9450b)
-
-Thanks @entertainyou, @SimenB, @just-paja for the heads-up.
-
-# 2.5.0 / 2016-05-23
-
-> This has been awhile coming! We needed to feel confident that the next release wouldn't break browser compatibility (e.g. the last few patch releases).
->
-> ### Browser Tests in CI
->
-> We now run unit tests against PhantomJS v1.x and an assortment of browsers on [SauceLabs](https://saucelabs.com), including:
-> - Internet Explorer v8.0
-> - Chrome (latest)
-> - Firefox (latest)
-> - Safari (latest)
-> - Microsoft Edge (latest)
->
-> To accomplish this, we now run Mocha's unit tests (and a handful of integration tests) via [Karma](https://npmjs.com/package/karma) and a modified [karma-mocha](https://npmjs.com/package/karma-mocha). Along the way, we had to solve issue [#880] (apologies to @mderijcke and @sukima who had PRs addressing this), as well as replace most usages of [should](https://npmjs.com/package/should) with [expect.js](https://npmjs.com/package/expect.js) for IE8.
->
-> Going forward, when sending PRs, your code will *only* run against PhantomJS v1.x (and not hit SauceLabs) [because security](https://docs.travis-ci.com/user/pull-requests/#Security-Restrictions-when-testing-Pull-Requests).
->
-> ### Node.js 6.x
-> Node.js 6.x "just worked" before, but now it's in the CI matrix, so it's "officially" supported. Mocha *still retains support* for Node.js 0.8.x.
->
-> ### "Minor" Release
-> You'll see mostly bug fixes below, but also a couple features--as such, it's a "minor" release.
->
-> ### TYVM
->
-> Thanks to everyone who contributed, and our fabulous [sponsors and backers](https://opencollective.com/mochajs)!
-
-- [#2079] - Add browser checks to CI; update [browserify](https://npmjs.com/package/browserify) to v13.0.0 ([@dasilvacontin], [@ScottFreeCode], [@boneskull] via c04c1d7, 0b1e9b3, 0dde0fa, f8a3d86, 9e8cbaa)
-- [#880] - Make Mocha browserifyable ([@boneskull] via 524862b)
-- [#2121] - Update [glob](https://npmjs.com/package/glob) to v3.2.11 ([@astorije] via 7920fc4)
-- [#2126] - Fix dupe error messages in stack trace filter ([@Turbo87] via 4301caa)
-- [#2109] - Fix certain diffs when objects cannot be coerced into primitives ([@joshlory] via 61fbb7f)
-- [#1827] - Fix TWBS/`mocha.css` collisions ([@irnc] via 0543798)
-- [#1760], [#1936] - Fix `this.skip()` in HTML reporter ([@mislav] via cb4248b)
-- [#2115] - Fix exceptions thrown from hooks in HTML reporter ([@danielstjules] via e290bc0)
-- [#2089] - Handle Symbol values in `util.stringify()` ([@ryym] via ea61d05)
-- [#2097] - Fix diff for objects overriding `Object.prototype.hasOwnProperty` ([@mantoni] via b20fdfe)
-- [#2101] - Properly handle non-string "messages" thrown from assertion libraries ([@jkimbo] via 9c41051)
-- [#2124] - Update [growl](https://npmjs.com/package/growl) ([@benjamine] via 9ae6a85)
-- [#2162], [#2205] - JSDoc fixes ([@OlegTsyba] via 8031f20, [@ScottFreeCode] via f83b1d9)
-- [#2132] - Remove Growl-related cruft ([@julienw] via 00d6469)
-- [#2172] - Add [OpenCollective](https://opencollective.com) badge, sponsors & backers ([@xdamman], [@boneskull] via caee94f)
-- [#1841] - Add new logo, banner assets ([@dasilvacontin] via 00fd0e1)
-- [#2214] - Update `README.md` header ([@dasilvacontin] via c0f9be2)
-- [#2236] - Better checks for Node.js v0.8 compatibility in CI ([@dasilvacontin] via ba5637d)
-- [#2239] - Add Node.js v6.x to CI matrix ([@boneskull] via 3904da4)
-
-[#880]: https://github.com/mochajs/mocha/issues/880
-[#1841]: https://github.com/mochajs/mocha/pull/1841
-[#2239]: https://github.com/mochajs/mocha/issues/2239
-[#2153]: https://github.com/mochajs/mocha/pull/2153
-[#2214]: https://github.com/mochajs/mocha/pull/2214
-[#2236]: https://github.com/mochajs/mocha/pull/2236
-[#2079]: https://github.com/mochajs/mocha/issues/2079
-[#2231]: https://github.com/mochajs/mocha/pull/2231
-[#2089]: https://github.com/mochajs/mocha/issues/2089
-[#2097]: https://github.com/mochajs/mocha/pull/2097
-[#1760]: https://github.com/mochajs/mocha/issues/1760
-[#1936]: https://github.com/mochajs/mocha/issues/1936
-[#2115]: https://github.com/mochajs/mocha/pull/2115
-[#1827]: https://github.com/mochajs/mocha/pull/1827
-[#2101]: https://github.com/mochajs/mocha/pull/2101
-[#2124]: https://github.com/mochajs/mocha/pull/2124
-[#2109]: https://github.com/mochajs/mocha/issues/2109
-[#2162]: https://github.com/mochajs/mocha/pull/2162
-[#2132]: https://github.com/mochajs/mocha/issues/2132
-[#2126]: https://github.com/mochajs/mocha/issues/2126
-[#2121]: https://github.com/mochajs/mocha/issues/2121
-[#2205]: https://github.com/mochajs/mocha/pull/2205
-[#2172]: https://github.com/mochajs/mocha/pull/2172
-[@xdamman]: https://github.com/xdamman
-[@Turbo87]: https://github.com/Turbo87
-[@OlegTsyba]: https://github.com/OlegTsyba
-[@ryym]: https://github.com/ryym
-[@mantoni]: https://github.com/mantoni
-[@mislav]: https://github.com/mislav
-[@irnc]: https://github.com/irnc
-[@jkimbo]: https://github.com/jkimbo
-[@benjamine]: https://github.com/benjamine
-[@joshlory]: https://github.com/joshlory
-[@julienw]: https://github.com/julienw
-[@ScottFreeCode]: https://github.com/ScottFreeCode
-[@astorije]: https://github.com/astorije
-[@dasilvacontin]: https://github.com/dasilvacontin
-
-2.4.5 / 2016-01-28
-==================
-
-* [#2080], [#2078], [#2072], [#2073], [#1200] - Revert changes to console colors in changeset [1192914](https://github.com/mochajs/mocha/commit/119291449cd03a11cdeda9e37cf718a69a012896) and subsequent related changes thereafter. Restores compatibility with IE8 & PhantomJS. See also [mantoni/mochify.js#129](https://github.com/mantoni/mochify.js/issues/129) and [openlayers/ol3#4746](https://github.com/openlayers/ol3/pull/4746) ([@boneskull])
-* [#2082] - Fix several test assertions ([@mislav])
-
-[#1200]: https://github.com/mochajs/mocha/issues/1200
-[#2082]: https://github.com/mochajs/mocha/pull/2082
-
-2.4.4 / 2016-01-27
-==================
-
-* [#2080] - Fix broken RequireJS compatibility ([@boneskull])
-
-[#2080]: https://github.com/mochajs/mocha/issues/2080
-
-2.4.3 / 2016-01-27
-==================
-
-* [#2078] - Fix broken IE8 ([@boneskull])
-
-[#2078]: https://github.com/mochajs/mocha/issues/2078
-
-2.4.2 / 2016-01-26
-==================
-
-* [#2053] - Fix web worker compatibility ([@mislav])
-* [#2072] - Fix Windows color output ([@thedark1337])
-* [#2073] - Fix colors in `progress` and `landing` reporters ([@gyandeeps])
-
-[#2053]: https://github.com/mochajs/mocha/pull/2053
-[#2072]: https://github.com/mochajs/mocha/pull/2072
-[#2073]: https://github.com/mochajs/mocha/pull/2073
-[@gyandeeps]: https://github.com/gyandeeps
-[@thedark1337]: https://github.com/thedark1337
-
-2.4.1 / 2016-01-26
-==================
-
-* [#2067] - Fix HTML/doc reporter regressions ([@danielstjules])
-
-[#2067]: https://github.com/mochajs/mocha/pull/2067
-
-2.4.0 / 2016-01-25
-==================
-
-* [#1945] - Correctly skip tests when skipping in suite's before() ([@ryanshawty])
-* [#2056] - chore(license): update license year to 2016 ([@pra85])
-* [#2048] - Fix `this.skip` from spec with HTML reporter ([@mislav])
-* [#2033] - Update tests for newer versions of should.js ([@tomhughes])
-* [#2037] - Fix for memory leak caused by referenced to deferred test ([@bd82])
-* [#2038] - Also run Travis-CI on node.js 4 & 5 ([@bd82])
-* [#2028] - Remove reference to test before afterAll hook runs ([@stonelgh])
-* Bump mkdirp to 0.5.1 to support strict mode ([@danielstjules])
-* [#1977] - safely stringify PhantomJS undefined value ([@ahamid])
-* Add the ability to retry tests ([@@longlho])
-* [#1982] - Enable --log-timer-events option [@Alaneor]
-* Fix #1980: Load mocha.opts from bin/mocha and bin/_mocha ([@danielstjules])
-* [#1976] - Simplify function call ([@iclanzan])
-* [#1963] - Add support --perf-basic-prof ([@robraux])
-* [#1981] - Fix HTML reporter handling of done and exceptions ([@Standard8])
-* [#1993] - propagate "file" property for "exports" interface ([@segrey])
-* [#1999] - Add support for strict mode ([@tmont])
-* [#2005] - XUnit Reporter Writes to stdout, falls back to console.log ([@jonnyreeves])
-* [#2021] - Fix non ES5 compliant regexp ([@zetaben])
-* [#1965] - Don't double install BDD UI ([@cowboyd])
-* [#1995] - Make sure the xunit output dir exists before writing to it ([@ianwremmel])
-* Use chalk for the base reporter colors; closes #1200 ([@boneskull])
-* Fix requiring custom interfaces ([@jgkim])
-* [#1967] Silence Bluebird js warnings ([@krisr])
-
-[#1945]: https://github.com/mochajs/mocha/pull/1945
-[#2056]: https://github.com/mochajs/mocha/pull/2056
-[#2048]: https://github.com/mochajs/mocha/pull/2048
-[#2033]: https://github.com/mochajs/mocha/pull/2033
-[#2037]: https://github.com/mochajs/mocha/pull/2037
-[#2038]: https://github.com/mochajs/mocha/pull/2038
-[#2028]: https://github.com/mochajs/mocha/pull/2028
-[#1977]: https://github.com/mochajs/mocha/pull/1977
-[#1982]: https://github.com/mochajs/mocha/pull/1982
-[#1976]: https://github.com/mochajs/mocha/pull/1976
-[#1963]: https://github.com/mochajs/mocha/pull/1963
-[#1981]: https://github.com/mochajs/mocha/pull/1981
-[#1993]: https://github.com/mochajs/mocha/pull/1993
-[#1999]: https://github.com/mochajs/mocha/pull/1999
-[#2005]: https://github.com/mochajs/mocha/pull/2005
-[#2021]: https://github.com/mochajs/mocha/pull/2021
-[1965#]: https://github.com/mochajs/mocha/pull/1965
-[#1995]: https://github.com/mochajs/mocha/pull/1995
-[#1967]: https://github.com/mochajs/mocha/pull/1967
-[@ryanshawty]: https://github.com/ryanshawty
-[@pra85]: https://github.com/pra85
-[@mislav]: https://github.com/mislav
-[@tomhughes]: https://github.com/tomhughes
-[@bd82]: https://github.com/bd82
-[@stonelgh]: https://github.com/stonelgh
-[@danielstjules]: https://github.com/danielstjules
-[@ahamid]: https://github.com/ahamid
-[@longlho]: https://github.com/longlho
-[@Alaneor]: https://github.com/Alaneor
-[@iclanzan]: https://github.com/iclanzan
-[@robraux]: https://github.com/robraux
-[@Standard8]: https://github.com/Standard8
-[@segrey]: https://github.com/segrey
-[@tmont]: https://github.com/tmont
-[@jonnyreeves]: https://github.com/jonnyreeves
-[@zetaben]: https://github.com/zetaben
-[@cowboyd]: https://github.com/cowboyd
-[@ianwremmel]: https://github.com/ianwremmel
-[@boneskull]: https://github.com/boneskull
-[@jgkim]: https://github.com/jgkim
-[@krisr]: https://github.com/krisr
-
-2.3.4 / 2015-11-15
-==================
-
- * Update debug dependency to 2.2.0
- * remove duplication of mocha.opts on process.argv
- * Fix typo in test/reporters/nyan.js
-
-2.3.3 / 2015-09-19
-==================
-
- * [#1875] - Fix Markdown reporter exceeds maximum call stack size ([@danielstjules])
- * [#1864] - Fix xunit missing output with --reporter-options output ([@danielstjules])
- * [#1846] - Support all harmony flags ([@danielstjules])
- * Fix fragile xunit reporter spec ([@danielstjules])
- * [#1669] - Fix catch uncaught errors outside test suite execution ([@danielstjules])
- * [#1868] - Revert jade to support npm < v1.3.7 ([@danielstjules])
- * [#1766] - Don't remove modules/components from stack trace in the browser ([@danielstjules])
- * [#1798] - Fix correctly attribute mutiple done err with hooks ([@danielstjules])
- * Fix use utils.reduce for IE8 compatibility ([@wsw0108])
- * Some linting errors fixed by [@danielstjules]
- * Call the inspect() function if message is not set ([@kevinburke])
-
-[#1875]: https://github.com/mochajs/mocha/issues/1875
-[#1864]: https://github.com/mochajs/mocha/issues/1864
-[#1846]: https://github.com/mochajs/mocha/issues/1846
-[#1669]: https://github.com/mochajs/mocha/issues/1669
-[#1868]: https://github.com/mochajs/mocha/issues/1868
-[#1766]: https://github.com/mochajs/mocha/issues/1766
-[#1798]: https://github.com/mochajs/mocha/issues/1798
-[@danielstjules]: https://github.com/danielstjules
-[@wsw0108]: https://github.com/wsw0108
-[@kevinburke]: https://github.com/kevinburke
-
-2.3.2 / 2015-09-07
-==================
- * [#1868] - Fix compatibility with older versions of NPM ([@boneskull])
-
- [#1868]: https://github.com/mochajs/mocha/issues/1868
-
-2.3.1 / 2015-09-06
-==================
-
- * [#1812] - Fix: Bail flag causes before() hooks to be run even after a failure ([@aaroncrows])
-
- [#1812]: https://github.com/mochajs/mocha/issues/1812
- [aaroncrows]: https://github.com/aaroncrows
-
-2.3.0 / 2015-08-30
-==================
-
- * [#553] - added --allowUncaught option ([@amsul])
- * [#1490] - Allow --async-only to be satisfied by returning a promise ([@jlai])
- * [#1829] - support --max-old-space-size ([@gigadude])
- * [#1811] - upgrade Jade dependency ([@outsideris])
- * [#1769] - Fix async hook error handling ([@ajaykodali])
- * [#1230] - More descriptive beforeEach/afterEach messages ([@duncanbeevers])
- * [#1787] - Scope loading behaviour instead of using early return ([@aryeguy])
- * [#1789] - Fix: html-runner crashing ([@sunesimonsen])
- * [#1749] - Fix maximum call stack error on large amount of tests ([@tinganho])
- * [#1230] - Decorate failed hook titles with test title ([@duncanbeevers])
- * [#1260] - Build using Browserify ([@ndhoule])
- * [#1728] - Don't use `__proto__` ([@ndhoule])
- * [#1781] - Fix hook error tests ([@glenjamin])
- * [#1754] - Allow boolean --reporter-options ([@papandreou])
- * [#1766] - Fix overly aggressive stack suppression ([@moll])
- * [#1752] - Avoid potential infinite loop ([@gsilk])
- * [#1761] - Fix problems running under PhantomJS ([@chromakode])
- * [#1700] - Fix more problems running under PhantomJS ([@jbnicolai])
- * [#1774] - Support escaped spaces in CLI options ([@adamgruber])
- * [#1687] - Fix HTML reporter links with special chars ([@benvinegar])
- * [#1359] - Adopt code style and enforce it using ESLint ([@ndhoule] w/ assist from [@jbnicolai] & [@boneskull])
- * various refactors ([@jbnicolai])
- * [#1758] - Add cross-frame compatible Error checking ([@outdooricon])
- * [#1741] - Remove moot `version` property from bower.json ([@kkirsche])
- * [#1739] - Improve `HISTORY.md` ([@rstacruz])
- * [#1730] - Support more io.js flags ([@ryedog])
- * [#1349] - Allow HTML in HTML reporter errors ([@papandreou] / [@sunesimonsen])
- * [#1572] - Prevent default browser behavior for failure/pass links ([@jschilli])
- * [#1630] - Support underscored harmony flags ([@dominicbarnes])
- * [#1718] - Support more harmony flags ([@slyg])
- * [#1689] - Add stack to JSON-stream reporter ([@jonathandelgado])
- * [#1654] - Fix `ReferenceError` "location is not defined" ([@jakemmarsh])
-
- [#553]: https://github.com/mochajs/mocha/issues/553
- [#1490]: https://github.com/mochajs/mocha/issues/1490
- [#1829]: https://github.com/mochajs/mocha/issues/1829
- [#1811]: https://github.com/mochajs/mocha/issues/1811
- [#1769]: https://github.com/mochajs/mocha/issues/1769
- [#1230]: https://github.com/mochajs/mocha/issues/1230
- [#1787]: https://github.com/mochajs/mocha/issues/1787
- [#1789]: https://github.com/mochajs/mocha/issues/1789
- [#1749]: https://github.com/mochajs/mocha/issues/1749
- [#1230]: https://github.com/mochajs/mocha/issues/1230
- [#1260]: https://github.com/mochajs/mocha/issues/1260
- [#1728]: https://github.com/mochajs/mocha/issues/1728
- [#1781]: https://github.com/mochajs/mocha/issues/1781
- [#1754]: https://github.com/mochajs/mocha/issues/1754
- [#1766]: https://github.com/mochajs/mocha/issues/1766
- [#1752]: https://github.com/mochajs/mocha/issues/1752
- [#1761]: https://github.com/mochajs/mocha/issues/1761
- [#1700]: https://github.com/mochajs/mocha/issues/1700
- [#1774]: https://github.com/mochajs/mocha/issues/1774
- [#1687]: https://github.com/mochajs/mocha/issues/1687
- [#1359]: https://github.com/mochajs/mocha/issues/1359
- [#1758]: https://github.com/mochajs/mocha/issues/1758
- [#1741]: https://github.com/mochajs/mocha/issues/1741
- [#1739]: https://github.com/mochajs/mocha/issues/1739
- [#1730]: https://github.com/mochajs/mocha/issues/1730
- [#1349]: https://github.com/mochajs/mocha/issues/1349
- [#1572]: https://github.com/mochajs/mocha/issues/1572
- [#1630]: https://github.com/mochajs/mocha/issues/1630
- [#1718]: https://github.com/mochajs/mocha/issues/1718
- [#1689]: https://github.com/mochajs/mocha/issues/1689
- [#1654]: https://github.com/mochajs/mocha/issues/1654
- [@adamgruber]: https://github.com/adamgruber
- [@ajaykodali]: https://github.com/ajaykodali
- [@amsul]: https://github.com/amsul
- [@aryeguy]: https://github.com/aryeguy
- [@benvinegar]: https://github.com/benvinegar
- [@boneskull]: https://github.com/boneskull
- [@chromakode]: https://github.com/chromakode
- [@dominicbarnes]: https://github.com/dominicbarnes
- [@duncanbeevers]: https://github.com/duncanbeevers
- [@gigadude]: https://github.com/gigadude
- [@glenjamin]: https://github.com/glenjamin
- [@gsilk]: https://github.com/gsilk
- [@jakemmarsh]: https://github.com/jakemmarsh
- [@jbnicolai]: https://github.com/jbnicolai
- [@jlai]: https://github.com/jlai
- [@jonathandelgado]: https://github.com/jonathandelgado
- [@jschilli]: https://github.com/jschilli
- [@kkirsche]: https://github.com/kkirsche
- [@moll]: https://github.com/moll
- [@ndhoule]: https://github.com/ndhoule
- [@outdooricon]: https://github.com/outdooricon
- [@outsideris]: https://github.com/outsideris
- [@papandreou]: https://github.com/papandreou
- [@rstacruz]: https://github.com/rstacruz
- [@ryedog]: https://github.com/ryedog
- [@slyg]: https://github.com/slyg
- [@sunesimonsen]: https://github.com/sunesimonsen
- [@tinganho]: https://github.com/tinganho
-
-2.2.5 / 2015-05-14
-==================
-
- * [#1699] - Upgrade jsdiff to v1.4.0 ([@nylen])
- * [#1648] - fix diff background colors in the console ([@nylen])
- * [#1327] - fix tests running twice, a regression issue. ([#1686], [@danielstjules])
- * [#1675] - add integration tests ([@danielstjules])
- * [#1682] - use a valid SPDX license identifier in package.json ([@kemitchell])
- * [#1660] - fix assertion of invalid dates ([#1661], [@a8m])
- * [#1241] - fix issue with multiline diffs appearing as single line ([#1655], [@a8m])
-
-[#1699]: https://github.com/mochajs/mocha/issues/1699
-[#1648]: https://github.com/mochajs/mocha/issues/1648
-[#1327]: https://github.com/mochajs/mocha/issues/1327
-[#1686]: https://github.com/mochajs/mocha/issues/1686
-[#1675]: https://github.com/mochajs/mocha/issues/1675
-[#1682]: https://github.com/mochajs/mocha/issues/1682
-[#1660]: https://github.com/mochajs/mocha/issues/1660
-[#1661]: https://github.com/mochajs/mocha/issues/1661
-[#1241]: https://github.com/mochajs/mocha/issues/1241
-[#1655]: https://github.com/mochajs/mocha/issues/1655
-[@nylen]: https://github.com/nylen
-[@danielstjules]: https://github.com/danielstjules
-[@kemitchell]: https://github.com/kemitchell
-[@a8m]: https://github.com/a8m
-
-2.2.4 / 2015-04-08
-==================
-
- * Load mocha.opts in _mocha for now (close #1645)
-
-2.2.3 / 2015-04-07
-==================
-
- * fix(reporter/base): string diff - issue #1241
- * fix(reporter/base): string diff - issue #1241
- * fix(reporter/base): don't show diffs for errors without expectation
- * fix(reporter/base): don't assume error message is first line of stack
- * improve: dry up reporter/base test
- * fix(reporter/base): explicitly ignore showDiff #1614
- * Add iojs to travis build
- * Pass `--allow-natives-syntax` flag to node.
- * Support --harmony_classes flag for io.js
- * Fix 1556: Update utils.clean to handle newlines in func declarations
- * Fix 1606: fix err handling in IE <= 8 and non-ES5 browsers
- * Fix 1585: make _mocha executable again
- * chore(package.json): add a8m as a contributor
- * Fixed broken link on html-cov reporter
- * support --es_staging flag
- * fix issue where menu overlaps content.
- * update contributors in package.json
- * Remove trailing whitespace from reporter output
- * Remove contributors list from readme
- * log third-party reporter errors
- * [Fix] Exclude not own properties when looping on options
- * fix: support node args in mocha.opts (close #1573)
- * fix(reporter/base): string diff - issue #1241
-
-2.2.1 / 2015-03-09
-==================
-
- * Fix passing of args intended for node/iojs.
-
-2.2.0 / 2015-03-06
-==================
-
- * Update mocha.js
- * Add --fgrep. Use grep for RegExp, fgrep for str
- * Ignore async global errors after spec resolution
- * Fixing errors that prevent mocha.js from loading in the browser - fixes #1558
- * fix(utils): issue #1558 + make
- * add ability to delay root suite; closes #362, closes #1124
- * fix insanity in http tests
- * update travis: add node 0.12, add gitter, remove slack
- * building
- * resolve #1548: ensure the environment's "node" executable is used
- * reporters/base: use supports-color to detect colorable term
- * travis: use docker containers
- * small fix: commander option for --expose-gc
- * Ignore asynchronous errors after global failure
- * Improve error output when a test fails with a non-error
- * updated travis badge, uses svg instead of img
- * Allow skip from test context for #332
- * [JSHINT] Unnecessary semicolon fixed in bin/_mocha
- * Added a reminder about the done() callback to test timeout error messages
- * fixes #1496, in Mocha.run(fn), check if fn exists before executing it, added tests too
- * Add Harmony Proxy flag for iojs
- * test(utils|ms|*): test existing units
- * add support for some iojs flags
- * fix(utils.stringify): issue #1229, diff viewer
- * Remove slack link
- * Prevent multiple 'grep=' querystring params in html reporter
- * Use grep as regexp (close #1381)
- * utils.stringify should handle objects without an Object prototype
- * in runnable test, comparing to undefined error's message rather than a literal
- * Fix test running output truncation on async STDIO
- * ammended for deprecated customFds option in child_process
-
-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-3.1.0/CONTRIBUTING.md b/tests/lib/mocha-3.1.0/CONTRIBUTING.md
deleted file mode 100644
index 6d172f0800..0000000000
--- a/tests/lib/mocha-3.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-3.1.0/LICENSE b/tests/lib/mocha-3.1.0/LICENSE
deleted file mode 100644
index 9919641276..0000000000
--- a/tests/lib/mocha-3.1.0/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-(The MIT License)
-
-Copyright (c) 2011-2016 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
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/tests/lib/mocha-3.1.0/Makefile b/tests/lib/mocha-3.1.0/Makefile
deleted file mode 100644
index 25d84f5c1d..0000000000
--- a/tests/lib/mocha-3.1.0/Makefile
+++ /dev/null
@@ -1,176 +0,0 @@
-BROWSERIFY := "node_modules/.bin/browserify"
-ESLINT := "node_modules/.bin/eslint"
-KARMA := "node_modules/.bin/karma"
-MOCHA := "bin/mocha"
-
-REPORTER ?= spec
-TM_BUNDLE = JavaScript\ mocha.tmbundle
-SRC = $(shell find lib -name "*.js" -type f | sort)
-TESTS = $(shell find test -name "*.js" -type f | sort)
-
-all: mocha.js
-
-mocha.js: $(SRC) browser-entry.js
- @printf "==> [Browser :: build]\n"
- $(BROWSERIFY) ./browser-entry \
- --plugin ./scripts/dedefine \
- --ignore 'fs' \
- --ignore 'glob' \
- --ignore 'path' \
- --ignore 'supports-color' > $@
-
-clean:
- @printf "==> [Clean]\n"
- rm -f mocha.js
-
-lint:
- @printf "==> [Test :: Lint]\n"
- $(ESLINT) browser-entry.js index.js karma.conf.js bin/mocha bin/_mocha "lib/**/*.js" "scripts/**/*.js" test
-
-test-node: test-bdd test-tdd test-qunit test-exports test-unit test-integration test-jsapi test-compilers test-glob test-requires test-reporters test-only test-global-only
-
-test-browser: clean mocha.js test-browser-unit test-browser-bdd test-browser-qunit test-browser-tdd test-browser-exports
-
-test: lint test-node test-browser
-
-test-browser-unit:
- @printf "==> [Test :: Browser]\n"
- NODE_PATH=. $(KARMA) start --single-run
-
-test-browser-bdd:
- @printf "==> [Test :: Browser :: BDD]\n"
- MOCHA_UI=bdd $(MAKE) test-browser-unit
-
-test-browser-qunit:
- @printf "==> [Test :: Browser :: QUnit]\n"
- MOCHA_UI=qunit $(MAKE) test-browser-unit
-
-test-browser-tdd:
- @printf "==> [Test :: Browser :: TDD]\n"
- MOCHA_UI=tdd $(MAKE) test-browser-unit
-
-test-jsapi:
- @printf "==> [Test :: JS API]\n"
- node test/jsapi
-
-test-unit:
- @printf "==> [Test :: Unit]\n"
- $(MOCHA) --reporter $(REPORTER) \
- test/acceptance/*.js \
- --growl \
- test/*.js
-
-test-integration:
- @printf "==> [Test :: Integrations]\n"
- $(MOCHA) --timeout 5000 \
- --reporter $(REPORTER) \
- test/integration/*.js
-
-test-compilers:
- @printf "==> [Test :: Compilers]\n"
- $(MOCHA) --reporter $(REPORTER) \
- --compilers coffee:coffee-script/register,foo:./test/compiler/foo \
- test/acceptance/test.coffee \
- test/acceptance/test.foo
-
-test-requires:
- @printf "==> [Test :: Requires]\n"
- $(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.spec.js
-
-test-bdd:
- @printf "==> [Test :: BDD]\n"
- $(MOCHA) --reporter $(REPORTER) \
- --ui bdd \
- test/acceptance/interfaces/bdd.spec
-
-test-tdd:
- @printf "==> [Test :: TDD]\n"
- $(MOCHA) --reporter $(REPORTER) \
- --ui tdd \
- test/acceptance/interfaces/tdd.spec
-
-test-qunit:
- @printf "==> [Test :: QUnit]\n"
- $(MOCHA) --reporter $(REPORTER) \
- --ui qunit \
- test/acceptance/interfaces/qunit.spec
-
-test-exports:
- @printf "==> [Test :: Exports]\n"
- $(MOCHA) --reporter $(REPORTER) \
- --ui exports \
- test/acceptance/interfaces/exports.spec
-
-test-glob:
- @printf "==> [Test :: Glob]\n"
- bash ./test/acceptance/glob/glob.sh
-
-test-reporters:
- @printf "==> [Test :: Reporters]\n"
- $(MOCHA) --reporter $(REPORTER) \
- test/reporters/*.js
-
-test-only:
- @printf "==> [Test :: Only]\n"
- $(MOCHA) --reporter $(REPORTER) \
- --ui tdd \
- test/acceptance/misc/only/tdd.spec
-
- $(MOCHA) --reporter $(REPORTER) \
- --ui bdd \
- test/acceptance/misc/only/bdd.spec
-
- $(MOCHA) --reporter $(REPORTER) \
- --ui qunit \
- test/acceptance/misc/only/bdd-require.spec
-
-test-global-only:
- @printf "==> [Test :: Global Only]\n"
- $(MOCHA) --reporter $(REPORTER) \
- --ui tdd \
- test/acceptance/misc/only/global/tdd.spec
-
- $(MOCHA) --reporter $(REPORTER) \
- --ui bdd \
- test/acceptance/misc/only/global/bdd.spec
-
- $(MOCHA) --reporter $(REPORTER) \
- --ui qunit \
- test/acceptance/misc/only/global/qunit.spec
-
-test-mocha:
- @printf "==> [Test :: Mocha]\n"
- $(MOCHA) --reporter $(REPORTER) \
- test/mocha
-
-non-tty:
- @printf "==> [Test :: Non-TTY]\n"
- $(MOCHA) --reporter dot \
- test/acceptance/interfaces/bdd.spec 2>&1 > /tmp/dot.out
-
- @echo dot:
- @cat /tmp/dot.out
-
- $(MOCHA) --reporter list \
- test/acceptance/interfaces/bdd.spec 2>&1 > /tmp/list.out
-
- @echo list:
- @cat /tmp/list.out
-
- $(MOCHA) --reporter spec \
- test/acceptance/interfaces/bdd.spec 2>&1 > /tmp/spec.out
-
- @echo spec:
- @cat /tmp/spec.out
-
-tm:
- @printf "==> [TM]\n"
- open editors/$(TM_BUNDLE)
-
-.PHONY: test-jsapi test-compilers watch test test-node test-bdd test-tdd test-qunit test-exports test-unit test-integration non-tty tm clean test-browser test-browser-unit test-browser-bdd test-browser-qunit test-browser-tdd test-browser-exports lint test-only test-global-only
diff --git a/tests/lib/mocha-3.1.0/README.md b/tests/lib/mocha-3.1.0/README.md
deleted file mode 100644
index e2d0bb998a..0000000000
--- a/tests/lib/mocha-3.1.0/README.md
+++ /dev/null
@@ -1,84 +0,0 @@
-<br><br>
-<p align="center">
- <img src="https://cldup.com/xFVFxOioAU.svg" alt="Mocha test framework"/>
-</p>
-<br><br>
-
-[![Build Status](https://api.travis-ci.org/mochajs/mocha.svg?branch=master)](http://travis-ci.org/mochajs/mocha) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mochajs/mocha?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-[![OpenCollective](https://opencollective.com/mochajs/backers/badge.svg)](#backers)
-[![OpenCollective](https://opencollective.com/mochajs/sponsors/badge.svg)](#sponsors)
-
- 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
-
- - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- - [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)
-
-
-## Backers
-
-[Become a backer]((https://opencollective.com/mochajs#backer)) and show your support to our open source project.
-
-<a href="https://opencollective.com/mochajs/backer/0/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/0/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/1/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/1/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/2/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/2/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/3/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/3/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/4/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/4/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/5/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/5/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/6/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/6/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/7/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/7/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/8/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/8/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/9/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/9/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/10/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/10/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/11/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/11/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/12/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/12/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/13/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/13/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/14/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/14/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/15/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/15/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/16/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/16/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/17/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/17/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/18/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/18/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/19/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/19/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/20/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/20/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/21/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/21/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/22/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/22/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/23/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/23/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/24/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/24/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/25/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/25/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/26/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/26/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/27/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/27/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/28/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/28/avatar"></a>
-<a href="https://opencollective.com/mochajs/backer/29/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/29/avatar"></a>
-
-
-## Sponsors
-
-Does your company use Mocha? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time for maintenance and new features for everyone. Also, your company's logo will show [on GitHub](https://github.com/mochajs/mocha#readme) and on [our site](https://mochajs.org)--who doesn't want a little extra exposure? [Here's the info](https://opencollective.com/mochajs#sponsor).
-
-<a href="https://opencollective.com/mochajs/sponsor/0/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/0/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/1/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/1/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/2/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/2/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/3/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/3/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/4/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/4/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/5/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/5/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/6/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/6/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/7/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/7/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/8/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/8/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/9/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/9/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/10/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/10/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/11/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/11/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/12/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/12/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/13/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/13/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/14/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/14/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/15/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/15/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/16/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/16/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/17/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/17/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/18/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/18/avatar"></a>
-<a href="https://opencollective.com/mochajs/sponsor/19/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/19/avatar"></a>
-
-## License
-
-MIT
diff --git a/tests/lib/mocha-3.1.0/appveyor.yml b/tests/lib/mocha-3.1.0/appveyor.yml
deleted file mode 100644
index 539b8b073d..0000000000
--- a/tests/lib/mocha-3.1.0/appveyor.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-environment:
- matrix:
- - nodejs_version: '6'
- - nodejs_version: '4'
- - nodejs_version: '0.12'
- - nodejs_version: '0.10'
-install:
- - ps: Install-Product node $env:nodejs_version
- - set CI=true
- - set PATH=%APPDATA%\npm;c:\MinGW\bin;%PATH%
- - set PHANTOMJS_CDNURL=https://cnpmjs.org/downloads
- - npm install
- - copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe
-matrix:
- fast_finish: true
-build: off
-version: '{build}'
-shallow_clone: true
-clone_depth: 1
-test_script:
- - node --version
- - npm --version
- - npm test
-skip_commits:
- message: /\[ci\s+skip\]/
-
diff --git a/tests/lib/mocha-3.1.0/assets/mocha-banner-192.png b/tests/lib/mocha-3.1.0/assets/mocha-banner-192.png
deleted file mode 100644
index 15e076e119..0000000000
--- a/tests/lib/mocha-3.1.0/assets/mocha-banner-192.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/mocha-3.1.0/assets/mocha-banner.svg b/tests/lib/mocha-3.1.0/assets/mocha-banner.svg
deleted file mode 100644
index 9f54009600..0000000000
--- a/tests/lib/mocha-3.1.0/assets/mocha-banner.svg
+++ /dev/null
@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- version="1.1"
- id="Layer_1"
- x="0px"
- y="0px"
- viewBox="0 0 384.90259 191.99999"
- enable-background="new 0 0 193 208"
- xml:space="preserve"
- inkscape:version="0.91 r13725"
- sodipodi:docname="mocha-banner.svg"
- width="384.90259"
- height="192"
- inkscape:export-filename="/Users/boneskull/Downloads/mocha-banner-192.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90"><title
- id="title4160">Mocha Logo</title><metadata
- id="metadata32"><rdf:RDF><cc:Work
- rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>Mocha Logo</dc:title><dc:date>08-21-2015</dc:date><dc:creator><cc:Agent><dc:title>Dick DeLeon &lt;ddeleon@decipherinc.com&gt;</dc:title></cc:Agent></dc:creator><dc:rights><cc:Agent><dc:title>CC BY-SA 4.0</dc:title></cc:Agent></dc:rights><dc:subject><rdf:Bag><rdf:li>mocha</rdf:li><rdf:li>mochajs</rdf:li></rdf:Bag></dc:subject><dc:contributor><cc:Agent><dc:title>Christopher Hiller &lt;boneskull@boneskull.com&gt;</dc:title></cc:Agent></dc:contributor><cc:license
- rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" /></cc:Work><cc:License
- rdf:about="http://creativecommons.org/licenses/by-sa/3.0/"><cc:permits
- rdf:resource="http://creativecommons.org/ns#Reproduction" /><cc:permits
- rdf:resource="http://creativecommons.org/ns#Distribution" /><cc:requires
- rdf:resource="http://creativecommons.org/ns#Notice" /><cc:requires
- rdf:resource="http://creativecommons.org/ns#Attribution" /><cc:permits
- rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /><cc:requires
- rdf:resource="http://creativecommons.org/ns#ShareAlike" /></cc:License></rdf:RDF></metadata><defs
- id="defs30" /><sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10000"
- gridtolerance="10000"
- guidetolerance="10000"
- inkscape:pageopacity="1"
- inkscape:pageshadow="2"
- inkscape:window-width="1920"
- inkscape:window-height="1031"
- id="namedview28"
- showgrid="false"
- fit-margin-top="5"
- fit-margin-left="5"
- fit-margin-right="5"
- fit-margin-bottom="5"
- inkscape:zoom="1"
- inkscape:cx="-211.59419"
- inkscape:cy="96.021558"
- inkscape:window-x="1360"
- inkscape:window-y="23"
- inkscape:window-maximized="0"
- inkscape:current-layer="g13-0"
- showguides="true"
- inkscape:guide-bbox="true"
- inkscape:snap-path-clip="true"
- inkscape:snap-path-mask="true"
- inkscape:snap-text-baseline="false"><sodipodi:guide
- position="178.24489,-94.11572"
- orientation="1,0"
- id="guide4358" /></sodipodi:namedview><path
- id="XMLID_229_"
- d="m 156.71875,146.01685 -68.70282,39.69498 c -2.958045,1.71756 -6.584028,1.71756 -9.542066,0 L 9.77103,146.01685 C 6.812992,144.29928 5,141.1504 5,137.81068 L 5,58.420744 C 5,54.985602 6.812992,51.932143 9.77103,50.214572 L 78.473864,10.5196 c 2.958038,-1.7175702 6.584021,-1.7175702 9.542056,0 l 68.70282,39.694972 c 2.95804,1.717571 4.77104,4.866451 4.77104,8.206172 l 0,79.389936 c -0.0954,3.33972 -1.90842,6.4886 -4.77104,8.20617 z"
- inkscape:connector-curvature="0"
- style="clip-rule:evenodd;fill:#8d6748;fill-rule:evenodd" /><path
- id="XMLID_262_"
- d="m 83.149473,24.164747 0,0 c 0.954207,0 1.812992,0.286262 2.671781,0.763365 l 59.351606,34.255996 c 1.62216,0.954206 2.67177,2.767198 2.67177,4.67561 l 0,68.511982 c 0,1.90842 -1.04962,3.72141 -2.67177,4.67562 l -59.351606,34.25599 c -0.858789,0.47711 -1.717574,0.76336 -2.671781,0.76336 -0.954206,0 -1.908412,-0.28625 -2.671777,-0.76336 L 21.126082,137.04732 c -1.62215,-0.95421 -2.671778,-2.7672 -2.671778,-4.67562 l 0,-68.511982 c 0,-1.908412 1.049628,-3.721404 2.671778,-4.67561 L 80.477696,24.928112 c 0.858785,-0.477103 1.812992,-0.763365 2.671777,-0.763365 m 0,-2.862618 c -1.431309,0 -2.862618,0.381683 -4.103085,1.145048 L 19.694773,56.703173 c -2.576357,1.431309 -4.103086,4.198506 -4.103086,7.061124 l 0,68.511993 c 0,2.95803 1.526729,5.62981 4.103086,7.06112 l 59.351615,34.25599 c 1.240467,0.76337 2.671776,1.14506 4.103085,1.14506 1.431309,0 2.862617,-0.38169 4.103097,-1.14506 l 59.35159,-34.25599 c 2.57636,-1.43131 4.10309,-4.1985 4.10309,-7.06112 l 0,-68.511993 c 0,-2.958038 -1.52673,-5.629815 -4.10309,-7.061124 L 87.25257,22.447177 c -1.24048,-0.763365 -2.671788,-1.145048 -4.103097,-1.145048 l 0,0 z"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><g
- id="XMLID_228_"
- transform="matrix(0.95420602,0,0,0.95420602,-7.2615534,-2.6484425)"><g
- id="XMLID_223_"><g
- id="XMLID_295_"><path
- d="m 103.6,69.6 c 0,-0.5 -0.4,-1 -1,-1 l -9.4,0 -9.4,0 c -0.5,0 -1,0.4 -1,1 0,3.4 0.5,15.1 5.5,20.8 0.2,0.2 0.4,0.3 0.7,0.3 l 8.4,0 c 0.3,0 0.5,-0.1 0.7,-0.3 5,-5.6 5.5,-17.3 5.5,-20.8 z m -7.4,18.2 -5.9,0 c -0.3,0 -0.5,-0.1 -0.7,-0.3 -3.4,-4 -3.8,-12 -3.9,-14.8 0,-0.5 0.4,-1 1,-1 l 6.6,0 6.6,0 c 0.5,0 1,0.4 1,1 0,2.8 -0.5,10.7 -3.9,14.8 -0.3,0.2 -0.5,0.3 -0.8,0.3 z"
- id="path8"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /></g></g><path
- id="XMLID_225_"
- d="m 95.1,66.6 c 0,0 3.6,-2.1 1.4,-5.9 -1.3,-2 -1.9,-3.7 -1.4,-4.4 -1.3,1.6 -3.5,3.3 -1.1,6.9 0.8,0.9 1.2,2.8 1.1,3.4 z"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- id="XMLID_224_"
- d="m 91.1,66.9 c 0,0 2.4,-1.4 0.9,-4 -0.9,-1.3 -1.3,-2.5 -0.9,-2.9 -0.9,1.1 -2.3,2.2 -0.7,4.7 0.5,0.5 0.7,1.8 0.7,2.2 z"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- id="XMLID_227_"
- d="m 99.3,78.5 c -0.4,2.7 -1.2,5.8 -2.9,7.8 -0.2,0.2 -0.4,0.3 -0.6,0.3 l -5,0 c -0.2,0 -0.5,-0.1 -0.6,-0.3 -1.2,-1.5 -2,-3.5 -2.5,-5.6 0,0 5.8,0.8 9.1,-0.4 2.4,-0.9 2.5,-1.8 2.5,-1.8 z"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /></g><g
- id="g13"
- transform="matrix(0.95420602,0,0,0.95420602,-7.2615534,-2.6484425)"><path
- d="m 33.6,94.7 3.7,0 6.1,9.4 6.1,-9.4 3.7,0 0,20 -3.5,0 0,-14.3 -6.3,9.4 -0.1,0 -6.2,-9.3 0,14.3 -3.5,0 0,-20.1 z"
- id="path15"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- d="m 71.3,115 c -1.5,0 -2.9,-0.3 -4.2,-0.8 -1.3,-0.5 -2.4,-1.3 -3.3,-2.2 -0.9,-0.9 -1.6,-2 -2.1,-3.3 -0.5,-1.2 -0.8,-2.6 -0.8,-4 l 0,-0.1 c 0,-1.4 0.3,-2.7 0.8,-4 0.5,-1.2 1.2,-2.3 2.2,-3.3 0.9,-0.9 2,-1.7 3.3,-2.2 1.3,-0.6 2.7,-0.8 4.2,-0.8 1.5,0 2.9,0.3 4.2,0.8 1.3,0.5 2.4,1.3 3.3,2.2 0.9,0.9 1.6,2 2.1,3.3 0.5,1.2 0.8,2.6 0.8,4 l 0,0.1 c 0,1.4 -0.3,2.7 -0.8,4 -0.5,1.2 -1.2,2.3 -2.2,3.3 -0.9,0.9 -2,1.7 -3.3,2.2 -1.3,0.6 -2.7,0.8 -4.2,0.8 z m 0,-3.2 c 1,0 1.9,-0.2 2.7,-0.6 0.8,-0.4 1.5,-0.9 2.1,-1.5 0.6,-0.6 1,-1.4 1.4,-2.2 0.3,-0.9 0.5,-1.8 0.5,-2.7 l 0,-0.1 c 0,-1 -0.2,-1.9 -0.5,-2.8 -0.3,-0.9 -0.8,-1.6 -1.4,-2.3 -0.6,-0.6 -1.3,-1.1 -2.1,-1.5 -0.8,-0.4 -1.7,-0.6 -2.7,-0.6 -1,0 -1.9,0.2 -2.7,0.6 -0.8,0.4 -1.5,0.9 -2.1,1.5 -0.6,0.6 -1,1.4 -1.4,2.2 -0.3,0.9 -0.5,1.8 -0.5,2.7 l 0,0.1 c 0,1 0.2,1.9 0.5,2.8 0.3,0.9 0.8,1.6 1.4,2.3 0.6,0.6 1.3,1.1 2.1,1.5 0.8,0.4 1.8,0.6 2.7,0.6 z"
- id="path17"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- d="m 98.7,115 c -1.5,0 -2.8,-0.3 -4,-0.8 -1.2,-0.5 -2.3,-1.3 -3.2,-2.2 -0.9,-0.9 -1.6,-2 -2.1,-3.3 -0.5,-1.3 -0.8,-2.6 -0.8,-4 l 0,-0.1 c 0,-1.4 0.3,-2.8 0.8,-4 0.5,-1.2 1.2,-2.3 2.1,-3.3 0.9,-0.9 2,-1.7 3.3,-2.2 1.3,-0.5 2.6,-0.8 4.2,-0.8 0.9,0 1.7,0.1 2.5,0.2 0.8,0.2 1.4,0.4 2.1,0.6 0.6,0.3 1.2,0.6 1.7,1 0.5,0.4 1,0.8 1.5,1.3 l -2.3,2.6 c -0.8,-0.7 -1.6,-1.3 -2.5,-1.8 -0.9,-0.5 -1.9,-0.7 -3.1,-0.7 -1,0 -1.8,0.2 -2.6,0.6 -0.8,0.4 -1.5,0.9 -2.1,1.5 -0.6,0.6 -1,1.4 -1.4,2.2 -0.3,0.9 -0.5,1.8 -0.5,2.7 l 0,0.1 c 0,1 0.2,1.9 0.5,2.8 0.3,0.9 0.8,1.6 1.4,2.3 0.6,0.6 1.3,1.2 2.1,1.5 0.8,0.3 1.7,0.6 2.6,0.6 1.2,0 2.3,-0.2 3.1,-0.7 0.8,-0.5 1.7,-1.1 2.6,-1.9 l 2.3,2.3 c -0.5,0.6 -1,1 -1.6,1.5 -0.6,0.5 -1.2,0.8 -1.8,1.1 -0.6,0.3 -1.4,0.6 -2.1,0.7 -0.9,0.2 -1.8,0.2 -2.7,0.2 z"
- id="path19"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- d="m 113.9,94.7 3.5,0 0,8.3 9.6,0 0,-8.3 3.5,0 0,20 -3.5,0 0,-8.4 -9.6,0 0,8.4 -3.5,0 0,-20 z"
- id="path21"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- d="m 146,94.6 3.2,0 8.8,20.1 -3.7,0 -2,-4.8 -9.4,0 -2.1,4.8 -3.6,0 8.8,-20.1 z m 5,12.2 -3.4,-8 -3.4,8 6.8,0 z"
- id="path23"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /></g><rect
- id="XMLID_444_"
- x="22.414255"
- y="112.81049"
- width="121.66127"
- height="1.0496266"
- style="fill:#ffffff" /><path
- id="XMLID_446_"
- d="m 144.07551,76.932341 -51.71797,0 c 0,0.381682 -0.0954,0.667943 -0.0954,1.049626 l 51.81338,0 0,-1.049626 z"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- id="XMLID_448_"
- d="m 22.414254,76.932341 0,1.049626 48.759928,0 c 0,-0.381683 -0.09542,-0.667944 -0.09542,-1.049626 l -48.664507,0 z"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><g
- id="g13-0"
- transform="matrix(0.95420602,0,0,0.95420602,90.83195,-0.74194725)"
- style="fill:#8d6748;fill-opacity:1"><text
- xml:space="preserve"
- style="font-style:normal;font-weight:normal;font-size:41.91966629px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- x="117.80782"
- y="99.410042"
- id="text4344"
- sodipodi:linespacing="125%"><tspan
- sodipodi:role="line"
- id="tspan4346"
- x="117.80782"
- y="99.410042" /></text>
-<text
- xml:space="preserve"
- style="font-style:italic;font-variant:normal;font-weight:300;font-stretch:normal;font-size:23.579813px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue, Light Italic';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#8d6748;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- x="92.403748"
- y="109.94498"
- id="text4348"
- sodipodi:linespacing="125%"><tspan
- sodipodi:role="line"
- id="tspan4350"
- x="92.403748"
- y="109.94498"
- style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:23.579813px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue, Light Italic';text-align:start;letter-spacing:0.52399588px;writing-mode:lr-tb;text-anchor:start;fill:#8d6748;fill-opacity:1"
- dx="4.114904e-08">simple, flexible, fun</tspan></text>
-</g></svg> \ No newline at end of file
diff --git a/tests/lib/mocha-3.1.0/assets/mocha-logo-128.png b/tests/lib/mocha-3.1.0/assets/mocha-logo-128.png
deleted file mode 100644
index d4dbf34603..0000000000
--- a/tests/lib/mocha-3.1.0/assets/mocha-logo-128.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/mocha-3.1.0/assets/mocha-logo-192.png b/tests/lib/mocha-3.1.0/assets/mocha-logo-192.png
deleted file mode 100644
index 69fbbff090..0000000000
--- a/tests/lib/mocha-3.1.0/assets/mocha-logo-192.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/mocha-3.1.0/assets/mocha-logo-64.png b/tests/lib/mocha-3.1.0/assets/mocha-logo-64.png
deleted file mode 100644
index 10403ff294..0000000000
--- a/tests/lib/mocha-3.1.0/assets/mocha-logo-64.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/mocha-3.1.0/assets/mocha-logo.svg b/tests/lib/mocha-3.1.0/assets/mocha-logo.svg
deleted file mode 100644
index e907e3167e..0000000000
--- a/tests/lib/mocha-3.1.0/assets/mocha-logo.svg
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- version="1.1"
- id="Layer_1"
- x="0px"
- y="0px"
- viewBox="0 0 192 191.99999"
- enable-background="new 0 0 193 208"
- xml:space="preserve"
- inkscape:version="0.91 r13725"
- sodipodi:docname="mocha-logo.svg"
- width="192"
- height="192"
- inkscape:export-filename="/Users/boneskull/Downloads/mocha-logo-192.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90"><title
- id="title4160">Mocha Logo</title><metadata
- id="metadata32"><rdf:RDF><cc:Work
- rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>Mocha Logo</dc:title><dc:date>08-21-2015</dc:date><dc:creator><cc:Agent><dc:title>Dick DeLeon &lt;ddeleon@decipherinc.com&gt;</dc:title></cc:Agent></dc:creator><dc:rights><cc:Agent><dc:title>CC BY-SA 4.0</dc:title></cc:Agent></dc:rights><dc:subject><rdf:Bag><rdf:li>mocha</rdf:li><rdf:li>mochajs</rdf:li></rdf:Bag></dc:subject><dc:contributor><cc:Agent><dc:title>Christopher Hiller &lt;boneskull@boneskull.com&gt;</dc:title></cc:Agent></dc:contributor><cc:license
- rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" /></cc:Work><cc:License
- rdf:about="http://creativecommons.org/licenses/by-sa/3.0/"><cc:permits
- rdf:resource="http://creativecommons.org/ns#Reproduction" /><cc:permits
- rdf:resource="http://creativecommons.org/ns#Distribution" /><cc:requires
- rdf:resource="http://creativecommons.org/ns#Notice" /><cc:requires
- rdf:resource="http://creativecommons.org/ns#Attribution" /><cc:permits
- rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /><cc:requires
- rdf:resource="http://creativecommons.org/ns#ShareAlike" /></cc:License></rdf:RDF></metadata><defs
- id="defs30" /><sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="1920"
- inkscape:window-height="1031"
- id="namedview28"
- showgrid="false"
- fit-margin-top="5"
- fit-margin-left="5"
- fit-margin-right="5"
- fit-margin-bottom="5"
- inkscape:zoom="1"
- inkscape:cx="96"
- inkscape:cy="98.137283"
- inkscape:window-x="1360"
- inkscape:window-y="23"
- inkscape:window-maximized="0"
- inkscape:current-layer="Layer_1" /><path
- id="XMLID_229_"
- d="m 169.47386,143.90113 -68.70282,39.69498 c -2.958045,1.71756 -6.584028,1.71756 -9.542066,0 L 22.52614,143.90113 c -2.958038,-1.71757 -4.77103,-4.86645 -4.77103,-8.20617 l 0,-79.389939 c 0,-3.435142 1.812992,-6.488601 4.77103,-8.206172 L 91.228974,8.403878 c 2.958038,-1.717571 6.584021,-1.717571 9.542056,0 l 68.70282,39.694971 c 2.95804,1.717571 4.77104,4.866451 4.77104,8.206172 l 0,79.389939 c -0.0954,3.33972 -1.90842,6.4886 -4.77104,8.20617 z"
- inkscape:connector-curvature="0"
- style="clip-rule:evenodd;fill:#8d6748;fill-rule:evenodd" /><path
- id="XMLID_262_"
- d="m 95.904583,22.049024 0,0 c 0.954207,0 1.812992,0.286262 2.671781,0.763365 l 59.351606,34.255996 c 1.62216,0.954206 2.67177,2.767198 2.67177,4.67561 l 0,68.511985 c 0,1.90842 -1.04962,3.72141 -2.67177,4.67562 l -59.351606,34.25599 c -0.858789,0.47711 -1.717574,0.76336 -2.671781,0.76336 -0.954206,0 -1.908412,-0.28625 -2.671777,-0.76336 L 33.881192,134.9316 c -1.62215,-0.95421 -2.671778,-2.7672 -2.671778,-4.67562 l 0,-68.511985 c 0,-1.908412 1.049628,-3.721404 2.671778,-4.67561 L 93.232806,22.812389 c 0.858785,-0.477103 1.812992,-0.763365 2.671777,-0.763365 m 0,-2.862618 c -1.431309,0 -2.862618,0.381683 -4.103085,1.145048 L 32.449883,54.58745 c -2.576357,1.431309 -4.103086,4.198506 -4.103086,7.061124 l 0,68.511996 c 0,2.95803 1.526729,5.62981 4.103086,7.06112 l 59.351615,34.25599 c 1.240467,0.76337 2.671776,1.14506 4.103085,1.14506 1.431309,0 2.862617,-0.38169 4.103097,-1.14506 l 59.35159,-34.25599 c 2.57636,-1.43131 4.10309,-4.1985 4.10309,-7.06112 l 0,-68.511996 c 0,-2.958038 -1.52673,-5.629815 -4.10309,-7.061124 L 100.00768,20.331454 C 98.7672,19.568089 97.335892,19.186406 95.904583,19.186406 l 0,0 z"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><g
- id="XMLID_228_"
- transform="matrix(0.95420602,0,0,0.95420602,5.4935566,-4.7641653)"><g
- id="XMLID_223_"><g
- id="XMLID_295_"><path
- d="m 103.6,69.6 c 0,-0.5 -0.4,-1 -1,-1 l -9.4,0 -9.4,0 c -0.5,0 -1,0.4 -1,1 0,3.4 0.5,15.1 5.5,20.8 0.2,0.2 0.4,0.3 0.7,0.3 l 8.4,0 c 0.3,0 0.5,-0.1 0.7,-0.3 5,-5.6 5.5,-17.3 5.5,-20.8 z m -7.4,18.2 -5.9,0 c -0.3,0 -0.5,-0.1 -0.7,-0.3 -3.4,-4 -3.8,-12 -3.9,-14.8 0,-0.5 0.4,-1 1,-1 l 6.6,0 6.6,0 c 0.5,0 1,0.4 1,1 0,2.8 -0.5,10.7 -3.9,14.8 -0.3,0.2 -0.5,0.3 -0.8,0.3 z"
- id="path8"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /></g></g><path
- id="XMLID_225_"
- d="m 95.1,66.6 c 0,0 3.6,-2.1 1.4,-5.9 -1.3,-2 -1.9,-3.7 -1.4,-4.4 -1.3,1.6 -3.5,3.3 -1.1,6.9 0.8,0.9 1.2,2.8 1.1,3.4 z"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- id="XMLID_224_"
- d="m 91.1,66.9 c 0,0 2.4,-1.4 0.9,-4 -0.9,-1.3 -1.3,-2.5 -0.9,-2.9 -0.9,1.1 -2.3,2.2 -0.7,4.7 0.5,0.5 0.7,1.8 0.7,2.2 z"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- id="XMLID_227_"
- d="m 99.3,78.5 c -0.4,2.7 -1.2,5.8 -2.9,7.8 -0.2,0.2 -0.4,0.3 -0.6,0.3 l -5,0 c -0.2,0 -0.5,-0.1 -0.6,-0.3 -1.2,-1.5 -2,-3.5 -2.5,-5.6 0,0 5.8,0.8 9.1,-0.4 2.4,-0.9 2.5,-1.8 2.5,-1.8 z"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /></g><g
- id="g13"
- transform="matrix(0.95420602,0,0,0.95420602,5.4935566,-4.7641653)"><path
- d="m 33.6,94.7 3.7,0 6.1,9.4 6.1,-9.4 3.7,0 0,20 -3.5,0 0,-14.3 -6.3,9.4 -0.1,0 -6.2,-9.3 0,14.3 -3.5,0 0,-20.1 z"
- id="path15"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- d="m 71.3,115 c -1.5,0 -2.9,-0.3 -4.2,-0.8 -1.3,-0.5 -2.4,-1.3 -3.3,-2.2 -0.9,-0.9 -1.6,-2 -2.1,-3.3 -0.5,-1.2 -0.8,-2.6 -0.8,-4 l 0,-0.1 c 0,-1.4 0.3,-2.7 0.8,-4 0.5,-1.2 1.2,-2.3 2.2,-3.3 0.9,-0.9 2,-1.7 3.3,-2.2 1.3,-0.6 2.7,-0.8 4.2,-0.8 1.5,0 2.9,0.3 4.2,0.8 1.3,0.5 2.4,1.3 3.3,2.2 0.9,0.9 1.6,2 2.1,3.3 0.5,1.2 0.8,2.6 0.8,4 l 0,0.1 c 0,1.4 -0.3,2.7 -0.8,4 -0.5,1.2 -1.2,2.3 -2.2,3.3 -0.9,0.9 -2,1.7 -3.3,2.2 -1.3,0.6 -2.7,0.8 -4.2,0.8 z m 0,-3.2 c 1,0 1.9,-0.2 2.7,-0.6 0.8,-0.4 1.5,-0.9 2.1,-1.5 0.6,-0.6 1,-1.4 1.4,-2.2 0.3,-0.9 0.5,-1.8 0.5,-2.7 l 0,-0.1 c 0,-1 -0.2,-1.9 -0.5,-2.8 -0.3,-0.9 -0.8,-1.6 -1.4,-2.3 -0.6,-0.6 -1.3,-1.1 -2.1,-1.5 -0.8,-0.4 -1.7,-0.6 -2.7,-0.6 -1,0 -1.9,0.2 -2.7,0.6 -0.8,0.4 -1.5,0.9 -2.1,1.5 -0.6,0.6 -1,1.4 -1.4,2.2 -0.3,0.9 -0.5,1.8 -0.5,2.7 l 0,0.1 c 0,1 0.2,1.9 0.5,2.8 0.3,0.9 0.8,1.6 1.4,2.3 0.6,0.6 1.3,1.1 2.1,1.5 0.8,0.4 1.8,0.6 2.7,0.6 z"
- id="path17"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- d="m 98.7,115 c -1.5,0 -2.8,-0.3 -4,-0.8 -1.2,-0.5 -2.3,-1.3 -3.2,-2.2 -0.9,-0.9 -1.6,-2 -2.1,-3.3 -0.5,-1.3 -0.8,-2.6 -0.8,-4 l 0,-0.1 c 0,-1.4 0.3,-2.8 0.8,-4 0.5,-1.2 1.2,-2.3 2.1,-3.3 0.9,-0.9 2,-1.7 3.3,-2.2 1.3,-0.5 2.6,-0.8 4.2,-0.8 0.9,0 1.7,0.1 2.5,0.2 0.8,0.2 1.4,0.4 2.1,0.6 0.6,0.3 1.2,0.6 1.7,1 0.5,0.4 1,0.8 1.5,1.3 l -2.3,2.6 c -0.8,-0.7 -1.6,-1.3 -2.5,-1.8 -0.9,-0.5 -1.9,-0.7 -3.1,-0.7 -1,0 -1.8,0.2 -2.6,0.6 -0.8,0.4 -1.5,0.9 -2.1,1.5 -0.6,0.6 -1,1.4 -1.4,2.2 -0.3,0.9 -0.5,1.8 -0.5,2.7 l 0,0.1 c 0,1 0.2,1.9 0.5,2.8 0.3,0.9 0.8,1.6 1.4,2.3 0.6,0.6 1.3,1.2 2.1,1.5 0.8,0.3 1.7,0.6 2.6,0.6 1.2,0 2.3,-0.2 3.1,-0.7 0.8,-0.5 1.7,-1.1 2.6,-1.9 l 2.3,2.3 c -0.5,0.6 -1,1 -1.6,1.5 -0.6,0.5 -1.2,0.8 -1.8,1.1 -0.6,0.3 -1.4,0.6 -2.1,0.7 -0.9,0.2 -1.8,0.2 -2.7,0.2 z"
- id="path19"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- d="m 113.9,94.7 3.5,0 0,8.3 9.6,0 0,-8.3 3.5,0 0,20 -3.5,0 0,-8.4 -9.6,0 0,8.4 -3.5,0 0,-20 z"
- id="path21"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- d="m 146,94.6 3.2,0 8.8,20.1 -3.7,0 -2,-4.8 -9.4,0 -2.1,4.8 -3.6,0 8.8,-20.1 z m 5,12.2 -3.4,-8 -3.4,8 6.8,0 z"
- id="path23"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /></g><rect
- id="XMLID_444_"
- x="35.169365"
- y="110.69476"
- width="121.66127"
- height="1.0496266"
- style="fill:#ffffff" /><path
- id="XMLID_446_"
- d="m 156.83062,74.816618 -51.71797,0 c 0,0.381682 -0.0954,0.667943 -0.0954,1.049626 l 51.81338,0 0,-1.049626 z"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /><path
- id="XMLID_448_"
- d="m 35.169364,74.816618 0,1.049626 48.759928,0 c 0,-0.381683 -0.09542,-0.667944 -0.09542,-1.049626 l -48.664507,0 z"
- inkscape:connector-curvature="0"
- style="fill:#ffffff" /></svg> \ No newline at end of file
diff --git a/tests/lib/mocha-3.1.0/bin/.eslintrc b/tests/lib/mocha-3.1.0/bin/.eslintrc
deleted file mode 100644
index db7424631c..0000000000
--- a/tests/lib/mocha-3.1.0/bin/.eslintrc
+++ /dev/null
@@ -1,3 +0,0 @@
----
-rules:
- no-process-exit: 0
diff --git a/tests/lib/mocha-3.1.0/bin/_mocha b/tests/lib/mocha-3.1.0/bin/_mocha
deleted file mode 100644
index 1d3539e8f0..0000000000
--- a/tests/lib/mocha-3.1.0/bin/_mocha
+++ /dev/null
@@ -1,543 +0,0 @@
-#!/usr/bin/env node
-
-/* eslint no-unused-vars: off */
-
-/**
- * Module dependencies.
- */
-
-var program = require('commander');
-var path = require('path');
-var fs = require('fs');
-var resolve = path.resolve;
-var exists = fs.existsSync || path.existsSync;
-var Mocha = require('../');
-var utils = Mocha.utils;
-var interfaceNames = Object.keys(Mocha.interfaces);
-var join = path.join;
-var cwd = process.cwd();
-var getOptions = require('./options');
-var mocha = new Mocha();
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-var Date = global.Date;
-var setTimeout = global.setTimeout;
-var setInterval = global.setInterval;
-var clearTimeout = global.clearTimeout;
-var clearInterval = global.clearInterval;
-
-/**
- * Files.
- */
-
-var files = [];
-
-/**
- * Globals.
- */
-
-var globals = [];
-
-/**
- * Requires.
- */
-
-var requires = [];
-
-/**
- * Images.
- */
-
-var images = {
- fail: path.join(__dirname, '..', 'images', 'error.png'),
- pass: path.join(__dirname, '..', 'images', 'ok.png')
-};
-
-// options
-
-program
- .version(JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')).version)
- .usage('[debug] [options] [files]')
- .option('-A, --async-only', 'force all tests to take a callback (async) or return a promise')
- .option('-c, --colors', 'force enabling of colors')
- .option('-C, --no-colors', 'force disabling of colors')
- .option('-G, --growl', 'enable growl notification support')
- .option('-O, --reporter-options <k=v,k2=v2,...>', 'reporter-specific options')
- .option('-R, --reporter <name>', 'specify the reporter to use', 'spec')
- .option('-S, --sort', 'sort test files')
- .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('-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 (' + interfaceNames.join('|') + ')', '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('--es_staging', 'enable all staged features')
- .option('--harmony<_classes,_generators,...>', 'all node --harmony* flags are available')
- .option('--preserve-symlinks', 'Instructs the module loader to preserve symbolic links when resolving and caching modules')
- .option('--icu-data-dir', 'include ICU data')
- .option('--inline-diffs', 'display actual/expected differences inline within each string')
- .option('--interfaces', 'display available interfaces')
- .option('--no-deprecation', 'silence deprecation warnings')
- .option('--no-exit', 'require a clean shutdown of the event loop: mocha will not call process.exit')
- .option('--no-timeouts', 'disables timeouts, given implicitly with --debug')
- .option('--opts <path>', 'specify opts path', 'test/mocha.opts')
- .option('--perf-basic-prof', 'enable perf linux profiler (basic support)')
- .option('--prof', 'log statistical profiling information')
- .option('--log-timer-events', 'Time events including external callbacks')
- .option('--recursive', 'include sub directories')
- .option('--reporters', 'display available reporters')
- .option('--retries <times>', 'set numbers of time to retry a failed test case')
- .option('--throw-deprecation', 'throw an exception anytime a deprecated function is used')
- .option('--trace', 'trace function calls')
- .option('--trace-deprecation', 'show stack traces on deprecations')
- .option('--use_strict', 'enforce strict mode')
- .option('--watch-extensions <ext>,...', 'additional extensions to monitor with --watch', list, [])
- .option('--delay', 'wait for async suite definition');
-
-program._name = 'mocha';
-
-// init command
-
-program
- .command('init <path>')
- .description('initialize a client-side mocha setup at <path>')
- .action(function(path) {
- var mkdir = require('mkdirp');
- mkdir.sync(path);
- var css = fs.readFileSync(join(__dirname, '..', 'mocha.css'));
- var js = fs.readFileSync(join(__dirname, '..', 'mocha.js'));
- var tmpl = fs.readFileSync(join(__dirname, '..', 'lib/template.html'));
- fs.writeFileSync(join(path, 'mocha.css'), css);
- fs.writeFileSync(join(path, 'mocha.js'), js);
- fs.writeFileSync(join(path, 'tests.js'), '');
- fs.writeFileSync(join(path, 'index.html'), tmpl);
- process.exit(0);
- });
-
-// --globals
-
-program.on('globals', function(val) {
- globals = globals.concat(list(val));
-});
-
-// --reporters
-
-program.on('reporters', function() {
- console.log();
- console.log(' dot - dot matrix');
- console.log(' doc - html documentation');
- console.log(' spec - hierarchical spec list');
- console.log(' json - single json object');
- console.log(' progress - progress bar');
- console.log(' list - spec-style listing');
- console.log(' tap - test-anything-protocol');
- console.log(' landing - unicode landing strip');
- console.log(' xunit - xunit reporter');
- console.log(' min - minimal reporter (great with --watch)');
- console.log(' json-stream - newline delimited json events');
- console.log(' markdown - markdown documentation (GitHub flavour)');
- console.log(' nyan - nyan cat!');
- console.log();
- process.exit();
-});
-
-// --interfaces
-
-program.on('interfaces', function() {
- console.log('');
- interfaceNames.forEach(function(interfaceName) {
- console.log(' ' + interfaceName);
- });
- console.log('');
- process.exit();
-});
-
-// -r, --require
-
-module.paths.push(cwd, join(cwd, 'node_modules'));
-
-program.on('require', function(mod) {
- var abs = exists(mod) || exists(mod + '.js');
- if (abs) {
- mod = resolve(mod);
- }
- requires.push(mod);
-});
-
-// If not already done, load mocha.opts
-if (!process.env.LOADED_MOCHA_OPTS) {
- getOptions();
-}
-
-// parse args
-
-program.parse(process.argv);
-
-// infinite stack traces
-
-Error.stackTraceLimit = Infinity; // TODO: config
-
-// reporter options
-
-var reporterOptions = {};
-if (program.reporterOptions !== undefined) {
- program.reporterOptions.split(',').forEach(function(opt) {
- var L = opt.split('=');
- if (L.length > 2 || L.length === 0) {
- throw new Error("invalid reporter option '" + opt + "'");
- } else if (L.length === 2) {
- reporterOptions[L[0]] = L[1];
- } else {
- reporterOptions[L[0]] = true;
- }
- });
-}
-
-// reporter
-
-mocha.reporter(program.reporter, reporterOptions);
-
-// load reporter
-
-var Reporter = null;
-try {
- Reporter = require('../lib/reporters/' + program.reporter);
-} catch (err) {
- try {
- Reporter = require(program.reporter);
- } catch (err2) {
- throw new Error('reporter "' + program.reporter + '" does not exist');
- }
-}
-
-// --no-colors
-
-if (!program.colors) {
- mocha.useColors(false);
-}
-
-// --colors
-
-if (~process.argv.indexOf('--colors') || ~process.argv.indexOf('-c')) {
- mocha.useColors(true);
-}
-
-// --inline-diffs
-
-if (program.inlineDiffs) {
- mocha.useInlineDiffs(true);
-}
-
-// --slow <ms>
-
-if (program.slow) {
- mocha.suite.slow(program.slow);
-}
-
-// --no-timeouts
-
-if (!program.timeouts) {
- mocha.enableTimeouts(false);
-}
-
-// --timeout
-
-if (program.timeout) {
- mocha.suite.timeout(program.timeout);
-}
-
-// --bail
-
-mocha.suite.bail(program.bail);
-
-// --grep
-
-if (program.grep) {
- mocha.grep(program.grep);
-}
-
-// --fgrep
-
-if (program.fgrep) {
- mocha.fgrep(program.fgrep);
-}
-
-// --invert
-
-if (program.invert) {
- mocha.invert();
-}
-
-// --check-leaks
-
-if (program.checkLeaks) {
- mocha.checkLeaks();
-}
-
-// --stack-trace
-
-if (program.fullTrace) {
- mocha.fullTrace();
-}
-
-// --growl
-
-if (program.growl) {
- mocha.growl();
-}
-
-// --async-only
-
-if (program.asyncOnly) {
- mocha.asyncOnly();
-}
-
-// --delay
-
-if (program.delay) {
- mocha.delay();
-}
-
-// --globals
-
-mocha.globals(globals);
-
-// --retries
-
-if (program.retries) {
- mocha.suite.retries(program.retries);
-}
-
-// custom compiler support
-
-var extensions = ['js'];
-program.compilers.forEach(function(c) {
- var idx = c.indexOf(':');
- var ext = c.slice(0, idx);
- var mod = c.slice(idx + 1);
-
- if (mod[0] === '.') {
- mod = join(process.cwd(), mod);
- }
- require(mod);
- extensions.push(ext);
- program.watchExtensions.push(ext);
-});
-
-// requires
-
-requires.forEach(function(mod) {
- require(mod);
-});
-
-// interface
-
-mocha.ui(program.ui);
-
-// args
-
-var args = program.args;
-
-// default files to test/*.{js,coffee}
-
-if (!args.length) {
- args.push('test');
-}
-
-args.forEach(function(arg) {
- var newFiles;
- try {
- newFiles = utils.lookupFiles(arg, extensions, program.recursive);
- } catch (err) {
- if (err.message.indexOf('cannot resolve path') === 0) {
- console.error('Warning: Could not find any test files matching pattern: ' + arg);
- return;
- }
-
- throw err;
- }
-
- files = files.concat(newFiles);
-});
-
-if (!files.length) {
- console.error('No test files found');
- process.exit(1);
-}
-
-// resolve
-
-files = files.map(function(path) {
- return resolve(path);
-});
-
-if (program.sort) {
- files.sort();
-}
-
-// --watch
-
-var runner;
-var loadAndRun;
-var purge;
-var rerun;
-
-if (program.watch) {
- console.log();
- hideCursor();
- process.on('SIGINT', function() {
- showCursor();
- console.log('\n');
- process.exit(130);
- });
-
- var watchFiles = utils.files(cwd, [ 'js' ].concat(program.watchExtensions));
- var runAgain = false;
-
- loadAndRun = function loadAndRun() {
- try {
- mocha.files = files;
- runAgain = false;
- runner = mocha.run(function() {
- runner = null;
- if (runAgain) {
- rerun();
- }
- });
- } catch (e) {
- console.log(e.stack);
- }
- };
-
- purge = function purge() {
- watchFiles.forEach(function(file) {
- delete require.cache[file];
- });
- };
-
- loadAndRun();
-
- rerun = function rerun() {
- purge();
- stop();
- if (!program.grep) {
- mocha.grep(null);
- }
- mocha.suite = mocha.suite.clone();
- mocha.suite.ctx = new Mocha.Context();
- mocha.ui(program.ui);
- loadAndRun();
- };
-
- utils.watch(watchFiles, function() {
- runAgain = true;
- if (runner) {
- runner.abort();
- } else {
- rerun();
- }
- });
-} else {
-// load
-
- mocha.files = files;
- runner = mocha.run(program.exit ? exit : exitLater);
-}
-
-function exitLater(code) {
- process.on('exit', function() {
- process.exit(Math.min(code, 255));
- });
-}
-
-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(Math.min(code, 255));
- }
- }
-
- 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();
-
- // This is a hack:
- // Instead of `process.exit(130)`, set runner.failures to 130 (exit code for SIGINT)
- // The amount of failures will be emitted as error code later
- runner.failures = 130;
-});
-
-/**
- * Parse list.
- */
-
-function list(str) {
- return str.split(/ *, */);
-}
-
-/**
- * Hide the cursor.
- */
-
-function hideCursor() {
- process.stdout.write('\u001b[?25l');
-}
-
-/**
- * Show the cursor.
- */
-
-function showCursor() {
- process.stdout.write('\u001b[?25h');
-}
-
-/**
- * Stop play()ing.
- */
-
-function stop() {
- process.stdout.write('\u001b[2K');
- clearInterval(play.timer);
-}
-
-/**
- * Play the given array of strings.
- */
-
-function play(arr, interval) {
- var len = arr.length;
- interval = interval || 100;
- var i = 0;
-
- play.timer = setInterval(function() {
- var str = arr[i++ % len];
- process.stdout.write('\u001b[0G' + str);
- }, interval);
-}
diff --git a/tests/lib/mocha-3.1.0/bin/mocha b/tests/lib/mocha-3.1.0/bin/mocha
deleted file mode 100644
index 0c16f0ee94..0000000000
--- a/tests/lib/mocha-3.1.0/bin/mocha
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * This tiny wrapper file checks for known node flags and appends them
- * when found, before invoking the "real" _mocha(1) executable.
- */
-
-var spawn = require('child_process').spawn;
-var path = require('path');
-var getOptions = require('./options');
-var args = [path.join(__dirname, '_mocha')];
-
-// Load mocha.opts into process.argv
-// Must be loaded here to handle node-specific options
-getOptions();
-
-process.argv.slice(2).forEach(function(arg) {
- var flag = arg.split('=')[0];
-
- switch (flag) {
- case '-d':
- args.unshift('--debug');
- args.push('--no-timeouts');
- break;
- case 'debug':
- case '--debug':
- case '--debug-brk':
- case '--inspect':
- args.unshift(arg);
- args.push('--no-timeouts');
- break;
- case '-gc':
- case '--expose-gc':
- args.unshift('--expose-gc');
- break;
- case '--gc-global':
- case '--es_staging':
- case '--no-deprecation':
- case '--prof':
- case '--log-timer-events':
- case '--throw-deprecation':
- case '--trace-deprecation':
- case '--use_strict':
- case '--allow-natives-syntax':
- case '--perf-basic-prof':
- args.unshift(arg);
- break;
- default:
- if (arg.indexOf('--harmony') === 0) {
- args.unshift(arg);
- } else if (arg.indexOf('--trace') === 0) {
- args.unshift(arg);
- } else if (arg.indexOf('--icu-data-dir') === 0) {
- args.unshift(arg);
- } else if (arg.indexOf('--max-old-space-size') === 0) {
- args.unshift(arg);
- } else if (arg.indexOf('--preserve-symlinks') === 0) {
- args.unshift(arg);
- } else {
- args.push(arg);
- }
- break;
- }
-});
-
-var proc = spawn(process.execPath, args, { stdio: 'inherit' });
-proc.on('exit', function(code, signal) {
- process.on('exit', function() {
- if (signal) {
- process.kill(process.pid, signal);
- } else {
- process.exit(code);
- }
- });
-});
-
-// terminate children.
-process.on('SIGINT', function() {
- proc.kill('SIGINT'); // calls runner.abort()
- proc.kill('SIGTERM'); // if that didn't work, we're probably in an infinite loop, so make it die.
-});
diff --git a/tests/lib/mocha-3.1.0/bin/options.js b/tests/lib/mocha-3.1.0/bin/options.js
deleted file mode 100644
index 9d1a18a23e..0000000000
--- a/tests/lib/mocha-3.1.0/bin/options.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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')
- .replace(/\\\s/g, '%20')
- .split(/\s/)
- .filter(Boolean)
- .map(function(value) {
- return value.replace(/%20/g, ' ');
- });
-
- process.argv = process.argv
- .slice(0, 2)
- .concat(opts.concat(process.argv.slice(2)));
- } catch (err) {
- // ignore
- }
-
- process.env.LOADED_MOCHA_OPTS = true;
-}
diff --git a/tests/lib/mocha-3.1.0/bower.json b/tests/lib/mocha-3.1.0/bower.json
deleted file mode 100644
index e96cc9526d..0000000000
--- a/tests/lib/mocha-3.1.0/bower.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "name": "mocha",
- "homepage": "https://mochajs.org",
- "description": "simple, flexible, fun test framework",
- "repository": {
- "type": "git",
- "url": "git://github.com/mochajs/mocha.git"
- },
- "main": [
- "mocha.js",
- "mocha.css"
- ],
- "ignore": [
- "bin",
- "editors",
- "images",
- "lib",
- "scripts",
- "test",
- "assets",
- "media",
- ".*",
- "index.js",
- "karma.conf.js",
- "browser-entry.js",
- "Makefile",
- "package.json",
- "appveyor.yml"
- ],
- "keywords": [
- "mocha",
- "test",
- "bdd",
- "tdd",
- "tap"
- ],
- "license": "MIT"
-}
diff --git a/tests/lib/mocha-3.1.0/browser-entry.js b/tests/lib/mocha-3.1.0/browser-entry.js
deleted file mode 100644
index 789e686ae6..0000000000
--- a/tests/lib/mocha-3.1.0/browser-entry.js
+++ /dev/null
@@ -1,184 +0,0 @@
-/* eslint no-unused-vars: off */
-
-/**
- * Shim process.stdout.
- */
-
-process.stdout = require('browser-stdout')();
-
-var Mocha = require('./lib/mocha');
-
-/**
- * Create a Mocha instance.
- *
- * @return {undefined}
- */
-
-var mocha = new Mocha({ reporter: 'html' });
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-var Date = global.Date;
-var setTimeout = global.setTimeout;
-var setInterval = global.setInterval;
-var clearTimeout = global.clearTimeout;
-var clearInterval = global.clearInterval;
-
-var uncaughtExceptionHandlers = [];
-
-var originalOnerrorHandler = global.onerror;
-
-/**
- * Remove uncaughtException listener.
- * Revert to original onerror handler if previously defined.
- */
-
-process.removeListener = function(e, fn) {
- if (e === 'uncaughtException') {
- if (originalOnerrorHandler) {
- global.onerror = originalOnerrorHandler;
- } else {
- global.onerror = function() {};
- }
- var i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn);
- if (i !== -1) {
- uncaughtExceptionHandlers.splice(i, 1);
- }
- }
-};
-
-/**
- * Implements uncaughtException listener.
- */
-
-process.on = function(e, fn) {
- if (e === 'uncaughtException') {
- global.onerror = function(err, url, line) {
- fn(new Error(err + ' (' + url + ':' + line + ')'));
- return !mocha.allowUncaught;
- };
- uncaughtExceptionHandlers.push(fn);
- }
-};
-
-// The BDD UI is registered by default, but no UI will be functional in the
-// browser without an explicit call to the overridden `mocha.ui` (see below).
-// Ensure that this default UI does not expose its methods to the global scope.
-mocha.suite.removeAllListeners('pre-require');
-
-var immediateQueue = [];
-var immediateTimeout;
-
-function timeslice() {
- var immediateStart = new Date().getTime();
- while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) {
- immediateQueue.shift()();
- }
- if (immediateQueue.length) {
- immediateTimeout = setTimeout(timeslice, 0);
- } else {
- immediateTimeout = null;
- }
-}
-
-/**
- * High-performance override of Runner.immediately.
- */
-
-Mocha.Runner.immediately = function(callback) {
- immediateQueue.push(callback);
- if (!immediateTimeout) {
- immediateTimeout = setTimeout(timeslice, 0);
- }
-};
-
-/**
- * Function to allow assertion libraries to throw errors directly into mocha.
- * This is useful when running tests in a browser because window.onerror will
- * only receive the 'message' attribute of the Error.
- */
-mocha.throwError = function(err) {
- Mocha.utils.forEach(uncaughtExceptionHandlers, function(fn) {
- fn(err);
- });
- throw err;
-};
-
-/**
- * Override ui to ensure that the ui functions are initialized.
- * Normally this would happen in Mocha.prototype.loadFiles.
- */
-
-mocha.ui = function(ui) {
- Mocha.prototype.ui.call(this, ui);
- this.suite.emit('pre-require', global, null, this);
- return this;
-};
-
-/**
- * Setup mocha with the given setting options.
- */
-
-mocha.setup = function(opts) {
- if (typeof opts === 'string') {
- opts = { ui: opts };
- }
- for (var opt in opts) {
- if (opts.hasOwnProperty(opt)) {
- this[opt](opts[opt]);
- }
- }
- return this;
-};
-
-/**
- * Run mocha, returning the Runner.
- */
-
-mocha.run = function(fn) {
- var options = mocha.options;
- mocha.globals('location');
-
- var query = Mocha.utils.parseQuery(global.location.search || '');
- if (query.grep) {
- mocha.grep(query.grep);
- }
- if (query.fgrep) {
- mocha.fgrep(query.fgrep);
- }
- if (query.invert) {
- mocha.invert();
- }
-
- return Mocha.prototype.run.call(mocha, function(err) {
- // The DOM Document is not available in Web Workers.
- var document = global.document;
- if (document && document.getElementById('mocha') && options.noHighlighting !== true) {
- Mocha.utils.highlightTags('code');
- }
- if (fn) {
- fn(err);
- }
- });
-};
-
-/**
- * Expose the process shim.
- * https://github.com/mochajs/mocha/pull/916
- */
-
-Mocha.process = process;
-
-/**
- * Expose mocha.
- */
-
-global.Mocha = Mocha;
-global.mocha = mocha;
-
-// this allows test/acceptance/required-tokens.js to pass; thus,
-// you can now do `const describe = require('mocha').describe` in a
-// browser context (assuming browserification). should fix #880
-module.exports = global;
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - after each.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - after each.tmSnippet
deleted file mode 100755
index c722cfe8ae..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - after each.tmSnippet
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>afterEach(function(){
- $0
-})</string>
- <key>name</key>
- <string>bdd - after each</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>ae</string>
- <key>uuid</key>
- <string>7B4DA8F4-2064-468B-B252-054148419B4B</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - after.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - after.tmSnippet
deleted file mode 100755
index c0b1f6bd82..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - after.tmSnippet
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>after(function(){
- $0
-})</string>
- <key>name</key>
- <string>bdd - after</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>a</string>
- <key>uuid</key>
- <string>A49A87F9-399E-4D74-A489-C535BB06D487</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - before each.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - before each.tmSnippet
deleted file mode 100755
index 14fa93b1b0..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - before each.tmSnippet
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>beforeEach(function(){
- $0
-})</string>
- <key>name</key>
- <string>bdd - before each</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>be</string>
- <key>uuid</key>
- <string>7AB064E3-EFBB-4FA7-98CA-9E87C10CC04E</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - before.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - before.tmSnippet
deleted file mode 100755
index 18b48c0eeb..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - before.tmSnippet
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>before(function(){
- $0
-})</string>
- <key>name</key>
- <string>bdd - before</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>b</string>
- <key>uuid</key>
- <string>DF6F1F42-F80A-4A24-AF78-376F19070C4C</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - describe.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - describe.tmSnippet
deleted file mode 100755
index 041726c067..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - describe.tmSnippet
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>describe('$1', function(){
- $0
-})</string>
- <key>name</key>
- <string>bdd - describe</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>des</string>
- <key>uuid</key>
- <string>4AA1FB50-9BB9-400E-A140-D61C39BDFDF5</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - it.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - it.tmSnippet
deleted file mode 100755
index 72a3b0ee3a..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/bdd - it.tmSnippet
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>it('should $1', function(){
- $0
-})</string>
- <key>name</key>
- <string>bdd - it</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>it</string>
- <key>uuid</key>
- <string>591AE071-95E4-4E1E-B0F3-A7DAF41595EE</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert.tmSnippet
deleted file mode 100755
index 38d78ce2ec..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert.tmSnippet
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>assert($0);</string>
- <key>name</key>
- <string>tdd - assert</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>as</string>
- <key>uuid</key>
- <string>9D920EC2-6A72-4108-B5A0-591AFA61C740</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_deepEqual.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_deepEqual.tmSnippet
deleted file mode 100755
index 4204e4c4f2..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_deepEqual.tmSnippet
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>assert.deepEqual($1, $2);</string>
- <key>name</key>
- <string>tdd - assert.deepEqual</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>deq</string>
- <key>uuid</key>
- <string>7D21FF16-E2E1-46BB-AD6B-82AD767A0822</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_equal.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_equal.tmSnippet
deleted file mode 100755
index 8f09805968..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_equal.tmSnippet
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>assert.equal($1, $2);</string>
- <key>name</key>
- <string>tdd - assert.equal</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>eq</string>
- <key>uuid</key>
- <string>4868D5C0-075D-44A8-B41B-A14E8350C0F8</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_fail.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_fail.tmSnippet
deleted file mode 100755
index 3e8dbe3b9e..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_fail.tmSnippet
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>assert.fail($0);</string>
- <key>name</key>
- <string>tdd - assert.fail</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>fail</string>
- <key>uuid</key>
- <string>11756F3A-5F08-445C-B5B6-30605838BC6F</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_isFunction.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_isFunction.tmSnippet
deleted file mode 100755
index 903d7f6fdf..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - assert_isFunction.tmSnippet
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>assert.isFunction($0);</string>
- <key>name</key>
- <string>tdd - assert.isFunction</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>isf</string>
- <key>uuid</key>
- <string>83DFFD36-2C46-4C92-8950-64665D32DC8E</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - setup.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - setup.tmSnippet
deleted file mode 100755
index a30e650187..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - setup.tmSnippet
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>setup(function() {
- $0
-});</string>
- <key>name</key>
- <string>tdd - setup</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>setup</string>
- <key>uuid</key>
- <string>DCEE796A-900D-4922-BAF0-39C9B91A15E1</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - suite.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - suite.tmSnippet
deleted file mode 100755
index 37cfd8a566..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - suite.tmSnippet
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>suite('$1', function() {
- $0
-});</string>
- <key>name</key>
- <string>tdd - suite</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>suite</string>
- <key>uuid</key>
- <string>2E65C1BE-A568-4868-95BF-E8C958EA5BA5</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - teardown.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - teardown.tmSnippet
deleted file mode 100755
index 68fd441016..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - teardown.tmSnippet
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>teardown(function() {
- $0
-});</string>
- <key>name</key>
- <string>tdd - teardown</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>teardown</string>
- <key>uuid</key>
- <string>9472B167-BEC1-45FD-BA1C-68A99961D8FF</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - test.tmSnippet b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - test.tmSnippet
deleted file mode 100755
index 279da8900d..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/Snippets/tdd - test.tmSnippet
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>content</key>
- <string>test('$1', function() {
- $0
-});</string>
- <key>name</key>
- <string>tdd - test</string>
- <key>scope</key>
- <string>source.js</string>
- <key>tabTrigger</key>
- <string>test</string>
- <key>uuid</key>
- <string>F6E3DF27-3458-4ADD-91A3-B6EF11E1D81E</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/info.plist b/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/info.plist
deleted file mode 100755
index 16f6587a6c..0000000000
--- a/tests/lib/mocha-3.1.0/editors/JavaScript mocha.tmbundle/info.plist
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>name</key>
- <string>JavaScript mocha</string>
- <key>ordering</key>
- <array>
- <string>4AA1FB50-9BB9-400E-A140-D61C39BDFDF5</string>
- <string>591AE071-95E4-4E1E-B0F3-A7DAF41595EE</string>
- <string>DF6F1F42-F80A-4A24-AF78-376F19070C4C</string>
- <string>A49A87F9-399E-4D74-A489-C535BB06D487</string>
- <string>7AB064E3-EFBB-4FA7-98CA-9E87C10CC04E</string>
- <string>7B4DA8F4-2064-468B-B252-054148419B4B</string>
- </array>
- <key>uuid</key>
- <string>094ACE33-0C0E-422A-B3F7-5B919F5B1239</string>
-</dict>
-</plist>
diff --git a/tests/lib/mocha-3.1.0/images/error.png b/tests/lib/mocha-3.1.0/images/error.png
deleted file mode 100755
index a07a1ba5ef..0000000000
--- a/tests/lib/mocha-3.1.0/images/error.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/mocha-3.1.0/images/ok.png b/tests/lib/mocha-3.1.0/images/ok.png
deleted file mode 100755
index b3623a5994..0000000000
--- a/tests/lib/mocha-3.1.0/images/ok.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/mocha-3.1.0/index.js b/tests/lib/mocha-3.1.0/index.js
deleted file mode 100644
index d2b7d19609..0000000000
--- a/tests/lib/mocha-3.1.0/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-'use strict';
-
-module.exports = require('./lib/mocha');
diff --git a/tests/lib/mocha-3.1.0/karma.conf.js b/tests/lib/mocha-3.1.0/karma.conf.js
deleted file mode 100644
index 4aa108b27d..0000000000
--- a/tests/lib/mocha-3.1.0/karma.conf.js
+++ /dev/null
@@ -1,179 +0,0 @@
-'use strict';
-
-var fs = require('fs');
-var path = require('path');
-var mkdirp = require('mkdirp');
-var baseBundleDirpath = path.join(__dirname, '.karma');
-
-module.exports = function(config) {
- var bundleDirpath;
- var cfg = {
- frameworks: [
- 'browserify',
- 'expect',
- 'mocha'
- ],
- files: [
- // we use the BDD interface for all of the tests that
- // aren't interface-specific.
- 'test/browser-fixtures/bdd.fixture.js',
- 'test/acceptance/*.spec.js'
- ],
- exclude: [
- 'test/acceptance/http.spec.js',
- 'test/acceptance/fs.spec.js',
- 'test/acceptance/lookup-files.spec.js',
- 'test/acceptance/require/**/*.js',
- 'test/acceptance/misc/**/*.js'
- ],
- preprocessors: {
- 'test/**/*.js': ['browserify']
- },
- browserify: {
- debug: true,
- configure: function configure(b) {
- b.ignore('glob')
- .ignore('fs')
- .ignore('path')
- .ignore('supports-color')
- .on('bundled', function(err, content) {
- if (!err && bundleDirpath) {
- // write bundle to directory for debugging
- fs.writeFileSync(path.join(bundleDirpath,
- 'bundle.' + Date.now() + '.js'), content);
- }
- });
- }
- },
- reporters: ['spec'],
- colors: true,
- browsers: ['PhantomJS'],
- logLevel: config.LOG_INFO,
- client: {
- mocha: {
- reporter: 'html'
- }
- }
- };
-
- // see https://github.com/saucelabs/karma-sauce-example
- // TO RUN LOCALLY, execute:
- // `CI=1 SAUCE_USERNAME=<user> SAUCE_ACCESS_KEY=<key> make test-browser`
- var env = process.env;
- var sauceConfig;
-
- if (env.CI) {
- console.error('CI mode enabled');
- if (env.TRAVIS) {
- console.error('Travis-CI detected');
- bundleDirpath = path.join(baseBundleDirpath, process.env.TRAVIS_BUILD_ID);
- if (env.SAUCE_USERNAME && env.SAUCE_ACCESS_KEY) {
- // correlate build/tunnel with Travis
- sauceConfig = {
- build: 'TRAVIS #' + env.TRAVIS_BUILD_NUMBER
- + ' (' + env.TRAVIS_BUILD_ID + ')',
- tunnelIdentifier: env.TRAVIS_JOB_NUMBER
- };
- console.error('Configured SauceLabs');
- } else {
- console.error('No SauceLabs credentials present');
- }
- } else if (env.APPVEYOR) {
- console.error('AppVeyor detected');
- bundleDirpath = path.join(baseBundleDirpath, process.env.APPVEYOR_BUILD_ID);
- } else {
- console.error('Local/unknown environment detected');
- bundleDirpath = path.join(baseBundleDirpath, 'local');
- // don't need to run sauce from appveyor b/c travis does it.
- if (!(env.SAUCE_USERNAME || env.SAUCE_ACCESS_KEY)) {
- console.error('No SauceLabs credentials present');
- } else {
- sauceConfig = {
- build: require('os').hostname() + ' (' + Date.now() + ')'
- };
- console.error('Configured SauceLabs');
- }
- }
- mkdirp.sync(bundleDirpath);
- } else {
- console.error('CI mode disabled');
- }
-
- if (sauceConfig) {
- cfg.sauceLabs = sauceConfig;
- addSauceTests(cfg);
- }
-
- // the MOCHA_UI env var will determine if we're running interface-specific
- // tets. since you can only load one at a time, each must be run separately.
- // each has its own set of acceptance tests and a fixture.
- // the "bdd" fixture is used by default.
- var ui = env.MOCHA_UI;
- if (ui) {
- if (cfg.sauceLabs) {
- cfg.sauceLabs.testName = 'Interface "' + ui + '" integration tests';
- }
- cfg.files = [
- 'test/browser-fixtures/' + ui + '.fixture.js',
- 'test/acceptance/interfaces/' + ui + '.spec.js'
- ];
- } else if (cfg.sauceLabs) {
- cfg.sauceLabs.testName = 'Unit Tests';
- }
-
- config.set(cfg);
-};
-
-function addSauceTests(cfg) {
- cfg.reporters.push('saucelabs');
-
- cfg.customLaunchers = {
- ie8: {
- base: 'SauceLabs',
- browserName: 'internet explorer',
- platform: 'Windows 7',
- version: '8.0'
- },
- ie7: {
- base: 'SauceLabs',
- browserName: 'internet explorer',
- platform: 'Windows XP',
- version: '7.0'
- },
- chrome: {
- base: 'SauceLabs',
- browserName: 'chrome',
- platform: 'Windows 8',
- version: 'latest'
- },
- edge: {
- base: 'SauceLabs',
- browserName: 'MicrosoftEdge',
- platform: 'Windows 10',
- version: 'latest'
- },
- firefox: {
- base: 'SauceLabs',
- browserName: 'firefox',
- platform: 'Windows 8.1',
- version: 'latest'
- },
- safari: {
- base: 'SauceLabs',
- browserName: 'safari',
- platform: 'OS X 10.11',
- version: 'latest'
- }
- };
-
- cfg.browsers = cfg.browsers.concat(Object.keys(cfg.customLaunchers));
-
- cfg.sauceLabs = {
- public: 'public',
- startConnect: true
- };
-
- // for slow browser booting, ostensibly
- cfg.captureTimeout = 120000;
- cfg.browserNoActivityTimeout = 20000;
-}
diff --git a/tests/lib/mocha-3.1.0/lib/browser/debug.js b/tests/lib/mocha-3.1.0/lib/browser/debug.js
deleted file mode 100644
index ba232896df..0000000000
--- a/tests/lib/mocha-3.1.0/lib/browser/debug.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/* eslint-disable no-unused-vars */
-module.exports = function(type) {
- return function() {};
-};
diff --git a/tests/lib/mocha-3.1.0/lib/browser/events.js b/tests/lib/mocha-3.1.0/lib/browser/events.js
deleted file mode 100644
index b4342f6202..0000000000
--- a/tests/lib/mocha-3.1.0/lib/browser/events.js
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- * Module exports.
- */
-
-exports.EventEmitter = EventEmitter;
-
-/**
- * Object#toString reference.
- */
-var objToString = Object.prototype.toString;
-
-/**
- * Check if a value is an array.
- *
- * @api private
- * @param {*} val The value to test.
- * @return {boolean} true if the value is an array, otherwise false.
- */
-function isArray(val) {
- return objToString.call(val) === '[object Array]';
-}
-
-/**
- * Event emitter constructor.
- *
- * @api public
- */
-function EventEmitter() {}
-
-/**
- * Add a listener.
- *
- * @api public
- * @param {string} name Event name.
- * @param {Function} fn Event handler.
- * @return {EventEmitter} Emitter instance.
- */
-EventEmitter.prototype.on = function(name, fn) {
- if (!this.$events) {
- this.$events = {};
- }
-
- if (!this.$events[name]) {
- this.$events[name] = fn;
- } else if (isArray(this.$events[name])) {
- this.$events[name].push(fn);
- } else {
- this.$events[name] = [this.$events[name], fn];
- }
-
- return this;
-};
-
-EventEmitter.prototype.addListener = EventEmitter.prototype.on;
-
-/**
- * Adds a volatile listener.
- *
- * @api public
- * @param {string} name Event name.
- * @param {Function} fn Event handler.
- * @return {EventEmitter} Emitter instance.
- */
-EventEmitter.prototype.once = function(name, fn) {
- var self = this;
-
- function on() {
- self.removeListener(name, on);
- fn.apply(this, arguments);
- }
-
- on.listener = fn;
- this.on(name, on);
-
- return this;
-};
-
-/**
- * Remove a listener.
- *
- * @api public
- * @param {string} name Event name.
- * @param {Function} fn Event handler.
- * @return {EventEmitter} Emitter instance.
- */
-EventEmitter.prototype.removeListener = function(name, fn) {
- if (this.$events && this.$events[name]) {
- var list = this.$events[name];
-
- if (isArray(list)) {
- var pos = -1;
-
- for (var i = 0, l = list.length; i < l; i++) {
- if (list[i] === fn || (list[i].listener && list[i].listener === fn)) {
- pos = i;
- break;
- }
- }
-
- if (pos < 0) {
- return this;
- }
-
- list.splice(pos, 1);
-
- if (!list.length) {
- delete this.$events[name];
- }
- } else if (list === fn || (list.listener && list.listener === fn)) {
- delete this.$events[name];
- }
- }
-
- return this;
-};
-
-/**
- * Remove all listeners for an event.
- *
- * @api public
- * @param {string} name Event name.
- * @return {EventEmitter} Emitter instance.
- */
-EventEmitter.prototype.removeAllListeners = function(name) {
- if (name === undefined) {
- this.$events = {};
- return this;
- }
-
- if (this.$events && this.$events[name]) {
- this.$events[name] = null;
- }
-
- return this;
-};
-
-/**
- * Get all listeners for a given event.
- *
- * @api public
- * @param {string} name Event name.
- * @return {EventEmitter} Emitter instance.
- */
-EventEmitter.prototype.listeners = function(name) {
- if (!this.$events) {
- this.$events = {};
- }
-
- if (!this.$events[name]) {
- this.$events[name] = [];
- }
-
- if (!isArray(this.$events[name])) {
- this.$events[name] = [this.$events[name]];
- }
-
- return this.$events[name];
-};
-
-/**
- * Emit an event.
- *
- * @api public
- * @param {string} name Event name.
- * @return {boolean} true if at least one handler was invoked, else false.
- */
-EventEmitter.prototype.emit = function(name) {
- if (!this.$events) {
- return false;
- }
-
- var handler = this.$events[name];
-
- if (!handler) {
- return false;
- }
-
- var args = Array.prototype.slice.call(arguments, 1);
-
- if (typeof handler === 'function') {
- handler.apply(this, args);
- } else if (isArray(handler)) {
- var listeners = handler.slice();
-
- for (var i = 0, l = listeners.length; i < l; i++) {
- listeners[i].apply(this, args);
- }
- } else {
- return false;
- }
-
- return true;
-};
diff --git a/tests/lib/mocha-3.1.0/lib/browser/progress.js b/tests/lib/mocha-3.1.0/lib/browser/progress.js
deleted file mode 100644
index 3186b6ec50..0000000000
--- a/tests/lib/mocha-3.1.0/lib/browser/progress.js
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * Expose `Progress`.
- */
-
-module.exports = Progress;
-
-/**
- * Initialize a new `Progress` indicator.
- */
-function Progress() {
- this.percent = 0;
- this.size(0);
- this.fontSize(11);
- this.font('helvetica, arial, sans-serif');
-}
-
-/**
- * Set progress size to `size`.
- *
- * @api public
- * @param {number} size
- * @return {Progress} Progress instance.
- */
-Progress.prototype.size = function(size) {
- this._size = size;
- return this;
-};
-
-/**
- * Set text to `text`.
- *
- * @api public
- * @param {string} text
- * @return {Progress} Progress instance.
- */
-Progress.prototype.text = function(text) {
- this._text = text;
- return this;
-};
-
-/**
- * Set font size to `size`.
- *
- * @api public
- * @param {number} size
- * @return {Progress} Progress instance.
- */
-Progress.prototype.fontSize = function(size) {
- this._fontSize = size;
- return this;
-};
-
-/**
- * Set font to `family`.
- *
- * @param {string} family
- * @return {Progress} Progress instance.
- */
-Progress.prototype.font = function(family) {
- this._font = family;
- return this;
-};
-
-/**
- * Update percentage to `n`.
- *
- * @param {number} n
- * @return {Progress} Progress instance.
- */
-Progress.prototype.update = function(n) {
- this.percent = n;
- return this;
-};
-
-/**
- * Draw on `ctx`.
- *
- * @param {CanvasRenderingContext2d} ctx
- * @return {Progress} Progress instance.
- */
-Progress.prototype.draw = function(ctx) {
- try {
- var percent = Math.min(this.percent, 100);
- var size = this._size;
- var half = size / 2;
- var x = half;
- var y = half;
- var rad = half - 1;
- var fontSize = this._fontSize;
-
- ctx.font = fontSize + 'px ' + this._font;
-
- var angle = Math.PI * 2 * (percent / 100);
- ctx.clearRect(0, 0, size, size);
-
- // outer circle
- ctx.strokeStyle = '#9f9f9f';
- ctx.beginPath();
- ctx.arc(x, y, rad, 0, angle, false);
- ctx.stroke();
-
- // inner circle
- ctx.strokeStyle = '#eee';
- ctx.beginPath();
- ctx.arc(x, y, rad - 1, 0, angle, true);
- ctx.stroke();
-
- // text
- var text = this._text || (percent | 0) + '%';
- var w = ctx.measureText(text).width;
-
- ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
- } catch (err) {
- // don't fail if we can't render progress
- }
- return this;
-};
diff --git a/tests/lib/mocha-3.1.0/lib/browser/tty.js b/tests/lib/mocha-3.1.0/lib/browser/tty.js
deleted file mode 100644
index 840d6699ee..0000000000
--- a/tests/lib/mocha-3.1.0/lib/browser/tty.js
+++ /dev/null
@@ -1,11 +0,0 @@
-exports.isatty = function isatty() {
- return true;
-};
-
-exports.getWindowSize = function getWindowSize() {
- if ('innerHeight' in global) {
- return [global.innerHeight, global.innerWidth];
- }
- // In a Web Worker, the DOM Window is not available.
- return [640, 480];
-};
diff --git a/tests/lib/mocha-3.1.0/lib/context.js b/tests/lib/mocha-3.1.0/lib/context.js
deleted file mode 100644
index 6d82fcadf4..0000000000
--- a/tests/lib/mocha-3.1.0/lib/context.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var JSON = require('json3');
-
-/**
- * Expose `Context`.
- */
-
-module.exports = Context;
-
-/**
- * Initialize a new `Context`.
- *
- * @api private
- */
-function Context() {}
-
-/**
- * Set or get the context `Runnable` to `runnable`.
- *
- * @api private
- * @param {Runnable} runnable
- * @return {Context}
- */
-Context.prototype.runnable = function(runnable) {
- if (!arguments.length) {
- return this._runnable;
- }
- this.test = this._runnable = runnable;
- return this;
-};
-
-/**
- * Set test timeout `ms`.
- *
- * @api private
- * @param {number} ms
- * @return {Context} self
- */
-Context.prototype.timeout = function(ms) {
- if (!arguments.length) {
- return this.runnable().timeout();
- }
- this.runnable().timeout(ms);
- return this;
-};
-
-/**
- * Set test timeout `enabled`.
- *
- * @api private
- * @param {boolean} enabled
- * @return {Context} self
- */
-Context.prototype.enableTimeouts = function(enabled) {
- this.runnable().enableTimeouts(enabled);
- return this;
-};
-
-/**
- * Set test slowness threshold `ms`.
- *
- * @api private
- * @param {number} ms
- * @return {Context} self
- */
-Context.prototype.slow = function(ms) {
- this.runnable().slow(ms);
- return this;
-};
-
-/**
- * Mark a test as skipped.
- *
- * @api private
- * @return {Context} self
- */
-Context.prototype.skip = function() {
- this.runnable().skip();
- return this;
-};
-
-/**
- * Allow a number of retries on failed tests
- *
- * @api private
- * @param {number} n
- * @return {Context} self
- */
-Context.prototype.retries = function(n) {
- if (!arguments.length) {
- return this.runnable().retries();
- }
- this.runnable().retries(n);
- return this;
-};
-
-/**
- * Inspect the context void of `._runnable`.
- *
- * @api private
- * @return {string}
- */
-Context.prototype.inspect = function() {
- return JSON.stringify(this, function(key, val) {
- return key === 'runnable' || key === 'test' ? undefined : val;
- }, 2);
-};
diff --git a/tests/lib/mocha-3.1.0/lib/hook.js b/tests/lib/mocha-3.1.0/lib/hook.js
deleted file mode 100644
index 0417e013cd..0000000000
--- a/tests/lib/mocha-3.1.0/lib/hook.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Runnable = require('./runnable');
-var inherits = require('./utils').inherits;
-
-/**
- * Expose `Hook`.
- */
-
-module.exports = Hook;
-
-/**
- * Initialize a new `Hook` with the given `title` and callback `fn`.
- *
- * @param {String} title
- * @param {Function} fn
- * @api private
- */
-function Hook(title, fn) {
- Runnable.call(this, title, fn);
- this.type = 'hook';
-}
-
-/**
- * Inherit from `Runnable.prototype`.
- */
-inherits(Hook, Runnable);
-
-/**
- * Get or set the test `err`.
- *
- * @param {Error} err
- * @return {Error}
- * @api public
- */
-Hook.prototype.error = function(err) {
- if (!arguments.length) {
- err = this._error;
- this._error = null;
- return err;
- }
-
- this._error = err;
-};
diff --git a/tests/lib/mocha-3.1.0/lib/interfaces/bdd.js b/tests/lib/mocha-3.1.0/lib/interfaces/bdd.js
deleted file mode 100644
index 830a5fe67a..0000000000
--- a/tests/lib/mocha-3.1.0/lib/interfaces/bdd.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Test = require('../test');
-
-/**
- * BDD-style interface:
- *
- * describe('Array', function() {
- * describe('#indexOf()', function() {
- * it('should return -1 when not present', function() {
- * // ...
- * });
- *
- * it('should return the index when present', function() {
- * // ...
- * });
- * });
- * });
- *
- * @param {Suite} suite Root suite.
- */
-module.exports = function(suite) {
- var suites = [suite];
-
- suite.on('pre-require', function(context, file, mocha) {
- var common = require('./common')(suites, context, mocha);
-
- 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
- * and/or tests.
- */
-
- context.describe = context.context = function(title, fn) {
- return common.suite.create({
- title: title,
- file: file,
- fn: fn
- });
- };
-
- /**
- * Pending describe.
- */
-
- context.xdescribe = context.xcontext = context.describe.skip = function(title, fn) {
- return common.suite.skip({
- title: title,
- file: file,
- fn: fn
- });
- };
-
- /**
- * Exclusive suite.
- */
-
- context.describe.only = function(title, fn) {
- return common.suite.only({
- title: title,
- file: file,
- fn: fn
- });
- };
-
- /**
- * Describe a specification or test-case
- * with the given `title` and callback `fn`
- * acting as a thunk.
- */
-
- context.it = context.specify = function(title, fn) {
- var suite = suites[0];
- if (suite.isPending()) {
- fn = null;
- }
- var test = new Test(title, fn);
- test.file = file;
- suite.addTest(test);
- return test;
- };
-
- /**
- * Exclusive test-case.
- */
-
- context.it.only = function(title, fn) {
- return common.test.only(mocha, context.it(title, fn));
- };
-
- /**
- * Pending test case.
- */
-
- context.xit = context.xspecify = context.it.skip = function(title) {
- context.it(title);
- };
-
- /**
- * Number of attempts to retry.
- */
- context.it.retries = function(n) {
- context.retries(n);
- };
- });
-};
diff --git a/tests/lib/mocha-3.1.0/lib/interfaces/common.js b/tests/lib/mocha-3.1.0/lib/interfaces/common.js
deleted file mode 100644
index 447458487b..0000000000
--- a/tests/lib/mocha-3.1.0/lib/interfaces/common.js
+++ /dev/null
@@ -1,158 +0,0 @@
-'use strict';
-
-var Suite = require('../suite');
-
-/**
- * Functions common to more than one interface.
- *
- * @param {Suite[]} suites
- * @param {Context} context
- * @param {Mocha} mocha
- * @return {Object} An object containing common functions.
- */
-module.exports = function(suites, context, mocha) {
- return {
- /**
- * This is only present if flag --delay is passed into Mocha. It triggers
- * root suite execution.
- *
- * @param {Suite} suite The root wuite.
- * @return {Function} A function which runs the root suite
- */
- runWithSuite: function runWithSuite(suite) {
- return function run() {
- suite.run();
- };
- },
-
- /**
- * Execute before running tests.
- *
- * @param {string} name
- * @param {Function} fn
- */
- before: function(name, fn) {
- suites[0].beforeAll(name, fn);
- },
-
- /**
- * Execute after running tests.
- *
- * @param {string} name
- * @param {Function} fn
- */
- after: function(name, fn) {
- suites[0].afterAll(name, fn);
- },
-
- /**
- * Execute before each test case.
- *
- * @param {string} name
- * @param {Function} fn
- */
- beforeEach: function(name, fn) {
- suites[0].beforeEach(name, fn);
- },
-
- /**
- * Execute after each test case.
- *
- * @param {string} name
- * @param {Function} fn
- */
- afterEach: function(name, fn) {
- suites[0].afterEach(name, fn);
- },
-
- suite: {
- /**
- * Create an exclusive Suite; convenience function
- * See docstring for create() below.
- *
- * @param {Object} opts
- * @returns {Suite}
- */
- only: function only(opts) {
- mocha.options.hasOnly = true;
- opts.isOnly = true;
- return this.create(opts);
- },
-
- /**
- * Create a Suite, but skip it; convenience function
- * See docstring for create() below.
- *
- * @param {Object} opts
- * @returns {Suite}
- */
- skip: function skip(opts) {
- opts.pending = true;
- return this.create(opts);
- },
-
- /**
- * Creates a suite.
- * @param {Object} opts Options
- * @param {string} opts.title Title of Suite
- * @param {Function} [opts.fn] Suite Function (not always applicable)
- * @param {boolean} [opts.pending] Is Suite pending?
- * @param {string} [opts.file] Filepath where this Suite resides
- * @param {boolean} [opts.isOnly] Is Suite exclusive?
- * @returns {Suite}
- */
- create: function create(opts) {
- var suite = Suite.create(suites[0], opts.title);
- suite.pending = Boolean(opts.pending);
- suite.file = opts.file;
- suites.unshift(suite);
- if (opts.isOnly) {
- suite.parent._onlySuites = suite.parent._onlySuites.concat(suite);
- mocha.options.hasOnly = true;
- }
- if (typeof opts.fn === 'function') {
- opts.fn.call(suite);
- suites.shift();
- } else if (typeof opts.fn === 'undefined' && !suite.pending) {
- throw new Error('Suite "' + suite.fullTitle() + '" was defined but no callback was supplied. Supply a callback or explicitly skip the suite.');
- }
-
- return suite;
- }
- },
-
- test: {
-
- /**
- * Exclusive test-case.
- *
- * @param {Object} mocha
- * @param {Function} test
- * @returns {*}
- */
- only: function(mocha, test) {
- test.parent._onlyTests = test.parent._onlyTests.concat(test);
- mocha.options.hasOnly = true;
- return test;
- },
-
- /**
- * Pending test case.
- *
- * @param {string} title
- */
- skip: function(title) {
- context.test(title);
- },
-
- /**
- * Number of retry attempts
- *
- * @param {number} n
- */
- retries: function(n) {
- context.retries(n);
- }
- }
- };
-};
diff --git a/tests/lib/mocha-3.1.0/lib/interfaces/exports.js b/tests/lib/mocha-3.1.0/lib/interfaces/exports.js
deleted file mode 100644
index 7db6e47c97..0000000000
--- a/tests/lib/mocha-3.1.0/lib/interfaces/exports.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Suite = require('../suite');
-var Test = require('../test');
-
-/**
- * Exports-style (as Node.js module) interface:
- *
- * exports.Array = {
- * '#indexOf()': {
- * 'should return -1 when the value is not present': function() {
- *
- * },
- *
- * 'should return the correct index when the value is present': function() {
- *
- * }
- * }
- * };
- *
- * @param {Suite} suite Root suite.
- */
-module.exports = function(suite) {
- var suites = [suite];
-
- suite.on('require', visit);
-
- function visit(obj, file) {
- var suite;
- for (var key in obj) {
- if (typeof obj[key] === 'function') {
- var fn = obj[key];
- switch (key) {
- case 'before':
- suites[0].beforeAll(fn);
- break;
- case 'after':
- suites[0].afterAll(fn);
- break;
- case 'beforeEach':
- suites[0].beforeEach(fn);
- break;
- case 'afterEach':
- suites[0].afterEach(fn);
- break;
- default:
- var test = new Test(key, fn);
- test.file = file;
- suites[0].addTest(test);
- }
- } else {
- suite = Suite.create(suites[0], key);
- suites.unshift(suite);
- visit(obj[key], file);
- suites.shift();
- }
- }
- }
-};
diff --git a/tests/lib/mocha-3.1.0/lib/interfaces/index.js b/tests/lib/mocha-3.1.0/lib/interfaces/index.js
deleted file mode 100755
index 4f825d15b2..0000000000
--- a/tests/lib/mocha-3.1.0/lib/interfaces/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-exports.bdd = require('./bdd');
-exports.tdd = require('./tdd');
-exports.qunit = require('./qunit');
-exports.exports = require('./exports');
diff --git a/tests/lib/mocha-3.1.0/lib/interfaces/qunit.js b/tests/lib/mocha-3.1.0/lib/interfaces/qunit.js
deleted file mode 100644
index 22e8080e2e..0000000000
--- a/tests/lib/mocha-3.1.0/lib/interfaces/qunit.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Test = require('../test');
-
-/**
- * QUnit-style interface:
- *
- * 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);
- * });
- *
- * @param {Suite} suite Root suite.
- */
-module.exports = function(suite) {
- var suites = [suite];
-
- suite.on('pre-require', function(context, file, mocha) {
- var common = require('./common')(suites, context, mocha);
-
- 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`.
- */
-
- context.suite = function(title) {
- if (suites.length > 1) {
- suites.shift();
- }
- return common.suite.create({
- title: title,
- file: file,
- fn: false
- });
- };
-
- /**
- * Exclusive Suite.
- */
-
- context.suite.only = function(title) {
- if (suites.length > 1) {
- suites.shift();
- }
- return common.suite.only({
- title: title,
- file: file,
- fn: false
- });
- };
-
- /**
- * Describe a specification or test-case
- * with the given `title` and callback `fn`
- * acting as a thunk.
- */
-
- context.test = function(title, fn) {
- var test = new Test(title, fn);
- test.file = file;
- suites[0].addTest(test);
- return test;
- };
-
- /**
- * Exclusive test-case.
- */
-
- context.test.only = function(title, fn) {
- return common.test.only(mocha, context.test(title, fn));
- };
-
- context.test.skip = common.test.skip;
- context.test.retries = common.test.retries;
- });
-};
diff --git a/tests/lib/mocha-3.1.0/lib/interfaces/tdd.js b/tests/lib/mocha-3.1.0/lib/interfaces/tdd.js
deleted file mode 100644
index 445e992213..0000000000
--- a/tests/lib/mocha-3.1.0/lib/interfaces/tdd.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Test = require('../test');
-
-/**
- * TDD-style interface:
- *
- * suite('Array', function() {
- * suite('#indexOf()', function() {
- * suiteSetup(function() {
- *
- * });
- *
- * test('should return -1 when not present', function() {
- *
- * });
- *
- * test('should return the index when present', function() {
- *
- * });
- *
- * suiteTeardown(function() {
- *
- * });
- * });
- * });
- *
- * @param {Suite} suite Root suite.
- */
-module.exports = function(suite) {
- var suites = [suite];
-
- suite.on('pre-require', function(context, file, mocha) {
- var common = require('./common')(suites, context, mocha);
-
- 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 and/or tests.
- */
- context.suite = function(title, fn) {
- return common.suite.create({
- title: title,
- file: file,
- fn: fn
- });
- };
-
- /**
- * Pending suite.
- */
- context.suite.skip = function(title, fn) {
- return common.suite.skip({
- title: title,
- file: file,
- fn: fn
- });
- };
-
- /**
- * Exclusive test-case.
- */
- context.suite.only = function(title, fn) {
- return common.suite.only({
- title: title,
- file: file,
- fn: fn
- });
- };
-
- /**
- * Describe a specification or test-case with the given `title` and
- * callback `fn` acting as a thunk.
- */
- context.test = function(title, fn) {
- var suite = suites[0];
- if (suite.isPending()) {
- fn = null;
- }
- var test = new Test(title, fn);
- test.file = file;
- suite.addTest(test);
- return test;
- };
-
- /**
- * Exclusive test-case.
- */
-
- context.test.only = function(title, fn) {
- return common.test.only(mocha, context.test(title, fn));
- };
-
- context.test.skip = common.test.skip;
- context.test.retries = common.test.retries;
- });
-};
diff --git a/tests/lib/mocha-3.1.0/lib/mocha.js b/tests/lib/mocha-3.1.0/lib/mocha.js
deleted file mode 100644
index a649715191..0000000000
--- a/tests/lib/mocha-3.1.0/lib/mocha.js
+++ /dev/null
@@ -1,520 +0,0 @@
-/*!
- * mocha
- * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var escapeRe = require('escape-string-regexp');
-var path = require('path');
-var reporters = require('./reporters');
-var utils = require('./utils');
-
-/**
- * Expose `Mocha`.
- */
-
-exports = module.exports = Mocha;
-
-/**
- * To require local UIs and reporters when running in node.
- */
-
-if (!process.browser) {
- var cwd = process.cwd();
- module.paths.push(cwd, path.join(cwd, 'node_modules'));
-}
-
-/**
- * Expose internals.
- */
-
-exports.utils = utils;
-exports.interfaces = require('./interfaces');
-exports.reporters = reporters;
-exports.Runnable = require('./runnable');
-exports.Context = require('./context');
-exports.Runner = require('./runner');
-exports.Suite = require('./suite');
-exports.Hook = require('./hook');
-exports.Test = require('./test');
-
-/**
- * Return image `name` path.
- *
- * @api private
- * @param {string} name
- * @return {string}
- */
-function image(name) {
- return path.join(__dirname, '../images', name + '.png');
-}
-
-/**
- * Set up mocha with `options`.
- *
- * Options:
- *
- * - `ui` name "bdd", "tdd", "exports" etc
- * - `reporter` reporter instance, defaults to `mocha.reporters.spec`
- * - `globals` array of accepted globals
- * - `timeout` timeout in milliseconds
- * - `retries` number of times to retry failed tests
- * - `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
- * @api public
- */
-function Mocha(options) {
- options = options || {};
- this.files = [];
- this.options = options;
- if (options.grep) {
- this.grep(new RegExp(options.grep));
- }
- if (options.fgrep) {
- this.fgrep(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 (typeof options.timeout !== 'undefined' && options.timeout !== null) {
- this.timeout(options.timeout);
- }
- if (typeof options.retries !== 'undefined' && options.retries !== null) {
- this.retries(options.retries);
- }
- this.useColors(options.useColors);
- if (options.enableTimeouts !== null) {
- this.enableTimeouts(options.enableTimeouts);
- }
- if (options.slow) {
- this.slow(options.slow);
- }
-}
-
-/**
- * Enable or disable bailing on the first failure.
- *
- * @api public
- * @param {boolean} [bail]
- */
-Mocha.prototype.bail = function(bail) {
- if (!arguments.length) {
- bail = true;
- }
- this.suite.bail(bail);
- return this;
-};
-
-/**
- * Add test `file`.
- *
- * @api public
- * @param {string} file
- */
-Mocha.prototype.addFile = function(file) {
- this.files.push(file);
- return this;
-};
-
-/**
- * Set reporter to `reporter`, defaults to "spec".
- *
- * @param {String|Function} reporter name or constructor
- * @param {Object} reporterOptions optional options
- * @api public
- * @param {string|Function} reporter name or constructor
- * @param {Object} reporterOptions optional options
- */
-Mocha.prototype.reporter = function(reporter, reporterOptions) {
- if (typeof reporter === 'function') {
- this._reporter = reporter;
- } else {
- reporter = reporter || 'spec';
- var _reporter;
- // Try to load a built-in reporter.
- if (reporters[reporter]) {
- _reporter = reporters[reporter];
- }
- // Try to load reporters from process.cwd() and node_modules
- 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 '
- + '(https://npmjs.org/package/mocha-teamcity-reporter).');
- }
- if (!_reporter) {
- throw new Error('invalid reporter "' + reporter + '"');
- }
- this._reporter = _reporter;
- }
- this.options.reporterOptions = reporterOptions;
- return this;
-};
-
-/**
- * Set test UI `name`, defaults to "bdd".
- *
- * @api public
- * @param {string} bdd
- */
-Mocha.prototype.ui = function(name) {
- name = name || 'bdd';
- this._ui = exports.interfaces[name];
- if (!this._ui) {
- try {
- this._ui = require(name);
- } catch (err) {
- throw new Error('invalid interface "' + name + '"');
- }
- }
- this._ui = this._ui(this.suite);
-
- this.suite.on('pre-require', function(context) {
- exports.afterEach = context.afterEach || context.teardown;
- exports.after = context.after || context.suiteTeardown;
- exports.beforeEach = context.beforeEach || context.setup;
- exports.before = context.before || context.suiteSetup;
- exports.describe = context.describe || context.suite;
- exports.it = context.it || context.test;
- exports.setup = context.setup || context.beforeEach;
- exports.suiteSetup = context.suiteSetup || context.before;
- exports.suiteTeardown = context.suiteTeardown || context.after;
- exports.suite = context.suite || context.describe;
- exports.teardown = context.teardown || context.afterEach;
- exports.test = context.test || context.it;
- exports.run = context.run;
- });
-
- return this;
-};
-
-/**
- * Load registered files.
- *
- * @api private
- */
-Mocha.prototype.loadFiles = function(fn) {
- var self = this;
- var suite = this.suite;
- this.files.forEach(function(file) {
- file = path.resolve(file);
- suite.emit('pre-require', global, file, self);
- suite.emit('require', require(file), file, self);
- suite.emit('post-require', global, file, self);
- });
- fn && fn();
-};
-
-/**
- * Enable growl support.
- *
- * @api private
- */
-Mocha.prototype._growl = function(runner, reporter) {
- var notify = require('growl');
-
- runner.on('end', function() {
- var stats = reporter.stats;
- if (stats.failures) {
- var msg = stats.failures + ' of ' + runner.total + ' tests failed';
- notify(msg, { name: 'mocha', title: 'Failed', image: image('error') });
- } else {
- notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', {
- name: 'mocha',
- title: 'Passed',
- image: image('ok')
- });
- }
- });
-};
-
-/**
- * Escape string and add it to grep as a regexp.
- *
- * @api public
- * @param str
- * @returns {Mocha}
- */
-Mocha.prototype.fgrep = function(str) {
- return this.grep(new RegExp(escapeRe(str)));
-};
-
-/**
- * Add regexp to grep, if `re` is a string it is escaped.
- *
- * @param {RegExp|String} re
- * @return {Mocha}
- * @api public
- * @param {RegExp|string} re
- * @return {Mocha}
- */
-Mocha.prototype.grep = function(re) {
- if (utils.isString(re)) {
- // extract args if it's regex-like, i.e: [string, pattern, flag]
- var arg = re.match(/^\/(.*)\/(g|i|)$|.*/);
- this.options.grep = new RegExp(arg[1] || arg[0], arg[2]);
- } else {
- this.options.grep = re;
- }
- return this;
-};
-/**
- * Invert `.grep()` matches.
- *
- * @return {Mocha}
- * @api public
- */
-Mocha.prototype.invert = function() {
- this.options.invert = true;
- return this;
-};
-
-/**
- * Ignore global leaks.
- *
- * @param {Boolean} ignore
- * @return {Mocha}
- * @api public
- * @param {boolean} ignore
- * @return {Mocha}
- */
-Mocha.prototype.ignoreLeaks = function(ignore) {
- this.options.ignoreLeaks = Boolean(ignore);
- return this;
-};
-
-/**
- * Enable global leak checking.
- *
- * @return {Mocha}
- * @api public
- */
-Mocha.prototype.checkLeaks = function() {
- this.options.ignoreLeaks = false;
- 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.
- *
- * @return {Mocha}
- * @api public
- */
-Mocha.prototype.growl = function() {
- this.options.growl = true;
- return this;
-};
-
-/**
- * Ignore `globals` array or string.
- *
- * @param {Array|String} globals
- * @return {Mocha}
- * @api public
- * @param {Array|string} globals
- * @return {Mocha}
- */
-Mocha.prototype.globals = function(globals) {
- this.options.globals = (this.options.globals || []).concat(globals);
- return this;
-};
-
-/**
- * Emit color output.
- *
- * @param {Boolean} colors
- * @return {Mocha}
- * @api public
- * @param {boolean} colors
- * @return {Mocha}
- */
-Mocha.prototype.useColors = function(colors) {
- if (colors !== undefined) {
- this.options.useColors = colors;
- }
- return this;
-};
-
-/**
- * Use inline diffs rather than +/-.
- *
- * @param {Boolean} inlineDiffs
- * @return {Mocha}
- * @api public
- * @param {boolean} inlineDiffs
- * @return {Mocha}
- */
-Mocha.prototype.useInlineDiffs = function(inlineDiffs) {
- this.options.useInlineDiffs = inlineDiffs !== undefined && inlineDiffs;
- return this;
-};
-
-/**
- * Set the timeout in milliseconds.
- *
- * @param {Number} timeout
- * @return {Mocha}
- * @api public
- * @param {number} timeout
- * @return {Mocha}
- */
-Mocha.prototype.timeout = function(timeout) {
- this.suite.timeout(timeout);
- return this;
-};
-
-/**
- * Set the number of times to retry failed tests.
- *
- * @param {Number} retry times
- * @return {Mocha}
- * @api public
- */
-Mocha.prototype.retries = function(n) {
- this.suite.retries(n);
- return this;
-};
-
-/**
- * Set slowness threshold in milliseconds.
- *
- * @param {Number} slow
- * @return {Mocha}
- * @api public
- * @param {number} slow
- * @return {Mocha}
- */
-Mocha.prototype.slow = function(slow) {
- this.suite.slow(slow);
- return this;
-};
-
-/**
- * Enable timeouts.
- *
- * @param {Boolean} enabled
- * @return {Mocha}
- * @api public
- * @param {boolean} enabled
- * @return {Mocha}
- */
-Mocha.prototype.enableTimeouts = function(enabled) {
- this.suite.enableTimeouts(arguments.length && enabled !== undefined ? enabled : true);
- return this;
-};
-
-/**
- * Makes all tests async (accepting a callback)
- *
- * @return {Mocha}
- * @api public
- */
-Mocha.prototype.asyncOnly = function() {
- this.options.asyncOnly = true;
- return this;
-};
-
-/**
- * Disable syntax highlighting (in browser).
- *
- * @api public
- */
-Mocha.prototype.noHighlighting = function() {
- this.options.noHighlighting = true;
- return this;
-};
-
-/**
- * Enable uncaught errors to propagate (in browser).
- *
- * @return {Mocha}
- * @api public
- */
-Mocha.prototype.allowUncaught = function() {
- this.options.allowUncaught = true;
- return this;
-};
-
-/**
- * Delay root suite execution.
- * @returns {Mocha}
- */
-Mocha.prototype.delay = function delay() {
- this.options.delay = true;
- return this;
-};
-
-/**
- * Run tests and invoke `fn()` when complete.
- *
- * @api public
- * @param {Function} fn
- * @return {Runner}
- */
-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, options.delay);
- var reporter = new this._reporter(runner, options);
- runner.ignoreLeaks = options.ignoreLeaks !== false;
- runner.fullStackTrace = options.fullStackTrace;
- runner.hasOnly = options.hasOnly;
- runner.asyncOnly = options.asyncOnly;
- runner.allowUncaught = options.allowUncaught;
- if (options.grep) {
- runner.grep(options.grep, options.invert);
- }
- if (options.globals) {
- runner.globals(options.globals);
- }
- if (options.growl) {
- this._growl(runner, reporter);
- }
- if (options.useColors !== undefined) {
- exports.reporters.Base.useColors = options.useColors;
- }
- exports.reporters.Base.inlineDiffs = options.useInlineDiffs;
-
- function done(failures) {
- if (reporter.done) {
- reporter.done(failures, fn);
- } else {
- fn && fn(failures);
- }
- }
-
- return runner.run(done);
-};
diff --git a/tests/lib/mocha-3.1.0/lib/ms.js b/tests/lib/mocha-3.1.0/lib/ms.js
deleted file mode 100644
index 12fddc18ae..0000000000
--- a/tests/lib/mocha-3.1.0/lib/ms.js
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Helpers.
- */
-
-var s = 1000;
-var m = s * 60;
-var h = m * 60;
-var d = h * 24;
-var y = d * 365.25;
-
-/**
- * Parse or format the given `val`.
- *
- * Options:
- *
- * - `long` verbose formatting [false]
- *
- * @api public
- * @param {string|number} val
- * @param {Object} options
- * @return {string|number}
- */
-module.exports = function(val, options) {
- options = options || {};
- if (typeof val === 'string') {
- return parse(val);
- }
- // https://github.com/mochajs/mocha/pull/1035
- return options['long'] ? longFormat(val) : shortFormat(val);
-};
-
-/**
- * Parse the given `str` and return milliseconds.
- *
- * @api private
- * @param {string} str
- * @return {number}
- */
-function parse(str) {
- var match = (/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i).exec(str);
- if (!match) {
- return;
- }
- var n = parseFloat(match[1]);
- var type = (match[2] || 'ms').toLowerCase();
- switch (type) {
- case 'years':
- case 'year':
- case 'y':
- return n * y;
- case 'days':
- case 'day':
- case 'd':
- return n * d;
- case 'hours':
- case 'hour':
- case 'h':
- return n * h;
- case 'minutes':
- case 'minute':
- case 'm':
- return n * m;
- case 'seconds':
- case 'second':
- case 's':
- return n * s;
- case 'ms':
- return n;
- default:
- // No default case
- }
-}
-
-/**
- * Short format for `ms`.
- *
- * @api private
- * @param {number} ms
- * @return {string}
- */
-function shortFormat(ms) {
- if (ms >= d) {
- return Math.round(ms / d) + 'd';
- }
- if (ms >= h) {
- return Math.round(ms / h) + 'h';
- }
- if (ms >= m) {
- return Math.round(ms / m) + 'm';
- }
- if (ms >= s) {
- return Math.round(ms / s) + 's';
- }
- return ms + 'ms';
-}
-
-/**
- * Long format for `ms`.
- *
- * @api private
- * @param {number} ms
- * @return {string}
- */
-function longFormat(ms) {
- return plural(ms, d, 'day')
- || plural(ms, h, 'hour')
- || plural(ms, m, 'minute')
- || plural(ms, s, 'second')
- || ms + ' ms';
-}
-
-/**
- * Pluralization helper.
- *
- * @api private
- * @param {number} ms
- * @param {number} n
- * @param {string} name
- */
-function plural(ms, n, name) {
- if (ms < n) {
- return;
- }
- if (ms < n * 1.5) {
- return Math.floor(ms / n) + ' ' + name;
- }
- return Math.ceil(ms / n) + ' ' + name + 's';
-}
diff --git a/tests/lib/mocha-3.1.0/lib/pending.js b/tests/lib/mocha-3.1.0/lib/pending.js
deleted file mode 100644
index c847e04e3f..0000000000
--- a/tests/lib/mocha-3.1.0/lib/pending.js
+++ /dev/null
@@ -1,15 +0,0 @@
-
-/**
- * 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-3.1.0/lib/reporters/base.js b/tests/lib/mocha-3.1.0/lib/reporters/base.js
deleted file mode 100644
index c754c5231f..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/base.js
+++ /dev/null
@@ -1,489 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var tty = require('tty');
-var diff = require('diff');
-var ms = require('../ms');
-var utils = require('../utils');
-var supportsColor = process.browser ? null : require('supports-color');
-
-/**
- * Expose `Base`.
- */
-
-exports = module.exports = Base;
-
-/**
- * Save timer references to avoid Sinon interfering.
- * See: https://github.com/mochajs/mocha/issues/237
- */
-
-/* eslint-disable no-unused-vars, no-native-reassign */
-var Date = global.Date;
-var setTimeout = global.setTimeout;
-var setInterval = global.setInterval;
-var clearTimeout = global.clearTimeout;
-var clearInterval = global.clearInterval;
-/* eslint-enable no-unused-vars, no-native-reassign */
-
-/**
- * Check if both stdio streams are associated with a tty.
- */
-
-var isatty = tty.isatty(1) && tty.isatty(2);
-
-/**
- * Enable coloring by default, except in the browser interface.
- */
-
-exports.useColors = !process.browser && (supportsColor || (process.env.MOCHA_COLORS !== undefined));
-
-/**
- * Inline diffs instead of +/-
- */
-
-exports.inlineDiffs = false;
-
-/**
- * Default color map.
- */
-
-exports.colors = {
- pass: 90,
- fail: 31,
- 'bright pass': 92,
- 'bright fail': 91,
- 'bright yellow': 93,
- pending: 36,
- suite: 0,
- 'error title': 0,
- 'error message': 31,
- 'error stack': 90,
- checkmark: 32,
- fast: 90,
- medium: 33,
- slow: 31,
- green: 32,
- light: 90,
- 'diff gutter': 90,
- 'diff added': 32,
- 'diff removed': 31
-};
-
-/**
- * Default symbol map.
- */
-
-exports.symbols = {
- ok: '✓',
- err: '✖',
- dot: '․',
- comma: ',',
- bang: '!'
-};
-
-// With node.js on Windows: use symbols available in terminal default fonts
-if (process.platform === 'win32') {
- exports.symbols.ok = '\u221A';
- exports.symbols.err = '\u00D7';
- exports.symbols.dot = '.';
-}
-
-/**
- * Color `str` with the given `type`,
- * allowing colors to be disabled,
- * as well as user-defined color
- * schemes.
- *
- * @param {string} type
- * @param {string} str
- * @return {string}
- * @api private
- */
-var color = exports.color = function(type, str) {
- if (!exports.useColors) {
- return String(str);
- }
- return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';
-};
-
-/**
- * Expose term window size, with some defaults for when stderr is not a tty.
- */
-
-exports.window = {
- width: 75
-};
-
-if (isatty) {
- exports.window.width = process.stdout.getWindowSize
- ? process.stdout.getWindowSize(1)[0]
- : tty.getWindowSize()[1];
-}
-
-/**
- * Expose some basic cursor interactions that are common among reporters.
- */
-
-exports.cursor = {
- hide: function() {
- isatty && process.stdout.write('\u001b[?25l');
- },
-
- show: function() {
- isatty && process.stdout.write('\u001b[?25h');
- },
-
- deleteLine: function() {
- isatty && process.stdout.write('\u001b[2K');
- },
-
- beginningOfLine: function() {
- isatty && process.stdout.write('\u001b[0G');
- },
-
- CR: function() {
- if (isatty) {
- exports.cursor.deleteLine();
- exports.cursor.beginningOfLine();
- } else {
- process.stdout.write('\r');
- }
- }
-};
-
-/**
- * Outut the given `failures` as a list.
- *
- * @param {Array} failures
- * @api public
- */
-
-exports.list = function(failures) {
- console.log();
- failures.forEach(function(test, i) {
- // format
- var fmt = color('error title', ' %s) %s:\n')
- + color('error message', ' %s')
- + color('error stack', '\n%s\n');
-
- // msg
- var msg;
- var err = test.err;
- var message;
- if (err.message && typeof err.message.toString === 'function') {
- message = err.message + '';
- } else if (typeof err.inspect === 'function') {
- message = err.inspect() + '';
- } else {
- message = '';
- }
- var stack = err.stack || message;
- var index = message ? stack.indexOf(message) : -1;
- var actual = err.actual;
- var expected = err.expected;
- var 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 !== false && sameType(actual, expected) && expected !== undefined) {
- escape = false;
- if (!(utils.isString(actual) && utils.isString(expected))) {
- err.actual = actual = utils.stringify(actual);
- err.expected = expected = utils.stringify(expected);
- }
-
- fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');
- var match = message.match(/^([^:]+): expected/);
- msg = '\n ' + color('error message', match ? match[1] : msg);
-
- if (exports.inlineDiffs) {
- msg += inlineDiff(err, escape);
- } else {
- msg += unifiedDiff(err, escape);
- }
- }
-
- // indent stack trace
- stack = stack.replace(/^/gm, ' ');
-
- console.log(fmt, (i + 1), test.fullTitle(), msg, stack);
- });
-};
-
-/**
- * Initialize a new `Base` reporter.
- *
- * All other reporters generally
- * inherit from this reporter, providing
- * stats such as test duration, number
- * of tests passed / failed etc.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Base(runner) {
- var stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 };
- var failures = this.failures = [];
-
- if (!runner) {
- return;
- }
- this.runner = runner;
-
- runner.stats = stats;
-
- runner.on('start', function() {
- stats.start = new Date();
- });
-
- runner.on('suite', function(suite) {
- stats.suites = stats.suites || 0;
- suite.root || stats.suites++;
- });
-
- runner.on('test end', function() {
- stats.tests = stats.tests || 0;
- stats.tests++;
- });
-
- runner.on('pass', function(test) {
- stats.passes = stats.passes || 0;
-
- if (test.duration > test.slow()) {
- test.speed = 'slow';
- } else if (test.duration > test.slow() / 2) {
- test.speed = 'medium';
- } else {
- test.speed = 'fast';
- }
-
- stats.passes++;
- });
-
- runner.on('fail', function(test, err) {
- stats.failures = stats.failures || 0;
- stats.failures++;
- test.err = err;
- failures.push(test);
- });
-
- runner.on('end', function() {
- stats.end = new Date();
- stats.duration = new Date() - stats.start;
- });
-
- runner.on('pending', function() {
- stats.pending++;
- });
-}
-
-/**
- * Output common epilogue used by many of
- * the bundled reporters.
- *
- * @api public
- */
-Base.prototype.epilogue = function() {
- var stats = this.stats;
- var fmt;
-
- console.log();
-
- // passes
- fmt = color('bright pass', ' ')
- + color('green', ' %d passing')
- + color('light', ' (%s)');
-
- console.log(fmt,
- stats.passes || 0,
- ms(stats.duration));
-
- // pending
- if (stats.pending) {
- fmt = color('pending', ' ')
- + color('pending', ' %d pending');
-
- console.log(fmt, stats.pending);
- }
-
- // failures
- if (stats.failures) {
- fmt = color('fail', ' %d failing');
-
- console.log(fmt, stats.failures);
-
- Base.list(this.failures);
- console.log();
- }
-
- console.log();
-};
-
-/**
- * Pad the given `str` to `len`.
- *
- * @api private
- * @param {string} str
- * @param {string} len
- * @return {string}
- */
-function pad(str, len) {
- str = String(str);
- return Array(len - str.length + 1).join(' ') + str;
-}
-
-/**
- * Returns an inline diff between 2 strings with coloured ANSI output
- *
- * @api private
- * @param {Error} err with actual/expected
- * @param {boolean} escape
- * @return {string} Diff
- */
-function inlineDiff(err, escape) {
- var msg = errorDiff(err, 'WordsWithSpace', escape);
-
- // linenos
- var lines = msg.split('\n');
- if (lines.length > 4) {
- var width = String(lines.length).length;
- msg = lines.map(function(str, i) {
- return pad(++i, width) + ' |' + ' ' + str;
- }).join('\n');
- }
-
- // legend
- msg = '\n'
- + color('diff removed', 'actual')
- + ' '
- + color('diff added', 'expected')
- + '\n\n'
- + msg
- + '\n';
-
- // indent
- msg = msg.replace(/^/gm, ' ');
- return msg;
-}
-
-/**
- * Returns a unified diff between two strings.
- *
- * @api private
- * @param {Error} err with actual/expected
- * @param {boolean} escape
- * @return {string} The diff.
- */
-function unifiedDiff(err, escape) {
- var indent = ' ';
- function cleanUp(line) {
- if (escape) {
- line = escapeInvisibles(line);
- }
- if (line[0] === '+') {
- return indent + colorLines('diff added', line);
- }
- if (line[0] === '-') {
- return indent + colorLines('diff removed', line);
- }
- if (line.match(/\@\@/)) {
- return null;
- }
- if (line.match(/\\ No newline/)) {
- return null;
- }
- return indent + line;
- }
- function notBlank(line) {
- return typeof line !== 'undefined' && line !== null;
- }
- var msg = diff.createPatch('string', err.actual, err.expected);
- var lines = msg.split('\n').splice(4);
- return '\n '
- + colorLines('diff added', '+ expected') + ' '
- + colorLines('diff removed', '- actual')
- + '\n\n'
- + lines.map(cleanUp).filter(notBlank).join('\n');
-}
-
-/**
- * Return a character diff for `err`.
- *
- * @api private
- * @param {Error} err
- * @param {string} type
- * @param {boolean} escape
- * @return {string}
- */
-function errorDiff(err, type, escape) {
- var actual = escape ? escapeInvisibles(err.actual) : err.actual;
- var expected = escape ? escapeInvisibles(err.expected) : err.expected;
- return diff['diff' + type](actual, expected).map(function(str) {
- if (str.added) {
- return colorLines('diff added', str.value);
- }
- if (str.removed) {
- return colorLines('diff removed', str.value);
- }
- return str.value;
- }).join('');
-}
-
-/**
- * Returns a string with all invisible characters in plain text
- *
- * @api private
- * @param {string} line
- * @return {string}
- */
-function escapeInvisibles(line) {
- return line.replace(/\t/g, '<tab>')
- .replace(/\r/g, '<CR>')
- .replace(/\n/g, '<LF>\n');
-}
-
-/**
- * Color lines for `str`, using the color `name`.
- *
- * @api private
- * @param {string} name
- * @param {string} str
- * @return {string}
- */
-function colorLines(name, str) {
- return str.split('\n').map(function(str) {
- return color(name, str);
- }).join('\n');
-}
-
-/**
- * Object#toString reference.
- */
-var objToString = Object.prototype.toString;
-
-/**
- * Check that a / b have the same type.
- *
- * @api private
- * @param {Object} a
- * @param {Object} b
- * @return {boolean}
- */
-function sameType(a, b) {
- return objToString.call(a) === objToString.call(b);
-}
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/doc.js b/tests/lib/mocha-3.1.0/lib/reporters/doc.js
deleted file mode 100644
index 9f5c3f8a37..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/doc.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var utils = require('../utils');
-
-/**
- * Expose `Doc`.
- */
-
-exports = module.exports = Doc;
-
-/**
- * Initialize a new `Doc` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-function Doc(runner) {
- Base.call(this, runner);
-
- var indents = 2;
-
- function indent() {
- return Array(indents).join(' ');
- }
-
- runner.on('suite', function(suite) {
- if (suite.root) {
- return;
- }
- ++indents;
- console.log('%s<section class="suite">', indent());
- ++indents;
- console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
- console.log('%s<dl>', indent());
- });
-
- runner.on('suite end', function(suite) {
- if (suite.root) {
- return;
- }
- console.log('%s</dl>', indent());
- --indents;
- console.log('%s</section>', indent());
- --indents;
- });
-
- runner.on('pass', function(test) {
- console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
- var code = utils.escape(utils.clean(test.body));
- console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
- });
-
- runner.on('fail', function(test, err) {
- console.log('%s <dt class="error">%s</dt>', indent(), utils.escape(test.title));
- var code = utils.escape(utils.clean(test.body));
- console.log('%s <dd class="error"><pre><code>%s</code></pre></dd>', indent(), code);
- console.log('%s <dd class="error">%s</dd>', indent(), utils.escape(err));
- });
-}
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/dot.js b/tests/lib/mocha-3.1.0/lib/reporters/dot.js
deleted file mode 100644
index f8b4b41fe0..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/dot.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-var color = Base.color;
-
-/**
- * Expose `Dot`.
- */
-
-exports = module.exports = Dot;
-
-/**
- * Initialize a new `Dot` matrix test reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function Dot(runner) {
- Base.call(this, runner);
-
- var self = this;
- var width = Base.window.width * .75 | 0;
- var n = -1;
-
- runner.on('start', function() {
- process.stdout.write('\n');
- });
-
- runner.on('pending', function() {
- if (++n % width === 0) {
- process.stdout.write('\n ');
- }
- process.stdout.write(color('pending', Base.symbols.comma));
- });
-
- runner.on('pass', function(test) {
- if (++n % width === 0) {
- process.stdout.write('\n ');
- }
- if (test.speed === 'slow') {
- process.stdout.write(color('bright yellow', Base.symbols.dot));
- } else {
- process.stdout.write(color(test.speed, Base.symbols.dot));
- }
- });
-
- runner.on('fail', function() {
- if (++n % width === 0) {
- process.stdout.write('\n ');
- }
- process.stdout.write(color('fail', Base.symbols.bang));
- });
-
- runner.on('end', function() {
- console.log();
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(Dot, Base);
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/html.js b/tests/lib/mocha-3.1.0/lib/reporters/html.js
deleted file mode 100644
index 51ba1ca722..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/html.js
+++ /dev/null
@@ -1,344 +0,0 @@
-/* eslint-env browser */
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var utils = require('../utils');
-var Progress = require('../browser/progress');
-var escapeRe = require('escape-string-regexp');
-var escape = utils.escape;
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-/* eslint-disable no-unused-vars, no-native-reassign */
-var Date = global.Date;
-var setTimeout = global.setTimeout;
-var setInterval = global.setInterval;
-var clearTimeout = global.clearTimeout;
-var clearInterval = global.clearInterval;
-/* eslint-enable no-unused-vars, no-native-reassign */
-
-/**
- * Expose `HTML`.
- */
-
-exports = module.exports = HTML;
-
-/**
- * Stats template.
- */
-
-var statsTemplate = '<ul id="mocha-stats">'
- + '<li class="progress"><canvas width="40" height="40"></canvas></li>'
- + '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>'
- + '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>'
- + '<li class="duration">duration: <em>0</em>s</li>'
- + '</ul>';
-
-/**
- * Initialize a new `HTML` reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function HTML(runner) {
- Base.call(this, runner);
-
- var self = this;
- var stats = this.stats;
- var stat = fragment(statsTemplate);
- var items = stat.getElementsByTagName('li');
- var passes = items[1].getElementsByTagName('em')[0];
- var passesLink = items[1].getElementsByTagName('a')[0];
- var failures = items[2].getElementsByTagName('em')[0];
- var failuresLink = items[2].getElementsByTagName('a')[0];
- var duration = items[3].getElementsByTagName('em')[0];
- var canvas = stat.getElementsByTagName('canvas')[0];
- var report = fragment('<ul id="mocha-report"></ul>');
- var stack = [report];
- var progress;
- var ctx;
- var root = document.getElementById('mocha');
-
- if (canvas.getContext) {
- var ratio = window.devicePixelRatio || 1;
- canvas.style.width = canvas.width;
- canvas.style.height = canvas.height;
- canvas.width *= ratio;
- canvas.height *= ratio;
- ctx = canvas.getContext('2d');
- ctx.scale(ratio, ratio);
- progress = new Progress();
- }
-
- if (!root) {
- return error('#mocha div missing, add it to your document');
- }
-
- // pass toggle
- on(passesLink, 'click', function(evt) {
- evt.preventDefault();
- unhide();
- var name = (/pass/).test(report.className) ? '' : ' pass';
- report.className = report.className.replace(/fail|pass/g, '') + name;
- if (report.className.trim()) {
- hideSuitesWithout('test pass');
- }
- });
-
- // failure toggle
- on(failuresLink, 'click', function(evt) {
- evt.preventDefault();
- unhide();
- var name = (/fail/).test(report.className) ? '' : ' fail';
- report.className = report.className.replace(/fail|pass/g, '') + name;
- if (report.className.trim()) {
- hideSuitesWithout('test fail');
- }
- });
-
- root.appendChild(stat);
- root.appendChild(report);
-
- if (progress) {
- progress.size(40);
- }
-
- runner.on('suite', function(suite) {
- if (suite.root) {
- return;
- }
-
- // suite
- var url = self.suiteURL(suite);
- var el = fragment('<li class="suite"><h1><a href="%s">%s</a></h1></li>', url, escape(suite.title));
-
- // container
- stack[0].appendChild(el);
- stack.unshift(document.createElement('ul'));
- el.appendChild(stack[0]);
- });
-
- runner.on('suite end', function(suite) {
- if (suite.root) {
- updateStats();
- return;
- }
- stack.shift();
- });
-
- runner.on('pass', function(test) {
- var url = self.testURL(test);
- var markup = '<li class="test pass %e"><h2>%e<span class="duration">%ems</span> '
- + '<a href="%s" class="replay">‣</a></h2></li>';
- var el = fragment(markup, test.speed, test.title, test.duration, url);
- self.addCodeToggle(el, test.body);
- appendToStack(el);
- updateStats();
- });
-
- runner.on('fail', function(test) {
- var el = fragment('<li class="test fail"><h2>%e <a href="%e" class="replay">‣</a></h2></li>',
- test.title, self.testURL(test));
- var stackString; // Note: Includes leading newline
- var message = test.err.toString();
-
- // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
- // check for the result of the stringifying.
- if (message === '[object Error]') {
- message = test.err.message;
- }
-
- if (test.err.stack) {
- var indexOfMessage = test.err.stack.indexOf(test.err.message);
- if (indexOfMessage === -1) {
- stackString = test.err.stack;
- } else {
- stackString = test.err.stack.substr(test.err.message.length + indexOfMessage);
- }
- } else if (test.err.sourceURL && test.err.line !== undefined) {
- // Safari doesn't give you a stack. Let's at least provide a source line.
- stackString = '\n(' + test.err.sourceURL + ':' + test.err.line + ')';
- }
-
- stackString = stackString || '';
-
- if (test.err.htmlMessage && stackString) {
- el.appendChild(fragment('<div class="html-error">%s\n<pre class="error">%e</pre></div>',
- test.err.htmlMessage, stackString));
- } else if (test.err.htmlMessage) {
- el.appendChild(fragment('<div class="html-error">%s</div>', test.err.htmlMessage));
- } else {
- el.appendChild(fragment('<pre class="error">%e%e</pre>', message, stackString));
- }
-
- self.addCodeToggle(el, test.body);
- appendToStack(el);
- updateStats();
- });
-
- runner.on('pending', function(test) {
- var el = fragment('<li class="test pass pending"><h2>%e</h2></li>', test.title);
- appendToStack(el);
- updateStats();
- });
-
- function appendToStack(el) {
- // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.
- if (stack[0]) {
- stack[0].appendChild(el);
- }
- }
-
- function updateStats() {
- // TODO: add to stats
- var percent = stats.tests / runner.total * 100 | 0;
- if (progress) {
- progress.update(percent).draw(ctx);
- }
-
- // update stats
- var ms = new Date() - stats.start;
- text(passes, stats.passes);
- text(failures, stats.failures);
- text(duration, (ms / 1000).toFixed(2));
- }
-}
-
-/**
- * Makes a URL, preserving querystring ("search") parameters.
- *
- * @param {string} s
- * @return {string} A new URL.
- */
-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(escapeRe(s));
-}
-
-/**
- * Provide suite URL.
- *
- * @param {Object} [suite]
- */
-HTML.prototype.suiteURL = function(suite) {
- return makeUrl(suite.fullTitle());
-};
-
-/**
- * Provide test URL.
- *
- * @param {Object} [test]
- */
-HTML.prototype.testURL = function(test) {
- return makeUrl(test.fullTitle());
-};
-
-/**
- * Adds code toggle functionality for the provided test's list element.
- *
- * @param {HTMLLIElement} el
- * @param {string} contents
- */
-HTML.prototype.addCodeToggle = function(el, contents) {
- var h2 = el.getElementsByTagName('h2')[0];
-
- on(h2, 'click', function() {
- pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
- });
-
- var pre = fragment('<pre><code>%e</code></pre>', utils.clean(contents));
- el.appendChild(pre);
- pre.style.display = 'none';
-};
-
-/**
- * Display error `msg`.
- *
- * @param {string} msg
- */
-function error(msg) {
- document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
-}
-
-/**
- * Return a DOM fragment from `html`.
- *
- * @param {string} html
- */
-function fragment(html) {
- var args = arguments;
- var div = document.createElement('div');
- var i = 1;
-
- div.innerHTML = html.replace(/%([se])/g, function(_, type) {
- switch (type) {
- case 's': return String(args[i++]);
- case 'e': return escape(args[i++]);
- // no default
- }
- });
-
- return div.firstChild;
-}
-
-/**
- * Check for suites that do not have elements
- * with `classname`, and hide them.
- *
- * @param {text} classname
- */
-function hideSuitesWithout(classname) {
- var suites = document.getElementsByClassName('suite');
- for (var i = 0; i < suites.length; i++) {
- var els = suites[i].getElementsByClassName(classname);
- if (!els.length) {
- suites[i].className += ' hidden';
- }
- }
-}
-
-/**
- * Unhide .hidden suites.
- */
-function unhide() {
- var els = document.getElementsByClassName('suite hidden');
- for (var i = 0; i < els.length; ++i) {
- els[i].className = els[i].className.replace('suite hidden', 'suite');
- }
-}
-
-/**
- * Set an element's text contents.
- *
- * @param {HTMLElement} el
- * @param {string} contents
- */
-function text(el, contents) {
- if (el.textContent) {
- el.textContent = contents;
- } else {
- el.innerText = contents;
- }
-}
-
-/**
- * Listen on `event` with callback `fn`.
- */
-function on(el, event, fn) {
- if (el.addEventListener) {
- el.addEventListener(event, fn, false);
- } else {
- el.attachEvent('on' + event, fn);
- }
-}
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/index.js b/tests/lib/mocha-3.1.0/lib/reporters/index.js
deleted file mode 100644
index 221a81d95b..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Alias exports to a their normalized format Mocha#reporter to prevent a need
-// for dynamic (try/catch) requires, which Browserify doesn't handle.
-exports.Base = exports.base = require('./base');
-exports.Dot = exports.dot = require('./dot');
-exports.Doc = exports.doc = require('./doc');
-exports.TAP = exports.tap = require('./tap');
-exports.JSON = exports.json = require('./json');
-exports.HTML = exports.html = require('./html');
-exports.List = exports.list = require('./list');
-exports.Min = exports.min = require('./min');
-exports.Spec = exports.spec = require('./spec');
-exports.Nyan = exports.nyan = require('./nyan');
-exports.XUnit = exports.xunit = require('./xunit');
-exports.Markdown = exports.markdown = require('./markdown');
-exports.Progress = exports.progress = require('./progress');
-exports.Landing = exports.landing = require('./landing');
-exports.JSONStream = exports['json-stream'] = require('./json-stream');
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/json-stream.js b/tests/lib/mocha-3.1.0/lib/reporters/json-stream.js
deleted file mode 100644
index f07f8657c0..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/json-stream.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var JSON = require('json3');
-
-/**
- * Expose `List`.
- */
-
-exports = module.exports = List;
-
-/**
- * Initialize a new `List` test reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function List(runner) {
- Base.call(this, runner);
-
- var self = this;
- var total = runner.total;
-
- runner.on('start', function() {
- console.log(JSON.stringify(['start', { total: total }]));
- });
-
- runner.on('pass', function(test) {
- console.log(JSON.stringify(['pass', clean(test)]));
- });
-
- runner.on('fail', function(test, err) {
- test = clean(test);
- test.err = err.message;
- test.stack = err.stack || null;
- console.log(JSON.stringify(['fail', test]));
- });
-
- runner.on('end', function() {
- process.stdout.write(JSON.stringify(['end', self.stats]));
- });
-}
-
-/**
- * Return a plain-object representation of `test`
- * free of cyclic properties etc.
- *
- * @api private
- * @param {Object} test
- * @return {Object}
- */
-function clean(test) {
- return {
- title: test.title,
- fullTitle: test.fullTitle(),
- duration: test.duration,
- currentRetry: test.currentRetry()
- };
-}
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/json.js b/tests/lib/mocha-3.1.0/lib/reporters/json.js
deleted file mode 100644
index cd9ec286b7..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/json.js
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-
-/**
- * Expose `JSON`.
- */
-
-exports = module.exports = JSONReporter;
-
-/**
- * Initialize a new `JSON` reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function JSONReporter(runner) {
- Base.call(this, runner);
-
- var self = this;
- var tests = [];
- var pending = [];
- var failures = [];
- var passes = [];
-
- runner.on('test end', function(test) {
- tests.push(test);
- });
-
- runner.on('pass', function(test) {
- passes.push(test);
- });
-
- runner.on('fail', function(test) {
- failures.push(test);
- });
-
- runner.on('pending', function(test) {
- pending.push(test);
- });
-
- runner.on('end', function() {
- var obj = {
- stats: self.stats,
- tests: tests.map(clean),
- pending: pending.map(clean),
- failures: failures.map(clean),
- passes: passes.map(clean)
- };
-
- runner.testResults = obj;
-
- process.stdout.write(JSON.stringify(obj, null, 2));
- });
-}
-
-/**
- * Return a plain-object representation of `test`
- * free of cyclic properties etc.
- *
- * @api private
- * @param {Object} test
- * @return {Object}
- */
-function clean(test) {
- return {
- title: test.title,
- fullTitle: test.fullTitle(),
- duration: test.duration,
- currentRetry: test.currentRetry(),
- err: errorJSON(test.err || {})
- };
-}
-
-/**
- * Transform `error` into a JSON object.
- *
- * @api private
- * @param {Error} err
- * @return {Object}
- */
-function errorJSON(err) {
- var res = {};
- Object.getOwnPropertyNames(err).forEach(function(key) {
- res[key] = err[key];
- }, err);
- return res;
-}
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/landing.js b/tests/lib/mocha-3.1.0/lib/reporters/landing.js
deleted file mode 100644
index b66b2000c1..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/landing.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-var cursor = Base.cursor;
-var color = Base.color;
-
-/**
- * Expose `Landing`.
- */
-
-exports = module.exports = Landing;
-
-/**
- * Airplane color.
- */
-
-Base.colors.plane = 0;
-
-/**
- * Airplane crash color.
- */
-
-Base.colors['plane crash'] = 31;
-
-/**
- * Runway color.
- */
-
-Base.colors.runway = 90;
-
-/**
- * Initialize a new `Landing` reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function Landing(runner) {
- Base.call(this, runner);
-
- var self = this;
- var width = Base.window.width * .75 | 0;
- var total = runner.total;
- var stream = process.stdout;
- var plane = color('plane', '✈');
- var crashed = -1;
- var n = 0;
-
- function runway() {
- var buf = Array(width).join('-');
- return ' ' + color('runway', buf);
- }
-
- runner.on('start', function() {
- stream.write('\n\n\n ');
- cursor.hide();
- });
-
- runner.on('test end', function(test) {
- // check if the plane crashed
- var col = crashed === -1 ? width * ++n / total | 0 : crashed;
-
- // show the crash
- if (test.state === 'failed') {
- plane = color('plane crash', '✈');
- crashed = col;
- }
-
- // render landing strip
- stream.write('\u001b[' + (width + 1) + 'D\u001b[2A');
- stream.write(runway());
- stream.write('\n ');
- stream.write(color('runway', Array(col).join('â‹…')));
- stream.write(plane);
- stream.write(color('runway', Array(width - col).join('â‹…') + '\n'));
- stream.write(runway());
- stream.write('\u001b[0m');
- });
-
- runner.on('end', function() {
- cursor.show();
- console.log();
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(Landing, Base);
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/list.js b/tests/lib/mocha-3.1.0/lib/reporters/list.js
deleted file mode 100644
index 0e5f910d1f..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/list.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-var color = Base.color;
-var cursor = Base.cursor;
-
-/**
- * Expose `List`.
- */
-
-exports = module.exports = List;
-
-/**
- * Initialize a new `List` test reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function List(runner) {
- Base.call(this, runner);
-
- var self = this;
- var n = 0;
-
- runner.on('start', function() {
- console.log();
- });
-
- runner.on('test', function(test) {
- process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
- });
-
- runner.on('pending', function(test) {
- var fmt = color('checkmark', ' -')
- + color('pending', ' %s');
- console.log(fmt, test.fullTitle());
- });
-
- runner.on('pass', function(test) {
- var fmt = color('checkmark', ' ' + Base.symbols.dot)
- + color('pass', ' %s: ')
- + color(test.speed, '%dms');
- cursor.CR();
- console.log(fmt, test.fullTitle(), test.duration);
- });
-
- runner.on('fail', function(test) {
- cursor.CR();
- console.log(color('fail', ' %d) %s'), ++n, test.fullTitle());
- });
-
- runner.on('end', self.epilogue.bind(self));
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(List, Base);
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/markdown.js b/tests/lib/mocha-3.1.0/lib/reporters/markdown.js
deleted file mode 100644
index 680c55d709..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/markdown.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var utils = require('../utils');
-
-/**
- * Constants
- */
-
-var SUITE_PREFIX = '$';
-
-/**
- * Expose `Markdown`.
- */
-
-exports = module.exports = Markdown;
-
-/**
- * Initialize a new `Markdown` reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function Markdown(runner) {
- Base.call(this, runner);
-
- var level = 0;
- var buf = '';
-
- function title(str) {
- return Array(level).join('#') + ' ' + str;
- }
-
- function mapTOC(suite, obj) {
- var ret = obj;
- var key = SUITE_PREFIX + suite.title;
-
- obj = obj[key] = obj[key] || { suite: suite };
- suite.suites.forEach(function(suite) {
- mapTOC(suite, obj);
- });
-
- return ret;
- }
-
- function stringifyTOC(obj, level) {
- ++level;
- var buf = '';
- var link;
- for (var key in obj) {
- if (key === 'suite') {
- continue;
- }
- if (key !== SUITE_PREFIX) {
- link = ' - [' + key.substring(1) + ']';
- link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
- buf += Array(level).join(' ') + link;
- }
- buf += stringifyTOC(obj[key], level);
- }
- return buf;
- }
-
- function generateTOC(suite) {
- var obj = mapTOC(suite, {});
- return stringifyTOC(obj, 0);
- }
-
- generateTOC(runner.suite);
-
- runner.on('suite', function(suite) {
- ++level;
- var slug = utils.slug(suite.fullTitle());
- buf += '<a name="' + slug + '"></a>' + '\n';
- buf += title(suite.title) + '\n';
- });
-
- runner.on('suite end', function() {
- --level;
- });
-
- runner.on('pass', function(test) {
- var code = utils.clean(test.body);
- buf += test.title + '.\n';
- buf += '\n```js\n';
- buf += code + '\n';
- buf += '```\n\n';
- });
-
- runner.on('end', function() {
- process.stdout.write('# TOC\n');
- process.stdout.write(generateTOC(runner.suite));
- process.stdout.write(buf);
- });
-}
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/min.js b/tests/lib/mocha-3.1.0/lib/reporters/min.js
deleted file mode 100644
index 2b48212ca8..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/min.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-
-/**
- * Expose `Min`.
- */
-
-exports = module.exports = Min;
-
-/**
- * Initialize a new `Min` minimal test reporter (best used with --watch).
- *
- * @api public
- * @param {Runner} runner
- */
-function Min(runner) {
- Base.call(this, runner);
-
- runner.on('start', function() {
- // clear screen
- process.stdout.write('\u001b[2J');
- // set cursor position
- process.stdout.write('\u001b[1;3H');
- });
-
- runner.on('end', this.epilogue.bind(this));
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(Min, Base);
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/nyan.js b/tests/lib/mocha-3.1.0/lib/reporters/nyan.js
deleted file mode 100644
index ba1b0509d9..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/nyan.js
+++ /dev/null
@@ -1,261 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-
-/**
- * Expose `Dot`.
- */
-
-exports = module.exports = NyanCat;
-
-/**
- * Initialize a new `Dot` matrix test reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function NyanCat(runner) {
- Base.call(this, runner);
-
- var self = this;
- var width = Base.window.width * .75 | 0;
- var nyanCatWidth = this.nyanCatWidth = 11;
-
- this.colorIndex = 0;
- this.numberOfLines = 4;
- this.rainbowColors = self.generateColors();
- this.scoreboardWidth = 5;
- this.tick = 0;
- this.trajectories = [[], [], [], []];
- this.trajectoryWidthMax = (width - nyanCatWidth);
-
- runner.on('start', function() {
- Base.cursor.hide();
- self.draw();
- });
-
- runner.on('pending', function() {
- self.draw();
- });
-
- runner.on('pass', function() {
- self.draw();
- });
-
- runner.on('fail', function() {
- self.draw();
- });
-
- runner.on('end', function() {
- Base.cursor.show();
- for (var i = 0; i < self.numberOfLines; i++) {
- write('\n');
- }
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(NyanCat, Base);
-
-/**
- * Draw the nyan cat
- *
- * @api private
- */
-
-NyanCat.prototype.draw = function() {
- this.appendRainbow();
- this.drawScoreboard();
- this.drawRainbow();
- this.drawNyanCat();
- this.tick = !this.tick;
-};
-
-/**
- * Draw the "scoreboard" showing the number
- * of passes, failures and pending tests.
- *
- * @api private
- */
-
-NyanCat.prototype.drawScoreboard = function() {
- var stats = this.stats;
-
- function draw(type, n) {
- write(' ');
- write(Base.color(type, n));
- write('\n');
- }
-
- draw('green', stats.passes);
- draw('fail', stats.failures);
- draw('pending', stats.pending);
- write('\n');
-
- this.cursorUp(this.numberOfLines);
-};
-
-/**
- * Append the rainbow.
- *
- * @api private
- */
-
-NyanCat.prototype.appendRainbow = function() {
- var segment = this.tick ? '_' : '-';
- var rainbowified = this.rainbowify(segment);
-
- for (var index = 0; index < this.numberOfLines; index++) {
- var trajectory = this.trajectories[index];
- if (trajectory.length >= this.trajectoryWidthMax) {
- trajectory.shift();
- }
- trajectory.push(rainbowified);
- }
-};
-
-/**
- * Draw the rainbow.
- *
- * @api private
- */
-
-NyanCat.prototype.drawRainbow = function() {
- var self = this;
-
- this.trajectories.forEach(function(line) {
- write('\u001b[' + self.scoreboardWidth + 'C');
- write(line.join(''));
- write('\n');
- });
-
- this.cursorUp(this.numberOfLines);
-};
-
-/**
- * Draw the nyan cat
- *
- * @api private
- */
-NyanCat.prototype.drawNyanCat = function() {
- var self = this;
- var startWidth = this.scoreboardWidth + this.trajectories[0].length;
- var dist = '\u001b[' + startWidth + 'C';
- var padding = '';
-
- write(dist);
- write('_,------,');
- write('\n');
-
- write(dist);
- padding = self.tick ? ' ' : ' ';
- write('_|' + padding + '/\\_/\\ ');
- write('\n');
-
- write(dist);
- padding = self.tick ? '_' : '__';
- var tail = self.tick ? '~' : '^';
- write(tail + '|' + padding + this.face() + ' ');
- write('\n');
-
- write(dist);
- padding = self.tick ? ' ' : ' ';
- write(padding + '"" "" ');
- write('\n');
-
- this.cursorUp(this.numberOfLines);
-};
-
-/**
- * Draw nyan cat face.
- *
- * @api private
- * @return {string}
- */
-
-NyanCat.prototype.face = function() {
- var stats = this.stats;
- if (stats.failures) {
- return '( x .x)';
- } else if (stats.pending) {
- return '( o .o)';
- } else if (stats.passes) {
- return '( ^ .^)';
- }
- return '( - .-)';
-};
-
-/**
- * Move cursor up `n`.
- *
- * @api private
- * @param {number} n
- */
-
-NyanCat.prototype.cursorUp = function(n) {
- write('\u001b[' + n + 'A');
-};
-
-/**
- * Move cursor down `n`.
- *
- * @api private
- * @param {number} n
- */
-
-NyanCat.prototype.cursorDown = function(n) {
- write('\u001b[' + n + 'B');
-};
-
-/**
- * Generate rainbow colors.
- *
- * @api private
- * @return {Array}
- */
-NyanCat.prototype.generateColors = function() {
- var colors = [];
-
- for (var i = 0; i < (6 * 7); i++) {
- var pi3 = Math.floor(Math.PI / 3);
- var n = (i * (1.0 / 6));
- var r = Math.floor(3 * Math.sin(n) + 3);
- var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
- var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
- colors.push(36 * r + 6 * g + b + 16);
- }
-
- return colors;
-};
-
-/**
- * Apply rainbow to the given `str`.
- *
- * @api private
- * @param {string} str
- * @return {string}
- */
-NyanCat.prototype.rainbowify = function(str) {
- if (!Base.useColors) {
- return str;
- }
- var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
- this.colorIndex += 1;
- return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
-};
-
-/**
- * Stdout helper.
- *
- * @param {string} string A message to write to stdout.
- */
-function write(string) {
- process.stdout.write(string);
-}
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/progress.js b/tests/lib/mocha-3.1.0/lib/reporters/progress.js
deleted file mode 100644
index 5349ca8936..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/progress.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-var color = Base.color;
-var cursor = Base.cursor;
-
-/**
- * Expose `Progress`.
- */
-
-exports = module.exports = Progress;
-
-/**
- * General progress bar color.
- */
-
-Base.colors.progress = 90;
-
-/**
- * Initialize a new `Progress` bar test reporter.
- *
- * @api public
- * @param {Runner} runner
- * @param {Object} options
- */
-function Progress(runner, options) {
- Base.call(this, runner);
-
- var self = this;
- var width = Base.window.width * .50 | 0;
- var total = runner.total;
- var complete = 0;
- var lastN = -1;
-
- // default chars
- options = options || {};
- options.open = options.open || '[';
- options.complete = options.complete || 'â–¬';
- options.incomplete = options.incomplete || Base.symbols.dot;
- options.close = options.close || ']';
- options.verbose = false;
-
- // tests started
- runner.on('start', function() {
- console.log();
- cursor.hide();
- });
-
- // tests complete
- runner.on('test end', function() {
- complete++;
-
- var percent = complete / total;
- var n = width * percent | 0;
- var i = width - n;
-
- if (n === lastN && !options.verbose) {
- // Don't re-render the line if it hasn't changed
- return;
- }
- lastN = n;
-
- cursor.CR();
- process.stdout.write('\u001b[J');
- process.stdout.write(color('progress', ' ' + options.open));
- process.stdout.write(Array(n).join(options.complete));
- process.stdout.write(Array(i).join(options.incomplete));
- process.stdout.write(color('progress', options.close));
- if (options.verbose) {
- process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
- }
- });
-
- // tests are complete, output some stats
- // and the failures if any
- runner.on('end', function() {
- cursor.show();
- console.log();
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(Progress, Base);
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/spec.js b/tests/lib/mocha-3.1.0/lib/reporters/spec.js
deleted file mode 100644
index 28993a8f32..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/spec.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-var color = Base.color;
-
-/**
- * Expose `Spec`.
- */
-
-exports = module.exports = Spec;
-
-/**
- * Initialize a new `Spec` test reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function Spec(runner) {
- Base.call(this, runner);
-
- var self = this;
- var indents = 0;
- var n = 0;
-
- function indent() {
- return Array(indents).join(' ');
- }
-
- runner.on('start', function() {
- console.log();
- });
-
- runner.on('suite', function(suite) {
- ++indents;
- console.log(color('suite', '%s%s'), indent(), suite.title);
- });
-
- runner.on('suite end', function() {
- --indents;
- if (indents === 1) {
- console.log();
- }
- });
-
- runner.on('pending', function(test) {
- var fmt = indent() + color('pending', ' - %s');
- console.log(fmt, test.title);
- });
-
- runner.on('pass', function(test) {
- var fmt;
- if (test.speed === 'fast') {
- fmt = indent()
- + color('checkmark', ' ' + Base.symbols.ok)
- + color('pass', ' %s');
- console.log(fmt, test.title);
- } else {
- fmt = indent()
- + color('checkmark', ' ' + Base.symbols.ok)
- + color('pass', ' %s')
- + color(test.speed, ' (%dms)');
- console.log(fmt, test.title, test.duration);
- }
- });
-
- runner.on('fail', function(test) {
- console.log(indent() + color('fail', ' %d) %s'), ++n, test.title);
- });
-
- runner.on('end', self.epilogue.bind(self));
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(Spec, Base);
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/tap.js b/tests/lib/mocha-3.1.0/lib/reporters/tap.js
deleted file mode 100644
index d9b1b953aa..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/tap.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-
-/**
- * Expose `TAP`.
- */
-
-exports = module.exports = TAP;
-
-/**
- * Initialize a new `TAP` reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function TAP(runner) {
- Base.call(this, runner);
-
- var n = 1;
- var passes = 0;
- var failures = 0;
-
- runner.on('start', function() {
- var total = runner.grepTotal(runner.suite);
- console.log('%d..%d', 1, total);
- });
-
- runner.on('test end', function() {
- ++n;
- });
-
- runner.on('pending', function(test) {
- console.log('ok %d %s # SKIP -', n, title(test));
- });
-
- runner.on('pass', function(test) {
- passes++;
- console.log('ok %d %s', n, title(test));
- });
-
- runner.on('fail', function(test, err) {
- failures++;
- console.log('not ok %d %s', n, title(test));
- if (err.stack) {
- console.log(err.stack.replace(/^/gm, ' '));
- }
- });
-
- runner.on('end', function() {
- console.log('# tests ' + (passes + failures));
- console.log('# pass ' + passes);
- console.log('# fail ' + failures);
- });
-}
-
-/**
- * Return a TAP-safe title of `test`
- *
- * @api private
- * @param {Object} test
- * @return {String}
- */
-function title(test) {
- return test.fullTitle().replace(/#/g, '');
-}
diff --git a/tests/lib/mocha-3.1.0/lib/reporters/xunit.js b/tests/lib/mocha-3.1.0/lib/reporters/xunit.js
deleted file mode 100644
index 1cfd8f4f51..0000000000
--- a/tests/lib/mocha-3.1.0/lib/reporters/xunit.js
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var utils = require('../utils');
-var inherits = utils.inherits;
-var fs = require('fs');
-var escape = utils.escape;
-var mkdirp = require('mkdirp');
-var path = require('path');
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-/* eslint-disable no-unused-vars, no-native-reassign */
-var Date = global.Date;
-var setTimeout = global.setTimeout;
-var setInterval = global.setInterval;
-var clearTimeout = global.clearTimeout;
-var clearInterval = global.clearInterval;
-/* eslint-enable no-unused-vars, no-native-reassign */
-
-/**
- * Expose `XUnit`.
- */
-
-exports = module.exports = XUnit;
-
-/**
- * Initialize a new `XUnit` reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function XUnit(runner, options) {
- Base.call(this, runner);
-
- var stats = this.stats;
- var tests = [];
- var self = this;
-
- if (options.reporterOptions && options.reporterOptions.output) {
- if (!fs.createWriteStream) {
- throw new Error('file output not supported in browser');
- }
- mkdirp.sync(path.dirname(options.reporterOptions.output));
- self.fileStream = fs.createWriteStream(options.reporterOptions.output);
- }
-
- runner.on('pending', function(test) {
- tests.push(test);
- });
-
- runner.on('pass', function(test) {
- tests.push(test);
- });
-
- runner.on('fail', function(test) {
- tests.push(test);
- });
-
- runner.on('end', function() {
- self.write(tag('testsuite', {
- name: 'Mocha Tests',
- tests: stats.tests,
- failures: stats.failures,
- errors: stats.failures,
- skipped: stats.tests - stats.failures - stats.passes,
- timestamp: (new Date()).toUTCString(),
- time: (stats.duration / 1000) || 0
- }, false));
-
- tests.forEach(function(t) {
- self.test(t);
- });
-
- self.write('</testsuite>');
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(XUnit, Base);
-
-/**
- * Override done to close the stream (if it's a file).
- *
- * @param failures
- * @param {Function} fn
- */
-XUnit.prototype.done = function(failures, fn) {
- if (this.fileStream) {
- this.fileStream.end(function() {
- fn(failures);
- });
- } else {
- fn(failures);
- }
-};
-
-/**
- * Write out the given line.
- *
- * @param {string} line
- */
-XUnit.prototype.write = function(line) {
- if (this.fileStream) {
- this.fileStream.write(line + '\n');
- } else if (typeof process === 'object' && process.stdout) {
- process.stdout.write(line + '\n');
- } else {
- console.log(line);
- }
-};
-
-/**
- * Output tag for the given `test.`
- *
- * @param {Test} test
- */
-XUnit.prototype.test = function(test) {
- var attrs = {
- classname: test.parent.fullTitle(),
- name: test.title,
- time: (test.duration / 1000) || 0
- };
-
- if (test.state === 'failed') {
- var err = test.err;
- this.write(tag('testcase', attrs, false, tag('failure', {}, false, escape(err.message) + '\n' + escape(err.stack))));
- } else if (test.isPending()) {
- this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));
- } else {
- this.write(tag('testcase', attrs, true));
- }
-};
-
-/**
- * HTML tag helper.
- *
- * @param name
- * @param attrs
- * @param close
- * @param content
- * @return {string}
- */
-function tag(name, attrs, close, content) {
- var end = close ? '/>' : '>';
- var pairs = [];
- var tag;
-
- for (var key in attrs) {
- if (Object.prototype.hasOwnProperty.call(attrs, key)) {
- pairs.push(key + '="' + escape(attrs[key]) + '"');
- }
- }
-
- tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
- if (content) {
- tag += content + '</' + name + end;
- }
- return tag;
-}
diff --git a/tests/lib/mocha-3.1.0/lib/runnable.js b/tests/lib/mocha-3.1.0/lib/runnable.js
deleted file mode 100644
index 52ee900b22..0000000000
--- a/tests/lib/mocha-3.1.0/lib/runnable.js
+++ /dev/null
@@ -1,380 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('events').EventEmitter;
-var JSON = require('json3');
-var Pending = require('./pending');
-var debug = require('debug')('mocha:runnable');
-var milliseconds = require('./ms');
-var utils = require('./utils');
-var create = require('lodash.create');
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-/* eslint-disable no-unused-vars, no-native-reassign */
-var Date = global.Date;
-var setTimeout = global.setTimeout;
-var setInterval = global.setInterval;
-var clearTimeout = global.clearTimeout;
-var clearInterval = global.clearInterval;
-/* eslint-enable no-unused-vars, no-native-reassign */
-
-/**
- * Object#toString().
- */
-
-var toString = Object.prototype.toString;
-
-/**
- * Expose `Runnable`.
- */
-
-module.exports = Runnable;
-
-/**
- * Initialize a new `Runnable` with the given `title` and callback `fn`.
- *
- * @param {String} title
- * @param {Function} fn
- * @api private
- * @param {string} title
- * @param {Function} fn
- */
-function Runnable(title, fn) {
- this.title = title;
- this.fn = fn;
- this.body = (fn || '').toString();
- this.async = fn && fn.length;
- this.sync = !this.async;
- this._timeout = 2000;
- this._slow = 75;
- this._enableTimeouts = true;
- this.timedOut = false;
- this._trace = new Error('done() called multiple times');
- this._retries = -1;
- this._currentRetry = 0;
- this.pending = false;
-}
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-Runnable.prototype = create(EventEmitter.prototype, {
- constructor: Runnable
-});
-
-/**
- * Set & get timeout `ms`.
- *
- * @api private
- * @param {number|string} ms
- * @return {Runnable|number} ms or Runnable instance.
- */
-Runnable.prototype.timeout = function(ms) {
- if (!arguments.length) {
- return this._timeout;
- }
- // see #1652 for reasoning
- if (ms === 0 || ms > Math.pow(2, 31)) {
- this._enableTimeouts = false;
- }
- if (typeof ms === 'string') {
- ms = milliseconds(ms);
- }
- debug('timeout %d', ms);
- this._timeout = ms;
- if (this.timer) {
- this.resetTimeout();
- }
- return this;
-};
-
-/**
- * Set & get slow `ms`.
- *
- * @api private
- * @param {number|string} ms
- * @return {Runnable|number} ms or Runnable instance.
- */
-Runnable.prototype.slow = function(ms) {
- if (typeof ms === 'undefined') {
- return this._slow;
- }
- if (typeof ms === 'string') {
- ms = milliseconds(ms);
- }
- debug('timeout %d', ms);
- this._slow = ms;
- return this;
-};
-
-/**
- * Set and get whether timeout is `enabled`.
- *
- * @api private
- * @param {boolean} enabled
- * @return {Runnable|boolean} enabled or Runnable instance.
- */
-Runnable.prototype.enableTimeouts = function(enabled) {
- if (!arguments.length) {
- return this._enableTimeouts;
- }
- debug('enableTimeouts %s', enabled);
- this._enableTimeouts = enabled;
- return this;
-};
-
-/**
- * Halt and mark as pending.
- *
- * @api public
- */
-Runnable.prototype.skip = function() {
- throw new Pending('sync skip');
-};
-
-/**
- * Check if this runnable or its parent suite is marked as pending.
- *
- * @api private
- */
-Runnable.prototype.isPending = function() {
- return this.pending || (this.parent && this.parent.isPending());
-};
-
-/**
- * Set number of retries.
- *
- * @api private
- */
-Runnable.prototype.retries = function(n) {
- if (!arguments.length) {
- return this._retries;
- }
- this._retries = n;
-};
-
-/**
- * Get current retry
- *
- * @api private
- */
-Runnable.prototype.currentRetry = function(n) {
- if (!arguments.length) {
- return this._currentRetry;
- }
- this._currentRetry = n;
-};
-
-/**
- * Return the full title generated by recursively concatenating the parent's
- * full title.
- *
- * @api public
- * @return {string}
- */
-Runnable.prototype.fullTitle = function() {
- return this.parent.fullTitle() + ' ' + this.title;
-};
-
-/**
- * Clear the timeout.
- *
- * @api private
- */
-Runnable.prototype.clearTimeout = function() {
- clearTimeout(this.timer);
-};
-
-/**
- * Inspect the runnable void of private properties.
- *
- * @api private
- * @return {string}
- */
-Runnable.prototype.inspect = function() {
- return JSON.stringify(this, function(key, val) {
- if (key[0] === '_') {
- return;
- }
- if (key === 'parent') {
- return '#<Suite>';
- }
- if (key === 'ctx') {
- return '#<Context>';
- }
- return val;
- }, 2);
-};
-
-/**
- * Reset the timeout.
- *
- * @api private
- */
-Runnable.prototype.resetTimeout = function() {
- var self = this;
- var ms = this.timeout() || 1e9;
-
- if (!this._enableTimeouts) {
- return;
- }
- this.clearTimeout();
- this.timer = setTimeout(function() {
- if (!self._enableTimeouts) {
- return;
- }
- self.callback(new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.'));
- self.timedOut = true;
- }, ms);
-};
-
-/**
- * Whitelist a list of globals for this test run.
- *
- * @api private
- * @param {string[]} globals
- */
-Runnable.prototype.globals = function(globals) {
- if (!arguments.length) {
- return this._allowedGlobals;
- }
- this._allowedGlobals = globals;
-};
-
-/**
- * Run the test and invoke `fn(err)`.
- *
- * @param {Function} fn
- * @api private
- */
-Runnable.prototype.run = function(fn) {
- var self = this;
- var start = new Date();
- var ctx = this.ctx;
- var finished;
- var emitted;
-
- // Sometimes the ctx exists, but it is not runnable
- if (ctx && ctx.runnable) {
- ctx.runnable(this);
- }
-
- // called multiple times
- function multiple(err) {
- if (emitted) {
- return;
- }
- emitted = true;
- self.emit('error', err || new Error('done() called multiple times; stacktrace may be inaccurate'));
- }
-
- // finished
- function done(err) {
- var ms = self.timeout();
- if (self.timedOut) {
- return;
- }
- if (finished) {
- return multiple(err || self._trace);
- }
-
- self.clearTimeout();
- self.duration = new Date() - start;
- finished = true;
- 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);
- }
-
- // for .resetTimeout()
- this.callback = done;
-
- // explicit async with `done` argument
- if (this.async) {
- this.resetTimeout();
-
- // allows skip() to be used in an explicit async context
- this.skip = function asyncSkip() {
- done(new Pending('async skip call'));
- // halt execution. the Runnable will be marked pending
- // by the previous call, and the uncaught handler will ignore
- // the failure.
- throw new Pending('async skip; aborting execution');
- };
-
- if (this.allowUncaught) {
- return callFnAsync(this.fn);
- }
- try {
- callFnAsync(this.fn);
- } catch (err) {
- done(utils.getError(err));
- }
- return;
- }
-
- if (this.allowUncaught) {
- callFn(this.fn);
- done();
- return;
- }
-
- // sync or promise-returning
- try {
- if (this.isPending()) {
- done();
- } else {
- callFn(this.fn);
- }
- } catch (err) {
- done(utils.getError(err));
- }
-
- function callFn(fn) {
- var result = fn.call(ctx);
- if (result && typeof result.then === 'function') {
- self.resetTimeout();
- result
- .then(function() {
- done();
- // Return null so libraries like bluebird do not warn about
- // subsequently constructed Promises.
- return null;
- },
- function(reason) {
- done(reason || new Error('Promise rejected with no or falsy reason'));
- });
- } else {
- if (self.asyncOnly) {
- return done(new Error('--async-only option in use without declaring `done()` or returning a promise'));
- }
-
- done();
- }
- }
-
- function callFnAsync(fn) {
- var result = fn.call(ctx, function(err) {
- if (err instanceof Error || toString.call(err) === '[object Error]') {
- return done(err);
- }
- if (err) {
- if (Object.prototype.toString.call(err) === '[object Object]') {
- return done(new Error('done() invoked with non-Error: '
- + JSON.stringify(err)));
- }
- return done(new Error('done() invoked with non-Error: ' + err));
- }
- if (result && utils.isPromise(result)) {
- return done(new Error('Resolution method is overspecified. Specify a callback *or* return a Promise; not both.'));
- }
-
- done();
- });
- }
-};
diff --git a/tests/lib/mocha-3.1.0/lib/runner.js b/tests/lib/mocha-3.1.0/lib/runner.js
deleted file mode 100644
index dc03ec451a..0000000000
--- a/tests/lib/mocha-3.1.0/lib/runner.js
+++ /dev/null
@@ -1,957 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('events').EventEmitter;
-var Pending = require('./pending');
-var utils = require('./utils');
-var inherits = utils.inherits;
-var debug = require('debug')('mocha:runner');
-var Runnable = require('./runnable');
-var filter = utils.filter;
-var indexOf = utils.indexOf;
-var some = utils.some;
-var keys = utils.keys;
-var stackFilter = utils.stackTraceFilter();
-var stringify = utils.stringify;
-var type = utils.type;
-var undefinedError = utils.undefinedError;
-var isArray = utils.isArray;
-
-/**
- * Non-enumerable globals.
- */
-
-var globals = [
- 'setTimeout',
- 'clearTimeout',
- 'setInterval',
- 'clearInterval',
- 'XMLHttpRequest',
- 'Date',
- 'setImmediate',
- 'clearImmediate'
-];
-
-/**
- * Expose `Runner`.
- */
-
-module.exports = Runner;
-
-/**
- * Initialize a `Runner` for the given `suite`.
- *
- * Events:
- *
- * - `start` execution started
- * - `end` execution complete
- * - `suite` (suite) test suite execution started
- * - `suite end` (suite) all tests (and sub-suites) have finished
- * - `test` (test) test execution started
- * - `test end` (test) test completed
- * - `hook` (hook) hook execution started
- * - `hook end` (hook) hook complete
- * - `pass` (test) test passed
- * - `fail` (test, err) test failed
- * - `pending` (test) test pending
- *
- * @api public
- * @param {Suite} suite Root suite
- * @param {boolean} [delay] Whether or not to delay execution of root suite
- * until ready.
- */
-function Runner(suite, delay) {
- var self = this;
- this._globals = [];
- this._abort = false;
- this._delay = delay;
- this.suite = suite;
- this.started = false;
- this.total = suite.total();
- this.failures = 0;
- this.on('test end', function(test) {
- self.checkGlobals(test);
- });
- this.on('hook end', function(hook) {
- self.checkGlobals(hook);
- });
- this._defaultGrep = /.*/;
- this.grep(this._defaultGrep);
- this.globals(this.globalProps().concat(extraGlobals()));
-}
-
-/**
- * Wrapper for setImmediate, process.nextTick, or browser polyfill.
- *
- * @param {Function} fn
- * @api private
- */
-Runner.immediately = global.setImmediate || process.nextTick;
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-inherits(Runner, EventEmitter);
-
-/**
- * Run tests with full titles matching `re`. Updates runner.total
- * with number of tests matched.
- *
- * @param {RegExp} re
- * @param {Boolean} invert
- * @return {Runner} for chaining
- * @api public
- * @param {RegExp} re
- * @param {boolean} invert
- * @return {Runner} Runner instance.
- */
-Runner.prototype.grep = function(re, invert) {
- debug('grep %s', re);
- this._grep = re;
- this._invert = invert;
- this.total = this.grepTotal(this.suite);
- return this;
-};
-
-/**
- * Returns the number of tests matching the grep search for the
- * given suite.
- *
- * @param {Suite} suite
- * @return {Number}
- * @api public
- * @param {Suite} suite
- * @return {number}
- */
-Runner.prototype.grepTotal = function(suite) {
- var self = this;
- var total = 0;
-
- suite.eachTest(function(test) {
- var match = self._grep.test(test.fullTitle());
- if (self._invert) {
- match = !match;
- }
- if (match) {
- total++;
- }
- });
-
- return total;
-};
-
-/**
- * Return a list of global properties.
- *
- * @return {Array}
- * @api private
- */
-Runner.prototype.globalProps = function() {
- var props = keys(global);
-
- // non-enumerables
- for (var i = 0; i < globals.length; ++i) {
- if (~indexOf(props, globals[i])) {
- continue;
- }
- props.push(globals[i]);
- }
-
- return props;
-};
-
-/**
- * Allow the given `arr` of globals.
- *
- * @param {Array} arr
- * @return {Runner} for chaining
- * @api public
- * @param {Array} arr
- * @return {Runner} Runner instance.
- */
-Runner.prototype.globals = function(arr) {
- if (!arguments.length) {
- return this._globals;
- }
- debug('globals %j', arr);
- this._globals = this._globals.concat(arr);
- return this;
-};
-
-/**
- * Check for global variable leaks.
- *
- * @api private
- */
-Runner.prototype.checkGlobals = function(test) {
- if (this.ignoreLeaks) {
- return;
- }
- var ok = this._globals;
-
- var globals = this.globalProps();
- var leaks;
-
- if (test) {
- ok = ok.concat(test._allowedGlobals || []);
- }
-
- if (this.prevGlobalsLength === globals.length) {
- return;
- }
- this.prevGlobalsLength = globals.length;
-
- leaks = filterLeaks(ok, globals);
- this._globals = this._globals.concat(leaks);
-
- if (leaks.length > 1) {
- this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + ''));
- } else if (leaks.length) {
- this.fail(test, new Error('global leak detected: ' + leaks[0]));
- }
-};
-
-/**
- * Fail the given `test`.
- *
- * @api private
- * @param {Test} test
- * @param {Error} err
- */
-Runner.prototype.fail = function(test, err) {
- if (test.isPending()) {
- return;
- }
-
- ++this.failures;
- test.state = 'failed';
-
- if (!(err instanceof Error || err && typeof err.message === 'string')) {
- 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);
-};
-
-/**
- * Fail the given `hook` with `err`.
- *
- * Hook failures work in the following pattern:
- * - If bail, then exit
- * - Failed `before` hook skips all tests in a suite and subsuites,
- * but jumps to corresponding `after` hook
- * - Failed `before each` hook skips remaining tests in a
- * suite and jumps to corresponding `after each` hook,
- * which is run only once
- * - Failed `after` hook does not alter
- * execution order
- * - Failed `after each` hook skips remaining tests in a
- * suite and subsuites, but executes other `after each`
- * hooks
- *
- * @api private
- * @param {Hook} hook
- * @param {Error} err
- */
-Runner.prototype.failHook = function(hook, err) {
- if (hook.ctx && hook.ctx.currentTest) {
- hook.originalTitle = hook.originalTitle || hook.title;
- hook.title = hook.originalTitle + ' for "' + hook.ctx.currentTest.title + '"';
- }
-
- this.fail(hook, err);
- if (this.suite.bail()) {
- this.emit('end');
- }
-};
-
-/**
- * Run hook `name` callbacks and then invoke `fn()`.
- *
- * @api private
- * @param {string} name
- * @param {Function} fn
- */
-
-Runner.prototype.hook = function(name, fn) {
- var suite = this.suite;
- var hooks = suite['_' + name];
- var self = this;
-
- function next(i) {
- var hook = hooks[i];
- if (!hook) {
- return fn();
- }
- self.currentRunnable = hook;
-
- hook.ctx.currentTest = self.test;
-
- self.emit('hook', hook);
-
- if (!hook.listeners('error').length) {
- hook.on('error', function(err) {
- self.failHook(hook, err);
- });
- }
-
- hook.run(function(err) {
- var testError = hook.error();
- if (testError) {
- self.fail(self.test, testError);
- }
- if (err) {
- if (err instanceof Pending) {
- if (name === 'beforeEach' || name === 'afterEach') {
- self.test.pending = true;
- } else {
- utils.forEach(suite.tests, function(test) {
- test.pending = true;
- });
- // a pending hook won't be executed twice.
- hook.pending = true;
- }
- } else {
- self.failHook(hook, err);
-
- // stop executing hooks, notify callee of hook err
- return fn(err);
- }
- }
- self.emit('hook end', hook);
- delete hook.ctx.currentTest;
- next(++i);
- });
- }
-
- Runner.immediately(function() {
- next(0);
- });
-};
-
-/**
- * Run hook `name` for the given array of `suites`
- * in order, and callback `fn(err, errSuite)`.
- *
- * @api private
- * @param {string} name
- * @param {Array} suites
- * @param {Function} fn
- */
-Runner.prototype.hooks = function(name, suites, fn) {
- var self = this;
- var orig = this.suite;
-
- function next(suite) {
- self.suite = suite;
-
- if (!suite) {
- self.suite = orig;
- return fn();
- }
-
- self.hook(name, function(err) {
- if (err) {
- var errSuite = self.suite;
- self.suite = orig;
- return fn(err, errSuite);
- }
-
- next(suites.pop());
- });
- }
-
- next(suites.pop());
-};
-
-/**
- * Run hooks from the top level down.
- *
- * @param {String} name
- * @param {Function} fn
- * @api private
- */
-Runner.prototype.hookUp = function(name, fn) {
- var suites = [this.suite].concat(this.parents()).reverse();
- this.hooks(name, suites, fn);
-};
-
-/**
- * Run hooks from the bottom up.
- *
- * @param {String} name
- * @param {Function} fn
- * @api private
- */
-Runner.prototype.hookDown = function(name, fn) {
- var suites = [this.suite].concat(this.parents());
- this.hooks(name, suites, fn);
-};
-
-/**
- * Return an array of parent Suites from
- * closest to furthest.
- *
- * @return {Array}
- * @api private
- */
-Runner.prototype.parents = function() {
- var suite = this.suite;
- var suites = [];
- while (suite.parent) {
- suite = suite.parent;
- suites.push(suite);
- }
- return suites;
-};
-
-/**
- * Run the current test and callback `fn(err)`.
- *
- * @param {Function} fn
- * @api private
- */
-Runner.prototype.runTest = function(fn) {
- var self = this;
- var test = this.test;
-
- if (!test) {
- return;
- }
- if (this.asyncOnly) {
- test.asyncOnly = true;
- }
-
- if (this.allowUncaught) {
- test.allowUncaught = true;
- return test.run(fn);
- }
- try {
- test.on('error', function(err) {
- self.fail(test, err);
- });
- test.run(fn);
- } catch (err) {
- fn(err);
- }
-};
-
-/**
- * Run tests in the given `suite` and invoke the callback `fn()` when complete.
- *
- * @api private
- * @param {Suite} suite
- * @param {Function} fn
- */
-Runner.prototype.runTests = function(suite, fn) {
- var self = this;
- var tests = suite.tests.slice();
- var test;
-
- function hookErr(_, errSuite, after) {
- // before/after Each hook for errSuite failed:
- var orig = self.suite;
-
- // for failed 'after each' hook start from errSuite parent,
- // otherwise start from errSuite itself
- self.suite = after ? errSuite.parent : errSuite;
-
- if (self.suite) {
- // call hookUp afterEach
- self.hookUp('afterEach', function(err2, errSuite2) {
- self.suite = orig;
- // some hooks may fail even now
- if (err2) {
- return hookErr(err2, errSuite2, true);
- }
- // report error suite
- fn(errSuite);
- });
- } else {
- // there is no need calling other 'after each' hooks
- self.suite = orig;
- fn(errSuite);
- }
- }
-
- function next(err, errSuite) {
- // if we bail after first err
- if (self.failures && suite._bail) {
- return fn();
- }
-
- if (self._abort) {
- return fn();
- }
-
- if (err) {
- return hookErr(err, errSuite, true);
- }
-
- // next test
- test = tests.shift();
-
- // all done
- if (!test) {
- return fn();
- }
-
- // grep
- var match = self._grep.test(test.fullTitle());
- if (self._invert) {
- match = !match;
- }
- if (!match) {
- // Run immediately only if we have defined a grep. When we
- // define a grep — It can cause maximum callstack error if
- // the grep is doing a large recursive loop by neglecting
- // all tests. The run immediately function also comes with
- // a performance cost. So we don't want to run immediately
- // if we run the whole test suite, because running the whole
- // test suite don't do any immediate recursive loops. Thus,
- // allowing a JS runtime to breathe.
- if (self._grep !== self._defaultGrep) {
- Runner.immediately(next);
- } else {
- next();
- }
- return;
- }
-
- if (test.isPending()) {
- self.emit('pending', test);
- self.emit('test end', test);
- return next();
- }
-
- // execute test and hook(s)
- self.emit('test', self.test = test);
- self.hookDown('beforeEach', function(err, errSuite) {
- if (test.isPending()) {
- self.emit('pending', test);
- self.emit('test end', test);
- return next();
- }
- if (err) {
- return hookErr(err, errSuite, false);
- }
- self.currentRunnable = self.test;
- self.runTest(function(err) {
- test = self.test;
- if (err) {
- var retry = test.currentRetry();
- if (err instanceof Pending) {
- test.pending = true;
- self.emit('pending', test);
- } else if (retry < test.retries()) {
- var clonedTest = test.clone();
- clonedTest.currentRetry(retry + 1);
- tests.unshift(clonedTest);
-
- // Early return + hook trigger so that it doesn't
- // increment the count wrong
- return self.hookUp('afterEach', next);
- } else {
- self.fail(test, err);
- }
- self.emit('test end', test);
-
- if (err instanceof Pending) {
- return next();
- }
-
- return self.hookUp('afterEach', next);
- }
-
- test.state = 'passed';
- self.emit('pass', test);
- self.emit('test end', test);
- self.hookUp('afterEach', next);
- });
- });
- }
-
- this.next = next;
- this.hookErr = hookErr;
- next();
-};
-
-/**
- * Run the given `suite` and invoke the callback `fn()` when complete.
- *
- * @api private
- * @param {Suite} suite
- * @param {Function} fn
- */
-Runner.prototype.runSuite = function(suite, fn) {
- var i = 0;
- var self = this;
- var total = this.grepTotal(suite);
- var afterAllHookCalled = false;
-
- debug('run suite %s', suite.fullTitle());
-
- if (!total || (self.failures && suite._bail)) {
- return fn();
- }
-
- this.emit('suite', this.suite = suite);
-
- function next(errSuite) {
- if (errSuite) {
- // current suite failed on a hook from errSuite
- if (errSuite === suite) {
- // if errSuite is current suite
- // continue to the next sibling suite
- return done();
- }
- // errSuite is among the parents of current suite
- // stop execution of errSuite and all sub-suites
- return done(errSuite);
- }
-
- if (self._abort) {
- return done();
- }
-
- var curr = suite.suites[i++];
- if (!curr) {
- return done();
- }
-
- // Avoid grep neglecting large number of tests causing a
- // huge recursive loop and thus a maximum call stack error.
- // See comment in `this.runTests()` for more information.
- if (self._grep !== self._defaultGrep) {
- Runner.immediately(function() {
- self.runSuite(curr, next);
- });
- } else {
- self.runSuite(curr, next);
- }
- }
-
- function done(errSuite) {
- self.suite = suite;
- self.nextSuite = next;
-
- if (afterAllHookCalled) {
- fn(errSuite);
- } else {
- // mark that the afterAll block has been called once
- // and so can be skipped if there is an error in it.
- afterAllHookCalled = true;
-
- // remove reference to test
- delete self.test;
-
- self.hook('afterAll', function() {
- self.emit('suite end', suite);
- fn(errSuite);
- });
- }
- }
-
- this.nextSuite = next;
-
- this.hook('beforeAll', function(err) {
- if (err) {
- return done();
- }
- self.runTests(suite, next);
- });
-};
-
-/**
- * Handle uncaught exceptions.
- *
- * @param {Error} err
- * @api private
- */
-Runner.prototype.uncaught = function(err) {
- if (err) {
- debug('uncaught exception %s', err !== function() {
- return this;
- }.call(err) ? err : (err.message || err));
- } else {
- debug('uncaught undefined exception');
- err = undefinedError();
- }
- err.uncaught = true;
-
- var runnable = this.currentRunnable;
-
- if (!runnable) {
- runnable = new Runnable('Uncaught error outside test suite');
- runnable.parent = this.suite;
-
- if (this.started) {
- this.fail(runnable, err);
- } else {
- // Can't recover from this failure
- this.emit('start');
- this.fail(runnable, err);
- this.emit('end');
- }
-
- return;
- }
-
- runnable.clearTimeout();
-
- // Ignore errors if complete or pending
- if (runnable.state || runnable.isPending()) {
- return;
- }
- this.fail(runnable, err);
-
- // recover from test
- if (runnable.type === 'test') {
- this.emit('test end', runnable);
- this.hookUp('afterEach', this.next);
- return;
- }
-
- // recover from hooks
- if (runnable.type === 'hook') {
- var errSuite = this.suite;
- // if hook failure is in afterEach block
- if (runnable.fullTitle().indexOf('after each') > -1) {
- return this.hookErr(err, errSuite, true);
- }
- // if hook failure is in beforeEach block
- if (runnable.fullTitle().indexOf('before each') > -1) {
- return this.hookErr(err, errSuite, false);
- }
- // if hook failure is in after or before blocks
- return this.nextSuite(errSuite);
- }
-
- // bail
- this.emit('end');
-};
-
-/**
- * Cleans up the references to all the deferred functions
- * (before/after/beforeEach/afterEach) and tests of a Suite.
- * These must be deleted otherwise a memory leak can happen,
- * as those functions may reference variables from closures,
- * thus those variables can never be garbage collected as long
- * as the deferred functions exist.
- *
- * @param {Suite} suite
- */
-function cleanSuiteReferences(suite) {
- function cleanArrReferences(arr) {
- for (var i = 0; i < arr.length; i++) {
- delete arr[i].fn;
- }
- }
-
- if (isArray(suite._beforeAll)) {
- cleanArrReferences(suite._beforeAll);
- }
-
- if (isArray(suite._beforeEach)) {
- cleanArrReferences(suite._beforeEach);
- }
-
- if (isArray(suite._afterAll)) {
- cleanArrReferences(suite._afterAll);
- }
-
- if (isArray(suite._afterEach)) {
- cleanArrReferences(suite._afterEach);
- }
-
- for (var i = 0; i < suite.tests.length; i++) {
- delete suite.tests[i].fn;
- }
-}
-
-/**
- * Run the root suite and invoke `fn(failures)`
- * on completion.
- *
- * @param {Function} fn
- * @return {Runner} for chaining
- * @api public
- * @param {Function} fn
- * @return {Runner} Runner instance.
- */
-Runner.prototype.run = function(fn) {
- var self = this;
- var rootSuite = this.suite;
-
- // If there is an `only` filter
- if (this.hasOnly) {
- filterOnly(rootSuite);
- }
-
- fn = fn || function() {};
-
- function uncaught(err) {
- self.uncaught(err);
- }
-
- function start() {
- self.started = true;
- self.emit('start');
- self.runSuite(rootSuite, function() {
- debug('finished running');
- self.emit('end');
- });
- }
-
- debug('start');
-
- // references cleanup to avoid memory leaks
- this.on('suite end', cleanSuiteReferences);
-
- // callback
- this.on('end', function() {
- debug('end');
- process.removeListener('uncaughtException', uncaught);
- fn(self.failures);
- });
-
- // 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;
-};
-
-/**
- * Cleanly abort execution.
- *
- * @api public
- * @return {Runner} Runner instance.
- */
-Runner.prototype.abort = function() {
- debug('aborting');
- this._abort = true;
-
- return this;
-};
-
-/**
- * Filter suites based on `isOnly` logic.
- *
- * @param {Array} suite
- * @returns {Boolean}
- * @api private
- */
-function filterOnly(suite) {
- if (suite._onlyTests.length) {
- // If the suite contains `only` tests, run those and ignore any nested suites.
- suite.tests = suite._onlyTests;
- suite.suites = [];
- } else {
- // Otherwise, do not run any of the tests in this suite.
- suite.tests = [];
- utils.forEach(suite._onlySuites, function(onlySuite) {
- // If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
- // Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
- if (hasOnly(onlySuite)) {
- filterOnly(onlySuite);
- }
- });
- // Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
- suite.suites = filter(suite.suites, function(childSuite) {
- return indexOf(suite._onlySuites, childSuite) !== -1 || filterOnly(childSuite);
- });
- }
- // Keep the suite only if there is something to run
- return suite.tests.length || suite.suites.length;
-}
-
-/**
- * Determines whether a suite has an `only` test or suite as a descendant.
- *
- * @param {Array} suite
- * @returns {Boolean}
- * @api private
- */
-function hasOnly(suite) {
- return suite._onlyTests.length || suite._onlySuites.length || some(suite.suites, hasOnly);
-}
-
-/**
- * Filter leaks with the given globals flagged as `ok`.
- *
- * @api private
- * @param {Array} ok
- * @param {Array} globals
- * @return {Array}
- */
-function filterLeaks(ok, globals) {
- return filter(globals, function(key) {
- // Firefox and Chrome exposes iframes as index inside the window object
- if (/^\d+/.test(key)) {
- return false;
- }
-
- // in firefox
- // if runner runs in an iframe, this iframe's window.getInterface method
- // not init at first it is assigned in some seconds
- if (global.navigator && (/^getInterface/).test(key)) {
- return false;
- }
-
- // an iframe could be approached by window[iframeIndex]
- // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak
- if (global.navigator && (/^\d+/).test(key)) {
- return false;
- }
-
- // Opera and IE expose global variables for HTML element IDs (issue #243)
- if (/^mocha-/.test(key)) {
- return false;
- }
-
- var matched = filter(ok, function(ok) {
- if (~ok.indexOf('*')) {
- return key.indexOf(ok.split('*')[0]) === 0;
- }
- return key === ok;
- });
- return !matched.length && (!global.navigator || key !== 'onerror');
- });
-}
-
-/**
- * Array of globals dependent on the environment.
- *
- * @return {Array}
- * @api private
- */
-function extraGlobals() {
- if (typeof process === 'object' && typeof process.version === 'string') {
- var parts = process.version.split('.');
- var nodeVersion = utils.reduce(parts, function(a, v) {
- return a << 8 | v;
- });
-
- // 'errno' was renamed to process._errno in v0.9.11.
-
- if (nodeVersion < 0x00090B) {
- return ['errno'];
- }
- }
-
- return [];
-}
diff --git a/tests/lib/mocha-3.1.0/lib/suite.js b/tests/lib/mocha-3.1.0/lib/suite.js
deleted file mode 100644
index bf3e4e9fef..0000000000
--- a/tests/lib/mocha-3.1.0/lib/suite.js
+++ /dev/null
@@ -1,400 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('events').EventEmitter;
-var Hook = require('./hook');
-var utils = require('./utils');
-var inherits = utils.inherits;
-var debug = require('debug')('mocha:suite');
-var milliseconds = require('./ms');
-
-/**
- * Expose `Suite`.
- */
-
-exports = module.exports = Suite;
-
-/**
- * Create a new `Suite` with the given `title` and parent `Suite`. When a suite
- * with the same title is already present, that suite is returned to provide
- * nicer reporter and more flexible meta-testing.
- *
- * @api public
- * @param {Suite} parent
- * @param {string} title
- * @return {Suite}
- */
-exports.create = function(parent, title) {
- var suite = new Suite(title, parent.ctx);
- suite.parent = parent;
- title = suite.fullTitle();
- parent.addSuite(suite);
- return suite;
-};
-
-/**
- * Initialize a new `Suite` with the given `title` and `ctx`.
- *
- * @api private
- * @param {string} title
- * @param {Context} parentContext
- */
-function Suite(title, parentContext) {
- if (!utils.isString(title)) {
- throw new Error('Suite `title` should be a "string" but "' + typeof title + '" was given instead.');
- }
- this.title = title;
- function Context() {}
- Context.prototype = parentContext;
- this.ctx = new Context();
- this.suites = [];
- this.tests = [];
- this.pending = false;
- this._beforeEach = [];
- this._beforeAll = [];
- this._afterEach = [];
- this._afterAll = [];
- this.root = !title;
- this._timeout = 2000;
- this._enableTimeouts = true;
- this._slow = 75;
- this._bail = false;
- this._retries = -1;
- this._onlyTests = [];
- this._onlySuites = [];
- this.delayed = false;
-}
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-inherits(Suite, EventEmitter);
-
-/**
- * Return a clone of this `Suite`.
- *
- * @api private
- * @return {Suite}
- */
-Suite.prototype.clone = function() {
- var suite = new Suite(this.title);
- debug('clone');
- suite.ctx = this.ctx;
- suite.timeout(this.timeout());
- suite.retries(this.retries());
- suite.enableTimeouts(this.enableTimeouts());
- suite.slow(this.slow());
- suite.bail(this.bail());
- return suite;
-};
-
-/**
- * Set timeout `ms` or short-hand such as "2s".
- *
- * @api private
- * @param {number|string} ms
- * @return {Suite|number} for chaining
- */
-Suite.prototype.timeout = function(ms) {
- if (!arguments.length) {
- return this._timeout;
- }
- if (ms.toString() === '0') {
- this._enableTimeouts = false;
- }
- if (typeof ms === 'string') {
- ms = milliseconds(ms);
- }
- debug('timeout %d', ms);
- this._timeout = parseInt(ms, 10);
- return this;
-};
-
-/**
- * Set number of times to retry a failed test.
- *
- * @api private
- * @param {number|string} n
- * @return {Suite|number} for chaining
- */
-Suite.prototype.retries = function(n) {
- if (!arguments.length) {
- return this._retries;
- }
- debug('retries %d', n);
- this._retries = parseInt(n, 10) || 0;
- return this;
-};
-
-/**
- * Set timeout to `enabled`.
- *
- * @api private
- * @param {boolean} enabled
- * @return {Suite|boolean} self or enabled
- */
-Suite.prototype.enableTimeouts = function(enabled) {
- if (!arguments.length) {
- return this._enableTimeouts;
- }
- debug('enableTimeouts %s', enabled);
- this._enableTimeouts = enabled;
- return this;
-};
-
-/**
- * Set slow `ms` or short-hand such as "2s".
- *
- * @api private
- * @param {number|string} ms
- * @return {Suite|number} for chaining
- */
-Suite.prototype.slow = function(ms) {
- if (!arguments.length) {
- return this._slow;
- }
- if (typeof ms === 'string') {
- ms = milliseconds(ms);
- }
- debug('slow %d', ms);
- this._slow = ms;
- return this;
-};
-
-/**
- * Sets whether to bail after first error.
- *
- * @api private
- * @param {boolean} bail
- * @return {Suite|number} for chaining
- */
-Suite.prototype.bail = function(bail) {
- if (!arguments.length) {
- return this._bail;
- }
- debug('bail %s', bail);
- this._bail = bail;
- return this;
-};
-
-/**
- * Check if this suite or its parent suite is marked as pending.
- *
- * @api private
- */
-Suite.prototype.isPending = function() {
- return this.pending || (this.parent && this.parent.isPending());
-};
-
-/**
- * Run `fn(test[, done])` before running tests.
- *
- * @api private
- * @param {string} title
- * @param {Function} fn
- * @return {Suite} for chaining
- */
-Suite.prototype.beforeAll = function(title, fn) {
- if (this.isPending()) {
- return this;
- }
- if (typeof title === 'function') {
- fn = title;
- title = fn.name;
- }
- title = '"before all" hook' + (title ? ': ' + title : '');
-
- var hook = new Hook(title, fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.retries(this.retries());
- hook.enableTimeouts(this.enableTimeouts());
- hook.slow(this.slow());
- hook.ctx = this.ctx;
- this._beforeAll.push(hook);
- this.emit('beforeAll', hook);
- return this;
-};
-
-/**
- * Run `fn(test[, done])` after running tests.
- *
- * @api private
- * @param {string} title
- * @param {Function} fn
- * @return {Suite} for chaining
- */
-Suite.prototype.afterAll = function(title, fn) {
- if (this.isPending()) {
- return this;
- }
- if (typeof title === 'function') {
- fn = title;
- title = fn.name;
- }
- title = '"after all" hook' + (title ? ': ' + title : '');
-
- var hook = new Hook(title, fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.retries(this.retries());
- hook.enableTimeouts(this.enableTimeouts());
- hook.slow(this.slow());
- hook.ctx = this.ctx;
- this._afterAll.push(hook);
- this.emit('afterAll', hook);
- return this;
-};
-
-/**
- * Run `fn(test[, done])` before each test case.
- *
- * @api private
- * @param {string} title
- * @param {Function} fn
- * @return {Suite} for chaining
- */
-Suite.prototype.beforeEach = function(title, fn) {
- if (this.isPending()) {
- return this;
- }
- if (typeof title === 'function') {
- fn = title;
- title = fn.name;
- }
- title = '"before each" hook' + (title ? ': ' + title : '');
-
- var hook = new Hook(title, fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.retries(this.retries());
- hook.enableTimeouts(this.enableTimeouts());
- hook.slow(this.slow());
- hook.ctx = this.ctx;
- this._beforeEach.push(hook);
- this.emit('beforeEach', hook);
- return this;
-};
-
-/**
- * Run `fn(test[, done])` after each test case.
- *
- * @api private
- * @param {string} title
- * @param {Function} fn
- * @return {Suite} for chaining
- */
-Suite.prototype.afterEach = function(title, fn) {
- if (this.isPending()) {
- return this;
- }
- if (typeof title === 'function') {
- fn = title;
- title = fn.name;
- }
- title = '"after each" hook' + (title ? ': ' + title : '');
-
- var hook = new Hook(title, fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.retries(this.retries());
- hook.enableTimeouts(this.enableTimeouts());
- hook.slow(this.slow());
- hook.ctx = this.ctx;
- this._afterEach.push(hook);
- this.emit('afterEach', hook);
- return this;
-};
-
-/**
- * Add a test `suite`.
- *
- * @api private
- * @param {Suite} suite
- * @return {Suite} for chaining
- */
-Suite.prototype.addSuite = function(suite) {
- suite.parent = this;
- suite.timeout(this.timeout());
- suite.retries(this.retries());
- suite.enableTimeouts(this.enableTimeouts());
- suite.slow(this.slow());
- suite.bail(this.bail());
- this.suites.push(suite);
- this.emit('suite', suite);
- return this;
-};
-
-/**
- * Add a `test` to this suite.
- *
- * @api private
- * @param {Test} test
- * @return {Suite} for chaining
- */
-Suite.prototype.addTest = function(test) {
- test.parent = this;
- test.timeout(this.timeout());
- test.retries(this.retries());
- test.enableTimeouts(this.enableTimeouts());
- test.slow(this.slow());
- test.ctx = this.ctx;
- this.tests.push(test);
- this.emit('test', test);
- return this;
-};
-
-/**
- * Return the full title generated by recursively concatenating the parent's
- * full title.
- *
- * @api public
- * @return {string}
- */
-Suite.prototype.fullTitle = function() {
- if (this.parent) {
- var full = this.parent.fullTitle();
- if (full) {
- return full + ' ' + this.title;
- }
- }
- return this.title;
-};
-
-/**
- * Return the total number of tests.
- *
- * @api public
- * @return {number}
- */
-Suite.prototype.total = function() {
- return utils.reduce(this.suites, function(sum, suite) {
- return sum + suite.total();
- }, 0) + this.tests.length;
-};
-
-/**
- * Iterates through each suite recursively to find all tests. Applies a
- * function in the format `fn(test)`.
- *
- * @api private
- * @param {Function} fn
- * @return {Suite}
- */
-Suite.prototype.eachTest = function(fn) {
- utils.forEach(this.tests, fn);
- utils.forEach(this.suites, function(suite) {
- suite.eachTest(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-3.1.0/lib/template.html b/tests/lib/mocha-3.1.0/lib/template.html
deleted file mode 100644
index 36c5e0b694..0000000000
--- a/tests/lib/mocha-3.1.0/lib/template.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE html>
-<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" />
- </head>
- <body>
- <div id="mocha"></div>
- <script src="mocha.js"></script>
- <script>mocha.setup('bdd');</script>
- <script src="tests.js"></script>
- <script>
- mocha.run();
- </script>
- </body>
-</html>
diff --git a/tests/lib/mocha-3.1.0/lib/test.js b/tests/lib/mocha-3.1.0/lib/test.js
deleted file mode 100644
index 05d4ed86d5..0000000000
--- a/tests/lib/mocha-3.1.0/lib/test.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var Runnable = require('./runnable');
-var create = require('lodash.create');
-var isString = require('./utils').isString;
-
-/**
- * Expose `Test`.
- */
-
-module.exports = Test;
-
-/**
- * Initialize a new `Test` with the given `title` and callback `fn`.
- *
- * @api private
- * @param {String} title
- * @param {Function} fn
- */
-function Test(title, fn) {
- if (!isString(title)) {
- throw new Error('Test `title` should be a "string" but "' + typeof title + '" was given instead.');
- }
- Runnable.call(this, title, fn);
- this.pending = !fn;
- this.type = 'test';
-}
-
-/**
- * Inherit from `Runnable.prototype`.
- */
-Test.prototype = create(Runnable.prototype, {
- constructor: Test
-});
-
-Test.prototype.clone = function() {
- var test = new Test(this.title, this.fn);
- test.timeout(this.timeout());
- test.slow(this.slow());
- test.enableTimeouts(this.enableTimeouts());
- test.retries(this.retries());
- test.currentRetry(this.currentRetry());
- test.globals(this.globals());
- test.parent = this.parent;
- test.file = this.file;
- test.ctx = this.ctx;
- return test;
-};
diff --git a/tests/lib/mocha-3.1.0/lib/to-iso-string/LICENSE b/tests/lib/mocha-3.1.0/lib/to-iso-string/LICENSE
deleted file mode 100644
index c25db56595..0000000000
--- a/tests/lib/mocha-3.1.0/lib/to-iso-string/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2016 Segment.io, Inc. (friends@segment.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/tests/lib/mocha-3.1.0/lib/to-iso-string/index.js b/tests/lib/mocha-3.1.0/lib/to-iso-string/index.js
deleted file mode 100644
index cd28d7be71..0000000000
--- a/tests/lib/mocha-3.1.0/lib/to-iso-string/index.js
+++ /dev/null
@@ -1,37 +0,0 @@
-'use strict';
-
-/**
- * Pad a `number` with a ten's place zero.
- *
- * @param {number} number
- * @return {string}
- */
-function pad(number) {
- var n = number.toString();
- return n.length === 1 ? '0' + n : n;
-}
-
-/**
- * Turn a `date` into an ISO string.
- *
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
- *
- * @param {Date} date
- * @return {string}
- */
-function toISOString(date) {
- return date.getUTCFullYear()
- + '-' + pad(date.getUTCMonth() + 1)
- + '-' + pad(date.getUTCDate())
- + 'T' + pad(date.getUTCHours())
- + ':' + pad(date.getUTCMinutes())
- + ':' + pad(date.getUTCSeconds())
- + '.' + String((date.getUTCMilliseconds()/1000).toFixed(3)).slice(2, 5)
- + 'Z';
-}
-
-/*
- * Exports.
- */
-
-module.exports = toISOString;
diff --git a/tests/lib/mocha-3.1.0/lib/utils.js b/tests/lib/mocha-3.1.0/lib/utils.js
deleted file mode 100644
index c7947cb05d..0000000000
--- a/tests/lib/mocha-3.1.0/lib/utils.js
+++ /dev/null
@@ -1,794 +0,0 @@
-/* eslint-env browser */
-
-/**
- * Module dependencies.
- */
-
-var JSON = require('json3');
-var basename = require('path').basename;
-var debug = require('debug')('mocha:watch');
-var exists = require('fs').existsSync || require('path').existsSync;
-var glob = require('glob');
-var path = require('path');
-var join = path.join;
-var readdirSync = require('fs').readdirSync;
-var statSync = require('fs').statSync;
-var watchFile = require('fs').watchFile;
-var toISOString = require('./to-iso-string');
-
-/**
- * Ignored directories.
- */
-
-var ignore = ['node_modules', '.git'];
-
-exports.inherits = require('util').inherits;
-
-/**
- * Escape special characters in the given string of html.
- *
- * @api private
- * @param {string} html
- * @return {string}
- */
-exports.escape = function(html) {
- return String(html)
- .replace(/&/g, '&amp;')
- .replace(/"/g, '&quot;')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;');
-};
-
-/**
- * Array#forEach (<=IE8)
- *
- * @api private
- * @param {Array} arr
- * @param {Function} fn
- * @param {Object} scope
- */
-exports.forEach = function(arr, fn, scope) {
- for (var i = 0, l = arr.length; i < l; i++) {
- fn.call(scope, arr[i], i);
- }
-};
-
-/**
- * Test if the given obj is type of string.
- *
- * @api private
- * @param {Object} obj
- * @return {boolean}
- */
-exports.isString = function(obj) {
- return typeof obj === 'string';
-};
-
-/**
- * Array#map (<=IE8)
- *
- * @api private
- * @param {Array} arr
- * @param {Function} fn
- * @param {Object} scope
- * @return {Array}
- */
-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, arr));
- }
- return result;
-};
-
-/**
- * Array#indexOf (<=IE8)
- *
- * @api private
- * @param {Array} arr
- * @param {Object} obj to find index of
- * @param {number} start
- * @return {number}
- */
-var indexOf = exports.indexOf = function(arr, obj, start) {
- for (var i = start || 0, l = arr.length; i < l; i++) {
- if (arr[i] === obj) {
- return i;
- }
- }
- return -1;
-};
-
-/**
- * Array#reduce (<=IE8)
- *
- * @api private
- * @param {Array} arr
- * @param {Function} fn
- * @param {Object} val Initial value.
- * @return {*}
- */
-var reduce = exports.reduce = function(arr, fn, val) {
- var rval = val;
-
- for (var i = 0, l = arr.length; i < l; i++) {
- rval = fn(rval, arr[i], i, arr);
- }
-
- return rval;
-};
-
-/**
- * Array#filter (<=IE8)
- *
- * @api private
- * @param {Array} arr
- * @param {Function} fn
- * @return {Array}
- */
-exports.filter = function(arr, fn) {
- var ret = [];
-
- for (var i = 0, l = arr.length; i < l; i++) {
- var val = arr[i];
- if (fn(val, i, arr)) {
- ret.push(val);
- }
- }
-
- return ret;
-};
-
-/**
- * Array#some (<=IE8)
- *
- * @api private
- * @param {Array} arr
- * @param {Function} fn
- * @return {Array}
- */
-exports.some = function(arr, fn) {
- for (var i = 0, l = arr.length; i < l; i++) {
- if (fn(arr[i])) {
- return true;
- }
- }
- return false;
-};
-
-/**
- * Object.keys (<=IE8)
- *
- * @api private
- * @param {Object} obj
- * @return {Array} keys
- */
-exports.keys = typeof Object.keys === 'function' ? Object.keys : function(obj) {
- var keys = [];
- var has = Object.prototype.hasOwnProperty; // for `window` on <=IE8
-
- for (var key in obj) {
- if (has.call(obj, key)) {
- keys.push(key);
- }
- }
-
- return keys;
-};
-
-/**
- * Watch the given `files` for changes
- * and invoke `fn(file)` on modification.
- *
- * @api private
- * @param {Array} files
- * @param {Function} fn
- */
-exports.watch = function(files, fn) {
- var options = { interval: 100 };
- files.forEach(function(file) {
- debug('file %s', file);
- watchFile(file, options, function(curr, prev) {
- if (prev.mtime < curr.mtime) {
- fn(file);
- }
- });
- });
-};
-
-/**
- * Array.isArray (<=IE8)
- *
- * @api private
- * @param {Object} obj
- * @return {Boolean}
- */
-var isArray = typeof Array.isArray === 'function' ? Array.isArray : function(obj) {
- return Object.prototype.toString.call(obj) === '[object Array]';
-};
-
-exports.isArray = isArray;
-
-/**
- * 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.
- *
- * @api private
- * @param {string} path
- * @return {boolean}
- */
-function ignored(path) {
- return !~ignore.indexOf(path);
-}
-
-/**
- * Lookup files in the given `dir`.
- *
- * @api private
- * @param {string} dir
- * @param {string[]} [ext=['.js']]
- * @param {Array} [ret=[]]
- * @return {Array}
- */
-exports.files = function(dir, ext, ret) {
- ret = ret || [];
- ext = ext || ['js'];
-
- var re = new RegExp('\\.(' + ext.join('|') + ')$');
-
- readdirSync(dir)
- .filter(ignored)
- .forEach(function(path) {
- path = join(dir, path);
- if (statSync(path).isDirectory()) {
- exports.files(path, ext, ret);
- } else if (path.match(re)) {
- ret.push(path);
- }
- });
-
- return ret;
-};
-
-/**
- * Compute a slug from the given `str`.
- *
- * @api private
- * @param {string} str
- * @return {string}
- */
-exports.slug = function(str) {
- return str
- .toLowerCase()
- .replace(/ +/g, '-')
- .replace(/[^-\w]/g, '');
-};
-
-/**
- * Strip the function definition from `str`, and re-indent for pre whitespace.
- *
- * @param {string} str
- * @return {string}
- */
-exports.clean = function(str) {
- str = str
- .replace(/\r\n?|[\n\u2028\u2029]/g, '\n').replace(/^\uFEFF/, '')
- // (traditional)-> space/name parameters body (lambda)-> parameters body multi-statement/single keep body content
- .replace(/^function(?:\s*|\s+[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\s*\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\s*\}|((?:.|\n)*))$/, '$1$2$3');
-
- var spaces = str.match(/^\n?( *)/)[1].length;
- var tabs = str.match(/^\n?(\t*)/)[1].length;
- var re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm');
-
- str = str.replace(re, '');
-
- return exports.trim(str);
-};
-
-/**
- * Trim the given `str`.
- *
- * @api private
- * @param {string} str
- * @return {string}
- */
-exports.trim = function(str) {
- return str.replace(/^\s+|\s+$/g, '');
-};
-
-/**
- * Parse the given `qs`.
- *
- * @api private
- * @param {string} qs
- * @return {Object}
- */
-exports.parseQuery = function(qs) {
- return reduce(qs.replace('?', '').split('&'), function(obj, pair) {
- var i = pair.indexOf('=');
- var key = pair.slice(0, i);
- var val = pair.slice(++i);
-
- obj[key] = decodeURIComponent(val);
- return obj;
- }, {});
-};
-
-/**
- * Highlight the given string of `js`.
- *
- * @api private
- * @param {string} js
- * @return {string}
- */
-function highlight(js) {
- return js
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
- .replace(/('.*?')/gm, '<span class="string">$1</span>')
- .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
- .replace(/(\d+)/gm, '<span class="number">$1</span>')
- .replace(/\bnew[ \t]+(\w+)/gm, '<span class="keyword">new</span> <span class="init">$1</span>')
- .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>');
-}
-
-/**
- * Highlight the contents of tag `name`.
- *
- * @api private
- * @param {string} name
- */
-exports.highlightTags = function(name) {
- var code = document.getElementById('mocha').getElementsByTagName(name);
- for (var i = 0, len = code.length; i < len; ++i) {
- code[i].innerHTML = highlight(code[i].innerHTML);
- }
-};
-
-/**
- * If a value could have properties, and has none, this function is called,
- * which returns a string representation of the empty value.
- *
- * Functions w/ no properties return `'[Function]'`
- * Arrays w/ length === 0 return `'[]'`
- * Objects w/ no properties return `'{}'`
- * All else: return result of `value.toString()`
- *
- * @api private
- * @param {*} value The value to inspect.
- * @param {string} typeHint The type of the value
- * @returns {string}
- */
-function emptyRepresentation(value, typeHint) {
- switch (typeHint) {
- case 'function':
- return '[Function]';
- case 'object':
- return '{}';
- case 'array':
- return '[]';
- default:
- return value.toString();
- }
-}
-
-/**
- * Takes some variable and asks `Object.prototype.toString()` what it thinks it
- * is.
- *
- * @api private
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
- * @param {*} value The value to test.
- * @returns {string} Computed type
- * @example
- * type({}) // 'object'
- * type([]) // 'array'
- * type(1) // 'number'
- * type(false) // 'boolean'
- * type(Infinity) // 'number'
- * type(null) // 'null'
- * type(new Date()) // 'date'
- * type(/foo/) // 'regexp'
- * type('type') // 'string'
- * type(global) // 'global'
- * type(new String('foo') // 'object'
- */
-var type = exports.type = function type(value) {
- if (value === undefined) {
- return 'undefined';
- } else if (value === null) {
- return 'null';
- } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {
- return 'buffer';
- }
- return Object.prototype.toString.call(value)
- .replace(/^\[.+\s(.+?)\]$/, '$1')
- .toLowerCase();
-};
-
-/**
- * Stringify `value`. Different behavior depending on type of value:
- *
- * - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively.
- * - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes.
- * - If `value` is an *empty* object, function, or array, return result of function
- * {@link emptyRepresentation}.
- * - If `value` has properties, call {@link exports.canonicalize} on it, then return result of
- * JSON.stringify().
- *
- * @api private
- * @see exports.type
- * @param {*} value
- * @return {string}
- */
-exports.stringify = function(value) {
- var typeHint = type(value);
-
- if (!~indexOf(['object', 'array', 'function'], typeHint)) {
- if (typeHint === 'buffer') {
- var json = value.toJSON();
- // Based on the toJSON result
- return jsonStringify(json.data && json.type ? json.data : json, 2)
- .replace(/,(\n|$)/g, '$1');
- }
-
- // IE7/IE8 has a bizarre String constructor; needs to be coerced
- // into an array and back to obj.
- if (typeHint === 'string' && typeof value === 'object') {
- value = reduce(value.split(''), function(acc, char, idx) {
- acc[idx] = char;
- return acc;
- }, {});
- typeHint = 'object';
- } else {
- return jsonStringify(value);
- }
- }
-
- for (var prop in value) {
- if (Object.prototype.hasOwnProperty.call(value, prop)) {
- return jsonStringify(exports.canonicalize(value, null, typeHint), 2).replace(/,(\n|$)/g, '$1');
- }
- }
-
- return emptyRepresentation(value, typeHint);
-};
-
-/**
- * like JSON.stringify but more sense.
- *
- * @api private
- * @param {Object} object
- * @param {number=} spaces
- * @param {number=} depth
- * @returns {*}
- */
-function jsonStringify(object, spaces, depth) {
- if (typeof spaces === 'undefined') {
- // primitive types
- return _stringify(object);
- }
-
- depth = depth || 1;
- var space = spaces * depth;
- var str = isArray(object) ? '[' : '{';
- var end = isArray(object) ? ']' : '}';
- var length = typeof object.length === 'number' ? object.length : exports.keys(object).length;
- // `.repeat()` polyfill
- function repeat(s, n) {
- return new Array(n).join(s);
- }
-
- function _stringify(val) {
- switch (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 'symbol':
- case 'number':
- val = val === 0 && (1 / val) === -Infinity // `-0`
- ? '-0'
- : val.toString();
- break;
- case 'date':
- var sDate;
- if (isNaN(val.getTime())) { // Invalid date
- sDate = val.toString();
- } else {
- sDate = val.toISOString ? val.toISOString() : toISOString(val);
- }
- 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.prototype.hasOwnProperty.call(object, 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);
-}
-
-/**
- * Test if a value is a buffer.
- *
- * @api private
- * @param {*} value The value to test.
- * @return {boolean} True if `value` is a buffer, otherwise false
- */
-exports.isBuffer = function(value) {
- return typeof Buffer !== 'undefined' && Buffer.isBuffer(value);
-};
-
-/**
- * Return a new Thing that has the keys in sorted order. Recursive.
- *
- * If the Thing...
- * - has already been seen, return string `'[Circular]'`
- * - is `undefined`, return string `'[undefined]'`
- * - is `null`, return value `null`
- * - is some other primitive, return the value
- * - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method
- * - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again.
- * - is an empty `Array`, `Object`, or `Function`, return the result of calling `emptyRepresentation()`
- *
- * @api private
- * @see {@link exports.stringify}
- * @param {*} value Thing to inspect. May or may not have properties.
- * @param {Array} [stack=[]] Stack of seen values
- * @param {string} [typeHint] Type hint
- * @return {(Object|Array|Function|string|undefined)}
- */
-exports.canonicalize = function canonicalize(value, stack, typeHint) {
- var canonicalizedObj;
- /* eslint-disable no-unused-vars */
- var prop;
- /* eslint-enable no-unused-vars */
- typeHint = typeHint || type(value);
- function withStack(value, fn) {
- stack.push(value);
- fn();
- stack.pop();
- }
-
- stack = stack || [];
-
- if (indexOf(stack, value) !== -1) {
- return '[Circular]';
- }
-
- switch (typeHint) {
- case 'undefined':
- case 'buffer':
- case 'null':
- canonicalizedObj = value;
- break;
- case 'array':
- withStack(value, function() {
- canonicalizedObj = exports.map(value, function(item) {
- return exports.canonicalize(item, stack);
- });
- });
- break;
- case 'function':
- /* eslint-disable guard-for-in */
- for (prop in value) {
- canonicalizedObj = {};
- break;
- }
- /* eslint-enable guard-for-in */
- if (!canonicalizedObj) {
- canonicalizedObj = emptyRepresentation(value, typeHint);
- break;
- }
- /* falls through */
- case 'object':
- canonicalizedObj = canonicalizedObj || {};
- withStack(value, function() {
- exports.forEach(exports.keys(value).sort(), function(key) {
- canonicalizedObj[key] = exports.canonicalize(value[key], stack);
- });
- });
- break;
- case 'date':
- case 'number':
- case 'regexp':
- case 'boolean':
- case 'symbol':
- canonicalizedObj = value;
- break;
- default:
- canonicalizedObj = value + '';
- }
-
- return canonicalizedObj;
-};
-
-/**
- * Lookup file names at the given `path`.
- *
- * @api public
- * @param {string} path Base path to start searching from.
- * @param {string[]} extensions File extensions to look for.
- * @param {boolean} recursive Whether or not to recurse into subdirectories.
- * @return {string[]} An array of paths.
- */
-exports.lookupFiles = function lookupFiles(path, extensions, recursive) {
- var files = [];
- var re = new RegExp('\\.(' + extensions.join('|') + ')$');
-
- if (!exists(path)) {
- if (exists(path + '.js')) {
- path += '.js';
- } else {
- files = glob.sync(path);
- if (!files.length) {
- throw new Error("cannot resolve path (or pattern) '" + path + "'");
- }
- return files;
- }
- }
-
- try {
- var stat = statSync(path);
- if (stat.isFile()) {
- return path;
- }
- } catch (err) {
- // ignore error
- return;
- }
-
- readdirSync(path).forEach(function(file) {
- file = join(path, file);
- try {
- var stat = statSync(file);
- if (stat.isDirectory()) {
- if (recursive) {
- files = files.concat(lookupFiles(file, extensions, recursive));
- }
- return;
- }
- } catch (err) {
- // ignore error
- return;
- }
- if (!stat.isFile() || !re.test(file) || basename(file)[0] === '.') {
- return;
- }
- files.push(file);
- });
-
- return files;
-};
-
-/**
- * Generate an undefined error with a message warning the user.
- *
- * @return {Error}
- */
-
-exports.undefinedError = function() {
- return new Error('Caught undefined error, did you throw without specifying what?');
-};
-
-/**
- * Generate an undefined error if `err` is not defined.
- *
- * @param {Error} err
- * @return {Error}
- */
-
-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 and internal node functions from stack trace).
- * @returns {Function}
- */
-exports.stackTraceFilter = function() {
- // TODO: Replace with `process.browser`
- var is = typeof document === 'undefined' ? { node: true } : { browser: true };
- var slash = path.sep;
- var cwd;
- if (is.node) {
- cwd = process.cwd() + slash;
- } else {
- cwd = (typeof location === 'undefined' ? window.location : location).href.replace(/\/[^\/]*$/, '/');
- slash = '/';
- }
-
- function isMochaInternal(line) {
- return (~line.indexOf('node_modules' + slash + 'mocha' + slash))
- || (~line.indexOf('node_modules' + slash + 'mocha.js'))
- || (~line.indexOf('bower_components' + slash + 'mocha.js'))
- || (~line.indexOf(slash + 'mocha.js'));
- }
-
- 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 = reduce(stack, function(list, line) {
- if (isMochaInternal(line)) {
- return list;
- }
-
- if (is.node && isNodeInternal(line)) {
- return list;
- }
-
- // Clean up cwd(absolute)
- if (/\(?.+:\d+:\d+\)?$/.test(line)) {
- line = line.replace(cwd, '');
- }
-
- list.push(line);
- return list;
- }, []);
-
- return stack.join('\n');
- };
-};
-
-/**
- * Crude, but effective.
- * @api
- * @param {*} value
- * @returns {boolean} Whether or not `value` is a Promise
- */
-exports.isPromise = function isPromise(value) {
- return typeof value === 'object' && typeof value.then === 'function';
-};
diff --git a/tests/lib/mocha-3.1.0/media/logo.svg b/tests/lib/mocha-3.1.0/media/logo.svg
deleted file mode 100644
index bc3cb4b5df..0000000000
--- a/tests/lib/mocha-3.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-3.1.0/mocha.css b/tests/lib/mocha-3.1.0/mocha.css
deleted file mode 100644
index ec96b003c9..0000000000
--- a/tests/lib/mocha-3.1.0/mocha.css
+++ /dev/null
@@ -1,326 +0,0 @@
-@charset "utf-8";
-
-body {
- margin:0;
-}
-
-#mocha {
- font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
- margin: 60px 50px;
-}
-
-#mocha ul,
-#mocha li {
- margin: 0;
- padding: 0;
-}
-
-#mocha ul {
- list-style: none;
-}
-
-#mocha h1,
-#mocha h2 {
- margin: 0;
-}
-
-#mocha h1 {
- margin-top: 15px;
- font-size: 1em;
- font-weight: 200;
-}
-
-#mocha h1 a {
- text-decoration: none;
- color: inherit;
-}
-
-#mocha h1 a:hover {
- text-decoration: underline;
-}
-
-#mocha .suite .suite h1 {
- margin-top: 0;
- font-size: .8em;
-}
-
-#mocha .hidden {
- display: none;
-}
-
-#mocha h2 {
- font-size: 12px;
- font-weight: normal;
- cursor: pointer;
-}
-
-#mocha .suite {
- margin-left: 15px;
-}
-
-#mocha .test {
- margin-left: 15px;
- overflow: hidden;
-}
-
-#mocha .test.pending:hover h2::after {
- content: '(pending)';
- font-family: arial, sans-serif;
-}
-
-#mocha .test.pass.medium .duration {
- background: #c09853;
-}
-
-#mocha .test.pass.slow .duration {
- background: #b94a48;
-}
-
-#mocha .test.pass::before {
- content: '✓';
- font-size: 12px;
- display: block;
- float: left;
- margin-right: 5px;
- color: #00d6b2;
-}
-
-#mocha .test.pass .duration {
- font-size: 9px;
- margin-left: 5px;
- padding: 2px 5px;
- color: #fff;
- -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
- -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
- box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- -ms-border-radius: 5px;
- -o-border-radius: 5px;
- border-radius: 5px;
-}
-
-#mocha .test.pass.fast .duration {
- display: none;
-}
-
-#mocha .test.pending {
- color: #0b97c4;
-}
-
-#mocha .test.pending::before {
- content: 'â—¦';
- color: #0b97c4;
-}
-
-#mocha .test.fail {
- color: #c00;
-}
-
-#mocha .test.fail pre {
- color: black;
-}
-
-#mocha .test.fail::before {
- content: '✖';
- font-size: 12px;
- display: block;
- float: left;
- margin-right: 5px;
- color: #c00;
-}
-
-#mocha .test pre.error {
- color: #c00;
- max-height: 300px;
- overflow: auto;
-}
-
-#mocha .test .html-error {
- overflow: auto;
- color: black;
- line-height: 1.5;
- display: block;
- float: left;
- clear: left;
- font: 12px/1.5 monaco, monospace;
- margin: 5px;
- padding: 15px;
- border: 1px solid #eee;
- max-width: 85%; /*(1)*/
- max-width: -webkit-calc(100% - 42px);
- max-width: -moz-calc(100% - 42px);
- max-width: calc(100% - 42px); /*(2)*/
- max-height: 300px;
- word-wrap: break-word;
- border-bottom-color: #ddd;
- -webkit-box-shadow: 0 1px 3px #eee;
- -moz-box-shadow: 0 1px 3px #eee;
- box-shadow: 0 1px 3px #eee;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
-}
-
-#mocha .test .html-error pre.error {
- border: none;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
- -webkit-box-shadow: 0;
- -moz-box-shadow: 0;
- box-shadow: 0;
- padding: 0;
- margin: 0;
- margin-top: 18px;
- max-height: none;
-}
-
-/**
- * (1): approximate for browsers not supporting calc
- * (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border)
- * ^^ seriously
- */
-#mocha .test pre {
- display: block;
- float: left;
- clear: left;
- font: 12px/1.5 monaco, monospace;
- margin: 5px;
- padding: 15px;
- border: 1px solid #eee;
- max-width: 85%; /*(1)*/
- max-width: -webkit-calc(100% - 42px);
- max-width: -moz-calc(100% - 42px);
- max-width: calc(100% - 42px); /*(2)*/
- word-wrap: break-word;
- border-bottom-color: #ddd;
- -webkit-box-shadow: 0 1px 3px #eee;
- -moz-box-shadow: 0 1px 3px #eee;
- box-shadow: 0 1px 3px #eee;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
-}
-
-#mocha .test h2 {
- position: relative;
-}
-
-#mocha .test a.replay {
- position: absolute;
- top: 3px;
- right: 0;
- text-decoration: none;
- vertical-align: middle;
- display: block;
- width: 15px;
- height: 15px;
- line-height: 15px;
- text-align: center;
- background: #eee;
- font-size: 15px;
- -webkit-border-radius: 15px;
- -moz-border-radius: 15px;
- border-radius: 15px;
- -webkit-transition:opacity 200ms;
- -moz-transition:opacity 200ms;
- -o-transition:opacity 200ms;
- transition: opacity 200ms;
- opacity: 0.3;
- color: #888;
-}
-
-#mocha .test:hover a.replay {
- opacity: 1;
-}
-
-#mocha-report.pass .test.fail {
- display: none;
-}
-
-#mocha-report.fail .test.pass {
- display: none;
-}
-
-#mocha-report.pending .test.pass,
-#mocha-report.pending .test.fail {
- display: none;
-}
-#mocha-report.pending .test.pass.pending {
- display: block;
-}
-
-#mocha-error {
- color: #c00;
- font-size: 1.5em;
- font-weight: 100;
- letter-spacing: 1px;
-}
-
-#mocha-stats {
- position: fixed;
- top: 15px;
- right: 10px;
- font-size: 12px;
- margin: 0;
- color: #888;
- z-index: 1;
-}
-
-#mocha-stats .progress {
- float: right;
- padding-top: 0;
-
- /**
- * Set safe initial values, so mochas .progress does not inherit these
- * properties from Bootstrap .progress (which causes .progress height to
- * equal line height set in Bootstrap).
- */
- height: auto;
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
- background-color: initial;
-}
-
-#mocha-stats em {
- color: black;
-}
-
-#mocha-stats a {
- text-decoration: none;
- color: inherit;
-}
-
-#mocha-stats a:hover {
- border-bottom: 1px solid #eee;
-}
-
-#mocha-stats li {
- display: inline-block;
- margin: 0 5px;
- list-style: none;
- padding-top: 11px;
-}
-
-#mocha-stats canvas {
- width: 40px;
- height: 40px;
-}
-
-#mocha code .comment { color: #ddd; }
-#mocha code .init { color: #2f6fad; }
-#mocha code .string { color: #5890ad; }
-#mocha code .keyword { color: #8a6343; }
-#mocha code .number { color: #2f6fad; }
-
-@media screen and (max-device-width: 480px) {
- #mocha {
- margin: 60px 0px;
- }
-
- #mocha #stats {
- position: absolute;
- }
-}
diff --git a/tests/lib/mocha-3.1.0/mocha.js b/tests/lib/mocha-3.1.0/mocha.js
deleted file mode 100644
index 1d5b072aca..0000000000
--- a/tests/lib/mocha-3.1.0/mocha.js
+++ /dev/null
@@ -1,15466 +0,0 @@
-(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
-(function (process,global){
-/* eslint no-unused-vars: off */
-
-/**
- * Shim process.stdout.
- */
-
-process.stdout = require('browser-stdout')();
-
-var Mocha = require('./lib/mocha');
-
-/**
- * Create a Mocha instance.
- *
- * @return {undefined}
- */
-
-var mocha = new Mocha({ reporter: 'html' });
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-var Date = global.Date;
-var setTimeout = global.setTimeout;
-var setInterval = global.setInterval;
-var clearTimeout = global.clearTimeout;
-var clearInterval = global.clearInterval;
-
-var uncaughtExceptionHandlers = [];
-
-var originalOnerrorHandler = global.onerror;
-
-/**
- * Remove uncaughtException listener.
- * Revert to original onerror handler if previously defined.
- */
-
-process.removeListener = function(e, fn) {
- if (e === 'uncaughtException') {
- if (originalOnerrorHandler) {
- global.onerror = originalOnerrorHandler;
- } else {
- global.onerror = function() {};
- }
- var i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn);
- if (i !== -1) {
- uncaughtExceptionHandlers.splice(i, 1);
- }
- }
-};
-
-/**
- * Implements uncaughtException listener.
- */
-
-process.on = function(e, fn) {
- if (e === 'uncaughtException') {
- global.onerror = function(err, url, line) {
- fn(new Error(err + ' (' + url + ':' + line + ')'));
- return !mocha.allowUncaught;
- };
- uncaughtExceptionHandlers.push(fn);
- }
-};
-
-// The BDD UI is registered by default, but no UI will be functional in the
-// browser without an explicit call to the overridden `mocha.ui` (see below).
-// Ensure that this default UI does not expose its methods to the global scope.
-mocha.suite.removeAllListeners('pre-require');
-
-var immediateQueue = [];
-var immediateTimeout;
-
-function timeslice() {
- var immediateStart = new Date().getTime();
- while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) {
- immediateQueue.shift()();
- }
- if (immediateQueue.length) {
- immediateTimeout = setTimeout(timeslice, 0);
- } else {
- immediateTimeout = null;
- }
-}
-
-/**
- * High-performance override of Runner.immediately.
- */
-
-Mocha.Runner.immediately = function(callback) {
- immediateQueue.push(callback);
- if (!immediateTimeout) {
- immediateTimeout = setTimeout(timeslice, 0);
- }
-};
-
-/**
- * Function to allow assertion libraries to throw errors directly into mocha.
- * This is useful when running tests in a browser because window.onerror will
- * only receive the 'message' attribute of the Error.
- */
-mocha.throwError = function(err) {
- Mocha.utils.forEach(uncaughtExceptionHandlers, function(fn) {
- fn(err);
- });
- throw err;
-};
-
-/**
- * Override ui to ensure that the ui functions are initialized.
- * Normally this would happen in Mocha.prototype.loadFiles.
- */
-
-mocha.ui = function(ui) {
- Mocha.prototype.ui.call(this, ui);
- this.suite.emit('pre-require', global, null, this);
- return this;
-};
-
-/**
- * Setup mocha with the given setting options.
- */
-
-mocha.setup = function(opts) {
- if (typeof opts === 'string') {
- opts = { ui: opts };
- }
- for (var opt in opts) {
- if (opts.hasOwnProperty(opt)) {
- this[opt](opts[opt]);
- }
- }
- return this;
-};
-
-/**
- * Run mocha, returning the Runner.
- */
-
-mocha.run = function(fn) {
- var options = mocha.options;
- mocha.globals('location');
-
- var query = Mocha.utils.parseQuery(global.location.search || '');
- if (query.grep) {
- mocha.grep(query.grep);
- }
- if (query.fgrep) {
- mocha.fgrep(query.fgrep);
- }
- if (query.invert) {
- mocha.invert();
- }
-
- return Mocha.prototype.run.call(mocha, function(err) {
- // The DOM Document is not available in Web Workers.
- var document = global.document;
- if (document && document.getElementById('mocha') && options.noHighlighting !== true) {
- Mocha.utils.highlightTags('code');
- }
- if (fn) {
- fn(err);
- }
- });
-};
-
-/**
- * Expose the process shim.
- * https://github.com/mochajs/mocha/pull/916
- */
-
-Mocha.process = process;
-
-/**
- * Expose mocha.
- */
-
-global.Mocha = Mocha;
-global.mocha = mocha;
-
-// this allows test/acceptance/required-tokens.js to pass; thus,
-// you can now do `const describe = require('mocha').describe` in a
-// browser context (assuming browserification). should fix #880
-module.exports = global;
-
-}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./lib/mocha":14,"_process":67,"browser-stdout":41}],2:[function(require,module,exports){
-/* eslint-disable no-unused-vars */
-module.exports = function(type) {
- return function() {};
-};
-
-},{}],3:[function(require,module,exports){
-/**
- * Module exports.
- */
-
-exports.EventEmitter = EventEmitter;
-
-/**
- * Object#toString reference.
- */
-var objToString = Object.prototype.toString;
-
-/**
- * Check if a value is an array.
- *
- * @api private
- * @param {*} val The value to test.
- * @return {boolean} true if the value is an array, otherwise false.
- */
-function isArray(val) {
- return objToString.call(val) === '[object Array]';
-}
-
-/**
- * Event emitter constructor.
- *
- * @api public
- */
-function EventEmitter() {}
-
-/**
- * Add a listener.
- *
- * @api public
- * @param {string} name Event name.
- * @param {Function} fn Event handler.
- * @return {EventEmitter} Emitter instance.
- */
-EventEmitter.prototype.on = function(name, fn) {
- if (!this.$events) {
- this.$events = {};
- }
-
- if (!this.$events[name]) {
- this.$events[name] = fn;
- } else if (isArray(this.$events[name])) {
- this.$events[name].push(fn);
- } else {
- this.$events[name] = [this.$events[name], fn];
- }
-
- return this;
-};
-
-EventEmitter.prototype.addListener = EventEmitter.prototype.on;
-
-/**
- * Adds a volatile listener.
- *
- * @api public
- * @param {string} name Event name.
- * @param {Function} fn Event handler.
- * @return {EventEmitter} Emitter instance.
- */
-EventEmitter.prototype.once = function(name, fn) {
- var self = this;
-
- function on() {
- self.removeListener(name, on);
- fn.apply(this, arguments);
- }
-
- on.listener = fn;
- this.on(name, on);
-
- return this;
-};
-
-/**
- * Remove a listener.
- *
- * @api public
- * @param {string} name Event name.
- * @param {Function} fn Event handler.
- * @return {EventEmitter} Emitter instance.
- */
-EventEmitter.prototype.removeListener = function(name, fn) {
- if (this.$events && this.$events[name]) {
- var list = this.$events[name];
-
- if (isArray(list)) {
- var pos = -1;
-
- for (var i = 0, l = list.length; i < l; i++) {
- if (list[i] === fn || (list[i].listener && list[i].listener === fn)) {
- pos = i;
- break;
- }
- }
-
- if (pos < 0) {
- return this;
- }
-
- list.splice(pos, 1);
-
- if (!list.length) {
- delete this.$events[name];
- }
- } else if (list === fn || (list.listener && list.listener === fn)) {
- delete this.$events[name];
- }
- }
-
- return this;
-};
-
-/**
- * Remove all listeners for an event.
- *
- * @api public
- * @param {string} name Event name.
- * @return {EventEmitter} Emitter instance.
- */
-EventEmitter.prototype.removeAllListeners = function(name) {
- if (name === undefined) {
- this.$events = {};
- return this;
- }
-
- if (this.$events && this.$events[name]) {
- this.$events[name] = null;
- }
-
- return this;
-};
-
-/**
- * Get all listeners for a given event.
- *
- * @api public
- * @param {string} name Event name.
- * @return {EventEmitter} Emitter instance.
- */
-EventEmitter.prototype.listeners = function(name) {
- if (!this.$events) {
- this.$events = {};
- }
-
- if (!this.$events[name]) {
- this.$events[name] = [];
- }
-
- if (!isArray(this.$events[name])) {
- this.$events[name] = [this.$events[name]];
- }
-
- return this.$events[name];
-};
-
-/**
- * Emit an event.
- *
- * @api public
- * @param {string} name Event name.
- * @return {boolean} true if at least one handler was invoked, else false.
- */
-EventEmitter.prototype.emit = function(name) {
- if (!this.$events) {
- return false;
- }
-
- var handler = this.$events[name];
-
- if (!handler) {
- return false;
- }
-
- var args = Array.prototype.slice.call(arguments, 1);
-
- if (typeof handler === 'function') {
- handler.apply(this, args);
- } else if (isArray(handler)) {
- var listeners = handler.slice();
-
- for (var i = 0, l = listeners.length; i < l; i++) {
- listeners[i].apply(this, args);
- }
- } else {
- return false;
- }
-
- return true;
-};
-
-},{}],4:[function(require,module,exports){
-/**
- * Expose `Progress`.
- */
-
-module.exports = Progress;
-
-/**
- * Initialize a new `Progress` indicator.
- */
-function Progress() {
- this.percent = 0;
- this.size(0);
- this.fontSize(11);
- this.font('helvetica, arial, sans-serif');
-}
-
-/**
- * Set progress size to `size`.
- *
- * @api public
- * @param {number} size
- * @return {Progress} Progress instance.
- */
-Progress.prototype.size = function(size) {
- this._size = size;
- return this;
-};
-
-/**
- * Set text to `text`.
- *
- * @api public
- * @param {string} text
- * @return {Progress} Progress instance.
- */
-Progress.prototype.text = function(text) {
- this._text = text;
- return this;
-};
-
-/**
- * Set font size to `size`.
- *
- * @api public
- * @param {number} size
- * @return {Progress} Progress instance.
- */
-Progress.prototype.fontSize = function(size) {
- this._fontSize = size;
- return this;
-};
-
-/**
- * Set font to `family`.
- *
- * @param {string} family
- * @return {Progress} Progress instance.
- */
-Progress.prototype.font = function(family) {
- this._font = family;
- return this;
-};
-
-/**
- * Update percentage to `n`.
- *
- * @param {number} n
- * @return {Progress} Progress instance.
- */
-Progress.prototype.update = function(n) {
- this.percent = n;
- return this;
-};
-
-/**
- * Draw on `ctx`.
- *
- * @param {CanvasRenderingContext2d} ctx
- * @return {Progress} Progress instance.
- */
-Progress.prototype.draw = function(ctx) {
- try {
- var percent = Math.min(this.percent, 100);
- var size = this._size;
- var half = size / 2;
- var x = half;
- var y = half;
- var rad = half - 1;
- var fontSize = this._fontSize;
-
- ctx.font = fontSize + 'px ' + this._font;
-
- var angle = Math.PI * 2 * (percent / 100);
- ctx.clearRect(0, 0, size, size);
-
- // outer circle
- ctx.strokeStyle = '#9f9f9f';
- ctx.beginPath();
- ctx.arc(x, y, rad, 0, angle, false);
- ctx.stroke();
-
- // inner circle
- ctx.strokeStyle = '#eee';
- ctx.beginPath();
- ctx.arc(x, y, rad - 1, 0, angle, true);
- ctx.stroke();
-
- // text
- var text = this._text || (percent | 0) + '%';
- var w = ctx.measureText(text).width;
-
- ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
- } catch (err) {
- // don't fail if we can't render progress
- }
- return this;
-};
-
-},{}],5:[function(require,module,exports){
-(function (global){
-exports.isatty = function isatty() {
- return true;
-};
-
-exports.getWindowSize = function getWindowSize() {
- if ('innerHeight' in global) {
- return [global.innerHeight, global.innerWidth];
- }
- // In a Web Worker, the DOM Window is not available.
- return [640, 480];
-};
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],6:[function(require,module,exports){
-/**
- * Module dependencies.
- */
-
-var JSON = require('json3');
-
-/**
- * Expose `Context`.
- */
-
-module.exports = Context;
-
-/**
- * Initialize a new `Context`.
- *
- * @api private
- */
-function Context() {}
-
-/**
- * Set or get the context `Runnable` to `runnable`.
- *
- * @api private
- * @param {Runnable} runnable
- * @return {Context}
- */
-Context.prototype.runnable = function(runnable) {
- if (!arguments.length) {
- return this._runnable;
- }
- this.test = this._runnable = runnable;
- return this;
-};
-
-/**
- * Set test timeout `ms`.
- *
- * @api private
- * @param {number} ms
- * @return {Context} self
- */
-Context.prototype.timeout = function(ms) {
- if (!arguments.length) {
- return this.runnable().timeout();
- }
- this.runnable().timeout(ms);
- return this;
-};
-
-/**
- * Set test timeout `enabled`.
- *
- * @api private
- * @param {boolean} enabled
- * @return {Context} self
- */
-Context.prototype.enableTimeouts = function(enabled) {
- this.runnable().enableTimeouts(enabled);
- return this;
-};
-
-/**
- * Set test slowness threshold `ms`.
- *
- * @api private
- * @param {number} ms
- * @return {Context} self
- */
-Context.prototype.slow = function(ms) {
- this.runnable().slow(ms);
- return this;
-};
-
-/**
- * Mark a test as skipped.
- *
- * @api private
- * @return {Context} self
- */
-Context.prototype.skip = function() {
- this.runnable().skip();
- return this;
-};
-
-/**
- * Allow a number of retries on failed tests
- *
- * @api private
- * @param {number} n
- * @return {Context} self
- */
-Context.prototype.retries = function(n) {
- if (!arguments.length) {
- return this.runnable().retries();
- }
- this.runnable().retries(n);
- return this;
-};
-
-/**
- * Inspect the context void of `._runnable`.
- *
- * @api private
- * @return {string}
- */
-Context.prototype.inspect = function() {
- return JSON.stringify(this, function(key, val) {
- return key === 'runnable' || key === 'test' ? undefined : val;
- }, 2);
-};
-
-},{"json3":54}],7:[function(require,module,exports){
-/**
- * Module dependencies.
- */
-
-var Runnable = require('./runnable');
-var inherits = require('./utils').inherits;
-
-/**
- * Expose `Hook`.
- */
-
-module.exports = Hook;
-
-/**
- * Initialize a new `Hook` with the given `title` and callback `fn`.
- *
- * @param {String} title
- * @param {Function} fn
- * @api private
- */
-function Hook(title, fn) {
- Runnable.call(this, title, fn);
- this.type = 'hook';
-}
-
-/**
- * Inherit from `Runnable.prototype`.
- */
-inherits(Hook, Runnable);
-
-/**
- * Get or set the test `err`.
- *
- * @param {Error} err
- * @return {Error}
- * @api public
- */
-Hook.prototype.error = function(err) {
- if (!arguments.length) {
- err = this._error;
- this._error = null;
- return err;
- }
-
- this._error = err;
-};
-
-},{"./runnable":33,"./utils":38}],8:[function(require,module,exports){
-/**
- * Module dependencies.
- */
-
-var Test = require('../test');
-
-/**
- * BDD-style interface:
- *
- * describe('Array', function() {
- * describe('#indexOf()', function() {
- * it('should return -1 when not present', function() {
- * // ...
- * });
- *
- * it('should return the index when present', function() {
- * // ...
- * });
- * });
- * });
- *
- * @param {Suite} suite Root suite.
- */
-module.exports = function(suite) {
- var suites = [suite];
-
- suite.on('pre-require', function(context, file, mocha) {
- var common = require('./common')(suites, context, mocha);
-
- 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
- * and/or tests.
- */
-
- context.describe = context.context = function(title, fn) {
- return common.suite.create({
- title: title,
- file: file,
- fn: fn
- });
- };
-
- /**
- * Pending describe.
- */
-
- context.xdescribe = context.xcontext = context.describe.skip = function(title, fn) {
- return common.suite.skip({
- title: title,
- file: file,
- fn: fn
- });
- };
-
- /**
- * Exclusive suite.
- */
-
- context.describe.only = function(title, fn) {
- return common.suite.only({
- title: title,
- file: file,
- fn: fn
- });
- };
-
- /**
- * Describe a specification or test-case
- * with the given `title` and callback `fn`
- * acting as a thunk.
- */
-
- context.it = context.specify = function(title, fn) {
- var suite = suites[0];
- if (suite.isPending()) {
- fn = null;
- }
- var test = new Test(title, fn);
- test.file = file;
- suite.addTest(test);
- return test;
- };
-
- /**
- * Exclusive test-case.
- */
-
- context.it.only = function(title, fn) {
- return common.test.only(mocha, context.it(title, fn));
- };
-
- /**
- * Pending test case.
- */
-
- context.xit = context.xspecify = context.it.skip = function(title) {
- context.it(title);
- };
-
- /**
- * Number of attempts to retry.
- */
- context.it.retries = function(n) {
- context.retries(n);
- };
- });
-};
-
-},{"../test":36,"./common":9}],9:[function(require,module,exports){
-'use strict';
-
-var Suite = require('../suite');
-
-/**
- * Functions common to more than one interface.
- *
- * @param {Suite[]} suites
- * @param {Context} context
- * @param {Mocha} mocha
- * @return {Object} An object containing common functions.
- */
-module.exports = function(suites, context, mocha) {
- return {
- /**
- * This is only present if flag --delay is passed into Mocha. It triggers
- * root suite execution.
- *
- * @param {Suite} suite The root wuite.
- * @return {Function} A function which runs the root suite
- */
- runWithSuite: function runWithSuite(suite) {
- return function run() {
- suite.run();
- };
- },
-
- /**
- * Execute before running tests.
- *
- * @param {string} name
- * @param {Function} fn
- */
- before: function(name, fn) {
- suites[0].beforeAll(name, fn);
- },
-
- /**
- * Execute after running tests.
- *
- * @param {string} name
- * @param {Function} fn
- */
- after: function(name, fn) {
- suites[0].afterAll(name, fn);
- },
-
- /**
- * Execute before each test case.
- *
- * @param {string} name
- * @param {Function} fn
- */
- beforeEach: function(name, fn) {
- suites[0].beforeEach(name, fn);
- },
-
- /**
- * Execute after each test case.
- *
- * @param {string} name
- * @param {Function} fn
- */
- afterEach: function(name, fn) {
- suites[0].afterEach(name, fn);
- },
-
- suite: {
- /**
- * Create an exclusive Suite; convenience function
- * See docstring for create() below.
- *
- * @param {Object} opts
- * @returns {Suite}
- */
- only: function only(opts) {
- mocha.options.hasOnly = true;
- opts.isOnly = true;
- return this.create(opts);
- },
-
- /**
- * Create a Suite, but skip it; convenience function
- * See docstring for create() below.
- *
- * @param {Object} opts
- * @returns {Suite}
- */
- skip: function skip(opts) {
- opts.pending = true;
- return this.create(opts);
- },
-
- /**
- * Creates a suite.
- * @param {Object} opts Options
- * @param {string} opts.title Title of Suite
- * @param {Function} [opts.fn] Suite Function (not always applicable)
- * @param {boolean} [opts.pending] Is Suite pending?
- * @param {string} [opts.file] Filepath where this Suite resides
- * @param {boolean} [opts.isOnly] Is Suite exclusive?
- * @returns {Suite}
- */
- create: function create(opts) {
- var suite = Suite.create(suites[0], opts.title);
- suite.pending = Boolean(opts.pending);
- suite.file = opts.file;
- suites.unshift(suite);
- if (opts.isOnly) {
- suite.parent._onlySuites = suite.parent._onlySuites.concat(suite);
- mocha.options.hasOnly = true;
- }
- if (typeof opts.fn === 'function') {
- opts.fn.call(suite);
- suites.shift();
- } else if (typeof opts.fn === 'undefined' && !suite.pending) {
- throw new Error('Suite "' + suite.fullTitle() + '" was defined but no callback was supplied. Supply a callback or explicitly skip the suite.');
- }
-
- return suite;
- }
- },
-
- test: {
-
- /**
- * Exclusive test-case.
- *
- * @param {Object} mocha
- * @param {Function} test
- * @returns {*}
- */
- only: function(mocha, test) {
- test.parent._onlyTests = test.parent._onlyTests.concat(test);
- mocha.options.hasOnly = true;
- return test;
- },
-
- /**
- * Pending test case.
- *
- * @param {string} title
- */
- skip: function(title) {
- context.test(title);
- },
-
- /**
- * Number of retry attempts
- *
- * @param {number} n
- */
- retries: function(n) {
- context.retries(n);
- }
- }
- };
-};
-
-},{"../suite":35}],10:[function(require,module,exports){
-/**
- * Module dependencies.
- */
-
-var Suite = require('../suite');
-var Test = require('../test');
-
-/**
- * Exports-style (as Node.js module) interface:
- *
- * exports.Array = {
- * '#indexOf()': {
- * 'should return -1 when the value is not present': function() {
- *
- * },
- *
- * 'should return the correct index when the value is present': function() {
- *
- * }
- * }
- * };
- *
- * @param {Suite} suite Root suite.
- */
-module.exports = function(suite) {
- var suites = [suite];
-
- suite.on('require', visit);
-
- function visit(obj, file) {
- var suite;
- for (var key in obj) {
- if (typeof obj[key] === 'function') {
- var fn = obj[key];
- switch (key) {
- case 'before':
- suites[0].beforeAll(fn);
- break;
- case 'after':
- suites[0].afterAll(fn);
- break;
- case 'beforeEach':
- suites[0].beforeEach(fn);
- break;
- case 'afterEach':
- suites[0].afterEach(fn);
- break;
- default:
- var test = new Test(key, fn);
- test.file = file;
- suites[0].addTest(test);
- }
- } else {
- suite = Suite.create(suites[0], key);
- suites.unshift(suite);
- visit(obj[key], file);
- suites.shift();
- }
- }
- }
-};
-
-},{"../suite":35,"../test":36}],11:[function(require,module,exports){
-exports.bdd = require('./bdd');
-exports.tdd = require('./tdd');
-exports.qunit = require('./qunit');
-exports.exports = require('./exports');
-
-},{"./bdd":8,"./exports":10,"./qunit":12,"./tdd":13}],12:[function(require,module,exports){
-/**
- * Module dependencies.
- */
-
-var Test = require('../test');
-
-/**
- * QUnit-style interface:
- *
- * 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);
- * });
- *
- * @param {Suite} suite Root suite.
- */
-module.exports = function(suite) {
- var suites = [suite];
-
- suite.on('pre-require', function(context, file, mocha) {
- var common = require('./common')(suites, context, mocha);
-
- 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`.
- */
-
- context.suite = function(title) {
- if (suites.length > 1) {
- suites.shift();
- }
- return common.suite.create({
- title: title,
- file: file,
- fn: false
- });
- };
-
- /**
- * Exclusive Suite.
- */
-
- context.suite.only = function(title) {
- if (suites.length > 1) {
- suites.shift();
- }
- return common.suite.only({
- title: title,
- file: file,
- fn: false
- });
- };
-
- /**
- * Describe a specification or test-case
- * with the given `title` and callback `fn`
- * acting as a thunk.
- */
-
- context.test = function(title, fn) {
- var test = new Test(title, fn);
- test.file = file;
- suites[0].addTest(test);
- return test;
- };
-
- /**
- * Exclusive test-case.
- */
-
- context.test.only = function(title, fn) {
- return common.test.only(mocha, context.test(title, fn));
- };
-
- context.test.skip = common.test.skip;
- context.test.retries = common.test.retries;
- });
-};
-
-},{"../test":36,"./common":9}],13:[function(require,module,exports){
-/**
- * Module dependencies.
- */
-
-var Test = require('../test');
-
-/**
- * TDD-style interface:
- *
- * suite('Array', function() {
- * suite('#indexOf()', function() {
- * suiteSetup(function() {
- *
- * });
- *
- * test('should return -1 when not present', function() {
- *
- * });
- *
- * test('should return the index when present', function() {
- *
- * });
- *
- * suiteTeardown(function() {
- *
- * });
- * });
- * });
- *
- * @param {Suite} suite Root suite.
- */
-module.exports = function(suite) {
- var suites = [suite];
-
- suite.on('pre-require', function(context, file, mocha) {
- var common = require('./common')(suites, context, mocha);
-
- 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 and/or tests.
- */
- context.suite = function(title, fn) {
- return common.suite.create({
- title: title,
- file: file,
- fn: fn
- });
- };
-
- /**
- * Pending suite.
- */
- context.suite.skip = function(title, fn) {
- return common.suite.skip({
- title: title,
- file: file,
- fn: fn
- });
- };
-
- /**
- * Exclusive test-case.
- */
- context.suite.only = function(title, fn) {
- return common.suite.only({
- title: title,
- file: file,
- fn: fn
- });
- };
-
- /**
- * Describe a specification or test-case with the given `title` and
- * callback `fn` acting as a thunk.
- */
- context.test = function(title, fn) {
- var suite = suites[0];
- if (suite.isPending()) {
- fn = null;
- }
- var test = new Test(title, fn);
- test.file = file;
- suite.addTest(test);
- return test;
- };
-
- /**
- * Exclusive test-case.
- */
-
- context.test.only = function(title, fn) {
- return common.test.only(mocha, context.test(title, fn));
- };
-
- context.test.skip = common.test.skip;
- context.test.retries = common.test.retries;
- });
-};
-
-},{"../test":36,"./common":9}],14:[function(require,module,exports){
-(function (process,global,__dirname){
-/*!
- * mocha
- * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var escapeRe = require('escape-string-regexp');
-var path = require('path');
-var reporters = require('./reporters');
-var utils = require('./utils');
-
-/**
- * Expose `Mocha`.
- */
-
-exports = module.exports = Mocha;
-
-/**
- * To require local UIs and reporters when running in node.
- */
-
-if (!process.browser) {
- var cwd = process.cwd();
- module.paths.push(cwd, path.join(cwd, 'node_modules'));
-}
-
-/**
- * Expose internals.
- */
-
-exports.utils = utils;
-exports.interfaces = require('./interfaces');
-exports.reporters = reporters;
-exports.Runnable = require('./runnable');
-exports.Context = require('./context');
-exports.Runner = require('./runner');
-exports.Suite = require('./suite');
-exports.Hook = require('./hook');
-exports.Test = require('./test');
-
-/**
- * Return image `name` path.
- *
- * @api private
- * @param {string} name
- * @return {string}
- */
-function image(name) {
- return path.join(__dirname, '../images', name + '.png');
-}
-
-/**
- * Set up mocha with `options`.
- *
- * Options:
- *
- * - `ui` name "bdd", "tdd", "exports" etc
- * - `reporter` reporter instance, defaults to `mocha.reporters.spec`
- * - `globals` array of accepted globals
- * - `timeout` timeout in milliseconds
- * - `retries` number of times to retry failed tests
- * - `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
- * @api public
- */
-function Mocha(options) {
- options = options || {};
- this.files = [];
- this.options = options;
- if (options.grep) {
- this.grep(new RegExp(options.grep));
- }
- if (options.fgrep) {
- this.fgrep(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 (typeof options.timeout !== 'undefined' && options.timeout !== null) {
- this.timeout(options.timeout);
- }
- if (typeof options.retries !== 'undefined' && options.retries !== null) {
- this.retries(options.retries);
- }
- this.useColors(options.useColors);
- if (options.enableTimeouts !== null) {
- this.enableTimeouts(options.enableTimeouts);
- }
- if (options.slow) {
- this.slow(options.slow);
- }
-}
-
-/**
- * Enable or disable bailing on the first failure.
- *
- * @api public
- * @param {boolean} [bail]
- */
-Mocha.prototype.bail = function(bail) {
- if (!arguments.length) {
- bail = true;
- }
- this.suite.bail(bail);
- return this;
-};
-
-/**
- * Add test `file`.
- *
- * @api public
- * @param {string} file
- */
-Mocha.prototype.addFile = function(file) {
- this.files.push(file);
- return this;
-};
-
-/**
- * Set reporter to `reporter`, defaults to "spec".
- *
- * @param {String|Function} reporter name or constructor
- * @param {Object} reporterOptions optional options
- * @api public
- * @param {string|Function} reporter name or constructor
- * @param {Object} reporterOptions optional options
- */
-Mocha.prototype.reporter = function(reporter, reporterOptions) {
- if (typeof reporter === 'function') {
- this._reporter = reporter;
- } else {
- reporter = reporter || 'spec';
- var _reporter;
- // Try to load a built-in reporter.
- if (reporters[reporter]) {
- _reporter = reporters[reporter];
- }
- // Try to load reporters from process.cwd() and node_modules
- 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 '
- + '(https://npmjs.org/package/mocha-teamcity-reporter).');
- }
- if (!_reporter) {
- throw new Error('invalid reporter "' + reporter + '"');
- }
- this._reporter = _reporter;
- }
- this.options.reporterOptions = reporterOptions;
- return this;
-};
-
-/**
- * Set test UI `name`, defaults to "bdd".
- *
- * @api public
- * @param {string} bdd
- */
-Mocha.prototype.ui = function(name) {
- name = name || 'bdd';
- this._ui = exports.interfaces[name];
- if (!this._ui) {
- try {
- this._ui = require(name);
- } catch (err) {
- throw new Error('invalid interface "' + name + '"');
- }
- }
- this._ui = this._ui(this.suite);
-
- this.suite.on('pre-require', function(context) {
- exports.afterEach = context.afterEach || context.teardown;
- exports.after = context.after || context.suiteTeardown;
- exports.beforeEach = context.beforeEach || context.setup;
- exports.before = context.before || context.suiteSetup;
- exports.describe = context.describe || context.suite;
- exports.it = context.it || context.test;
- exports.setup = context.setup || context.beforeEach;
- exports.suiteSetup = context.suiteSetup || context.before;
- exports.suiteTeardown = context.suiteTeardown || context.after;
- exports.suite = context.suite || context.describe;
- exports.teardown = context.teardown || context.afterEach;
- exports.test = context.test || context.it;
- exports.run = context.run;
- });
-
- return this;
-};
-
-/**
- * Load registered files.
- *
- * @api private
- */
-Mocha.prototype.loadFiles = function(fn) {
- var self = this;
- var suite = this.suite;
- this.files.forEach(function(file) {
- file = path.resolve(file);
- suite.emit('pre-require', global, file, self);
- suite.emit('require', require(file), file, self);
- suite.emit('post-require', global, file, self);
- });
- fn && fn();
-};
-
-/**
- * Enable growl support.
- *
- * @api private
- */
-Mocha.prototype._growl = function(runner, reporter) {
- var notify = require('growl');
-
- runner.on('end', function() {
- var stats = reporter.stats;
- if (stats.failures) {
- var msg = stats.failures + ' of ' + runner.total + ' tests failed';
- notify(msg, { name: 'mocha', title: 'Failed', image: image('error') });
- } else {
- notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', {
- name: 'mocha',
- title: 'Passed',
- image: image('ok')
- });
- }
- });
-};
-
-/**
- * Escape string and add it to grep as a regexp.
- *
- * @api public
- * @param str
- * @returns {Mocha}
- */
-Mocha.prototype.fgrep = function(str) {
- return this.grep(new RegExp(escapeRe(str)));
-};
-
-/**
- * Add regexp to grep, if `re` is a string it is escaped.
- *
- * @param {RegExp|String} re
- * @return {Mocha}
- * @api public
- * @param {RegExp|string} re
- * @return {Mocha}
- */
-Mocha.prototype.grep = function(re) {
- if (utils.isString(re)) {
- // extract args if it's regex-like, i.e: [string, pattern, flag]
- var arg = re.match(/^\/(.*)\/(g|i|)$|.*/);
- this.options.grep = new RegExp(arg[1] || arg[0], arg[2]);
- } else {
- this.options.grep = re;
- }
- return this;
-};
-/**
- * Invert `.grep()` matches.
- *
- * @return {Mocha}
- * @api public
- */
-Mocha.prototype.invert = function() {
- this.options.invert = true;
- return this;
-};
-
-/**
- * Ignore global leaks.
- *
- * @param {Boolean} ignore
- * @return {Mocha}
- * @api public
- * @param {boolean} ignore
- * @return {Mocha}
- */
-Mocha.prototype.ignoreLeaks = function(ignore) {
- this.options.ignoreLeaks = Boolean(ignore);
- return this;
-};
-
-/**
- * Enable global leak checking.
- *
- * @return {Mocha}
- * @api public
- */
-Mocha.prototype.checkLeaks = function() {
- this.options.ignoreLeaks = false;
- 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.
- *
- * @return {Mocha}
- * @api public
- */
-Mocha.prototype.growl = function() {
- this.options.growl = true;
- return this;
-};
-
-/**
- * Ignore `globals` array or string.
- *
- * @param {Array|String} globals
- * @return {Mocha}
- * @api public
- * @param {Array|string} globals
- * @return {Mocha}
- */
-Mocha.prototype.globals = function(globals) {
- this.options.globals = (this.options.globals || []).concat(globals);
- return this;
-};
-
-/**
- * Emit color output.
- *
- * @param {Boolean} colors
- * @return {Mocha}
- * @api public
- * @param {boolean} colors
- * @return {Mocha}
- */
-Mocha.prototype.useColors = function(colors) {
- if (colors !== undefined) {
- this.options.useColors = colors;
- }
- return this;
-};
-
-/**
- * Use inline diffs rather than +/-.
- *
- * @param {Boolean} inlineDiffs
- * @return {Mocha}
- * @api public
- * @param {boolean} inlineDiffs
- * @return {Mocha}
- */
-Mocha.prototype.useInlineDiffs = function(inlineDiffs) {
- this.options.useInlineDiffs = inlineDiffs !== undefined && inlineDiffs;
- return this;
-};
-
-/**
- * Set the timeout in milliseconds.
- *
- * @param {Number} timeout
- * @return {Mocha}
- * @api public
- * @param {number} timeout
- * @return {Mocha}
- */
-Mocha.prototype.timeout = function(timeout) {
- this.suite.timeout(timeout);
- return this;
-};
-
-/**
- * Set the number of times to retry failed tests.
- *
- * @param {Number} retry times
- * @return {Mocha}
- * @api public
- */
-Mocha.prototype.retries = function(n) {
- this.suite.retries(n);
- return this;
-};
-
-/**
- * Set slowness threshold in milliseconds.
- *
- * @param {Number} slow
- * @return {Mocha}
- * @api public
- * @param {number} slow
- * @return {Mocha}
- */
-Mocha.prototype.slow = function(slow) {
- this.suite.slow(slow);
- return this;
-};
-
-/**
- * Enable timeouts.
- *
- * @param {Boolean} enabled
- * @return {Mocha}
- * @api public
- * @param {boolean} enabled
- * @return {Mocha}
- */
-Mocha.prototype.enableTimeouts = function(enabled) {
- this.suite.enableTimeouts(arguments.length && enabled !== undefined ? enabled : true);
- return this;
-};
-
-/**
- * Makes all tests async (accepting a callback)
- *
- * @return {Mocha}
- * @api public
- */
-Mocha.prototype.asyncOnly = function() {
- this.options.asyncOnly = true;
- return this;
-};
-
-/**
- * Disable syntax highlighting (in browser).
- *
- * @api public
- */
-Mocha.prototype.noHighlighting = function() {
- this.options.noHighlighting = true;
- return this;
-};
-
-/**
- * Enable uncaught errors to propagate (in browser).
- *
- * @return {Mocha}
- * @api public
- */
-Mocha.prototype.allowUncaught = function() {
- this.options.allowUncaught = true;
- return this;
-};
-
-/**
- * Delay root suite execution.
- * @returns {Mocha}
- */
-Mocha.prototype.delay = function delay() {
- this.options.delay = true;
- return this;
-};
-
-/**
- * Run tests and invoke `fn()` when complete.
- *
- * @api public
- * @param {Function} fn
- * @return {Runner}
- */
-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, options.delay);
- var reporter = new this._reporter(runner, options);
- runner.ignoreLeaks = options.ignoreLeaks !== false;
- runner.fullStackTrace = options.fullStackTrace;
- runner.hasOnly = options.hasOnly;
- runner.asyncOnly = options.asyncOnly;
- runner.allowUncaught = options.allowUncaught;
- if (options.grep) {
- runner.grep(options.grep, options.invert);
- }
- if (options.globals) {
- runner.globals(options.globals);
- }
- if (options.growl) {
- this._growl(runner, reporter);
- }
- if (options.useColors !== undefined) {
- exports.reporters.Base.useColors = options.useColors;
- }
- exports.reporters.Base.inlineDiffs = options.useInlineDiffs;
-
- function done(failures) {
- if (reporter.done) {
- reporter.done(failures, fn);
- } else {
- fn && fn(failures);
- }
- }
-
- return runner.run(done);
-};
-
-}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},"/lib")
-},{"./context":6,"./hook":7,"./interfaces":11,"./reporters":21,"./runnable":33,"./runner":34,"./suite":35,"./test":36,"./utils":38,"_process":67,"escape-string-regexp":47,"growl":49,"path":42}],15:[function(require,module,exports){
-/**
- * Helpers.
- */
-
-var s = 1000;
-var m = s * 60;
-var h = m * 60;
-var d = h * 24;
-var y = d * 365.25;
-
-/**
- * Parse or format the given `val`.
- *
- * Options:
- *
- * - `long` verbose formatting [false]
- *
- * @api public
- * @param {string|number} val
- * @param {Object} options
- * @return {string|number}
- */
-module.exports = function(val, options) {
- options = options || {};
- if (typeof val === 'string') {
- return parse(val);
- }
- // https://github.com/mochajs/mocha/pull/1035
- return options['long'] ? longFormat(val) : shortFormat(val);
-};
-
-/**
- * Parse the given `str` and return milliseconds.
- *
- * @api private
- * @param {string} str
- * @return {number}
- */
-function parse(str) {
- var match = (/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i).exec(str);
- if (!match) {
- return;
- }
- var n = parseFloat(match[1]);
- var type = (match[2] || 'ms').toLowerCase();
- switch (type) {
- case 'years':
- case 'year':
- case 'y':
- return n * y;
- case 'days':
- case 'day':
- case 'd':
- return n * d;
- case 'hours':
- case 'hour':
- case 'h':
- return n * h;
- case 'minutes':
- case 'minute':
- case 'm':
- return n * m;
- case 'seconds':
- case 'second':
- case 's':
- return n * s;
- case 'ms':
- return n;
- default:
- // No default case
- }
-}
-
-/**
- * Short format for `ms`.
- *
- * @api private
- * @param {number} ms
- * @return {string}
- */
-function shortFormat(ms) {
- if (ms >= d) {
- return Math.round(ms / d) + 'd';
- }
- if (ms >= h) {
- return Math.round(ms / h) + 'h';
- }
- if (ms >= m) {
- return Math.round(ms / m) + 'm';
- }
- if (ms >= s) {
- return Math.round(ms / s) + 's';
- }
- return ms + 'ms';
-}
-
-/**
- * Long format for `ms`.
- *
- * @api private
- * @param {number} ms
- * @return {string}
- */
-function longFormat(ms) {
- return plural(ms, d, 'day')
- || plural(ms, h, 'hour')
- || plural(ms, m, 'minute')
- || plural(ms, s, 'second')
- || ms + ' ms';
-}
-
-/**
- * Pluralization helper.
- *
- * @api private
- * @param {number} ms
- * @param {number} n
- * @param {string} name
- */
-function plural(ms, n, name) {
- if (ms < n) {
- return;
- }
- if (ms < n * 1.5) {
- return Math.floor(ms / n) + ' ' + name;
- }
- return Math.ceil(ms / n) + ' ' + name + 's';
-}
-
-},{}],16:[function(require,module,exports){
-
-/**
- * Expose `Pending`.
- */
-
-module.exports = Pending;
-
-/**
- * Initialize a new `Pending` error with the given message.
- *
- * @param {string} message
- */
-function Pending(message) {
- this.message = message;
-}
-
-},{}],17:[function(require,module,exports){
-(function (process,global){
-/**
- * Module dependencies.
- */
-
-var tty = require('tty');
-var diff = require('diff');
-var ms = require('../ms');
-var utils = require('../utils');
-var supportsColor = process.browser ? null : require('supports-color');
-
-/**
- * Expose `Base`.
- */
-
-exports = module.exports = Base;
-
-/**
- * Save timer references to avoid Sinon interfering.
- * See: https://github.com/mochajs/mocha/issues/237
- */
-
-/* eslint-disable no-unused-vars, no-native-reassign */
-var Date = global.Date;
-var setTimeout = global.setTimeout;
-var setInterval = global.setInterval;
-var clearTimeout = global.clearTimeout;
-var clearInterval = global.clearInterval;
-/* eslint-enable no-unused-vars, no-native-reassign */
-
-/**
- * Check if both stdio streams are associated with a tty.
- */
-
-var isatty = tty.isatty(1) && tty.isatty(2);
-
-/**
- * Enable coloring by default, except in the browser interface.
- */
-
-exports.useColors = !process.browser && (supportsColor || (process.env.MOCHA_COLORS !== undefined));
-
-/**
- * Inline diffs instead of +/-
- */
-
-exports.inlineDiffs = false;
-
-/**
- * Default color map.
- */
-
-exports.colors = {
- pass: 90,
- fail: 31,
- 'bright pass': 92,
- 'bright fail': 91,
- 'bright yellow': 93,
- pending: 36,
- suite: 0,
- 'error title': 0,
- 'error message': 31,
- 'error stack': 90,
- checkmark: 32,
- fast: 90,
- medium: 33,
- slow: 31,
- green: 32,
- light: 90,
- 'diff gutter': 90,
- 'diff added': 32,
- 'diff removed': 31
-};
-
-/**
- * Default symbol map.
- */
-
-exports.symbols = {
- ok: '✓',
- err: '✖',
- dot: '․',
- comma: ',',
- bang: '!'
-};
-
-// With node.js on Windows: use symbols available in terminal default fonts
-if (process.platform === 'win32') {
- exports.symbols.ok = '\u221A';
- exports.symbols.err = '\u00D7';
- exports.symbols.dot = '.';
-}
-
-/**
- * Color `str` with the given `type`,
- * allowing colors to be disabled,
- * as well as user-defined color
- * schemes.
- *
- * @param {string} type
- * @param {string} str
- * @return {string}
- * @api private
- */
-var color = exports.color = function(type, str) {
- if (!exports.useColors) {
- return String(str);
- }
- return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';
-};
-
-/**
- * Expose term window size, with some defaults for when stderr is not a tty.
- */
-
-exports.window = {
- width: 75
-};
-
-if (isatty) {
- exports.window.width = process.stdout.getWindowSize
- ? process.stdout.getWindowSize(1)[0]
- : tty.getWindowSize()[1];
-}
-
-/**
- * Expose some basic cursor interactions that are common among reporters.
- */
-
-exports.cursor = {
- hide: function() {
- isatty && process.stdout.write('\u001b[?25l');
- },
-
- show: function() {
- isatty && process.stdout.write('\u001b[?25h');
- },
-
- deleteLine: function() {
- isatty && process.stdout.write('\u001b[2K');
- },
-
- beginningOfLine: function() {
- isatty && process.stdout.write('\u001b[0G');
- },
-
- CR: function() {
- if (isatty) {
- exports.cursor.deleteLine();
- exports.cursor.beginningOfLine();
- } else {
- process.stdout.write('\r');
- }
- }
-};
-
-/**
- * Outut the given `failures` as a list.
- *
- * @param {Array} failures
- * @api public
- */
-
-exports.list = function(failures) {
- console.log();
- failures.forEach(function(test, i) {
- // format
- var fmt = color('error title', ' %s) %s:\n')
- + color('error message', ' %s')
- + color('error stack', '\n%s\n');
-
- // msg
- var msg;
- var err = test.err;
- var message;
- if (err.message && typeof err.message.toString === 'function') {
- message = err.message + '';
- } else if (typeof err.inspect === 'function') {
- message = err.inspect() + '';
- } else {
- message = '';
- }
- var stack = err.stack || message;
- var index = message ? stack.indexOf(message) : -1;
- var actual = err.actual;
- var expected = err.expected;
- var 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 !== false && sameType(actual, expected) && expected !== undefined) {
- escape = false;
- if (!(utils.isString(actual) && utils.isString(expected))) {
- err.actual = actual = utils.stringify(actual);
- err.expected = expected = utils.stringify(expected);
- }
-
- fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');
- var match = message.match(/^([^:]+): expected/);
- msg = '\n ' + color('error message', match ? match[1] : msg);
-
- if (exports.inlineDiffs) {
- msg += inlineDiff(err, escape);
- } else {
- msg += unifiedDiff(err, escape);
- }
- }
-
- // indent stack trace
- stack = stack.replace(/^/gm, ' ');
-
- console.log(fmt, (i + 1), test.fullTitle(), msg, stack);
- });
-};
-
-/**
- * Initialize a new `Base` reporter.
- *
- * All other reporters generally
- * inherit from this reporter, providing
- * stats such as test duration, number
- * of tests passed / failed etc.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Base(runner) {
- var stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 };
- var failures = this.failures = [];
-
- if (!runner) {
- return;
- }
- this.runner = runner;
-
- runner.stats = stats;
-
- runner.on('start', function() {
- stats.start = new Date();
- });
-
- runner.on('suite', function(suite) {
- stats.suites = stats.suites || 0;
- suite.root || stats.suites++;
- });
-
- runner.on('test end', function() {
- stats.tests = stats.tests || 0;
- stats.tests++;
- });
-
- runner.on('pass', function(test) {
- stats.passes = stats.passes || 0;
-
- if (test.duration > test.slow()) {
- test.speed = 'slow';
- } else if (test.duration > test.slow() / 2) {
- test.speed = 'medium';
- } else {
- test.speed = 'fast';
- }
-
- stats.passes++;
- });
-
- runner.on('fail', function(test, err) {
- stats.failures = stats.failures || 0;
- stats.failures++;
- test.err = err;
- failures.push(test);
- });
-
- runner.on('end', function() {
- stats.end = new Date();
- stats.duration = new Date() - stats.start;
- });
-
- runner.on('pending', function() {
- stats.pending++;
- });
-}
-
-/**
- * Output common epilogue used by many of
- * the bundled reporters.
- *
- * @api public
- */
-Base.prototype.epilogue = function() {
- var stats = this.stats;
- var fmt;
-
- console.log();
-
- // passes
- fmt = color('bright pass', ' ')
- + color('green', ' %d passing')
- + color('light', ' (%s)');
-
- console.log(fmt,
- stats.passes || 0,
- ms(stats.duration));
-
- // pending
- if (stats.pending) {
- fmt = color('pending', ' ')
- + color('pending', ' %d pending');
-
- console.log(fmt, stats.pending);
- }
-
- // failures
- if (stats.failures) {
- fmt = color('fail', ' %d failing');
-
- console.log(fmt, stats.failures);
-
- Base.list(this.failures);
- console.log();
- }
-
- console.log();
-};
-
-/**
- * Pad the given `str` to `len`.
- *
- * @api private
- * @param {string} str
- * @param {string} len
- * @return {string}
- */
-function pad(str, len) {
- str = String(str);
- return Array(len - str.length + 1).join(' ') + str;
-}
-
-/**
- * Returns an inline diff between 2 strings with coloured ANSI output
- *
- * @api private
- * @param {Error} err with actual/expected
- * @param {boolean} escape
- * @return {string} Diff
- */
-function inlineDiff(err, escape) {
- var msg = errorDiff(err, 'WordsWithSpace', escape);
-
- // linenos
- var lines = msg.split('\n');
- if (lines.length > 4) {
- var width = String(lines.length).length;
- msg = lines.map(function(str, i) {
- return pad(++i, width) + ' |' + ' ' + str;
- }).join('\n');
- }
-
- // legend
- msg = '\n'
- + color('diff removed', 'actual')
- + ' '
- + color('diff added', 'expected')
- + '\n\n'
- + msg
- + '\n';
-
- // indent
- msg = msg.replace(/^/gm, ' ');
- return msg;
-}
-
-/**
- * Returns a unified diff between two strings.
- *
- * @api private
- * @param {Error} err with actual/expected
- * @param {boolean} escape
- * @return {string} The diff.
- */
-function unifiedDiff(err, escape) {
- var indent = ' ';
- function cleanUp(line) {
- if (escape) {
- line = escapeInvisibles(line);
- }
- if (line[0] === '+') {
- return indent + colorLines('diff added', line);
- }
- if (line[0] === '-') {
- return indent + colorLines('diff removed', line);
- }
- if (line.match(/\@\@/)) {
- return null;
- }
- if (line.match(/\\ No newline/)) {
- return null;
- }
- return indent + line;
- }
- function notBlank(line) {
- return typeof line !== 'undefined' && line !== null;
- }
- var msg = diff.createPatch('string', err.actual, err.expected);
- var lines = msg.split('\n').splice(4);
- return '\n '
- + colorLines('diff added', '+ expected') + ' '
- + colorLines('diff removed', '- actual')
- + '\n\n'
- + lines.map(cleanUp).filter(notBlank).join('\n');
-}
-
-/**
- * Return a character diff for `err`.
- *
- * @api private
- * @param {Error} err
- * @param {string} type
- * @param {boolean} escape
- * @return {string}
- */
-function errorDiff(err, type, escape) {
- var actual = escape ? escapeInvisibles(err.actual) : err.actual;
- var expected = escape ? escapeInvisibles(err.expected) : err.expected;
- return diff['diff' + type](actual, expected).map(function(str) {
- if (str.added) {
- return colorLines('diff added', str.value);
- }
- if (str.removed) {
- return colorLines('diff removed', str.value);
- }
- return str.value;
- }).join('');
-}
-
-/**
- * Returns a string with all invisible characters in plain text
- *
- * @api private
- * @param {string} line
- * @return {string}
- */
-function escapeInvisibles(line) {
- return line.replace(/\t/g, '<tab>')
- .replace(/\r/g, '<CR>')
- .replace(/\n/g, '<LF>\n');
-}
-
-/**
- * Color lines for `str`, using the color `name`.
- *
- * @api private
- * @param {string} name
- * @param {string} str
- * @return {string}
- */
-function colorLines(name, str) {
- return str.split('\n').map(function(str) {
- return color(name, str);
- }).join('\n');
-}
-
-/**
- * Object#toString reference.
- */
-var objToString = Object.prototype.toString;
-
-/**
- * Check that a / b have the same type.
- *
- * @api private
- * @param {Object} a
- * @param {Object} b
- * @return {boolean}
- */
-function sameType(a, b) {
- return objToString.call(a) === objToString.call(b);
-}
-
-}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"../ms":15,"../utils":38,"_process":67,"diff":46,"supports-color":42,"tty":5}],18:[function(require,module,exports){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var utils = require('../utils');
-
-/**
- * Expose `Doc`.
- */
-
-exports = module.exports = Doc;
-
-/**
- * Initialize a new `Doc` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-function Doc(runner) {
- Base.call(this, runner);
-
- var indents = 2;
-
- function indent() {
- return Array(indents).join(' ');
- }
-
- runner.on('suite', function(suite) {
- if (suite.root) {
- return;
- }
- ++indents;
- console.log('%s<section class="suite">', indent());
- ++indents;
- console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
- console.log('%s<dl>', indent());
- });
-
- runner.on('suite end', function(suite) {
- if (suite.root) {
- return;
- }
- console.log('%s</dl>', indent());
- --indents;
- console.log('%s</section>', indent());
- --indents;
- });
-
- runner.on('pass', function(test) {
- console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
- var code = utils.escape(utils.clean(test.body));
- console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
- });
-
- runner.on('fail', function(test, err) {
- console.log('%s <dt class="error">%s</dt>', indent(), utils.escape(test.title));
- var code = utils.escape(utils.clean(test.body));
- console.log('%s <dd class="error"><pre><code>%s</code></pre></dd>', indent(), code);
- console.log('%s <dd class="error">%s</dd>', indent(), utils.escape(err));
- });
-}
-
-},{"../utils":38,"./base":17}],19:[function(require,module,exports){
-(function (process){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-var color = Base.color;
-
-/**
- * Expose `Dot`.
- */
-
-exports = module.exports = Dot;
-
-/**
- * Initialize a new `Dot` matrix test reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function Dot(runner) {
- Base.call(this, runner);
-
- var self = this;
- var width = Base.window.width * .75 | 0;
- var n = -1;
-
- runner.on('start', function() {
- process.stdout.write('\n');
- });
-
- runner.on('pending', function() {
- if (++n % width === 0) {
- process.stdout.write('\n ');
- }
- process.stdout.write(color('pending', Base.symbols.comma));
- });
-
- runner.on('pass', function(test) {
- if (++n % width === 0) {
- process.stdout.write('\n ');
- }
- if (test.speed === 'slow') {
- process.stdout.write(color('bright yellow', Base.symbols.dot));
- } else {
- process.stdout.write(color(test.speed, Base.symbols.dot));
- }
- });
-
- runner.on('fail', function() {
- if (++n % width === 0) {
- process.stdout.write('\n ');
- }
- process.stdout.write(color('fail', Base.symbols.bang));
- });
-
- runner.on('end', function() {
- console.log();
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(Dot, Base);
-
-}).call(this,require('_process'))
-},{"../utils":38,"./base":17,"_process":67}],20:[function(require,module,exports){
-(function (global){
-/* eslint-env browser */
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var utils = require('../utils');
-var Progress = require('../browser/progress');
-var escapeRe = require('escape-string-regexp');
-var escape = utils.escape;
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-/* eslint-disable no-unused-vars, no-native-reassign */
-var Date = global.Date;
-var setTimeout = global.setTimeout;
-var setInterval = global.setInterval;
-var clearTimeout = global.clearTimeout;
-var clearInterval = global.clearInterval;
-/* eslint-enable no-unused-vars, no-native-reassign */
-
-/**
- * Expose `HTML`.
- */
-
-exports = module.exports = HTML;
-
-/**
- * Stats template.
- */
-
-var statsTemplate = '<ul id="mocha-stats">'
- + '<li class="progress"><canvas width="40" height="40"></canvas></li>'
- + '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>'
- + '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>'
- + '<li class="duration">duration: <em>0</em>s</li>'
- + '</ul>';
-
-/**
- * Initialize a new `HTML` reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function HTML(runner) {
- Base.call(this, runner);
-
- var self = this;
- var stats = this.stats;
- var stat = fragment(statsTemplate);
- var items = stat.getElementsByTagName('li');
- var passes = items[1].getElementsByTagName('em')[0];
- var passesLink = items[1].getElementsByTagName('a')[0];
- var failures = items[2].getElementsByTagName('em')[0];
- var failuresLink = items[2].getElementsByTagName('a')[0];
- var duration = items[3].getElementsByTagName('em')[0];
- var canvas = stat.getElementsByTagName('canvas')[0];
- var report = fragment('<ul id="mocha-report"></ul>');
- var stack = [report];
- var progress;
- var ctx;
- var root = document.getElementById('mocha');
-
- if (canvas.getContext) {
- var ratio = window.devicePixelRatio || 1;
- canvas.style.width = canvas.width;
- canvas.style.height = canvas.height;
- canvas.width *= ratio;
- canvas.height *= ratio;
- ctx = canvas.getContext('2d');
- ctx.scale(ratio, ratio);
- progress = new Progress();
- }
-
- if (!root) {
- return error('#mocha div missing, add it to your document');
- }
-
- // pass toggle
- on(passesLink, 'click', function(evt) {
- evt.preventDefault();
- unhide();
- var name = (/pass/).test(report.className) ? '' : ' pass';
- report.className = report.className.replace(/fail|pass/g, '') + name;
- if (report.className.trim()) {
- hideSuitesWithout('test pass');
- }
- });
-
- // failure toggle
- on(failuresLink, 'click', function(evt) {
- evt.preventDefault();
- unhide();
- var name = (/fail/).test(report.className) ? '' : ' fail';
- report.className = report.className.replace(/fail|pass/g, '') + name;
- if (report.className.trim()) {
- hideSuitesWithout('test fail');
- }
- });
-
- root.appendChild(stat);
- root.appendChild(report);
-
- if (progress) {
- progress.size(40);
- }
-
- runner.on('suite', function(suite) {
- if (suite.root) {
- return;
- }
-
- // suite
- var url = self.suiteURL(suite);
- var el = fragment('<li class="suite"><h1><a href="%s">%s</a></h1></li>', url, escape(suite.title));
-
- // container
- stack[0].appendChild(el);
- stack.unshift(document.createElement('ul'));
- el.appendChild(stack[0]);
- });
-
- runner.on('suite end', function(suite) {
- if (suite.root) {
- updateStats();
- return;
- }
- stack.shift();
- });
-
- runner.on('pass', function(test) {
- var url = self.testURL(test);
- var markup = '<li class="test pass %e"><h2>%e<span class="duration">%ems</span> '
- + '<a href="%s" class="replay">‣</a></h2></li>';
- var el = fragment(markup, test.speed, test.title, test.duration, url);
- self.addCodeToggle(el, test.body);
- appendToStack(el);
- updateStats();
- });
-
- runner.on('fail', function(test) {
- var el = fragment('<li class="test fail"><h2>%e <a href="%e" class="replay">‣</a></h2></li>',
- test.title, self.testURL(test));
- var stackString; // Note: Includes leading newline
- var message = test.err.toString();
-
- // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
- // check for the result of the stringifying.
- if (message === '[object Error]') {
- message = test.err.message;
- }
-
- if (test.err.stack) {
- var indexOfMessage = test.err.stack.indexOf(test.err.message);
- if (indexOfMessage === -1) {
- stackString = test.err.stack;
- } else {
- stackString = test.err.stack.substr(test.err.message.length + indexOfMessage);
- }
- } else if (test.err.sourceURL && test.err.line !== undefined) {
- // Safari doesn't give you a stack. Let's at least provide a source line.
- stackString = '\n(' + test.err.sourceURL + ':' + test.err.line + ')';
- }
-
- stackString = stackString || '';
-
- if (test.err.htmlMessage && stackString) {
- el.appendChild(fragment('<div class="html-error">%s\n<pre class="error">%e</pre></div>',
- test.err.htmlMessage, stackString));
- } else if (test.err.htmlMessage) {
- el.appendChild(fragment('<div class="html-error">%s</div>', test.err.htmlMessage));
- } else {
- el.appendChild(fragment('<pre class="error">%e%e</pre>', message, stackString));
- }
-
- self.addCodeToggle(el, test.body);
- appendToStack(el);
- updateStats();
- });
-
- runner.on('pending', function(test) {
- var el = fragment('<li class="test pass pending"><h2>%e</h2></li>', test.title);
- appendToStack(el);
- updateStats();
- });
-
- function appendToStack(el) {
- // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.
- if (stack[0]) {
- stack[0].appendChild(el);
- }
- }
-
- function updateStats() {
- // TODO: add to stats
- var percent = stats.tests / runner.total * 100 | 0;
- if (progress) {
- progress.update(percent).draw(ctx);
- }
-
- // update stats
- var ms = new Date() - stats.start;
- text(passes, stats.passes);
- text(failures, stats.failures);
- text(duration, (ms / 1000).toFixed(2));
- }
-}
-
-/**
- * Makes a URL, preserving querystring ("search") parameters.
- *
- * @param {string} s
- * @return {string} A new URL.
- */
-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(escapeRe(s));
-}
-
-/**
- * Provide suite URL.
- *
- * @param {Object} [suite]
- */
-HTML.prototype.suiteURL = function(suite) {
- return makeUrl(suite.fullTitle());
-};
-
-/**
- * Provide test URL.
- *
- * @param {Object} [test]
- */
-HTML.prototype.testURL = function(test) {
- return makeUrl(test.fullTitle());
-};
-
-/**
- * Adds code toggle functionality for the provided test's list element.
- *
- * @param {HTMLLIElement} el
- * @param {string} contents
- */
-HTML.prototype.addCodeToggle = function(el, contents) {
- var h2 = el.getElementsByTagName('h2')[0];
-
- on(h2, 'click', function() {
- pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
- });
-
- var pre = fragment('<pre><code>%e</code></pre>', utils.clean(contents));
- el.appendChild(pre);
- pre.style.display = 'none';
-};
-
-/**
- * Display error `msg`.
- *
- * @param {string} msg
- */
-function error(msg) {
- document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
-}
-
-/**
- * Return a DOM fragment from `html`.
- *
- * @param {string} html
- */
-function fragment(html) {
- var args = arguments;
- var div = document.createElement('div');
- var i = 1;
-
- div.innerHTML = html.replace(/%([se])/g, function(_, type) {
- switch (type) {
- case 's': return String(args[i++]);
- case 'e': return escape(args[i++]);
- // no default
- }
- });
-
- return div.firstChild;
-}
-
-/**
- * Check for suites that do not have elements
- * with `classname`, and hide them.
- *
- * @param {text} classname
- */
-function hideSuitesWithout(classname) {
- var suites = document.getElementsByClassName('suite');
- for (var i = 0; i < suites.length; i++) {
- var els = suites[i].getElementsByClassName(classname);
- if (!els.length) {
- suites[i].className += ' hidden';
- }
- }
-}
-
-/**
- * Unhide .hidden suites.
- */
-function unhide() {
- var els = document.getElementsByClassName('suite hidden');
- for (var i = 0; i < els.length; ++i) {
- els[i].className = els[i].className.replace('suite hidden', 'suite');
- }
-}
-
-/**
- * Set an element's text contents.
- *
- * @param {HTMLElement} el
- * @param {string} contents
- */
-function text(el, contents) {
- if (el.textContent) {
- el.textContent = contents;
- } else {
- el.innerText = contents;
- }
-}
-
-/**
- * Listen on `event` with callback `fn`.
- */
-function on(el, event, fn) {
- if (el.addEventListener) {
- el.addEventListener(event, fn, false);
- } else {
- el.attachEvent('on' + event, fn);
- }
-}
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"../browser/progress":4,"../utils":38,"./base":17,"escape-string-regexp":47}],21:[function(require,module,exports){
-// Alias exports to a their normalized format Mocha#reporter to prevent a need
-// for dynamic (try/catch) requires, which Browserify doesn't handle.
-exports.Base = exports.base = require('./base');
-exports.Dot = exports.dot = require('./dot');
-exports.Doc = exports.doc = require('./doc');
-exports.TAP = exports.tap = require('./tap');
-exports.JSON = exports.json = require('./json');
-exports.HTML = exports.html = require('./html');
-exports.List = exports.list = require('./list');
-exports.Min = exports.min = require('./min');
-exports.Spec = exports.spec = require('./spec');
-exports.Nyan = exports.nyan = require('./nyan');
-exports.XUnit = exports.xunit = require('./xunit');
-exports.Markdown = exports.markdown = require('./markdown');
-exports.Progress = exports.progress = require('./progress');
-exports.Landing = exports.landing = require('./landing');
-exports.JSONStream = exports['json-stream'] = require('./json-stream');
-
-},{"./base":17,"./doc":18,"./dot":19,"./html":20,"./json":23,"./json-stream":22,"./landing":24,"./list":25,"./markdown":26,"./min":27,"./nyan":28,"./progress":29,"./spec":30,"./tap":31,"./xunit":32}],22:[function(require,module,exports){
-(function (process){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var JSON = require('json3');
-
-/**
- * Expose `List`.
- */
-
-exports = module.exports = List;
-
-/**
- * Initialize a new `List` test reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function List(runner) {
- Base.call(this, runner);
-
- var self = this;
- var total = runner.total;
-
- runner.on('start', function() {
- console.log(JSON.stringify(['start', { total: total }]));
- });
-
- runner.on('pass', function(test) {
- console.log(JSON.stringify(['pass', clean(test)]));
- });
-
- runner.on('fail', function(test, err) {
- test = clean(test);
- test.err = err.message;
- test.stack = err.stack || null;
- console.log(JSON.stringify(['fail', test]));
- });
-
- runner.on('end', function() {
- process.stdout.write(JSON.stringify(['end', self.stats]));
- });
-}
-
-/**
- * Return a plain-object representation of `test`
- * free of cyclic properties etc.
- *
- * @api private
- * @param {Object} test
- * @return {Object}
- */
-function clean(test) {
- return {
- title: test.title,
- fullTitle: test.fullTitle(),
- duration: test.duration,
- currentRetry: test.currentRetry()
- };
-}
-
-}).call(this,require('_process'))
-},{"./base":17,"_process":67,"json3":54}],23:[function(require,module,exports){
-(function (process){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-
-/**
- * Expose `JSON`.
- */
-
-exports = module.exports = JSONReporter;
-
-/**
- * Initialize a new `JSON` reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function JSONReporter(runner) {
- Base.call(this, runner);
-
- var self = this;
- var tests = [];
- var pending = [];
- var failures = [];
- var passes = [];
-
- runner.on('test end', function(test) {
- tests.push(test);
- });
-
- runner.on('pass', function(test) {
- passes.push(test);
- });
-
- runner.on('fail', function(test) {
- failures.push(test);
- });
-
- runner.on('pending', function(test) {
- pending.push(test);
- });
-
- runner.on('end', function() {
- var obj = {
- stats: self.stats,
- tests: tests.map(clean),
- pending: pending.map(clean),
- failures: failures.map(clean),
- passes: passes.map(clean)
- };
-
- runner.testResults = obj;
-
- process.stdout.write(JSON.stringify(obj, null, 2));
- });
-}
-
-/**
- * Return a plain-object representation of `test`
- * free of cyclic properties etc.
- *
- * @api private
- * @param {Object} test
- * @return {Object}
- */
-function clean(test) {
- return {
- title: test.title,
- fullTitle: test.fullTitle(),
- duration: test.duration,
- currentRetry: test.currentRetry(),
- err: errorJSON(test.err || {})
- };
-}
-
-/**
- * Transform `error` into a JSON object.
- *
- * @api private
- * @param {Error} err
- * @return {Object}
- */
-function errorJSON(err) {
- var res = {};
- Object.getOwnPropertyNames(err).forEach(function(key) {
- res[key] = err[key];
- }, err);
- return res;
-}
-
-}).call(this,require('_process'))
-},{"./base":17,"_process":67}],24:[function(require,module,exports){
-(function (process){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-var cursor = Base.cursor;
-var color = Base.color;
-
-/**
- * Expose `Landing`.
- */
-
-exports = module.exports = Landing;
-
-/**
- * Airplane color.
- */
-
-Base.colors.plane = 0;
-
-/**
- * Airplane crash color.
- */
-
-Base.colors['plane crash'] = 31;
-
-/**
- * Runway color.
- */
-
-Base.colors.runway = 90;
-
-/**
- * Initialize a new `Landing` reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function Landing(runner) {
- Base.call(this, runner);
-
- var self = this;
- var width = Base.window.width * .75 | 0;
- var total = runner.total;
- var stream = process.stdout;
- var plane = color('plane', '✈');
- var crashed = -1;
- var n = 0;
-
- function runway() {
- var buf = Array(width).join('-');
- return ' ' + color('runway', buf);
- }
-
- runner.on('start', function() {
- stream.write('\n\n\n ');
- cursor.hide();
- });
-
- runner.on('test end', function(test) {
- // check if the plane crashed
- var col = crashed === -1 ? width * ++n / total | 0 : crashed;
-
- // show the crash
- if (test.state === 'failed') {
- plane = color('plane crash', '✈');
- crashed = col;
- }
-
- // render landing strip
- stream.write('\u001b[' + (width + 1) + 'D\u001b[2A');
- stream.write(runway());
- stream.write('\n ');
- stream.write(color('runway', Array(col).join('â‹…')));
- stream.write(plane);
- stream.write(color('runway', Array(width - col).join('â‹…') + '\n'));
- stream.write(runway());
- stream.write('\u001b[0m');
- });
-
- runner.on('end', function() {
- cursor.show();
- console.log();
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(Landing, Base);
-
-}).call(this,require('_process'))
-},{"../utils":38,"./base":17,"_process":67}],25:[function(require,module,exports){
-(function (process){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-var color = Base.color;
-var cursor = Base.cursor;
-
-/**
- * Expose `List`.
- */
-
-exports = module.exports = List;
-
-/**
- * Initialize a new `List` test reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function List(runner) {
- Base.call(this, runner);
-
- var self = this;
- var n = 0;
-
- runner.on('start', function() {
- console.log();
- });
-
- runner.on('test', function(test) {
- process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
- });
-
- runner.on('pending', function(test) {
- var fmt = color('checkmark', ' -')
- + color('pending', ' %s');
- console.log(fmt, test.fullTitle());
- });
-
- runner.on('pass', function(test) {
- var fmt = color('checkmark', ' ' + Base.symbols.dot)
- + color('pass', ' %s: ')
- + color(test.speed, '%dms');
- cursor.CR();
- console.log(fmt, test.fullTitle(), test.duration);
- });
-
- runner.on('fail', function(test) {
- cursor.CR();
- console.log(color('fail', ' %d) %s'), ++n, test.fullTitle());
- });
-
- runner.on('end', self.epilogue.bind(self));
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(List, Base);
-
-}).call(this,require('_process'))
-},{"../utils":38,"./base":17,"_process":67}],26:[function(require,module,exports){
-(function (process){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var utils = require('../utils');
-
-/**
- * Constants
- */
-
-var SUITE_PREFIX = '$';
-
-/**
- * Expose `Markdown`.
- */
-
-exports = module.exports = Markdown;
-
-/**
- * Initialize a new `Markdown` reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function Markdown(runner) {
- Base.call(this, runner);
-
- var level = 0;
- var buf = '';
-
- function title(str) {
- return Array(level).join('#') + ' ' + str;
- }
-
- function mapTOC(suite, obj) {
- var ret = obj;
- var key = SUITE_PREFIX + suite.title;
-
- obj = obj[key] = obj[key] || { suite: suite };
- suite.suites.forEach(function(suite) {
- mapTOC(suite, obj);
- });
-
- return ret;
- }
-
- function stringifyTOC(obj, level) {
- ++level;
- var buf = '';
- var link;
- for (var key in obj) {
- if (key === 'suite') {
- continue;
- }
- if (key !== SUITE_PREFIX) {
- link = ' - [' + key.substring(1) + ']';
- link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
- buf += Array(level).join(' ') + link;
- }
- buf += stringifyTOC(obj[key], level);
- }
- return buf;
- }
-
- function generateTOC(suite) {
- var obj = mapTOC(suite, {});
- return stringifyTOC(obj, 0);
- }
-
- generateTOC(runner.suite);
-
- runner.on('suite', function(suite) {
- ++level;
- var slug = utils.slug(suite.fullTitle());
- buf += '<a name="' + slug + '"></a>' + '\n';
- buf += title(suite.title) + '\n';
- });
-
- runner.on('suite end', function() {
- --level;
- });
-
- runner.on('pass', function(test) {
- var code = utils.clean(test.body);
- buf += test.title + '.\n';
- buf += '\n```js\n';
- buf += code + '\n';
- buf += '```\n\n';
- });
-
- runner.on('end', function() {
- process.stdout.write('# TOC\n');
- process.stdout.write(generateTOC(runner.suite));
- process.stdout.write(buf);
- });
-}
-
-}).call(this,require('_process'))
-},{"../utils":38,"./base":17,"_process":67}],27:[function(require,module,exports){
-(function (process){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-
-/**
- * Expose `Min`.
- */
-
-exports = module.exports = Min;
-
-/**
- * Initialize a new `Min` minimal test reporter (best used with --watch).
- *
- * @api public
- * @param {Runner} runner
- */
-function Min(runner) {
- Base.call(this, runner);
-
- runner.on('start', function() {
- // clear screen
- process.stdout.write('\u001b[2J');
- // set cursor position
- process.stdout.write('\u001b[1;3H');
- });
-
- runner.on('end', this.epilogue.bind(this));
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(Min, Base);
-
-}).call(this,require('_process'))
-},{"../utils":38,"./base":17,"_process":67}],28:[function(require,module,exports){
-(function (process){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-
-/**
- * Expose `Dot`.
- */
-
-exports = module.exports = NyanCat;
-
-/**
- * Initialize a new `Dot` matrix test reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function NyanCat(runner) {
- Base.call(this, runner);
-
- var self = this;
- var width = Base.window.width * .75 | 0;
- var nyanCatWidth = this.nyanCatWidth = 11;
-
- this.colorIndex = 0;
- this.numberOfLines = 4;
- this.rainbowColors = self.generateColors();
- this.scoreboardWidth = 5;
- this.tick = 0;
- this.trajectories = [[], [], [], []];
- this.trajectoryWidthMax = (width - nyanCatWidth);
-
- runner.on('start', function() {
- Base.cursor.hide();
- self.draw();
- });
-
- runner.on('pending', function() {
- self.draw();
- });
-
- runner.on('pass', function() {
- self.draw();
- });
-
- runner.on('fail', function() {
- self.draw();
- });
-
- runner.on('end', function() {
- Base.cursor.show();
- for (var i = 0; i < self.numberOfLines; i++) {
- write('\n');
- }
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(NyanCat, Base);
-
-/**
- * Draw the nyan cat
- *
- * @api private
- */
-
-NyanCat.prototype.draw = function() {
- this.appendRainbow();
- this.drawScoreboard();
- this.drawRainbow();
- this.drawNyanCat();
- this.tick = !this.tick;
-};
-
-/**
- * Draw the "scoreboard" showing the number
- * of passes, failures and pending tests.
- *
- * @api private
- */
-
-NyanCat.prototype.drawScoreboard = function() {
- var stats = this.stats;
-
- function draw(type, n) {
- write(' ');
- write(Base.color(type, n));
- write('\n');
- }
-
- draw('green', stats.passes);
- draw('fail', stats.failures);
- draw('pending', stats.pending);
- write('\n');
-
- this.cursorUp(this.numberOfLines);
-};
-
-/**
- * Append the rainbow.
- *
- * @api private
- */
-
-NyanCat.prototype.appendRainbow = function() {
- var segment = this.tick ? '_' : '-';
- var rainbowified = this.rainbowify(segment);
-
- for (var index = 0; index < this.numberOfLines; index++) {
- var trajectory = this.trajectories[index];
- if (trajectory.length >= this.trajectoryWidthMax) {
- trajectory.shift();
- }
- trajectory.push(rainbowified);
- }
-};
-
-/**
- * Draw the rainbow.
- *
- * @api private
- */
-
-NyanCat.prototype.drawRainbow = function() {
- var self = this;
-
- this.trajectories.forEach(function(line) {
- write('\u001b[' + self.scoreboardWidth + 'C');
- write(line.join(''));
- write('\n');
- });
-
- this.cursorUp(this.numberOfLines);
-};
-
-/**
- * Draw the nyan cat
- *
- * @api private
- */
-NyanCat.prototype.drawNyanCat = function() {
- var self = this;
- var startWidth = this.scoreboardWidth + this.trajectories[0].length;
- var dist = '\u001b[' + startWidth + 'C';
- var padding = '';
-
- write(dist);
- write('_,------,');
- write('\n');
-
- write(dist);
- padding = self.tick ? ' ' : ' ';
- write('_|' + padding + '/\\_/\\ ');
- write('\n');
-
- write(dist);
- padding = self.tick ? '_' : '__';
- var tail = self.tick ? '~' : '^';
- write(tail + '|' + padding + this.face() + ' ');
- write('\n');
-
- write(dist);
- padding = self.tick ? ' ' : ' ';
- write(padding + '"" "" ');
- write('\n');
-
- this.cursorUp(this.numberOfLines);
-};
-
-/**
- * Draw nyan cat face.
- *
- * @api private
- * @return {string}
- */
-
-NyanCat.prototype.face = function() {
- var stats = this.stats;
- if (stats.failures) {
- return '( x .x)';
- } else if (stats.pending) {
- return '( o .o)';
- } else if (stats.passes) {
- return '( ^ .^)';
- }
- return '( - .-)';
-};
-
-/**
- * Move cursor up `n`.
- *
- * @api private
- * @param {number} n
- */
-
-NyanCat.prototype.cursorUp = function(n) {
- write('\u001b[' + n + 'A');
-};
-
-/**
- * Move cursor down `n`.
- *
- * @api private
- * @param {number} n
- */
-
-NyanCat.prototype.cursorDown = function(n) {
- write('\u001b[' + n + 'B');
-};
-
-/**
- * Generate rainbow colors.
- *
- * @api private
- * @return {Array}
- */
-NyanCat.prototype.generateColors = function() {
- var colors = [];
-
- for (var i = 0; i < (6 * 7); i++) {
- var pi3 = Math.floor(Math.PI / 3);
- var n = (i * (1.0 / 6));
- var r = Math.floor(3 * Math.sin(n) + 3);
- var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
- var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
- colors.push(36 * r + 6 * g + b + 16);
- }
-
- return colors;
-};
-
-/**
- * Apply rainbow to the given `str`.
- *
- * @api private
- * @param {string} str
- * @return {string}
- */
-NyanCat.prototype.rainbowify = function(str) {
- if (!Base.useColors) {
- return str;
- }
- var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
- this.colorIndex += 1;
- return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
-};
-
-/**
- * Stdout helper.
- *
- * @param {string} string A message to write to stdout.
- */
-function write(string) {
- process.stdout.write(string);
-}
-
-}).call(this,require('_process'))
-},{"../utils":38,"./base":17,"_process":67}],29:[function(require,module,exports){
-(function (process){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-var color = Base.color;
-var cursor = Base.cursor;
-
-/**
- * Expose `Progress`.
- */
-
-exports = module.exports = Progress;
-
-/**
- * General progress bar color.
- */
-
-Base.colors.progress = 90;
-
-/**
- * Initialize a new `Progress` bar test reporter.
- *
- * @api public
- * @param {Runner} runner
- * @param {Object} options
- */
-function Progress(runner, options) {
- Base.call(this, runner);
-
- var self = this;
- var width = Base.window.width * .50 | 0;
- var total = runner.total;
- var complete = 0;
- var lastN = -1;
-
- // default chars
- options = options || {};
- options.open = options.open || '[';
- options.complete = options.complete || 'â–¬';
- options.incomplete = options.incomplete || Base.symbols.dot;
- options.close = options.close || ']';
- options.verbose = false;
-
- // tests started
- runner.on('start', function() {
- console.log();
- cursor.hide();
- });
-
- // tests complete
- runner.on('test end', function() {
- complete++;
-
- var percent = complete / total;
- var n = width * percent | 0;
- var i = width - n;
-
- if (n === lastN && !options.verbose) {
- // Don't re-render the line if it hasn't changed
- return;
- }
- lastN = n;
-
- cursor.CR();
- process.stdout.write('\u001b[J');
- process.stdout.write(color('progress', ' ' + options.open));
- process.stdout.write(Array(n).join(options.complete));
- process.stdout.write(Array(i).join(options.incomplete));
- process.stdout.write(color('progress', options.close));
- if (options.verbose) {
- process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
- }
- });
-
- // tests are complete, output some stats
- // and the failures if any
- runner.on('end', function() {
- cursor.show();
- console.log();
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(Progress, Base);
-
-}).call(this,require('_process'))
-},{"../utils":38,"./base":17,"_process":67}],30:[function(require,module,exports){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var inherits = require('../utils').inherits;
-var color = Base.color;
-
-/**
- * Expose `Spec`.
- */
-
-exports = module.exports = Spec;
-
-/**
- * Initialize a new `Spec` test reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function Spec(runner) {
- Base.call(this, runner);
-
- var self = this;
- var indents = 0;
- var n = 0;
-
- function indent() {
- return Array(indents).join(' ');
- }
-
- runner.on('start', function() {
- console.log();
- });
-
- runner.on('suite', function(suite) {
- ++indents;
- console.log(color('suite', '%s%s'), indent(), suite.title);
- });
-
- runner.on('suite end', function() {
- --indents;
- if (indents === 1) {
- console.log();
- }
- });
-
- runner.on('pending', function(test) {
- var fmt = indent() + color('pending', ' - %s');
- console.log(fmt, test.title);
- });
-
- runner.on('pass', function(test) {
- var fmt;
- if (test.speed === 'fast') {
- fmt = indent()
- + color('checkmark', ' ' + Base.symbols.ok)
- + color('pass', ' %s');
- console.log(fmt, test.title);
- } else {
- fmt = indent()
- + color('checkmark', ' ' + Base.symbols.ok)
- + color('pass', ' %s')
- + color(test.speed, ' (%dms)');
- console.log(fmt, test.title, test.duration);
- }
- });
-
- runner.on('fail', function(test) {
- console.log(indent() + color('fail', ' %d) %s'), ++n, test.title);
- });
-
- runner.on('end', self.epilogue.bind(self));
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(Spec, Base);
-
-},{"../utils":38,"./base":17}],31:[function(require,module,exports){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-
-/**
- * Expose `TAP`.
- */
-
-exports = module.exports = TAP;
-
-/**
- * Initialize a new `TAP` reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function TAP(runner) {
- Base.call(this, runner);
-
- var n = 1;
- var passes = 0;
- var failures = 0;
-
- runner.on('start', function() {
- var total = runner.grepTotal(runner.suite);
- console.log('%d..%d', 1, total);
- });
-
- runner.on('test end', function() {
- ++n;
- });
-
- runner.on('pending', function(test) {
- console.log('ok %d %s # SKIP -', n, title(test));
- });
-
- runner.on('pass', function(test) {
- passes++;
- console.log('ok %d %s', n, title(test));
- });
-
- runner.on('fail', function(test, err) {
- failures++;
- console.log('not ok %d %s', n, title(test));
- if (err.stack) {
- console.log(err.stack.replace(/^/gm, ' '));
- }
- });
-
- runner.on('end', function() {
- console.log('# tests ' + (passes + failures));
- console.log('# pass ' + passes);
- console.log('# fail ' + failures);
- });
-}
-
-/**
- * Return a TAP-safe title of `test`
- *
- * @api private
- * @param {Object} test
- * @return {String}
- */
-function title(test) {
- return test.fullTitle().replace(/#/g, '');
-}
-
-},{"./base":17}],32:[function(require,module,exports){
-(function (process,global){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-var utils = require('../utils');
-var inherits = utils.inherits;
-var fs = require('fs');
-var escape = utils.escape;
-var mkdirp = require('mkdirp');
-var path = require('path');
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-/* eslint-disable no-unused-vars, no-native-reassign */
-var Date = global.Date;
-var setTimeout = global.setTimeout;
-var setInterval = global.setInterval;
-var clearTimeout = global.clearTimeout;
-var clearInterval = global.clearInterval;
-/* eslint-enable no-unused-vars, no-native-reassign */
-
-/**
- * Expose `XUnit`.
- */
-
-exports = module.exports = XUnit;
-
-/**
- * Initialize a new `XUnit` reporter.
- *
- * @api public
- * @param {Runner} runner
- */
-function XUnit(runner, options) {
- Base.call(this, runner);
-
- var stats = this.stats;
- var tests = [];
- var self = this;
-
- if (options.reporterOptions && options.reporterOptions.output) {
- if (!fs.createWriteStream) {
- throw new Error('file output not supported in browser');
- }
- mkdirp.sync(path.dirname(options.reporterOptions.output));
- self.fileStream = fs.createWriteStream(options.reporterOptions.output);
- }
-
- runner.on('pending', function(test) {
- tests.push(test);
- });
-
- runner.on('pass', function(test) {
- tests.push(test);
- });
-
- runner.on('fail', function(test) {
- tests.push(test);
- });
-
- runner.on('end', function() {
- self.write(tag('testsuite', {
- name: 'Mocha Tests',
- tests: stats.tests,
- failures: stats.failures,
- errors: stats.failures,
- skipped: stats.tests - stats.failures - stats.passes,
- timestamp: (new Date()).toUTCString(),
- time: (stats.duration / 1000) || 0
- }, false));
-
- tests.forEach(function(t) {
- self.test(t);
- });
-
- self.write('</testsuite>');
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-inherits(XUnit, Base);
-
-/**
- * Override done to close the stream (if it's a file).
- *
- * @param failures
- * @param {Function} fn
- */
-XUnit.prototype.done = function(failures, fn) {
- if (this.fileStream) {
- this.fileStream.end(function() {
- fn(failures);
- });
- } else {
- fn(failures);
- }
-};
-
-/**
- * Write out the given line.
- *
- * @param {string} line
- */
-XUnit.prototype.write = function(line) {
- if (this.fileStream) {
- this.fileStream.write(line + '\n');
- } else if (typeof process === 'object' && process.stdout) {
- process.stdout.write(line + '\n');
- } else {
- console.log(line);
- }
-};
-
-/**
- * Output tag for the given `test.`
- *
- * @param {Test} test
- */
-XUnit.prototype.test = function(test) {
- var attrs = {
- classname: test.parent.fullTitle(),
- name: test.title,
- time: (test.duration / 1000) || 0
- };
-
- if (test.state === 'failed') {
- var err = test.err;
- this.write(tag('testcase', attrs, false, tag('failure', {}, false, escape(err.message) + '\n' + escape(err.stack))));
- } else if (test.isPending()) {
- this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));
- } else {
- this.write(tag('testcase', attrs, true));
- }
-};
-
-/**
- * HTML tag helper.
- *
- * @param name
- * @param attrs
- * @param close
- * @param content
- * @return {string}
- */
-function tag(name, attrs, close, content) {
- var end = close ? '/>' : '>';
- var pairs = [];
- var tag;
-
- for (var key in attrs) {
- if (Object.prototype.hasOwnProperty.call(attrs, key)) {
- pairs.push(key + '="' + escape(attrs[key]) + '"');
- }
- }
-
- tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
- if (content) {
- tag += content + '</' + name + end;
- }
- return tag;
-}
-
-}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"../utils":38,"./base":17,"_process":67,"fs":42,"mkdirp":64,"path":42}],33:[function(require,module,exports){
-(function (global){
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('events').EventEmitter;
-var JSON = require('json3');
-var Pending = require('./pending');
-var debug = require('debug')('mocha:runnable');
-var milliseconds = require('./ms');
-var utils = require('./utils');
-var create = require('lodash.create');
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-/* eslint-disable no-unused-vars, no-native-reassign */
-var Date = global.Date;
-var setTimeout = global.setTimeout;
-var setInterval = global.setInterval;
-var clearTimeout = global.clearTimeout;
-var clearInterval = global.clearInterval;
-/* eslint-enable no-unused-vars, no-native-reassign */
-
-/**
- * Object#toString().
- */
-
-var toString = Object.prototype.toString;
-
-/**
- * Expose `Runnable`.
- */
-
-module.exports = Runnable;
-
-/**
- * Initialize a new `Runnable` with the given `title` and callback `fn`.
- *
- * @param {String} title
- * @param {Function} fn
- * @api private
- * @param {string} title
- * @param {Function} fn
- */
-function Runnable(title, fn) {
- this.title = title;
- this.fn = fn;
- this.body = (fn || '').toString();
- this.async = fn && fn.length;
- this.sync = !this.async;
- this._timeout = 2000;
- this._slow = 75;
- this._enableTimeouts = true;
- this.timedOut = false;
- this._trace = new Error('done() called multiple times');
- this._retries = -1;
- this._currentRetry = 0;
- this.pending = false;
-}
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-Runnable.prototype = create(EventEmitter.prototype, {
- constructor: Runnable
-});
-
-/**
- * Set & get timeout `ms`.
- *
- * @api private
- * @param {number|string} ms
- * @return {Runnable|number} ms or Runnable instance.
- */
-Runnable.prototype.timeout = function(ms) {
- if (!arguments.length) {
- return this._timeout;
- }
- // see #1652 for reasoning
- if (ms === 0 || ms > Math.pow(2, 31)) {
- this._enableTimeouts = false;
- }
- if (typeof ms === 'string') {
- ms = milliseconds(ms);
- }
- debug('timeout %d', ms);
- this._timeout = ms;
- if (this.timer) {
- this.resetTimeout();
- }
- return this;
-};
-
-/**
- * Set & get slow `ms`.
- *
- * @api private
- * @param {number|string} ms
- * @return {Runnable|number} ms or Runnable instance.
- */
-Runnable.prototype.slow = function(ms) {
- if (typeof ms === 'undefined') {
- return this._slow;
- }
- if (typeof ms === 'string') {
- ms = milliseconds(ms);
- }
- debug('timeout %d', ms);
- this._slow = ms;
- return this;
-};
-
-/**
- * Set and get whether timeout is `enabled`.
- *
- * @api private
- * @param {boolean} enabled
- * @return {Runnable|boolean} enabled or Runnable instance.
- */
-Runnable.prototype.enableTimeouts = function(enabled) {
- if (!arguments.length) {
- return this._enableTimeouts;
- }
- debug('enableTimeouts %s', enabled);
- this._enableTimeouts = enabled;
- return this;
-};
-
-/**
- * Halt and mark as pending.
- *
- * @api public
- */
-Runnable.prototype.skip = function() {
- throw new Pending('sync skip');
-};
-
-/**
- * Check if this runnable or its parent suite is marked as pending.
- *
- * @api private
- */
-Runnable.prototype.isPending = function() {
- return this.pending || (this.parent && this.parent.isPending());
-};
-
-/**
- * Set number of retries.
- *
- * @api private
- */
-Runnable.prototype.retries = function(n) {
- if (!arguments.length) {
- return this._retries;
- }
- this._retries = n;
-};
-
-/**
- * Get current retry
- *
- * @api private
- */
-Runnable.prototype.currentRetry = function(n) {
- if (!arguments.length) {
- return this._currentRetry;
- }
- this._currentRetry = n;
-};
-
-/**
- * Return the full title generated by recursively concatenating the parent's
- * full title.
- *
- * @api public
- * @return {string}
- */
-Runnable.prototype.fullTitle = function() {
- return this.parent.fullTitle() + ' ' + this.title;
-};
-
-/**
- * Clear the timeout.
- *
- * @api private
- */
-Runnable.prototype.clearTimeout = function() {
- clearTimeout(this.timer);
-};
-
-/**
- * Inspect the runnable void of private properties.
- *
- * @api private
- * @return {string}
- */
-Runnable.prototype.inspect = function() {
- return JSON.stringify(this, function(key, val) {
- if (key[0] === '_') {
- return;
- }
- if (key === 'parent') {
- return '#<Suite>';
- }
- if (key === 'ctx') {
- return '#<Context>';
- }
- return val;
- }, 2);
-};
-
-/**
- * Reset the timeout.
- *
- * @api private
- */
-Runnable.prototype.resetTimeout = function() {
- var self = this;
- var ms = this.timeout() || 1e9;
-
- if (!this._enableTimeouts) {
- return;
- }
- this.clearTimeout();
- this.timer = setTimeout(function() {
- if (!self._enableTimeouts) {
- return;
- }
- self.callback(new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.'));
- self.timedOut = true;
- }, ms);
-};
-
-/**
- * Whitelist a list of globals for this test run.
- *
- * @api private
- * @param {string[]} globals
- */
-Runnable.prototype.globals = function(globals) {
- if (!arguments.length) {
- return this._allowedGlobals;
- }
- this._allowedGlobals = globals;
-};
-
-/**
- * Run the test and invoke `fn(err)`.
- *
- * @param {Function} fn
- * @api private
- */
-Runnable.prototype.run = function(fn) {
- var self = this;
- var start = new Date();
- var ctx = this.ctx;
- var finished;
- var emitted;
-
- // Sometimes the ctx exists, but it is not runnable
- if (ctx && ctx.runnable) {
- ctx.runnable(this);
- }
-
- // called multiple times
- function multiple(err) {
- if (emitted) {
- return;
- }
- emitted = true;
- self.emit('error', err || new Error('done() called multiple times; stacktrace may be inaccurate'));
- }
-
- // finished
- function done(err) {
- var ms = self.timeout();
- if (self.timedOut) {
- return;
- }
- if (finished) {
- return multiple(err || self._trace);
- }
-
- self.clearTimeout();
- self.duration = new Date() - start;
- finished = true;
- 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);
- }
-
- // for .resetTimeout()
- this.callback = done;
-
- // explicit async with `done` argument
- if (this.async) {
- this.resetTimeout();
-
- // allows skip() to be used in an explicit async context
- this.skip = function asyncSkip() {
- done(new Pending('async skip call'));
- // halt execution. the Runnable will be marked pending
- // by the previous call, and the uncaught handler will ignore
- // the failure.
- throw new Pending('async skip; aborting execution');
- };
-
- if (this.allowUncaught) {
- return callFnAsync(this.fn);
- }
- try {
- callFnAsync(this.fn);
- } catch (err) {
- done(utils.getError(err));
- }
- return;
- }
-
- if (this.allowUncaught) {
- callFn(this.fn);
- done();
- return;
- }
-
- // sync or promise-returning
- try {
- if (this.isPending()) {
- done();
- } else {
- callFn(this.fn);
- }
- } catch (err) {
- done(utils.getError(err));
- }
-
- function callFn(fn) {
- var result = fn.call(ctx);
- if (result && typeof result.then === 'function') {
- self.resetTimeout();
- result
- .then(function() {
- done();
- // Return null so libraries like bluebird do not warn about
- // subsequently constructed Promises.
- return null;
- },
- function(reason) {
- done(reason || new Error('Promise rejected with no or falsy reason'));
- });
- } else {
- if (self.asyncOnly) {
- return done(new Error('--async-only option in use without declaring `done()` or returning a promise'));
- }
-
- done();
- }
- }
-
- function callFnAsync(fn) {
- var result = fn.call(ctx, function(err) {
- if (err instanceof Error || toString.call(err) === '[object Error]') {
- return done(err);
- }
- if (err) {
- if (Object.prototype.toString.call(err) === '[object Object]') {
- return done(new Error('done() invoked with non-Error: '
- + JSON.stringify(err)));
- }
- return done(new Error('done() invoked with non-Error: ' + err));
- }
- if (result && utils.isPromise(result)) {
- return done(new Error('Resolution method is overspecified. Specify a callback *or* return a Promise; not both.'));
- }
-
- done();
- });
- }
-};
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./ms":15,"./pending":16,"./utils":38,"debug":2,"events":3,"json3":54,"lodash.create":60}],34:[function(require,module,exports){
-(function (process,global){
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('events').EventEmitter;
-var Pending = require('./pending');
-var utils = require('./utils');
-var inherits = utils.inherits;
-var debug = require('debug')('mocha:runner');
-var Runnable = require('./runnable');
-var filter = utils.filter;
-var indexOf = utils.indexOf;
-var some = utils.some;
-var keys = utils.keys;
-var stackFilter = utils.stackTraceFilter();
-var stringify = utils.stringify;
-var type = utils.type;
-var undefinedError = utils.undefinedError;
-var isArray = utils.isArray;
-
-/**
- * Non-enumerable globals.
- */
-
-var globals = [
- 'setTimeout',
- 'clearTimeout',
- 'setInterval',
- 'clearInterval',
- 'XMLHttpRequest',
- 'Date',
- 'setImmediate',
- 'clearImmediate'
-];
-
-/**
- * Expose `Runner`.
- */
-
-module.exports = Runner;
-
-/**
- * Initialize a `Runner` for the given `suite`.
- *
- * Events:
- *
- * - `start` execution started
- * - `end` execution complete
- * - `suite` (suite) test suite execution started
- * - `suite end` (suite) all tests (and sub-suites) have finished
- * - `test` (test) test execution started
- * - `test end` (test) test completed
- * - `hook` (hook) hook execution started
- * - `hook end` (hook) hook complete
- * - `pass` (test) test passed
- * - `fail` (test, err) test failed
- * - `pending` (test) test pending
- *
- * @api public
- * @param {Suite} suite Root suite
- * @param {boolean} [delay] Whether or not to delay execution of root suite
- * until ready.
- */
-function Runner(suite, delay) {
- var self = this;
- this._globals = [];
- this._abort = false;
- this._delay = delay;
- this.suite = suite;
- this.started = false;
- this.total = suite.total();
- this.failures = 0;
- this.on('test end', function(test) {
- self.checkGlobals(test);
- });
- this.on('hook end', function(hook) {
- self.checkGlobals(hook);
- });
- this._defaultGrep = /.*/;
- this.grep(this._defaultGrep);
- this.globals(this.globalProps().concat(extraGlobals()));
-}
-
-/**
- * Wrapper for setImmediate, process.nextTick, or browser polyfill.
- *
- * @param {Function} fn
- * @api private
- */
-Runner.immediately = global.setImmediate || process.nextTick;
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-inherits(Runner, EventEmitter);
-
-/**
- * Run tests with full titles matching `re`. Updates runner.total
- * with number of tests matched.
- *
- * @param {RegExp} re
- * @param {Boolean} invert
- * @return {Runner} for chaining
- * @api public
- * @param {RegExp} re
- * @param {boolean} invert
- * @return {Runner} Runner instance.
- */
-Runner.prototype.grep = function(re, invert) {
- debug('grep %s', re);
- this._grep = re;
- this._invert = invert;
- this.total = this.grepTotal(this.suite);
- return this;
-};
-
-/**
- * Returns the number of tests matching the grep search for the
- * given suite.
- *
- * @param {Suite} suite
- * @return {Number}
- * @api public
- * @param {Suite} suite
- * @return {number}
- */
-Runner.prototype.grepTotal = function(suite) {
- var self = this;
- var total = 0;
-
- suite.eachTest(function(test) {
- var match = self._grep.test(test.fullTitle());
- if (self._invert) {
- match = !match;
- }
- if (match) {
- total++;
- }
- });
-
- return total;
-};
-
-/**
- * Return a list of global properties.
- *
- * @return {Array}
- * @api private
- */
-Runner.prototype.globalProps = function() {
- var props = keys(global);
-
- // non-enumerables
- for (var i = 0; i < globals.length; ++i) {
- if (~indexOf(props, globals[i])) {
- continue;
- }
- props.push(globals[i]);
- }
-
- return props;
-};
-
-/**
- * Allow the given `arr` of globals.
- *
- * @param {Array} arr
- * @return {Runner} for chaining
- * @api public
- * @param {Array} arr
- * @return {Runner} Runner instance.
- */
-Runner.prototype.globals = function(arr) {
- if (!arguments.length) {
- return this._globals;
- }
- debug('globals %j', arr);
- this._globals = this._globals.concat(arr);
- return this;
-};
-
-/**
- * Check for global variable leaks.
- *
- * @api private
- */
-Runner.prototype.checkGlobals = function(test) {
- if (this.ignoreLeaks) {
- return;
- }
- var ok = this._globals;
-
- var globals = this.globalProps();
- var leaks;
-
- if (test) {
- ok = ok.concat(test._allowedGlobals || []);
- }
-
- if (this.prevGlobalsLength === globals.length) {
- return;
- }
- this.prevGlobalsLength = globals.length;
-
- leaks = filterLeaks(ok, globals);
- this._globals = this._globals.concat(leaks);
-
- if (leaks.length > 1) {
- this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + ''));
- } else if (leaks.length) {
- this.fail(test, new Error('global leak detected: ' + leaks[0]));
- }
-};
-
-/**
- * Fail the given `test`.
- *
- * @api private
- * @param {Test} test
- * @param {Error} err
- */
-Runner.prototype.fail = function(test, err) {
- if (test.isPending()) {
- return;
- }
-
- ++this.failures;
- test.state = 'failed';
-
- if (!(err instanceof Error || err && typeof err.message === 'string')) {
- 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);
-};
-
-/**
- * Fail the given `hook` with `err`.
- *
- * Hook failures work in the following pattern:
- * - If bail, then exit
- * - Failed `before` hook skips all tests in a suite and subsuites,
- * but jumps to corresponding `after` hook
- * - Failed `before each` hook skips remaining tests in a
- * suite and jumps to corresponding `after each` hook,
- * which is run only once
- * - Failed `after` hook does not alter
- * execution order
- * - Failed `after each` hook skips remaining tests in a
- * suite and subsuites, but executes other `after each`
- * hooks
- *
- * @api private
- * @param {Hook} hook
- * @param {Error} err
- */
-Runner.prototype.failHook = function(hook, err) {
- if (hook.ctx && hook.ctx.currentTest) {
- hook.originalTitle = hook.originalTitle || hook.title;
- hook.title = hook.originalTitle + ' for "' + hook.ctx.currentTest.title + '"';
- }
-
- this.fail(hook, err);
- if (this.suite.bail()) {
- this.emit('end');
- }
-};
-
-/**
- * Run hook `name` callbacks and then invoke `fn()`.
- *
- * @api private
- * @param {string} name
- * @param {Function} fn
- */
-
-Runner.prototype.hook = function(name, fn) {
- var suite = this.suite;
- var hooks = suite['_' + name];
- var self = this;
-
- function next(i) {
- var hook = hooks[i];
- if (!hook) {
- return fn();
- }
- self.currentRunnable = hook;
-
- hook.ctx.currentTest = self.test;
-
- self.emit('hook', hook);
-
- if (!hook.listeners('error').length) {
- hook.on('error', function(err) {
- self.failHook(hook, err);
- });
- }
-
- hook.run(function(err) {
- var testError = hook.error();
- if (testError) {
- self.fail(self.test, testError);
- }
- if (err) {
- if (err instanceof Pending) {
- if (name === 'beforeEach' || name === 'afterEach') {
- self.test.pending = true;
- } else {
- utils.forEach(suite.tests, function(test) {
- test.pending = true;
- });
- // a pending hook won't be executed twice.
- hook.pending = true;
- }
- } else {
- self.failHook(hook, err);
-
- // stop executing hooks, notify callee of hook err
- return fn(err);
- }
- }
- self.emit('hook end', hook);
- delete hook.ctx.currentTest;
- next(++i);
- });
- }
-
- Runner.immediately(function() {
- next(0);
- });
-};
-
-/**
- * Run hook `name` for the given array of `suites`
- * in order, and callback `fn(err, errSuite)`.
- *
- * @api private
- * @param {string} name
- * @param {Array} suites
- * @param {Function} fn
- */
-Runner.prototype.hooks = function(name, suites, fn) {
- var self = this;
- var orig = this.suite;
-
- function next(suite) {
- self.suite = suite;
-
- if (!suite) {
- self.suite = orig;
- return fn();
- }
-
- self.hook(name, function(err) {
- if (err) {
- var errSuite = self.suite;
- self.suite = orig;
- return fn(err, errSuite);
- }
-
- next(suites.pop());
- });
- }
-
- next(suites.pop());
-};
-
-/**
- * Run hooks from the top level down.
- *
- * @param {String} name
- * @param {Function} fn
- * @api private
- */
-Runner.prototype.hookUp = function(name, fn) {
- var suites = [this.suite].concat(this.parents()).reverse();
- this.hooks(name, suites, fn);
-};
-
-/**
- * Run hooks from the bottom up.
- *
- * @param {String} name
- * @param {Function} fn
- * @api private
- */
-Runner.prototype.hookDown = function(name, fn) {
- var suites = [this.suite].concat(this.parents());
- this.hooks(name, suites, fn);
-};
-
-/**
- * Return an array of parent Suites from
- * closest to furthest.
- *
- * @return {Array}
- * @api private
- */
-Runner.prototype.parents = function() {
- var suite = this.suite;
- var suites = [];
- while (suite.parent) {
- suite = suite.parent;
- suites.push(suite);
- }
- return suites;
-};
-
-/**
- * Run the current test and callback `fn(err)`.
- *
- * @param {Function} fn
- * @api private
- */
-Runner.prototype.runTest = function(fn) {
- var self = this;
- var test = this.test;
-
- if (!test) {
- return;
- }
- if (this.asyncOnly) {
- test.asyncOnly = true;
- }
-
- if (this.allowUncaught) {
- test.allowUncaught = true;
- return test.run(fn);
- }
- try {
- test.on('error', function(err) {
- self.fail(test, err);
- });
- test.run(fn);
- } catch (err) {
- fn(err);
- }
-};
-
-/**
- * Run tests in the given `suite` and invoke the callback `fn()` when complete.
- *
- * @api private
- * @param {Suite} suite
- * @param {Function} fn
- */
-Runner.prototype.runTests = function(suite, fn) {
- var self = this;
- var tests = suite.tests.slice();
- var test;
-
- function hookErr(_, errSuite, after) {
- // before/after Each hook for errSuite failed:
- var orig = self.suite;
-
- // for failed 'after each' hook start from errSuite parent,
- // otherwise start from errSuite itself
- self.suite = after ? errSuite.parent : errSuite;
-
- if (self.suite) {
- // call hookUp afterEach
- self.hookUp('afterEach', function(err2, errSuite2) {
- self.suite = orig;
- // some hooks may fail even now
- if (err2) {
- return hookErr(err2, errSuite2, true);
- }
- // report error suite
- fn(errSuite);
- });
- } else {
- // there is no need calling other 'after each' hooks
- self.suite = orig;
- fn(errSuite);
- }
- }
-
- function next(err, errSuite) {
- // if we bail after first err
- if (self.failures && suite._bail) {
- return fn();
- }
-
- if (self._abort) {
- return fn();
- }
-
- if (err) {
- return hookErr(err, errSuite, true);
- }
-
- // next test
- test = tests.shift();
-
- // all done
- if (!test) {
- return fn();
- }
-
- // grep
- var match = self._grep.test(test.fullTitle());
- if (self._invert) {
- match = !match;
- }
- if (!match) {
- // Run immediately only if we have defined a grep. When we
- // define a grep — It can cause maximum callstack error if
- // the grep is doing a large recursive loop by neglecting
- // all tests. The run immediately function also comes with
- // a performance cost. So we don't want to run immediately
- // if we run the whole test suite, because running the whole
- // test suite don't do any immediate recursive loops. Thus,
- // allowing a JS runtime to breathe.
- if (self._grep !== self._defaultGrep) {
- Runner.immediately(next);
- } else {
- next();
- }
- return;
- }
-
- if (test.isPending()) {
- self.emit('pending', test);
- self.emit('test end', test);
- return next();
- }
-
- // execute test and hook(s)
- self.emit('test', self.test = test);
- self.hookDown('beforeEach', function(err, errSuite) {
- if (test.isPending()) {
- self.emit('pending', test);
- self.emit('test end', test);
- return next();
- }
- if (err) {
- return hookErr(err, errSuite, false);
- }
- self.currentRunnable = self.test;
- self.runTest(function(err) {
- test = self.test;
- if (err) {
- var retry = test.currentRetry();
- if (err instanceof Pending) {
- test.pending = true;
- self.emit('pending', test);
- } else if (retry < test.retries()) {
- var clonedTest = test.clone();
- clonedTest.currentRetry(retry + 1);
- tests.unshift(clonedTest);
-
- // Early return + hook trigger so that it doesn't
- // increment the count wrong
- return self.hookUp('afterEach', next);
- } else {
- self.fail(test, err);
- }
- self.emit('test end', test);
-
- if (err instanceof Pending) {
- return next();
- }
-
- return self.hookUp('afterEach', next);
- }
-
- test.state = 'passed';
- self.emit('pass', test);
- self.emit('test end', test);
- self.hookUp('afterEach', next);
- });
- });
- }
-
- this.next = next;
- this.hookErr = hookErr;
- next();
-};
-
-/**
- * Run the given `suite` and invoke the callback `fn()` when complete.
- *
- * @api private
- * @param {Suite} suite
- * @param {Function} fn
- */
-Runner.prototype.runSuite = function(suite, fn) {
- var i = 0;
- var self = this;
- var total = this.grepTotal(suite);
- var afterAllHookCalled = false;
-
- debug('run suite %s', suite.fullTitle());
-
- if (!total || (self.failures && suite._bail)) {
- return fn();
- }
-
- this.emit('suite', this.suite = suite);
-
- function next(errSuite) {
- if (errSuite) {
- // current suite failed on a hook from errSuite
- if (errSuite === suite) {
- // if errSuite is current suite
- // continue to the next sibling suite
- return done();
- }
- // errSuite is among the parents of current suite
- // stop execution of errSuite and all sub-suites
- return done(errSuite);
- }
-
- if (self._abort) {
- return done();
- }
-
- var curr = suite.suites[i++];
- if (!curr) {
- return done();
- }
-
- // Avoid grep neglecting large number of tests causing a
- // huge recursive loop and thus a maximum call stack error.
- // See comment in `this.runTests()` for more information.
- if (self._grep !== self._defaultGrep) {
- Runner.immediately(function() {
- self.runSuite(curr, next);
- });
- } else {
- self.runSuite(curr, next);
- }
- }
-
- function done(errSuite) {
- self.suite = suite;
- self.nextSuite = next;
-
- if (afterAllHookCalled) {
- fn(errSuite);
- } else {
- // mark that the afterAll block has been called once
- // and so can be skipped if there is an error in it.
- afterAllHookCalled = true;
-
- // remove reference to test
- delete self.test;
-
- self.hook('afterAll', function() {
- self.emit('suite end', suite);
- fn(errSuite);
- });
- }
- }
-
- this.nextSuite = next;
-
- this.hook('beforeAll', function(err) {
- if (err) {
- return done();
- }
- self.runTests(suite, next);
- });
-};
-
-/**
- * Handle uncaught exceptions.
- *
- * @param {Error} err
- * @api private
- */
-Runner.prototype.uncaught = function(err) {
- if (err) {
- debug('uncaught exception %s', err !== function() {
- return this;
- }.call(err) ? err : (err.message || err));
- } else {
- debug('uncaught undefined exception');
- err = undefinedError();
- }
- err.uncaught = true;
-
- var runnable = this.currentRunnable;
-
- if (!runnable) {
- runnable = new Runnable('Uncaught error outside test suite');
- runnable.parent = this.suite;
-
- if (this.started) {
- this.fail(runnable, err);
- } else {
- // Can't recover from this failure
- this.emit('start');
- this.fail(runnable, err);
- this.emit('end');
- }
-
- return;
- }
-
- runnable.clearTimeout();
-
- // Ignore errors if complete or pending
- if (runnable.state || runnable.isPending()) {
- return;
- }
- this.fail(runnable, err);
-
- // recover from test
- if (runnable.type === 'test') {
- this.emit('test end', runnable);
- this.hookUp('afterEach', this.next);
- return;
- }
-
- // recover from hooks
- if (runnable.type === 'hook') {
- var errSuite = this.suite;
- // if hook failure is in afterEach block
- if (runnable.fullTitle().indexOf('after each') > -1) {
- return this.hookErr(err, errSuite, true);
- }
- // if hook failure is in beforeEach block
- if (runnable.fullTitle().indexOf('before each') > -1) {
- return this.hookErr(err, errSuite, false);
- }
- // if hook failure is in after or before blocks
- return this.nextSuite(errSuite);
- }
-
- // bail
- this.emit('end');
-};
-
-/**
- * Cleans up the references to all the deferred functions
- * (before/after/beforeEach/afterEach) and tests of a Suite.
- * These must be deleted otherwise a memory leak can happen,
- * as those functions may reference variables from closures,
- * thus those variables can never be garbage collected as long
- * as the deferred functions exist.
- *
- * @param {Suite} suite
- */
-function cleanSuiteReferences(suite) {
- function cleanArrReferences(arr) {
- for (var i = 0; i < arr.length; i++) {
- delete arr[i].fn;
- }
- }
-
- if (isArray(suite._beforeAll)) {
- cleanArrReferences(suite._beforeAll);
- }
-
- if (isArray(suite._beforeEach)) {
- cleanArrReferences(suite._beforeEach);
- }
-
- if (isArray(suite._afterAll)) {
- cleanArrReferences(suite._afterAll);
- }
-
- if (isArray(suite._afterEach)) {
- cleanArrReferences(suite._afterEach);
- }
-
- for (var i = 0; i < suite.tests.length; i++) {
- delete suite.tests[i].fn;
- }
-}
-
-/**
- * Run the root suite and invoke `fn(failures)`
- * on completion.
- *
- * @param {Function} fn
- * @return {Runner} for chaining
- * @api public
- * @param {Function} fn
- * @return {Runner} Runner instance.
- */
-Runner.prototype.run = function(fn) {
- var self = this;
- var rootSuite = this.suite;
-
- // If there is an `only` filter
- if (this.hasOnly) {
- filterOnly(rootSuite);
- }
-
- fn = fn || function() {};
-
- function uncaught(err) {
- self.uncaught(err);
- }
-
- function start() {
- self.started = true;
- self.emit('start');
- self.runSuite(rootSuite, function() {
- debug('finished running');
- self.emit('end');
- });
- }
-
- debug('start');
-
- // references cleanup to avoid memory leaks
- this.on('suite end', cleanSuiteReferences);
-
- // callback
- this.on('end', function() {
- debug('end');
- process.removeListener('uncaughtException', uncaught);
- fn(self.failures);
- });
-
- // 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;
-};
-
-/**
- * Cleanly abort execution.
- *
- * @api public
- * @return {Runner} Runner instance.
- */
-Runner.prototype.abort = function() {
- debug('aborting');
- this._abort = true;
-
- return this;
-};
-
-/**
- * Filter suites based on `isOnly` logic.
- *
- * @param {Array} suite
- * @returns {Boolean}
- * @api private
- */
-function filterOnly(suite) {
- if (suite._onlyTests.length) {
- // If the suite contains `only` tests, run those and ignore any nested suites.
- suite.tests = suite._onlyTests;
- suite.suites = [];
- } else {
- // Otherwise, do not run any of the tests in this suite.
- suite.tests = [];
- utils.forEach(suite._onlySuites, function(onlySuite) {
- // If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
- // Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
- if (hasOnly(onlySuite)) {
- filterOnly(onlySuite);
- }
- });
- // Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
- suite.suites = filter(suite.suites, function(childSuite) {
- return indexOf(suite._onlySuites, childSuite) !== -1 || filterOnly(childSuite);
- });
- }
- // Keep the suite only if there is something to run
- return suite.tests.length || suite.suites.length;
-}
-
-/**
- * Determines whether a suite has an `only` test or suite as a descendant.
- *
- * @param {Array} suite
- * @returns {Boolean}
- * @api private
- */
-function hasOnly(suite) {
- return suite._onlyTests.length || suite._onlySuites.length || some(suite.suites, hasOnly);
-}
-
-/**
- * Filter leaks with the given globals flagged as `ok`.
- *
- * @api private
- * @param {Array} ok
- * @param {Array} globals
- * @return {Array}
- */
-function filterLeaks(ok, globals) {
- return filter(globals, function(key) {
- // Firefox and Chrome exposes iframes as index inside the window object
- if (/^\d+/.test(key)) {
- return false;
- }
-
- // in firefox
- // if runner runs in an iframe, this iframe's window.getInterface method
- // not init at first it is assigned in some seconds
- if (global.navigator && (/^getInterface/).test(key)) {
- return false;
- }
-
- // an iframe could be approached by window[iframeIndex]
- // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak
- if (global.navigator && (/^\d+/).test(key)) {
- return false;
- }
-
- // Opera and IE expose global variables for HTML element IDs (issue #243)
- if (/^mocha-/.test(key)) {
- return false;
- }
-
- var matched = filter(ok, function(ok) {
- if (~ok.indexOf('*')) {
- return key.indexOf(ok.split('*')[0]) === 0;
- }
- return key === ok;
- });
- return !matched.length && (!global.navigator || key !== 'onerror');
- });
-}
-
-/**
- * Array of globals dependent on the environment.
- *
- * @return {Array}
- * @api private
- */
-function extraGlobals() {
- if (typeof process === 'object' && typeof process.version === 'string') {
- var parts = process.version.split('.');
- var nodeVersion = utils.reduce(parts, function(a, v) {
- return a << 8 | v;
- });
-
- // 'errno' was renamed to process._errno in v0.9.11.
-
- if (nodeVersion < 0x00090B) {
- return ['errno'];
- }
- }
-
- return [];
-}
-
-}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./pending":16,"./runnable":33,"./utils":38,"_process":67,"debug":2,"events":3}],35:[function(require,module,exports){
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('events').EventEmitter;
-var Hook = require('./hook');
-var utils = require('./utils');
-var inherits = utils.inherits;
-var debug = require('debug')('mocha:suite');
-var milliseconds = require('./ms');
-
-/**
- * Expose `Suite`.
- */
-
-exports = module.exports = Suite;
-
-/**
- * Create a new `Suite` with the given `title` and parent `Suite`. When a suite
- * with the same title is already present, that suite is returned to provide
- * nicer reporter and more flexible meta-testing.
- *
- * @api public
- * @param {Suite} parent
- * @param {string} title
- * @return {Suite}
- */
-exports.create = function(parent, title) {
- var suite = new Suite(title, parent.ctx);
- suite.parent = parent;
- title = suite.fullTitle();
- parent.addSuite(suite);
- return suite;
-};
-
-/**
- * Initialize a new `Suite` with the given `title` and `ctx`.
- *
- * @api private
- * @param {string} title
- * @param {Context} parentContext
- */
-function Suite(title, parentContext) {
- if (!utils.isString(title)) {
- throw new Error('Suite `title` should be a "string" but "' + typeof title + '" was given instead.');
- }
- this.title = title;
- function Context() {}
- Context.prototype = parentContext;
- this.ctx = new Context();
- this.suites = [];
- this.tests = [];
- this.pending = false;
- this._beforeEach = [];
- this._beforeAll = [];
- this._afterEach = [];
- this._afterAll = [];
- this.root = !title;
- this._timeout = 2000;
- this._enableTimeouts = true;
- this._slow = 75;
- this._bail = false;
- this._retries = -1;
- this._onlyTests = [];
- this._onlySuites = [];
- this.delayed = false;
-}
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-inherits(Suite, EventEmitter);
-
-/**
- * Return a clone of this `Suite`.
- *
- * @api private
- * @return {Suite}
- */
-Suite.prototype.clone = function() {
- var suite = new Suite(this.title);
- debug('clone');
- suite.ctx = this.ctx;
- suite.timeout(this.timeout());
- suite.retries(this.retries());
- suite.enableTimeouts(this.enableTimeouts());
- suite.slow(this.slow());
- suite.bail(this.bail());
- return suite;
-};
-
-/**
- * Set timeout `ms` or short-hand such as "2s".
- *
- * @api private
- * @param {number|string} ms
- * @return {Suite|number} for chaining
- */
-Suite.prototype.timeout = function(ms) {
- if (!arguments.length) {
- return this._timeout;
- }
- if (ms.toString() === '0') {
- this._enableTimeouts = false;
- }
- if (typeof ms === 'string') {
- ms = milliseconds(ms);
- }
- debug('timeout %d', ms);
- this._timeout = parseInt(ms, 10);
- return this;
-};
-
-/**
- * Set number of times to retry a failed test.
- *
- * @api private
- * @param {number|string} n
- * @return {Suite|number} for chaining
- */
-Suite.prototype.retries = function(n) {
- if (!arguments.length) {
- return this._retries;
- }
- debug('retries %d', n);
- this._retries = parseInt(n, 10) || 0;
- return this;
-};
-
-/**
- * Set timeout to `enabled`.
- *
- * @api private
- * @param {boolean} enabled
- * @return {Suite|boolean} self or enabled
- */
-Suite.prototype.enableTimeouts = function(enabled) {
- if (!arguments.length) {
- return this._enableTimeouts;
- }
- debug('enableTimeouts %s', enabled);
- this._enableTimeouts = enabled;
- return this;
-};
-
-/**
- * Set slow `ms` or short-hand such as "2s".
- *
- * @api private
- * @param {number|string} ms
- * @return {Suite|number} for chaining
- */
-Suite.prototype.slow = function(ms) {
- if (!arguments.length) {
- return this._slow;
- }
- if (typeof ms === 'string') {
- ms = milliseconds(ms);
- }
- debug('slow %d', ms);
- this._slow = ms;
- return this;
-};
-
-/**
- * Sets whether to bail after first error.
- *
- * @api private
- * @param {boolean} bail
- * @return {Suite|number} for chaining
- */
-Suite.prototype.bail = function(bail) {
- if (!arguments.length) {
- return this._bail;
- }
- debug('bail %s', bail);
- this._bail = bail;
- return this;
-};
-
-/**
- * Check if this suite or its parent suite is marked as pending.
- *
- * @api private
- */
-Suite.prototype.isPending = function() {
- return this.pending || (this.parent && this.parent.isPending());
-};
-
-/**
- * Run `fn(test[, done])` before running tests.
- *
- * @api private
- * @param {string} title
- * @param {Function} fn
- * @return {Suite} for chaining
- */
-Suite.prototype.beforeAll = function(title, fn) {
- if (this.isPending()) {
- return this;
- }
- if (typeof title === 'function') {
- fn = title;
- title = fn.name;
- }
- title = '"before all" hook' + (title ? ': ' + title : '');
-
- var hook = new Hook(title, fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.retries(this.retries());
- hook.enableTimeouts(this.enableTimeouts());
- hook.slow(this.slow());
- hook.ctx = this.ctx;
- this._beforeAll.push(hook);
- this.emit('beforeAll', hook);
- return this;
-};
-
-/**
- * Run `fn(test[, done])` after running tests.
- *
- * @api private
- * @param {string} title
- * @param {Function} fn
- * @return {Suite} for chaining
- */
-Suite.prototype.afterAll = function(title, fn) {
- if (this.isPending()) {
- return this;
- }
- if (typeof title === 'function') {
- fn = title;
- title = fn.name;
- }
- title = '"after all" hook' + (title ? ': ' + title : '');
-
- var hook = new Hook(title, fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.retries(this.retries());
- hook.enableTimeouts(this.enableTimeouts());
- hook.slow(this.slow());
- hook.ctx = this.ctx;
- this._afterAll.push(hook);
- this.emit('afterAll', hook);
- return this;
-};
-
-/**
- * Run `fn(test[, done])` before each test case.
- *
- * @api private
- * @param {string} title
- * @param {Function} fn
- * @return {Suite} for chaining
- */
-Suite.prototype.beforeEach = function(title, fn) {
- if (this.isPending()) {
- return this;
- }
- if (typeof title === 'function') {
- fn = title;
- title = fn.name;
- }
- title = '"before each" hook' + (title ? ': ' + title : '');
-
- var hook = new Hook(title, fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.retries(this.retries());
- hook.enableTimeouts(this.enableTimeouts());
- hook.slow(this.slow());
- hook.ctx = this.ctx;
- this._beforeEach.push(hook);
- this.emit('beforeEach', hook);
- return this;
-};
-
-/**
- * Run `fn(test[, done])` after each test case.
- *
- * @api private
- * @param {string} title
- * @param {Function} fn
- * @return {Suite} for chaining
- */
-Suite.prototype.afterEach = function(title, fn) {
- if (this.isPending()) {
- return this;
- }
- if (typeof title === 'function') {
- fn = title;
- title = fn.name;
- }
- title = '"after each" hook' + (title ? ': ' + title : '');
-
- var hook = new Hook(title, fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.retries(this.retries());
- hook.enableTimeouts(this.enableTimeouts());
- hook.slow(this.slow());
- hook.ctx = this.ctx;
- this._afterEach.push(hook);
- this.emit('afterEach', hook);
- return this;
-};
-
-/**
- * Add a test `suite`.
- *
- * @api private
- * @param {Suite} suite
- * @return {Suite} for chaining
- */
-Suite.prototype.addSuite = function(suite) {
- suite.parent = this;
- suite.timeout(this.timeout());
- suite.retries(this.retries());
- suite.enableTimeouts(this.enableTimeouts());
- suite.slow(this.slow());
- suite.bail(this.bail());
- this.suites.push(suite);
- this.emit('suite', suite);
- return this;
-};
-
-/**
- * Add a `test` to this suite.
- *
- * @api private
- * @param {Test} test
- * @return {Suite} for chaining
- */
-Suite.prototype.addTest = function(test) {
- test.parent = this;
- test.timeout(this.timeout());
- test.retries(this.retries());
- test.enableTimeouts(this.enableTimeouts());
- test.slow(this.slow());
- test.ctx = this.ctx;
- this.tests.push(test);
- this.emit('test', test);
- return this;
-};
-
-/**
- * Return the full title generated by recursively concatenating the parent's
- * full title.
- *
- * @api public
- * @return {string}
- */
-Suite.prototype.fullTitle = function() {
- if (this.parent) {
- var full = this.parent.fullTitle();
- if (full) {
- return full + ' ' + this.title;
- }
- }
- return this.title;
-};
-
-/**
- * Return the total number of tests.
- *
- * @api public
- * @return {number}
- */
-Suite.prototype.total = function() {
- return utils.reduce(this.suites, function(sum, suite) {
- return sum + suite.total();
- }, 0) + this.tests.length;
-};
-
-/**
- * Iterates through each suite recursively to find all tests. Applies a
- * function in the format `fn(test)`.
- *
- * @api private
- * @param {Function} fn
- * @return {Suite}
- */
-Suite.prototype.eachTest = function(fn) {
- utils.forEach(this.tests, fn);
- utils.forEach(this.suites, function(suite) {
- suite.eachTest(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');
- }
-};
-
-},{"./hook":7,"./ms":15,"./utils":38,"debug":2,"events":3}],36:[function(require,module,exports){
-/**
- * Module dependencies.
- */
-
-var Runnable = require('./runnable');
-var create = require('lodash.create');
-var isString = require('./utils').isString;
-
-/**
- * Expose `Test`.
- */
-
-module.exports = Test;
-
-/**
- * Initialize a new `Test` with the given `title` and callback `fn`.
- *
- * @api private
- * @param {String} title
- * @param {Function} fn
- */
-function Test(title, fn) {
- if (!isString(title)) {
- throw new Error('Test `title` should be a "string" but "' + typeof title + '" was given instead.');
- }
- Runnable.call(this, title, fn);
- this.pending = !fn;
- this.type = 'test';
-}
-
-/**
- * Inherit from `Runnable.prototype`.
- */
-Test.prototype = create(Runnable.prototype, {
- constructor: Test
-});
-
-Test.prototype.clone = function() {
- var test = new Test(this.title, this.fn);
- test.timeout(this.timeout());
- test.slow(this.slow());
- test.enableTimeouts(this.enableTimeouts());
- test.retries(this.retries());
- test.currentRetry(this.currentRetry());
- test.globals(this.globals());
- test.parent = this.parent;
- test.file = this.file;
- test.ctx = this.ctx;
- return test;
-};
-
-},{"./runnable":33,"./utils":38,"lodash.create":60}],37:[function(require,module,exports){
-'use strict';
-
-/**
- * Pad a `number` with a ten's place zero.
- *
- * @param {number} number
- * @return {string}
- */
-function pad(number) {
- var n = number.toString();
- return n.length === 1 ? '0' + n : n;
-}
-
-/**
- * Turn a `date` into an ISO string.
- *
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
- *
- * @param {Date} date
- * @return {string}
- */
-function toISOString(date) {
- return date.getUTCFullYear()
- + '-' + pad(date.getUTCMonth() + 1)
- + '-' + pad(date.getUTCDate())
- + 'T' + pad(date.getUTCHours())
- + ':' + pad(date.getUTCMinutes())
- + ':' + pad(date.getUTCSeconds())
- + '.' + String((date.getUTCMilliseconds()/1000).toFixed(3)).slice(2, 5)
- + 'Z';
-}
-
-/*
- * Exports.
- */
-
-module.exports = toISOString;
-
-},{}],38:[function(require,module,exports){
-(function (process,Buffer){
-/* eslint-env browser */
-
-/**
- * Module dependencies.
- */
-
-var JSON = require('json3');
-var basename = require('path').basename;
-var debug = require('debug')('mocha:watch');
-var exists = require('fs').existsSync || require('path').existsSync;
-var glob = require('glob');
-var path = require('path');
-var join = path.join;
-var readdirSync = require('fs').readdirSync;
-var statSync = require('fs').statSync;
-var watchFile = require('fs').watchFile;
-var toISOString = require('./to-iso-string');
-
-/**
- * Ignored directories.
- */
-
-var ignore = ['node_modules', '.git'];
-
-exports.inherits = require('util').inherits;
-
-/**
- * Escape special characters in the given string of html.
- *
- * @api private
- * @param {string} html
- * @return {string}
- */
-exports.escape = function(html) {
- return String(html)
- .replace(/&/g, '&amp;')
- .replace(/"/g, '&quot;')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;');
-};
-
-/**
- * Array#forEach (<=IE8)
- *
- * @api private
- * @param {Array} arr
- * @param {Function} fn
- * @param {Object} scope
- */
-exports.forEach = function(arr, fn, scope) {
- for (var i = 0, l = arr.length; i < l; i++) {
- fn.call(scope, arr[i], i);
- }
-};
-
-/**
- * Test if the given obj is type of string.
- *
- * @api private
- * @param {Object} obj
- * @return {boolean}
- */
-exports.isString = function(obj) {
- return typeof obj === 'string';
-};
-
-/**
- * Array#map (<=IE8)
- *
- * @api private
- * @param {Array} arr
- * @param {Function} fn
- * @param {Object} scope
- * @return {Array}
- */
-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, arr));
- }
- return result;
-};
-
-/**
- * Array#indexOf (<=IE8)
- *
- * @api private
- * @param {Array} arr
- * @param {Object} obj to find index of
- * @param {number} start
- * @return {number}
- */
-var indexOf = exports.indexOf = function(arr, obj, start) {
- for (var i = start || 0, l = arr.length; i < l; i++) {
- if (arr[i] === obj) {
- return i;
- }
- }
- return -1;
-};
-
-/**
- * Array#reduce (<=IE8)
- *
- * @api private
- * @param {Array} arr
- * @param {Function} fn
- * @param {Object} val Initial value.
- * @return {*}
- */
-var reduce = exports.reduce = function(arr, fn, val) {
- var rval = val;
-
- for (var i = 0, l = arr.length; i < l; i++) {
- rval = fn(rval, arr[i], i, arr);
- }
-
- return rval;
-};
-
-/**
- * Array#filter (<=IE8)
- *
- * @api private
- * @param {Array} arr
- * @param {Function} fn
- * @return {Array}
- */
-exports.filter = function(arr, fn) {
- var ret = [];
-
- for (var i = 0, l = arr.length; i < l; i++) {
- var val = arr[i];
- if (fn(val, i, arr)) {
- ret.push(val);
- }
- }
-
- return ret;
-};
-
-/**
- * Array#some (<=IE8)
- *
- * @api private
- * @param {Array} arr
- * @param {Function} fn
- * @return {Array}
- */
-exports.some = function(arr, fn) {
- for (var i = 0, l = arr.length; i < l; i++) {
- if (fn(arr[i])) {
- return true;
- }
- }
- return false;
-};
-
-/**
- * Object.keys (<=IE8)
- *
- * @api private
- * @param {Object} obj
- * @return {Array} keys
- */
-exports.keys = typeof Object.keys === 'function' ? Object.keys : function(obj) {
- var keys = [];
- var has = Object.prototype.hasOwnProperty; // for `window` on <=IE8
-
- for (var key in obj) {
- if (has.call(obj, key)) {
- keys.push(key);
- }
- }
-
- return keys;
-};
-
-/**
- * Watch the given `files` for changes
- * and invoke `fn(file)` on modification.
- *
- * @api private
- * @param {Array} files
- * @param {Function} fn
- */
-exports.watch = function(files, fn) {
- var options = { interval: 100 };
- files.forEach(function(file) {
- debug('file %s', file);
- watchFile(file, options, function(curr, prev) {
- if (prev.mtime < curr.mtime) {
- fn(file);
- }
- });
- });
-};
-
-/**
- * Array.isArray (<=IE8)
- *
- * @api private
- * @param {Object} obj
- * @return {Boolean}
- */
-var isArray = typeof Array.isArray === 'function' ? Array.isArray : function(obj) {
- return Object.prototype.toString.call(obj) === '[object Array]';
-};
-
-exports.isArray = isArray;
-
-/**
- * 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.
- *
- * @api private
- * @param {string} path
- * @return {boolean}
- */
-function ignored(path) {
- return !~ignore.indexOf(path);
-}
-
-/**
- * Lookup files in the given `dir`.
- *
- * @api private
- * @param {string} dir
- * @param {string[]} [ext=['.js']]
- * @param {Array} [ret=[]]
- * @return {Array}
- */
-exports.files = function(dir, ext, ret) {
- ret = ret || [];
- ext = ext || ['js'];
-
- var re = new RegExp('\\.(' + ext.join('|') + ')$');
-
- readdirSync(dir)
- .filter(ignored)
- .forEach(function(path) {
- path = join(dir, path);
- if (statSync(path).isDirectory()) {
- exports.files(path, ext, ret);
- } else if (path.match(re)) {
- ret.push(path);
- }
- });
-
- return ret;
-};
-
-/**
- * Compute a slug from the given `str`.
- *
- * @api private
- * @param {string} str
- * @return {string}
- */
-exports.slug = function(str) {
- return str
- .toLowerCase()
- .replace(/ +/g, '-')
- .replace(/[^-\w]/g, '');
-};
-
-/**
- * Strip the function definition from `str`, and re-indent for pre whitespace.
- *
- * @param {string} str
- * @return {string}
- */
-exports.clean = function(str) {
- str = str
- .replace(/\r\n?|[\n\u2028\u2029]/g, '\n').replace(/^\uFEFF/, '')
- // (traditional)-> space/name parameters body (lambda)-> parameters body multi-statement/single keep body content
- .replace(/^function(?:\s*|\s+[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\s*\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\s*\}|((?:.|\n)*))$/, '$1$2$3');
-
- var spaces = str.match(/^\n?( *)/)[1].length;
- var tabs = str.match(/^\n?(\t*)/)[1].length;
- var re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm');
-
- str = str.replace(re, '');
-
- return exports.trim(str);
-};
-
-/**
- * Trim the given `str`.
- *
- * @api private
- * @param {string} str
- * @return {string}
- */
-exports.trim = function(str) {
- return str.replace(/^\s+|\s+$/g, '');
-};
-
-/**
- * Parse the given `qs`.
- *
- * @api private
- * @param {string} qs
- * @return {Object}
- */
-exports.parseQuery = function(qs) {
- return reduce(qs.replace('?', '').split('&'), function(obj, pair) {
- var i = pair.indexOf('=');
- var key = pair.slice(0, i);
- var val = pair.slice(++i);
-
- obj[key] = decodeURIComponent(val);
- return obj;
- }, {});
-};
-
-/**
- * Highlight the given string of `js`.
- *
- * @api private
- * @param {string} js
- * @return {string}
- */
-function highlight(js) {
- return js
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
- .replace(/('.*?')/gm, '<span class="string">$1</span>')
- .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
- .replace(/(\d+)/gm, '<span class="number">$1</span>')
- .replace(/\bnew[ \t]+(\w+)/gm, '<span class="keyword">new</span> <span class="init">$1</span>')
- .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>');
-}
-
-/**
- * Highlight the contents of tag `name`.
- *
- * @api private
- * @param {string} name
- */
-exports.highlightTags = function(name) {
- var code = document.getElementById('mocha').getElementsByTagName(name);
- for (var i = 0, len = code.length; i < len; ++i) {
- code[i].innerHTML = highlight(code[i].innerHTML);
- }
-};
-
-/**
- * If a value could have properties, and has none, this function is called,
- * which returns a string representation of the empty value.
- *
- * Functions w/ no properties return `'[Function]'`
- * Arrays w/ length === 0 return `'[]'`
- * Objects w/ no properties return `'{}'`
- * All else: return result of `value.toString()`
- *
- * @api private
- * @param {*} value The value to inspect.
- * @param {string} typeHint The type of the value
- * @returns {string}
- */
-function emptyRepresentation(value, typeHint) {
- switch (typeHint) {
- case 'function':
- return '[Function]';
- case 'object':
- return '{}';
- case 'array':
- return '[]';
- default:
- return value.toString();
- }
-}
-
-/**
- * Takes some variable and asks `Object.prototype.toString()` what it thinks it
- * is.
- *
- * @api private
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
- * @param {*} value The value to test.
- * @returns {string} Computed type
- * @example
- * type({}) // 'object'
- * type([]) // 'array'
- * type(1) // 'number'
- * type(false) // 'boolean'
- * type(Infinity) // 'number'
- * type(null) // 'null'
- * type(new Date()) // 'date'
- * type(/foo/) // 'regexp'
- * type('type') // 'string'
- * type(global) // 'global'
- * type(new String('foo') // 'object'
- */
-var type = exports.type = function type(value) {
- if (value === undefined) {
- return 'undefined';
- } else if (value === null) {
- return 'null';
- } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {
- return 'buffer';
- }
- return Object.prototype.toString.call(value)
- .replace(/^\[.+\s(.+?)\]$/, '$1')
- .toLowerCase();
-};
-
-/**
- * Stringify `value`. Different behavior depending on type of value:
- *
- * - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively.
- * - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes.
- * - If `value` is an *empty* object, function, or array, return result of function
- * {@link emptyRepresentation}.
- * - If `value` has properties, call {@link exports.canonicalize} on it, then return result of
- * JSON.stringify().
- *
- * @api private
- * @see exports.type
- * @param {*} value
- * @return {string}
- */
-exports.stringify = function(value) {
- var typeHint = type(value);
-
- if (!~indexOf(['object', 'array', 'function'], typeHint)) {
- if (typeHint === 'buffer') {
- var json = value.toJSON();
- // Based on the toJSON result
- return jsonStringify(json.data && json.type ? json.data : json, 2)
- .replace(/,(\n|$)/g, '$1');
- }
-
- // IE7/IE8 has a bizarre String constructor; needs to be coerced
- // into an array and back to obj.
- if (typeHint === 'string' && typeof value === 'object') {
- value = reduce(value.split(''), function(acc, char, idx) {
- acc[idx] = char;
- return acc;
- }, {});
- typeHint = 'object';
- } else {
- return jsonStringify(value);
- }
- }
-
- for (var prop in value) {
- if (Object.prototype.hasOwnProperty.call(value, prop)) {
- return jsonStringify(exports.canonicalize(value, null, typeHint), 2).replace(/,(\n|$)/g, '$1');
- }
- }
-
- return emptyRepresentation(value, typeHint);
-};
-
-/**
- * like JSON.stringify but more sense.
- *
- * @api private
- * @param {Object} object
- * @param {number=} spaces
- * @param {number=} depth
- * @returns {*}
- */
-function jsonStringify(object, spaces, depth) {
- if (typeof spaces === 'undefined') {
- // primitive types
- return _stringify(object);
- }
-
- depth = depth || 1;
- var space = spaces * depth;
- var str = isArray(object) ? '[' : '{';
- var end = isArray(object) ? ']' : '}';
- var length = typeof object.length === 'number' ? object.length : exports.keys(object).length;
- // `.repeat()` polyfill
- function repeat(s, n) {
- return new Array(n).join(s);
- }
-
- function _stringify(val) {
- switch (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 'symbol':
- case 'number':
- val = val === 0 && (1 / val) === -Infinity // `-0`
- ? '-0'
- : val.toString();
- break;
- case 'date':
- var sDate;
- if (isNaN(val.getTime())) { // Invalid date
- sDate = val.toString();
- } else {
- sDate = val.toISOString ? val.toISOString() : toISOString(val);
- }
- 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.prototype.hasOwnProperty.call(object, 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);
-}
-
-/**
- * Test if a value is a buffer.
- *
- * @api private
- * @param {*} value The value to test.
- * @return {boolean} True if `value` is a buffer, otherwise false
- */
-exports.isBuffer = function(value) {
- return typeof Buffer !== 'undefined' && Buffer.isBuffer(value);
-};
-
-/**
- * Return a new Thing that has the keys in sorted order. Recursive.
- *
- * If the Thing...
- * - has already been seen, return string `'[Circular]'`
- * - is `undefined`, return string `'[undefined]'`
- * - is `null`, return value `null`
- * - is some other primitive, return the value
- * - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method
- * - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again.
- * - is an empty `Array`, `Object`, or `Function`, return the result of calling `emptyRepresentation()`
- *
- * @api private
- * @see {@link exports.stringify}
- * @param {*} value Thing to inspect. May or may not have properties.
- * @param {Array} [stack=[]] Stack of seen values
- * @param {string} [typeHint] Type hint
- * @return {(Object|Array|Function|string|undefined)}
- */
-exports.canonicalize = function canonicalize(value, stack, typeHint) {
- var canonicalizedObj;
- /* eslint-disable no-unused-vars */
- var prop;
- /* eslint-enable no-unused-vars */
- typeHint = typeHint || type(value);
- function withStack(value, fn) {
- stack.push(value);
- fn();
- stack.pop();
- }
-
- stack = stack || [];
-
- if (indexOf(stack, value) !== -1) {
- return '[Circular]';
- }
-
- switch (typeHint) {
- case 'undefined':
- case 'buffer':
- case 'null':
- canonicalizedObj = value;
- break;
- case 'array':
- withStack(value, function() {
- canonicalizedObj = exports.map(value, function(item) {
- return exports.canonicalize(item, stack);
- });
- });
- break;
- case 'function':
- /* eslint-disable guard-for-in */
- for (prop in value) {
- canonicalizedObj = {};
- break;
- }
- /* eslint-enable guard-for-in */
- if (!canonicalizedObj) {
- canonicalizedObj = emptyRepresentation(value, typeHint);
- break;
- }
- /* falls through */
- case 'object':
- canonicalizedObj = canonicalizedObj || {};
- withStack(value, function() {
- exports.forEach(exports.keys(value).sort(), function(key) {
- canonicalizedObj[key] = exports.canonicalize(value[key], stack);
- });
- });
- break;
- case 'date':
- case 'number':
- case 'regexp':
- case 'boolean':
- case 'symbol':
- canonicalizedObj = value;
- break;
- default:
- canonicalizedObj = value + '';
- }
-
- return canonicalizedObj;
-};
-
-/**
- * Lookup file names at the given `path`.
- *
- * @api public
- * @param {string} path Base path to start searching from.
- * @param {string[]} extensions File extensions to look for.
- * @param {boolean} recursive Whether or not to recurse into subdirectories.
- * @return {string[]} An array of paths.
- */
-exports.lookupFiles = function lookupFiles(path, extensions, recursive) {
- var files = [];
- var re = new RegExp('\\.(' + extensions.join('|') + ')$');
-
- if (!exists(path)) {
- if (exists(path + '.js')) {
- path += '.js';
- } else {
- files = glob.sync(path);
- if (!files.length) {
- throw new Error("cannot resolve path (or pattern) '" + path + "'");
- }
- return files;
- }
- }
-
- try {
- var stat = statSync(path);
- if (stat.isFile()) {
- return path;
- }
- } catch (err) {
- // ignore error
- return;
- }
-
- readdirSync(path).forEach(function(file) {
- file = join(path, file);
- try {
- var stat = statSync(file);
- if (stat.isDirectory()) {
- if (recursive) {
- files = files.concat(lookupFiles(file, extensions, recursive));
- }
- return;
- }
- } catch (err) {
- // ignore error
- return;
- }
- if (!stat.isFile() || !re.test(file) || basename(file)[0] === '.') {
- return;
- }
- files.push(file);
- });
-
- return files;
-};
-
-/**
- * Generate an undefined error with a message warning the user.
- *
- * @return {Error}
- */
-
-exports.undefinedError = function() {
- return new Error('Caught undefined error, did you throw without specifying what?');
-};
-
-/**
- * Generate an undefined error if `err` is not defined.
- *
- * @param {Error} err
- * @return {Error}
- */
-
-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 and internal node functions from stack trace).
- * @returns {Function}
- */
-exports.stackTraceFilter = function() {
- // TODO: Replace with `process.browser`
- var is = typeof document === 'undefined' ? { node: true } : { browser: true };
- var slash = path.sep;
- var cwd;
- if (is.node) {
- cwd = process.cwd() + slash;
- } else {
- cwd = (typeof location === 'undefined' ? window.location : location).href.replace(/\/[^\/]*$/, '/');
- slash = '/';
- }
-
- function isMochaInternal(line) {
- return (~line.indexOf('node_modules' + slash + 'mocha' + slash))
- || (~line.indexOf('node_modules' + slash + 'mocha.js'))
- || (~line.indexOf('bower_components' + slash + 'mocha.js'))
- || (~line.indexOf(slash + 'mocha.js'));
- }
-
- 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 = reduce(stack, function(list, line) {
- if (isMochaInternal(line)) {
- return list;
- }
-
- if (is.node && isNodeInternal(line)) {
- return list;
- }
-
- // Clean up cwd(absolute)
- if (/\(?.+:\d+:\d+\)?$/.test(line)) {
- line = line.replace(cwd, '');
- }
-
- list.push(line);
- return list;
- }, []);
-
- return stack.join('\n');
- };
-};
-
-/**
- * Crude, but effective.
- * @api
- * @param {*} value
- * @returns {boolean} Whether or not `value` is a Promise
- */
-exports.isPromise = function isPromise(value) {
- return typeof value === 'object' && typeof value.then === 'function';
-};
-
-}).call(this,require('_process'),require("buffer").Buffer)
-},{"./to-iso-string":37,"_process":67,"buffer":44,"debug":2,"fs":42,"glob":42,"json3":54,"path":42,"util":84}],39:[function(require,module,exports){
-'use strict'
-
-exports.toByteArray = toByteArray
-exports.fromByteArray = fromByteArray
-
-var lookup = []
-var revLookup = []
-var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
-
-function init () {
- var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
- for (var i = 0, len = code.length; i < len; ++i) {
- lookup[i] = code[i]
- revLookup[code.charCodeAt(i)] = i
- }
-
- revLookup['-'.charCodeAt(0)] = 62
- revLookup['_'.charCodeAt(0)] = 63
-}
-
-init()
-
-function toByteArray (b64) {
- var i, j, l, tmp, placeHolders, arr
- var len = b64.length
-
- if (len % 4 > 0) {
- throw new Error('Invalid string. Length must be a multiple of 4')
- }
-
- // the number of equal signs (place holders)
- // if there are two placeholders, than the two characters before it
- // represent one byte
- // if there is only one, then the three characters before it represent 2 bytes
- // this is just a cheap hack to not do indexOf twice
- placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
-
- // base64 is 4/3 + up to two characters of the original data
- arr = new Arr(len * 3 / 4 - placeHolders)
-
- // if there are placeholders, only get up to the last complete 4 chars
- l = placeHolders > 0 ? len - 4 : len
-
- var L = 0
-
- for (i = 0, j = 0; i < l; i += 4, j += 3) {
- tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
- arr[L++] = (tmp >> 16) & 0xFF
- arr[L++] = (tmp >> 8) & 0xFF
- arr[L++] = tmp & 0xFF
- }
-
- if (placeHolders === 2) {
- tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
- arr[L++] = tmp & 0xFF
- } else if (placeHolders === 1) {
- tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
- arr[L++] = (tmp >> 8) & 0xFF
- arr[L++] = tmp & 0xFF
- }
-
- return arr
-}
-
-function tripletToBase64 (num) {
- return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
-}
-
-function encodeChunk (uint8, start, end) {
- var tmp
- var output = []
- for (var i = start; i < end; i += 3) {
- tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
- output.push(tripletToBase64(tmp))
- }
- return output.join('')
-}
-
-function fromByteArray (uint8) {
- var tmp
- var len = uint8.length
- var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
- var output = ''
- var parts = []
- var maxChunkLength = 16383 // must be multiple of 3
-
- // go through the array every three bytes, we'll deal with trailing stuff later
- for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
- parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
- }
-
- // pad the end with zeros, but make sure to not forget the extra bytes
- if (extraBytes === 1) {
- tmp = uint8[len - 1]
- output += lookup[tmp >> 2]
- output += lookup[(tmp << 4) & 0x3F]
- output += '=='
- } else if (extraBytes === 2) {
- tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
- output += lookup[tmp >> 10]
- output += lookup[(tmp >> 4) & 0x3F]
- output += lookup[(tmp << 2) & 0x3F]
- output += '='
- }
-
- parts.push(output)
-
- return parts.join('')
-}
-
-},{}],40:[function(require,module,exports){
-
-},{}],41:[function(require,module,exports){
-(function (process){
-var WritableStream = require('stream').Writable
-var inherits = require('util').inherits
-
-module.exports = BrowserStdout
-
-
-inherits(BrowserStdout, WritableStream)
-
-function BrowserStdout(opts) {
- if (!(this instanceof BrowserStdout)) return new BrowserStdout(opts)
-
- opts = opts || {}
- WritableStream.call(this, opts)
- this.label = (opts.label !== undefined) ? opts.label : 'stdout'
-}
-
-BrowserStdout.prototype._write = function(chunks, encoding, cb) {
- var output = chunks.toString ? chunks.toString() : chunks
- if (this.label === false) {
- console.log(output)
- } else {
- console.log(this.label+':', output)
- }
- process.nextTick(cb)
-}
-
-}).call(this,require('_process'))
-},{"_process":67,"stream":79,"util":84}],42:[function(require,module,exports){
-arguments[4][40][0].apply(exports,arguments)
-},{"dup":40}],43:[function(require,module,exports){
-(function (global){
-'use strict';
-
-var buffer = require('buffer');
-var Buffer = buffer.Buffer;
-var SlowBuffer = buffer.SlowBuffer;
-var MAX_LEN = buffer.kMaxLength || 2147483647;
-exports.alloc = function alloc(size, fill, encoding) {
- if (typeof Buffer.alloc === 'function') {
- return Buffer.alloc(size, fill, encoding);
- }
- if (typeof encoding === 'number') {
- throw new TypeError('encoding must not be number');
- }
- if (typeof size !== 'number') {
- throw new TypeError('size must be a number');
- }
- if (size > MAX_LEN) {
- throw new RangeError('size is too large');
- }
- var enc = encoding;
- var _fill = fill;
- if (_fill === undefined) {
- enc = undefined;
- _fill = 0;
- }
- var buf = new Buffer(size);
- if (typeof _fill === 'string') {
- var fillBuf = new Buffer(_fill, enc);
- var flen = fillBuf.length;
- var i = -1;
- while (++i < size) {
- buf[i] = fillBuf[i % flen];
- }
- } else {
- buf.fill(_fill);
- }
- return buf;
-}
-exports.allocUnsafe = function allocUnsafe(size) {
- if (typeof Buffer.allocUnsafe === 'function') {
- return Buffer.allocUnsafe(size);
- }
- if (typeof size !== 'number') {
- throw new TypeError('size must be a number');
- }
- if (size > MAX_LEN) {
- throw new RangeError('size is too large');
- }
- return new Buffer(size);
-}
-exports.from = function from(value, encodingOrOffset, length) {
- if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) {
- return Buffer.from(value, encodingOrOffset, length);
- }
- if (typeof value === 'number') {
- throw new TypeError('"value" argument must not be a number');
- }
- if (typeof value === 'string') {
- return new Buffer(value, encodingOrOffset);
- }
- if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
- var offset = encodingOrOffset;
- if (arguments.length === 1) {
- return new Buffer(value);
- }
- if (typeof offset === 'undefined') {
- offset = 0;
- }
- var len = length;
- if (typeof len === 'undefined') {
- len = value.byteLength - offset;
- }
- if (offset >= value.byteLength) {
- throw new RangeError('\'offset\' is out of bounds');
- }
- if (len > value.byteLength - offset) {
- throw new RangeError('\'length\' is out of bounds');
- }
- return new Buffer(value.slice(offset, offset + len));
- }
- if (Buffer.isBuffer(value)) {
- var out = new Buffer(value.length);
- value.copy(out, 0, 0, value.length);
- return out;
- }
- if (value) {
- if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) {
- return new Buffer(value);
- }
- if (value.type === 'Buffer' && Array.isArray(value.data)) {
- return new Buffer(value.data);
- }
- }
-
- throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.');
-}
-exports.allocUnsafeSlow = function allocUnsafeSlow(size) {
- if (typeof Buffer.allocUnsafeSlow === 'function') {
- return Buffer.allocUnsafeSlow(size);
- }
- if (typeof size !== 'number') {
- throw new TypeError('size must be a number');
- }
- if (size >= MAX_LEN) {
- throw new RangeError('size is too large');
- }
- return new SlowBuffer(size);
-}
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"buffer":44}],44:[function(require,module,exports){
-(function (global){
-/*!
- * The buffer module from node.js, for the browser.
- *
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
- * @license MIT
- */
-/* eslint-disable no-proto */
-
-'use strict'
-
-var base64 = require('base64-js')
-var ieee754 = require('ieee754')
-var isArray = require('isarray')
-
-exports.Buffer = Buffer
-exports.SlowBuffer = SlowBuffer
-exports.INSPECT_MAX_BYTES = 50
-
-/**
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
- * === true Use Uint8Array implementation (fastest)
- * === false Use Object implementation (most compatible, even IE6)
- *
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
- * Opera 11.6+, iOS 4.2+.
- *
- * Due to various browser bugs, sometimes the Object implementation will be used even
- * when the browser supports typed arrays.
- *
- * Note:
- *
- * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
- * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
- *
- * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
- *
- * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
- * incorrect length in some situations.
-
- * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
- * get the Object implementation, which is slower but behaves correctly.
- */
-Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
- ? global.TYPED_ARRAY_SUPPORT
- : typedArraySupport()
-
-/*
- * Export kMaxLength after typed array support is determined.
- */
-exports.kMaxLength = kMaxLength()
-
-function typedArraySupport () {
- try {
- var arr = new Uint8Array(1)
- arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
- return arr.foo() === 42 && // typed array instances can be augmented
- typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
- arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
- } catch (e) {
- return false
- }
-}
-
-function kMaxLength () {
- return Buffer.TYPED_ARRAY_SUPPORT
- ? 0x7fffffff
- : 0x3fffffff
-}
-
-function createBuffer (that, length) {
- if (kMaxLength() < length) {
- throw new RangeError('Invalid typed array length')
- }
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- // Return an augmented `Uint8Array` instance, for best performance
- that = new Uint8Array(length)
- that.__proto__ = Buffer.prototype
- } else {
- // Fallback: Return an object instance of the Buffer class
- if (that === null) {
- that = new Buffer(length)
- }
- that.length = length
- }
-
- return that
-}
-
-/**
- * The Buffer constructor returns instances of `Uint8Array` that have their
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
- * returns a single octet.
- *
- * The `Uint8Array` prototype remains unmodified.
- */
-
-function Buffer (arg, encodingOrOffset, length) {
- if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
- return new Buffer(arg, encodingOrOffset, length)
- }
-
- // Common case.
- if (typeof arg === 'number') {
- if (typeof encodingOrOffset === 'string') {
- throw new Error(
- 'If encoding is specified then the first argument must be a string'
- )
- }
- return allocUnsafe(this, arg)
- }
- return from(this, arg, encodingOrOffset, length)
-}
-
-Buffer.poolSize = 8192 // not used by this implementation
-
-// TODO: Legacy, not needed anymore. Remove in next major version.
-Buffer._augment = function (arr) {
- arr.__proto__ = Buffer.prototype
- return arr
-}
-
-function from (that, value, encodingOrOffset, length) {
- if (typeof value === 'number') {
- throw new TypeError('"value" argument must not be a number')
- }
-
- if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
- return fromArrayBuffer(that, value, encodingOrOffset, length)
- }
-
- if (typeof value === 'string') {
- return fromString(that, value, encodingOrOffset)
- }
-
- return fromObject(that, value)
-}
-
-/**
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
- * if value is a number.
- * Buffer.from(str[, encoding])
- * Buffer.from(array)
- * Buffer.from(buffer)
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
- **/
-Buffer.from = function (value, encodingOrOffset, length) {
- return from(null, value, encodingOrOffset, length)
-}
-
-if (Buffer.TYPED_ARRAY_SUPPORT) {
- Buffer.prototype.__proto__ = Uint8Array.prototype
- Buffer.__proto__ = Uint8Array
- if (typeof Symbol !== 'undefined' && Symbol.species &&
- Buffer[Symbol.species] === Buffer) {
- // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
- Object.defineProperty(Buffer, Symbol.species, {
- value: null,
- configurable: true
- })
- }
-}
-
-function assertSize (size) {
- if (typeof size !== 'number') {
- throw new TypeError('"size" argument must be a number')
- } else if (size < 0) {
- throw new RangeError('"size" argument must not be negative')
- }
-}
-
-function alloc (that, size, fill, encoding) {
- assertSize(size)
- if (size <= 0) {
- return createBuffer(that, size)
- }
- if (fill !== undefined) {
- // Only pay attention to encoding if it's a string. This
- // prevents accidentally sending in a number that would
- // be interpretted as a start offset.
- return typeof encoding === 'string'
- ? createBuffer(that, size).fill(fill, encoding)
- : createBuffer(that, size).fill(fill)
- }
- return createBuffer(that, size)
-}
-
-/**
- * Creates a new filled Buffer instance.
- * alloc(size[, fill[, encoding]])
- **/
-Buffer.alloc = function (size, fill, encoding) {
- return alloc(null, size, fill, encoding)
-}
-
-function allocUnsafe (that, size) {
- assertSize(size)
- that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
- if (!Buffer.TYPED_ARRAY_SUPPORT) {
- for (var i = 0; i < size; ++i) {
- that[i] = 0
- }
- }
- return that
-}
-
-/**
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
- * */
-Buffer.allocUnsafe = function (size) {
- return allocUnsafe(null, size)
-}
-/**
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
- */
-Buffer.allocUnsafeSlow = function (size) {
- return allocUnsafe(null, size)
-}
-
-function fromString (that, string, encoding) {
- if (typeof encoding !== 'string' || encoding === '') {
- encoding = 'utf8'
- }
-
- if (!Buffer.isEncoding(encoding)) {
- throw new TypeError('"encoding" must be a valid string encoding')
- }
-
- var length = byteLength(string, encoding) | 0
- that = createBuffer(that, length)
-
- var actual = that.write(string, encoding)
-
- if (actual !== length) {
- // Writing a hex string, for example, that contains invalid characters will
- // cause everything after the first invalid character to be ignored. (e.g.
- // 'abxxcd' will be treated as 'ab')
- that = that.slice(0, actual)
- }
-
- return that
-}
-
-function fromArrayLike (that, array) {
- var length = array.length < 0 ? 0 : checked(array.length) | 0
- that = createBuffer(that, length)
- for (var i = 0; i < length; i += 1) {
- that[i] = array[i] & 255
- }
- return that
-}
-
-function fromArrayBuffer (that, array, byteOffset, length) {
- array.byteLength // this throws if `array` is not a valid ArrayBuffer
-
- if (byteOffset < 0 || array.byteLength < byteOffset) {
- throw new RangeError('\'offset\' is out of bounds')
- }
-
- if (array.byteLength < byteOffset + (length || 0)) {
- throw new RangeError('\'length\' is out of bounds')
- }
-
- if (byteOffset === undefined && length === undefined) {
- array = new Uint8Array(array)
- } else if (length === undefined) {
- array = new Uint8Array(array, byteOffset)
- } else {
- array = new Uint8Array(array, byteOffset, length)
- }
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- // Return an augmented `Uint8Array` instance, for best performance
- that = array
- that.__proto__ = Buffer.prototype
- } else {
- // Fallback: Return an object instance of the Buffer class
- that = fromArrayLike(that, array)
- }
- return that
-}
-
-function fromObject (that, obj) {
- if (Buffer.isBuffer(obj)) {
- var len = checked(obj.length) | 0
- that = createBuffer(that, len)
-
- if (that.length === 0) {
- return that
- }
-
- obj.copy(that, 0, 0, len)
- return that
- }
-
- if (obj) {
- if ((typeof ArrayBuffer !== 'undefined' &&
- obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
- if (typeof obj.length !== 'number' || isnan(obj.length)) {
- return createBuffer(that, 0)
- }
- return fromArrayLike(that, obj)
- }
-
- if (obj.type === 'Buffer' && isArray(obj.data)) {
- return fromArrayLike(that, obj.data)
- }
- }
-
- throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
-}
-
-function checked (length) {
- // Note: cannot use `length < kMaxLength()` here because that fails when
- // length is NaN (which is otherwise coerced to zero.)
- if (length >= kMaxLength()) {
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
- 'size: 0x' + kMaxLength().toString(16) + ' bytes')
- }
- return length | 0
-}
-
-function SlowBuffer (length) {
- if (+length != length) { // eslint-disable-line eqeqeq
- length = 0
- }
- return Buffer.alloc(+length)
-}
-
-Buffer.isBuffer = function isBuffer (b) {
- return !!(b != null && b._isBuffer)
-}
-
-Buffer.compare = function compare (a, b) {
- if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
- throw new TypeError('Arguments must be Buffers')
- }
-
- if (a === b) return 0
-
- var x = a.length
- var y = b.length
-
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
- if (a[i] !== b[i]) {
- x = a[i]
- y = b[i]
- break
- }
- }
-
- if (x < y) return -1
- if (y < x) return 1
- return 0
-}
-
-Buffer.isEncoding = function isEncoding (encoding) {
- switch (String(encoding).toLowerCase()) {
- case 'hex':
- case 'utf8':
- case 'utf-8':
- case 'ascii':
- case 'latin1':
- case 'binary':
- case 'base64':
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return true
- default:
- return false
- }
-}
-
-Buffer.concat = function concat (list, length) {
- if (!isArray(list)) {
- throw new TypeError('"list" argument must be an Array of Buffers')
- }
-
- if (list.length === 0) {
- return Buffer.alloc(0)
- }
-
- var i
- if (length === undefined) {
- length = 0
- for (i = 0; i < list.length; ++i) {
- length += list[i].length
- }
- }
-
- var buffer = Buffer.allocUnsafe(length)
- var pos = 0
- for (i = 0; i < list.length; ++i) {
- var buf = list[i]
- if (!Buffer.isBuffer(buf)) {
- throw new TypeError('"list" argument must be an Array of Buffers')
- }
- buf.copy(buffer, pos)
- pos += buf.length
- }
- return buffer
-}
-
-function byteLength (string, encoding) {
- if (Buffer.isBuffer(string)) {
- return string.length
- }
- if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
- (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
- return string.byteLength
- }
- if (typeof string !== 'string') {
- string = '' + string
- }
-
- var len = string.length
- if (len === 0) return 0
-
- // Use a for loop to avoid recursion
- var loweredCase = false
- for (;;) {
- switch (encoding) {
- case 'ascii':
- case 'latin1':
- case 'binary':
- return len
- case 'utf8':
- case 'utf-8':
- case undefined:
- return utf8ToBytes(string).length
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return len * 2
- case 'hex':
- return len >>> 1
- case 'base64':
- return base64ToBytes(string).length
- default:
- if (loweredCase) return utf8ToBytes(string).length // assume utf8
- encoding = ('' + encoding).toLowerCase()
- loweredCase = true
- }
- }
-}
-Buffer.byteLength = byteLength
-
-function slowToString (encoding, start, end) {
- var loweredCase = false
-
- // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
- // property of a typed array.
-
- // This behaves neither like String nor Uint8Array in that we set start/end
- // to their upper/lower bounds if the value passed is out of range.
- // undefined is handled specially as per ECMA-262 6th Edition,
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
- if (start === undefined || start < 0) {
- start = 0
- }
- // Return early if start > this.length. Done here to prevent potential uint32
- // coercion fail below.
- if (start > this.length) {
- return ''
- }
-
- if (end === undefined || end > this.length) {
- end = this.length
- }
-
- if (end <= 0) {
- return ''
- }
-
- // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
- end >>>= 0
- start >>>= 0
-
- if (end <= start) {
- return ''
- }
-
- if (!encoding) encoding = 'utf8'
-
- while (true) {
- switch (encoding) {
- case 'hex':
- return hexSlice(this, start, end)
-
- case 'utf8':
- case 'utf-8':
- return utf8Slice(this, start, end)
-
- case 'ascii':
- return asciiSlice(this, start, end)
-
- case 'latin1':
- case 'binary':
- return latin1Slice(this, start, end)
-
- case 'base64':
- return base64Slice(this, start, end)
-
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return utf16leSlice(this, start, end)
-
- default:
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
- encoding = (encoding + '').toLowerCase()
- loweredCase = true
- }
- }
-}
-
-// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
-// Buffer instances.
-Buffer.prototype._isBuffer = true
-
-function swap (b, n, m) {
- var i = b[n]
- b[n] = b[m]
- b[m] = i
-}
-
-Buffer.prototype.swap16 = function swap16 () {
- var len = this.length
- if (len % 2 !== 0) {
- throw new RangeError('Buffer size must be a multiple of 16-bits')
- }
- for (var i = 0; i < len; i += 2) {
- swap(this, i, i + 1)
- }
- return this
-}
-
-Buffer.prototype.swap32 = function swap32 () {
- var len = this.length
- if (len % 4 !== 0) {
- throw new RangeError('Buffer size must be a multiple of 32-bits')
- }
- for (var i = 0; i < len; i += 4) {
- swap(this, i, i + 3)
- swap(this, i + 1, i + 2)
- }
- return this
-}
-
-Buffer.prototype.swap64 = function swap64 () {
- var len = this.length
- if (len % 8 !== 0) {
- throw new RangeError('Buffer size must be a multiple of 64-bits')
- }
- for (var i = 0; i < len; i += 8) {
- swap(this, i, i + 7)
- swap(this, i + 1, i + 6)
- swap(this, i + 2, i + 5)
- swap(this, i + 3, i + 4)
- }
- return this
-}
-
-Buffer.prototype.toString = function toString () {
- var length = this.length | 0
- if (length === 0) return ''
- if (arguments.length === 0) return utf8Slice(this, 0, length)
- return slowToString.apply(this, arguments)
-}
-
-Buffer.prototype.equals = function equals (b) {
- if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
- if (this === b) return true
- return Buffer.compare(this, b) === 0
-}
-
-Buffer.prototype.inspect = function inspect () {
- var str = ''
- var max = exports.INSPECT_MAX_BYTES
- if (this.length > 0) {
- str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
- if (this.length > max) str += ' ... '
- }
- return '<Buffer ' + str + '>'
-}
-
-Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
- if (!Buffer.isBuffer(target)) {
- throw new TypeError('Argument must be a Buffer')
- }
-
- if (start === undefined) {
- start = 0
- }
- if (end === undefined) {
- end = target ? target.length : 0
- }
- if (thisStart === undefined) {
- thisStart = 0
- }
- if (thisEnd === undefined) {
- thisEnd = this.length
- }
-
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
- throw new RangeError('out of range index')
- }
-
- if (thisStart >= thisEnd && start >= end) {
- return 0
- }
- if (thisStart >= thisEnd) {
- return -1
- }
- if (start >= end) {
- return 1
- }
-
- start >>>= 0
- end >>>= 0
- thisStart >>>= 0
- thisEnd >>>= 0
-
- if (this === target) return 0
-
- var x = thisEnd - thisStart
- var y = end - start
- var len = Math.min(x, y)
-
- var thisCopy = this.slice(thisStart, thisEnd)
- var targetCopy = target.slice(start, end)
-
- for (var i = 0; i < len; ++i) {
- if (thisCopy[i] !== targetCopy[i]) {
- x = thisCopy[i]
- y = targetCopy[i]
- break
- }
- }
-
- if (x < y) return -1
- if (y < x) return 1
- return 0
-}
-
-// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
-// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
-//
-// Arguments:
-// - buffer - a Buffer to search
-// - val - a string, Buffer, or number
-// - byteOffset - an index into `buffer`; will be clamped to an int32
-// - encoding - an optional encoding, relevant is val is a string
-// - dir - true for indexOf, false for lastIndexOf
-function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
- // Empty buffer means no match
- if (buffer.length === 0) return -1
-
- // Normalize byteOffset
- if (typeof byteOffset === 'string') {
- encoding = byteOffset
- byteOffset = 0
- } else if (byteOffset > 0x7fffffff) {
- byteOffset = 0x7fffffff
- } else if (byteOffset < -0x80000000) {
- byteOffset = -0x80000000
- }
- byteOffset = +byteOffset // Coerce to Number.
- if (isNaN(byteOffset)) {
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
- byteOffset = dir ? 0 : (buffer.length - 1)
- }
-
- // Normalize byteOffset: negative offsets start from the end of the buffer
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset
- if (byteOffset >= buffer.length) {
- if (dir) return -1
- else byteOffset = buffer.length - 1
- } else if (byteOffset < 0) {
- if (dir) byteOffset = 0
- else return -1
- }
-
- // Normalize val
- if (typeof val === 'string') {
- val = Buffer.from(val, encoding)
- }
-
- // Finally, search either indexOf (if dir is true) or lastIndexOf
- if (Buffer.isBuffer(val)) {
- // Special case: looking for empty string/buffer always fails
- if (val.length === 0) {
- return -1
- }
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
- } else if (typeof val === 'number') {
- val = val & 0xFF // Search for a byte value [0-255]
- if (Buffer.TYPED_ARRAY_SUPPORT &&
- typeof Uint8Array.prototype.indexOf === 'function') {
- if (dir) {
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
- } else {
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
- }
- }
- return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
- }
-
- throw new TypeError('val must be string, number or Buffer')
-}
-
-function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
- var indexSize = 1
- var arrLength = arr.length
- var valLength = val.length
-
- if (encoding !== undefined) {
- encoding = String(encoding).toLowerCase()
- if (encoding === 'ucs2' || encoding === 'ucs-2' ||
- encoding === 'utf16le' || encoding === 'utf-16le') {
- if (arr.length < 2 || val.length < 2) {
- return -1
- }
- indexSize = 2
- arrLength /= 2
- valLength /= 2
- byteOffset /= 2
- }
- }
-
- function read (buf, i) {
- if (indexSize === 1) {
- return buf[i]
- } else {
- return buf.readUInt16BE(i * indexSize)
- }
- }
-
- var i
- if (dir) {
- var foundIndex = -1
- for (i = byteOffset; i < arrLength; i++) {
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
- if (foundIndex === -1) foundIndex = i
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
- } else {
- if (foundIndex !== -1) i -= i - foundIndex
- foundIndex = -1
- }
- }
- } else {
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
- for (i = byteOffset; i >= 0; i--) {
- var found = true
- for (var j = 0; j < valLength; j++) {
- if (read(arr, i + j) !== read(val, j)) {
- found = false
- break
- }
- }
- if (found) return i
- }
- }
-
- return -1
-}
-
-Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
- return this.indexOf(val, byteOffset, encoding) !== -1
-}
-
-Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
-}
-
-Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
-}
-
-function hexWrite (buf, string, offset, length) {
- offset = Number(offset) || 0
- var remaining = buf.length - offset
- if (!length) {
- length = remaining
- } else {
- length = Number(length)
- if (length > remaining) {
- length = remaining
- }
- }
-
- // must be an even number of digits
- var strLen = string.length
- if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
-
- if (length > strLen / 2) {
- length = strLen / 2
- }
- for (var i = 0; i < length; ++i) {
- var parsed = parseInt(string.substr(i * 2, 2), 16)
- if (isNaN(parsed)) return i
- buf[offset + i] = parsed
- }
- return i
-}
-
-function utf8Write (buf, string, offset, length) {
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
-}
-
-function asciiWrite (buf, string, offset, length) {
- return blitBuffer(asciiToBytes(string), buf, offset, length)
-}
-
-function latin1Write (buf, string, offset, length) {
- return asciiWrite(buf, string, offset, length)
-}
-
-function base64Write (buf, string, offset, length) {
- return blitBuffer(base64ToBytes(string), buf, offset, length)
-}
-
-function ucs2Write (buf, string, offset, length) {
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
-}
-
-Buffer.prototype.write = function write (string, offset, length, encoding) {
- // Buffer#write(string)
- if (offset === undefined) {
- encoding = 'utf8'
- length = this.length
- offset = 0
- // Buffer#write(string, encoding)
- } else if (length === undefined && typeof offset === 'string') {
- encoding = offset
- length = this.length
- offset = 0
- // Buffer#write(string, offset[, length][, encoding])
- } else if (isFinite(offset)) {
- offset = offset | 0
- if (isFinite(length)) {
- length = length | 0
- if (encoding === undefined) encoding = 'utf8'
- } else {
- encoding = length
- length = undefined
- }
- // legacy write(string, encoding, offset, length) - remove in v0.13
- } else {
- throw new Error(
- 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
- )
- }
-
- var remaining = this.length - offset
- if (length === undefined || length > remaining) length = remaining
-
- if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
- throw new RangeError('Attempt to write outside buffer bounds')
- }
-
- if (!encoding) encoding = 'utf8'
-
- var loweredCase = false
- for (;;) {
- switch (encoding) {
- case 'hex':
- return hexWrite(this, string, offset, length)
-
- case 'utf8':
- case 'utf-8':
- return utf8Write(this, string, offset, length)
-
- case 'ascii':
- return asciiWrite(this, string, offset, length)
-
- case 'latin1':
- case 'binary':
- return latin1Write(this, string, offset, length)
-
- case 'base64':
- // Warning: maxLength not taken into account in base64Write
- return base64Write(this, string, offset, length)
-
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return ucs2Write(this, string, offset, length)
-
- default:
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
- encoding = ('' + encoding).toLowerCase()
- loweredCase = true
- }
- }
-}
-
-Buffer.prototype.toJSON = function toJSON () {
- return {
- type: 'Buffer',
- data: Array.prototype.slice.call(this._arr || this, 0)
- }
-}
-
-function base64Slice (buf, start, end) {
- if (start === 0 && end === buf.length) {
- return base64.fromByteArray(buf)
- } else {
- return base64.fromByteArray(buf.slice(start, end))
- }
-}
-
-function utf8Slice (buf, start, end) {
- end = Math.min(buf.length, end)
- var res = []
-
- var i = start
- while (i < end) {
- var firstByte = buf[i]
- var codePoint = null
- var bytesPerSequence = (firstByte > 0xEF) ? 4
- : (firstByte > 0xDF) ? 3
- : (firstByte > 0xBF) ? 2
- : 1
-
- if (i + bytesPerSequence <= end) {
- var secondByte, thirdByte, fourthByte, tempCodePoint
-
- switch (bytesPerSequence) {
- case 1:
- if (firstByte < 0x80) {
- codePoint = firstByte
- }
- break
- case 2:
- secondByte = buf[i + 1]
- if ((secondByte & 0xC0) === 0x80) {
- tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
- if (tempCodePoint > 0x7F) {
- codePoint = tempCodePoint
- }
- }
- break
- case 3:
- secondByte = buf[i + 1]
- thirdByte = buf[i + 2]
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
- codePoint = tempCodePoint
- }
- }
- break
- case 4:
- secondByte = buf[i + 1]
- thirdByte = buf[i + 2]
- fourthByte = buf[i + 3]
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
- codePoint = tempCodePoint
- }
- }
- }
- }
-
- if (codePoint === null) {
- // we did not generate a valid codePoint so insert a
- // replacement char (U+FFFD) and advance only 1 byte
- codePoint = 0xFFFD
- bytesPerSequence = 1
- } else if (codePoint > 0xFFFF) {
- // encode to utf16 (surrogate pair dance)
- codePoint -= 0x10000
- res.push(codePoint >>> 10 & 0x3FF | 0xD800)
- codePoint = 0xDC00 | codePoint & 0x3FF
- }
-
- res.push(codePoint)
- i += bytesPerSequence
- }
-
- return decodeCodePointsArray(res)
-}
-
-// Based on http://stackoverflow.com/a/22747272/680742, the browser with
-// the lowest limit is Chrome, with 0x10000 args.
-// We go 1 magnitude less, for safety
-var MAX_ARGUMENTS_LENGTH = 0x1000
-
-function decodeCodePointsArray (codePoints) {
- var len = codePoints.length
- if (len <= MAX_ARGUMENTS_LENGTH) {
- return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
- }
-
- // Decode in chunks to avoid "call stack size exceeded".
- var res = ''
- var i = 0
- while (i < len) {
- res += String.fromCharCode.apply(
- String,
- codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
- )
- }
- return res
-}
-
-function asciiSlice (buf, start, end) {
- var ret = ''
- end = Math.min(buf.length, end)
-
- for (var i = start; i < end; ++i) {
- ret += String.fromCharCode(buf[i] & 0x7F)
- }
- return ret
-}
-
-function latin1Slice (buf, start, end) {
- var ret = ''
- end = Math.min(buf.length, end)
-
- for (var i = start; i < end; ++i) {
- ret += String.fromCharCode(buf[i])
- }
- return ret
-}
-
-function hexSlice (buf, start, end) {
- var len = buf.length
-
- if (!start || start < 0) start = 0
- if (!end || end < 0 || end > len) end = len
-
- var out = ''
- for (var i = start; i < end; ++i) {
- out += toHex(buf[i])
- }
- return out
-}
-
-function utf16leSlice (buf, start, end) {
- var bytes = buf.slice(start, end)
- var res = ''
- for (var i = 0; i < bytes.length; i += 2) {
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
- }
- return res
-}
-
-Buffer.prototype.slice = function slice (start, end) {
- var len = this.length
- start = ~~start
- end = end === undefined ? len : ~~end
-
- if (start < 0) {
- start += len
- if (start < 0) start = 0
- } else if (start > len) {
- start = len
- }
-
- if (end < 0) {
- end += len
- if (end < 0) end = 0
- } else if (end > len) {
- end = len
- }
-
- if (end < start) end = start
-
- var newBuf
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- newBuf = this.subarray(start, end)
- newBuf.__proto__ = Buffer.prototype
- } else {
- var sliceLen = end - start
- newBuf = new Buffer(sliceLen, undefined)
- for (var i = 0; i < sliceLen; ++i) {
- newBuf[i] = this[i + start]
- }
- }
-
- return newBuf
-}
-
-/*
- * Need to make sure that buffer isn't trying to write out of bounds.
- */
-function checkOffset (offset, ext, length) {
- if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
-}
-
-Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) checkOffset(offset, byteLength, this.length)
-
- var val = this[offset]
- var mul = 1
- var i = 0
- while (++i < byteLength && (mul *= 0x100)) {
- val += this[offset + i] * mul
- }
-
- return val
-}
-
-Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) {
- checkOffset(offset, byteLength, this.length)
- }
-
- var val = this[offset + --byteLength]
- var mul = 1
- while (byteLength > 0 && (mul *= 0x100)) {
- val += this[offset + --byteLength] * mul
- }
-
- return val
-}
-
-Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 1, this.length)
- return this[offset]
-}
-
-Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- return this[offset] | (this[offset + 1] << 8)
-}
-
-Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- return (this[offset] << 8) | this[offset + 1]
-}
-
-Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
-
- return ((this[offset]) |
- (this[offset + 1] << 8) |
- (this[offset + 2] << 16)) +
- (this[offset + 3] * 0x1000000)
-}
-
-Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
-
- return (this[offset] * 0x1000000) +
- ((this[offset + 1] << 16) |
- (this[offset + 2] << 8) |
- this[offset + 3])
-}
-
-Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) checkOffset(offset, byteLength, this.length)
-
- var val = this[offset]
- var mul = 1
- var i = 0
- while (++i < byteLength && (mul *= 0x100)) {
- val += this[offset + i] * mul
- }
- mul *= 0x80
-
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
-
- return val
-}
-
-Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) checkOffset(offset, byteLength, this.length)
-
- var i = byteLength
- var mul = 1
- var val = this[offset + --i]
- while (i > 0 && (mul *= 0x100)) {
- val += this[offset + --i] * mul
- }
- mul *= 0x80
-
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
-
- return val
-}
-
-Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 1, this.length)
- if (!(this[offset] & 0x80)) return (this[offset])
- return ((0xff - this[offset] + 1) * -1)
-}
-
-Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- var val = this[offset] | (this[offset + 1] << 8)
- return (val & 0x8000) ? val | 0xFFFF0000 : val
-}
-
-Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- var val = this[offset + 1] | (this[offset] << 8)
- return (val & 0x8000) ? val | 0xFFFF0000 : val
-}
-
-Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
-
- return (this[offset]) |
- (this[offset + 1] << 8) |
- (this[offset + 2] << 16) |
- (this[offset + 3] << 24)
-}
-
-Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
-
- return (this[offset] << 24) |
- (this[offset + 1] << 16) |
- (this[offset + 2] << 8) |
- (this[offset + 3])
-}
-
-Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return ieee754.read(this, offset, true, 23, 4)
-}
-
-Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return ieee754.read(this, offset, false, 23, 4)
-}
-
-Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 8, this.length)
- return ieee754.read(this, offset, true, 52, 8)
-}
-
-Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 8, this.length)
- return ieee754.read(this, offset, false, 52, 8)
-}
-
-function checkInt (buf, value, offset, ext, max, min) {
- if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
-}
-
-Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) {
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
- checkInt(this, value, offset, byteLength, maxBytes, 0)
- }
-
- var mul = 1
- var i = 0
- this[offset] = value & 0xFF
- while (++i < byteLength && (mul *= 0x100)) {
- this[offset + i] = (value / mul) & 0xFF
- }
-
- return offset + byteLength
-}
-
-Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) {
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
- checkInt(this, value, offset, byteLength, maxBytes, 0)
- }
-
- var i = byteLength - 1
- var mul = 1
- this[offset + i] = value & 0xFF
- while (--i >= 0 && (mul *= 0x100)) {
- this[offset + i] = (value / mul) & 0xFF
- }
-
- return offset + byteLength
-}
-
-Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
- this[offset] = (value & 0xff)
- return offset + 1
-}
-
-function objectWriteUInt16 (buf, value, offset, littleEndian) {
- if (value < 0) value = 0xffff + value + 1
- for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
- buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
- (littleEndian ? i : 1 - i) * 8
- }
-}
-
-Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value & 0xff)
- this[offset + 1] = (value >>> 8)
- } else {
- objectWriteUInt16(this, value, offset, true)
- }
- return offset + 2
-}
-
-Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 8)
- this[offset + 1] = (value & 0xff)
- } else {
- objectWriteUInt16(this, value, offset, false)
- }
- return offset + 2
-}
-
-function objectWriteUInt32 (buf, value, offset, littleEndian) {
- if (value < 0) value = 0xffffffff + value + 1
- for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
- buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
- }
-}
-
-Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset + 3] = (value >>> 24)
- this[offset + 2] = (value >>> 16)
- this[offset + 1] = (value >>> 8)
- this[offset] = (value & 0xff)
- } else {
- objectWriteUInt32(this, value, offset, true)
- }
- return offset + 4
-}
-
-Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 24)
- this[offset + 1] = (value >>> 16)
- this[offset + 2] = (value >>> 8)
- this[offset + 3] = (value & 0xff)
- } else {
- objectWriteUInt32(this, value, offset, false)
- }
- return offset + 4
-}
-
-Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) {
- var limit = Math.pow(2, 8 * byteLength - 1)
-
- checkInt(this, value, offset, byteLength, limit - 1, -limit)
- }
-
- var i = 0
- var mul = 1
- var sub = 0
- this[offset] = value & 0xFF
- while (++i < byteLength && (mul *= 0x100)) {
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
- sub = 1
- }
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
- }
-
- return offset + byteLength
-}
-
-Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) {
- var limit = Math.pow(2, 8 * byteLength - 1)
-
- checkInt(this, value, offset, byteLength, limit - 1, -limit)
- }
-
- var i = byteLength - 1
- var mul = 1
- var sub = 0
- this[offset + i] = value & 0xFF
- while (--i >= 0 && (mul *= 0x100)) {
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
- sub = 1
- }
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
- }
-
- return offset + byteLength
-}
-
-Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
- if (value < 0) value = 0xff + value + 1
- this[offset] = (value & 0xff)
- return offset + 1
-}
-
-Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value & 0xff)
- this[offset + 1] = (value >>> 8)
- } else {
- objectWriteUInt16(this, value, offset, true)
- }
- return offset + 2
-}
-
-Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 8)
- this[offset + 1] = (value & 0xff)
- } else {
- objectWriteUInt16(this, value, offset, false)
- }
- return offset + 2
-}
-
-Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value & 0xff)
- this[offset + 1] = (value >>> 8)
- this[offset + 2] = (value >>> 16)
- this[offset + 3] = (value >>> 24)
- } else {
- objectWriteUInt32(this, value, offset, true)
- }
- return offset + 4
-}
-
-Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
- if (value < 0) value = 0xffffffff + value + 1
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 24)
- this[offset + 1] = (value >>> 16)
- this[offset + 2] = (value >>> 8)
- this[offset + 3] = (value & 0xff)
- } else {
- objectWriteUInt32(this, value, offset, false)
- }
- return offset + 4
-}
-
-function checkIEEE754 (buf, value, offset, ext, max, min) {
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
- if (offset < 0) throw new RangeError('Index out of range')
-}
-
-function writeFloat (buf, value, offset, littleEndian, noAssert) {
- if (!noAssert) {
- checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
- }
- ieee754.write(buf, value, offset, littleEndian, 23, 4)
- return offset + 4
-}
-
-Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
- return writeFloat(this, value, offset, true, noAssert)
-}
-
-Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
- return writeFloat(this, value, offset, false, noAssert)
-}
-
-function writeDouble (buf, value, offset, littleEndian, noAssert) {
- if (!noAssert) {
- checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
- }
- ieee754.write(buf, value, offset, littleEndian, 52, 8)
- return offset + 8
-}
-
-Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
- return writeDouble(this, value, offset, true, noAssert)
-}
-
-Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
- return writeDouble(this, value, offset, false, noAssert)
-}
-
-// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
-Buffer.prototype.copy = function copy (target, targetStart, start, end) {
- if (!start) start = 0
- if (!end && end !== 0) end = this.length
- if (targetStart >= target.length) targetStart = target.length
- if (!targetStart) targetStart = 0
- if (end > 0 && end < start) end = start
-
- // Copy 0 bytes; we're done
- if (end === start) return 0
- if (target.length === 0 || this.length === 0) return 0
-
- // Fatal error conditions
- if (targetStart < 0) {
- throw new RangeError('targetStart out of bounds')
- }
- if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
- if (end < 0) throw new RangeError('sourceEnd out of bounds')
-
- // Are we oob?
- if (end > this.length) end = this.length
- if (target.length - targetStart < end - start) {
- end = target.length - targetStart + start
- }
-
- var len = end - start
- var i
-
- if (this === target && start < targetStart && targetStart < end) {
- // descending copy from end
- for (i = len - 1; i >= 0; --i) {
- target[i + targetStart] = this[i + start]
- }
- } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
- // ascending copy from start
- for (i = 0; i < len; ++i) {
- target[i + targetStart] = this[i + start]
- }
- } else {
- Uint8Array.prototype.set.call(
- target,
- this.subarray(start, start + len),
- targetStart
- )
- }
-
- return len
-}
-
-// Usage:
-// buffer.fill(number[, offset[, end]])
-// buffer.fill(buffer[, offset[, end]])
-// buffer.fill(string[, offset[, end]][, encoding])
-Buffer.prototype.fill = function fill (val, start, end, encoding) {
- // Handle string cases:
- if (typeof val === 'string') {
- if (typeof start === 'string') {
- encoding = start
- start = 0
- end = this.length
- } else if (typeof end === 'string') {
- encoding = end
- end = this.length
- }
- if (val.length === 1) {
- var code = val.charCodeAt(0)
- if (code < 256) {
- val = code
- }
- }
- if (encoding !== undefined && typeof encoding !== 'string') {
- throw new TypeError('encoding must be a string')
- }
- if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
- throw new TypeError('Unknown encoding: ' + encoding)
- }
- } else if (typeof val === 'number') {
- val = val & 255
- }
-
- // Invalid ranges are not set to a default, so can range check early.
- if (start < 0 || this.length < start || this.length < end) {
- throw new RangeError('Out of range index')
- }
-
- if (end <= start) {
- return this
- }
-
- start = start >>> 0
- end = end === undefined ? this.length : end >>> 0
-
- if (!val) val = 0
-
- var i
- if (typeof val === 'number') {
- for (i = start; i < end; ++i) {
- this[i] = val
- }
- } else {
- var bytes = Buffer.isBuffer(val)
- ? val
- : utf8ToBytes(new Buffer(val, encoding).toString())
- var len = bytes.length
- for (i = 0; i < end - start; ++i) {
- this[i + start] = bytes[i % len]
- }
- }
-
- return this
-}
-
-// HELPER FUNCTIONS
-// ================
-
-var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
-
-function base64clean (str) {
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
- str = stringtrim(str).replace(INVALID_BASE64_RE, '')
- // Node converts strings with length < 2 to ''
- if (str.length < 2) return ''
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
- while (str.length % 4 !== 0) {
- str = str + '='
- }
- return str
-}
-
-function stringtrim (str) {
- if (str.trim) return str.trim()
- return str.replace(/^\s+|\s+$/g, '')
-}
-
-function toHex (n) {
- if (n < 16) return '0' + n.toString(16)
- return n.toString(16)
-}
-
-function utf8ToBytes (string, units) {
- units = units || Infinity
- var codePoint
- var length = string.length
- var leadSurrogate = null
- var bytes = []
-
- for (var i = 0; i < length; ++i) {
- codePoint = string.charCodeAt(i)
-
- // is surrogate component
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
- // last char was a lead
- if (!leadSurrogate) {
- // no lead yet
- if (codePoint > 0xDBFF) {
- // unexpected trail
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- continue
- } else if (i + 1 === length) {
- // unpaired lead
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- continue
- }
-
- // valid lead
- leadSurrogate = codePoint
-
- continue
- }
-
- // 2 leads in a row
- if (codePoint < 0xDC00) {
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- leadSurrogate = codePoint
- continue
- }
-
- // valid surrogate pair
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
- } else if (leadSurrogate) {
- // valid bmp char, but last char was a lead
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- }
-
- leadSurrogate = null
-
- // encode utf8
- if (codePoint < 0x80) {
- if ((units -= 1) < 0) break
- bytes.push(codePoint)
- } else if (codePoint < 0x800) {
- if ((units -= 2) < 0) break
- bytes.push(
- codePoint >> 0x6 | 0xC0,
- codePoint & 0x3F | 0x80
- )
- } else if (codePoint < 0x10000) {
- if ((units -= 3) < 0) break
- bytes.push(
- codePoint >> 0xC | 0xE0,
- codePoint >> 0x6 & 0x3F | 0x80,
- codePoint & 0x3F | 0x80
- )
- } else if (codePoint < 0x110000) {
- if ((units -= 4) < 0) break
- bytes.push(
- codePoint >> 0x12 | 0xF0,
- codePoint >> 0xC & 0x3F | 0x80,
- codePoint >> 0x6 & 0x3F | 0x80,
- codePoint & 0x3F | 0x80
- )
- } else {
- throw new Error('Invalid code point')
- }
- }
-
- return bytes
-}
-
-function asciiToBytes (str) {
- var byteArray = []
- for (var i = 0; i < str.length; ++i) {
- // Node's code seems to be doing this and not & 0x7F..
- byteArray.push(str.charCodeAt(i) & 0xFF)
- }
- return byteArray
-}
-
-function utf16leToBytes (str, units) {
- var c, hi, lo
- var byteArray = []
- for (var i = 0; i < str.length; ++i) {
- if ((units -= 2) < 0) break
-
- c = str.charCodeAt(i)
- hi = c >> 8
- lo = c % 256
- byteArray.push(lo)
- byteArray.push(hi)
- }
-
- return byteArray
-}
-
-function base64ToBytes (str) {
- return base64.toByteArray(base64clean(str))
-}
-
-function blitBuffer (src, dst, offset, length) {
- for (var i = 0; i < length; ++i) {
- if ((i + offset >= dst.length) || (i >= src.length)) break
- dst[i + offset] = src[i]
- }
- return i
-}
-
-function isnan (val) {
- return val !== val // eslint-disable-line no-self-compare
-}
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"base64-js":39,"ieee754":50,"isarray":53}],45:[function(require,module,exports){
-(function (Buffer){
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// NOTE: These type checking functions intentionally don't use `instanceof`
-// because it is fragile and can be easily faked with `Object.create()`.
-
-function isArray(arg) {
- if (Array.isArray) {
- return Array.isArray(arg);
- }
- return objectToString(arg) === '[object Array]';
-}
-exports.isArray = isArray;
-
-function isBoolean(arg) {
- return typeof arg === 'boolean';
-}
-exports.isBoolean = isBoolean;
-
-function isNull(arg) {
- return arg === null;
-}
-exports.isNull = isNull;
-
-function isNullOrUndefined(arg) {
- return arg == null;
-}
-exports.isNullOrUndefined = isNullOrUndefined;
-
-function isNumber(arg) {
- return typeof arg === 'number';
-}
-exports.isNumber = isNumber;
-
-function isString(arg) {
- return typeof arg === 'string';
-}
-exports.isString = isString;
-
-function isSymbol(arg) {
- return typeof arg === 'symbol';
-}
-exports.isSymbol = isSymbol;
-
-function isUndefined(arg) {
- return arg === void 0;
-}
-exports.isUndefined = isUndefined;
-
-function isRegExp(re) {
- return objectToString(re) === '[object RegExp]';
-}
-exports.isRegExp = isRegExp;
-
-function isObject(arg) {
- return typeof arg === 'object' && arg !== null;
-}
-exports.isObject = isObject;
-
-function isDate(d) {
- return objectToString(d) === '[object Date]';
-}
-exports.isDate = isDate;
-
-function isError(e) {
- return (objectToString(e) === '[object Error]' || e instanceof Error);
-}
-exports.isError = isError;
-
-function isFunction(arg) {
- return typeof arg === 'function';
-}
-exports.isFunction = isFunction;
-
-function isPrimitive(arg) {
- return arg === null ||
- typeof arg === 'boolean' ||
- typeof arg === 'number' ||
- typeof arg === 'string' ||
- typeof arg === 'symbol' || // ES6 symbol
- typeof arg === 'undefined';
-}
-exports.isPrimitive = isPrimitive;
-
-exports.isBuffer = Buffer.isBuffer;
-
-function objectToString(o) {
- return Object.prototype.toString.call(o);
-}
-
-}).call(this,{"isBuffer":require("../../is-buffer/index.js")})
-},{"../../is-buffer/index.js":52}],46:[function(require,module,exports){
-/* See LICENSE file for terms of use */
-
-/*
- * Text diff implementation.
- *
- * This library supports the following APIS:
- * JsDiff.diffChars: Character by character diff
- * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
- * JsDiff.diffLines: Line based diff
- *
- * JsDiff.diffCss: Diff targeted at CSS content
- *
- * These methods are based on the implementation proposed in
- * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
- * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
- */
-(function(global, undefined) {
- var objectPrototypeToString = Object.prototype.toString;
-
- /*istanbul ignore next*/
- function map(arr, mapper, that) {
- if (Array.prototype.map) {
- return Array.prototype.map.call(arr, mapper, that);
- }
-
- var other = new Array(arr.length);
-
- for (var i = 0, n = arr.length; i < n; i++) {
- other[i] = mapper.call(that, arr[i], i, arr);
- }
- return other;
- }
- function clonePath(path) {
- return { newPos: path.newPos, components: path.components.slice(0) };
- }
- function removeEmpty(array) {
- var ret = [];
- for (var i = 0; i < array.length; i++) {
- if (array[i]) {
- ret.push(array[i]);
- }
- }
- return ret;
- }
- function escapeHTML(s) {
- var n = s;
- n = n.replace(/&/g, '&amp;');
- n = n.replace(/</g, '&lt;');
- n = n.replace(/>/g, '&gt;');
- n = n.replace(/"/g, '&quot;');
-
- return n;
- }
-
- // This function handles the presence of circular references by bailing out when encountering an
- // object that is already on the "stack" of items being processed.
- function canonicalize(obj, stack, replacementStack) {
- stack = stack || [];
- replacementStack = replacementStack || [];
-
- var i;
-
- for (i = 0; i < stack.length; i += 1) {
- if (stack[i] === obj) {
- return replacementStack[i];
- }
- }
-
- var canonicalizedObj;
-
- if ('[object Array]' === objectPrototypeToString.call(obj)) {
- stack.push(obj);
- canonicalizedObj = new Array(obj.length);
- replacementStack.push(canonicalizedObj);
- for (i = 0; i < obj.length; i += 1) {
- canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack);
- }
- stack.pop();
- replacementStack.pop();
- } else if (typeof obj === 'object' && obj !== null) {
- stack.push(obj);
- canonicalizedObj = {};
- replacementStack.push(canonicalizedObj);
- var sortedKeys = [],
- key;
- for (key in obj) {
- sortedKeys.push(key);
- }
- sortedKeys.sort();
- for (i = 0; i < sortedKeys.length; i += 1) {
- key = sortedKeys[i];
- canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack);
- }
- stack.pop();
- replacementStack.pop();
- } else {
- canonicalizedObj = obj;
- }
- return canonicalizedObj;
- }
-
- function buildValues(components, newString, oldString, useLongestToken) {
- var componentPos = 0,
- componentLen = components.length,
- newPos = 0,
- oldPos = 0;
-
- for (; componentPos < componentLen; componentPos++) {
- var component = components[componentPos];
- if (!component.removed) {
- if (!component.added && useLongestToken) {
- var value = newString.slice(newPos, newPos + component.count);
- value = map(value, function(value, i) {
- var oldValue = oldString[oldPos + i];
- return oldValue.length > value.length ? oldValue : value;
- });
-
- component.value = value.join('');
- } else {
- component.value = newString.slice(newPos, newPos + component.count).join('');
- }
- newPos += component.count;
-
- // Common case
- if (!component.added) {
- oldPos += component.count;
- }
- } else {
- component.value = oldString.slice(oldPos, oldPos + component.count).join('');
- oldPos += component.count;
-
- // Reverse add and remove so removes are output first to match common convention
- // The diffing algorithm is tied to add then remove output and this is the simplest
- // route to get the desired output with minimal overhead.
- if (componentPos && components[componentPos - 1].added) {
- var tmp = components[componentPos - 1];
- components[componentPos - 1] = components[componentPos];
- components[componentPos] = tmp;
- }
- }
- }
-
- return components;
- }
-
- function Diff(ignoreWhitespace) {
- this.ignoreWhitespace = ignoreWhitespace;
- }
- Diff.prototype = {
- diff: function(oldString, newString, callback) {
- var self = this;
-
- function done(value) {
- if (callback) {
- setTimeout(function() { callback(undefined, value); }, 0);
- return true;
- } else {
- return value;
- }
- }
-
- // Handle the identity case (this is due to unrolling editLength == 0
- if (newString === oldString) {
- return done([{ value: newString }]);
- }
- if (!newString) {
- return done([{ value: oldString, removed: true }]);
- }
- if (!oldString) {
- return done([{ value: newString, added: true }]);
- }
-
- newString = this.tokenize(newString);
- oldString = this.tokenize(oldString);
-
- var newLen = newString.length, oldLen = oldString.length;
- var editLength = 1;
- var maxEditLength = newLen + oldLen;
- var bestPath = [{ newPos: -1, components: [] }];
-
- // Seed editLength = 0, i.e. the content starts with the same values
- var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
- if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
- // Identity per the equality and tokenizer
- return done([{value: newString.join('')}]);
- }
-
- // Main worker method. checks all permutations of a given edit length for acceptance.
- function execEditLength() {
- for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
- var basePath;
- var addPath = bestPath[diagonalPath - 1],
- removePath = bestPath[diagonalPath + 1],
- oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
- if (addPath) {
- // No one else is going to attempt to use this value, clear it
- bestPath[diagonalPath - 1] = undefined;
- }
-
- var canAdd = addPath && addPath.newPos + 1 < newLen,
- canRemove = removePath && 0 <= oldPos && oldPos < oldLen;
- if (!canAdd && !canRemove) {
- // If this path is a terminal then prune
- bestPath[diagonalPath] = undefined;
- continue;
- }
-
- // Select the diagonal that we want to branch from. We select the prior
- // path whose position in the new string is the farthest from the origin
- // and does not pass the bounds of the diff graph
- if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
- basePath = clonePath(removePath);
- self.pushComponent(basePath.components, undefined, true);
- } else {
- basePath = addPath; // No need to clone, we've pulled it from the list
- basePath.newPos++;
- self.pushComponent(basePath.components, true, undefined);
- }
-
- oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
-
- // If we have hit the end of both strings, then we are done
- if (basePath.newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
- return done(buildValues(basePath.components, newString, oldString, self.useLongestToken));
- } else {
- // Otherwise track this path as a potential candidate and continue.
- bestPath[diagonalPath] = basePath;
- }
- }
-
- editLength++;
- }
-
- // Performs the length of edit iteration. Is a bit fugly as this has to support the
- // sync and async mode which is never fun. Loops over execEditLength until a value
- // is produced.
- if (callback) {
- (function exec() {
- setTimeout(function() {
- // This should not happen, but we want to be safe.
- /*istanbul ignore next */
- if (editLength > maxEditLength) {
- return callback();
- }
-
- if (!execEditLength()) {
- exec();
- }
- }, 0);
- }());
- } else {
- while (editLength <= maxEditLength) {
- var ret = execEditLength();
- if (ret) {
- return ret;
- }
- }
- }
- },
-
- pushComponent: function(components, added, removed) {
- var last = components[components.length - 1];
- if (last && last.added === added && last.removed === removed) {
- // We need to clone here as the component clone operation is just
- // as shallow array clone
- components[components.length - 1] = {count: last.count + 1, added: added, removed: removed };
- } else {
- components.push({count: 1, added: added, removed: removed });
- }
- },
- extractCommon: function(basePath, newString, oldString, diagonalPath) {
- var newLen = newString.length,
- oldLen = oldString.length,
- newPos = basePath.newPos,
- oldPos = newPos - diagonalPath,
-
- commonCount = 0;
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
- newPos++;
- oldPos++;
- commonCount++;
- }
-
- if (commonCount) {
- basePath.components.push({count: commonCount});
- }
-
- basePath.newPos = newPos;
- return oldPos;
- },
-
- equals: function(left, right) {
- var reWhitespace = /\S/;
- return left === right || (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right));
- },
- tokenize: function(value) {
- return value.split('');
- }
- };
-
- var CharDiff = new Diff();
-
- var WordDiff = new Diff(true);
- var WordWithSpaceDiff = new Diff();
- WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) {
- return removeEmpty(value.split(/(\s+|\b)/));
- };
-
- var CssDiff = new Diff(true);
- CssDiff.tokenize = function(value) {
- return removeEmpty(value.split(/([{}:;,]|\s+)/));
- };
-
- var LineDiff = new Diff();
-
- var TrimmedLineDiff = new Diff();
- TrimmedLineDiff.ignoreTrim = true;
-
- LineDiff.tokenize = TrimmedLineDiff.tokenize = function(value) {
- var retLines = [],
- lines = value.split(/^/m);
- for (var i = 0; i < lines.length; i++) {
- var line = lines[i],
- lastLine = lines[i - 1],
- lastLineLastChar = lastLine && lastLine[lastLine.length - 1];
-
- // Merge lines that may contain windows new lines
- if (line === '\n' && lastLineLastChar === '\r') {
- retLines[retLines.length - 1] = retLines[retLines.length - 1].slice(0, -1) + '\r\n';
- } else {
- if (this.ignoreTrim) {
- line = line.trim();
- // add a newline unless this is the last line.
- if (i < lines.length - 1) {
- line += '\n';
- }
- }
- retLines.push(line);
- }
- }
-
- return retLines;
- };
-
- var PatchDiff = new Diff();
- PatchDiff.tokenize = function(value) {
- var ret = [],
- linesAndNewlines = value.split(/(\n|\r\n)/);
-
- // Ignore the final empty token that occurs if the string ends with a new line
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
- linesAndNewlines.pop();
- }
-
- // Merge the content and line separators into single tokens
- for (var i = 0; i < linesAndNewlines.length; i++) {
- var line = linesAndNewlines[i];
-
- if (i % 2) {
- ret[ret.length - 1] += line;
- } else {
- ret.push(line);
- }
- }
- return ret;
- };
-
- var SentenceDiff = new Diff();
- SentenceDiff.tokenize = function(value) {
- return removeEmpty(value.split(/(\S.+?[.!?])(?=\s+|$)/));
- };
-
- var JsonDiff = new Diff();
- // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
- // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
- JsonDiff.useLongestToken = true;
- JsonDiff.tokenize = LineDiff.tokenize;
- JsonDiff.equals = function(left, right) {
- return LineDiff.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'));
- };
-
- var JsDiff = {
- Diff: Diff,
-
- diffChars: function(oldStr, newStr, callback) { return CharDiff.diff(oldStr, newStr, callback); },
- diffWords: function(oldStr, newStr, callback) { return WordDiff.diff(oldStr, newStr, callback); },
- diffWordsWithSpace: function(oldStr, newStr, callback) { return WordWithSpaceDiff.diff(oldStr, newStr, callback); },
- diffLines: function(oldStr, newStr, callback) { return LineDiff.diff(oldStr, newStr, callback); },
- diffTrimmedLines: function(oldStr, newStr, callback) { return TrimmedLineDiff.diff(oldStr, newStr, callback); },
-
- diffSentences: function(oldStr, newStr, callback) { return SentenceDiff.diff(oldStr, newStr, callback); },
-
- diffCss: function(oldStr, newStr, callback) { return CssDiff.diff(oldStr, newStr, callback); },
- diffJson: function(oldObj, newObj, callback) {
- return JsonDiff.diff(
- typeof oldObj === 'string' ? oldObj : JSON.stringify(canonicalize(oldObj), undefined, ' '),
- typeof newObj === 'string' ? newObj : JSON.stringify(canonicalize(newObj), undefined, ' '),
- callback
- );
- },
-
- createTwoFilesPatch: function(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader) {
- var ret = [];
-
- if (oldFileName == newFileName) {
- ret.push('Index: ' + oldFileName);
- }
- ret.push('===================================================================');
- ret.push('--- ' + oldFileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader));
- ret.push('+++ ' + newFileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader));
-
- var diff = PatchDiff.diff(oldStr, newStr);
- diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier
-
- // Formats a given set of lines for printing as context lines in a patch
- function contextLines(lines) {
- return map(lines, function(entry) { return ' ' + entry; });
- }
-
- // Outputs the no newline at end of file warning if needed
- function eofNL(curRange, i, current) {
- var last = diff[diff.length - 2],
- isLast = i === diff.length - 2,
- isLastOfType = i === diff.length - 3 && current.added !== last.added;
-
- // Figure out if this is the last line for the given file and missing NL
- if (!(/\n$/.test(current.value)) && (isLast || isLastOfType)) {
- curRange.push('\\ No newline at end of file');
- }
- }
-
- var oldRangeStart = 0, newRangeStart = 0, curRange = [],
- oldLine = 1, newLine = 1;
- for (var i = 0; i < diff.length; i++) {
- var current = diff[i],
- lines = current.lines || current.value.replace(/\n$/, '').split('\n');
- current.lines = lines;
-
- if (current.added || current.removed) {
- // If we have previous context, start with that
- if (!oldRangeStart) {
- var prev = diff[i - 1];
- oldRangeStart = oldLine;
- newRangeStart = newLine;
-
- if (prev) {
- curRange = contextLines(prev.lines.slice(-4));
- oldRangeStart -= curRange.length;
- newRangeStart -= curRange.length;
- }
- }
-
- // Output our changes
- curRange.push.apply(curRange, map(lines, function(entry) {
- return (current.added ? '+' : '-') + entry;
- }));
- eofNL(curRange, i, current);
-
- // Track the updated file position
- if (current.added) {
- newLine += lines.length;
- } else {
- oldLine += lines.length;
- }
- } else {
- // Identical context lines. Track line changes
- if (oldRangeStart) {
- // Close out any changes that have been output (or join overlapping)
- if (lines.length <= 8 && i < diff.length - 2) {
- // Overlapping
- curRange.push.apply(curRange, contextLines(lines));
- } else {
- // end the range and output
- var contextSize = Math.min(lines.length, 4);
- ret.push(
- '@@ -' + oldRangeStart + ',' + (oldLine - oldRangeStart + contextSize)
- + ' +' + newRangeStart + ',' + (newLine - newRangeStart + contextSize)
- + ' @@');
- ret.push.apply(ret, curRange);
- ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));
- if (lines.length <= 4) {
- eofNL(ret, i, current);
- }
-
- oldRangeStart = 0;
- newRangeStart = 0;
- curRange = [];
- }
- }
- oldLine += lines.length;
- newLine += lines.length;
- }
- }
-
- return ret.join('\n') + '\n';
- },
-
- createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {
- return JsDiff.createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader);
- },
-
- applyPatch: function(oldStr, uniDiff) {
- var diffstr = uniDiff.split('\n'),
- hunks = [],
- i = 0,
- remEOFNL = false,
- addEOFNL = false;
-
- // Skip to the first change hunk
- while (i < diffstr.length && !(/^@@/.test(diffstr[i]))) {
- i++;
- }
-
- // Parse the unified diff
- for (; i < diffstr.length; i++) {
- if (diffstr[i][0] === '@') {
- var chnukHeader = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);
- hunks.unshift({
- start: chnukHeader[3],
- oldlength: +chnukHeader[2],
- removed: [],
- newlength: chnukHeader[4],
- added: []
- });
- } else if (diffstr[i][0] === '+') {
- hunks[0].added.push(diffstr[i].substr(1));
- } else if (diffstr[i][0] === '-') {
- hunks[0].removed.push(diffstr[i].substr(1));
- } else if (diffstr[i][0] === ' ') {
- hunks[0].added.push(diffstr[i].substr(1));
- hunks[0].removed.push(diffstr[i].substr(1));
- } else if (diffstr[i][0] === '\\') {
- if (diffstr[i - 1][0] === '+') {
- remEOFNL = true;
- } else if (diffstr[i - 1][0] === '-') {
- addEOFNL = true;
- }
- }
- }
-
- // Apply the diff to the input
- var lines = oldStr.split('\n');
- for (i = hunks.length - 1; i >= 0; i--) {
- var hunk = hunks[i];
- // Sanity check the input string. Bail if we don't match.
- for (var j = 0; j < hunk.oldlength; j++) {
- if (lines[hunk.start - 1 + j] !== hunk.removed[j]) {
- return false;
- }
- }
- Array.prototype.splice.apply(lines, [hunk.start - 1, hunk.oldlength].concat(hunk.added));
- }
-
- // Handle EOFNL insertion/removal
- if (remEOFNL) {
- while (!lines[lines.length - 1]) {
- lines.pop();
- }
- } else if (addEOFNL) {
- lines.push('');
- }
- return lines.join('\n');
- },
-
- convertChangesToXML: function(changes) {
- var ret = [];
- for (var i = 0; i < changes.length; i++) {
- var change = changes[i];
- if (change.added) {
- ret.push('<ins>');
- } else if (change.removed) {
- ret.push('<del>');
- }
-
- ret.push(escapeHTML(change.value));
-
- if (change.added) {
- ret.push('</ins>');
- } else if (change.removed) {
- ret.push('</del>');
- }
- }
- return ret.join('');
- },
-
- // See: http://code.google.com/p/google-diff-match-patch/wiki/API
- convertChangesToDMP: function(changes) {
- var ret = [],
- change,
- operation;
- for (var i = 0; i < changes.length; i++) {
- change = changes[i];
- if (change.added) {
- operation = 1;
- } else if (change.removed) {
- operation = -1;
- } else {
- operation = 0;
- }
-
- ret.push([operation, change.value]);
- }
- return ret;
- },
-
- canonicalize: canonicalize
- };
-
- /*istanbul ignore next */
- /*global module */
- if (typeof module !== 'undefined' && module.exports) {
- module.exports = JsDiff;
- } else if (false) {
- /*global define */
- define([], function() { return JsDiff; });
- } else if (typeof global.JsDiff === 'undefined') {
- global.JsDiff = JsDiff;
- }
-}(this));
-
-},{}],47:[function(require,module,exports){
-'use strict';
-
-var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
-
-module.exports = function (str) {
- if (typeof str !== 'string') {
- throw new TypeError('Expected a string');
- }
-
- return str.replace(matchOperatorsRe, '\\$&');
-};
-
-},{}],48:[function(require,module,exports){
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-function EventEmitter() {
- this._events = this._events || {};
- this._maxListeners = this._maxListeners || undefined;
-}
-module.exports = EventEmitter;
-
-// Backwards-compat with node 0.10.x
-EventEmitter.EventEmitter = EventEmitter;
-
-EventEmitter.prototype._events = undefined;
-EventEmitter.prototype._maxListeners = undefined;
-
-// By default EventEmitters will print a warning if more than 10 listeners are
-// added to it. This is a useful default which helps finding memory leaks.
-EventEmitter.defaultMaxListeners = 10;
-
-// Obviously not all Emitters should be limited to 10. This function allows
-// that to be increased. Set to zero for unlimited.
-EventEmitter.prototype.setMaxListeners = function(n) {
- if (!isNumber(n) || n < 0 || isNaN(n))
- throw TypeError('n must be a positive number');
- this._maxListeners = n;
- return this;
-};
-
-EventEmitter.prototype.emit = function(type) {
- var er, handler, len, args, i, listeners;
-
- if (!this._events)
- this._events = {};
-
- // If there is no 'error' event listener then throw.
- if (type === 'error') {
- if (!this._events.error ||
- (isObject(this._events.error) && !this._events.error.length)) {
- er = arguments[1];
- if (er instanceof Error) {
- throw er; // Unhandled 'error' event
- } else {
- // At least give some kind of context to the user
- var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
- err.context = er;
- throw err;
- }
- }
- }
-
- handler = this._events[type];
-
- if (isUndefined(handler))
- return false;
-
- if (isFunction(handler)) {
- switch (arguments.length) {
- // fast cases
- case 1:
- handler.call(this);
- break;
- case 2:
- handler.call(this, arguments[1]);
- break;
- case 3:
- handler.call(this, arguments[1], arguments[2]);
- break;
- // slower
- default:
- args = Array.prototype.slice.call(arguments, 1);
- handler.apply(this, args);
- }
- } else if (isObject(handler)) {
- args = Array.prototype.slice.call(arguments, 1);
- listeners = handler.slice();
- len = listeners.length;
- for (i = 0; i < len; i++)
- listeners[i].apply(this, args);
- }
-
- return true;
-};
-
-EventEmitter.prototype.addListener = function(type, listener) {
- var m;
-
- if (!isFunction(listener))
- throw TypeError('listener must be a function');
-
- if (!this._events)
- this._events = {};
-
- // To avoid recursion in the case that type === "newListener"! Before
- // adding it to the listeners, first emit "newListener".
- if (this._events.newListener)
- this.emit('newListener', type,
- isFunction(listener.listener) ?
- listener.listener : listener);
-
- if (!this._events[type])
- // Optimize the case of one listener. Don't need the extra array object.
- this._events[type] = listener;
- else if (isObject(this._events[type]))
- // If we've already got an array, just append.
- this._events[type].push(listener);
- else
- // Adding the second element, need to change to array.
- this._events[type] = [this._events[type], listener];
-
- // Check for listener leak
- if (isObject(this._events[type]) && !this._events[type].warned) {
- if (!isUndefined(this._maxListeners)) {
- m = this._maxListeners;
- } else {
- m = EventEmitter.defaultMaxListeners;
- }
-
- if (m && m > 0 && this._events[type].length > m) {
- this._events[type].warned = true;
- console.error('(node) warning: possible EventEmitter memory ' +
- 'leak detected. %d listeners added. ' +
- 'Use emitter.setMaxListeners() to increase limit.',
- this._events[type].length);
- if (typeof console.trace === 'function') {
- // not supported in IE 10
- console.trace();
- }
- }
- }
-
- return this;
-};
-
-EventEmitter.prototype.on = EventEmitter.prototype.addListener;
-
-EventEmitter.prototype.once = function(type, listener) {
- if (!isFunction(listener))
- throw TypeError('listener must be a function');
-
- var fired = false;
-
- function g() {
- this.removeListener(type, g);
-
- if (!fired) {
- fired = true;
- listener.apply(this, arguments);
- }
- }
-
- g.listener = listener;
- this.on(type, g);
-
- return this;
-};
-
-// emits a 'removeListener' event iff the listener was removed
-EventEmitter.prototype.removeListener = function(type, listener) {
- var list, position, length, i;
-
- if (!isFunction(listener))
- throw TypeError('listener must be a function');
-
- if (!this._events || !this._events[type])
- return this;
-
- list = this._events[type];
- length = list.length;
- position = -1;
-
- if (list === listener ||
- (isFunction(list.listener) && list.listener === listener)) {
- delete this._events[type];
- if (this._events.removeListener)
- this.emit('removeListener', type, listener);
-
- } else if (isObject(list)) {
- for (i = length; i-- > 0;) {
- if (list[i] === listener ||
- (list[i].listener && list[i].listener === listener)) {
- position = i;
- break;
- }
- }
-
- if (position < 0)
- return this;
-
- if (list.length === 1) {
- list.length = 0;
- delete this._events[type];
- } else {
- list.splice(position, 1);
- }
-
- if (this._events.removeListener)
- this.emit('removeListener', type, listener);
- }
-
- return this;
-};
-
-EventEmitter.prototype.removeAllListeners = function(type) {
- var key, listeners;
-
- if (!this._events)
- return this;
-
- // not listening for removeListener, no need to emit
- if (!this._events.removeListener) {
- if (arguments.length === 0)
- this._events = {};
- else if (this._events[type])
- delete this._events[type];
- return this;
- }
-
- // emit removeListener for all listeners on all events
- if (arguments.length === 0) {
- for (key in this._events) {
- if (key === 'removeListener') continue;
- this.removeAllListeners(key);
- }
- this.removeAllListeners('removeListener');
- this._events = {};
- return this;
- }
-
- listeners = this._events[type];
-
- if (isFunction(listeners)) {
- this.removeListener(type, listeners);
- } else if (listeners) {
- // LIFO order
- while (listeners.length)
- this.removeListener(type, listeners[listeners.length - 1]);
- }
- delete this._events[type];
-
- return this;
-};
-
-EventEmitter.prototype.listeners = function(type) {
- var ret;
- if (!this._events || !this._events[type])
- ret = [];
- else if (isFunction(this._events[type]))
- ret = [this._events[type]];
- else
- ret = this._events[type].slice();
- return ret;
-};
-
-EventEmitter.prototype.listenerCount = function(type) {
- if (this._events) {
- var evlistener = this._events[type];
-
- if (isFunction(evlistener))
- return 1;
- else if (evlistener)
- return evlistener.length;
- }
- return 0;
-};
-
-EventEmitter.listenerCount = function(emitter, type) {
- return emitter.listenerCount(type);
-};
-
-function isFunction(arg) {
- return typeof arg === 'function';
-}
-
-function isNumber(arg) {
- return typeof arg === 'number';
-}
-
-function isObject(arg) {
- return typeof arg === 'object' && arg !== null;
-}
-
-function isUndefined(arg) {
- return arg === void 0;
-}
-
-},{}],49:[function(require,module,exports){
-(function (process){
-// Growl - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
-
-/**
- * Module dependencies.
- */
-
-var exec = require('child_process').exec
- , fs = require('fs')
- , path = require('path')
- , exists = fs.existsSync || path.existsSync
- , os = require('os')
- , quote = JSON.stringify
- , cmd;
-
-function which(name) {
- var paths = process.env.PATH.split(':');
- var loc;
-
- for (var i = 0, len = paths.length; i < len; ++i) {
- loc = path.join(paths[i], name);
- if (exists(loc)) return loc;
- }
-}
-
-switch(os.type()) {
- case 'Darwin':
- if (which('terminal-notifier')) {
- cmd = {
- type: "Darwin-NotificationCenter"
- , pkg: "terminal-notifier"
- , msg: '-message'
- , title: '-title'
- , subtitle: '-subtitle'
- , icon: '-appIcon'
- , sound: '-sound'
- , url: '-open'
- , priority: {
- cmd: '-execute'
- , range: []
- }
- };
- } else {
- cmd = {
- type: "Darwin-Growl"
- , pkg: "growlnotify"
- , msg: '-m'
- , sticky: '--sticky'
- , priority: {
- cmd: '--priority'
- , range: [
- -2
- , -1
- , 0
- , 1
- , 2
- , "Very Low"
- , "Moderate"
- , "Normal"
- , "High"
- , "Emergency"
- ]
- }
- };
- }
- break;
- case 'Linux':
- if (which('growl')) {
- cmd = {
- type: "Linux-Growl"
- , pkg: "growl"
- , msg: '-m'
- , title: '-title'
- , subtitle: '-subtitle'
- , host: {
- cmd: '-H'
- , hostname: '192.168.33.1'
- }
- };
- } else {
- cmd = {
- type: "Linux"
- , pkg: "notify-send"
- , msg: ''
- , sticky: '-t 0'
- , icon: '-i'
- , priority: {
- cmd: '-u'
- , range: [
- "low"
- , "normal"
- , "critical"
- ]
- }
- };
- }
- break;
- case 'Windows_NT':
- cmd = {
- type: "Windows"
- , pkg: "growlnotify"
- , msg: ''
- , sticky: '/s:true'
- , title: '/t:'
- , icon: '/i:'
- , url: '/cu:'
- , priority: {
- cmd: '/p:'
- , range: [
- -2
- , -1
- , 0
- , 1
- , 2
- ]
- }
- };
- break;
-}
-
-/**
- * Expose `growl`.
- */
-
-exports = module.exports = growl;
-
-/**
- * Node-growl version.
- */
-
-exports.version = '1.4.1'
-
-/**
- * Send growl notification _msg_ with _options_.
- *
- * Options:
- *
- * - title Notification title
- * - sticky Make the notification stick (defaults to false)
- * - priority Specify an int or named key (default is 0)
- * - name Application name (defaults to growlnotify)
- * - sound Sound efect ( in OSx defined in preferences -> sound -> effects) * works only in OSX > 10.8x
- * - image
- * - path to an icon sets --iconpath
- * - path to an image sets --image
- * - capitalized word sets --appIcon
- * - filename uses extname as --icon
- * - otherwise treated as --icon
- *
- * Examples:
- *
- * growl('New email')
- * growl('5 new emails', { title: 'Thunderbird' })
- * growl('5 new emails', { title: 'Thunderbird', sound: 'Purr' })
- * growl('Email sent', function(){
- * // ... notification sent
- * })
- *
- * @param {string} msg
- * @param {object} options
- * @param {function} fn
- * @api public
- */
-
-function growl(msg, options, fn) {
- var image
- , args
- , options = options || {}
- , fn = fn || function(){};
-
- if (options.exec) {
- cmd = {
- type: "Custom"
- , pkg: options.exec
- , range: []
- };
- }
-
- // noop
- if (!cmd) return fn(new Error('growl not supported on this platform'));
- args = [cmd.pkg];
-
- // image
- if (image = options.image) {
- switch(cmd.type) {
- case 'Darwin-Growl':
- var flag, ext = path.extname(image).substr(1)
- flag = flag || ext == 'icns' && 'iconpath'
- flag = flag || /^[A-Z]/.test(image) && 'appIcon'
- flag = flag || /^png|gif|jpe?g$/.test(ext) && 'image'
- flag = flag || ext && (image = ext) && 'icon'
- flag = flag || 'icon'
- args.push('--' + flag, quote(image))
- break;
- case 'Darwin-NotificationCenter':
- args.push(cmd.icon, quote(image));
- break;
- case 'Linux':
- args.push(cmd.icon, quote(image));
- // libnotify defaults to sticky, set a hint for transient notifications
- if (!options.sticky) args.push('--hint=int:transient:1');
- break;
- case 'Windows':
- args.push(cmd.icon + quote(image));
- break;
- }
- }
-
- // sticky
- if (options.sticky) args.push(cmd.sticky);
-
- // priority
- if (options.priority) {
- var priority = options.priority + '';
- var checkindexOf = cmd.priority.range.indexOf(priority);
- if (~cmd.priority.range.indexOf(priority)) {
- args.push(cmd.priority, options.priority);
- }
- }
-
- //sound
- if(options.sound && cmd.type === 'Darwin-NotificationCenter'){
- args.push(cmd.sound, options.sound)
- }
-
- // name
- if (options.name && cmd.type === "Darwin-Growl") {
- args.push('--name', options.name);
- }
-
- switch(cmd.type) {
- case 'Darwin-Growl':
- args.push(cmd.msg);
- args.push(quote(msg).replace(/\\n/g, '\n'));
- if (options.title) args.push(quote(options.title));
- break;
- case 'Darwin-NotificationCenter':
- args.push(cmd.msg);
- var stringifiedMsg = quote(msg);
- var escapedMsg = stringifiedMsg.replace(/\\n/g, '\n');
- args.push(escapedMsg);
- if (options.title) {
- args.push(cmd.title);
- args.push(quote(options.title));
- }
- if (options.subtitle) {
- args.push(cmd.subtitle);
- args.push(quote(options.subtitle));
- }
- if (options.url) {
- args.push(cmd.url);
- args.push(quote(options.url));
- }
- break;
- case 'Linux-Growl':
- args.push(cmd.msg);
- args.push(quote(msg).replace(/\\n/g, '\n'));
- if (options.title) args.push(quote(options.title));
- if (cmd.host) {
- args.push(cmd.host.cmd, cmd.host.hostname)
- }
- break;
- case 'Linux':
- if (options.title) {
- args.push(quote(options.title));
- args.push(cmd.msg);
- args.push(quote(msg).replace(/\\n/g, '\n'));
- } else {
- args.push(quote(msg).replace(/\\n/g, '\n'));
- }
- break;
- case 'Windows':
- args.push(quote(msg).replace(/\\n/g, '\n'));
- if (options.title) args.push(cmd.title + quote(options.title));
- if (options.url) args.push(cmd.url + quote(options.url));
- break;
- case 'Custom':
- args[0] = (function(origCommand) {
- var message = options.title
- ? options.title + ': ' + msg
- : msg;
- var command = origCommand.replace(/(^|[^%])%s/g, '$1' + quote(message));
- if (command === origCommand) args.push(quote(message));
- return command;
- })(args[0]);
- break;
- }
-
- // execute
- exec(args.join(' '), fn);
-};
-
-}).call(this,require('_process'))
-},{"_process":67,"child_process":42,"fs":42,"os":65,"path":42}],50:[function(require,module,exports){
-exports.read = function (buffer, offset, isLE, mLen, nBytes) {
- var e, m
- var eLen = nBytes * 8 - mLen - 1
- var eMax = (1 << eLen) - 1
- var eBias = eMax >> 1
- var nBits = -7
- var i = isLE ? (nBytes - 1) : 0
- var d = isLE ? -1 : 1
- var s = buffer[offset + i]
-
- i += d
-
- e = s & ((1 << (-nBits)) - 1)
- s >>= (-nBits)
- nBits += eLen
- for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
-
- m = e & ((1 << (-nBits)) - 1)
- e >>= (-nBits)
- nBits += mLen
- for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
-
- if (e === 0) {
- e = 1 - eBias
- } else if (e === eMax) {
- return m ? NaN : ((s ? -1 : 1) * Infinity)
- } else {
- m = m + Math.pow(2, mLen)
- e = e - eBias
- }
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
-}
-
-exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
- var e, m, c
- var eLen = nBytes * 8 - mLen - 1
- var eMax = (1 << eLen) - 1
- var eBias = eMax >> 1
- var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
- var i = isLE ? 0 : (nBytes - 1)
- var d = isLE ? 1 : -1
- var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
-
- value = Math.abs(value)
-
- if (isNaN(value) || value === Infinity) {
- m = isNaN(value) ? 1 : 0
- e = eMax
- } else {
- e = Math.floor(Math.log(value) / Math.LN2)
- if (value * (c = Math.pow(2, -e)) < 1) {
- e--
- c *= 2
- }
- if (e + eBias >= 1) {
- value += rt / c
- } else {
- value += rt * Math.pow(2, 1 - eBias)
- }
- if (value * c >= 2) {
- e++
- c /= 2
- }
-
- if (e + eBias >= eMax) {
- m = 0
- e = eMax
- } else if (e + eBias >= 1) {
- m = (value * c - 1) * Math.pow(2, mLen)
- e = e + eBias
- } else {
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
- e = 0
- }
- }
-
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
-
- e = (e << mLen) | m
- eLen += mLen
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
-
- buffer[offset + i - d] |= s * 128
-}
-
-},{}],51:[function(require,module,exports){
-if (typeof Object.create === 'function') {
- // implementation from standard node.js 'util' module
- module.exports = function inherits(ctor, superCtor) {
- ctor.super_ = superCtor
- ctor.prototype = Object.create(superCtor.prototype, {
- constructor: {
- value: ctor,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- };
-} else {
- // old school shim for old browsers
- module.exports = function inherits(ctor, superCtor) {
- ctor.super_ = superCtor
- var TempCtor = function () {}
- TempCtor.prototype = superCtor.prototype
- ctor.prototype = new TempCtor()
- ctor.prototype.constructor = ctor
- }
-}
-
-},{}],52:[function(require,module,exports){
-/*!
- * Determine if an object is a Buffer
- *
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
- * @license MIT
- */
-
-// The _isBuffer check is for Safari 5-7 support, because it's missing
-// Object.prototype.constructor. Remove this eventually
-module.exports = function (obj) {
- return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
-}
-
-function isBuffer (obj) {
- return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
-}
-
-// For Node v0.10 support. Remove this eventually.
-function isSlowBuffer (obj) {
- return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
-}
-
-},{}],53:[function(require,module,exports){
-var toString = {}.toString;
-
-module.exports = Array.isArray || function (arr) {
- return toString.call(arr) == '[object Array]';
-};
-
-},{}],54:[function(require,module,exports){
-(function (global){
-/*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */
-;(function () {
- // Detect the `define` function exposed by asynchronous module loaders. The
- // strict `define` check is necessary for compatibility with `r.js`.
- var isLoader = false;
-
- // A set of types used to distinguish objects from primitives.
- var objectTypes = {
- "function": true,
- "object": true
- };
-
- // Detect the `exports` object exposed by CommonJS implementations.
- var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
-
- // Use the `global` object exposed by Node (including Browserify via
- // `insert-module-globals`), Narwhal, and Ringo as the default context,
- // and the `window` object in browsers. Rhino exports a `global` function
- // instead.
- var root = objectTypes[typeof window] && window || this,
- freeGlobal = freeExports && objectTypes[typeof module] && module && !module.nodeType && typeof global == "object" && global;
-
- if (freeGlobal && (freeGlobal["global"] === freeGlobal || freeGlobal["window"] === freeGlobal || freeGlobal["self"] === freeGlobal)) {
- root = freeGlobal;
- }
-
- // Public: Initializes JSON 3 using the given `context` object, attaching the
- // `stringify` and `parse` functions to the specified `exports` object.
- function runInContext(context, exports) {
- context || (context = root["Object"]());
- exports || (exports = root["Object"]());
-
- // Native constructor aliases.
- var Number = context["Number"] || root["Number"],
- String = context["String"] || root["String"],
- Object = context["Object"] || root["Object"],
- Date = context["Date"] || root["Date"],
- SyntaxError = context["SyntaxError"] || root["SyntaxError"],
- TypeError = context["TypeError"] || root["TypeError"],
- Math = context["Math"] || root["Math"],
- nativeJSON = context["JSON"] || root["JSON"];
-
- // Delegate to the native `stringify` and `parse` implementations.
- if (typeof nativeJSON == "object" && nativeJSON) {
- exports.stringify = nativeJSON.stringify;
- exports.parse = nativeJSON.parse;
- }
-
- // Convenience aliases.
- var objectProto = Object.prototype,
- getClass = objectProto.toString,
- isProperty, forEach, undef;
-
- // Test the `Date#getUTC*` methods. Based on work by @Yaffle.
- var isExtended = new Date(-3509827334573292);
- try {
- // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical
- // results for certain dates in Opera >= 10.53.
- isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 &&
- // Safari < 2.0.2 stores the internal millisecond time value correctly,
- // but clips the values returned by the date methods to the range of
- // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]).
- isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708;
- } catch (exception) {}
-
- // Internal: Determines whether the native `JSON.stringify` and `parse`
- // implementations are spec-compliant. Based on work by Ken Snyder.
- function has(name) {
- if (has[name] !== undef) {
- // Return cached feature test result.
- return has[name];
- }
- var isSupported;
- if (name == "bug-string-char-index") {
- // IE <= 7 doesn't support accessing string characters using square
- // bracket notation. IE 8 only supports this for primitives.
- isSupported = "a"[0] != "a";
- } else if (name == "json") {
- // Indicates whether both `JSON.stringify` and `JSON.parse` are
- // supported.
- isSupported = has("json-stringify") && has("json-parse");
- } else {
- var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';
- // Test `JSON.stringify`.
- if (name == "json-stringify") {
- var stringify = exports.stringify, stringifySupported = typeof stringify == "function" && isExtended;
- if (stringifySupported) {
- // A test function object with a custom `toJSON` method.
- (value = function () {
- return 1;
- }).toJSON = value;
- try {
- stringifySupported =
- // Firefox 3.1b1 and b2 serialize string, number, and boolean
- // primitives as object literals.
- stringify(0) === "0" &&
- // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object
- // literals.
- stringify(new Number()) === "0" &&
- stringify(new String()) == '""' &&
- // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or
- // does not define a canonical JSON representation (this applies to
- // objects with `toJSON` properties as well, *unless* they are nested
- // within an object or array).
- stringify(getClass) === undef &&
- // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and
- // FF 3.1b3 pass this test.
- stringify(undef) === undef &&
- // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,
- // respectively, if the value is omitted entirely.
- stringify() === undef &&
- // FF 3.1b1, 2 throw an error if the given value is not a number,
- // string, array, object, Boolean, or `null` literal. This applies to
- // objects with custom `toJSON` methods as well, unless they are nested
- // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`
- // methods entirely.
- stringify(value) === "1" &&
- stringify([value]) == "[1]" &&
- // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of
- // `"[null]"`.
- stringify([undef]) == "[null]" &&
- // YUI 3.0.0b1 fails to serialize `null` literals.
- stringify(null) == "null" &&
- // FF 3.1b1, 2 halts serialization if an array contains a function:
- // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3
- // elides non-JSON values from objects and arrays, unless they
- // define custom `toJSON` methods.
- stringify([undef, getClass, null]) == "[null,null,null]" &&
- // Simple serialization test. FF 3.1b1 uses Unicode escape sequences
- // where character escape codes are expected (e.g., `\b` => `\u0008`).
- stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized &&
- // FF 3.1b1 and b2 ignore the `filter` and `width` arguments.
- stringify(null, value) === "1" &&
- stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" &&
- // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly
- // serialize extended years.
- stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' &&
- // The milliseconds are optional in ES 5, but required in 5.1.
- stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' &&
- // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative
- // four-digit years instead of six-digit years. Credits: @Yaffle.
- stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' &&
- // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond
- // values less than 1000. Credits: @Yaffle.
- stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
- } catch (exception) {
- stringifySupported = false;
- }
- }
- isSupported = stringifySupported;
- }
- // Test `JSON.parse`.
- if (name == "json-parse") {
- var parse = exports.parse;
- if (typeof parse == "function") {
- try {
- // FF 3.1b1, b2 will throw an exception if a bare literal is provided.
- // Conforming implementations should also coerce the initial argument to
- // a string prior to parsing.
- if (parse("0") === 0 && !parse(false)) {
- // Simple parsing test.
- value = parse(serialized);
- var parseSupported = value["a"].length == 5 && value["a"][0] === 1;
- if (parseSupported) {
- try {
- // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings.
- parseSupported = !parse('"\t"');
- } catch (exception) {}
- if (parseSupported) {
- try {
- // FF 4.0 and 4.0.1 allow leading `+` signs and leading
- // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow
- // certain octal literals.
- parseSupported = parse("01") !== 1;
- } catch (exception) {}
- }
- if (parseSupported) {
- try {
- // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal
- // points. These environments, along with FF 3.1b1 and 2,
- // also allow trailing commas in JSON objects and arrays.
- parseSupported = parse("1.") !== 1;
- } catch (exception) {}
- }
- }
- }
- } catch (exception) {
- parseSupported = false;
- }
- }
- isSupported = parseSupported;
- }
- }
- return has[name] = !!isSupported;
- }
-
- if (!has("json")) {
- // Common `[[Class]]` name aliases.
- var functionClass = "[object Function]",
- dateClass = "[object Date]",
- numberClass = "[object Number]",
- stringClass = "[object String]",
- arrayClass = "[object Array]",
- booleanClass = "[object Boolean]";
-
- // Detect incomplete support for accessing string characters by index.
- var charIndexBuggy = has("bug-string-char-index");
-
- // Define additional utility methods if the `Date` methods are buggy.
- if (!isExtended) {
- var floor = Math.floor;
- // A mapping between the months of the year and the number of days between
- // January 1st and the first of the respective month.
- var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
- // Internal: Calculates the number of days between the Unix epoch and the
- // first day of the given month.
- var getDay = function (year, month) {
- return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400);
- };
- }
-
- // Internal: Determines if a property is a direct property of the given
- // object. Delegates to the native `Object#hasOwnProperty` method.
- if (!(isProperty = objectProto.hasOwnProperty)) {
- isProperty = function (property) {
- var members = {}, constructor;
- if ((members.__proto__ = null, members.__proto__ = {
- // The *proto* property cannot be set multiple times in recent
- // versions of Firefox and SeaMonkey.
- "toString": 1
- }, members).toString != getClass) {
- // Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but
- // supports the mutable *proto* property.
- isProperty = function (property) {
- // Capture and break the object's prototype chain (see section 8.6.2
- // of the ES 5.1 spec). The parenthesized expression prevents an
- // unsafe transformation by the Closure Compiler.
- var original = this.__proto__, result = property in (this.__proto__ = null, this);
- // Restore the original prototype chain.
- this.__proto__ = original;
- return result;
- };
- } else {
- // Capture a reference to the top-level `Object` constructor.
- constructor = members.constructor;
- // Use the `constructor` property to simulate `Object#hasOwnProperty` in
- // other environments.
- isProperty = function (property) {
- var parent = (this.constructor || constructor).prototype;
- return property in this && !(property in parent && this[property] === parent[property]);
- };
- }
- members = null;
- return isProperty.call(this, property);
- };
- }
-
- // Internal: Normalizes the `for...in` iteration algorithm across
- // environments. Each enumerated key is yielded to a `callback` function.
- forEach = function (object, callback) {
- var size = 0, Properties, members, property;
-
- // Tests for bugs in the current environment's `for...in` algorithm. The
- // `valueOf` property inherits the non-enumerable flag from
- // `Object.prototype` in older versions of IE, Netscape, and Mozilla.
- (Properties = function () {
- this.valueOf = 0;
- }).prototype.valueOf = 0;
-
- // Iterate over a new instance of the `Properties` class.
- members = new Properties();
- for (property in members) {
- // Ignore all properties inherited from `Object.prototype`.
- if (isProperty.call(members, property)) {
- size++;
- }
- }
- Properties = members = null;
-
- // Normalize the iteration algorithm.
- if (!size) {
- // A list of non-enumerable properties inherited from `Object.prototype`.
- members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"];
- // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable
- // properties.
- forEach = function (object, callback) {
- var isFunction = getClass.call(object) == functionClass, property, length;
- var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty;
- for (property in object) {
- // Gecko <= 1.0 enumerates the `prototype` property of functions under
- // certain conditions; IE does not.
- if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) {
- callback(property);
- }
- }
- // Manually invoke the callback for each non-enumerable property.
- for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property));
- };
- } else if (size == 2) {
- // Safari <= 2.0.4 enumerates shadowed properties twice.
- forEach = function (object, callback) {
- // Create a set of iterated properties.
- var members = {}, isFunction = getClass.call(object) == functionClass, property;
- for (property in object) {
- // Store each property name to prevent double enumeration. The
- // `prototype` property of functions is not enumerated due to cross-
- // environment inconsistencies.
- if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) {
- callback(property);
- }
- }
- };
- } else {
- // No bugs detected; use the standard `for...in` algorithm.
- forEach = function (object, callback) {
- var isFunction = getClass.call(object) == functionClass, property, isConstructor;
- for (property in object) {
- if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) {
- callback(property);
- }
- }
- // Manually invoke the callback for the `constructor` property due to
- // cross-environment inconsistencies.
- if (isConstructor || isProperty.call(object, (property = "constructor"))) {
- callback(property);
- }
- };
- }
- return forEach(object, callback);
- };
-
- // Public: Serializes a JavaScript `value` as a JSON string. The optional
- // `filter` argument may specify either a function that alters how object and
- // array members are serialized, or an array of strings and numbers that
- // indicates which properties should be serialized. The optional `width`
- // argument may be either a string or number that specifies the indentation
- // level of the output.
- if (!has("json-stringify")) {
- // Internal: A map of control characters and their escaped equivalents.
- var Escapes = {
- 92: "\\\\",
- 34: '\\"',
- 8: "\\b",
- 12: "\\f",
- 10: "\\n",
- 13: "\\r",
- 9: "\\t"
- };
-
- // Internal: Converts `value` into a zero-padded string such that its
- // length is at least equal to `width`. The `width` must be <= 6.
- var leadingZeroes = "000000";
- var toPaddedString = function (width, value) {
- // The `|| 0` expression is necessary to work around a bug in
- // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`.
- return (leadingZeroes + (value || 0)).slice(-width);
- };
-
- // Internal: Double-quotes a string `value`, replacing all ASCII control
- // characters (characters with code unit values between 0 and 31) with
- // their escaped equivalents. This is an implementation of the
- // `Quote(value)` operation defined in ES 5.1 section 15.12.3.
- var unicodePrefix = "\\u00";
- var quote = function (value) {
- var result = '"', index = 0, length = value.length, useCharIndex = !charIndexBuggy || length > 10;
- var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value);
- for (; index < length; index++) {
- var charCode = value.charCodeAt(index);
- // If the character is a control character, append its Unicode or
- // shorthand escape sequence; otherwise, append the character as-is.
- switch (charCode) {
- case 8: case 9: case 10: case 12: case 13: case 34: case 92:
- result += Escapes[charCode];
- break;
- default:
- if (charCode < 32) {
- result += unicodePrefix + toPaddedString(2, charCode.toString(16));
- break;
- }
- result += useCharIndex ? symbols[index] : value.charAt(index);
- }
- }
- return result + '"';
- };
-
- // Internal: Recursively serializes an object. Implements the
- // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.
- var serialize = function (property, object, callback, properties, whitespace, indentation, stack) {
- var value, className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, result;
- try {
- // Necessary for host object support.
- value = object[property];
- } catch (exception) {}
- if (typeof value == "object" && value) {
- className = getClass.call(value);
- if (className == dateClass && !isProperty.call(value, "toJSON")) {
- if (value > -1 / 0 && value < 1 / 0) {
- // Dates are serialized according to the `Date#toJSON` method
- // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15
- // for the ISO 8601 date time string format.
- if (getDay) {
- // Manually compute the year, month, date, hours, minutes,
- // seconds, and milliseconds if the `getUTC*` methods are
- // buggy. Adapted from @Yaffle's `date-shim` project.
- date = floor(value / 864e5);
- for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++);
- for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++);
- date = 1 + date - getDay(year, month);
- // The `time` value specifies the time within the day (see ES
- // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used
- // to compute `A modulo B`, as the `%` operator does not
- // correspond to the `modulo` operation for negative numbers.
- time = (value % 864e5 + 864e5) % 864e5;
- // The hours, minutes, seconds, and milliseconds are obtained by
- // decomposing the time within the day. See section 15.9.1.10.
- hours = floor(time / 36e5) % 24;
- minutes = floor(time / 6e4) % 60;
- seconds = floor(time / 1e3) % 60;
- milliseconds = time % 1e3;
- } else {
- year = value.getUTCFullYear();
- month = value.getUTCMonth();
- date = value.getUTCDate();
- hours = value.getUTCHours();
- minutes = value.getUTCMinutes();
- seconds = value.getUTCSeconds();
- milliseconds = value.getUTCMilliseconds();
- }
- // Serialize extended years correctly.
- value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) +
- "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) +
- // Months, dates, hours, minutes, and seconds should have two
- // digits; milliseconds should have three.
- "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) +
- // Milliseconds are optional in ES 5.0, but required in 5.1.
- "." + toPaddedString(3, milliseconds) + "Z";
- } else {
- value = null;
- }
- } else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) {
- // Prototype <= 1.6.1 adds non-standard `toJSON` methods to the
- // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3
- // ignores all `toJSON` methods on these objects unless they are
- // defined directly on an instance.
- value = value.toJSON(property);
- }
- }
- if (callback) {
- // If a replacement function was provided, call it to obtain the value
- // for serialization.
- value = callback.call(object, property, value);
- }
- if (value === null) {
- return "null";
- }
- className = getClass.call(value);
- if (className == booleanClass) {
- // Booleans are represented literally.
- return "" + value;
- } else if (className == numberClass) {
- // JSON numbers must be finite. `Infinity` and `NaN` are serialized as
- // `"null"`.
- return value > -1 / 0 && value < 1 / 0 ? "" + value : "null";
- } else if (className == stringClass) {
- // Strings are double-quoted and escaped.
- return quote("" + value);
- }
- // Recursively serialize objects and arrays.
- if (typeof value == "object") {
- // Check for cyclic structures. This is a linear search; performance
- // is inversely proportional to the number of unique nested objects.
- for (length = stack.length; length--;) {
- if (stack[length] === value) {
- // Cyclic structures cannot be serialized by `JSON.stringify`.
- throw TypeError();
- }
- }
- // Add the object to the stack of traversed objects.
- stack.push(value);
- results = [];
- // Save the current indentation level and indent one additional level.
- prefix = indentation;
- indentation += whitespace;
- if (className == arrayClass) {
- // Recursively serialize array elements.
- for (index = 0, length = value.length; index < length; index++) {
- element = serialize(index, value, callback, properties, whitespace, indentation, stack);
- results.push(element === undef ? "null" : element);
- }
- result = results.length ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]";
- } else {
- // Recursively serialize object members. Members are selected from
- // either a user-specified list of property names, or the object
- // itself.
- forEach(properties || value, function (property) {
- var element = serialize(property, value, callback, properties, whitespace, indentation, stack);
- if (element !== undef) {
- // According to ES 5.1 section 15.12.3: "If `gap` {whitespace}
- // is not the empty string, let `member` {quote(property) + ":"}
- // be the concatenation of `member` and the `space` character."
- // The "`space` character" refers to the literal space
- // character, not the `space` {width} argument provided to
- // `JSON.stringify`.
- results.push(quote(property) + ":" + (whitespace ? " " : "") + element);
- }
- });
- result = results.length ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}";
- }
- // Remove the object from the traversed object stack.
- stack.pop();
- return result;
- }
- };
-
- // Public: `JSON.stringify`. See ES 5.1 section 15.12.3.
- exports.stringify = function (source, filter, width) {
- var whitespace, callback, properties, className;
- if (objectTypes[typeof filter] && filter) {
- if ((className = getClass.call(filter)) == functionClass) {
- callback = filter;
- } else if (className == arrayClass) {
- // Convert the property names array into a makeshift set.
- properties = {};
- for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((className = getClass.call(value)), className == stringClass || className == numberClass) && (properties[value] = 1));
- }
- }
- if (width) {
- if ((className = getClass.call(width)) == numberClass) {
- // Convert the `width` to an integer and create a string containing
- // `width` number of space characters.
- if ((width -= width % 1) > 0) {
- for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " ");
- }
- } else if (className == stringClass) {
- whitespace = width.length <= 10 ? width : width.slice(0, 10);
- }
- }
- // Opera <= 7.54u2 discards the values associated with empty string keys
- // (`""`) only if they are used directly within an object member list
- // (e.g., `!("" in { "": 1})`).
- return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []);
- };
- }
-
- // Public: Parses a JSON source string.
- if (!has("json-parse")) {
- var fromCharCode = String.fromCharCode;
-
- // Internal: A map of escaped control characters and their unescaped
- // equivalents.
- var Unescapes = {
- 92: "\\",
- 34: '"',
- 47: "/",
- 98: "\b",
- 116: "\t",
- 110: "\n",
- 102: "\f",
- 114: "\r"
- };
-
- // Internal: Stores the parser state.
- var Index, Source;
-
- // Internal: Resets the parser state and throws a `SyntaxError`.
- var abort = function () {
- Index = Source = null;
- throw SyntaxError();
- };
-
- // Internal: Returns the next token, or `"$"` if the parser has reached
- // the end of the source string. A token may be a string, number, `null`
- // literal, or Boolean literal.
- var lex = function () {
- var source = Source, length = source.length, value, begin, position, isSigned, charCode;
- while (Index < length) {
- charCode = source.charCodeAt(Index);
- switch (charCode) {
- case 9: case 10: case 13: case 32:
- // Skip whitespace tokens, including tabs, carriage returns, line
- // feeds, and space characters.
- Index++;
- break;
- case 123: case 125: case 91: case 93: case 58: case 44:
- // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at
- // the current position.
- value = charIndexBuggy ? source.charAt(Index) : source[Index];
- Index++;
- return value;
- case 34:
- // `"` delimits a JSON string; advance to the next character and
- // begin parsing the string. String tokens are prefixed with the
- // sentinel `@` character to distinguish them from punctuators and
- // end-of-string tokens.
- for (value = "@", Index++; Index < length;) {
- charCode = source.charCodeAt(Index);
- if (charCode < 32) {
- // Unescaped ASCII control characters (those with a code unit
- // less than the space character) are not permitted.
- abort();
- } else if (charCode == 92) {
- // A reverse solidus (`\`) marks the beginning of an escaped
- // control character (including `"`, `\`, and `/`) or Unicode
- // escape sequence.
- charCode = source.charCodeAt(++Index);
- switch (charCode) {
- case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114:
- // Revive escaped control characters.
- value += Unescapes[charCode];
- Index++;
- break;
- case 117:
- // `\u` marks the beginning of a Unicode escape sequence.
- // Advance to the first character and validate the
- // four-digit code point.
- begin = ++Index;
- for (position = Index + 4; Index < position; Index++) {
- charCode = source.charCodeAt(Index);
- // A valid sequence comprises four hexdigits (case-
- // insensitive) that form a single hexadecimal value.
- if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) {
- // Invalid Unicode escape sequence.
- abort();
- }
- }
- // Revive the escaped character.
- value += fromCharCode("0x" + source.slice(begin, Index));
- break;
- default:
- // Invalid escape sequence.
- abort();
- }
- } else {
- if (charCode == 34) {
- // An unescaped double-quote character marks the end of the
- // string.
- break;
- }
- charCode = source.charCodeAt(Index);
- begin = Index;
- // Optimize for the common case where a string is valid.
- while (charCode >= 32 && charCode != 92 && charCode != 34) {
- charCode = source.charCodeAt(++Index);
- }
- // Append the string as-is.
- value += source.slice(begin, Index);
- }
- }
- if (source.charCodeAt(Index) == 34) {
- // Advance to the next character and return the revived string.
- Index++;
- return value;
- }
- // Unterminated string.
- abort();
- default:
- // Parse numbers and literals.
- begin = Index;
- // Advance past the negative sign, if one is specified.
- if (charCode == 45) {
- isSigned = true;
- charCode = source.charCodeAt(++Index);
- }
- // Parse an integer or floating-point value.
- if (charCode >= 48 && charCode <= 57) {
- // Leading zeroes are interpreted as octal literals.
- if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) {
- // Illegal octal literal.
- abort();
- }
- isSigned = false;
- // Parse the integer component.
- for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++);
- // Floats cannot contain a leading decimal point; however, this
- // case is already accounted for by the parser.
- if (source.charCodeAt(Index) == 46) {
- position = ++Index;
- // Parse the decimal component.
- for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
- if (position == Index) {
- // Illegal trailing decimal.
- abort();
- }
- Index = position;
- }
- // Parse exponents. The `e` denoting the exponent is
- // case-insensitive.
- charCode = source.charCodeAt(Index);
- if (charCode == 101 || charCode == 69) {
- charCode = source.charCodeAt(++Index);
- // Skip past the sign following the exponent, if one is
- // specified.
- if (charCode == 43 || charCode == 45) {
- Index++;
- }
- // Parse the exponential component.
- for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
- if (position == Index) {
- // Illegal empty exponent.
- abort();
- }
- Index = position;
- }
- // Coerce the parsed value to a JavaScript number.
- return +source.slice(begin, Index);
- }
- // A negative sign may only precede numbers.
- if (isSigned) {
- abort();
- }
- // `true`, `false`, and `null` literals.
- if (source.slice(Index, Index + 4) == "true") {
- Index += 4;
- return true;
- } else if (source.slice(Index, Index + 5) == "false") {
- Index += 5;
- return false;
- } else if (source.slice(Index, Index + 4) == "null") {
- Index += 4;
- return null;
- }
- // Unrecognized token.
- abort();
- }
- }
- // Return the sentinel `$` character if the parser has reached the end
- // of the source string.
- return "$";
- };
-
- // Internal: Parses a JSON `value` token.
- var get = function (value) {
- var results, hasMembers;
- if (value == "$") {
- // Unexpected end of input.
- abort();
- }
- if (typeof value == "string") {
- if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") {
- // Remove the sentinel `@` character.
- return value.slice(1);
- }
- // Parse object and array literals.
- if (value == "[") {
- // Parses a JSON array, returning a new JavaScript array.
- results = [];
- for (;; hasMembers || (hasMembers = true)) {
- value = lex();
- // A closing square bracket marks the end of the array literal.
- if (value == "]") {
- break;
- }
- // If the array literal contains elements, the current token
- // should be a comma separating the previous element from the
- // next.
- if (hasMembers) {
- if (value == ",") {
- value = lex();
- if (value == "]") {
- // Unexpected trailing `,` in array literal.
- abort();
- }
- } else {
- // A `,` must separate each array element.
- abort();
- }
- }
- // Elisions and leading commas are not permitted.
- if (value == ",") {
- abort();
- }
- results.push(get(value));
- }
- return results;
- } else if (value == "{") {
- // Parses a JSON object, returning a new JavaScript object.
- results = {};
- for (;; hasMembers || (hasMembers = true)) {
- value = lex();
- // A closing curly brace marks the end of the object literal.
- if (value == "}") {
- break;
- }
- // If the object literal contains members, the current token
- // should be a comma separator.
- if (hasMembers) {
- if (value == ",") {
- value = lex();
- if (value == "}") {
- // Unexpected trailing `,` in object literal.
- abort();
- }
- } else {
- // A `,` must separate each object member.
- abort();
- }
- }
- // Leading commas are not permitted, object property names must be
- // double-quoted strings, and a `:` must separate each property
- // name and value.
- if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") {
- abort();
- }
- results[value.slice(1)] = get(lex());
- }
- return results;
- }
- // Unexpected token encountered.
- abort();
- }
- return value;
- };
-
- // Internal: Updates a traversed object member.
- var update = function (source, property, callback) {
- var element = walk(source, property, callback);
- if (element === undef) {
- delete source[property];
- } else {
- source[property] = element;
- }
- };
-
- // Internal: Recursively traverses a parsed JSON object, invoking the
- // `callback` function for each value. This is an implementation of the
- // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.
- var walk = function (source, property, callback) {
- var value = source[property], length;
- if (typeof value == "object" && value) {
- // `forEach` can't be used to traverse an array in Opera <= 8.54
- // because its `Object#hasOwnProperty` implementation returns `false`
- // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`).
- if (getClass.call(value) == arrayClass) {
- for (length = value.length; length--;) {
- update(value, length, callback);
- }
- } else {
- forEach(value, function (property) {
- update(value, property, callback);
- });
- }
- }
- return callback.call(source, property, value);
- };
-
- // Public: `JSON.parse`. See ES 5.1 section 15.12.2.
- exports.parse = function (source, callback) {
- var result, value;
- Index = 0;
- Source = "" + source;
- result = get(lex());
- // If a JSON string contains multiple tokens, it is invalid.
- if (lex() != "$") {
- abort();
- }
- // Reset the parser state.
- Index = Source = null;
- return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result;
- };
- }
- }
-
- exports["runInContext"] = runInContext;
- return exports;
- }
-
- if (freeExports && !isLoader) {
- // Export for CommonJS environments.
- runInContext(root, freeExports);
- } else {
- // Export for web browsers and JavaScript engines.
- var nativeJSON = root.JSON,
- previousJSON = root["JSON3"],
- isRestored = false;
-
- var JSON3 = runInContext(root, (root["JSON3"] = {
- // Public: Restores the original value of the global `JSON` object and
- // returns a reference to the `JSON3` object.
- "noConflict": function () {
- if (!isRestored) {
- isRestored = true;
- root.JSON = nativeJSON;
- root["JSON3"] = previousJSON;
- nativeJSON = previousJSON = null;
- }
- return JSON3;
- }
- }));
-
- root.JSON = {
- "parse": JSON3.parse,
- "stringify": JSON3.stringify
- };
- }
-
- // Export for asynchronous module loaders.
- if (isLoader) {
- define(function () {
- return JSON3;
- });
- }
-}).call(this);
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],55:[function(require,module,exports){
-/**
- * lodash 3.2.0 (Custom Build) <https://lodash.com/>
- * Build: `lodash modern modularize exports="npm" -o ./`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-var baseCopy = require('lodash._basecopy'),
- keys = require('lodash.keys');
-
-/**
- * The base implementation of `_.assign` without support for argument juggling,
- * multiple sources, and `customizer` functions.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @returns {Object} Returns `object`.
- */
-function baseAssign(object, source) {
- return source == null
- ? object
- : baseCopy(source, keys(source), object);
-}
-
-module.exports = baseAssign;
-
-},{"lodash._basecopy":56,"lodash.keys":63}],56:[function(require,module,exports){
-/**
- * lodash 3.0.1 (Custom Build) <https://lodash.com/>
- * Build: `lodash modern modularize exports="npm" -o ./`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-
-/**
- * Copies properties of `source` to `object`.
- *
- * @private
- * @param {Object} source The object to copy properties from.
- * @param {Array} props The property names to copy.
- * @param {Object} [object={}] The object to copy properties to.
- * @returns {Object} Returns `object`.
- */
-function baseCopy(source, props, object) {
- object || (object = {});
-
- var index = -1,
- length = props.length;
-
- while (++index < length) {
- var key = props[index];
- object[key] = source[key];
- }
- return object;
-}
-
-module.exports = baseCopy;
-
-},{}],57:[function(require,module,exports){
-/**
- * lodash 3.0.3 (Custom Build) <https://lodash.com/>
- * Build: `lodash modern modularize exports="npm" -o ./`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-
-/**
- * The base implementation of `_.create` without support for assigning
- * properties to the created object.
- *
- * @private
- * @param {Object} prototype The object to inherit from.
- * @returns {Object} Returns the new object.
- */
-var baseCreate = (function() {
- function object() {}
- return function(prototype) {
- if (isObject(prototype)) {
- object.prototype = prototype;
- var result = new object;
- object.prototype = undefined;
- }
- return result || {};
- };
-}());
-
-/**
- * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
- * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(1);
- * // => false
- */
-function isObject(value) {
- // Avoid a V8 JIT bug in Chrome 19-20.
- // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
-}
-
-module.exports = baseCreate;
-
-},{}],58:[function(require,module,exports){
-/**
- * lodash 3.9.1 (Custom Build) <https://lodash.com/>
- * Build: `lodash modern modularize exports="npm" -o ./`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-
-/** `Object#toString` result references. */
-var funcTag = '[object Function]';
-
-/** Used to detect host constructors (Safari > 5). */
-var reIsHostCtor = /^\[object .+?Constructor\]$/;
-
-/**
- * Checks if `value` is object-like.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- */
-function isObjectLike(value) {
- return !!value && typeof value == 'object';
-}
-
-/** Used for native method references. */
-var objectProto = Object.prototype;
-
-/** Used to resolve the decompiled source of functions. */
-var fnToString = Function.prototype.toString;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty = objectProto.hasOwnProperty;
-
-/**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
-var objToString = objectProto.toString;
-
-/** Used to detect if a method is native. */
-var reIsNative = RegExp('^' +
- fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
-);
-
-/**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */
-function getNative(object, key) {
- var value = object == null ? undefined : object[key];
- return isNative(value) ? value : undefined;
-}
-
-/**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
-function isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in older versions of Chrome and Safari which return 'function' for regexes
- // and Safari 8 equivalents which return 'object' for typed array constructors.
- return isObject(value) && objToString.call(value) == funcTag;
-}
-
-/**
- * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
- * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(1);
- * // => false
- */
-function isObject(value) {
- // Avoid a V8 JIT bug in Chrome 19-20.
- // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
-}
-
-/**
- * Checks if `value` is a native function.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
- * @example
- *
- * _.isNative(Array.prototype.push);
- * // => true
- *
- * _.isNative(_);
- * // => false
- */
-function isNative(value) {
- if (value == null) {
- return false;
- }
- if (isFunction(value)) {
- return reIsNative.test(fnToString.call(value));
- }
- return isObjectLike(value) && reIsHostCtor.test(value);
-}
-
-module.exports = getNative;
-
-},{}],59:[function(require,module,exports){
-/**
- * lodash 3.0.9 (Custom Build) <https://lodash.com/>
- * Build: `lodash modern modularize exports="npm" -o ./`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-
-/** Used to detect unsigned integer values. */
-var reIsUint = /^\d+$/;
-
-/**
- * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
- * of an array-like value.
- */
-var MAX_SAFE_INTEGER = 9007199254740991;
-
-/**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new function.
- */
-function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
- };
-}
-
-/**
- * Gets the "length" property value of `object`.
- *
- * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
- * that affects Safari on at least iOS 8.1-8.3 ARM64.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {*} Returns the "length" value.
- */
-var getLength = baseProperty('length');
-
-/**
- * Checks if `value` is array-like.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- */
-function isArrayLike(value) {
- return value != null && isLength(getLength(value));
-}
-
-/**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
-function isIndex(value, length) {
- value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
- length = length == null ? MAX_SAFE_INTEGER : length;
- return value > -1 && value % 1 == 0 && value < length;
-}
-
-/**
- * Checks if the provided arguments are from an iteratee call.
- *
- * @private
- * @param {*} value The potential iteratee value argument.
- * @param {*} index The potential iteratee index or key argument.
- * @param {*} object The potential iteratee object argument.
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
- */
-function isIterateeCall(value, index, object) {
- if (!isObject(object)) {
- return false;
- }
- var type = typeof index;
- if (type == 'number'
- ? (isArrayLike(object) && isIndex(index, object.length))
- : (type == 'string' && index in object)) {
- var other = object[index];
- return value === value ? (value === other) : (other !== other);
- }
- return false;
-}
-
-/**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength).
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- */
-function isLength(value) {
- return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
-}
-
-/**
- * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
- * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(1);
- * // => false
- */
-function isObject(value) {
- // Avoid a V8 JIT bug in Chrome 19-20.
- // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
-}
-
-module.exports = isIterateeCall;
-
-},{}],60:[function(require,module,exports){
-/**
- * lodash 3.1.1 (Custom Build) <https://lodash.com/>
- * Build: `lodash modern modularize exports="npm" -o ./`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-var baseAssign = require('lodash._baseassign'),
- baseCreate = require('lodash._basecreate'),
- isIterateeCall = require('lodash._isiterateecall');
-
-/**
- * Creates an object that inherits from the given `prototype` object. If a
- * `properties` object is provided its own enumerable properties are assigned
- * to the created object.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} prototype The object to inherit from.
- * @param {Object} [properties] The properties to assign to the object.
- * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
- * @returns {Object} Returns the new object.
- * @example
- *
- * function Shape() {
- * this.x = 0;
- * this.y = 0;
- * }
- *
- * function Circle() {
- * Shape.call(this);
- * }
- *
- * Circle.prototype = _.create(Shape.prototype, {
- * 'constructor': Circle
- * });
- *
- * var circle = new Circle;
- * circle instanceof Circle;
- * // => true
- *
- * circle instanceof Shape;
- * // => true
- */
-function create(prototype, properties, guard) {
- var result = baseCreate(prototype);
- if (guard && isIterateeCall(prototype, properties, guard)) {
- properties = undefined;
- }
- return properties ? baseAssign(result, properties) : result;
-}
-
-module.exports = create;
-
-},{"lodash._baseassign":55,"lodash._basecreate":57,"lodash._isiterateecall":59}],61:[function(require,module,exports){
-/**
- * lodash (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */
-
-/** Used as references for various `Number` constants. */
-var MAX_SAFE_INTEGER = 9007199254740991;
-
-/** `Object#toString` result references. */
-var argsTag = '[object Arguments]',
- funcTag = '[object Function]',
- genTag = '[object GeneratorFunction]';
-
-/** Used for built-in method references. */
-var objectProto = Object.prototype;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty = objectProto.hasOwnProperty;
-
-/**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
-var objectToString = objectProto.toString;
-
-/** Built-in value references. */
-var propertyIsEnumerable = objectProto.propertyIsEnumerable;
-
-/**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
-function isArguments(value) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
- (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
-}
-
-/**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
-function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
-}
-
-/**
- * This method is like `_.isArrayLike` except that it also checks if `value`
- * is an object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object,
- * else `false`.
- * @example
- *
- * _.isArrayLikeObject([1, 2, 3]);
- * // => true
- *
- * _.isArrayLikeObject(document.body.children);
- * // => true
- *
- * _.isArrayLikeObject('abc');
- * // => false
- *
- * _.isArrayLikeObject(_.noop);
- * // => false
- */
-function isArrayLikeObject(value) {
- return isObjectLike(value) && isArrayLike(value);
-}
-
-/**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
-function isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
- var tag = isObject(value) ? objectToString.call(value) : '';
- return tag == funcTag || tag == genTag;
-}
-
-/**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */
-function isLength(value) {
- return typeof value == 'number' &&
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
-}
-
-/**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
-function isObject(value) {
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
-}
-
-/**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
-function isObjectLike(value) {
- return !!value && typeof value == 'object';
-}
-
-module.exports = isArguments;
-
-},{}],62:[function(require,module,exports){
-/**
- * lodash 3.0.4 (Custom Build) <https://lodash.com/>
- * Build: `lodash modern modularize exports="npm" -o ./`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-
-/** `Object#toString` result references. */
-var arrayTag = '[object Array]',
- funcTag = '[object Function]';
-
-/** Used to detect host constructors (Safari > 5). */
-var reIsHostCtor = /^\[object .+?Constructor\]$/;
-
-/**
- * Checks if `value` is object-like.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- */
-function isObjectLike(value) {
- return !!value && typeof value == 'object';
-}
-
-/** Used for native method references. */
-var objectProto = Object.prototype;
-
-/** Used to resolve the decompiled source of functions. */
-var fnToString = Function.prototype.toString;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty = objectProto.hasOwnProperty;
-
-/**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
-var objToString = objectProto.toString;
-
-/** Used to detect if a method is native. */
-var reIsNative = RegExp('^' +
- fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
-);
-
-/* Native method references for those with the same name as other `lodash` methods. */
-var nativeIsArray = getNative(Array, 'isArray');
-
-/**
- * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
- * of an array-like value.
- */
-var MAX_SAFE_INTEGER = 9007199254740991;
-
-/**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */
-function getNative(object, key) {
- var value = object == null ? undefined : object[key];
- return isNative(value) ? value : undefined;
-}
-
-/**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- */
-function isLength(value) {
- return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
-}
-
-/**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(function() { return arguments; }());
- * // => false
- */
-var isArray = nativeIsArray || function(value) {
- return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
-};
-
-/**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
-function isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in older versions of Chrome and Safari which return 'function' for regexes
- // and Safari 8 equivalents which return 'object' for typed array constructors.
- return isObject(value) && objToString.call(value) == funcTag;
-}
-
-/**
- * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
- * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(1);
- * // => false
- */
-function isObject(value) {
- // Avoid a V8 JIT bug in Chrome 19-20.
- // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
-}
-
-/**
- * Checks if `value` is a native function.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
- * @example
- *
- * _.isNative(Array.prototype.push);
- * // => true
- *
- * _.isNative(_);
- * // => false
- */
-function isNative(value) {
- if (value == null) {
- return false;
- }
- if (isFunction(value)) {
- return reIsNative.test(fnToString.call(value));
- }
- return isObjectLike(value) && reIsHostCtor.test(value);
-}
-
-module.exports = isArray;
-
-},{}],63:[function(require,module,exports){
-/**
- * lodash 3.1.2 (Custom Build) <https://lodash.com/>
- * Build: `lodash modern modularize exports="npm" -o ./`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-var getNative = require('lodash._getnative'),
- isArguments = require('lodash.isarguments'),
- isArray = require('lodash.isarray');
-
-/** Used to detect unsigned integer values. */
-var reIsUint = /^\d+$/;
-
-/** Used for native method references. */
-var objectProto = Object.prototype;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty = objectProto.hasOwnProperty;
-
-/* Native method references for those with the same name as other `lodash` methods. */
-var nativeKeys = getNative(Object, 'keys');
-
-/**
- * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
- * of an array-like value.
- */
-var MAX_SAFE_INTEGER = 9007199254740991;
-
-/**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new function.
- */
-function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
- };
-}
-
-/**
- * Gets the "length" property value of `object`.
- *
- * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
- * that affects Safari on at least iOS 8.1-8.3 ARM64.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {*} Returns the "length" value.
- */
-var getLength = baseProperty('length');
-
-/**
- * Checks if `value` is array-like.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- */
-function isArrayLike(value) {
- return value != null && isLength(getLength(value));
-}
-
-/**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
-function isIndex(value, length) {
- value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
- length = length == null ? MAX_SAFE_INTEGER : length;
- return value > -1 && value % 1 == 0 && value < length;
-}
-
-/**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- */
-function isLength(value) {
- return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
-}
-
-/**
- * A fallback implementation of `Object.keys` which creates an array of the
- * own enumerable property names of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
-function shimKeys(object) {
- var props = keysIn(object),
- propsLength = props.length,
- length = propsLength && object.length;
-
- var allowIndexes = !!length && isLength(length) &&
- (isArray(object) || isArguments(object));
-
- var index = -1,
- result = [];
-
- while (++index < propsLength) {
- var key = props[index];
- if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
- result.push(key);
- }
- }
- return result;
-}
-
-/**
- * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
- * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(1);
- * // => false
- */
-function isObject(value) {
- // Avoid a V8 JIT bug in Chrome 19-20.
- // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
-}
-
-/**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */
-var keys = !nativeKeys ? shimKeys : function(object) {
- var Ctor = object == null ? undefined : object.constructor;
- if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
- (typeof object != 'function' && isArrayLike(object))) {
- return shimKeys(object);
- }
- return isObject(object) ? nativeKeys(object) : [];
-};
-
-/**
- * Creates an array of the own and inherited enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keysIn(new Foo);
- * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
- */
-function keysIn(object) {
- if (object == null) {
- return [];
- }
- if (!isObject(object)) {
- object = Object(object);
- }
- var length = object.length;
- length = (length && isLength(length) &&
- (isArray(object) || isArguments(object)) && length) || 0;
-
- var Ctor = object.constructor,
- index = -1,
- isProto = typeof Ctor == 'function' && Ctor.prototype === object,
- result = Array(length),
- skipIndexes = length > 0;
-
- while (++index < length) {
- result[index] = (index + '');
- }
- for (var key in object) {
- if (!(skipIndexes && isIndex(key, length)) &&
- !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
- result.push(key);
- }
- }
- return result;
-}
-
-module.exports = keys;
-
-},{"lodash._getnative":58,"lodash.isarguments":61,"lodash.isarray":62}],64:[function(require,module,exports){
-(function (process){
-var path = require('path');
-var fs = require('fs');
-var _0777 = parseInt('0777', 8);
-
-module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
-
-function mkdirP (p, opts, f, made) {
- if (typeof opts === 'function') {
- f = opts;
- opts = {};
- }
- else if (!opts || typeof opts !== 'object') {
- opts = { mode: opts };
- }
-
- var mode = opts.mode;
- var xfs = opts.fs || fs;
-
- if (mode === undefined) {
- mode = _0777 & (~process.umask());
- }
- if (!made) made = null;
-
- var cb = f || function () {};
- p = path.resolve(p);
-
- xfs.mkdir(p, mode, function (er) {
- if (!er) {
- made = made || p;
- return cb(null, made);
- }
- switch (er.code) {
- case 'ENOENT':
- mkdirP(path.dirname(p), opts, function (er, made) {
- if (er) cb(er, made);
- else mkdirP(p, opts, cb, made);
- });
- break;
-
- // In the case of any other error, just see if there's a dir
- // there already. If so, then hooray! If not, then something
- // is borked.
- default:
- xfs.stat(p, function (er2, stat) {
- // if the stat fails, then that's super weird.
- // let the original error be the failure reason.
- if (er2 || !stat.isDirectory()) cb(er, made)
- else cb(null, made);
- });
- break;
- }
- });
-}
-
-mkdirP.sync = function sync (p, opts, made) {
- if (!opts || typeof opts !== 'object') {
- opts = { mode: opts };
- }
-
- var mode = opts.mode;
- var xfs = opts.fs || fs;
-
- if (mode === undefined) {
- mode = _0777 & (~process.umask());
- }
- if (!made) made = null;
-
- p = path.resolve(p);
-
- try {
- xfs.mkdirSync(p, mode);
- made = made || p;
- }
- catch (err0) {
- switch (err0.code) {
- case 'ENOENT' :
- made = sync(path.dirname(p), opts, made);
- sync(p, opts, made);
- break;
-
- // In the case of any other error, just see if there's a dir
- // there already. If so, then hooray! If not, then something
- // is borked.
- default:
- var stat;
- try {
- stat = xfs.statSync(p);
- }
- catch (err1) {
- throw err0;
- }
- if (!stat.isDirectory()) throw err0;
- break;
- }
- }
-
- return made;
-};
-
-}).call(this,require('_process'))
-},{"_process":67,"fs":42,"path":42}],65:[function(require,module,exports){
-exports.endianness = function () { return 'LE' };
-
-exports.hostname = function () {
- if (typeof location !== 'undefined') {
- return location.hostname
- }
- else return '';
-};
-
-exports.loadavg = function () { return [] };
-
-exports.uptime = function () { return 0 };
-
-exports.freemem = function () {
- return Number.MAX_VALUE;
-};
-
-exports.totalmem = function () {
- return Number.MAX_VALUE;
-};
-
-exports.cpus = function () { return [] };
-
-exports.type = function () { return 'Browser' };
-
-exports.release = function () {
- if (typeof navigator !== 'undefined') {
- return navigator.appVersion;
- }
- return '';
-};
-
-exports.networkInterfaces
-= exports.getNetworkInterfaces
-= function () { return {} };
-
-exports.arch = function () { return 'javascript' };
-
-exports.platform = function () { return 'browser' };
-
-exports.tmpdir = exports.tmpDir = function () {
- return '/tmp';
-};
-
-exports.EOL = '\n';
-
-},{}],66:[function(require,module,exports){
-(function (process){
-'use strict';
-
-if (!process.version ||
- process.version.indexOf('v0.') === 0 ||
- process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
- module.exports = nextTick;
-} else {
- module.exports = process.nextTick;
-}
-
-function nextTick(fn, arg1, arg2, arg3) {
- if (typeof fn !== 'function') {
- throw new TypeError('"callback" argument must be a function');
- }
- var len = arguments.length;
- var args, i;
- switch (len) {
- case 0:
- case 1:
- return process.nextTick(fn);
- case 2:
- return process.nextTick(function afterTickOne() {
- fn.call(null, arg1);
- });
- case 3:
- return process.nextTick(function afterTickTwo() {
- fn.call(null, arg1, arg2);
- });
- case 4:
- return process.nextTick(function afterTickThree() {
- fn.call(null, arg1, arg2, arg3);
- });
- default:
- args = new Array(len - 1);
- i = 0;
- while (i < args.length) {
- args[i++] = arguments[i];
- }
- return process.nextTick(function afterTick() {
- fn.apply(null, args);
- });
- }
-}
-
-}).call(this,require('_process'))
-},{"_process":67}],67:[function(require,module,exports){
-// shim for using process in browser
-var process = module.exports = {};
-
-// cached from whatever global is present so that test runners that stub it
-// don't break things. But we need to wrap it in a try catch in case it is
-// wrapped in strict mode code which doesn't define any globals. It's inside a
-// function because try/catches deoptimize in certain engines.
-
-var cachedSetTimeout;
-var cachedClearTimeout;
-
-function defaultSetTimout() {
- throw new Error('setTimeout has not been defined');
-}
-function defaultClearTimeout () {
- throw new Error('clearTimeout has not been defined');
-}
-(function () {
- try {
- if (typeof setTimeout === 'function') {
- cachedSetTimeout = setTimeout;
- } else {
- cachedSetTimeout = defaultSetTimout;
- }
- } catch (e) {
- cachedSetTimeout = defaultSetTimout;
- }
- try {
- if (typeof clearTimeout === 'function') {
- cachedClearTimeout = clearTimeout;
- } else {
- cachedClearTimeout = defaultClearTimeout;
- }
- } catch (e) {
- cachedClearTimeout = defaultClearTimeout;
- }
-} ())
-function runTimeout(fun) {
- if (cachedSetTimeout === setTimeout) {
- //normal enviroments in sane situations
- return setTimeout(fun, 0);
- }
- // if setTimeout wasn't available but was latter defined
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
- cachedSetTimeout = setTimeout;
- return setTimeout(fun, 0);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedSetTimeout(fun, 0);
- } catch(e){
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedSetTimeout.call(null, fun, 0);
- } catch(e){
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
- return cachedSetTimeout.call(this, fun, 0);
- }
- }
-
-
-}
-function runClearTimeout(marker) {
- if (cachedClearTimeout === clearTimeout) {
- //normal enviroments in sane situations
- return clearTimeout(marker);
- }
- // if clearTimeout wasn't available but was latter defined
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
- cachedClearTimeout = clearTimeout;
- return clearTimeout(marker);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedClearTimeout(marker);
- } catch (e){
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedClearTimeout.call(null, marker);
- } catch (e){
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
- return cachedClearTimeout.call(this, marker);
- }
- }
-
-
-
-}
-var queue = [];
-var draining = false;
-var currentQueue;
-var queueIndex = -1;
-
-function cleanUpNextTick() {
- if (!draining || !currentQueue) {
- return;
- }
- draining = false;
- if (currentQueue.length) {
- queue = currentQueue.concat(queue);
- } else {
- queueIndex = -1;
- }
- if (queue.length) {
- drainQueue();
- }
-}
-
-function drainQueue() {
- if (draining) {
- return;
- }
- var timeout = runTimeout(cleanUpNextTick);
- draining = true;
-
- var len = queue.length;
- while(len) {
- currentQueue = queue;
- queue = [];
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
- queueIndex = -1;
- len = queue.length;
- }
- currentQueue = null;
- draining = false;
- runClearTimeout(timeout);
-}
-
-process.nextTick = function (fun) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue.push(new Item(fun, args));
- if (queue.length === 1 && !draining) {
- runTimeout(drainQueue);
- }
-};
-
-// v8 likes predictible objects
-function Item(fun, array) {
- this.fun = fun;
- this.array = array;
-}
-Item.prototype.run = function () {
- this.fun.apply(null, this.array);
-};
-process.title = 'browser';
-process.browser = true;
-process.env = {};
-process.argv = [];
-process.version = ''; // empty string to avoid regexp issues
-process.versions = {};
-
-function noop() {}
-
-process.on = noop;
-process.addListener = noop;
-process.once = noop;
-process.off = noop;
-process.removeListener = noop;
-process.removeAllListeners = noop;
-process.emit = noop;
-
-process.binding = function (name) {
- throw new Error('process.binding is not supported');
-};
-
-process.cwd = function () { return '/' };
-process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
-};
-process.umask = function() { return 0; };
-
-},{}],68:[function(require,module,exports){
-module.exports = require("./lib/_stream_duplex.js")
-
-},{"./lib/_stream_duplex.js":69}],69:[function(require,module,exports){
-// a duplex stream is just a stream that is both readable and writable.
-// Since JS doesn't have multiple prototypal inheritance, this class
-// prototypally inherits from Readable, and then parasitically from
-// Writable.
-
-'use strict';
-
-/*<replacement>*/
-
-var objectKeys = Object.keys || function (obj) {
- var keys = [];
- for (var key in obj) {
- keys.push(key);
- }return keys;
-};
-/*</replacement>*/
-
-module.exports = Duplex;
-
-/*<replacement>*/
-var processNextTick = require('process-nextick-args');
-/*</replacement>*/
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-var Readable = require('./_stream_readable');
-var Writable = require('./_stream_writable');
-
-util.inherits(Duplex, Readable);
-
-var keys = objectKeys(Writable.prototype);
-for (var v = 0; v < keys.length; v++) {
- var method = keys[v];
- if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
-}
-
-function Duplex(options) {
- if (!(this instanceof Duplex)) return new Duplex(options);
-
- Readable.call(this, options);
- Writable.call(this, options);
-
- if (options && options.readable === false) this.readable = false;
-
- if (options && options.writable === false) this.writable = false;
-
- this.allowHalfOpen = true;
- if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
-
- this.once('end', onend);
-}
-
-// the no-half-open enforcer
-function onend() {
- // if we allow half-open state, or if the writable side ended,
- // then we're ok.
- if (this.allowHalfOpen || this._writableState.ended) return;
-
- // no more data can be written.
- // But allow more writes to happen in this tick.
- processNextTick(onEndNT, this);
-}
-
-function onEndNT(self) {
- self.end();
-}
-
-function forEach(xs, f) {
- for (var i = 0, l = xs.length; i < l; i++) {
- f(xs[i], i);
- }
-}
-},{"./_stream_readable":71,"./_stream_writable":73,"core-util-is":45,"inherits":51,"process-nextick-args":66}],70:[function(require,module,exports){
-// a passthrough stream.
-// basically just the most minimal sort of Transform stream.
-// Every written chunk gets output as-is.
-
-'use strict';
-
-module.exports = PassThrough;
-
-var Transform = require('./_stream_transform');
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-util.inherits(PassThrough, Transform);
-
-function PassThrough(options) {
- if (!(this instanceof PassThrough)) return new PassThrough(options);
-
- Transform.call(this, options);
-}
-
-PassThrough.prototype._transform = function (chunk, encoding, cb) {
- cb(null, chunk);
-};
-},{"./_stream_transform":72,"core-util-is":45,"inherits":51}],71:[function(require,module,exports){
-(function (process){
-'use strict';
-
-module.exports = Readable;
-
-/*<replacement>*/
-var processNextTick = require('process-nextick-args');
-/*</replacement>*/
-
-/*<replacement>*/
-var isArray = require('isarray');
-/*</replacement>*/
-
-Readable.ReadableState = ReadableState;
-
-/*<replacement>*/
-var EE = require('events').EventEmitter;
-
-var EElistenerCount = function (emitter, type) {
- return emitter.listeners(type).length;
-};
-/*</replacement>*/
-
-/*<replacement>*/
-var Stream;
-(function () {
- try {
- Stream = require('st' + 'ream');
- } catch (_) {} finally {
- if (!Stream) Stream = require('events').EventEmitter;
- }
-})();
-/*</replacement>*/
-
-var Buffer = require('buffer').Buffer;
-/*<replacement>*/
-var bufferShim = require('buffer-shims');
-/*</replacement>*/
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-/*<replacement>*/
-var debugUtil = require('util');
-var debug = void 0;
-if (debugUtil && debugUtil.debuglog) {
- debug = debugUtil.debuglog('stream');
-} else {
- debug = function () {};
-}
-/*</replacement>*/
-
-var BufferList = require('./internal/streams/BufferList');
-var StringDecoder;
-
-util.inherits(Readable, Stream);
-
-function prependListener(emitter, event, fn) {
- if (typeof emitter.prependListener === 'function') {
- return emitter.prependListener(event, fn);
- } else {
- // This is a hack to make sure that our error handler is attached before any
- // userland ones. NEVER DO THIS. This is here only because this code needs
- // to continue to work with older versions of Node.js that do not include
- // the prependListener() method. The goal is to eventually remove this hack.
- if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
- }
-}
-
-var Duplex;
-function ReadableState(options, stream) {
- Duplex = Duplex || require('./_stream_duplex');
-
- options = options || {};
-
- // object stream flag. Used to make read(n) ignore n and to
- // make all the buffer merging and length checks go away
- this.objectMode = !!options.objectMode;
-
- if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
-
- // the point at which it stops calling _read() to fill the buffer
- // Note: 0 is a valid value, means "don't call _read preemptively ever"
- var hwm = options.highWaterMark;
- var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
-
- // cast to ints.
- this.highWaterMark = ~ ~this.highWaterMark;
-
- // A linked list is used to store data chunks instead of an array because the
- // linked list can remove elements from the beginning faster than
- // array.shift()
- this.buffer = new BufferList();
- this.length = 0;
- this.pipes = null;
- this.pipesCount = 0;
- this.flowing = null;
- this.ended = false;
- this.endEmitted = false;
- this.reading = false;
-
- // a flag to be able to tell if the onwrite cb is called immediately,
- // or on a later tick. We set this to true at first, because any
- // actions that shouldn't happen until "later" should generally also
- // not happen before the first write call.
- this.sync = true;
-
- // whenever we return null, then we set a flag to say
- // that we're awaiting a 'readable' event emission.
- this.needReadable = false;
- this.emittedReadable = false;
- this.readableListening = false;
- this.resumeScheduled = false;
-
- // Crypto is kind of old and crusty. Historically, its default string
- // encoding is 'binary' so we have to make this configurable.
- // Everything else in the universe uses 'utf8', though.
- this.defaultEncoding = options.defaultEncoding || 'utf8';
-
- // when piping, we only care about 'readable' events that happen
- // after read()ing all the bytes and not getting any pushback.
- this.ranOut = false;
-
- // the number of writers that are awaiting a drain event in .pipe()s
- this.awaitDrain = 0;
-
- // if true, a maybeReadMore has been scheduled
- this.readingMore = false;
-
- this.decoder = null;
- this.encoding = null;
- if (options.encoding) {
- if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
- this.decoder = new StringDecoder(options.encoding);
- this.encoding = options.encoding;
- }
-}
-
-var Duplex;
-function Readable(options) {
- Duplex = Duplex || require('./_stream_duplex');
-
- if (!(this instanceof Readable)) return new Readable(options);
-
- this._readableState = new ReadableState(options, this);
-
- // legacy
- this.readable = true;
-
- if (options && typeof options.read === 'function') this._read = options.read;
-
- Stream.call(this);
-}
-
-// Manually shove something into the read() buffer.
-// This returns true if the highWaterMark has not been hit yet,
-// similar to how Writable.write() returns true if you should
-// write() some more.
-Readable.prototype.push = function (chunk, encoding) {
- var state = this._readableState;
-
- if (!state.objectMode && typeof chunk === 'string') {
- encoding = encoding || state.defaultEncoding;
- if (encoding !== state.encoding) {
- chunk = bufferShim.from(chunk, encoding);
- encoding = '';
- }
- }
-
- return readableAddChunk(this, state, chunk, encoding, false);
-};
-
-// Unshift should *always* be something directly out of read()
-Readable.prototype.unshift = function (chunk) {
- var state = this._readableState;
- return readableAddChunk(this, state, chunk, '', true);
-};
-
-Readable.prototype.isPaused = function () {
- return this._readableState.flowing === false;
-};
-
-function readableAddChunk(stream, state, chunk, encoding, addToFront) {
- var er = chunkInvalid(state, chunk);
- if (er) {
- stream.emit('error', er);
- } else if (chunk === null) {
- state.reading = false;
- onEofChunk(stream, state);
- } else if (state.objectMode || chunk && chunk.length > 0) {
- if (state.ended && !addToFront) {
- var e = new Error('stream.push() after EOF');
- stream.emit('error', e);
- } else if (state.endEmitted && addToFront) {
- var _e = new Error('stream.unshift() after end event');
- stream.emit('error', _e);
- } else {
- var skipAdd;
- if (state.decoder && !addToFront && !encoding) {
- chunk = state.decoder.write(chunk);
- skipAdd = !state.objectMode && chunk.length === 0;
- }
-
- if (!addToFront) state.reading = false;
-
- // Don't add to the buffer if we've decoded to an empty string chunk and
- // we're not in object mode
- if (!skipAdd) {
- // if we want the data now, just emit it.
- if (state.flowing && state.length === 0 && !state.sync) {
- stream.emit('data', chunk);
- stream.read(0);
- } else {
- // update the buffer info.
- state.length += state.objectMode ? 1 : chunk.length;
- if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
-
- if (state.needReadable) emitReadable(stream);
- }
- }
-
- maybeReadMore(stream, state);
- }
- } else if (!addToFront) {
- state.reading = false;
- }
-
- return needMoreData(state);
-}
-
-// if it's past the high water mark, we can push in some more.
-// Also, if we have no data yet, we can stand some
-// more bytes. This is to work around cases where hwm=0,
-// such as the repl. Also, if the push() triggered a
-// readable event, and the user called read(largeNumber) such that
-// needReadable was set, then we ought to push more, so that another
-// 'readable' event will be triggered.
-function needMoreData(state) {
- return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
-}
-
-// backwards compatibility.
-Readable.prototype.setEncoding = function (enc) {
- if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
- this._readableState.decoder = new StringDecoder(enc);
- this._readableState.encoding = enc;
- return this;
-};
-
-// Don't raise the hwm > 8MB
-var MAX_HWM = 0x800000;
-function computeNewHighWaterMark(n) {
- if (n >= MAX_HWM) {
- n = MAX_HWM;
- } else {
- // Get the next highest power of 2 to prevent increasing hwm excessively in
- // tiny amounts
- n--;
- n |= n >>> 1;
- n |= n >>> 2;
- n |= n >>> 4;
- n |= n >>> 8;
- n |= n >>> 16;
- n++;
- }
- return n;
-}
-
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function howMuchToRead(n, state) {
- if (n <= 0 || state.length === 0 && state.ended) return 0;
- if (state.objectMode) return 1;
- if (n !== n) {
- // Only flow one buffer at a time
- if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
- }
- // If we're asking for more than the current hwm, then raise the hwm.
- if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
- if (n <= state.length) return n;
- // Don't have enough
- if (!state.ended) {
- state.needReadable = true;
- return 0;
- }
- return state.length;
-}
-
-// you can override either this method, or the async _read(n) below.
-Readable.prototype.read = function (n) {
- debug('read', n);
- n = parseInt(n, 10);
- var state = this._readableState;
- var nOrig = n;
-
- if (n !== 0) state.emittedReadable = false;
-
- // if we're doing read(0) to trigger a readable event, but we
- // already have a bunch of data in the buffer, then just trigger
- // the 'readable' event and move on.
- if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
- debug('read: emitReadable', state.length, state.ended);
- if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
- return null;
- }
-
- n = howMuchToRead(n, state);
-
- // if we've ended, and we're now clear, then finish it up.
- if (n === 0 && state.ended) {
- if (state.length === 0) endReadable(this);
- return null;
- }
-
- // All the actual chunk generation logic needs to be
- // *below* the call to _read. The reason is that in certain
- // synthetic stream cases, such as passthrough streams, _read
- // may be a completely synchronous operation which may change
- // the state of the read buffer, providing enough data when
- // before there was *not* enough.
- //
- // So, the steps are:
- // 1. Figure out what the state of things will be after we do
- // a read from the buffer.
- //
- // 2. If that resulting state will trigger a _read, then call _read.
- // Note that this may be asynchronous, or synchronous. Yes, it is
- // deeply ugly to write APIs this way, but that still doesn't mean
- // that the Readable class should behave improperly, as streams are
- // designed to be sync/async agnostic.
- // Take note if the _read call is sync or async (ie, if the read call
- // has returned yet), so that we know whether or not it's safe to emit
- // 'readable' etc.
- //
- // 3. Actually pull the requested chunks out of the buffer and return.
-
- // if we need a readable event, then we need to do some reading.
- var doRead = state.needReadable;
- debug('need readable', doRead);
-
- // if we currently have less than the highWaterMark, then also read some
- if (state.length === 0 || state.length - n < state.highWaterMark) {
- doRead = true;
- debug('length less than watermark', doRead);
- }
-
- // however, if we've ended, then there's no point, and if we're already
- // reading, then it's unnecessary.
- if (state.ended || state.reading) {
- doRead = false;
- debug('reading or ended', doRead);
- } else if (doRead) {
- debug('do read');
- state.reading = true;
- state.sync = true;
- // if the length is currently zero, then we *need* a readable event.
- if (state.length === 0) state.needReadable = true;
- // call internal read method
- this._read(state.highWaterMark);
- state.sync = false;
- // If _read pushed data synchronously, then `reading` will be false,
- // and we need to re-evaluate how much data we can return to the user.
- if (!state.reading) n = howMuchToRead(nOrig, state);
- }
-
- var ret;
- if (n > 0) ret = fromList(n, state);else ret = null;
-
- if (ret === null) {
- state.needReadable = true;
- n = 0;
- } else {
- state.length -= n;
- }
-
- if (state.length === 0) {
- // If we have nothing in the buffer, then we want to know
- // as soon as we *do* get something into the buffer.
- if (!state.ended) state.needReadable = true;
-
- // If we tried to read() past the EOF, then emit end on the next tick.
- if (nOrig !== n && state.ended) endReadable(this);
- }
-
- if (ret !== null) this.emit('data', ret);
-
- return ret;
-};
-
-function chunkInvalid(state, chunk) {
- var er = null;
- if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
- er = new TypeError('Invalid non-string/buffer chunk');
- }
- return er;
-}
-
-function onEofChunk(stream, state) {
- if (state.ended) return;
- if (state.decoder) {
- var chunk = state.decoder.end();
- if (chunk && chunk.length) {
- state.buffer.push(chunk);
- state.length += state.objectMode ? 1 : chunk.length;
- }
- }
- state.ended = true;
-
- // emit 'readable' now to make sure it gets picked up.
- emitReadable(stream);
-}
-
-// Don't emit readable right away in sync mode, because this can trigger
-// another read() call => stack overflow. This way, it might trigger
-// a nextTick recursion warning, but that's not so bad.
-function emitReadable(stream) {
- var state = stream._readableState;
- state.needReadable = false;
- if (!state.emittedReadable) {
- debug('emitReadable', state.flowing);
- state.emittedReadable = true;
- if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
- }
-}
-
-function emitReadable_(stream) {
- debug('emit readable');
- stream.emit('readable');
- flow(stream);
-}
-
-// at this point, the user has presumably seen the 'readable' event,
-// and called read() to consume some data. that may have triggered
-// in turn another _read(n) call, in which case reading = true if
-// it's in progress.
-// However, if we're not ended, or reading, and the length < hwm,
-// then go ahead and try to read some more preemptively.
-function maybeReadMore(stream, state) {
- if (!state.readingMore) {
- state.readingMore = true;
- processNextTick(maybeReadMore_, stream, state);
- }
-}
-
-function maybeReadMore_(stream, state) {
- var len = state.length;
- while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
- debug('maybeReadMore read 0');
- stream.read(0);
- if (len === state.length)
- // didn't get any data, stop spinning.
- break;else len = state.length;
- }
- state.readingMore = false;
-}
-
-// abstract method. to be overridden in specific implementation classes.
-// call cb(er, data) where data is <= n in length.
-// for virtual (non-string, non-buffer) streams, "length" is somewhat
-// arbitrary, and perhaps not very meaningful.
-Readable.prototype._read = function (n) {
- this.emit('error', new Error('not implemented'));
-};
-
-Readable.prototype.pipe = function (dest, pipeOpts) {
- var src = this;
- var state = this._readableState;
-
- switch (state.pipesCount) {
- case 0:
- state.pipes = dest;
- break;
- case 1:
- state.pipes = [state.pipes, dest];
- break;
- default:
- state.pipes.push(dest);
- break;
- }
- state.pipesCount += 1;
- debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
-
- var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
-
- var endFn = doEnd ? onend : cleanup;
- if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
-
- dest.on('unpipe', onunpipe);
- function onunpipe(readable) {
- debug('onunpipe');
- if (readable === src) {
- cleanup();
- }
- }
-
- function onend() {
- debug('onend');
- dest.end();
- }
-
- // when the dest drains, it reduces the awaitDrain counter
- // on the source. This would be more elegant with a .once()
- // handler in flow(), but adding and removing repeatedly is
- // too slow.
- var ondrain = pipeOnDrain(src);
- dest.on('drain', ondrain);
-
- var cleanedUp = false;
- function cleanup() {
- debug('cleanup');
- // cleanup event handlers once the pipe is broken
- dest.removeListener('close', onclose);
- dest.removeListener('finish', onfinish);
- dest.removeListener('drain', ondrain);
- dest.removeListener('error', onerror);
- dest.removeListener('unpipe', onunpipe);
- src.removeListener('end', onend);
- src.removeListener('end', cleanup);
- src.removeListener('data', ondata);
-
- cleanedUp = true;
-
- // if the reader is waiting for a drain event from this
- // specific writer, then it would cause it to never start
- // flowing again.
- // So, if this is awaiting a drain, then we just call it now.
- // If we don't know, then assume that we are waiting for one.
- if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
- }
-
- // If the user pushes more data while we're writing to dest then we'll end up
- // in ondata again. However, we only want to increase awaitDrain once because
- // dest will only emit one 'drain' event for the multiple writes.
- // => Introduce a guard on increasing awaitDrain.
- var increasedAwaitDrain = false;
- src.on('data', ondata);
- function ondata(chunk) {
- debug('ondata');
- increasedAwaitDrain = false;
- var ret = dest.write(chunk);
- if (false === ret && !increasedAwaitDrain) {
- // If the user unpiped during `dest.write()`, it is possible
- // to get stuck in a permanently paused state if that write
- // also returned false.
- // => Check whether `dest` is still a piping destination.
- if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
- debug('false write response, pause', src._readableState.awaitDrain);
- src._readableState.awaitDrain++;
- increasedAwaitDrain = true;
- }
- src.pause();
- }
- }
-
- // if the dest has an error, then stop piping into it.
- // however, don't suppress the throwing behavior for this.
- function onerror(er) {
- debug('onerror', er);
- unpipe();
- dest.removeListener('error', onerror);
- if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
- }
-
- // Make sure our error handler is attached before userland ones.
- prependListener(dest, 'error', onerror);
-
- // Both close and finish should trigger unpipe, but only once.
- function onclose() {
- dest.removeListener('finish', onfinish);
- unpipe();
- }
- dest.once('close', onclose);
- function onfinish() {
- debug('onfinish');
- dest.removeListener('close', onclose);
- unpipe();
- }
- dest.once('finish', onfinish);
-
- function unpipe() {
- debug('unpipe');
- src.unpipe(dest);
- }
-
- // tell the dest that it's being piped to
- dest.emit('pipe', src);
-
- // start the flow if it hasn't been started already.
- if (!state.flowing) {
- debug('pipe resume');
- src.resume();
- }
-
- return dest;
-};
-
-function pipeOnDrain(src) {
- return function () {
- var state = src._readableState;
- debug('pipeOnDrain', state.awaitDrain);
- if (state.awaitDrain) state.awaitDrain--;
- if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
- state.flowing = true;
- flow(src);
- }
- };
-}
-
-Readable.prototype.unpipe = function (dest) {
- var state = this._readableState;
-
- // if we're not piping anywhere, then do nothing.
- if (state.pipesCount === 0) return this;
-
- // just one destination. most common case.
- if (state.pipesCount === 1) {
- // passed in one, but it's not the right one.
- if (dest && dest !== state.pipes) return this;
-
- if (!dest) dest = state.pipes;
-
- // got a match.
- state.pipes = null;
- state.pipesCount = 0;
- state.flowing = false;
- if (dest) dest.emit('unpipe', this);
- return this;
- }
-
- // slow case. multiple pipe destinations.
-
- if (!dest) {
- // remove all.
- var dests = state.pipes;
- var len = state.pipesCount;
- state.pipes = null;
- state.pipesCount = 0;
- state.flowing = false;
-
- for (var _i = 0; _i < len; _i++) {
- dests[_i].emit('unpipe', this);
- }return this;
- }
-
- // try to find the right one.
- var i = indexOf(state.pipes, dest);
- if (i === -1) return this;
-
- state.pipes.splice(i, 1);
- state.pipesCount -= 1;
- if (state.pipesCount === 1) state.pipes = state.pipes[0];
-
- dest.emit('unpipe', this);
-
- return this;
-};
-
-// set up data events if they are asked for
-// Ensure readable listeners eventually get something
-Readable.prototype.on = function (ev, fn) {
- var res = Stream.prototype.on.call(this, ev, fn);
-
- if (ev === 'data') {
- // Start flowing on next tick if stream isn't explicitly paused
- if (this._readableState.flowing !== false) this.resume();
- } else if (ev === 'readable') {
- var state = this._readableState;
- if (!state.endEmitted && !state.readableListening) {
- state.readableListening = state.needReadable = true;
- state.emittedReadable = false;
- if (!state.reading) {
- processNextTick(nReadingNextTick, this);
- } else if (state.length) {
- emitReadable(this, state);
- }
- }
- }
-
- return res;
-};
-Readable.prototype.addListener = Readable.prototype.on;
-
-function nReadingNextTick(self) {
- debug('readable nexttick read 0');
- self.read(0);
-}
-
-// pause() and resume() are remnants of the legacy readable stream API
-// If the user uses them, then switch into old mode.
-Readable.prototype.resume = function () {
- var state = this._readableState;
- if (!state.flowing) {
- debug('resume');
- state.flowing = true;
- resume(this, state);
- }
- return this;
-};
-
-function resume(stream, state) {
- if (!state.resumeScheduled) {
- state.resumeScheduled = true;
- processNextTick(resume_, stream, state);
- }
-}
-
-function resume_(stream, state) {
- if (!state.reading) {
- debug('resume read 0');
- stream.read(0);
- }
-
- state.resumeScheduled = false;
- state.awaitDrain = 0;
- stream.emit('resume');
- flow(stream);
- if (state.flowing && !state.reading) stream.read(0);
-}
-
-Readable.prototype.pause = function () {
- debug('call pause flowing=%j', this._readableState.flowing);
- if (false !== this._readableState.flowing) {
- debug('pause');
- this._readableState.flowing = false;
- this.emit('pause');
- }
- return this;
-};
-
-function flow(stream) {
- var state = stream._readableState;
- debug('flow', state.flowing);
- while (state.flowing && stream.read() !== null) {}
-}
-
-// wrap an old-style stream as the async data source.
-// This is *not* part of the readable stream interface.
-// It is an ugly unfortunate mess of history.
-Readable.prototype.wrap = function (stream) {
- var state = this._readableState;
- var paused = false;
-
- var self = this;
- stream.on('end', function () {
- debug('wrapped end');
- if (state.decoder && !state.ended) {
- var chunk = state.decoder.end();
- if (chunk && chunk.length) self.push(chunk);
- }
-
- self.push(null);
- });
-
- stream.on('data', function (chunk) {
- debug('wrapped data');
- if (state.decoder) chunk = state.decoder.write(chunk);
-
- // don't skip over falsy values in objectMode
- if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
-
- var ret = self.push(chunk);
- if (!ret) {
- paused = true;
- stream.pause();
- }
- });
-
- // proxy all the other methods.
- // important when wrapping filters and duplexes.
- for (var i in stream) {
- if (this[i] === undefined && typeof stream[i] === 'function') {
- this[i] = function (method) {
- return function () {
- return stream[method].apply(stream, arguments);
- };
- }(i);
- }
- }
-
- // proxy certain important events.
- var events = ['error', 'close', 'destroy', 'pause', 'resume'];
- forEach(events, function (ev) {
- stream.on(ev, self.emit.bind(self, ev));
- });
-
- // when we try to consume some more bytes, simply unpause the
- // underlying stream.
- self._read = function (n) {
- debug('wrapped _read', n);
- if (paused) {
- paused = false;
- stream.resume();
- }
- };
-
- return self;
-};
-
-// exposed for testing purposes only.
-Readable._fromList = fromList;
-
-// Pluck off n bytes from an array of buffers.
-// Length is the combined lengths of all the buffers in the list.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function fromList(n, state) {
- // nothing buffered
- if (state.length === 0) return null;
-
- var ret;
- if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
- // read it all, truncate the list
- if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
- state.buffer.clear();
- } else {
- // read part of list
- ret = fromListPartial(n, state.buffer, state.decoder);
- }
-
- return ret;
-}
-
-// Extracts only enough buffered data to satisfy the amount requested.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function fromListPartial(n, list, hasStrings) {
- var ret;
- if (n < list.head.data.length) {
- // slice is the same for buffers and strings
- ret = list.head.data.slice(0, n);
- list.head.data = list.head.data.slice(n);
- } else if (n === list.head.data.length) {
- // first chunk is a perfect match
- ret = list.shift();
- } else {
- // result spans more than one buffer
- ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
- }
- return ret;
-}
-
-// Copies a specified amount of characters from the list of buffered data
-// chunks.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function copyFromBufferString(n, list) {
- var p = list.head;
- var c = 1;
- var ret = p.data;
- n -= ret.length;
- while (p = p.next) {
- var str = p.data;
- var nb = n > str.length ? str.length : n;
- if (nb === str.length) ret += str;else ret += str.slice(0, n);
- n -= nb;
- if (n === 0) {
- if (nb === str.length) {
- ++c;
- if (p.next) list.head = p.next;else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = str.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
-}
-
-// Copies a specified amount of bytes from the list of buffered data chunks.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function copyFromBuffer(n, list) {
- var ret = bufferShim.allocUnsafe(n);
- var p = list.head;
- var c = 1;
- p.data.copy(ret);
- n -= p.data.length;
- while (p = p.next) {
- var buf = p.data;
- var nb = n > buf.length ? buf.length : n;
- buf.copy(ret, ret.length - n, 0, nb);
- n -= nb;
- if (n === 0) {
- if (nb === buf.length) {
- ++c;
- if (p.next) list.head = p.next;else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = buf.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
-}
-
-function endReadable(stream) {
- var state = stream._readableState;
-
- // If we get here before consuming all the bytes, then that is a
- // bug in node. Should never happen.
- if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
-
- if (!state.endEmitted) {
- state.ended = true;
- processNextTick(endReadableNT, state, stream);
- }
-}
-
-function endReadableNT(state, stream) {
- // Check that we didn't get one last unshift.
- if (!state.endEmitted && state.length === 0) {
- state.endEmitted = true;
- stream.readable = false;
- stream.emit('end');
- }
-}
-
-function forEach(xs, f) {
- for (var i = 0, l = xs.length; i < l; i++) {
- f(xs[i], i);
- }
-}
-
-function indexOf(xs, x) {
- for (var i = 0, l = xs.length; i < l; i++) {
- if (xs[i] === x) return i;
- }
- return -1;
-}
-}).call(this,require('_process'))
-},{"./_stream_duplex":69,"./internal/streams/BufferList":74,"_process":67,"buffer":44,"buffer-shims":43,"core-util-is":45,"events":48,"inherits":51,"isarray":53,"process-nextick-args":66,"string_decoder/":80,"util":40}],72:[function(require,module,exports){
-// a transform stream is a readable/writable stream where you do
-// something with the data. Sometimes it's called a "filter",
-// but that's not a great name for it, since that implies a thing where
-// some bits pass through, and others are simply ignored. (That would
-// be a valid example of a transform, of course.)
-//
-// While the output is causally related to the input, it's not a
-// necessarily symmetric or synchronous transformation. For example,
-// a zlib stream might take multiple plain-text writes(), and then
-// emit a single compressed chunk some time in the future.
-//
-// Here's how this works:
-//
-// The Transform stream has all the aspects of the readable and writable
-// stream classes. When you write(chunk), that calls _write(chunk,cb)
-// internally, and returns false if there's a lot of pending writes
-// buffered up. When you call read(), that calls _read(n) until
-// there's enough pending readable data buffered up.
-//
-// In a transform stream, the written data is placed in a buffer. When
-// _read(n) is called, it transforms the queued up data, calling the
-// buffered _write cb's as it consumes chunks. If consuming a single
-// written chunk would result in multiple output chunks, then the first
-// outputted bit calls the readcb, and subsequent chunks just go into
-// the read buffer, and will cause it to emit 'readable' if necessary.
-//
-// This way, back-pressure is actually determined by the reading side,
-// since _read has to be called to start processing a new chunk. However,
-// a pathological inflate type of transform can cause excessive buffering
-// here. For example, imagine a stream where every byte of input is
-// interpreted as an integer from 0-255, and then results in that many
-// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
-// 1kb of data being output. In this case, you could write a very small
-// amount of input, and end up with a very large amount of output. In
-// such a pathological inflating mechanism, there'd be no way to tell
-// the system to stop doing the transform. A single 4MB write could
-// cause the system to run out of memory.
-//
-// However, even in such a pathological case, only a single written chunk
-// would be consumed, and then the rest would wait (un-transformed) until
-// the results of the previous transformed chunk were consumed.
-
-'use strict';
-
-module.exports = Transform;
-
-var Duplex = require('./_stream_duplex');
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-util.inherits(Transform, Duplex);
-
-function TransformState(stream) {
- this.afterTransform = function (er, data) {
- return afterTransform(stream, er, data);
- };
-
- this.needTransform = false;
- this.transforming = false;
- this.writecb = null;
- this.writechunk = null;
- this.writeencoding = null;
-}
-
-function afterTransform(stream, er, data) {
- var ts = stream._transformState;
- ts.transforming = false;
-
- var cb = ts.writecb;
-
- if (!cb) return stream.emit('error', new Error('no writecb in Transform class'));
-
- ts.writechunk = null;
- ts.writecb = null;
-
- if (data !== null && data !== undefined) stream.push(data);
-
- cb(er);
-
- var rs = stream._readableState;
- rs.reading = false;
- if (rs.needReadable || rs.length < rs.highWaterMark) {
- stream._read(rs.highWaterMark);
- }
-}
-
-function Transform(options) {
- if (!(this instanceof Transform)) return new Transform(options);
-
- Duplex.call(this, options);
-
- this._transformState = new TransformState(this);
-
- // when the writable side finishes, then flush out anything remaining.
- var stream = this;
-
- // start out asking for a readable event once data is transformed.
- this._readableState.needReadable = true;
-
- // we have implemented the _read method, and done the other things
- // that Readable wants before the first _read call, so unset the
- // sync guard flag.
- this._readableState.sync = false;
-
- if (options) {
- if (typeof options.transform === 'function') this._transform = options.transform;
-
- if (typeof options.flush === 'function') this._flush = options.flush;
- }
-
- this.once('prefinish', function () {
- if (typeof this._flush === 'function') this._flush(function (er) {
- done(stream, er);
- });else done(stream);
- });
-}
-
-Transform.prototype.push = function (chunk, encoding) {
- this._transformState.needTransform = false;
- return Duplex.prototype.push.call(this, chunk, encoding);
-};
-
-// This is the part where you do stuff!
-// override this function in implementation classes.
-// 'chunk' is an input chunk.
-//
-// Call `push(newChunk)` to pass along transformed output
-// to the readable side. You may call 'push' zero or more times.
-//
-// Call `cb(err)` when you are done with this chunk. If you pass
-// an error, then that'll put the hurt on the whole operation. If you
-// never call cb(), then you'll never get another chunk.
-Transform.prototype._transform = function (chunk, encoding, cb) {
- throw new Error('Not implemented');
-};
-
-Transform.prototype._write = function (chunk, encoding, cb) {
- var ts = this._transformState;
- ts.writecb = cb;
- ts.writechunk = chunk;
- ts.writeencoding = encoding;
- if (!ts.transforming) {
- var rs = this._readableState;
- if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
- }
-};
-
-// Doesn't matter what the args are here.
-// _transform does all the work.
-// That we got here means that the readable side wants more data.
-Transform.prototype._read = function (n) {
- var ts = this._transformState;
-
- if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
- ts.transforming = true;
- this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
- } else {
- // mark that we need a transform, so that any data that comes in
- // will get processed, now that we've asked for it.
- ts.needTransform = true;
- }
-};
-
-function done(stream, er) {
- if (er) return stream.emit('error', er);
-
- // if there's nothing in the write buffer, then that means
- // that nothing more will ever be provided
- var ws = stream._writableState;
- var ts = stream._transformState;
-
- if (ws.length) throw new Error('Calling transform done when ws.length != 0');
-
- if (ts.transforming) throw new Error('Calling transform done when still transforming');
-
- return stream.push(null);
-}
-},{"./_stream_duplex":69,"core-util-is":45,"inherits":51}],73:[function(require,module,exports){
-(function (process){
-// A bit simpler than readable streams.
-// Implement an async ._write(chunk, encoding, cb), and it'll handle all
-// the drain event emission and buffering.
-
-'use strict';
-
-module.exports = Writable;
-
-/*<replacement>*/
-var processNextTick = require('process-nextick-args');
-/*</replacement>*/
-
-/*<replacement>*/
-var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
-/*</replacement>*/
-
-Writable.WritableState = WritableState;
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-/*<replacement>*/
-var internalUtil = {
- deprecate: require('util-deprecate')
-};
-/*</replacement>*/
-
-/*<replacement>*/
-var Stream;
-(function () {
- try {
- Stream = require('st' + 'ream');
- } catch (_) {} finally {
- if (!Stream) Stream = require('events').EventEmitter;
- }
-})();
-/*</replacement>*/
-
-var Buffer = require('buffer').Buffer;
-/*<replacement>*/
-var bufferShim = require('buffer-shims');
-/*</replacement>*/
-
-util.inherits(Writable, Stream);
-
-function nop() {}
-
-function WriteReq(chunk, encoding, cb) {
- this.chunk = chunk;
- this.encoding = encoding;
- this.callback = cb;
- this.next = null;
-}
-
-var Duplex;
-function WritableState(options, stream) {
- Duplex = Duplex || require('./_stream_duplex');
-
- options = options || {};
-
- // object stream flag to indicate whether or not this stream
- // contains buffers or objects.
- this.objectMode = !!options.objectMode;
-
- if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
-
- // the point at which write() starts returning false
- // Note: 0 is a valid value, means that we always return false if
- // the entire buffer is not flushed immediately on write()
- var hwm = options.highWaterMark;
- var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
-
- // cast to ints.
- this.highWaterMark = ~ ~this.highWaterMark;
-
- this.needDrain = false;
- // at the start of calling end()
- this.ending = false;
- // when end() has been called, and returned
- this.ended = false;
- // when 'finish' is emitted
- this.finished = false;
-
- // should we decode strings into buffers before passing to _write?
- // this is here so that some node-core streams can optimize string
- // handling at a lower level.
- var noDecode = options.decodeStrings === false;
- this.decodeStrings = !noDecode;
-
- // Crypto is kind of old and crusty. Historically, its default string
- // encoding is 'binary' so we have to make this configurable.
- // Everything else in the universe uses 'utf8', though.
- this.defaultEncoding = options.defaultEncoding || 'utf8';
-
- // not an actual buffer we keep track of, but a measurement
- // of how much we're waiting to get pushed to some underlying
- // socket or file.
- this.length = 0;
-
- // a flag to see when we're in the middle of a write.
- this.writing = false;
-
- // when true all writes will be buffered until .uncork() call
- this.corked = 0;
-
- // a flag to be able to tell if the onwrite cb is called immediately,
- // or on a later tick. We set this to true at first, because any
- // actions that shouldn't happen until "later" should generally also
- // not happen before the first write call.
- this.sync = true;
-
- // a flag to know if we're processing previously buffered items, which
- // may call the _write() callback in the same tick, so that we don't
- // end up in an overlapped onwrite situation.
- this.bufferProcessing = false;
-
- // the callback that's passed to _write(chunk,cb)
- this.onwrite = function (er) {
- onwrite(stream, er);
- };
-
- // the callback that the user supplies to write(chunk,encoding,cb)
- this.writecb = null;
-
- // the amount that is being written when _write is called.
- this.writelen = 0;
-
- this.bufferedRequest = null;
- this.lastBufferedRequest = null;
-
- // number of pending user-supplied write callbacks
- // this must be 0 before 'finish' can be emitted
- this.pendingcb = 0;
-
- // emit prefinish if the only thing we're waiting for is _write cbs
- // This is relevant for synchronous Transform streams
- this.prefinished = false;
-
- // True if the error was already emitted and should not be thrown again
- this.errorEmitted = false;
-
- // count buffered requests
- this.bufferedRequestCount = 0;
-
- // allocate the first CorkedRequest, there is always
- // one allocated and free to use, and we maintain at most two
- this.corkedRequestsFree = new CorkedRequest(this);
-}
-
-WritableState.prototype.getBuffer = function writableStateGetBuffer() {
- var current = this.bufferedRequest;
- var out = [];
- while (current) {
- out.push(current);
- current = current.next;
- }
- return out;
-};
-
-(function () {
- try {
- Object.defineProperty(WritableState.prototype, 'buffer', {
- get: internalUtil.deprecate(function () {
- return this.getBuffer();
- }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
- });
- } catch (_) {}
-})();
-
-var Duplex;
-function Writable(options) {
- Duplex = Duplex || require('./_stream_duplex');
-
- // Writable ctor is applied to Duplexes, though they're not
- // instanceof Writable, they're instanceof Readable.
- if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options);
-
- this._writableState = new WritableState(options, this);
-
- // legacy.
- this.writable = true;
-
- if (options) {
- if (typeof options.write === 'function') this._write = options.write;
-
- if (typeof options.writev === 'function') this._writev = options.writev;
- }
-
- Stream.call(this);
-}
-
-// Otherwise people can pipe Writable streams, which is just wrong.
-Writable.prototype.pipe = function () {
- this.emit('error', new Error('Cannot pipe, not readable'));
-};
-
-function writeAfterEnd(stream, cb) {
- var er = new Error('write after end');
- // TODO: defer error events consistently everywhere, not just the cb
- stream.emit('error', er);
- processNextTick(cb, er);
-}
-
-// If we get something that is not a buffer, string, null, or undefined,
-// and we're not in objectMode, then that's an error.
-// Otherwise stream chunks are all considered to be of length=1, and the
-// watermarks determine how many objects to keep in the buffer, rather than
-// how many bytes or characters.
-function validChunk(stream, state, chunk, cb) {
- var valid = true;
- var er = false;
- // Always throw error if a null is written
- // if we are not in object mode then throw
- // if it is not a buffer, string, or undefined.
- if (chunk === null) {
- er = new TypeError('May not write null values to stream');
- } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
- er = new TypeError('Invalid non-string/buffer chunk');
- }
- if (er) {
- stream.emit('error', er);
- processNextTick(cb, er);
- valid = false;
- }
- return valid;
-}
-
-Writable.prototype.write = function (chunk, encoding, cb) {
- var state = this._writableState;
- var ret = false;
-
- if (typeof encoding === 'function') {
- cb = encoding;
- encoding = null;
- }
-
- if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
-
- if (typeof cb !== 'function') cb = nop;
-
- if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {
- state.pendingcb++;
- ret = writeOrBuffer(this, state, chunk, encoding, cb);
- }
-
- return ret;
-};
-
-Writable.prototype.cork = function () {
- var state = this._writableState;
-
- state.corked++;
-};
-
-Writable.prototype.uncork = function () {
- var state = this._writableState;
-
- if (state.corked) {
- state.corked--;
-
- if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
- }
-};
-
-Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
- // node::ParseEncoding() requires lower case.
- if (typeof encoding === 'string') encoding = encoding.toLowerCase();
- if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
- this._writableState.defaultEncoding = encoding;
- return this;
-};
-
-function decodeChunk(state, chunk, encoding) {
- if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
- chunk = bufferShim.from(chunk, encoding);
- }
- return chunk;
-}
-
-// if we're already writing something, then just put this
-// in the queue, and wait our turn. Otherwise, call _write
-// If we return false, then we need a drain event, so set that flag.
-function writeOrBuffer(stream, state, chunk, encoding, cb) {
- chunk = decodeChunk(state, chunk, encoding);
-
- if (Buffer.isBuffer(chunk)) encoding = 'buffer';
- var len = state.objectMode ? 1 : chunk.length;
-
- state.length += len;
-
- var ret = state.length < state.highWaterMark;
- // we must ensure that previous needDrain will not be reset to false.
- if (!ret) state.needDrain = true;
-
- if (state.writing || state.corked) {
- var last = state.lastBufferedRequest;
- state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
- if (last) {
- last.next = state.lastBufferedRequest;
- } else {
- state.bufferedRequest = state.lastBufferedRequest;
- }
- state.bufferedRequestCount += 1;
- } else {
- doWrite(stream, state, false, len, chunk, encoding, cb);
- }
-
- return ret;
-}
-
-function doWrite(stream, state, writev, len, chunk, encoding, cb) {
- state.writelen = len;
- state.writecb = cb;
- state.writing = true;
- state.sync = true;
- if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
- state.sync = false;
-}
-
-function onwriteError(stream, state, sync, er, cb) {
- --state.pendingcb;
- if (sync) processNextTick(cb, er);else cb(er);
-
- stream._writableState.errorEmitted = true;
- stream.emit('error', er);
-}
-
-function onwriteStateUpdate(state) {
- state.writing = false;
- state.writecb = null;
- state.length -= state.writelen;
- state.writelen = 0;
-}
-
-function onwrite(stream, er) {
- var state = stream._writableState;
- var sync = state.sync;
- var cb = state.writecb;
-
- onwriteStateUpdate(state);
-
- if (er) onwriteError(stream, state, sync, er, cb);else {
- // Check if we're actually ready to finish, but don't emit yet
- var finished = needFinish(state);
-
- if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
- clearBuffer(stream, state);
- }
-
- if (sync) {
- /*<replacement>*/
- asyncWrite(afterWrite, stream, state, finished, cb);
- /*</replacement>*/
- } else {
- afterWrite(stream, state, finished, cb);
- }
- }
-}
-
-function afterWrite(stream, state, finished, cb) {
- if (!finished) onwriteDrain(stream, state);
- state.pendingcb--;
- cb();
- finishMaybe(stream, state);
-}
-
-// Must force callback to be called on nextTick, so that we don't
-// emit 'drain' before the write() consumer gets the 'false' return
-// value, and has a chance to attach a 'drain' listener.
-function onwriteDrain(stream, state) {
- if (state.length === 0 && state.needDrain) {
- state.needDrain = false;
- stream.emit('drain');
- }
-}
-
-// if there's something in the buffer waiting, then process it
-function clearBuffer(stream, state) {
- state.bufferProcessing = true;
- var entry = state.bufferedRequest;
-
- if (stream._writev && entry && entry.next) {
- // Fast case, write everything using _writev()
- var l = state.bufferedRequestCount;
- var buffer = new Array(l);
- var holder = state.corkedRequestsFree;
- holder.entry = entry;
-
- var count = 0;
- while (entry) {
- buffer[count] = entry;
- entry = entry.next;
- count += 1;
- }
-
- doWrite(stream, state, true, state.length, buffer, '', holder.finish);
-
- // doWrite is almost always async, defer these to save a bit of time
- // as the hot path ends with doWrite
- state.pendingcb++;
- state.lastBufferedRequest = null;
- if (holder.next) {
- state.corkedRequestsFree = holder.next;
- holder.next = null;
- } else {
- state.corkedRequestsFree = new CorkedRequest(state);
- }
- } else {
- // Slow case, write chunks one-by-one
- while (entry) {
- var chunk = entry.chunk;
- var encoding = entry.encoding;
- var cb = entry.callback;
- var len = state.objectMode ? 1 : chunk.length;
-
- doWrite(stream, state, false, len, chunk, encoding, cb);
- entry = entry.next;
- // if we didn't call the onwrite immediately, then
- // it means that we need to wait until it does.
- // also, that means that the chunk and cb are currently
- // being processed, so move the buffer counter past them.
- if (state.writing) {
- break;
- }
- }
-
- if (entry === null) state.lastBufferedRequest = null;
- }
-
- state.bufferedRequestCount = 0;
- state.bufferedRequest = entry;
- state.bufferProcessing = false;
-}
-
-Writable.prototype._write = function (chunk, encoding, cb) {
- cb(new Error('not implemented'));
-};
-
-Writable.prototype._writev = null;
-
-Writable.prototype.end = function (chunk, encoding, cb) {
- var state = this._writableState;
-
- if (typeof chunk === 'function') {
- cb = chunk;
- chunk = null;
- encoding = null;
- } else if (typeof encoding === 'function') {
- cb = encoding;
- encoding = null;
- }
-
- if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
-
- // .end() fully uncorks
- if (state.corked) {
- state.corked = 1;
- this.uncork();
- }
-
- // ignore unnecessary end() calls.
- if (!state.ending && !state.finished) endWritable(this, state, cb);
-};
-
-function needFinish(state) {
- return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
-}
-
-function prefinish(stream, state) {
- if (!state.prefinished) {
- state.prefinished = true;
- stream.emit('prefinish');
- }
-}
-
-function finishMaybe(stream, state) {
- var need = needFinish(state);
- if (need) {
- if (state.pendingcb === 0) {
- prefinish(stream, state);
- state.finished = true;
- stream.emit('finish');
- } else {
- prefinish(stream, state);
- }
- }
- return need;
-}
-
-function endWritable(stream, state, cb) {
- state.ending = true;
- finishMaybe(stream, state);
- if (cb) {
- if (state.finished) processNextTick(cb);else stream.once('finish', cb);
- }
- state.ended = true;
- stream.writable = false;
-}
-
-// It seems a linked list but it is not
-// there will be only 2 of these for each stream
-function CorkedRequest(state) {
- var _this = this;
-
- this.next = null;
- this.entry = null;
-
- this.finish = function (err) {
- var entry = _this.entry;
- _this.entry = null;
- while (entry) {
- var cb = entry.callback;
- state.pendingcb--;
- cb(err);
- entry = entry.next;
- }
- if (state.corkedRequestsFree) {
- state.corkedRequestsFree.next = _this;
- } else {
- state.corkedRequestsFree = _this;
- }
- };
-}
-}).call(this,require('_process'))
-},{"./_stream_duplex":69,"_process":67,"buffer":44,"buffer-shims":43,"core-util-is":45,"events":48,"inherits":51,"process-nextick-args":66,"util-deprecate":81}],74:[function(require,module,exports){
-'use strict';
-
-var Buffer = require('buffer').Buffer;
-/*<replacement>*/
-var bufferShim = require('buffer-shims');
-/*</replacement>*/
-
-module.exports = BufferList;
-
-function BufferList() {
- this.head = null;
- this.tail = null;
- this.length = 0;
-}
-
-BufferList.prototype.push = function (v) {
- var entry = { data: v, next: null };
- if (this.length > 0) this.tail.next = entry;else this.head = entry;
- this.tail = entry;
- ++this.length;
-};
-
-BufferList.prototype.unshift = function (v) {
- var entry = { data: v, next: this.head };
- if (this.length === 0) this.tail = entry;
- this.head = entry;
- ++this.length;
-};
-
-BufferList.prototype.shift = function () {
- if (this.length === 0) return;
- var ret = this.head.data;
- if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
- --this.length;
- return ret;
-};
-
-BufferList.prototype.clear = function () {
- this.head = this.tail = null;
- this.length = 0;
-};
-
-BufferList.prototype.join = function (s) {
- if (this.length === 0) return '';
- var p = this.head;
- var ret = '' + p.data;
- while (p = p.next) {
- ret += s + p.data;
- }return ret;
-};
-
-BufferList.prototype.concat = function (n) {
- if (this.length === 0) return bufferShim.alloc(0);
- if (this.length === 1) return this.head.data;
- var ret = bufferShim.allocUnsafe(n >>> 0);
- var p = this.head;
- var i = 0;
- while (p) {
- p.data.copy(ret, i);
- i += p.data.length;
- p = p.next;
- }
- return ret;
-};
-},{"buffer":44,"buffer-shims":43}],75:[function(require,module,exports){
-module.exports = require("./lib/_stream_passthrough.js")
-
-},{"./lib/_stream_passthrough.js":70}],76:[function(require,module,exports){
-(function (process){
-var Stream = (function (){
- try {
- return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify
- } catch(_){}
-}());
-exports = module.exports = require('./lib/_stream_readable.js');
-exports.Stream = Stream || exports;
-exports.Readable = exports;
-exports.Writable = require('./lib/_stream_writable.js');
-exports.Duplex = require('./lib/_stream_duplex.js');
-exports.Transform = require('./lib/_stream_transform.js');
-exports.PassThrough = require('./lib/_stream_passthrough.js');
-
-if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) {
- module.exports = Stream;
-}
-
-}).call(this,require('_process'))
-},{"./lib/_stream_duplex.js":69,"./lib/_stream_passthrough.js":70,"./lib/_stream_readable.js":71,"./lib/_stream_transform.js":72,"./lib/_stream_writable.js":73,"_process":67}],77:[function(require,module,exports){
-module.exports = require("./lib/_stream_transform.js")
-
-},{"./lib/_stream_transform.js":72}],78:[function(require,module,exports){
-module.exports = require("./lib/_stream_writable.js")
-
-},{"./lib/_stream_writable.js":73}],79:[function(require,module,exports){
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-module.exports = Stream;
-
-var EE = require('events').EventEmitter;
-var inherits = require('inherits');
-
-inherits(Stream, EE);
-Stream.Readable = require('readable-stream/readable.js');
-Stream.Writable = require('readable-stream/writable.js');
-Stream.Duplex = require('readable-stream/duplex.js');
-Stream.Transform = require('readable-stream/transform.js');
-Stream.PassThrough = require('readable-stream/passthrough.js');
-
-// Backwards-compat with node 0.4.x
-Stream.Stream = Stream;
-
-
-
-// old-style streams. Note that the pipe method (the only relevant
-// part of this class) is overridden in the Readable class.
-
-function Stream() {
- EE.call(this);
-}
-
-Stream.prototype.pipe = function(dest, options) {
- var source = this;
-
- function ondata(chunk) {
- if (dest.writable) {
- if (false === dest.write(chunk) && source.pause) {
- source.pause();
- }
- }
- }
-
- source.on('data', ondata);
-
- function ondrain() {
- if (source.readable && source.resume) {
- source.resume();
- }
- }
-
- dest.on('drain', ondrain);
-
- // If the 'end' option is not supplied, dest.end() will be called when
- // source gets the 'end' or 'close' events. Only dest.end() once.
- if (!dest._isStdio && (!options || options.end !== false)) {
- source.on('end', onend);
- source.on('close', onclose);
- }
-
- var didOnEnd = false;
- function onend() {
- if (didOnEnd) return;
- didOnEnd = true;
-
- dest.end();
- }
-
-
- function onclose() {
- if (didOnEnd) return;
- didOnEnd = true;
-
- if (typeof dest.destroy === 'function') dest.destroy();
- }
-
- // don't leave dangling pipes when there are errors.
- function onerror(er) {
- cleanup();
- if (EE.listenerCount(this, 'error') === 0) {
- throw er; // Unhandled stream error in pipe.
- }
- }
-
- source.on('error', onerror);
- dest.on('error', onerror);
-
- // remove all the event listeners that were added.
- function cleanup() {
- source.removeListener('data', ondata);
- dest.removeListener('drain', ondrain);
-
- source.removeListener('end', onend);
- source.removeListener('close', onclose);
-
- source.removeListener('error', onerror);
- dest.removeListener('error', onerror);
-
- source.removeListener('end', cleanup);
- source.removeListener('close', cleanup);
-
- dest.removeListener('close', cleanup);
- }
-
- source.on('end', cleanup);
- source.on('close', cleanup);
-
- dest.on('close', cleanup);
-
- dest.emit('pipe', source);
-
- // Allow for unix-like usage: A.pipe(B).pipe(C)
- return dest;
-};
-
-},{"events":48,"inherits":51,"readable-stream/duplex.js":68,"readable-stream/passthrough.js":75,"readable-stream/readable.js":76,"readable-stream/transform.js":77,"readable-stream/writable.js":78}],80:[function(require,module,exports){
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var Buffer = require('buffer').Buffer;
-
-var isBufferEncoding = Buffer.isEncoding
- || function(encoding) {
- switch (encoding && encoding.toLowerCase()) {
- case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
- default: return false;
- }
- }
-
-
-function assertEncoding(encoding) {
- if (encoding && !isBufferEncoding(encoding)) {
- throw new Error('Unknown encoding: ' + encoding);
- }
-}
-
-// StringDecoder provides an interface for efficiently splitting a series of
-// buffers into a series of JS strings without breaking apart multi-byte
-// characters. CESU-8 is handled as part of the UTF-8 encoding.
-//
-// @TODO Handling all encodings inside a single object makes it very difficult
-// to reason about this code, so it should be split up in the future.
-// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
-// points as used by CESU-8.
-var StringDecoder = exports.StringDecoder = function(encoding) {
- this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
- assertEncoding(encoding);
- switch (this.encoding) {
- case 'utf8':
- // CESU-8 represents each of Surrogate Pair by 3-bytes
- this.surrogateSize = 3;
- break;
- case 'ucs2':
- case 'utf16le':
- // UTF-16 represents each of Surrogate Pair by 2-bytes
- this.surrogateSize = 2;
- this.detectIncompleteChar = utf16DetectIncompleteChar;
- break;
- case 'base64':
- // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
- this.surrogateSize = 3;
- this.detectIncompleteChar = base64DetectIncompleteChar;
- break;
- default:
- this.write = passThroughWrite;
- return;
- }
-
- // Enough space to store all bytes of a single character. UTF-8 needs 4
- // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
- this.charBuffer = new Buffer(6);
- // Number of bytes received for the current incomplete multi-byte character.
- this.charReceived = 0;
- // Number of bytes expected for the current incomplete multi-byte character.
- this.charLength = 0;
-};
-
-
-// write decodes the given buffer and returns it as JS string that is
-// guaranteed to not contain any partial multi-byte characters. Any partial
-// character found at the end of the buffer is buffered up, and will be
-// returned when calling write again with the remaining bytes.
-//
-// Note: Converting a Buffer containing an orphan surrogate to a String
-// currently works, but converting a String to a Buffer (via `new Buffer`, or
-// Buffer#write) will replace incomplete surrogates with the unicode
-// replacement character. See https://codereview.chromium.org/121173009/ .
-StringDecoder.prototype.write = function(buffer) {
- var charStr = '';
- // if our last write ended with an incomplete multibyte character
- while (this.charLength) {
- // determine how many remaining bytes this buffer has to offer for this char
- var available = (buffer.length >= this.charLength - this.charReceived) ?
- this.charLength - this.charReceived :
- buffer.length;
-
- // add the new bytes to the char buffer
- buffer.copy(this.charBuffer, this.charReceived, 0, available);
- this.charReceived += available;
-
- if (this.charReceived < this.charLength) {
- // still not enough chars in this buffer? wait for more ...
- return '';
- }
-
- // remove bytes belonging to the current character from the buffer
- buffer = buffer.slice(available, buffer.length);
-
- // get the character that was split
- charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
-
- // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
- var charCode = charStr.charCodeAt(charStr.length - 1);
- if (charCode >= 0xD800 && charCode <= 0xDBFF) {
- this.charLength += this.surrogateSize;
- charStr = '';
- continue;
- }
- this.charReceived = this.charLength = 0;
-
- // if there are no more bytes in this buffer, just emit our char
- if (buffer.length === 0) {
- return charStr;
- }
- break;
- }
-
- // determine and set charLength / charReceived
- this.detectIncompleteChar(buffer);
-
- var end = buffer.length;
- if (this.charLength) {
- // buffer the incomplete character bytes we got
- buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
- end -= this.charReceived;
- }
-
- charStr += buffer.toString(this.encoding, 0, end);
-
- var end = charStr.length - 1;
- var charCode = charStr.charCodeAt(end);
- // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
- if (charCode >= 0xD800 && charCode <= 0xDBFF) {
- var size = this.surrogateSize;
- this.charLength += size;
- this.charReceived += size;
- this.charBuffer.copy(this.charBuffer, size, 0, size);
- buffer.copy(this.charBuffer, 0, 0, size);
- return charStr.substring(0, end);
- }
-
- // or just emit the charStr
- return charStr;
-};
-
-// detectIncompleteChar determines if there is an incomplete UTF-8 character at
-// the end of the given buffer. If so, it sets this.charLength to the byte
-// length that character, and sets this.charReceived to the number of bytes
-// that are available for this character.
-StringDecoder.prototype.detectIncompleteChar = function(buffer) {
- // determine how many bytes we have to check at the end of this buffer
- var i = (buffer.length >= 3) ? 3 : buffer.length;
-
- // Figure out if one of the last i bytes of our buffer announces an
- // incomplete char.
- for (; i > 0; i--) {
- var c = buffer[buffer.length - i];
-
- // See http://en.wikipedia.org/wiki/UTF-8#Description
-
- // 110XXXXX
- if (i == 1 && c >> 5 == 0x06) {
- this.charLength = 2;
- break;
- }
-
- // 1110XXXX
- if (i <= 2 && c >> 4 == 0x0E) {
- this.charLength = 3;
- break;
- }
-
- // 11110XXX
- if (i <= 3 && c >> 3 == 0x1E) {
- this.charLength = 4;
- break;
- }
- }
- this.charReceived = i;
-};
-
-StringDecoder.prototype.end = function(buffer) {
- var res = '';
- if (buffer && buffer.length)
- res = this.write(buffer);
-
- if (this.charReceived) {
- var cr = this.charReceived;
- var buf = this.charBuffer;
- var enc = this.encoding;
- res += buf.slice(0, cr).toString(enc);
- }
-
- return res;
-};
-
-function passThroughWrite(buffer) {
- return buffer.toString(this.encoding);
-}
-
-function utf16DetectIncompleteChar(buffer) {
- this.charReceived = buffer.length % 2;
- this.charLength = this.charReceived ? 2 : 0;
-}
-
-function base64DetectIncompleteChar(buffer) {
- this.charReceived = buffer.length % 3;
- this.charLength = this.charReceived ? 3 : 0;
-}
-
-},{"buffer":44}],81:[function(require,module,exports){
-(function (global){
-
-/**
- * Module exports.
- */
-
-module.exports = deprecate;
-
-/**
- * Mark that a method should not be used.
- * Returns a modified function which warns once by default.
- *
- * If `localStorage.noDeprecation = true` is set, then it is a no-op.
- *
- * If `localStorage.throwDeprecation = true` is set, then deprecated functions
- * will throw an Error when invoked.
- *
- * If `localStorage.traceDeprecation = true` is set, then deprecated functions
- * will invoke `console.trace()` instead of `console.error()`.
- *
- * @param {Function} fn - the function to deprecate
- * @param {String} msg - the string to print to the console when `fn` is invoked
- * @returns {Function} a new "deprecated" version of `fn`
- * @api public
- */
-
-function deprecate (fn, msg) {
- if (config('noDeprecation')) {
- return fn;
- }
-
- var warned = false;
- function deprecated() {
- if (!warned) {
- if (config('throwDeprecation')) {
- throw new Error(msg);
- } else if (config('traceDeprecation')) {
- console.trace(msg);
- } else {
- console.warn(msg);
- }
- warned = true;
- }
- return fn.apply(this, arguments);
- }
-
- return deprecated;
-}
-
-/**
- * Checks `localStorage` for boolean values for the given `name`.
- *
- * @param {String} name
- * @returns {Boolean}
- * @api private
- */
-
-function config (name) {
- // accessing global.localStorage can trigger a DOMException in sandboxed iframes
- try {
- if (!global.localStorage) return false;
- } catch (_) {
- return false;
- }
- var val = global.localStorage[name];
- if (null == val) return false;
- return String(val).toLowerCase() === 'true';
-}
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],82:[function(require,module,exports){
-arguments[4][51][0].apply(exports,arguments)
-},{"dup":51}],83:[function(require,module,exports){
-module.exports = function isBuffer(arg) {
- return arg && typeof arg === 'object'
- && typeof arg.copy === 'function'
- && typeof arg.fill === 'function'
- && typeof arg.readUInt8 === 'function';
-}
-},{}],84:[function(require,module,exports){
-(function (process,global){
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var formatRegExp = /%[sdj%]/g;
-exports.format = function(f) {
- if (!isString(f)) {
- var objects = [];
- for (var i = 0; i < arguments.length; i++) {
- objects.push(inspect(arguments[i]));
- }
- return objects.join(' ');
- }
-
- var i = 1;
- var args = arguments;
- var len = args.length;
- var str = String(f).replace(formatRegExp, function(x) {
- if (x === '%%') return '%';
- if (i >= len) return x;
- switch (x) {
- case '%s': return String(args[i++]);
- case '%d': return Number(args[i++]);
- case '%j':
- try {
- return JSON.stringify(args[i++]);
- } catch (_) {
- return '[Circular]';
- }
- default:
- return x;
- }
- });
- for (var x = args[i]; i < len; x = args[++i]) {
- if (isNull(x) || !isObject(x)) {
- str += ' ' + x;
- } else {
- str += ' ' + inspect(x);
- }
- }
- return str;
-};
-
-
-// Mark that a method should not be used.
-// Returns a modified function which warns once by default.
-// If --no-deprecation is set, then it is a no-op.
-exports.deprecate = function(fn, msg) {
- // Allow for deprecating things in the process of starting up.
- if (isUndefined(global.process)) {
- return function() {
- return exports.deprecate(fn, msg).apply(this, arguments);
- };
- }
-
- if (process.noDeprecation === true) {
- return fn;
- }
-
- var warned = false;
- function deprecated() {
- if (!warned) {
- if (process.throwDeprecation) {
- throw new Error(msg);
- } else if (process.traceDeprecation) {
- console.trace(msg);
- } else {
- console.error(msg);
- }
- warned = true;
- }
- return fn.apply(this, arguments);
- }
-
- return deprecated;
-};
-
-
-var debugs = {};
-var debugEnviron;
-exports.debuglog = function(set) {
- if (isUndefined(debugEnviron))
- debugEnviron = process.env.NODE_DEBUG || '';
- set = set.toUpperCase();
- if (!debugs[set]) {
- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
- var pid = process.pid;
- debugs[set] = function() {
- var msg = exports.format.apply(exports, arguments);
- console.error('%s %d: %s', set, pid, msg);
- };
- } else {
- debugs[set] = function() {};
- }
- }
- return debugs[set];
-};
-
-
-/**
- * Echos the value of a value. Trys to print the value out
- * in the best way possible given the different types.
- *
- * @param {Object} obj The object to print out.
- * @param {Object} opts Optional options object that alters the output.
- */
-/* legacy: obj, showHidden, depth, colors*/
-function inspect(obj, opts) {
- // default options
- var ctx = {
- seen: [],
- stylize: stylizeNoColor
- };
- // legacy...
- if (arguments.length >= 3) ctx.depth = arguments[2];
- if (arguments.length >= 4) ctx.colors = arguments[3];
- if (isBoolean(opts)) {
- // legacy...
- ctx.showHidden = opts;
- } else if (opts) {
- // got an "options" object
- exports._extend(ctx, opts);
- }
- // set default options
- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
- if (isUndefined(ctx.depth)) ctx.depth = 2;
- if (isUndefined(ctx.colors)) ctx.colors = false;
- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
- if (ctx.colors) ctx.stylize = stylizeWithColor;
- return formatValue(ctx, obj, ctx.depth);
-}
-exports.inspect = inspect;
-
-
-// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
-inspect.colors = {
- 'bold' : [1, 22],
- 'italic' : [3, 23],
- 'underline' : [4, 24],
- 'inverse' : [7, 27],
- 'white' : [37, 39],
- 'grey' : [90, 39],
- 'black' : [30, 39],
- 'blue' : [34, 39],
- 'cyan' : [36, 39],
- 'green' : [32, 39],
- 'magenta' : [35, 39],
- 'red' : [31, 39],
- 'yellow' : [33, 39]
-};
-
-// Don't use 'blue' not visible on cmd.exe
-inspect.styles = {
- 'special': 'cyan',
- 'number': 'yellow',
- 'boolean': 'yellow',
- 'undefined': 'grey',
- 'null': 'bold',
- 'string': 'green',
- 'date': 'magenta',
- // "name": intentionally not styling
- 'regexp': 'red'
-};
-
-
-function stylizeWithColor(str, styleType) {
- var style = inspect.styles[styleType];
-
- if (style) {
- return '\u001b[' + inspect.colors[style][0] + 'm' + str +
- '\u001b[' + inspect.colors[style][1] + 'm';
- } else {
- return str;
- }
-}
-
-
-function stylizeNoColor(str, styleType) {
- return str;
-}
-
-
-function arrayToHash(array) {
- var hash = {};
-
- array.forEach(function(val, idx) {
- hash[val] = true;
- });
-
- return hash;
-}
-
-
-function formatValue(ctx, value, recurseTimes) {
- // Provide a hook for user-specified inspect functions.
- // Check that value is an object with an inspect function on it
- if (ctx.customInspect &&
- value &&
- isFunction(value.inspect) &&
- // Filter out the util module, it's inspect function is special
- value.inspect !== exports.inspect &&
- // Also filter out any prototype objects using the circular check.
- !(value.constructor && value.constructor.prototype === value)) {
- var ret = value.inspect(recurseTimes, ctx);
- if (!isString(ret)) {
- ret = formatValue(ctx, ret, recurseTimes);
- }
- return ret;
- }
-
- // Primitive types cannot have properties
- var primitive = formatPrimitive(ctx, value);
- if (primitive) {
- return primitive;
- }
-
- // Look up the keys of the object.
- var keys = Object.keys(value);
- var visibleKeys = arrayToHash(keys);
-
- if (ctx.showHidden) {
- keys = Object.getOwnPropertyNames(value);
- }
-
- // IE doesn't make error fields non-enumerable
- // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
- if (isError(value)
- && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
- return formatError(value);
- }
-
- // Some type of object without properties can be shortcutted.
- if (keys.length === 0) {
- if (isFunction(value)) {
- var name = value.name ? ': ' + value.name : '';
- return ctx.stylize('[Function' + name + ']', 'special');
- }
- if (isRegExp(value)) {
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
- }
- if (isDate(value)) {
- return ctx.stylize(Date.prototype.toString.call(value), 'date');
- }
- if (isError(value)) {
- return formatError(value);
- }
- }
-
- var base = '', array = false, braces = ['{', '}'];
-
- // Make Array say that they are Array
- if (isArray(value)) {
- array = true;
- braces = ['[', ']'];
- }
-
- // Make functions say that they are functions
- if (isFunction(value)) {
- var n = value.name ? ': ' + value.name : '';
- base = ' [Function' + n + ']';
- }
-
- // Make RegExps say that they are RegExps
- if (isRegExp(value)) {
- base = ' ' + RegExp.prototype.toString.call(value);
- }
-
- // Make dates with properties first say the date
- if (isDate(value)) {
- base = ' ' + Date.prototype.toUTCString.call(value);
- }
-
- // Make error with message first say the error
- if (isError(value)) {
- base = ' ' + formatError(value);
- }
-
- if (keys.length === 0 && (!array || value.length == 0)) {
- return braces[0] + base + braces[1];
- }
-
- if (recurseTimes < 0) {
- if (isRegExp(value)) {
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
- } else {
- return ctx.stylize('[Object]', 'special');
- }
- }
-
- ctx.seen.push(value);
-
- var output;
- if (array) {
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
- } else {
- output = keys.map(function(key) {
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
- });
- }
-
- ctx.seen.pop();
-
- return reduceToSingleString(output, base, braces);
-}
-
-
-function formatPrimitive(ctx, value) {
- if (isUndefined(value))
- return ctx.stylize('undefined', 'undefined');
- if (isString(value)) {
- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
- .replace(/'/g, "\\'")
- .replace(/\\"/g, '"') + '\'';
- return ctx.stylize(simple, 'string');
- }
- if (isNumber(value))
- return ctx.stylize('' + value, 'number');
- if (isBoolean(value))
- return ctx.stylize('' + value, 'boolean');
- // For some reason typeof null is "object", so special case here.
- if (isNull(value))
- return ctx.stylize('null', 'null');
-}
-
-
-function formatError(value) {
- return '[' + Error.prototype.toString.call(value) + ']';
-}
-
-
-function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
- var output = [];
- for (var i = 0, l = value.length; i < l; ++i) {
- if (hasOwnProperty(value, String(i))) {
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
- String(i), true));
- } else {
- output.push('');
- }
- }
- keys.forEach(function(key) {
- if (!key.match(/^\d+$/)) {
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
- key, true));
- }
- });
- return output;
-}
-
-
-function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
- var name, str, desc;
- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
- if (desc.get) {
- if (desc.set) {
- str = ctx.stylize('[Getter/Setter]', 'special');
- } else {
- str = ctx.stylize('[Getter]', 'special');
- }
- } else {
- if (desc.set) {
- str = ctx.stylize('[Setter]', 'special');
- }
- }
- if (!hasOwnProperty(visibleKeys, key)) {
- name = '[' + key + ']';
- }
- if (!str) {
- if (ctx.seen.indexOf(desc.value) < 0) {
- if (isNull(recurseTimes)) {
- str = formatValue(ctx, desc.value, null);
- } else {
- str = formatValue(ctx, desc.value, recurseTimes - 1);
- }
- if (str.indexOf('\n') > -1) {
- if (array) {
- str = str.split('\n').map(function(line) {
- return ' ' + line;
- }).join('\n').substr(2);
- } else {
- str = '\n' + str.split('\n').map(function(line) {
- return ' ' + line;
- }).join('\n');
- }
- }
- } else {
- str = ctx.stylize('[Circular]', 'special');
- }
- }
- if (isUndefined(name)) {
- if (array && key.match(/^\d+$/)) {
- return str;
- }
- name = JSON.stringify('' + key);
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
- name = name.substr(1, name.length - 2);
- name = ctx.stylize(name, 'name');
- } else {
- name = name.replace(/'/g, "\\'")
- .replace(/\\"/g, '"')
- .replace(/(^"|"$)/g, "'");
- name = ctx.stylize(name, 'string');
- }
- }
-
- return name + ': ' + str;
-}
-
-
-function reduceToSingleString(output, base, braces) {
- var numLinesEst = 0;
- var length = output.reduce(function(prev, cur) {
- numLinesEst++;
- if (cur.indexOf('\n') >= 0) numLinesEst++;
- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
- }, 0);
-
- if (length > 60) {
- return braces[0] +
- (base === '' ? '' : base + '\n ') +
- ' ' +
- output.join(',\n ') +
- ' ' +
- braces[1];
- }
-
- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
-}
-
-
-// NOTE: These type checking functions intentionally don't use `instanceof`
-// because it is fragile and can be easily faked with `Object.create()`.
-function isArray(ar) {
- return Array.isArray(ar);
-}
-exports.isArray = isArray;
-
-function isBoolean(arg) {
- return typeof arg === 'boolean';
-}
-exports.isBoolean = isBoolean;
-
-function isNull(arg) {
- return arg === null;
-}
-exports.isNull = isNull;
-
-function isNullOrUndefined(arg) {
- return arg == null;
-}
-exports.isNullOrUndefined = isNullOrUndefined;
-
-function isNumber(arg) {
- return typeof arg === 'number';
-}
-exports.isNumber = isNumber;
-
-function isString(arg) {
- return typeof arg === 'string';
-}
-exports.isString = isString;
-
-function isSymbol(arg) {
- return typeof arg === 'symbol';
-}
-exports.isSymbol = isSymbol;
-
-function isUndefined(arg) {
- return arg === void 0;
-}
-exports.isUndefined = isUndefined;
-
-function isRegExp(re) {
- return isObject(re) && objectToString(re) === '[object RegExp]';
-}
-exports.isRegExp = isRegExp;
-
-function isObject(arg) {
- return typeof arg === 'object' && arg !== null;
-}
-exports.isObject = isObject;
-
-function isDate(d) {
- return isObject(d) && objectToString(d) === '[object Date]';
-}
-exports.isDate = isDate;
-
-function isError(e) {
- return isObject(e) &&
- (objectToString(e) === '[object Error]' || e instanceof Error);
-}
-exports.isError = isError;
-
-function isFunction(arg) {
- return typeof arg === 'function';
-}
-exports.isFunction = isFunction;
-
-function isPrimitive(arg) {
- return arg === null ||
- typeof arg === 'boolean' ||
- typeof arg === 'number' ||
- typeof arg === 'string' ||
- typeof arg === 'symbol' || // ES6 symbol
- typeof arg === 'undefined';
-}
-exports.isPrimitive = isPrimitive;
-
-exports.isBuffer = require('./support/isBuffer');
-
-function objectToString(o) {
- return Object.prototype.toString.call(o);
-}
-
-
-function pad(n) {
- return n < 10 ? '0' + n.toString(10) : n.toString(10);
-}
-
-
-var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
- 'Oct', 'Nov', 'Dec'];
-
-// 26 Feb 16:19:34
-function timestamp() {
- var d = new Date();
- var time = [pad(d.getHours()),
- pad(d.getMinutes()),
- pad(d.getSeconds())].join(':');
- return [d.getDate(), months[d.getMonth()], time].join(' ');
-}
-
-
-// log is just a thin wrapper to console.log that prepends a timestamp
-exports.log = function() {
- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
-};
-
-
-/**
- * Inherit the prototype methods from one constructor into another.
- *
- * The Function.prototype.inherits from lang.js rewritten as a standalone
- * function (not on Function.prototype). NOTE: If this file is to be loaded
- * during bootstrapping this function needs to be rewritten using some native
- * functions as prototype setup using normal JavaScript does not work as
- * expected during bootstrapping (see mirror.js in r114903).
- *
- * @param {function} ctor Constructor function which needs to inherit the
- * prototype.
- * @param {function} superCtor Constructor function to inherit prototype from.
- */
-exports.inherits = require('inherits');
-
-exports._extend = function(origin, add) {
- // Don't do anything if add isn't an object
- if (!add || !isObject(add)) return origin;
-
- var keys = Object.keys(add);
- var i = keys.length;
- while (i--) {
- origin[keys[i]] = add[keys[i]];
- }
- return origin;
-};
-
-function hasOwnProperty(obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
-}
-
-}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./support/isBuffer":83,"_process":67,"inherits":82}]},{},[1]);
diff --git a/tests/lib/mocha-3.1.0/package.json b/tests/lib/mocha-3.1.0/package.json
deleted file mode 100644
index 4ec6546e6d..0000000000
--- a/tests/lib/mocha-3.1.0/package.json
+++ /dev/null
@@ -1,357 +0,0 @@
-{
- "name": "mocha",
- "version": "3.1.0",
- "description": "simple, flexible, fun test framework",
- "keywords": [
- "mocha",
- "test",
- "bdd",
- "tdd",
- "tap"
- ],
- "author": "TJ Holowaychuk <tj@vision-media.ca>",
- "contributors": [
- "aaroncrows (https://github.com/aaroncrows)",
- "Aaron Hamid <aaron@incsw.com> (https://github.com/ahamid)",
- "Aaron Heckmann <aaron.heckmann+github@gmail.com> (https://github.com/aheckmann)",
- "Adam Crabtree (CrabDude's alias) (https://github.com/CrabBot)",
- "Adam Gruber (https://github.com/adamgruber)",
- "Adrian Ludwig (https://github.com/adrian-ludwig)",
- "Ainthe Kitchen <a.in.the.k@gmail.com> (https://github.com/ainthek)",
- "ajaykodali (https://github.com/ajaykodali)",
- "Alex Early (https://github.com/aearly)",
- "Alex Pham <thedark1337@thedark1337.com> (https://github.com/thedark1337)",
- "amsul (https://github.com/amsul)",
- "Andreas Brekken <andreas@brekken.com> (https://github.com/abrkn)",
- "Andreas Lind <andreas@one.com> (https://github.com/papandreou)",
- "Andrew Miller <vnikitin@live.com> (https://github.com/vnikiti)",
- "Andrew Nesbitt <andrewnez@gmail.com> (https://github.com/andrew)",
- "Andrey Popp <8mayday@gmail.com> (https://github.com/andreypopp)",
- "Andrii Shumada <eagleeyes91@gmail.com> (https://github.com/eagleeye)",
- "Anis Safine (https://github.com/anis)",
- "Arian Stolwijk <stolwijk.arian@gmail.com> (https://github.com/arian)",
- "Ariel Mashraki <ariel@mashraki.co.il> (https://github.com/a8m)",
- "Arnaud Brousseau (https://github.com/ArnaudBrousseau)",
- "Atsuya Takagi <atsuya.takagi@gmail.com> (https://github.com/atsuya)",
- "Attila Domokos (https://github.com/adomokos)",
- "Austin Birch (https://github.com/austinbirch)",
- "Avi Vahl (https://github.com/AviVahl)",
- "Ben Bradley (https://github.com/ben-bradley)",
- "beneidel (https://github.com/beneidel)",
- "Benjie Gillam (https://github.com/benjie)",
- "Ben Noordhuis <info@bnoordhuis.nl> (https://github.com/bnoordhuis)",
- "Benoit Larroque (https://github.com/zetaben)",
- "Benoît Zugmeyer (https://github.com/BenoitZugmeyer)",
- "Ben Vinegar (https://github.com/benvinegar)",
- "Berker Peksag <berker.peksag@gmail.com> (https://github.com/berkerpeksag)",
- "Bjørge Næss (https://github.com/bjoerge)",
- "Brendan Nee <brendan@blinktag.com> (https://github.com/brendannee)",
- "Brian Beck <exogen@gmail.com> (https://github.com/exogen)",
- "Brian C <brian.m.carlson@gmail.com> (https://github.com/brianc)",
- "Brian Lalor <blalor@bravo5.org> (https://github.com/blalor)",
- "Brian Moore (https://github.com/bionicbrian)",
- "Bryan Donovan (https://github.com/BryanDonovan)",
- "Buck Doyle (https://github.com/backspace)",
- "C. Scott Ananian <cscott@cscott.net> (https://github.com/cscott)",
- "Casey Foster (https://github.com/caseywebdev)",
- "Charles Lowell <cowboyd@frontside.io> (https://github.com/cowboyd)",
- "Chris Buckley <chris@cmbuckley.co.uk> (https://github.com/cmbuckley)",
- "Christopher Hiller <boneskull@boneskull.com> (https://github.com/boneskull)",
- "Chris Wren <chriswrendev@gmail.com> (https://github.com/ChrisWren)",
- "Clemens Stolle (https://github.com/klaemo)",
- "Connor Dunn (https://github.com/Connorhd)",
- "Corey Butler (https://github.com/coreybutler)",
- "Cory Thomas (https://github.com/dump247)",
- "cybertk (https://github.com/cybertk)",
- "Daniel Ericsson (https://github.com/monowerker)",
- "Daniel St. Jules <danielst.jules@gmail.com> (https://github.com/danielstjules)",
- "Daniel Stockman <daniel.stockman@gmail.com> (https://github.com/evocateur)",
- "Dave McKenna <davemckenna01@gmail.com> (https://github.com/davemckenna01)",
- "David da Silva <yo@dasilvacont.in> (https://github.com/dasilvacontin)",
- "David Henderson (https://github.com/dhendo)",
- "Denis Bardadym <bardadymchik@gmail.com> (https://github.com/btd)",
- "Devin Weaver <suki@tritarget.org> (https://github.com/sukima)",
- "Diogo Monteiro <diogo.gmt@gmail.com> (https://github.com/diogogmt)",
- "Dmitry Shirokov <deadrunk@gmail.com> (https://github.com/runk)",
- "Domenic Denicola <d@domenic.me> (https://github.com/domenic)",
- "Dominic Barnes <dominic@dbarnes.info> (https://github.com/dominicbarnes)",
- "domq (https://github.com/domq)",
- "Douglas Wilson <doug@somethingdoug.com> (https://github.com/dougwilson)",
- "Duncan Beevers <duncan@dweebd.com> (https://github.com/duncanbeevers)",
- "Duncan Wong (https://github.com/badunk)",
- "eiji.ienaga (https://github.com/haru01)",
- "Fabio Crisci <piuccio@gmail.com> (https://github.com/piuccio)",
- "Fede Ramirez <i@2fd.me> (https://github.com/2fd)",
- "Fedor Indutny <fedor@indutny.com> (https://github.com/indutny)",
- "fengmk2 <m@fengmk2.com> (https://github.com/fengmk2)",
- "Florian Margaine <florian@margaine.com> (https://github.com/ralt)",
- "Forbes Lindesay (https://github.com/ForbesLindesay)",
- "Frederico Silva (https://github.com/fredericosilva)",
- "Fredrik Enestad <fredrik.enestad@soundtrackyourbrand.com> (https://github.com/fredr)",
- "Fredrik Lindin (https://github.com/Cowboy-coder)",
- "Gabriel Silk (https://github.com/gsilk)",
- "Gareth Aye <gareth.aye@gmail.com> (https://github.com/gaye)",
- "Gavin Mogan <gavin@gavinmogan.com> (https://github.com/halkeye)",
- "gigadude (https://github.com/gigadude)",
- "Giovanni Bassi (https://github.com/giggio)",
- "Glen Huang <curvedmark@gmail.com> (https://github.com/curvedmark)",
- "Glen Mailer <glen@stainlessed.co.uk> (https://github.com/glenjamin)",
- "Greg Perkins <gregperkins@alum.mit.edu> (https://github.com/gregrperkins)",
- "Guillermo Rauch <rauchg@gmail.com> (https://github.com/rauchg)",
- "Guy Arye (https://github.com/aryeguy)",
- "Gyandeep Singh <gyandeeps@gmail.com> (https://github.com/gyandeeps)",
- "Harish <hyeluri@gmail.com> (https://github.com/hyeluri)",
- "Harry Brundage <harry.brundage@gmail.com> (https://github.com/airhorns)",
- "Ian Remmel <design@ianwremmel.com> (https://github.com/ianwremmel)",
- "Ian Storm Taylor (https://github.com/ianstormtaylor)",
- "Ian Young <ian@iangreenleaf.com> (https://github.com/iangreenleaf)",
- "Ivan (https://github.com/ivanstoyanov)",
- "Jaakko Salonen (https://github.com/jsalonen)",
- "Jacob Wejendorp <jacob@wejendorp.dk> (https://github.com/wejendorp)",
- "Jake Craige (https://github.com/jakecraige)",
- "Jake Marsh (https://github.com/jakemmarsh)",
- "Jake Mc <jake.mc@icloud.com> (https://github.com/startswithaj)",
- "Jake Verbaten <raynos2@gmail.com> (https://github.com/Raynos)",
- "Jakub Nešetřil <jakub@apiary.io> (https://github.com/zzen)",
- "James Bowes (https://github.com/jbowes)",
- "James Carr <james.r.carr@gmail.com> (https://github.com/jamescarr)",
- "James G. Kim <jgkim@jayg.org> (https://github.com/jgkim)",
- "James Lal <james@lightsofapollo.com> (https://github.com/lightsofapollo)",
- "James Nylen <jnylen@gmail.com> (https://github.com/nylen)",
- "Jason (https://github.com/jlai)",
- "Jason Barry <jay@jcbarry.com> (https://github.com/JCBarry)",
- "Javier Aranda <javier.aranda.varo@gmail.com> (https://github.com/javierav)",
- "jcreamer898 (https://github.com/jcreamer898)",
- "Jean Ponchon (https://github.com/nopnop)",
- "Jeff Kunkle (https://github.com/kunklejr)",
- "Jeff Schilling <jeff@manicwave.com> (https://github.com/jschilli)",
- "JeongHoon Byun (aka Outsider) <outsideris@gmail.com> (https://github.com/outsideris)",
- "Jeremy Martin (https://github.com/jmar777)",
- "jimenglish81 (https://github.com/jimenglish81)",
- "Jimmy Cuadra (https://github.com/jimmycuadra)",
- "jldailey (https://github.com/jldailey)",
- "jleyba (https://github.com/jleyba)",
- "Joey Cozza <joeycozza@gmail.com> (https://github.com/joeycozza)",
- "Johnathon Sanders (https://github.com/outdooricon)",
- "John Doty <jrhdoty@gmail.com> (https://github.com/jrhdoty)",
- "John Firebaugh <john.firebaugh@gmail.com> (https://github.com/jfirebaugh)",
- "John Reeves (https://github.com/jonnyreeves)",
- "Jo Liss <joliss42@gmail.com> (https://github.com/joliss)",
- "Jonas Dohse (https://github.com/dohse)",
- "Jonathan Kim <hello@jkimbo.co.uk> (https://github.com/jkimbo)",
- "Jonathan Park <jonathan.daniel.park@gmail.com> (https://github.com/park9140)",
- "jongleberry <me@jongleberry.com> (https://github.com/jonathanong)",
- "Jordan Sexton <jordan@jordansexton.com> (https://github.com/jordansexton)",
- "Joseph Spencer (https://github.com/jsdevel)",
- "Josh Lory (https://github.com/joshlory)",
- "Joshua Appelman <joshua@jbna.nl> (https://github.com/jbnicolai)",
- "Joshua Krall <joshuakrall@pobox.com> (https://github.com/jkrall)",
- "João Moreno (https://github.com/joaomoreno)",
- "João Paulo Bochi <jpbochi@gmail.com> (https://github.com/jpbochi)",
- "jugglinmike (https://github.com/jugglinmike)",
- "Julien Wajsberg (https://github.com/julienw)",
- "Jussi Virtanen <contact@jvirtanen.org> (https://github.com/jvirtanen)",
- "Justin DuJardin (https://github.com/justindujardin)",
- "Juzer Ali <juzerali@live.com> (https://github.com/juzerali)",
- "Jérémie Astori (https://github.com/astorije)",
- "Katie Gengler (https://github.com/kategengler)",
- "Kazuhito Hokamura (https://github.com/hokaccha)",
- "Keith Cirkel (https://github.com/keithamus)",
- "Kent C. Dodds <kent+github@doddsfamily.us> (https://github.com/kentcdodds)",
- "Kevin Burke <kev@inburke.com> (https://github.com/kevinburke)",
- "Kevin Conway <kevinjacobconway@gmail.com> (https://github.com/kevinconway)",
- "Kevin Kirsche <Kev.Kirsche@gmail.com> (https://github.com/kkirsche)",
- "Kirill Korolyov <kirill.korolyov@gmail.com> (https://github.com/Dremora)",
- "Koen Punt <mail@koen.pt> (https://github.com/koenpunt)",
- "Konstantin Käfer <mail@kkaefer.com> (https://github.com/kkaefer)",
- "Kris Rasmussen (https://github.com/krisr)",
- "Kyle Mitchell <kyle@kemitchell.com> (https://github.com/kemitchell)",
- "lakmeer (https://github.com/lakmeer)",
- "Liam Newman <bitwiseman@gmail.com> (https://github.com/bitwiseman)",
- "Linus Unnebäck <linus@folkdatorn.se> (https://github.com/LinusU)",
- "Long Ho <holevietlong@gmail.com> (https://github.com/longlho)",
- "László Bácsi <lackac@lackac.hu> (https://github.com/lackac)",
- "Maciej Małecki <me@mmalecki.com> (https://github.com/mmalecki)",
- "Mal Graty (https://github.com/mal)",
- "Marcello Bastéa-Forte <marcello@cellosoft.com> (https://github.com/marcello3d)",
- "Marc Kuo <marc@routific.com> (https://github.com/mck-)",
- "Mark Banner (https://github.com/Standard8)",
- "Matija Marohnić <matija.marohnic@gmail.com> (https://github.com/silvenon)",
- "Matthew Shanley <matthewshanley@littlesecretsrecords.com> (https://github.com/arkadyan)",
- "mattias-lw (https://github.com/mattias-lw)",
- "Matt Robenolt <m@robenolt.com> (https://github.com/mattrobenolt)",
- "Matt Smith <matt@twobitfool.com> (https://github.com/twobitfool)",
- "Max Goodman <c@chromako.de> (https://github.com/chromakode)",
- "Maximilian Antoni <mail@maxantoni.de> (https://github.com/mantoni)",
- "Merrick Christensen <merrick.christensen@gmail.com> (https://github.com/iammerrick)",
- "michael-adsk (https://github.com/michael-adsk)",
- "Michael Demmer (https://github.com/demmer)",
- "Michael Jackson <mjijackson@gmail.com> (https://github.com/mjackson)",
- "Michael Schoonmaker <michael.r.schoonmaker@gmail.com> (https://github.com/Schoonology)",
- "Michal Charemza (https://github.com/michalc)",
- "Mike Olson (https://github.com/mwolson)",
- "Mislav Marohnić <mislav.marohnic@gmail.com> (https://github.com/mislav)",
- "mrShturman (https://github.com/mrShturman)",
- "Nathan Alderson <nathan@nathanalderson.com> (https://github.com/nathanalderson)",
- "Nathan Black <nathan@nathanblack.org> (https://github.com/nathanboktae)",
- "Nathan Bowser <nbowser@gmail.com> (https://github.com/nathanbowser)",
- "Nathan Houle <nathan+github@nathanhoule.com> (https://github.com/ndhoule)",
- "Nathan Rajlich <nathan@tootallnate.net> (https://github.com/TooTallNate)",
- "Nick Fitzgerald (https://github.com/fitzgen)",
- "noirlab (https://github.com/noirlab)",
- "Noshir Patel <nosh@blackpiano.com> (https://github.com/noshir-patel)",
- "OlegTsyba <oleg.tsyba.ua@gmail.com> (https://github.com/OlegTsyba)",
- "omar (https://github.com/omardelarosa)",
- "Panu Horsmalahti <panu.horsmalahti@iki.fi> (https://github.com/panuhorsmalahti)",
- "Parker Moore <email@byparker.com> (https://github.com/parkr)",
- "Paul Armstrong (https://github.com/paularmstrong)",
- "Paul Miller <paul+gh@paulmillr.com> (https://github.com/paulmillr)",
- "Pavel Zubkou (https://github.com/irnc)",
- "Pete Hawkins (https://github.com/phawk)",
- "Phil Sung <philbert@gmail.com> (https://github.com/psung)",
- "Prayag Verma <prayag.verma@gmail.com> (https://github.com/pra85)",
- "qiu zuhui <qiuzuhui@gmail.com> (https://github.com/qiuzuhui)",
- "Quang Van <quang@boldapps.io> (https://github.com/quangv)",
- "Rauno (https://github.com/Rauno56)",
- "Refael Ackermann <me@refack.com> (https://github.com/refack)",
- "Richard Dingwall <rdingwall@gmail.com> (https://github.com/rdingwall)",
- "Richard Knop (https://github.com/RichardKnop)",
- "Rico Sta. Cruz <hi@ricostacruz.com> (https://github.com/rstacruz)",
- "Robert Rossmann (https://github.com/Alaneor)",
- "Rob Wu <rob@robwu.nl> (https://github.com/Rob--W)",
- "Romain (https://github.com/rprieto)",
- "Roman Neuhauser <rneuhauser@sigpipe.cz> (https://github.com/roman-neuhauser)",
- "Roman Shtylman (https://github.com/defunctzombie)",
- "Russ Bradberry <devdazed@me.com> (https://github.com/devdazed)",
- "Russell Munson (https://github.com/rmunson)",
- "Ryan <ryan.shaw@min.vc> (https://github.com/ryan-shaw)",
- "Ryan Hubbard (https://github.com/ryedog)",
- "Ryunosuke Sato <tricknotes.rs@gmail.com> (https://github.com/tricknotes)",
- "ryym (https://github.com/ryym)",
- "Salehen Shovon Rahman <sal@linux.com> (https://github.com/shovon)",
- "Salvador de la Puente González <salva@unoyunodiez.com> (https://github.com/delapuente)",
- "Sam Mussell (https://github.com/smussell)",
- "Samuel Goldszmidt <samuel.goldszmidt@gmail.com> (https://github.com/ouhouhsami)",
- "Sasha Koss <kossnocorp@gmail.com> (https://github.com/kossnocorp)",
- "Scott Santucci <ScottFreeCode@gmail.com> (https://github.com/ScottFreeCode)",
- "Sean Lang <slang800@gmail.com> (https://github.com/slang800)",
- "seb vincent <seb.vincent@gmail.com> (https://github.com/sebv)",
- "Seiya Konno <nulltask@gmail.com> (https://github.com/nulltask)",
- "Sergey Simonchik (https://github.com/segrey)",
- "Sergio Santoro (https://github.com/taueres)",
- "Shahar Soel (https://github.com/bd82)",
- "Shaine Hatch (https://github.com/shaine)",
- "Shiwei Wang (https://github.com/wsw0108)",
- "Simon Gaeremynck (https://github.com/simong)",
- "Simon Goumaz (https://github.com/sgoumaz)",
- "Sindre Sorhus <sindresorhus@gmail.com> (https://github.com/sindresorhus)",
- "slientcloud <rjmuqiang@gmail.com> (https://github.com/silentcloud)",
- "Sorin Iclanzan (https://github.com/iclanzan)",
- "Standa Opichal <opichals@gmail.com> (https://github.com/opichals)",
- "Stephen Mathieson <me@stephenmathieson.com> (https://github.com/stephenmathieson)",
- "Steve Mason (https://github.com/spmason)",
- "Stewart Taylor <stewart@taylore.net> (https://github.com/Stewart-Taylor)",
- "Sune Simonsen <sune@we-knowhow.dk> (https://github.com/sunesimonsen)",
- "Sylvain Faucherand (https://github.com/slyg)",
- "Takuya Nishigori <nishigori.tak@gmail.com> (https://github.com/nishigori)",
- "Taylor Gautier (https://github.com/tsgautier)",
- "Teddy Zeenny (https://github.com/teddyzeenny)",
- "Thomas Grainger <https//@graingert.co.uk> (https://github.com/graingert)",
- "Tim Ehat (https://github.com/timehat)",
- "Timothy Gu <timothygu99@gmail.com> (https://github.com/TimothyGu)",
- "Timo Tijhof <krinklemail@gmail.com> (https://github.com/Krinkle)",
- "Tingan Ho <tingan87@gmail.com> (https://github.com/tinganho)",
- "TJ Holowaychuk <tj@vision-media.ca> (https://github.com/tj)",
- "Tobias Bieniek <tobias.bieniek@gmail.com> (https://github.com/Turbo87)",
- "Toby Ho <airportyh@gmail.com> (https://github.com/airportyh)",
- "Todd Agulnick (https://github.com/tawdle)",
- "Tom Hughes (https://github.com/tomhughes)",
- "Tommy Montgomery (https://github.com/tmont)",
- "traleig1 (https://github.com/traleig1)",
- "Travis Jeffery <tj@travisjeffery.com> (https://github.com/travisjeffery)",
- "Tyson Tate <tyson@tysontate.com> (https://github.com/tysontate)",
- "Valentin Agachi (https://github.com/avaly)",
- "Victor Costan <victor@costan.us> (https://github.com/pwnall)",
- "Vladimir Chernis (https://github.com/vlazzle)",
- "Vlad Magdalin <vlad@webflow.com> (https://github.com/callmevlad)",
- "Will Langstroth (https://github.com/wlangstroth)",
- "Wil Moore III <wil.moore@wilmoore.com> (https://github.com/wilmoore)",
- "Xavier Antoviaque <xavier@opencraft.com> (https://github.com/antoviaque)",
- "Xavier Damman <xdamman@gmail.com> (https://github.com/xdamman)",
- "Yanis Wang <yanis.wang@gmail.com> (https://github.com/yaniswang)",
- "yuitest <developer.yuitest+github@cjhat.net> (https://github.com/yuitest)",
- "Zhiye Li <github@zhiye.li> (https://github.com/zhiyelee)",
- "Zhouxuan Yang <fool2fish@gmail.com> (https://github.com/fool2fish)",
- "Zsolt Takács <firstname at lastname dot cc> (https://github.com/oker1)"
- ],
- "license": "MIT",
- "repository": {
- "type": "git",
- "url": "https://github.com/mochajs/mocha.git"
- },
- "bin": {
- "mocha": "./bin/mocha",
- "_mocha": "./bin/_mocha"
- },
- "engines": {
- "node": ">= 0.10.x",
- "npm": ">= 1.4.x"
- },
- "scripts": {
- "test": "make test"
- },
- "dependencies": {
- "browser-stdout": "1.3.0",
- "commander": "2.9.0",
- "debug": "2.2.0",
- "diff": "1.4.0",
- "escape-string-regexp": "1.0.5",
- "glob": "7.0.5",
- "growl": "1.9.2",
- "json3": "3.3.2",
- "lodash.create": "3.1.1",
- "mkdirp": "0.5.1",
- "supports-color": "3.1.2"
- },
- "devDependencies": {
- "browserify": "^13.0.0",
- "coffee-script": "^1.10.0",
- "eslint": "^2.13.1",
- "expect.js": "^0.3.1",
- "karma": "^1.1.0",
- "karma-browserify": "^5.0.5",
- "karma-expect": "^1.1.2",
- "karma-no-mocha": "^2.0.0",
- "karma-phantomjs-launcher": "^0.2.3",
- "karma-sauce-launcher": "^1.0.0",
- "karma-spec-reporter": "0.0.26",
- "phantomjs": "1.9.8",
- "rimraf": "^2.5.2",
- "should": "^9.0.2",
- "through2": "^2.0.1",
- "watchify": "^3.7.0"
- },
- "files": [
- "bin",
- "images",
- "lib",
- "index.js",
- "mocha.css",
- "mocha.js",
- "browser-entry.js",
- "LICENSE",
- "bower.json"
- ],
- "browser": {
- "debug": "./lib/browser/debug.js",
- "events": "./lib/browser/events.js",
- "tty": "./lib/browser/tty.js",
- "./index.js": "./browser-entry.js",
- "fs": false,
- "glob": false,
- "path": false,
- "supports-color": false
- },
- "homepage": "https://mochajs.org",
- "logo": "https://cldup.com/S9uQ-cOLYz.svg"
-}
diff --git a/tests/lib/mocha-3.1.0/scripts/dedefine.js b/tests/lib/mocha-3.1.0/scripts/dedefine.js
deleted file mode 100644
index c647c0e083..0000000000
--- a/tests/lib/mocha-3.1.0/scripts/dedefine.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict';
-
-/**
- * This is a transform stream we're using to strip AMD calls from
- * dependencies in our Browserify bundle.
- */
-
-var through = require('through2');
-var defineRx = /typeof define === ['"]function['"] && define\.amd/g;
-
-function createStream() {
- return through.obj(function(chunk, enc, next) {
- this.push(String(chunk)
- .replace(defineRx, 'false'));
- next();
- });
-}
-
-module.exports = function(b) {
- function wrap() {
- b.pipeline.get('wrap').push(createStream());
- }
-
- b.on('reset', wrap);
- wrap();
-};
diff --git a/tests/lib/mocha-3.1.0/scripts/travis-after-script.sh b/tests/lib/mocha-3.1.0/scripts/travis-after-script.sh
deleted file mode 100644
index e93c98f796..0000000000
--- a/tests/lib/mocha-3.1.0/scripts/travis-after-script.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-# syncs Karma test bundles to S3 if $S3 is set
-
-if [ ${S3} ]
-then
- mkdir -p .karma/${TRAVIS_JOB_NUMBER}
- cp ./mocha.js ".karma/${TRAVIS_JOB_NUMBER}/mocha.js"
- aws s3 sync ".karma/${TRAVIS_JOB_NUMBER}" "s3://mochajs/karma-bundles/${TRAVIS_JOB_NUMBER}"
-fi
diff --git a/tests/lib/mocha-3.1.0/scripts/travis-before-install.sh b/tests/lib/mocha-3.1.0/scripts/travis-before-install.sh
deleted file mode 100644
index 9913070ae9..0000000000
--- a/tests/lib/mocha-3.1.0/scripts/travis-before-install.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env bash
-
-npm install --production
-# this avoids our mocha.opts (and thus devDependencies) in a roundabout way
-./bin/mocha --opts /dev/null --reporter spec test/sanity/sanity.spec.js
diff --git a/tests/lib/mocha-3.1.0/scripts/travis-before-script.sh b/tests/lib/mocha-3.1.0/scripts/travis-before-script.sh
deleted file mode 100644
index e5c6b25414..0000000000
--- a/tests/lib/mocha-3.1.0/scripts/travis-before-script.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env bash
-# installs awscli from pip if $S3 is set
-
-if [ ${S3} ]
-then
- sudo pip install awscli
-fi
diff --git a/tests/lib/mocha-3.1.0/test/.eslintrc b/tests/lib/mocha-3.1.0/test/.eslintrc
deleted file mode 100644
index 956287d60c..0000000000
--- a/tests/lib/mocha-3.1.0/test/.eslintrc
+++ /dev/null
@@ -1,5 +0,0 @@
----
-env:
- mocha: true
-globals:
- expect: false
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/context.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/context.spec.js
deleted file mode 100644
index 69dea139c9..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/context.spec.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(){
- expect(this.calls).to.eql(['before', 'before two']);
- this.calls.push('test');
- })
-
- after(function(){
- expect(this.calls).to.eql(['before', 'before two', 'test']);
- this.calls.push('after two');
- })
- })
-
- after(function(){
- expect(this.calls).to.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(){
- expect(this.hiddenFromSibling).to.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(){
- expect('This should be hidden').not.to.eql(this.hiddenFromSibling);
- this.visibleFromTestSibling = 'Visible from test sibling';
- })
-
- it('should allow test siblings to modify shared context', function(){
- expect('Visible from test sibling').to.eql(this.visibleFromTestSibling);
- })
-
- it('should have reset this.calls before describe', function(){
- expect(this.calls).to.eql(['before', 'before sibling']);
- })
- })
-
- after(function(){
- expect(this.calls).to.eql(['before', 'before sibling']);
- })
-
-})
-
-describe('timeout()', function(){
- it('should return the timeout', function(){
- expect(this.timeout()).to.equal(200);
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/duration.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/duration.spec.js
deleted file mode 100644
index 4f319b8a3c..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/duration.spec.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-3.1.0/test/acceptance/fs.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/fs.spec.js
deleted file mode 100644
index 3a70f2752c..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/fs.spec.js
+++ /dev/null
@@ -1,20 +0,0 @@
-var fs = require('fs');
-var path = require('path');
-var os = require('os');
-var tmpFile = path.join.bind(path, os.tmpdir());
-
-describe('fs.readFile()', function(){
- describe('when the file exists', function(){
- it('should succeed', function(done){
- fs.writeFile(tmpFile('mocha'), 'wahoo', done)
- })
- })
-
- describe('when the file does not exist', function(){
- it('should fail', function(done){
- // uncomment
- // fs.readFile(tmpFile('does-not-exist'), done);
- done();
- })
- })
-})
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/glob/glob.sh b/tests/lib/mocha-3.1.0/test/acceptance/glob/glob.sh
deleted file mode 100644
index 823ba07fb9..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/glob/glob.sh
+++ /dev/null
@@ -1,66 +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 'Could not find any test files matching pattern' || {
- echo Globbing './*-none.js' in `pwd` should match no files and run no tests.
- exit 1
-}
-
-../../../bin/mocha -R json-stream ./*.js ./*-none.js >& /tmp/mocha-glob.txt || {
- echo Globbing ./*.js ./*-none.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,' &&
-cat /tmp/mocha-glob.txt | grep -q -F 'Could not find any test files matching pattern' || {
- echo Globbing ./*.js ./*-none.js in `pwd` should match glob.js with one test inside and display one warning for the non-existing file.
- 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 'Could not find any test files matching pattern' || {
- 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-3.1.0/test/acceptance/glob/glob.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/glob/glob.spec.js
deleted file mode 100644
index 3029ae82ee..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/glob/glob.spec.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-3.1.0/test/acceptance/globals.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/globals.spec.js
deleted file mode 100644
index f8ef804b23..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/globals.spec.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-3.1.0/test/acceptance/http.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/http.spec.js
deleted file mode 100644
index 43b8588508..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/http.spec.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){
- expect(res).to.have.property('statusCode', 200);
- done();
- })
- })
-})
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/interfaces/bdd.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/interfaces/bdd.spec.js
deleted file mode 100644
index ba444c8f7f..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/interfaces/bdd.spec.js
+++ /dev/null
@@ -1,32 +0,0 @@
-describe('integer primitives', function(){
- describe('arithmetic', function(){
- it('should add', function(){
- expect(1 + 1).to.equal(2);
- expect(2 + 2).to.equal(4);
- })
-
- it('should subtract', function(){
- expect(1 - 1).to.equal(0);
- expect(2 - 1).to.equal(1);
- })
- })
-})
-
-describe('integer primitives', function(){
- describe('arithmetic is not', function(){
- it('should add', function(){
- expect(1 + 1).not.to.equal(3);
- expect(2 + 2).not.to.equal(5);
- })
- })
-})
-
-context('test suite', function(){
- beforeEach(function(){
- this.number = 5;
- })
-
- specify('share a property', function(){
- expect(this.number).to.equal(5);
- })
-})
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/interfaces/exports.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/interfaces/exports.spec.js
deleted file mode 100644
index 08db71200b..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/interfaces/exports.spec.js
+++ /dev/null
@@ -1,43 +0,0 @@
-var calls = [];
-
-exports.Array = {
- before: function(){
- calls.push('before');
- },
-
- after: function(){
- calls.push('after');
- expect(calls).to.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');
- expect([1,2,3].indexOf(5)).to.equal(-1);
- expect([1,2,3].indexOf(0)).to.equal(-1);
- },
-
- 'should return the correct index when the value is present': function(){
- calls.push('two');
- expect([1,2,3].indexOf(1)).to.equal(0);
- expect([1,2,3].indexOf(2)).to.equal(1);
- expect([1,2,3].indexOf(3)).to.equal(2);
- }
- }
-};
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/interfaces/qunit.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/interfaces/qunit.spec.js
deleted file mode 100644
index d452e769c5..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/interfaces/qunit.spec.js
+++ /dev/null
@@ -1,23 +0,0 @@
-function ok(expr, msg) {
- if (!expr) throw new Error(msg);
-}
-
-suite('integer primitives');
-
-test('should add', function(){
- var number = 2 + 2;
- ok(number == 4);
-});
-
-test('should decrement', function(){
- var number = 3;
- ok(--number == 2);
- ok(--number == 1);
- ok(--number == 0);
-});
-
-suite('String');
-
-test('#length', function(){
- ok('foo'.length == 3);
-});
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/interfaces/tdd.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/interfaces/tdd.spec.js
deleted file mode 100644
index 7ad079e36d..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/interfaces/tdd.spec.js
+++ /dev/null
@@ -1,40 +0,0 @@
-suite('integer primitives', function(){
- suite('arithmetic', function(){
- var initialValue = 41;
-
- suiteSetup(function(done){
- expect(initialValue).to.eql(41);
- initialValue += 1;
- done();
- });
-
- test('should add', function(){
- expect(initialValue).to.eql(42);
- expect(1 + 1).to.equal(2);
- expect(2 + 2).to.equal(4);
- });
-
- test('should subtract', function(){
- expect(initialValue).to.eql(42);
- expect(1 - 1).to.equal(0);
- expect(2 - 1).to.equal(1);
- });
-
- test.skip('should skip this test', function(){
- var zero = 0;
- expect(zero).to.equal(1, 'this test should have been skipped');
- });
-
- suite.skip('should skip this suite', function(){
- test('should skip this test', function(){
- var zero = 0;
- expect(zero).to.equal(1, 'this test should have been skipped');
- });
- });
-
- suiteTeardown(function(done){
- expect(initialValue).to.eql(42);
- done();
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/lookup-files.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/lookup-files.spec.js
deleted file mode 100644
index 5d4a48d8af..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/lookup-files.spec.js
+++ /dev/null
@@ -1,90 +0,0 @@
-'use strict';
-
-var utils = require('../../lib/utils');
-var fs = require('fs');
-var path = require('path');
-var os = require('os');
-var mkdirp = require('mkdirp');
-var rimraf = require('rimraf');
-
-describe('lookupFiles', function() {
- var tmpDir = path.join(os.tmpDir(), 'mocha-lookup-files');
- var existsSync = fs.existsSync;
- var tmpFile = path.join.bind(path, tmpDir);
- var symlinkSupported = false;
-
- (function testSymlinkSupport() {
- makeTempDir();
-
- fs.writeFileSync(tmpFile('mocha-utils.js'), 'yippy skippy ying yang yow');
- try {
- fs.symlinkSync(tmpFile('mocha-utils.js'), tmpFile('mocha-utils-link.js'));
- symlinkSupported = true;
- } catch (ignored) {
- // ignored
- } finally {
- removeTempDir();
- }
- }());
-
- beforeEach(function() {
- makeTempDir();
-
- fs.writeFileSync(tmpFile('mocha-utils.js'), 'yippy skippy ying yang yow');
- if (symlinkSupported) {
- fs.symlinkSync(tmpFile('mocha-utils.js'), tmpFile('mocha-utils-link.js'));
- }
- });
-
- (symlinkSupported ? it : it.skip)('should not choke on symlinks', function() {
- expect(utils.lookupFiles(tmpDir, ['js'], false))
- .to
- .contain(tmpFile('mocha-utils-link.js'))
- .and
- .contain(tmpFile('mocha-utils.js'))
- .and
- .have
- .length(2);
- expect(existsSync(tmpFile('mocha-utils-link.js')))
- .to
- .be(true);
- fs.renameSync(tmpFile('mocha-utils.js'), tmpFile('bob'));
- expect(existsSync(tmpFile('mocha-utils-link.js')))
- .to
- .be(false);
- expect(utils.lookupFiles(tmpDir, ['js'], false))
- .to
- .eql([]);
- });
-
- it('should accept a glob "path" value', function() {
- var res = utils.lookupFiles(tmpFile('mocha-utils*'), ['js'], false)
- .map(path.normalize.bind(path));
-
- var expectedLength = 0;
- var ex = expect(res)
- .to
- .contain(tmpFile('mocha-utils.js'));
- expectedLength++;
-
- if (symlinkSupported) {
- ex = ex.and
- .contain(tmpFile('mocha-utils-link.js'));
- expectedLength++;
- }
-
- ex.and
- .have
- .length(expectedLength);
- });
-
- afterEach(removeTempDir);
-
- function makeTempDir() {
- mkdirp.sync(tmpDir);
- }
-
- function removeTempDir() {
- rimraf.sync(tmpDir);
- }
-});
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/misc/exit.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/misc/exit.spec.js
deleted file mode 100644
index 113e392300..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/misc/exit.spec.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-3.1.0/test/acceptance/misc/many.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/misc/many.spec.js
deleted file mode 100644
index 26538bc66e..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/misc/many.spec.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-3.1.0/test/acceptance/misc/nontty.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/misc/nontty.spec.js
deleted file mode 100644
index 2372a660b9..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/misc/nontty.spec.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-3.1.0/test/acceptance/misc/only/bdd-require.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/misc/only/bdd-require.spec.js
deleted file mode 100644
index 516dad7afa..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/misc/only/bdd-require.spec.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/*jshint node: true */
-
-var mocha = require('../../../../lib/mocha');
-
-var beforeEach = mocha.beforeEach;
-var it = mocha.it;
-var describe = mocha.describe;
-
-describe('it.only via require("mocha")', function() {
- beforeEach(function() {
- this.didRunBeforeEach = true;
- });
- describe("nested within a describe/context", function() {
- it.only('should run all enclosing beforeEach hooks', function() {
- require('assert').equal(this.didRunBeforeEach, true);
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/misc/only/bdd.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/misc/only/bdd.spec.js
deleted file mode 100644
index 7a33a74eac..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/misc/only/bdd.spec.js
+++ /dev/null
@@ -1,125 +0,0 @@
-describe('should only run .only test in this bdd suite', function() {
- it('should not run this test', function() {
- (0).should.equal(1, 'this test should have been skipped');
- });
- it.only('should run this test', function() {
- (0).should.equal(0, 'this .only test should run');
- });
- it('should run this test, not (includes the title of the .only test)', function() {
- (0).should.equal(1, 'this test should have been skipped');
- });
-});
-
-describe('should not run this suite', function() {
- it('should not run this test', function() {
- (true).should.equal(false);
- });
-
- it('should not run this test', function() {
- (true).should.equal(false);
- });
-
- it('should not run this test', function() {
- (true).should.equal(false);
- });
-});
-
-describe.only('should run all tests in this bdd suite', function() {
- it('should run this test #1', function() {
- (true).should.equal(true);
- });
-
- it('should run this test #2', function() {
- (1).should.equal(1);
- });
-
- it('should run this test #3', function() {
- ('foo').should.equal('foo');
- });
-});
-
-describe('should run only suites that marked as `only`', function() {
- describe.only('should run all this tdd suite', function() {
- it('should run this test #1', function() {
- (true).should.equal(true);
- });
-
- it('should run this test #2', function() {
- (true).should.equal(true);
- });
- });
-
- describe('should not run this suite', function() {
- it('should run this test', function() {
- (true).should.equal(false);
- });
- });
-});
-
-// Nested situation
-describe('should not run parent tests', function() {
- it('should not run this test', function() {
- (true).should.equal(false);
- });
- describe('and not the child tests too', function() {
- it('should not run this test', function() {
- (true).should.equal(false);
- });
- describe.only('but run all the tests in this suite', function() {
- it('should run this test #1', function() {
- (true).should.equal(true);
- });
- it('should run this test #2', function() {
- (true).should.equal(true);
- });
- });
- });
-});
-
-// mark test as `only` override the suite behavior
-describe.only('should run only tests that marked as `only`', function() {
- it('should not run this test #1', function() {
- (false).should.equal(true);
- });
-
- it.only('should run this test #2', function() {
- (true).should.equal(true);
- });
-
- it('should not run this test #3', function() {
- (false).should.equal(true);
- });
-
- it.only('should run this test #4', function() {
- (true).should.equal(true);
- });
-});
-
-describe.only('Should run only test cases that mark as only', function() {
- it.only('should runt his test', function() {
- (true).should.equal(true);
- });
-
- it('should not run this test', function() {
- (false).should.equal(true);
- });
-
- describe('should not run this suite', function() {
- it('should not run this test', function() {
- (false).should.equal(true);
- });
- });
-});
-
-// Root Suite
-it.only('#Root-Suite, should run this test-case #1', function() {
- (true).should.equal(true);
-});
-
-it.only('#Root-Suite, should run this test-case #2', function() {
- (true).should.equal(true);
-});
-
-it('#Root-Suite, should not run this test', function() {
- (false).should.equal(true);
-});
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/misc/only/global/bdd.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/misc/only/global/bdd.spec.js
deleted file mode 100644
index e923876f84..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/misc/only/global/bdd.spec.js
+++ /dev/null
@@ -1,12 +0,0 @@
-// Root-only test cases
-it.only('#Root-Suite, should run this bdd test-case #1', function() {
- (true).should.equal(true);
-});
-
-it('#Root-Suite, should not run this bdd test-case #2', function() {
- (false).should.equal(true);
-});
-
-it('#Root-Suite, should not run this bdd test-case #3', function() {
- (false).should.equal(true);
-}); \ No newline at end of file
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/misc/only/global/qunit.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/misc/only/global/qunit.spec.js
deleted file mode 100644
index 59ad72c3bf..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/misc/only/global/qunit.spec.js
+++ /dev/null
@@ -1,12 +0,0 @@
-// Root-only test cases
-test.only('#Root-Suite, should run this qunit test-case #1', function() {
- (true).should.equal(true);
-});
-
-test('#Root-Suite, should not run this qunit test-case #2', function() {
- (false).should.equal(true);
-});
-
-test('#Root-Suite, should not run this qunit test-case #3', function() {
- (false).should.equal(true);
-}); \ No newline at end of file
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/misc/only/global/tdd.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/misc/only/global/tdd.spec.js
deleted file mode 100644
index 08d456848b..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/misc/only/global/tdd.spec.js
+++ /dev/null
@@ -1,12 +0,0 @@
-// Root-only test cases
-test.only('#Root-Suite, should run this tdd test-case #1', function() {
- (true).should.equal(true);
-});
-
-test('#Root-Suite, should not run this tdd test-case #2', function() {
- (false).should.equal(true);
-});
-
-test('#Root-Suite, should not run this tdd test-case #3', function() {
- (false).should.equal(true);
-}); \ No newline at end of file
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/misc/only/qunit.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/misc/only/qunit.spec.js
deleted file mode 100644
index 1248adeba7..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/misc/only/qunit.spec.js
+++ /dev/null
@@ -1,73 +0,0 @@
-// Root Suite
-test.only('#Root-Suite, should run this test-case #1', function() {
- (true).should.equal(true);
-});
-
-test.only('#Root-Suite, should run this test-case #2', function() {
- (true).should.equal(true);
-});
-
-test('#Root-Suite, should not run this test', function() {
- (false).should.equal(true);
-});
-
-suite('should only run .only test in this qunit suite');
-
-test('should not run this test', function() {
- (0).should.equal(1, 'this test should have been skipped');
-});
-test.only('should run this test', function() {
- (0).should.equal(0, 'this .only test should run');
-});
-test('should run this test, not (includes the title of the .only test)', function() {
- (0).should.equal(1, 'this test should have been skipped');
-});
-
-// Mark suite
-suite.only('should run all tests in this suite');
-
-test('should run this test #1', function() {
- (true).should.equal(true);
-});
-
-test('should run this test #2', function() {
- (true).should.equal(true);
-});
-
-test('should run this test #3', function() {
- (true).should.equal(true);
-});
-
-// Unmark this suite
-suite('should not run any of this suite\'s tests');
-
-test('should not run this test', function() {
- (false).should.equal(true);
-});
-
-test('should not run this test', function() {
- (false).should.equal(true);
-});
-
-test('should not run this test', function() {
- (false).should.equal(true);
-});
-
-// Mark test as `only` override the suite behavior
-suite.only('should run only tests that marked as `only`');
-
-test('should not run this test #1', function() {
- (false).should.equal(true);
-});
-
-test.only('should not run this test #2', function() {
- (true).should.equal(true);
-});
-
-test('should not run this test #3', function() {
- (false).should.equal(true);
-});
-
-test.only('should not run this test #4', function() {
- (true).should.equal(true);
-}); \ No newline at end of file
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/misc/only/tdd.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/misc/only/tdd.spec.js
deleted file mode 100644
index 7e37e7a3b3..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/misc/only/tdd.spec.js
+++ /dev/null
@@ -1,125 +0,0 @@
-suite('should only run .only test in this tdd suite', function() {
- test('should not run this test', function() {
- (0).should.equal(1, 'this test should have been skipped');
- });
- test.only('should run this test', function() {
- (0).should.equal(0, 'this .only test should run');
- });
- test('should run this test, not (includes the title of the .only test)', function() {
- (0).should.equal(1, 'this test should have been skipped');
- });
-});
-
-suite('should not run this suite', function() {
- test('should not run this test', function() {
- (true).should.equal(false);
- });
-
- test('should not run this test', function() {
- (true).should.equal(false);
- });
-
- test('should not run this test', function() {
- (true).should.equal(false);
- });
-});
-
-suite.only('should run all tests in this tdd suite', function() {
- test('should run this test #1', function() {
- (true).should.equal(true);
- });
-
- test('should run this test #2', function() {
- (1).should.equal(1);
- });
-
- test('should run this test #3', function() {
- ('foo').should.equal('foo');
- });
-});
-
-suite('should run only suites that marked as `only`', function() {
- suite.only('should run all this tdd suite', function() {
- test('should run this test #1', function() {
- (true).should.equal(true);
- });
-
- test('should run this test #2', function() {
- (true).should.equal(true);
- });
- });
-
- suite('should not run this suite', function() {
- test('should not run this test', function() {
- (true).should.equal(false);
- });
- });
-});
-
-// Nested situation
-suite('should not run parent tests', function() {
- test('should not run this test', function() {
- (true).should.equal(false);
- });
- suite('and not the child tests too', function() {
- test('should not run this test', function() {
- (true).should.equal(false);
- });
- suite.only('but run all the tests in this suite', function() {
- test('should run this test #1', function() {
- (true).should.equal(true);
- });
- test('should run this test #2', function() {
- (true).should.equal(true);
- });
- });
- });
-});
-
-// mark test as `only` override the suite behavior
-suite.only('should run only tests that marked as `only`', function() {
- test('should not run this test #1', function() {
- (false).should.equal(true);
- });
-
- test.only('should run this test #2', function() {
- (true).should.equal(true);
- });
-
- test('should not run this test #3', function() {
- (false).should.equal(true);
- });
-
- test.only('should run this test #4', function() {
- (true).should.equal(true);
- });
-});
-
-suite.only('Should run only test cases that mark as only', function() {
- test.only('should runt his test', function() {
- (true).should.equal(true);
- });
-
- test('should not run this test', function() {
- (false).should.equal(true);
- });
-
- suite('should not run this suite', function() {
- test('should not run this test', function() {
- (false).should.equal(true);
- });
- });
-});
-
-// Root Suite
-test.only('#Root-Suite, should run this test-case #1', function() {
- (true).should.equal(true);
-});
-
-test.only('#Root-Suite, should run this test-case #2', function() {
- (true).should.equal(true);
-});
-
-test('#Root-Suite, should not run this test', function() {
- (false).should.equal(true);
-});
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/overspecified-async.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/overspecified-async.spec.js
deleted file mode 100644
index 2844920379..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/overspecified-async.spec.js
+++ /dev/null
@@ -1,8 +0,0 @@
-describe('overspecified asynchronous resolution method', function() {
- it('should fail when multiple methods are used', function(done) {
- setTimeout(done, 0);
-
- // uncomment
- // return { then: function() {} };
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/require/a.js b/tests/lib/mocha-3.1.0/test/acceptance/require/a.js
deleted file mode 100644
index 592d827449..0000000000
--- a/tests/lib/mocha-3.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-3.1.0/test/acceptance/require/b.coffee b/tests/lib/mocha-3.1.0/test/acceptance/require/b.coffee
deleted file mode 100644
index 045cc7591b..0000000000
--- a/tests/lib/mocha-3.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-3.1.0/test/acceptance/require/c.js b/tests/lib/mocha-3.1.0/test/acceptance/require/c.js
deleted file mode 100644
index 4e681373a1..0000000000
--- a/tests/lib/mocha-3.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-3.1.0/test/acceptance/require/d.coffee b/tests/lib/mocha-3.1.0/test/acceptance/require/d.coffee
deleted file mode 100644
index d5ebbf60ed..0000000000
--- a/tests/lib/mocha-3.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-3.1.0/test/acceptance/require/require.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/require/require.spec.js
deleted file mode 100644
index 22570e62ff..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/require/require.spec.js
+++ /dev/null
@@ -1,9 +0,0 @@
-describe('require test', function(){
- it('should require args in order', function(){
- var req = global.required;
- expect(req.indexOf('a.js')).to.equal(0);
- expect(req.indexOf('b.coffee')).to.equal(1);
- expect(req.indexOf('c.js')).to.equal(2);
- expect(req.indexOf('d.coffee')).to.equal(3);
- })
-});
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/required-tokens.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/required-tokens.spec.js
deleted file mode 100644
index 6944cee40c..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/required-tokens.spec.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-3.1.0/test/acceptance/root.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/root.spec.js
deleted file mode 100644
index 037e6a328a..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/root.spec.js
+++ /dev/null
@@ -1,11 +0,0 @@
-var calls = [];
-
-before(function(){
- calls.push('before');
-})
-
-describe('root', function(){
- it('should be a valid suite', function(){
- expect(calls).to.eql(['before']);
- })
-})
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/test.coffee b/tests/lib/mocha-3.1.0/test/acceptance/test.coffee
deleted file mode 100644
index b8e309f515..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/test.coffee
+++ /dev/null
@@ -1,6 +0,0 @@
-
-obj = foo: 'bar'
-
-describe 'coffeescript', ->
- it 'should work', ->
- expect(obj).to.eql foo: 'bar'
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/test.foo b/tests/lib/mocha-3.1.0/test/acceptance/test.foo
deleted file mode 100644
index d00491fd7e..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/test.foo
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/throw.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/throw.spec.js
deleted file mode 100644
index 46cfbad6ad..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/throw.spec.js
+++ /dev/null
@@ -1,108 +0,0 @@
-var Suite = require('../../lib/suite');
-var Test = require('../../lib/test');
-var Runner = require('../../lib/runner');
-
-describe('a test that throws', function () {
- var suite, runner;
-
- beforeEach(function(){
- suite = new Suite('Suite', 'root');
- runner = new Runner(suite);
- })
-
- 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(){
- expect(runner.failures).to.equal(1);
- expect(test.state).to.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(){
- expect(runner.failures).to.equal(1);
- expect(test.state).to.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(){
- expect(runner.failures).to.equal(1);
- expect(test.state).to.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(){
- expect(runner.failures).to.equal(1);
- expect(test.state).to.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(){
- expect(runner.failures).to.equal(1);
- expect(test.state).to.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(){
- expect(runner.failures).to.equal(1);
- expect(test.state).to.equal('failed');
- done();
- });
- runner.run();
- })
- })
-})
diff --git a/tests/lib/mocha-3.1.0/test/acceptance/timeout.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/timeout.spec.js
deleted file mode 100644
index f61c3ba566..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/timeout.spec.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-3.1.0/test/acceptance/utils.spec.js b/tests/lib/mocha-3.1.0/test/acceptance/utils.spec.js
deleted file mode 100644
index cab0f42b01..0000000000
--- a/tests/lib/mocha-3.1.0/test/acceptance/utils.spec.js
+++ /dev/null
@@ -1,406 +0,0 @@
-var utils = require('../../lib/utils');
-var toISOString = require('../../lib/to-iso-string');
-var JSON = require('json3');
-
-describe('lib/utils', function () {
- describe('clean', function () {
- it("should format a single line test function", function () {
- var fn = [
- "function () {"
- , " var a = 1;"
- , "}"
- ].join("\n");
- expect(utils.clean(fn)).to.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");
- expect(utils.clean(fn)).to.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");
- expect(utils.clean(fn)).to.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");
- expect(utils.clean(fn)).to.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");
- expect(utils.clean(fn)).to.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");
- expect(utils.clean(fn)).to.equal("var a = 1;");
- });
-
- it("should format es6 arrow functions with implicit return", function () {
- var fn = "() => foo()";
- expect(utils.clean(fn)).to.equal("foo()");
- });
- });
-
- describe('stringify', function(){
-
- var stringify = utils.stringify;
-
- it('should return an object representation of a string created with a String constructor', function() {
- expect(stringify(new String('foo'))).to.equal('{\n "0": "f"\n "1": "o"\n "2": "o"\n}');
- });
-
- it('should return Buffer with .toJSON representation', function() {
- expect(stringify(new Buffer([0x01]))).to.equal('[\n 1\n]');
- expect(stringify(new Buffer([0x01, 0x02]))).to.equal('[\n 1\n 2\n]');
-
- expect(stringify(new Buffer('ABCD'))).to.equal('[\n 65\n 66\n 67\n 68\n]');
- });
-
- it('should return Date object with .toISOString() + string prefix', function() {
- expect(stringify(new Date(0))).to.equal('[Date: ' + shimToISOString(new Date(0)) + ']');
-
- var date = new Date(); // now
- expect(stringify(date)).to.equal('[Date: ' + shimToISOString(date) + ']');
-
- function shimToISOString(date) {
- if (date.toISOString) {
- return date.toISOString();
- } else {
- return toISOString(date);
- }
- }
- });
-
- it('should return invalid Date object with .toString() + string prefix', function() {
- expect(stringify(new Date(''))).to.equal('[Date: ' + new Date('').toString() + ']');
- });
-
- describe('#Number', function() {
- it('should show the handle -0 situations', function() {
- expect(stringify(-0)).to.eql('-0');
- expect(stringify(0)).to.eql('0');
- expect(stringify('-0')).to.eql('"-0"');
- });
-
- it('should work well with `NaN` and `Infinity`', function() {
- expect(stringify(NaN)).to.equal('NaN');
- expect(stringify(Infinity)).to.equal('Infinity');
- expect(stringify(-Infinity)).to.equal('-Infinity');
- });
-
- it('floats and ints', function() {
- expect(stringify(1)).to.equal('1');
- expect(stringify(1.2)).to.equal('1.2');
- expect(stringify(1e9)).to.equal('1000000000');
- });
- });
-
- describe('canonicalize example', function() {
- it('should represent the actual full result', function() {
- var expected = {
- str: 'string',
- int: 90,
- float: 9.99,
- boolean: false,
- nil: null,
- undef: undefined,
- regex: /^[a-z|A-Z]/,
- date: new Date(0),
- func: function() {},
- infi: Infinity,
- nan: NaN,
- zero: -0,
- buffer: new Buffer([0x01, 0x02]),
- array: [1,2,3],
- empArr: [],
- matrix: [[1], [2,3,4] ],
- object: { a: 1, b: 2 },
- canObj: { a: { b: 1, c: 2 }, b: {} },
- empObj: {}
- };
- expected.circular = expected; // Make `Circular` situation
- var actual = ['{'
- , ' "array": ['
- , ' 1'
- , ' 2'
- , ' 3'
- , ' ]'
- , ' "boolean": false'
- , ' "buffer": [Buffer: ['
- , ' 1'
- , ' 2'
- , ' ]]'
- , ' "canObj": {'
- , ' "a": {'
- , ' "b": 1'
- , ' "c": 2'
- , ' }'
- , ' "b": {}'
- , ' }'
- , ' "circular": [Circular]'
- , ' "date": [Date: 1970-01-01T00:00:00.000Z]'
- , ' "empArr": []'
- , ' "empObj": {}'
- , ' "float": 9.99'
- , ' "func": [Function]'
- , ' "infi": Infinity'
- , ' "int": 90'
- , ' "matrix": ['
- , ' ['
- , ' 1'
- , ' ]'
- , ' ['
- , ' 2'
- , ' 3'
- , ' 4'
- , ' ]'
- , ' ]'
- , ' "nan": NaN'
- , ' "nil": [null]'
- , ' "object": {'
- , ' "a": 1'
- , ' "b": 2'
- , ' }'
- , ' "regex": /^[a-z|A-Z]/'
- , ' "str": "string"'
- , ' "undef": [undefined]'
- , ' "zero": -0'
- , '}'].join('\n');
- expect(stringify(expected)).to.equal(actual);
- });
- });
-
- it('should canonicalize the object', function(){
- var travis = { name: 'travis', age: 24 };
- var travis2 = { age: 24, name: 'travis' };
-
- expect(stringify(travis)).to.equal(stringify(travis2));
- });
-
- it('should handle circular structures in objects', function(){
- var travis = { name: 'travis' };
- travis.whoami = travis;
-
- expect(stringify(travis)).to.equal('{\n "name": "travis"\n "whoami": [Circular]\n}');
- });
-
- it('should handle circular structures in arrays', function(){
- var travis = ['travis'];
- travis.push(travis);
-
- expect(stringify(travis)).to.equal('[\n "travis"\n [Circular]\n]');
- });
-
- it('should handle circular structures in functions', function(){
- var travis = function () {};
- travis.fn = travis;
-
- expect(stringify(travis)).to.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 = '/(?:)/';
-
- expect(stringify(regExpObj)).to.equal('{\n "regexp": ' + regexpString + '\n}');
- expect(stringify(regexp)).to.equal(regexpString);
-
- var number = 1,
- numberObj = { number: number },
- numberString = '1';
-
- expect(stringify(numberObj)).to.equal('{\n "number": ' + number + '\n}');
- expect(stringify(number)).to.equal(numberString);
-
- var boolean = false,
- booleanObj = { boolean: boolean },
- booleanString = 'false';
-
- expect(stringify(booleanObj)).to.equal('{\n "boolean": ' + boolean + '\n}');
- expect(stringify(boolean)).to.equal(booleanString);
-
- var string = 'sneepy',
- stringObj = { string: string };
-
- expect(stringify(stringObj)).to.equal('{\n "string": "' + string + '"\n}');
- expect(stringify(string)).to.equal(JSON.stringify(string));
-
- var nullValue = null,
- nullObj = { 'null': null },
- nullString = '[null]';
-
- expect(stringify(nullObj)).to.equal('{\n "null": [null]\n}');
- expect(stringify(nullValue)).to.equal(nullString);
- });
-
- it('should handle arrays', function () {
- var array = ['dave', 'dave', 'dave', 'dave'],
- arrayObj = {array: array},
- arrayString = ' "dave"\n "dave"\n "dave"\n "dave"'
-
- expect(stringify(arrayObj)).to.equal('{\n "array": [\n' + arrayString + '\n ]\n}');
- expect(stringify(array)).to.equal('[' + arrayString.replace(/\s+/g, '\n ') + '\n]');
- });
-
- it('should handle functions', function () {
- var fn = function() {},
- fnObj = {fn: fn},
- fnString = '[Function]';
-
- expect(stringify(fnObj)).to.equal('{\n "fn": ' + fnString + '\n}');
- expect(stringify(fn)).to.equal('[Function]');
- });
-
- it('should handle empty objects', function () {
- expect(stringify({})).to.equal('{}');
- expect(stringify({foo: {}})).to.equal('{\n "foo": {}\n}');
- });
-
- it('should handle empty arrays', function () {
- expect(stringify([])).to.equal('[]');
- expect(stringify({foo: []})).to.equal('{\n "foo": []\n}');
- });
-
- it('should handle non-empty arrays', function () {
- expect(stringify(['a', 'b', 'c'])).to.equal('[\n "a"\n "b"\n "c"\n]')
- });
-
- it('should handle empty functions (with no properties)', function () {
- expect(stringify(function(){})).to.equal('[Function]');
- expect(stringify({foo: function() {}})).to.equal('{\n "foo": [Function]\n}');
- expect(stringify({foo: function() {}, bar: 'baz'})).to.equal('{\n "bar": "baz"\n "foo": [Function]\n}');
- });
-
- it('should handle functions w/ properties', function () {
- var fn = function(){};
- fn.bar = 'baz';
- expect(stringify(fn)).to.equal('{\n "bar": "baz"\n}');
- expect(stringify({foo: fn})).to.equal('{\n "foo": {\n "bar": "baz"\n }\n}');
- });
-
- it('should handle undefined values', function () {
- expect(stringify({foo: undefined})).to.equal('{\n "foo": [undefined]\n}');
- expect(stringify({foo: 'bar', baz: undefined})).to.equal('{\n "baz": [undefined]\n "foo": "bar"\n}');
- expect(stringify()).to.equal('[undefined]');
- });
-
- it('should recurse', function () {
- expect(stringify({foo: {bar: {baz: {quux: {herp: 'derp'}}}}})).to.equal('{\n "foo": {\n "bar": {\n "baz": {\n "quux": {\n "herp": "derp"\n }\n }\n }\n }\n}');
- });
-
- it('might get confusing', function () {
- expect(stringify(null)).to.equal('[null]');
- });
-
- it('should not freak out if it sees a primitive twice', function () {
- expect(stringify({foo: null, bar: null})).to.equal('{\n "bar": [null]\n "foo": [null]\n}');
- expect(stringify({foo: 1, bar: 1})).to.equal('{\n "bar": 1\n "foo": 1\n}');
- });
-
- it('should stringify dates', function () {
- var date = new Date(0);
- expect(stringify(date)).to.equal('[Date: 1970-01-01T00:00:00.000Z]');
- expect(stringify({date: date})).to.equal('{\n "date": [Date: 1970-01-01T00:00:00.000Z]\n}');
- });
-
- it('should handle object without an Object prototype', function () {
- var a;
- if (Object.create) {
- a = Object.create(null);
- } else {
- a = {};
- }
- a.foo = 1;
-
- expect(stringify(a)).to.equal('{\n "foo": 1\n}');
- });
-
- // In old version node.js, Symbol is not available by default.
- if (typeof global.Symbol === 'function') {
- it('should handle Symbol', function () {
- var symbol = Symbol('value');
- expect(stringify(symbol)).to.equal('Symbol(value)');
- expect(stringify({symbol: symbol})).to.equal('{\n "symbol": Symbol(value)\n}')
- });
- }
-
- it('should handle length properties that cannot be coerced to a number', function () {
- expect(stringify({length: {nonBuiltinProperty: 0}})).to.equal('{\n "length": {\n "nonBuiltinProperty": 0\n }\n}');
- expect(stringify({length: "a string where length should be"})).to.equal('{\n "length": "a string where length should be"\n}');
- });
- });
-
- describe('type', function () {
- var type = utils.type;
- var toString = Object.prototype.toString;
-
- beforeEach(function() {
- // some JS engines such as PhantomJS 1.x exhibit this behavior
- Object.prototype.toString = function() {
- if (this === global) {
- return '[object DOMWindow]';
- }
- return toString.call(this);
- };
- });
-
- it('should recognize various types', function () {
- expect(type({})).to.equal('object');
- expect(type([])).to.equal('array');
- expect(type(1)).to.equal('number');
- expect(type(Infinity)).to.equal('number');
- expect(type(null)).to.equal('null');
- expect(type(undefined)).to.equal('undefined');
- expect(type(new Date())).to.equal('date');
- expect(type(/foo/)).to.equal('regexp');
- expect(type('type')).to.equal('string');
- expect(type(global)).to.equal('domwindow');
- expect(type(true)).to.equal('boolean');
- });
-
- describe('when toString on null or undefined stringifies window', function () {
- it('should recognize null and undefined', function () {
- expect(type(null)).to.equal('null');
- expect(type(undefined)).to.equal('undefined');
- });
- });
-
- afterEach(function () {
- Object.prototype.toString = toString;
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/browser-fixtures/bdd.fixture.js b/tests/lib/mocha-3.1.0/test/browser-fixtures/bdd.fixture.js
deleted file mode 100644
index 72b4a8a47c..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser-fixtures/bdd.fixture.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/* eslint-env browser */
-
-window.mocha.timeout(200)
- .ui('bdd');
diff --git a/tests/lib/mocha-3.1.0/test/browser-fixtures/exports.fixture.js b/tests/lib/mocha-3.1.0/test/browser-fixtures/exports.fixture.js
deleted file mode 100644
index 32c26a12ff..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser-fixtures/exports.fixture.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/* eslint-env browser */
-
-window.mocha.timeout(200)
- .ui('exports');
diff --git a/tests/lib/mocha-3.1.0/test/browser-fixtures/qunit.fixture.js b/tests/lib/mocha-3.1.0/test/browser-fixtures/qunit.fixture.js
deleted file mode 100644
index 8804d0b994..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser-fixtures/qunit.fixture.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/* eslint-env browser */
-
-window.mocha.timeout(200)
- .ui('qunit');
diff --git a/tests/lib/mocha-3.1.0/test/browser-fixtures/tdd.fixture.js b/tests/lib/mocha-3.1.0/test/browser-fixtures/tdd.fixture.js
deleted file mode 100644
index 997a47dc18..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser-fixtures/tdd.fixture.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/* eslint-env browser */
-
-window.mocha.timeout(200)
- .ui('tdd');
diff --git a/tests/lib/mocha-3.1.0/test/browser/array.spec.js b/tests/lib/mocha-3.1.0/test/browser/array.spec.js
deleted file mode 100644
index 26404f6a90..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser/array.spec.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-3.1.0/test/browser/grep.html b/tests/lib/mocha-3.1.0/test/browser/grep.html
deleted file mode 100644
index 0ba47c8533..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser/grep.html
+++ /dev/null
@@ -1,51 +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="grep.js"></script>
- </head>
- <body>
- <div id="mocha"></div>
- <script>
- (function(window) {
- var location = window.location;
- mocha.checkLeaks();
- var runner = mocha.run();
- setTimeout(run, 1000);
-
- function run() {
- var regex = [
- '.*', // All
- 'm{2}', // 'mm...m'
- '\\d', // Contains number
- '^\\d{2}(?=\\s\\d$)', // Start with 2 numbers and end with one
- '^@.*(?=\\(\\)$)', // Run @Array and @Function suite, but only function
- '^@(?!.*\\)$)', // Run @Array and @Function suite, but only properties
- '^co', // Start with 'co'
- 'first$', // Ends with 'first'
- '^co.*(?=second$)', // Starts with 'co', ends with 'second'
- '^Date:\\s01\/0(?:[1-4])\/2015$', // Run all tests between '01/[01-04]/2015'
- encodeURIComponent('^#'), // Run encoded => start with '#'
- encodeURIComponent('^[^a-z|0-9]+$') // Run encoded => only uppercase suites(include `it` fns), e.g: CONSTANTS
- ]
- , qs = location.search.replace('?grep=', '')
- , re = ~qs.indexOf('%') ? qs : decodeURIComponent(qs)
- , grep = regex[regex.indexOf(re) + 1];
-
- return grep
- ? location.search = 'grep=' + grep
- : false;
- }
- })(window);
- </script>
- </body>
-</html>
diff --git a/tests/lib/mocha-3.1.0/test/browser/grep.spec.js b/tests/lib/mocha-3.1.0/test/browser/grep.spec.js
deleted file mode 100644
index 9531b87aa9..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser/grep.spec.js
+++ /dev/null
@@ -1,108 +0,0 @@
-// numbers
-describe('21', function() {
- it('1', function() {
- assert(true);
- });
- it('2', function() {
- assert(true);
- });
-});
-// symbols
-describe('@Array', function() {
- it('.pop()', function() {
- assert(true);
- });
- it('.push()', function() {
- assert(true);
- });
- it('.length', function() {
- assert(true);
- });
-});
-
-describe('@Function', function() {
- it('.call()', function() {
- assert(true);
- });
- it('.apply()', function() {
- assert(true);
- });
- it('.length', function() {
- assert(true);
- });
- it('.name', function() {
- assert(true);
- });
- it('.prototype', function() {
- assert(true);
- });
-});
-
-//url with hashtags
-describe('#Services',function() {
- describe('#http', function() {
- it('.createClient()', function() {
- assert(true);
- });
- it('.Server()', function() {
- assert(true);
- });
- });
- describe('#crypto', function() {
- it('.randomBytes()', function() {
- assert(true);
- });
- it('.Hmac()', function() {
- assert(true);
- });
- });
-});
-
-// Uppercase
-describe('CONSTANTS', function() {
- it('.STATUS_CODES', function() {
- assert(true);
- });
-});
-
-// Dates
-describe('Date:', function() {
- it('01/02/2015', function() {
- assert(true);
- });
- it('01/03/2015', function() {
- assert(true);
- });
- it('01/06/2015', function() {
- assert(true);
- });
-});
-
-// etc..
-describe('booking/summary', function() {
- it('should be run last', function() {
- assert(true);
- });
-});
-
-describe('component/booking/summary', function() {
- it('should be run second', function() {
- assert(true);
- });
-});
-
-describe('component/booking/intro', function() {
- it('should be run first', function() {
- assert(true);
- });
-});
-
-describe('contains numbers', function() {
- it('should run if the number 92 matching', function() {
- assert(true);
- });
-
- it('should run if the number 8 matching', function() {
- assert(true);
- });
-}); \ No newline at end of file
diff --git a/tests/lib/mocha-3.1.0/test/browser/index.html b/tests/lib/mocha-3.1.0/test/browser/index.html
deleted file mode 100644
index 9200b977e5..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser/index.html
+++ /dev/null
@@ -1,33 +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 src="multiple-done.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-3.1.0/test/browser/large.html b/tests/lib/mocha-3.1.0/test/browser/large.html
deleted file mode 100644
index 1804b3a000..0000000000
--- a/tests/lib/mocha-3.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-3.1.0/test/browser/large.spec.js b/tests/lib/mocha-3.1.0/test/browser/large.spec.js
deleted file mode 100644
index 56757eae27..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser/large.spec.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-3.1.0/test/browser/multiple-done.spec.js b/tests/lib/mocha-3.1.0/test/browser/multiple-done.spec.js
deleted file mode 100644
index d8a9d49ae2..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser/multiple-done.spec.js
+++ /dev/null
@@ -1,16 +0,0 @@
-describe('Multiple Done calls', function(){
- it('should report an error if done was called more than once', function(done){
- done();
- done();
- })
-
- it('should report an error if an exception happened async after done was called', function (done) {
- done();
- setTimeout(done, 50);
- })
-
- it('should report an error if an exception happened after done was called', function(done){
- done();
- throw new Error("thrown error");
- })
-})
diff --git a/tests/lib/mocha-3.1.0/test/browser/opts.html b/tests/lib/mocha-3.1.0/test/browser/opts.html
deleted file mode 100644
index ec49a418fc..0000000000
--- a/tests/lib/mocha-3.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-3.1.0/test/browser/opts.spec.js b/tests/lib/mocha-3.1.0/test/browser/opts.spec.js
deleted file mode 100644
index dbbc9ff172..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser/opts.spec.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-3.1.0/test/browser/stack-trace.html b/tests/lib/mocha-3.1.0/test/browser/stack-trace.html
deleted file mode 100644
index 0f267dab98..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser/stack-trace.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, err) {
- if (!expr) throw err;
- }
- </script>
- <script src="stack-trace.js"></script>
- <script>
- onload = function() {
- mocha.run();
- };
- </script>
-</head>
-<body>
-<div id="mocha"></div>
-</body>
-</html>
diff --git a/tests/lib/mocha-3.1.0/test/browser/stack-trace.spec.js b/tests/lib/mocha-3.1.0/test/browser/stack-trace.spec.js
deleted file mode 100644
index b39944db09..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser/stack-trace.spec.js
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict';
-describe('Stack trace', function() {
- it('should prettify the stack-trace', function() {
- var err = new Error();
- // We do this fake stack-trace because we under development,
- // and our root isn't `node_modules`, `bower` or `components`
- err.stack = ['Error: failed'
- , 'at assert (stack-trace.html:11:30)'
- , 'at Context.<anonymous> (stack-trace.js:5:5)'
- , 'at callFn (http://localhost:63342/node_modules/mocha.js:4546:21)'
- , 'at Test.require.register.Runnable.run (http://localhost:63342/node_modules/mocha.js:4539:7)'
- , 'at Runner.require.register.Runner.runTest (http://localhost:63342/node_modules/mocha.js:4958:10)'
- , 'at http://localhost:63342/bower_components/mocha.js:5041:12'
- , 'at next (http://localhost:63342/bower_components/mocha.js:4883:14)'
- , 'at http://localhost:63342/bower_components/mocha.js:4893:7'
- , 'at next (http://localhost:63342/bower_components/mocha.js:4828:23)'
- , 'at http://localhost:63342/bower_components/mocha.js:4860:5'].join('\n');
- assert(false, err);
- });
-}); \ No newline at end of file
diff --git a/tests/lib/mocha-3.1.0/test/browser/ui.html b/tests/lib/mocha-3.1.0/test/browser/ui.html
deleted file mode 100644
index 071c7798a0..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser/ui.html
+++ /dev/null
@@ -1,46 +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="ui.js"></script>
- </head>
- <body>
- <div id="mocha"></div>
- <script>
- (function(window) {
- var location = window.location;
- mocha.checkLeaks();
- var runner = mocha.run();
- var count = 0;
- setTimeout(run, 1000);
-
- function run() {
- var regex = [
- '', // All
- '%5C%24%5C.jQuery', // $.jQuery
- '%5C%24%5C.jQuery%20%5C.on%5C(%5C)', // $.jQuery .on()
- ]
- , qs = location.search.replace('?grep=', '')
- , re = ~qs.indexOf('%') ? qs : decodeURIComponent(qs)
- , grep = regex[regex.indexOf(re) + 1]
- , anchors = document.getElementsByTagName('a');
-
- // Locate first 'a' element w/ matching grep param; click it
- for (var i = 0; i < anchors.length; i++) {
- if (anchors[i].href && anchors[i].href.indexOf(grep) > -1)
- return void anchors[i].click();
- }
- }
- })(window);
- </script>
- </body>
-</html>
diff --git a/tests/lib/mocha-3.1.0/test/browser/ui.spec.js b/tests/lib/mocha-3.1.0/test/browser/ui.spec.js
deleted file mode 100644
index 48236e9497..0000000000
--- a/tests/lib/mocha-3.1.0/test/browser/ui.spec.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// test titles containing regex-conflicting characters
-
-// leading $
-describe('$.jQuery', function() {
- // parens
- describe('.on()', function () {
- it('should set an event', function() {
- assert(true);
- });
- });
-
- describe('.off()', function () {
- it('should remove an event', function () {
-
- });
- });
-});
-
-// another generic describe block to verify it is absent
-// when greeping on $.jQuery
-describe('@Array', function() {
- it('.pop()', function() {
- assert(true);
- });
- it('.push()', function() {
- assert(true);
- });
- it('.length', function() {
- assert(true);
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/color.spec.js b/tests/lib/mocha-3.1.0/test/color.spec.js
deleted file mode 100644
index 5ee46e71c4..0000000000
--- a/tests/lib/mocha-3.1.0/test/color.spec.js
+++ /dev/null
@@ -1,18 +0,0 @@
-var assert = require('assert');
-var child_process = require('child_process');
-var path = require('path');
-
-describe('Mocha', function() {
- this.timeout(2000);
-
- it('should not output colors to pipe', function(cb) {
- var command = [path.join('bin', 'mocha'), '--grep', 'missing-test'];
- child_process.execFile(process.execPath, command, function(err, stdout, stderr) {
- if (err) return cb(err);
-
- assert(stdout.indexOf('[90m') === -1);
-
- cb(null);
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/compiler/foo.js b/tests/lib/mocha-3.1.0/test/compiler/foo.js
deleted file mode 100644
index b13101a77b..0000000000
--- a/tests/lib/mocha-3.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-3.1.0/test/fixture-expect.js b/tests/lib/mocha-3.1.0/test/fixture-expect.js
deleted file mode 100644
index cacc78425a..0000000000
--- a/tests/lib/mocha-3.1.0/test/fixture-expect.js
+++ /dev/null
@@ -1 +0,0 @@
-global.expect = require("expect.js")
diff --git a/tests/lib/mocha-3.1.0/test/grep.spec.js b/tests/lib/mocha-3.1.0/test/grep.spec.js
deleted file mode 100644
index bbc5c55eba..0000000000
--- a/tests/lib/mocha-3.1.0/test/grep.spec.js
+++ /dev/null
@@ -1,65 +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 string to a RegExp', function(){
- var mocha = new Mocha({ grep: 'foo.*' });
- mocha.options.grep.toString().should.equal('/foo.*/');
- });
- });
-
- describe('"fgrep" option', function(){
- it('should escape and convert string to a RegExp', function(){
- var mocha = new Mocha({ fgrep: 'foo.*' });
- mocha.options.grep.toString().should.equal('/foo\\.\\*/');
- });
- });
-
- describe('.grep()', function() {
- // Test helper
- function testGrep(mocha) {
- return function testGrep(grep, expected) {
- mocha.grep(grep);
- mocha.options.grep.toString().should.equal(expected);
- }
- }
-
- it('should add a RegExp to the mocha.options object', function() {
- var test = testGrep(new Mocha);
- test(/foo/, '/foo/');
- });
-
- it('should convert grep string to a RegExp', function() {
- var test = testGrep(new Mocha);
- test('foo', '/foo/');
- test('^foo.*bar$', '/^foo.*bar$/');
- test('^@.*(?=\\(\\)$)', '/^@.*(?=\\(\\)$)/');
- });
-
- it('should covert grep regex-like string to a RegExp', function() {
- var test = testGrep(new Mocha);
- test('/foo/', '/foo/');
- // Keep the flags
- test('/baz/i', '/baz/i');
- test('/bar/g', '/bar/g');
- test('/^foo(.*)bar/g', '/^foo(.*)bar/g');
- });
-
- 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-3.1.0/test/hook-async.spec.js b/tests/lib/mocha-3.1.0/test/hook-async.spec.js
deleted file mode 100644
index ae6e642d24..0000000000
--- a/tests/lib/mocha-3.1.0/test/hook-async.spec.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-3.1.0/test/hook-sync-nested.spec.js b/tests/lib/mocha-3.1.0/test/hook-sync-nested.spec.js
deleted file mode 100644
index b87c22298f..0000000000
--- a/tests/lib/mocha-3.1.0/test/hook-sync-nested.spec.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-3.1.0/test/hook-sync.spec.js b/tests/lib/mocha-3.1.0/test/hook-sync.spec.js
deleted file mode 100644
index 1d40f5d0c0..0000000000
--- a/tests/lib/mocha-3.1.0/test/hook-sync.spec.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-3.1.0/test/hook-timeout.spec.js b/tests/lib/mocha-3.1.0/test/hook-timeout.spec.js
deleted file mode 100644
index 155c1e95a6..0000000000
--- a/tests/lib/mocha-3.1.0/test/hook-timeout.spec.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-3.1.0/test/http-meta-2.spec.js b/tests/lib/mocha-3.1.0/test/http-meta-2.spec.js
deleted file mode 100644
index fe9662b2e6..0000000000
--- a/tests/lib/mocha-3.1.0/test/http-meta-2.spec.js
+++ /dev/null
@@ -1,91 +0,0 @@
-var http = require('http');
-
-var PORT = 8899;
-
-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;
- }
-})
-
-function get(url) {
- var fields
- , expected
- , header = {};
-
- function request(done) {
- http.get({ path: url, port: PORT, 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(){
-
- before(function(done) {
- server.listen(PORT, done);
- });
-
- after(function() {
- server.close();
- });
-
- 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-3.1.0/test/http-meta.spec.js b/tests/lib/mocha-3.1.0/test/http-meta.spec.js
deleted file mode 100644
index 5d1fb6750b..0000000000
--- a/tests/lib/mocha-3.1.0/test/http-meta.spec.js
+++ /dev/null
@@ -1,61 +0,0 @@
-var http = require('http');
-
-var PORT = 8889;
-
-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;
- }
-});
-
-
-function get(url, body, header) {
- return function(done){
- http.get({ path: url, port: PORT, 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 () {
-
- before(function(done) {
- server.listen(PORT, done);
- });
-
- after(function() {
- server.close();
- });
-
- 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-3.1.0/test/integration/diffs.spec.js b/tests/lib/mocha-3.1.0/test/integration/diffs.spec.js
deleted file mode 100644
index b779b84ada..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/diffs.spec.js
+++ /dev/null
@@ -1,44 +0,0 @@
-var assert = require('assert');
-var helpers = require('./helpers');
-var run = helpers.runMocha;
-var fs = require('fs');
-var getDiffs = helpers.getDiffs;
-
-function getExpectedOutput() {
- var output = fs.readFileSync('test/integration/fixtures/diffs/output', 'UTF8');
-
- // Diffs are delimited in file by "// DIFF"
- return output.split(/\s*\/\/ DIFF/).slice(1).map(function(diff) {
- return diff.split('\n').filter(Boolean).join('\n');
- });
-}
-
-describe('diffs', function() {
- var diffs, expected;
-
- before(function(done) {
- run('diffs/diffs.fixture.js', ['-C'], function(err, res) {
- expected = getExpectedOutput();
- diffs = getDiffs(res.output);
- done(err);
- });
- });
-
- [
- 'should display a diff for small strings',
- 'should display a diff of canonicalized objects',
- 'should display a diff for medium strings',
- 'should display a diff for entire object dumps',
- 'should display a diff for multi-line strings',
- 'should display a diff for entire object dumps',
- 'should display a full-comparison with escaped special characters',
- 'should display a word diff for large strings',
- 'should work with objects',
- 'should show value diffs and not be affected by commas',
- 'should display diff by data and not like an objects'
- ].forEach(function(title, i) {
- it(title, function() {
- assert.equal(diffs[i], expected[i]);
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/cascade.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/cascade.fixture.js
deleted file mode 100644
index 10b1c37ffd..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/cascade.fixture.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-3.1.0/test/integration/fixtures/diffs/diffs.css.in b/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.css.in
deleted file mode 100644
index 09a3ca5363..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.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-3.1.0/test/integration/fixtures/diffs/diffs.css.out b/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.css.out
deleted file mode 100644
index 53b3ec906e..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.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-3.1.0/test/integration/fixtures/diffs/diffs.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.fixture.js
deleted file mode 100644
index cf538fd777..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.fixture.js
+++ /dev/null
@@ -1,84 +0,0 @@
-var fs = require('fs');
-var assert = require('assert');
-var cssin = fs.readFileSync('test/integration/fixtures/diffs/diffs.css.in', 'ascii');
-var cssout = fs.readFileSync('test/integration/fixtures/diffs/diffs.css.out', 'ascii');
-
-describe('diffs', function() {
- var actual, expected;
-
- it('should display a diff for small strings', function() {
- actual = 'foo rar baz';
- expected = 'foo bar baz';
- actual.should.equal(expected);
- });
-
- it('should display a diff of canonicalized objects', function() {
- actual = { name: 'travis j', age: 23 };
- expected = { age: 23, name: 'travis' };
- actual.should.equal(expected);
- });
-
- it('should display a diff for medium strings', function() {
- actual = 'foo bar baz\nfoo rar baz\nfoo bar raz';
- expected = 'foo bar baz\nfoo bar baz\nfoo bar baz';
- actual.should.equal(expected);
- });
-
- it('should display a diff for entire object dumps', function() {
- actual = { name: 'joel', age: 30, address: {city: 'new york', country: 'usa' }};
- expected = { name: 'joe', age: 30, address: {city: 'new york', country: 'us' }};
- actual.should.equal(expected);
- });
-
- it('should display a diff for multi-line strings', function() {
- actual = 'one two three\nfour zzzz six\nseven eight nine';
- expected = 'one two three\nfour five six\nseven eight nine';
- actual.should.equal(expected);
- });
-
- it('should display a diff for entire object dumps', function() {
- actual = { name: 'joel', age: 30, address: {city: 'new york', country: 'usa' }};
- expected = { name: 'joe', age: 30, address: {city: 'new york', country: 'us' }}
- actual.should.equal(expected);
- });
-
- it('should display a full-comparison with escaped special characters', function() {
- actual = 'one\ttab\ntwo\t\t\ttabs';
- expected = 'one\ttab\ntwo\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() {
- actual = {
- name: 'tobi',
- species: 'ferret',
- color: 'white',
- age: 2
- };
-
- expected = {
- name: 'loki',
- species: 'ferret',
- color: 'brown',
- age: 2
- };
-
- actual.should.eql(expected);
- });
-
- it('should show value diffs and not be affected by commas', function() {
- actual = { a: 123 };
- expected = { a: 123, b: 456 };
- actual.should.equal(expected);
- });
-
- it('should display diff by data and not like an objects', function() {
- actual = new Buffer([0x01]);
- expected = new Buffer([0x02]);
- actual.should.equal(expected);
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/output b/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/output
deleted file mode 100644
index bf56a96397..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/output
+++ /dev/null
@@ -1,91 +0,0 @@
-// DIFF
- -foo rar baz
- +foo bar baz
-
-// DIFF
- {
- "age": 23
- - "name": "travis j"
- + "name": "travis"
- }
-
-// DIFF
- foo bar baz
- -foo rar baz
- -foo bar raz
- +foo bar baz
- +foo bar baz
-
-// DIFF
- {
- "address": {
- "city": "new york"
- - "country": "usa"
- + "country": "us"
- }
- "age": 30
- - "name": "joel"
- + "name": "joe"
- }
-
-// DIFF
- one two three
- -four zzzz six
- +four five six
- seven eight nine
-
-// DIFF
- {
- "address": {
- "city": "new york"
- - "country": "usa"
- + "country": "us"
- }
- "age": 30
- - "name": "joel"
- + "name": "joe"
- }
-
-// DIFF
- one tab
- -two tabs
- +two tabs
-
-// DIFF
- body {
- font: "Helvetica Neue", Helvetica, arial, sans-serif;
- background: black;
- - color: white;
- + color: #fff;
- }
-
- a {
- - color: blue
- + color: blue;
- }
- +
- +foo {
- + bar: 'baz';
- +}
-
-// DIFF
- {
- "age": 2
- - "color": "white"
- - "name": "tobi"
- + "color": "brown"
- + "name": "loki"
- "species": "ferret"
- }
-
-// DIFF
- {
- "a": 123
- + "b": 456
- }
-
-// DIFF
- [
- - 1
- + 2
- ]
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-async-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-async-error.fixture.js
deleted file mode 100644
index dc55537a60..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-async-error.fixture.js
+++ /dev/null
@@ -1,19 +0,0 @@
-describe('spec 1', function () {
- after(function (done) {
- console.log('after');
- process.nextTick(function () {
- throw new Error('after hook error');
- });
- });
- it('should be called because error is in after hook', function () {
- console.log('test 1');
- });
- it('should be called because error is in after hook', function () {
- console.log('test 2');
- });
-});
-describe('spec 2', function () {
- it('should be called, because hook error was in a sibling suite', function () {
- console.log('test 3');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-error.fixture.js
deleted file mode 100644
index e84856e433..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-error.fixture.js
+++ /dev/null
@@ -1,17 +0,0 @@
-describe('spec 1', function () {
- after(function () {
- console.log('after');
- throw new Error('after hook error');
- });
- it('should be called because error is in after hook', function () {
- console.log('test 1');
- });
- it('should be called because error is in after hook', function () {
- console.log('test 2');
- });
-});
-describe('spec 2', function () {
- it('should be called, because hook error was in a sibling suite', function () {
- console.log('test 3');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-async-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-async-error.fixture.js
deleted file mode 100644
index d4f4c9bdd9..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-async-error.fixture.js
+++ /dev/null
@@ -1,19 +0,0 @@
-describe('spec 1', function () {
- afterEach(function (done) {
- console.log('after');
- process.nextTick(function () {
- throw new Error('after each hook error');
- });
- });
- it('should be called because error is in after each hook', function () {
- console.log('test 1');
- });
- it('should not be called', function () {
- console.log('test 2');
- });
-});
-describe('spec 2', function () {
- it('should be called, because hook error was in a sibling suite', function () {
- console.log('test 3');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-error.fixture.js
deleted file mode 100644
index 9d28632fa3..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-error.fixture.js
+++ /dev/null
@@ -1,17 +0,0 @@
-describe('spec 1', function () {
- afterEach(function () {
- console.log('after');
- throw new Error('after each hook error');
- });
- it('should be called because error is in after each hook', function () {
- console.log('test 1');
- });
- it('should not be called', function () {
- console.log('test 2');
- });
-});
-describe('spec 2', function () {
- it('should be called, because hook error was in a sibling suite', function () {
- console.log('test 3');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error-tip.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error-tip.fixture.js
deleted file mode 100644
index 14e114e959..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error-tip.fixture.js
+++ /dev/null
@@ -1,11 +0,0 @@
-describe('spec 1', function() {
- it('should not blame me', function() { });
-});
-describe('spec 2', function() {
- before(function(done) {
- process.nextTick(function () {
- throw new Error('before hook error');
- });
- });
- it('skipped');
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error.fixture.js
deleted file mode 100644
index 10ea95156b..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error.fixture.js
+++ /dev/null
@@ -1,19 +0,0 @@
-describe('spec 1', function () {
- before(function (done) {
- console.log('before');
- process.nextTick(function () {
- throw new Error('before hook error');
- });
- });
- it('should not be called because of error in before hook', function () {
- console.log('test 1');
- });
- it('should not be called because of error in before hook', function () {
- console.log('test 2');
- });
-});
-describe('spec 2', function () {
- it('should be called, because hook error was in a sibling suite', function () {
- console.log('test 3');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error-tip.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error-tip.fixture.js
deleted file mode 100644
index 567dfef26b..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error-tip.fixture.js
+++ /dev/null
@@ -1,9 +0,0 @@
-describe('spec 1', function() {
- it('should not blame me', function() { });
-});
-describe('spec 2', function() {
- before(function() {
- throw new Error('before hook error');
- });
- it('skipped');
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error.fixture.js
deleted file mode 100644
index b3d6ea6640..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error.fixture.js
+++ /dev/null
@@ -1,17 +0,0 @@
-describe('spec 1', function () {
- before(function () {
- console.log('before');
- throw new Error('before hook error');
- });
- it('should not be called because of error in before hook', function () {
- console.log('test 1');
- });
- it('should not be called because of error in before hook', function () {
- console.log('test 2');
- });
-});
-describe('spec 2', function () {
- it('should be called, because hook error was in a sibling suite', function () {
- console.log('test 3');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-async-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-async-error.fixture.js
deleted file mode 100644
index a34ed755e2..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-async-error.fixture.js
+++ /dev/null
@@ -1,19 +0,0 @@
-describe('spec 1', function () {
- beforeEach(function (done) {
- console.log('before');
- process.nextTick(function () {
- throw new Error('before each hook error');
- });
- });
- it('should not be called because of error in before each hook', function () {
- console.log('test 1');
- });
- it('should not be called because of error in before each hook', function () {
- console.log('test 2');
- });
-});
-describe('spec 2', function () {
- it('should be called, because hook error was in a sibling suite', function () {
- console.log('test 3');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-error.fixture.js
deleted file mode 100644
index bd84e8fe74..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-error.fixture.js
+++ /dev/null
@@ -1,17 +0,0 @@
-describe('spec 1', function () {
- beforeEach(function () {
- console.log('before');
- throw new Error('before each hook error');
- });
- it('should not be called because of error in before each hook', function () {
- console.log('test 1');
- });
- it('should not be called because of error in before each hook', function () {
- console.log('test 2');
- });
-});
-describe('spec 2', function () {
- it('should be called, because hook error was in a sibling suite', function () {
- console.log('test 3');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-async-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-async-error.fixture.js
deleted file mode 100644
index 93ace7ff0d..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-async-error.fixture.js
+++ /dev/null
@@ -1,139 +0,0 @@
-before(function () {
- console.log('root before');
-});
-beforeEach(function () {
- console.log('root before each');
-});
-describe('1', function () {
- beforeEach(function () {
- console.log('1 before each');
- });
-
- describe('1-1', function () {
- before(function () {
- console.log('1-1 before');
- });
- beforeEach(function (done) {
- console.log('1-1 before each');
- process.nextTick(function () {
- throw new Error('1-1 before each hook failed');
- });
- });
- it('1-1 test 1', function () {
- console.log('1-1 test 1');
- });
- it('1-1 test 2', function () {
- console.log('1-1 test 2');
- });
- afterEach(function () {
- console.log('1-1 after each');
- });
- after(function (done) {
- console.log('1-1 after');
- process.nextTick(function () {
- throw new Error('1-1 after hook failed');
- });
- });
- });
-
- describe('1-2', function () {
- before(function () {
- console.log('1-2 before');
- });
- beforeEach(function () {
- console.log('1-2 before each');
- });
- it('1-2 test 1', function () {
- console.log('1-2 test 1');
- });
- it('1-2 test 2', function () {
- console.log('1-2 test 2');
- });
- afterEach(function (done) {
- console.log('1-2 after each');
- process.nextTick(function () {
- throw new Error('1-2 after each hook failed');
- });
- });
- after(function () {
- console.log('1-2 after');
- });
- });
-
- afterEach(function () {
- console.log('1 after each');
- });
-
- after(function () {
- console.log('1 after');
- });
-});
-
-describe('2', function () {
- beforeEach(function (done) {
- console.log('2 before each');
- process.nextTick(function () {
- throw new Error('2 before each hook failed');
- });
- });
-
- describe('2-1', function () {
- before(function () {
- console.log('2-1 before');
- });
- beforeEach(function () {
- console.log('2-1 before each');
- });
- it('2-1 test 1', function () {
- console.log('2-1 test 1');
- });
- it('2-1 test 2', function () {
- console.log('2-1 test 2');
- });
- afterEach(function () {
- console.log('2-1 after each');
- });
- after(function () {
- console.log('2-1 after');
- });
- });
-
- describe('2-2', function () {
- before(function () {
- console.log('2-2 before');
- });
- beforeEach(function () {
- console.log('2-2 before each');
- });
- it('2-2 test 1', function () {
- console.log('2-2 test 1');
- });
- it('2-2 test 2', function () {
- console.log('2-2 test 2');
- });
- afterEach(function () {
- console.log('2-2 after each');
- });
- after(function () {
- console.log('2-2 after');
- });
- });
-
- afterEach(function (done) {
- console.log('2 after each');
- process.nextTick(function () {
- throw new Error('2 after each hook failed');
- });
- });
-
- after(function () {
- console.log('2 after');
- });
-});
-
-after(function () {
- console.log('root after');
-});
-afterEach(function () {
- console.log('root after each');
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-error.fixture.js
deleted file mode 100644
index 53d167b1cf..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-error.fixture.js
+++ /dev/null
@@ -1,129 +0,0 @@
-before(function () {
- console.log('root before');
-});
-beforeEach(function () {
- console.log('root before each');
-});
-describe('1', function () {
- beforeEach(function () {
- console.log('1 before each');
- });
-
- describe('1-1', function () {
- before(function () {
- console.log('1-1 before');
- });
- beforeEach(function () {
- console.log('1-1 before each');
- throw new Error('1-1 before each hook failed');
- });
- it('1-1 test 1', function () {
- console.log('1-1 test 1');
- });
- it('1-1 test 2', function () {
- console.log('1-1 test 2');
- });
- afterEach(function () {
- console.log('1-1 after each');
- });
- after(function () {
- console.log('1-1 after');
- throw new Error('1-1 after hook failed');
- });
- });
-
- describe('1-2', function () {
- before(function () {
- console.log('1-2 before');
- });
- beforeEach(function () {
- console.log('1-2 before each');
- });
- it('1-2 test 1', function () {
- console.log('1-2 test 1');
- });
- it('1-2 test 2', function () {
- console.log('1-2 test 2');
- });
- afterEach(function () {
- console.log('1-2 after each');
- throw new Error('1-2 after each hook failed');
- });
- after(function () {
- console.log('1-2 after');
- });
- });
-
- afterEach(function () {
- console.log('1 after each');
- });
-
- after(function () {
- console.log('1 after');
- });
-});
-
-describe('2', function () {
- beforeEach(function () {
- console.log('2 before each');
- throw new Error('2 before each hook failed');
- });
-
- describe('2-1', function () {
- before(function () {
- console.log('2-1 before');
- });
- beforeEach(function () {
- console.log('2-1 before each');
- });
- it('2-1 test 1', function () {
- console.log('2-1 test 1');
- });
- it('2-1 test 2', function () {
- console.log('2-1 test 2');
- });
- afterEach(function () {
- console.log('2-1 after each');
- });
- after(function () {
- console.log('2-1 after');
- });
- });
-
- describe('2-2', function () {
- before(function () {
- console.log('2-2 before');
- });
- beforeEach(function () {
- console.log('2-2 before each');
- });
- it('2-2 test 1', function () {
- console.log('2-2 test 1');
- });
- it('2-2 test 2', function () {
- console.log('2-2 test 2');
- });
- afterEach(function () {
- console.log('2-2 after each');
- });
- after(function () {
- console.log('2-2 after');
- });
- });
-
- afterEach(function () {
- console.log('2 after each');
- throw new Error('2 after each hook failed');
- });
-
- after(function () {
- console.log('2 after');
- });
-});
-
-after(function () {
- console.log('root after');
-});
-afterEach(function () {
- console.log('root after each');
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-before.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-before.fixture.js
deleted file mode 100644
index 80d4adb61a..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-before.fixture.js
+++ /dev/null
@@ -1,10 +0,0 @@
-describe('suite', function() {
- before(function(done) {
- setTimeout(done, 10);
- setTimeout(done, 30);
- });
-
- it('test1', function(done) {
- setTimeout(done, 50);
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-beforeEach.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-beforeEach.fixture.js
deleted file mode 100644
index 9b4724dea1..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-beforeEach.fixture.js
+++ /dev/null
@@ -1,14 +0,0 @@
-describe('suite', function() {
- beforeEach(function(done) {
- setTimeout(done, 10);
- setTimeout(done, 20);
- });
-
- it('test1', function(done) {
- setTimeout(done, 50);
- });
-
- it('test2', function(done) {
- setTimeout(done, 50);
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-specs.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-specs.fixture.js
deleted file mode 100644
index 82197061f1..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-specs.fixture.js
+++ /dev/null
@@ -1,10 +0,0 @@
-describe('suite', function() {
- it('test1', function(done) {
- done();
- setTimeout(done, 10);
- });
-
- it('test2', function(done) {
- setTimeout(done, 20);
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done.fixture.js
deleted file mode 100644
index 63a704061c..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done.fixture.js
+++ /dev/null
@@ -1,18 +0,0 @@
-// The suite below should result in an additional error, but does
-// not. Uncomment once this bug is resolved.
-
-// describe('suite', function() {
-// beforeEach(function(done) {
-// done();
-// done();
-// });
-
-// it('test', function() {});
-// });
-
-it('should fail in a test-case', function(done) {
- process.nextTick(function(){
- done();
- done();
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-async.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-async.fixture.js
deleted file mode 100644
index 5387d169b7..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-async.fixture.js
+++ /dev/null
@@ -1,3 +0,0 @@
-it('should pass', function(done){
- done();
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-sync.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-sync.fixture.js
deleted file mode 100644
index d0dd9fa828..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-sync.fixture.js
+++ /dev/null
@@ -1 +0,0 @@
-it('throws an error', function() {});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/bail.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/bail.fixture.js
deleted file mode 100644
index 32d17e9aa8..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/bail.fixture.js
+++ /dev/null
@@ -1,21 +0,0 @@
-describe('suite1', function() {
- it('should display this spec', 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('suite2', 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-3.1.0/test/integration/fixtures/options/delay-fail.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/delay-fail.fixture.js
deleted file mode 100644
index 1475c918d4..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/delay-fail.fixture.js
+++ /dev/null
@@ -1,5 +0,0 @@
-setTimeout(function() {
- throw new Error('oops');
- it('test', function() {});
- run();
-}, 100);
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/delay.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/delay.fixture.js
deleted file mode 100644
index a8bf2d4112..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/delay.fixture.js
+++ /dev/null
@@ -1,14 +0,0 @@
-var assert = require('assert');
-var delay = 500;
-
-setTimeout(function() {
- describe('delayed execution', function() {
- it('should have no effect if attempted twice in the same suite', function() {
- assert(true);
- run();
- assert(true);
- });
- });
-
- run();
-}, delay);
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/grep.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/grep.fixture.js
deleted file mode 100644
index 94785dc7db..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/grep.fixture.js
+++ /dev/null
@@ -1,17 +0,0 @@
-describe('grep', function() {
- describe('Match', function() {
- it('should run', function(){});
- it('should also run', function() {});
- });
-
- describe('match', function() {
- it('should run', function(){});
- it('should also run', function() {});
- });
-
- describe('fail', function() {
- it('should not be ran', function() {
- throw new Error('Spec should not run');
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/bdd.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/bdd.fixture.js
deleted file mode 100644
index 783ce19b0b..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/bdd.fixture.js
+++ /dev/null
@@ -1,71 +0,0 @@
-describe.only('should run this suite', function() {
- it('should run this test', function() {});
-
- it('should run this test', function() {});
-
- it('should run this test', function() {});
-});
-
-describe('should not run this suite', function() {
- it('should not run this test', function() {
- (true).should.equal(false);
- });
-
- it('should not run this test', function() {
- (true).should.equal(false);
- });
-
- it('should not run this test', function() {
- (true).should.equal(false);
- });
-});
-
-describe.only('should run this suite too', function() {
- describe('should run this nested suite', function () {
- it('should run this test', function() {});
-
- it('should run this test', function() {});
-
- it('should run this test', function() {});
- });
-});
-
-describe.only('should run this suite, even', function() {
- describe('should run this nested suite, even', function () {
- describe('should run this doubly-nested suite!', function () {
- it('should run this test', function() {});
-
- it('should run this test', function() {});
-
- it('should run this test', function() {});
- });
- });
-});
-
-
-describe('should run this suite with an exclusive test', function() {
- it.only('should run this test', function () {});
-
- describe('should not run this nested suite', function () {
- describe.only('should not run this doubly-nested suite', function () {
- it('should not run this test', function() {});
-
- it('should not run this test', function() {});
-
- it('should not run this test', function() {});
- });
- });
-});
-
-describe('should run this suite with an exclusive test (reverse order)', function() {
- describe('should not run this nested suite', function () {
- describe.only('should not run this doubly-nested suite', function () {
- it('should not run this test', function() {});
-
- it('should not run this test', function() {});
-
- it('should not run this test', function() {});
- });
- });
- it.only('should run this test', function () {});
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/qunit.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/qunit.fixture.js
deleted file mode 100644
index 9fa95f440b..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/qunit.fixture.js
+++ /dev/null
@@ -1,26 +0,0 @@
-suite.only('should run all tests in this suite');
-
-test('should run this test #1', function() {});
-
-test('should run this test #2', function() {});
-
-test('should run this test #3', function() {});
-
-test('should run this test #4', function() {});
-
-test('should run this test #5', function() {});
-
-
-suite('should not run any of this suite\'s tests');
-
-test('should not run this test', function() {
- (false).should.equal(true);
-});
-
-test('should not run this test', function() {
- (false).should.equal(true);
-});
-
-test('should not run this test', function() {
- (false).should.equal(true);
-}); \ No newline at end of file
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/tdd.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/tdd.fixture.js
deleted file mode 100644
index 129a9e5d74..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/tdd.fixture.js
+++ /dev/null
@@ -1,35 +0,0 @@
-suite.only('should run all tests in this tdd suite', function() {
- test('should run this test #1', function() {});
-
- test('should run this test #2', function() {});
-
- test('should run this test #3', function() {});
-
- test('should run this test #4', function() {});
-});
-
-suite('should not run this suite', function() {
- test('should not run this test', function() {
- (true).should.equal(false);
- });
-
- test('should not run this test', function() {
- (true).should.equal(false);
- });
-
- test('should not run this test', function() {
- (true).should.equal(false);
- });
-});
-
-suite.only('should run this suite too', function() {
- suite('should run this nested suite', function () {
- test('should run this test', function() {});
-
- test('should run this test', function() {});
-
- test('should run this test', function() {});
-
- test('should run this test', function() {});
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/retries.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/retries.fixture.js
deleted file mode 100644
index b2f76e12ea..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/retries.fixture.js
+++ /dev/null
@@ -1,5 +0,0 @@
-describe('retries', function() {
- it('should fail', function () {
- throw new Error('retry failure');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/sort-alpha.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/sort-alpha.fixture.js
deleted file mode 100644
index 7a5302994f..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/sort-alpha.fixture.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-3.1.0/test/integration/fixtures/options/sort-beta.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/sort-beta.fixture.js
deleted file mode 100644
index 0951f49038..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/sort-beta.fixture.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-3.1.0/test/integration/fixtures/passing.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/passing.fixture.js
deleted file mode 100644
index df91b3e501..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/passing.fixture.js
+++ /dev/null
@@ -1,11 +0,0 @@
-var assert = require('assert');
-
-describe('suite', function() {
- it('test1', function() {
- assert(true);
- });
-
- it('test2', function() {
- assert(true);
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-before.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-before.fixture.js
deleted file mode 100644
index 114db36d88..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-before.fixture.js
+++ /dev/null
@@ -1,16 +0,0 @@
-describe('skip in before', function() {
- before(function(done) {
- var self = this;
- setTimeout(function() {
- self.skip();
- }, 50);
- });
-
- it('should never run this test', function() {
- throw new Error('never thrown');
- });
-
- it('should never run this test', function() {
- throw new Error('never thrown');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-beforeEach.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-beforeEach.fixture.js
deleted file mode 100644
index b8db22b94a..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-beforeEach.fixture.js
+++ /dev/null
@@ -1,16 +0,0 @@
-describe('skip in beforeEach', function() {
- beforeEach(function(done) {
- var self = this;
- setTimeout(function() {
- self.skip();
- }, 50);
- });
-
- it('should never run this test', function() {
- throw new Error('never thrown');
- });
-
- it('should never run this test', function() {
- throw new Error('never thrown');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-spec.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-spec.fixture.js
deleted file mode 100644
index 6096c59d2a..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-spec.fixture.js
+++ /dev/null
@@ -1,12 +0,0 @@
-describe('skip in test', function() {
- it('should skip async', function(done) {
- var self = this;
- setTimeout(function() {
- self.skip();
- }, 50);
- });
-
- it('should run other tests in the suite', function() {
- // Do nothing
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-before.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-before.fixture.js
deleted file mode 100644
index 35152e27f4..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-before.fixture.js
+++ /dev/null
@@ -1,13 +0,0 @@
-describe('skip in before', function() {
- before(function() {
- this.skip();
- });
-
- it('should never run this test', function() {
- throw new Error('never thrown');
- });
-
- it('should never run this test', function() {
- throw new Error('never thrown');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-beforeEach.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-beforeEach.fixture.js
deleted file mode 100644
index 8d1c442ce2..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-beforeEach.fixture.js
+++ /dev/null
@@ -1,13 +0,0 @@
-describe('skip in beforeEach', function() {
- beforeEach(function() {
- this.skip();
- });
-
- it('should never run this test', function() {
- throw new Error('never thrown');
- });
-
- it('should never run this test', function() {
- throw new Error('never thrown');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-spec.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-spec.fixture.js
deleted file mode 100644
index e2bbb739b3..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-spec.fixture.js
+++ /dev/null
@@ -1,10 +0,0 @@
-describe('skip in test', function() {
- it('should skip immediately', function() {
- this.skip();
- throw new Error('never thrown');
- });
-
- it('should run other tests in the suite', function() {
- // Do nothing
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/spec.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/spec.fixture.js
deleted file mode 100644
index 084dd33588..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/spec.fixture.js
+++ /dev/null
@@ -1,3 +0,0 @@
-describe('suite', function() {
- it('pending spec');
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/issue-1794.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/issue-1794.fixture.js
deleted file mode 100644
index 1a1637f30a..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/issue-1794.fixture.js
+++ /dev/null
@@ -1,3 +0,0 @@
-test('pass', function() {
- // pass
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/simple-ui.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/simple-ui.js
deleted file mode 100644
index 1fdf33d665..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/simple-ui.js
+++ /dev/null
@@ -1,27 +0,0 @@
-var path = '../../../../../lib/',
- Mocha = require(path + 'mocha');
- Suite = require(path + 'suite'),
- Test = require(path + 'test');
-
-/**
- * A simple UI that only exposes a single function: test
- */
-module.exports = Mocha.interfaces['simple-ui'] = function(suite) {
- suite.on('pre-require', function(context, file, mocha) {
- var common = require(path + 'interfaces/common')([suite], context);
-
- context.run = mocha.options.delay && common.runWithSuite(suite);
-
- /**
- * Describes a specification or test-case with the given `title`
- * and callback `fn` acting as a thunk.
- */
- context.test = function(title, fn) {
- var test = new Test(title, fn);
- test.file = file;
- suite.addTest(test);
-
- return test;
- };
- });
-};
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1327.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1327.fixture.js
deleted file mode 100644
index 43d5553762..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1327.fixture.js
+++ /dev/null
@@ -1,15 +0,0 @@
-it('test 1', function() {
- console.log('testbody1');
- process.nextTick(function() {
- throw 'Too bad';
- });
-});
-
-it('test 2', function() {
- console.log('testbody2');
-});
-
-it('test 3', function() {
- console.log('testbody3');
- throw new Error('OUCH');
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1991.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1991.fixture.js
deleted file mode 100644
index 96860332a2..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1991.fixture.js
+++ /dev/null
@@ -1,47 +0,0 @@
-function MemoryLeak() {
- this.myArr = [];
- for (var i = 0; i < 1000000; i++) {
- this.myArr.push(i)
- }
-}
-
-var numOfTests = 300;
-for (var i = 0; i < numOfTests; i += 1) {
- /*
- * This Test suite will crash V8 due to:
- * 'FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory'
- * if all the deferred functions references have not been cleared
- */
- describe('Memory Leak Suite #' + i, function () {
-
- // The <closureVar> variable will be accessed by the test below.
- // As long as those test's functions are
- // referenced in memory, the closure variable may not be garbage collected
- // as it is still referenced.
- // * In a chrome heap snapshot it will appear under "system / Context" (a scope)
- var closureVar;
-
- before(function () {
- var x = closureVar ? 1 : 2
- });
-
- after(function () {
- var x = closureVar[0]
- });
-
- beforeEach(function () {
- var x = closureVar ? 1 : 2
- });
-
- afterEach(function () {
- var x = closureVar[0]
- });
-
- it('access a variable via a closure', function () {
- // slow performance on older node.js versions
- this.timeout(1000);
- closureVar = new MemoryLeak();
- });
-
- });
-}
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2315.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2315.js
deleted file mode 100644
index cdfb201059..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2315.js
+++ /dev/null
@@ -1,9 +0,0 @@
-describe('issue-2315: cannot read property currentRetry of undefined', function () {
- before(function () {
- process.nextTick(function () {
- throw new Error();
- });
- });
-
- it('something', function () {});
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2406.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2406.fixture.js
deleted file mode 100644
index c800228f1e..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2406.fixture.js
+++ /dev/null
@@ -1,15 +0,0 @@
-describe('outer describe', function() {
- it('should not run this test', function() {});
- describe('this suite should not run', function() {
- it('should not run this test', function() {});
- });
- describe.only('this .only suite should run', function() {
- describe('this suite should run', function() {
- it('should run this test in a nested suite', function() {});
- });
- it('should run this test', function() {});
- });
- describe('this suite should not run', function() {
- it('should not run this test', function() {});
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2417.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2417.fixture.js
deleted file mode 100644
index e14aab09db..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2417.fixture.js
+++ /dev/null
@@ -1,7 +0,0 @@
-describe('outer describe', function() {
- describe.only('outer describe.only', function() {
- it.only('inner it.only', function() {
- // should run and exit without error
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/async.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/async.fixture.js
deleted file mode 100644
index 0e917e52f3..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/async.fixture.js
+++ /dev/null
@@ -1,28 +0,0 @@
-describe('retries', function() {
- var times = 0;
- before(function () {
- console.log('before');
- });
-
- after(function () {
- console.log('after');
- });
-
- beforeEach(function() {
- console.log('before each', times);
- });
-
- afterEach(function () {
- console.log('after each', times);
- });
-
- it('should allow override and run appropriate hooks', function (done) {
- this.timeout(200);
- this.retries(2);
- console.log('TEST', times);
- if (++times < 3) {
- return setTimeout(done, 300);
- }
- setTimeout(done, 50);
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/early-pass.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/early-pass.fixture.js
deleted file mode 100644
index 0010d120fa..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/early-pass.fixture.js
+++ /dev/null
@@ -1,11 +0,0 @@
-describe('retries', function() {
- this.retries(1);
- var times = 0;
-
- it('should pass after 1 retry', function() {
- times++;
- if (times !== 2) {
- throw new Error('retry error ' + times);
- }
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/hooks.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/hooks.fixture.js
deleted file mode 100644
index 47f6c6a1b7..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/hooks.fixture.js
+++ /dev/null
@@ -1,25 +0,0 @@
-describe('retries', function() {
- var times = 0;
- before(function () {
- console.log('before');
- });
-
- after(function () {
- console.log('after');
- });
-
- beforeEach(function() {
- console.log('before each', times);
- });
-
- afterEach(function () {
- console.log('after each', times);
- });
-
- it('should allow override and run appropriate hooks', function(){
- this.retries(4);
- console.log('TEST', times);
- times++;
- throw new Error('retry error');
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/nested.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/nested.fixture.js
deleted file mode 100644
index 43c40cb236..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/nested.fixture.js
+++ /dev/null
@@ -1,9 +0,0 @@
-describe('retries', function() {
- this.retries(3);
- describe('nested', function () {
- it('should fail after only 1 retry', function(){
- this.retries(1);
- throw new Error('retry error');
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-no-callback.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-no-callback.fixture.js
deleted file mode 100644
index de55b358a3..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-no-callback.fixture.js
+++ /dev/null
@@ -1 +0,0 @@
-describe('a suite without a callback');
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-callback.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-callback.fixture.js
deleted file mode 100644
index b30b67ee2e..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-callback.fixture.js
+++ /dev/null
@@ -1 +0,0 @@
-xdescribe('a pending suite with a callback', function () {});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-no-callback.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-no-callback.fixture.js
deleted file mode 100644
index c5bca84a47..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-no-callback.fixture.js
+++ /dev/null
@@ -1 +0,0 @@
-xdescribe('a pending suite without a callback');
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/timeout.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/timeout.fixture.js
deleted file mode 100644
index d8c99b2bc3..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/timeout.fixture.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());
- }
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught-hook.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught-hook.fixture.js
deleted file mode 100644
index 9adcb3f726..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught-hook.fixture.js
+++ /dev/null
@@ -1,15 +0,0 @@
-describe('uncaught', function() {
- beforeEach(function(done) {
- process.nextTick(function() {
- throw new Error('oh noes');
- done();
- });
- });
-
- it('test', function(done) {
- process.nextTick(function() {
- throw new Error("I'm uncaught!");
- done();
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught.fixture.js
deleted file mode 100644
index 054d1d857b..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught.fixture.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict';
-
-/**
- * This file should only generate one failure per spec despite the fact that
- * Mocha is capable of detecting two distinct exceptions during test execution.
- */
-
-it('fails exactly once when a global error is thrown first', function(done) {
- setTimeout(function() {
- throw new Error('global error');
-
- setTimeout(function() {
- done(new Error('test error'));
- }, 0);
- }, 0);
-});
-
-it('fails exactly once when a global error is thrown second', function(done) {
- setTimeout(function() {
- done(new Error('test error'));
- }, 0);
-
- setTimeout(function() {
- throw new Error('global error');
- }, 0);
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/helpers.js b/tests/lib/mocha-3.1.0/test/integration/helpers.js
deleted file mode 100644
index 2720eb3bda..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/helpers.js
+++ /dev/null
@@ -1,191 +0,0 @@
-var spawn = require('child_process').spawn;
-var path = require('path');
-var fs = require('fs');
-var baseReporter = require('../../lib/reporters/base');
-
-module.exports = {
- /**
- * Invokes the mocha binary for the given fixture with color output disabled.
- * Accepts an array of additional command line args to pass. The callback is
- * invoked with a summary of the run, in addition to its output. The summary
- * includes the number of passing, pending, and failing tests, as well as the
- * exit code. Useful for testing different reporters.
- *
- * Example response:
- * {
- * pending: 0,
- * passing: 0,
- * failing: 1,
- * code: 1,
- * output: '...'
- * }
- *
- * @param {string} fixturePath
- * @param {array} args
- * @param {function} fn
- */
- runMocha: function(fixturePath, args, fn) {
- var path;
-
- path = resolveFixturePath(fixturePath);
- args = args || [];
-
- invokeMocha(args.concat(['-C', path]), function(err, res) {
- if (err) return fn(err);
-
- fn(null, getSummary(res));
- });
- },
-
- /**
- * Invokes the mocha binary on the code of the body of the function.
- * Accepts an array of additional command line args to pass. The callback is
- * invoked with a summary of the run, in addition to its output. The summary
- * includes the number of passing, pending, and failing tests, as well as the
- * exit code. Useful for testing different reporters.
- *
- * Example response:
- * {
- * pending: 0,
- * passing: 0,
- * failing: 1,
- * code: 1,
- * output: '...'
- * }
- *
- * @param {function} fixture
- * @param {array} args
- * @param {function} fn
- */
- runMochaFunction: function(fixture, args, fn) {
- var path = resolveFixturePath(fixture.name + '.js' || 'tempfile.js');
- args = args || [];
-
- var fixtureContent = 'var fn = ' + fixture.toString() + '; fn()';
- fs.writeFileSync(path, fixtureContent, 'utf8');
-
- function cleanup() {
- fs.unlink(path);
- fn.apply(this, arguments);
- }
-
- invokeMocha(args.concat(['-C', path]), function(err, res) {
- if (err) {
- return cleanup(err);
- }
-
- cleanup(null, getSummary(res));
- });
- },
-
- /**
- * Invokes the mocha binary for the given fixture using the JSON reporter,
- * returning the parsed output, as well as exit code.
- *
- * @param {string} fixturePath
- * @param {array} args
- * @param {function} fn
- */
- runMochaJSON: function(fixturePath, args, fn) {
- var path;
-
- path = resolveFixturePath(fixturePath);
- args = args || [];
-
- invokeMocha(args.concat(['--reporter', 'json', path]), function(err, res) {
- if (err) return fn(err);
-
- try {
- var result = JSON.parse(res.output);
- result.code = res.code;
- } catch (err) {
- return fn(err);
- }
-
- fn(null, result);
- });
- },
-
- /**
- * Returns an array of diffs corresponding to exceptions thrown from specs,
- * given the plaintext output (-C) of a mocha run.
- *
- * @param {string} output
- * returns {string[]}
- */
- getDiffs: function(output) {
- var diffs, i, inDiff, inStackTrace;
-
- diffs = [];
- output.split('\n').forEach(function(line) {
- if (line.match(/^ \d+\)/)) {
- // New spec, e.g. "1) spec title"
- diffs.push([]);
- i = diffs.length - 1;
- inStackTrace = false;
- inDiff = false;
- } else if (!diffs.length || inStackTrace) {
- // Haven't encountered a spec yet
- // or we're in the middle of a stack trace
- return;
- } else if (line.indexOf('+ expected - actual') !== -1) {
- inDiff = true;
- } else if (line.match(/at Context/)) {
- // At the start of a stack trace
- inStackTrace = true;
- inDiff = false;
- } else if (inDiff) {
- diffs[i].push(line);
- }
- });
-
- // Ignore empty lines before/after diff
- return diffs.map(function(diff) {
- return diff.slice(1, -3).join('\n');
- });
- },
-
- /**
- * regular expression used for splitting lines based on new line / dot symbol.
- */
- splitRegExp: new RegExp('[\\n' + baseReporter.symbols.dot + ']+')
-};
-
-function invokeMocha(args, fn) {
- var output, mocha, listener;
-
- output = '';
- args = [path.join('bin', 'mocha')].concat(args);
- mocha = spawn(process.execPath, args);
-
- listener = function(data) {
- output += data;
- };
-
- mocha.stdout.on('data', listener);
- mocha.stderr.on('data', listener);
- mocha.on('error', fn);
-
- mocha.on('close', function(code) {
- fn(null, {
- output: output.split('\n').join('\n'),
- code: code
- });
- });
-}
-
-function resolveFixturePath(fixture) {
- return path.join('./test/integration/fixtures', fixture);
-}
-
-function getSummary(res) {
- return ['passing', 'pending', 'failing'].reduce(function(summary, type) {
- var pattern, match;
-
- pattern = new RegExp(' (\\d+) ' + type + '\\s');
- match = pattern.exec(res.output);
- summary[type] = (match) ? parseInt(match, 10) : 0;
-
- return summary;
- }, res);
-}
diff --git a/tests/lib/mocha-3.1.0/test/integration/hook-err.spec.js b/tests/lib/mocha-3.1.0/test/integration/hook-err.spec.js
deleted file mode 100644
index be18721f31..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/hook-err.spec.js
+++ /dev/null
@@ -1,215 +0,0 @@
-var assert = require('assert');
-var runMocha = require('./helpers').runMocha;
-var splitRegExp = require('./helpers').splitRegExp;
-var bang = require('../../lib/reporters/base').symbols.bang;
-
-describe('hook error handling', function() {
- var lines;
-
- describe('before hook error', function() {
- before(run('hooks/before-hook-error.fixture.js'));
- it('should verify results', function() {
- assert.deepEqual(
- lines,
- ['before', bang + 'test 3']
- );
- });
- });
-
- describe('before hook error tip', function() {
- before(run('hooks/before-hook-error-tip.fixture.js', onlyErrorTitle));
- it('should verify results', function() {
- assert.deepEqual(
- lines,
- ['1) spec 2 "before all" hook:']
- );
- });
- });
-
- describe('before each hook error', function() {
- before(run('hooks/beforeEach-hook-error.fixture.js'));
- it('should verify results', function() {
- assert.deepEqual(
- lines,
- ['before', bang + 'test 3']
- );
- });
- });
-
- describe('after hook error', function() {
- before(run('hooks/after-hook-error.fixture.js'));
- it('should verify results', function() {
- assert.deepEqual(
- lines,
- ['test 1', 'test 2', 'after', bang + 'test 3']
- );
- });
- });
-
- describe('after each hook error', function() {
- before(run('hooks/afterEach-hook-error.fixture.js'));
- it('should verify results', function() {
- assert.deepEqual(
- lines,
- ['test 1', 'after', bang + 'test 3']
- );
- });
- });
-
- describe('multiple hook errors', function() {
- before(run('hooks/multiple-hook-error.fixture.js'));
- it('should verify results', function() {
- assert.deepEqual(
- lines,
- [
- 'root before',
- '1-1 before',
- 'root before each',
- '1 before each',
- '1-1 before each',
- bang + '1-1 after each',
- '1 after each',
- 'root after each',
- '1-1 after',
- bang + '1-2 before',
- 'root before each',
- '1 before each',
- '1-2 before each',
- '1-2 test 1',
- '1-2 after each',
- bang + '1 after each',
- 'root after each',
- '1-2 after',
- '1 after',
- '2-1 before',
- 'root before each',
- '2 before each',
- bang + '2 after each',
- bang + 'root after each',
- '2-1 after',
- '2 after',
- 'root after'
- ]
- );
- });
- });
-
- describe('async - before hook error', function() {
- before(run('hooks/before-hook-async-error.fixture.js'));
- it('should verify results', function() {
- assert.deepEqual(
- lines,
- ['before', bang + 'test 3']
- );
- });
- });
-
- describe('async - before hook error tip', function() {
- before(run('hooks/before-hook-async-error-tip.fixture.js', onlyErrorTitle));
- it('should verify results', function() {
- assert.deepEqual(
- lines,
- ['1) spec 2 "before all" hook:']
- );
- });
- });
-
- describe('async - before each hook error', function() {
- before(run('hooks/beforeEach-hook-async-error.fixture.js'));
- it('should verify results', function() {
- assert.deepEqual(
- lines,
- ['before', bang + 'test 3']
- );
- });
- });
-
- describe('async - after hook error', function() {
- before(run('hooks/after-hook-async-error.fixture.js'));
- it('should verify results', function() {
- assert.deepEqual(
- lines,
- ['test 1', 'test 2', 'after', bang + 'test 3']
- );
- });
- });
-
- describe('async - after each hook error', function() {
- before(run('hooks/afterEach-hook-async-error.fixture.js'));
- it('should verify results', function() {
- assert.deepEqual(
- lines,
- ['test 1', 'after', bang + 'test 3']
- );
- });
- });
-
- describe('async - multiple hook errors', function() {
- before(run('hooks/multiple-hook-async-error.fixture.js'));
- it('should verify results', function() {
- assert.deepEqual(
- lines,
- [
- 'root before',
- '1-1 before',
- 'root before each',
- '1 before each',
- '1-1 before each',
- bang + '1-1 after each',
- '1 after each',
- 'root after each',
- '1-1 after',
- bang + '1-2 before',
- 'root before each',
- '1 before each',
- '1-2 before each',
- '1-2 test 1',
- '1-2 after each',
- bang + '1 after each',
- 'root after each',
- '1-2 after',
- '1 after',
- '2-1 before',
- 'root before each',
- '2 before each',
- bang + '2 after each',
- bang + 'root after each',
- '2-1 after',
- '2 after',
- 'root after'
- ]
- );
- });
- });
-
- function run(fnPath, outputFilter) {
- return function(done) {
- runMocha(fnPath, [], function(err, res) {
- assert.ifError(err);
-
- lines = res.output
- .split(splitRegExp)
- .map(function(line) {
- return line.trim();
- })
- .filter(outputFilter || onlyConsoleOutput());
-
- done();
- });
- };
- }
-});
-
-function onlyConsoleOutput() {
- var foundSummary = false;
- return function(line) {
- if (!foundSummary) {
- foundSummary = !!(/\(\d+ms\)/).exec(line);
- }
- return !foundSummary && line.length > 0;
- };
-}
-
-function onlyErrorTitle(line) {
- return !!(/^1\)/).exec(line);
-}
diff --git a/tests/lib/mocha-3.1.0/test/integration/hooks.spec.js b/tests/lib/mocha-3.1.0/test/integration/hooks.spec.js
deleted file mode 100644
index 7633cb5630..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/hooks.spec.js
+++ /dev/null
@@ -1,43 +0,0 @@
-var assert = require('assert');
-var run = require('./helpers').runMocha;
-var splitRegExp = require('./helpers').splitRegExp;
-var args = [];
-
-describe('hooks', function() {
- it('are ran in correct order', function(done) {
- run('cascade.fixture.js', args, function(err, res) {
- var lines, expected;
-
- assert(!err);
-
- lines = res.output.split(splitRegExp).map(function(line) {
- return line.trim();
- }).filter(function(line) {
- return line.length;
- }).slice(0, -1);
-
- expected = [
- 'before one',
- 'before two',
- 'before three',
- 'before each one',
- 'before each two',
- 'before each three',
- 'TEST three',
- 'after each three',
- 'after each two',
- 'after each one',
- 'after three',
- 'after two',
- 'after one'
- ];
-
- expected.forEach(function(line, i) {
- assert.equal(lines[i], line);
- });
-
- assert.equal(res.code, 0);
- done();
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/multiple-done.spec.js b/tests/lib/mocha-3.1.0/test/integration/multiple-done.spec.js
deleted file mode 100644
index 47e82dbebb..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/multiple-done.spec.js
+++ /dev/null
@@ -1,96 +0,0 @@
-var assert = require('assert');
-var run = require('./helpers').runMochaJSON;
-var args = [];
-
-describe('multiple calls to done()', function() {
- var res;
- describe('from a spec', function() {
- before(function(done) {
- run('multiple-done.fixture.js', args, function(err, result) {
- res = result;
- done(err);
- });
- });
-
- it('results in failures', function() {
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 1);
- assert.equal(res.stats.failures, 1);
- assert.equal(res.code, 1);
- });
-
- it('throws a descriptive error', function() {
- assert.equal(res.failures[0].err.message,
- 'done() called multiple times');
- });
- });
-
- describe('with multiple specs', function() {
- before(function(done) {
- run('multiple-done-specs.fixture.js', args, function(err, result) {
- res = result;
- done(err);
- });
- });
-
- it('results in a failure', function() {
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 2);
- assert.equal(res.stats.failures, 1);
- assert.equal(res.code, 1);
- });
-
- it('correctly attributes the error', function() {
- assert.equal(res.failures[0].fullTitle, 'suite test1');
- assert.equal(res.failures[0].err.message,
- 'done() called multiple times');
- });
- });
-
- describe('from a before hook', function() {
- before(function(done) {
- run('multiple-done-before.fixture.js', args, function(err, result) {
- res = result;
- done(err);
- });
- });
-
- it('results in a failure', function() {
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 1);
- assert.equal(res.stats.failures, 1);
- assert.equal(res.code, 1);
- });
-
- it('correctly attributes the error', function() {
- assert.equal(res.failures[0].fullTitle, 'suite "before all" hook');
- assert.equal(res.failures[0].err.message,
- 'done() called multiple times');
- });
- });
-
- describe('from a beforeEach hook', function() {
- before(function(done) {
- run('multiple-done-beforeEach.fixture.js', args, function(err, result) {
- res = result;
- done(err);
- });
- });
-
- it('results in a failure', function() {
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 2);
- assert.equal(res.stats.failures, 2);
- assert.equal(res.code, 2);
- });
-
- it('correctly attributes the errors', function() {
- assert.equal(res.failures.length, 2);
- res.failures.forEach(function(failure) {
- assert.equal(failure.fullTitle, 'suite "before each" hook');
- assert.equal(failure.err.message,
- 'done() called multiple times');
- });
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/only.spec.js b/tests/lib/mocha-3.1.0/test/integration/only.spec.js
deleted file mode 100644
index 61254ce1d3..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/only.spec.js
+++ /dev/null
@@ -1,45 +0,0 @@
-var run = require('./helpers').runMochaJSON;
-var assert = require('assert');
-
-describe('.only()', function() {
- describe('bdd', function() {
- it('should run only tests that marked as `only`', function(done) {
- run('options/only/bdd.fixture.js', ['--ui', 'bdd'], function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 11);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
- });
-
- describe('tdd', function() {
- it('should run only tests that marked as `only`', function(done) {
- run('options/only/tdd.fixture.js', ['--ui', 'tdd'], function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 8);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
- });
-
- describe('qunit', function() {
- it('should run only tests that marked as `only`', function(done) {
- run('options/only/qunit.fixture.js', ['--ui', 'qunit'], function(err, res) {
- console.log(err);
-
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 5);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/options.spec.js b/tests/lib/mocha-3.1.0/test/integration/options.spec.js
deleted file mode 100644
index 4755647f76..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/options.spec.js
+++ /dev/null
@@ -1,182 +0,0 @@
-var assert = require('assert');
-var run = require('./helpers').runMochaJSON;
-var args = [];
-
-describe('options', function() {
- describe('--async-only', function() {
-
- before(function() {
- args = ['--async-only'];
- });
-
- it('should fail synchronous specs', function(done) {
- run('options/async-only-sync.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 0);
- assert.equal(res.stats.failures, 1);
-
- assert.equal(res.failures[0].title, 'throws an error');
- assert.equal(res.code, 1);
- done();
- });
- });
-
- it('should allow asynchronous specs', function(done) {
- run('options/async-only-async.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 1);
- assert.equal(res.stats.failures, 0);
-
- assert.equal(res.passes[0].title, 'should pass');
- assert.equal(res.code, 0);
- done();
- });
- });
- });
-
- describe('--bail', function() {
- before(function() {
- args = ['--bail'];
- });
-
- it('should stop after the first error', function(done) {
- run('options/bail.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 1);
- assert.equal(res.stats.failures, 1);
-
- assert.equal(res.passes[0].title, 'should display this spec');
- assert.equal(res.failures[0].title, 'should only display this error');
- assert.equal(res.code, 1);
- done();
- });
- });
- });
-
- describe('--sort', function() {
- before(function() {
- args = ['--sort'];
- });
-
- it('should sort tests in alphabetical order', function(done) {
- run('options/sort*', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 2);
- assert.equal(res.stats.failures, 0);
-
- assert.equal(res.passes[0].fullTitle,
- 'alpha should be executed first');
- assert.equal(res.code, 0);
- done();
- });
- });
- });
-
- describe('--delay', function() {
- before(function() {
- args = ['--delay'];
- });
-
- it('should run the generated test suite', function(done) {
- run('options/delay.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 1);
- assert.equal(res.stats.failures, 0);
-
- assert.equal(res.passes[0].title,
- 'should have no effect if attempted twice in the same suite');
- assert.equal(res.code, 0);
- done();
- });
- });
-
- it('should throw an error if the test suite failed to run', function(done) {
- run('options/delay-fail.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 0);
- assert.equal(res.stats.failures, 1);
-
- assert.equal(res.failures[0].title,
- 'Uncaught error outside test suite');
- assert.equal(res.code, 1);
- done();
- });
- });
- });
-
- describe('--grep', function() {
- it('runs specs matching a string', function(done) {
- args = ['--grep', 'match'];
- run('options/grep.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 2);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
-
- describe('runs specs matching a RegExp', function() {
- it('with RegExp like strings(pattern follow by flag)', function(done) {
- args = ['--grep', '/match/i'];
- run('options/grep.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 4);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
-
- it('string as pattern', function(done) {
- args = ['--grep', '.*'];
- run('options/grep.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 4);
- assert.equal(res.stats.failures, 1);
- assert.equal(res.code, 1);
- done();
- });
- });
- });
-
- describe('with --invert', function() {
- it('runs specs that do not match the pattern', function(done) {
- args = ['--grep', 'fail', '--invert'];
- run('options/grep.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 4);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
- });
- });
-
- describe('--retries', function() {
- it('retries after a certain threshold', function (done) {
- args = ['--retries', '3'];
- run('options/retries.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 0);
- assert.equal(res.stats.tests, 1);
- assert.equal(res.tests[0].currentRetry, 3);
- assert.equal(res.stats.failures, 1);
- assert.equal(res.code, 1);
- done();
- });
- })
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/pending.spec.js b/tests/lib/mocha-3.1.0/test/integration/pending.spec.js
deleted file mode 100644
index 4d4beffc2a..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/pending.spec.js
+++ /dev/null
@@ -1,100 +0,0 @@
-var assert = require('assert');
-var run = require('./helpers').runMochaJSON;
-var args = [];
-
-describe('pending', function() {
- describe('pending specs', function() {
- it('should be created by omitting a function', function(done) {
- run('pending/spec.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 1);
- assert.equal(res.stats.passes, 0);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
- });
-
- describe('synchronous skip()', function() {
- describe('in spec', function() {
- it('should immediately skip the spec and run all others', function(done) {
- run('pending/skip-sync-spec.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 1);
- assert.equal(res.stats.passes, 1);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
- });
-
- describe('in before', function() {
- it('should skip all suite specs', function(done) {
- run('pending/skip-sync-before.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 2);
- assert.equal(res.stats.passes, 0);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
- });
-
- describe('in beforeEach', function() {
- it('should skip all suite specs', function(done) {
- run('pending/skip-sync-beforeEach.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 2);
- assert.equal(res.stats.passes, 0);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
- });
- });
-
- describe('asynchronous skip()', function() {
- describe('in spec', function() {
- it('should immediately skip the spec and run all others', function(done) {
- run('pending/skip-async-spec.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 1);
- assert.equal(res.stats.passes, 1);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
- });
-
- describe('in before', function() {
- it('should skip all suite specs', function(done) {
- run('pending/skip-async-before.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 2);
- assert.equal(res.stats.passes, 0);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
- });
-
- describe('in beforeEach', function() {
- it('should skip all suite specs', function(done) {
- run('pending/skip-sync-beforeEach.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 2);
- assert.equal(res.stats.passes, 0);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/regression.spec.js b/tests/lib/mocha-3.1.0/test/integration/regression.spec.js
deleted file mode 100644
index f2a435a34c..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/regression.spec.js
+++ /dev/null
@@ -1,97 +0,0 @@
-var assert = require('assert');
-var fs = require('fs');
-var path = require('path');
-var run = require('./helpers').runMocha;
-var runJSON = require('./helpers').runMochaJSON;
-
-describe('regressions', function() {
- it('issue-1327: should run all 3 specs exactly once', function(done) {
- var args = [];
- run('regression/issue-1327.fixture.js', args, function(err, res) {
- var occurences = function(str) {
- var pattern = new RegExp(str, 'g');
- return (res.output.match(pattern) || []).length;
- };
-
- assert(!err);
- assert.equal(occurences('testbody1'), 1);
- assert.equal(occurences('testbody2'), 1);
- assert.equal(occurences('testbody3'), 1);
-
- assert.equal(res.code, 1);
- done();
- });
- });
-
- it('should not duplicate mocha.opts args in process.argv', function() {
- var processArgv = process.argv.join('');
- var mochaOpts = fs.readFileSync(path.join(__dirname, '..', 'mocha.opts'), 'utf-8').split(/[\s]+/).join('');
- assert.notEqual(processArgv.indexOf(mochaOpts), -1, 'process.argv missing mocha.opts');
- assert.equal(processArgv.indexOf(mochaOpts), processArgv.lastIndexOf(mochaOpts), 'process.argv contains duplicated mocha.opts');
- });
-
- it('issue-1794: Can\'t --require custom UI and use it', function(done) {
- var simpleUiPath = path.join(__dirname, 'fixtures', 'regression', '1794', 'simple-ui.js');
- var args = ['--require', simpleUiPath, '--ui', 'simple-ui'];
- run('regression/1794/issue-1794.fixture.js', args, function(err, res) {
- assert.equal(res.code, 0, 'Custom UI should be loaded');
- done();
- });
- });
-
- it('issue-1991: Declarations do not get cleaned up unless you set them to `null` - Memory Leak', function(done) {
- // on a modern MBP takes ±5 seconds on node 4.0, but on older laptops with node 0.12 ±40 seconds.
- // Could easily take longer on even weaker machines (Travis-CI containers for example).
- this.timeout(120000);
- run('regression/issue-1991.fixture.js', [], function(err, res) {
- assert.equal(/process out of memory/.test(res.output), false, 'fixture\'s process out of memory!');
- assert.equal(res.code, 0, 'Runnable fn (it/before[Each]/after[Each]) references should be deleted to avoid memory leaks');
- done();
- });
- })
-
- describe('issue-2286: after doesn\'t execute if test was skipped in beforeEach', function () {
- var afterWasRun = false;
- describe('suite with skipped test for meta test', function () {
- beforeEach(function () { this.skip(); });
- after(function () { afterWasRun = true; });
- it('should be pending', function () {});
- })
- after('meta test', function () {
- afterWasRun.should.be.ok();
- });
- });
-
- it('issue-2315: cannot read property currentRetry of undefined', function (done) {
- runJSON('regression/issue-2315.js', [], function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 0);
- assert.equal(res.stats.failures, 1);
- assert.equal(res.code, 1);
- done();
- });
- });
-
- it('issue-2406: should run nested describe.only suites', function(done) {
- this.timeout(2000);
- runJSON('regression/issue-2406.fixture.js', [], function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 2);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- done();
- });
- });
-
- it('issue-2417: should not recurse infinitely with .only suites nested within each other', function() {
- runJSON('regression/issue-2417.fixture.js', [], function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 1);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.code, 0);
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/reporters.spec.js b/tests/lib/mocha-3.1.0/test/integration/reporters.spec.js
deleted file mode 100644
index 9595611829..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/reporters.spec.js
+++ /dev/null
@@ -1,61 +0,0 @@
-var assert = require('assert');
-var os = require('os');
-var fs = require('fs');
-var crypto = require('crypto');
-var path = require('path');
-var run = require('./helpers').runMocha;
-
-describe('reporters', function() {
- describe('markdown', function() {
- var res;
-
- before(function(done) {
- run('passing.fixture.js', ['--reporter', 'markdown'], function(err, result) {
- res = result;
- done(err);
- });
- });
-
- it('does not exceed maximum callstack (issue: 1875)', function() {
- assert(res.output.indexOf('RangeError') === -1, 'Threw RangeError');
- });
-
- it('contains spec src', function() {
- var src = [
- '```js',
- 'assert(true);',
- '```'
- ].join('\n');
-
- assert(res.output.indexOf(src) !== -1, 'No assert found');
- });
- });
-
- describe('xunit', function() {
- it('prints test cases with --reporter-options output (issue: 1864)', function(done) {
- var randomStr = crypto.randomBytes(8).toString('hex');
- var tmpDir = os.tmpDir().replace(new RegExp(path.sep + '$'), '');
- var tmpFile = tmpDir + path.sep + 'test-issue-1864-' + randomStr + '.xml';
-
- var args = ['--reporter=xunit', '--reporter-options', 'output=' + tmpFile];
- var expectedOutput = [
- '<testcase classname="suite" name="test1" time="',
- '<testcase classname="suite" name="test2" time="',
- '</testsuite>'
- ];
-
- run('passing.fixture.js', args, function(err, result) {
- if (err) return done(err);
-
- var xml = fs.readFileSync(tmpFile, 'utf8');
- fs.unlinkSync(tmpFile);
-
- expectedOutput.forEach(function(line) {
- assert(xml.indexOf(line) !== -1, 'XML did not contain ' + line);
- });
-
- done(err);
- });
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/retries.spec.js b/tests/lib/mocha-3.1.0/test/integration/retries.spec.js
deleted file mode 100644
index ce76545b00..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/retries.spec.js
+++ /dev/null
@@ -1,106 +0,0 @@
-var assert = require('assert');
-var helpers = require('./helpers');
-var args = [];
-var bang = require('../../lib/reporters/base').symbols.bang;
-
-describe('retries', function() {
- it('are ran in correct order', function(done) {
- helpers.runMocha('retries/hooks.fixture.js', args, function(err, res) {
- var lines, expected;
-
- assert(!err);
-
- lines = res.output.split(helpers.splitRegExp).map(function(line) {
- return line.trim();
- }).filter(function(line) {
- return line.length;
- }).slice(0, -1);
-
- expected = [
- 'before',
- 'before each 0',
- 'TEST 0',
- 'after each 1',
- 'before each 1',
- 'TEST 1',
- 'after each 2',
- 'before each 2',
- 'TEST 2',
- 'after each 3',
- 'before each 3',
- 'TEST 3',
- 'after each 4',
- 'before each 4',
- 'TEST 4',
- bang + 'after each 5',
- 'after'
- ];
-
- expected.forEach(function(line, i) {
- assert.equal(lines[i], line);
- });
-
- assert.equal(res.code, 1);
- done();
- });
- });
-
- it('should exit early if test passes', function (done) {
- helpers.runMochaJSON('retries/early-pass.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.passes, 1);
- assert.equal(res.stats.failures, 0);
- assert.equal(res.tests[0].currentRetry, 1);
- assert.equal(res.stats.tests, 1);
- assert.equal(res.code, 0);
- done();
- });
- });
-
- it('should let test override', function (done) {
- helpers.runMochaJSON('retries/nested.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.passes, 0);
- assert.equal(res.stats.failures, 1);
- assert.equal(res.stats.tests, 1);
- assert.equal(res.tests[0].currentRetry, 1);
- assert.equal(res.code, 1);
- done();
- });
- });
-
- it('should not hang w/ async test', function (done) {
- helpers.runMocha('retries/async.fixture.js', args, function(err, res) {
- var lines, expected;
-
- assert(!err);
-
- lines = res.output.split(helpers.splitRegExp).map(function(line) {
- return line.trim();
- }).filter(function(line) {
- return line.length;
- }).slice(0, -1);
-
- expected = [
- 'before',
- 'before each 0',
- 'TEST 0',
- 'after each 1',
- 'before each 1',
- 'TEST 1',
- 'after each 2',
- 'before each 2',
- 'TEST 2',
- 'after each 3',
- 'after'
- ];
-
- expected.forEach(function(line, i) {
- assert.equal(lines[i], line);
- });
-
- assert.equal(res.code, 0);
- done();
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/suite.spec.js b/tests/lib/mocha-3.1.0/test/integration/suite.spec.js
deleted file mode 100644
index 00066a34f4..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/suite.spec.js
+++ /dev/null
@@ -1,42 +0,0 @@
-var assert = require('assert');
-var run = require('./helpers').runMocha;
-var args = [];
-
-describe('suite w/no callback', function() {
- this.timeout(1000);
- it('should throw a helpful error message when a callback for suite is not supplied', function(done) {
- run('suite/suite-no-callback.fixture.js', args, function(err, res) {
- assert(!err);
- var result = res.output.match(/no callback was supplied/) || [];
- assert.equal(result.length, 1);
- done();
- });
- });
-});
-
-describe('skipped suite w/no callback', function() {
- this.timeout(1000);
- it('should not throw an error when a callback for skipped suite is not supplied', function(done) {
- run('suite/suite-skipped-no-callback.fixture.js', args, function(err, res) {
- assert(!err);
- pattern = new RegExp("Error", 'g');
- var result = res.output.match(pattern) || [];
- assert.equal(result.length, 0);
- done();
- });
- });
-});
-
-
-describe('skipped suite w/ callback', function() {
- this.timeout(1000);
- it('should not throw an error when a callback for skipped suite is supplied', function(done) {
- run('suite/suite-skipped-callback.fixture.js', args, function(err, res) {
- assert(!err);
- pattern = new RegExp("Error", 'g');
- var result = res.output.match(pattern) || [];
- assert.equal(result.length, 0);
- done();
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/timeout.spec.js b/tests/lib/mocha-3.1.0/test/integration/timeout.spec.js
deleted file mode 100644
index 33b8e33093..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/timeout.spec.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var assert = require('assert');
-var run = require('./helpers').runMochaJSON;
-var args = [];
-
-describe('this.timeout()', function() {
- it('is respected by sync and async suites', function(done) {
- run('timeout.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 0);
- assert.equal(res.stats.failures, 2);
- assert.equal(res.code, 2);
- done();
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/integration/uncaught.spec.js b/tests/lib/mocha-3.1.0/test/integration/uncaught.spec.js
deleted file mode 100644
index 87dde90902..0000000000
--- a/tests/lib/mocha-3.1.0/test/integration/uncaught.spec.js
+++ /dev/null
@@ -1,35 +0,0 @@
-var assert = require('assert');
-var run = require('./helpers').runMochaJSON;
-var args = [];
-
-describe('uncaught exceptions', function() {
- it('handles uncaught exceptions from hooks', function(done) {
- run('uncaught-hook.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 0);
- assert.equal(res.stats.failures, 1);
-
- assert.equal(res.failures[0].fullTitle,
- 'uncaught "before each" hook');
- assert.equal(res.code, 1);
- done();
- });
- });
-
- it('handles uncaught exceptions from async specs', function(done) {
- run('uncaught.fixture.js', args, function(err, res) {
- assert(!err);
- assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 0);
- assert.equal(res.stats.failures, 2);
-
- assert.equal(res.failures[0].title,
- 'fails exactly once when a global error is thrown first');
- assert.equal(res.failures[1].title,
- 'fails exactly once when a global error is thrown second');
- assert.equal(res.code, 2);
- done();
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/jsapi/index.js b/tests/lib/mocha-3.1.0/test/jsapi/index.js
deleted file mode 100644
index a096186b96..0000000000
--- a/tests/lib/mocha-3.1.0/test/jsapi/index.js
+++ /dev/null
@@ -1,29 +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.spec.js');
-mocha.addFile('test/runner.spec.js');
-mocha.addFile('test/runnable.spec.js');
-mocha.addFile('test/hook-sync.spec.js');
-mocha.addFile('test/hook-sync-nested.spec.js');
-mocha.addFile('test/hook-async.spec.js');
-mocha.addFile('test/acceptance/duration.spec.js');
-mocha.addFile('test/acceptance/fs.spec.js');
-mocha.addFile('test/acceptance/globals.spec.js');
-mocha.addFile('test/acceptance/timeout.spec.js');
-
-mocha.run(function(){
- console.log('done');
-}).on('pass', function(test){
- // console.log('... %s', test.title);
-});
diff --git a/tests/lib/mocha-3.1.0/test/mocha.opts b/tests/lib/mocha-3.1.0/test/mocha.opts
deleted file mode 100644
index cd797e2ae0..0000000000
--- a/tests/lib/mocha-3.1.0/test/mocha.opts
+++ /dev/null
@@ -1,8 +0,0 @@
---require should
---require ./test/fixture-expect.js
---reporter dot
---ui bdd
---globals okGlobalA,okGlobalB
---globals okGlobalC
---globals callback*
---timeout 200
diff --git a/tests/lib/mocha-3.1.0/test/mocha.spec.js b/tests/lib/mocha-3.1.0/test/mocha.spec.js
deleted file mode 100644
index 46411fc18b..0000000000
--- a/tests/lib/mocha-3.1.0/test/mocha.spec.js
+++ /dev/null
@@ -1,33 +0,0 @@
-var Mocha = require('../');
-var Test = Mocha.Test;
-
-describe('Mocha', function(){
- var blankOpts = { reporter: function(){} }; // no output
-
- describe('.run(fn)', function(){
- it('should not raise errors if callback was not provided', function(){
- var mocha = new Mocha(blankOpts);
- mocha.run();
- })
-
- it('should execute the callback when complete', function(done) {
- var mocha = new Mocha(blankOpts);
- mocha.run(function(){
- done();
- })
- })
-
- it('should execute the callback with the number of failures '+
- 'as parameter', function(done) {
- var mocha = new Mocha(blankOpts);
- var failingTest = new Test('failing test', function(){
- throw new Error('such fail');
- });
- mocha.suite.addTest(failingTest);
- mocha.run(function(failures) {
- failures.should.equal(1);
- done();
- });
- })
- })
-})
diff --git a/tests/lib/mocha-3.1.0/test/ms.spec.js b/tests/lib/mocha-3.1.0/test/ms.spec.js
deleted file mode 100644
index 1fd9740a62..0000000000
--- a/tests/lib/mocha-3.1.0/test/ms.spec.js
+++ /dev/null
@@ -1,82 +0,0 @@
-'use strict';
-var ms = require('../lib/ms');
-
-describe('.ms()', function() {
- // Helpers
- var time = {
- minutes: function(n) { return n * 60 * 1000; },
- hours: function (n) { return n * this.minutes(60); },
- days: function(n) { return n * this.hours(24); },
- years: function(n) { return n * this.days(365.25); }
- };
- describe('get a value that less than 1 second', function() {
- it('should return milliseconds representation', function() {
- ms(200).should.equal('200ms');
- ms(30).should.equal('30ms');
- ms(2000).should.not.equal('2000ms');
- });
- });
-
- describe('seconds representation', function() {
- it('should return short format', function() {
- ms(2000).should.equal('2s');
- });
-
- it('should return long format', function() {
- ms(2000, { long: true }).should.equal('2 seconds');
- ms(1000, { long: true }).should.equal('1 second');
- ms(1010, { long: true }).should.equal('1 second');
- });
- });
-
- describe('minutess representation', function() {
- it('should return short format', function() {
- ms(time.minutes(1)).should.equal('1m');
- });
-
- it('should return long format', function() {
- ms(time.minutes(1), { long: true }).should.equal('1 minute');
- ms(time.minutes(3), { long: true }).should.equal('3 minutes');
- });
- });
-
- describe('hours representation', function() {
- it('should return short format', function() {
- ms(time.hours(1)).should.equal('1h');
- });
-
- it('should return long format', function() {
- ms(time.hours(1), { long: true }).should.equal('1 hour');
- ms(time.hours(3), { long: true }).should.equal('3 hours');
- });
- });
-
- describe('days representation', function() {
- it('should return short format', function() {
- ms(time.days(1)).should.equal('1d');
- });
-
- it('should return long format', function() {
- ms(time.days(1), { long: true }).should.equal('1 day');
- ms(time.days(3), { long: true }).should.equal('3 days');
- });
- });
-
- describe('Getting string value', function() {
- it('should return the milliseconds representation(Number)', function() {
- ms('1 second').should.equal(1000);
-
- ms('1 minute').should.equal(time.minutes(1));
- ms('6 minutes').should.equal(time.minutes(6));
-
- ms('1 hour').should.equal(time.hours(1));
- ms('5 hours').should.equal(time.hours(5));
-
- ms('1 day').should.equal(time.days(1));
- ms('3 days').should.equal(time.days(3));
-
- ms('1 year').should.equal(time.years(1));
- ms('2 years').should.equal(time.years(2));
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/reporters/base.spec.js b/tests/lib/mocha-3.1.0/test/reporters/base.spec.js
deleted file mode 100644
index bbd0d3a9a7..0000000000
--- a/tests/lib/mocha-3.1.0/test/reporters/base.spec.js
+++ /dev/null
@@ -1,214 +0,0 @@
-var assert = require('assert');
-
-var Base = require('../../lib/reporters/base')
- , Assert = require('assert').AssertionError;
-
-function makeTest(err) {
- return {
- err: err,
- fullTitle: function () {
- return 'test title';
- }
- };
-}
-
-describe('Base reporter', function () {
- var stdout
- , stdoutWrite
- , useColors;
-
- beforeEach(function () {
- stdout = [];
- stdoutWrite = process.stdout.write;
- process.stdout.write = function (string) {
- stdout.push(string);
- };
- useColors = Base.useColors;
- Base.useColors = false;
- });
-
- afterEach(function () {
- process.stdout.write = stdoutWrite;
- Base.useColors = useColors;
- });
-
- describe('showDiff', function() {
- it('should show diffs by default', function () {
- var err = new Assert({ actual: 'foo', expected: 'bar' })
- , errOut;
-
- var test = makeTest(err);
-
- Base.list([test]);
-
- errOut = stdout.join('\n');
- errOut.should.match(/\- actual/);
- errOut.should.match(/\+ expected/);
- });
-
- it('should show diffs if property set to `true`', function () {
- var err = new Assert({ actual: 'foo', expected: 'bar' })
- , errOut;
-
- err.showDiff = true;
- var test = makeTest(err);
-
-
- Base.list([test]);
-
- errOut = stdout.join('\n');
- errOut.should.match(/\- actual/);
- errOut.should.match(/\+ expected/);
- });
-
- it('should not show diffs when showDiff property set to `false`', function () {
- var err = new Assert({ actual: 'foo', expected: 'bar' })
- , errOut;
-
- err.showDiff = false;
- var test = makeTest(err);
-
- Base.list([test]);
-
- errOut = stdout.join('\n');
- errOut.should.not.match(/\- actual/);
- errOut.should.not.match(/\+ expected/);
- });
-
- it('should not show diffs when expected is not defined', function () {
- var err = new Error('ouch')
- , errOut;
-
- var test = makeTest(err);
-
- Base.list([test]);
-
- errOut = stdout.join('\n');
- errOut.should.not.match(/\- actual/);
- errOut.should.not.match(/\+ expected/);
- });
-
- });
-
- describe('Getting two strings', function() {
- // Fix regression V1.2.1(see: issue #1241)
- it('should show strings diff as is', function () {
- var err = new Error('test'),
- errOut;
-
- err.actual = 'foo\nbar';
- err.expected = 'foo\nbaz';
- err.showDiff = true;
- var test = makeTest(err);
-
- Base.list([test]);
-
- errOut = stdout.join('\n');
-
- errOut.should.not.match(/"foo\\nbar"/);
- errOut.should.match(/foo/).and.match(/bar/);
- errOut.should.match(/test/);
- errOut.should.match(/actual/);
- errOut.should.match(/expected/);
- });
- });
-
- it('should stringify objects', function () {
- var err = new Error('test'),
- errOut;
-
- err.actual = {key:"a1"};
- err.expected = {key:"e1"};
- err.showDiff = true;
- var test = makeTest(err);
-
- Base.list([test]);
-
- errOut = stdout.join('\n');
- errOut.should.match(/"key"/);
- errOut.should.match(/test/);
- errOut.should.match(/\- actual/);
- errOut.should.match(/\+ expected/);
- });
-
- it('should stringify Object.create(null)', function () {
- var err = new Error('test'),
- errOut;
-
- err.actual = Object.create(null);
- err.actual.hasOwnProperty = 1;
- err.expected = Object.create(null);
- err.expected.hasOwnProperty = 2;
- err.showDiff = true;
- var test = makeTest(err);
-
- Base.list([test]);
-
- errOut = stdout.join('\n');
- errOut.should.match(/"hasOwnProperty"/);
- errOut.should.match(/test/);
- errOut.should.match(/\- actual/);
- errOut.should.match(/\+ expected/);
- });
-
- it('should handle error messages that are not strings', function () {
- var errOut;
-
- try {
- assert(false, true);
- } catch (err) {
- err.actual = false;
- err.expected = true;
- err.showDiff = true;
- var test = makeTest(err);
-
- Base.list([test]);
-
- errOut = stdout.join('\n');
- errOut.should.match(/\+true/);
- errOut.should.match(/\-false/);
- errOut.should.match(/\- actual/);
- errOut.should.match(/\+ expected/);
- }
- });
-
- it('should remove message from stack', function () {
- var err = {
- message: 'Error',
- stack: 'Error\nfoo\nbar',
- showDiff: false
- };
- var test = makeTest(err);
-
- Base.list([test]);
-
- var errOut = stdout.join('\n').trim();
- errOut.should.equal('1) test title:\n Error\n foo\n bar');
- });
-
- it('should use the inspect() property if `message` is not set', function () {
- var err = {
- showDiff: false,
- inspect: function() { return 'an error happened'; },
- };
- var test = makeTest(err);
- Base.list([test]);
- var errOut = stdout.join('\n').trim();
- errOut.should.equal('1) test title:\n an error happened');
- });
-
- it('should not modify stack if it does not contain message', function () {
- var err = {
- message: 'Error',
- stack: 'foo\nbar',
- showDiff: false
- };
- var test = makeTest(err);
-
- Base.list([test]);
-
- var errOut = stdout.join('\n').trim();
- errOut.should.equal('1) test title:\n Error\n foo\n bar');
- });
-
-});
diff --git a/tests/lib/mocha-3.1.0/test/reporters/json.spec.js b/tests/lib/mocha-3.1.0/test/reporters/json.spec.js
deleted file mode 100644
index e7b8955757..0000000000
--- a/tests/lib/mocha-3.1.0/test/reporters/json.spec.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-3.1.0/test/reporters/nyan.spec.js b/tests/lib/mocha-3.1.0/test/reporters/nyan.spec.js
deleted file mode 100644
index 37c9b7c372..0000000000
--- a/tests/lib/mocha-3.1.0/test/reporters/nyan.spec.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 "pending" 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-3.1.0/test/runnable.spec.js b/tests/lib/mocha-3.1.0/test/runnable.spec.js
deleted file mode 100644
index d6b020a6a1..0000000000
--- a/tests/lib/mocha-3.1.0/test/runnable.spec.js
+++ /dev/null
@@ -1,470 +0,0 @@
-var mocha = require('../')
- , utils = mocha.utils
- , 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('#timeout(ms) when ms>2^31', function() {
- it('should set disabled', function() {
- var run = new Runnable();
- run.timeout(1e10);
- run.enableTimeouts().should.be.false;
- });
- });
-
- 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() {
- var run;
-
- beforeEach(function() {
- run = new Runnable();
- });
-
- it('should set the slow threshold', function() {
- run.slow(100);
- run.slow().should.equal(100);
- });
-
- it('should not set the slow threshold if the parameter is not passed', function() {
- run.slow();
- run.slow().should.equal(75);
- });
-
- it('should not set the slow threshold if the parameter is undefined', function() {
- run.slow(undefined);
- run.slow().should.equal(75);
- });
- })
-
- 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('#retries(n)', function(){
- it('should set the number of retries', function(){
- var run = new Runnable;
- run.retries(1);
- run.retries().should.equal(1);
- })
- })
-
- 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 an exception is thrown and is allowed to remain uncaught', function(){
- it('throws an error when it is allowed', function(done) {
- var test = new Runnable('foo', function(){
- throw new Error('fail');
- });
- test.allowUncaught = true;
- function fail() {
- test.run(function(err) {});
- }
- fail.should.throw('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(utils.undefinedError().message);
- done();
- })
- });
- })
-
- describe('when an exception is thrown and is allowed to remain uncaught', function(){
- it('throws an error when it is allowed', function(done) {
- var test = new Runnable('foo', function(done){
- throw new Error('fail');
- process.nextTick(done);
- });
- test.allowUncaught = true;
- function fail() {
- test.run(function(err) {});
- }
- fail.should.throw('fail');
- 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-3.1.0/test/runner.spec.js b/tests/lib/mocha-3.1.0/test/runner.spec.js
deleted file mode 100644
index 5392d0077b..0000000000
--- a/tests/lib/mocha-3.1.0/test/runner.spec.js
+++ /dev/null
@@ -1,420 +0,0 @@
-var mocha = require('../');
-var Suite = mocha.Suite;
-var Runner = mocha.Runner;
-var Test = mocha.Test;
-var Hook = mocha.Hook;
-var path = require('path');
-
-function noop() {}
-
-describe('Runner', function() {
- var suite;
- var runner;
-
- beforeEach(function() {
- suite = new Suite('Suite', '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', noop));
- suite.addTest(new Test('im another test about lions', noop));
- suite.addTest(new Test('im a test about bears', noop));
- 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', noop));
- suite.addTest(new Test('im another test about lions', noop));
- suite.addTest(new Test('im a test about bears', noop));
- 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', noop));
- suite.addTest(new Test('im another test about lions', noop));
- suite.addTest(new Test('im a test about bears', noop));
- 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', noop));
- suite.addTest(new Test('im another test about lions', noop));
- suite.addTest(new Test('im a test about bears', noop));
- 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) {
- var test = new Test('im a test', noop);
- runner.checkGlobals();
- global.foo = 'bar';
- runner.on('fail', function(_test, err) {
- _test.should.equal(test);
- err.message.should.equal('global leak detected: foo');
- delete global.foo;
- done();
- });
- runner.checkGlobals(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() {
- delete global.bad;
- done();
- doneCalled = true;
- });
- runner.checkGlobals(new Test('yet another test', noop));
- 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', noop);
- 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) {
- var test = new Test('im a test', noop);
- runner.checkGlobals();
- global.foo = 'bar';
- global.bar = 'baz';
- runner.on('fail', function(_test, err) {
- _test.should.equal(test);
- err.message.should.equal('global leaks detected: foo, bar');
- delete global.foo;
- delete global.bar;
- done();
- });
- runner.checkGlobals(test);
- });
-
- it('should respect per test whitelisted globals', function() {
- var test = new Test('im a test about lions', noop);
- 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', noop);
- 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);
- });
-
- it('should emit "fail" when a global beginning with d is introduced', function(done) {
- global.derp = 'bar';
- runner.on('fail', function() {
- delete global.derp;
- done();
- });
- runner.checkGlobals(new Test('herp', function() {}));
- });
- });
-
- describe('.hook(name, fn)', function() {
- it('should execute hooks after failed test if suite bail is true', function(done) {
- runner.fail(new Test('failed test', noop));
- 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(new Test('one', noop), {});
- runner.failures.should.equal(1);
- runner.fail(new Test('two', noop), {});
- runner.failures.should.equal(2);
- });
-
- it('should set test.state to "failed"', function() {
- var test = new Test('some test', noop);
- runner.fail(test, 'some error');
- test.state.should.equal('failed');
- });
-
- it('should emit "fail"', function(done) {
- var test = new Test('some other test', noop);
- var err = {};
- runner.on('fail', function(test, err) {
- test.should.equal(test);
- err.should.equal(err);
- done();
- });
- runner.fail(test, err);
- });
-
- it('should emit a helpful message when failed with a string', function(done) {
- var test = new Test('helpful test', noop);
- var err = 'string';
- runner.on('fail', function(test, err) {
- err.message.should.equal('the string "string" was thrown, throw an Error :)');
- done();
- });
- runner.fail(test, err);
- });
-
- it('should emit a the error when failed with an Error instance', function(done) {
- var test = new Test('a test', noop);
- var err = new Error('an error message');
- runner.on('fail', function(test, err) {
- err.message.should.equal('an error message');
- done();
- });
- runner.fail(test, err);
- });
-
- it('should emit the error when failed with an Error-like object', function(done) {
- var test = new Test('a test', noop);
- var err = { message: 'an error message' };
- runner.on('fail', function(test, err) {
- err.message.should.equal('an error message');
- done();
- });
- runner.fail(test, err);
- });
-
- it('should emit a helpful message when failed with an Object', function(done) {
- var test = new Test('a test', noop);
- var err = { x: 1 };
- runner.on('fail', function(test, err) {
- err.message.should.equal('the object {\n "x": 1\n} was thrown, throw an Error :)');
- done();
- });
- runner.fail(test, err);
- });
-
- it('should emit a helpful message when failed with an Array', function(done) {
- var test = new Test('a test', noop);
- var err = [
- 1,
- 2
- ];
- runner.on('fail', function(test, err) {
- err.message.should.equal('the array [\n 1\n 2\n] was thrown, throw an Error :)');
- done();
- });
- runner.fail(test, err);
- });
- });
-
- describe('.failHook(hook, err)', function() {
- it('should increment .failures', function() {
- runner.failures.should.equal(0);
- runner.failHook(new Test('fail hook 1', noop), {});
- runner.failures.should.equal(1);
- runner.failHook(new Test('fail hook 2', noop), {});
- runner.failures.should.equal(2);
- });
-
- it('should augment hook title with current test title', function() {
- var hook = new Hook('"before each" hook');
- hook.ctx = { currentTest: new Test('should behave', noop) };
-
- runner.failHook(hook, {});
- hook.title.should.equal('"before each" hook for "should behave"');
-
- hook.ctx.currentTest = new Test('should obey', noop);
- runner.failHook(hook, {});
- hook.title.should.equal('"before each" hook for "should obey"');
- });
-
- it('should emit "fail"', function(done) {
- var hook = new Hook();
- var 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 = new Hook();
- var 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 = new Hook();
- var err = {};
- suite.bail(false);
- runner.on('end', function() {
- throw new Error('"end" was emit, but the bail is false');
- });
- runner.failHook(hook, err);
- done();
- });
- });
-
- describe('allowUncaught', function() {
- it('should allow unhandled errors to propagate through', function(done) {
- var newRunner = new Runner(suite);
- newRunner.allowUncaught = true;
- newRunner.test = new Test('failing test', function() {
- throw new Error('allow unhandled errors');
- });
- function fail() {
- newRunner.runTest();
- }
- fail.should.throw('allow unhandled errors');
- done();
- });
- });
-
- describe('stackTrace', function() {
- var stack = [
- 'AssertionError: foo bar',
- 'at EventEmitter.<anonymous> (/usr/local/dev/test.js:16:12)',
- 'at Context.<anonymous> (/usr/local/dev/test.js:19:5)',
- 'Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:244:7)',
- 'Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:374:10)',
- '/usr/local/lib/node_modules/mocha/lib/runner.js:452:12',
- 'next (/usr/local/lib/node_modules/mocha/lib/runner.js:299:14)',
- '/usr/local/lib/node_modules/mocha/lib/runner.js:309:7',
- 'next (/usr/local/lib/node_modules/mocha/lib/runner.js:248:23)',
- 'Immediate._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:276:5)',
- 'at processImmediate [as _immediateCallback] (timers.js:321:17)'
- ];
-
- describe('shortStackTrace', function() {
- beforeEach(function() {
- if (path.sep !== '/') {
- this.skip();
- }
- });
-
- it('should prettify the stack-trace', function(done) {
- var hook = new Hook();
- var err = new Error();
- // Fake stack-trace
- err.stack = stack.join('\n');
-
- runner.on('fail', function(hook, err) {
- err.stack.should.equal(stack.slice(0, 3).join('\n'));
- done();
- });
- runner.failHook(hook, err);
- });
- });
-
- describe('longStackTrace', function() {
- beforeEach(function() {
- if (path.sep !== '/') {
- this.skip();
- }
- });
-
- it('should display the full stack-trace', function(done) {
- var hook = new Hook();
- var err = new Error();
- // Fake stack-trace
- err.stack = stack.join('\n');
- // Add --stack-trace option
- runner.fullStackTrace = true;
-
- runner.on('fail', function(hook, err) {
- err.stack.should.equal(stack.join('\n'));
- done();
- });
- runner.failHook(hook, err);
- });
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/sanity/sanity.spec.js b/tests/lib/mocha-3.1.0/test/sanity/sanity.spec.js
deleted file mode 100644
index 59d5896515..0000000000
--- a/tests/lib/mocha-3.1.0/test/sanity/sanity.spec.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-var assert = require('assert');
-
-describe('a production installation of Mocha', function() {
- it('should be able to execute a test', function() {
- assert.ok(true);
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/suite.spec.js b/tests/lib/mocha-3.1.0/test/suite.spec.js
deleted file mode 100644
index 54a1acd667..0000000000
--- a/tests/lib/mocha-3.1.0/test/suite.spec.js
+++ /dev/null
@@ -1,439 +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.match(/^"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.match(/^"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.match(/^"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.match(/^"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);
- });
-
- it('treats suite as pending if its parent is pending', function(){
- this.first.pending = true
- this.second.isPending.should.be.true
- });
- });
-
- // 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);
- });
- });
-
- });
-
- describe('initialization', function() {
- it('should throw an error if the title isn\'t a string', function() {
- (function() {
- new Suite(undefined, 'root');
- }).should.throw();
-
- (function() {
- new Suite(function(){}, 'root');
- }).should.throw();
- });
-
- it('should not throw if the title is a string', function() {
- (function() {
- new Suite('Bdd suite', 'root');
- }).should.not.throw();
- });
- });
-});
-
-describe('Test', function() {
- describe('initialization', function() {
- it('should throw an error if the title isn\'t a string', function() {
- (function() {
- new Test(function(){});
- }).should.throw();
-
- (function() {
- new Test(undefined, function(){});
- }).should.throw();
- });
-
- it('should not throw if the title is a string', function() {
- (function() {
- new Test('test-case', function(){});
- }).should.not.throw();
- });
- });
-}); \ No newline at end of file
diff --git a/tests/lib/mocha-3.1.0/test/test.spec.js b/tests/lib/mocha-3.1.0/test/test.spec.js
deleted file mode 100644
index 5dea7919db..0000000000
--- a/tests/lib/mocha-3.1.0/test/test.spec.js
+++ /dev/null
@@ -1,76 +0,0 @@
-var mocha = require('../')
- , should = require('should')
- , Context = mocha.Context
- , Test = mocha.Test;
-
-describe('Test', function(){
- describe('.clone()', function(){
- beforeEach(function(){
- this._test = new Test('To be cloned', function () {});
- this._test._timeout = 3043;
- this._test._slow = 101;
- this._test._enableTimeouts = true;
- this._test._retries = 3;
- this._test._currentRetry = 1;
- this._test._allowedGlobals = ['foo'];
- this._test.parent = 'foo';
- this._test.file = 'bar';
- });
-
- it('should copy the title', function(){
- this._test.clone().title.should.equal('To be cloned');
- });
-
- it('should copy the timeout value', function(){
- this._test.clone().timeout().should.equal(3043);
- });
-
- it('should copy the slow value', function(){
- this._test.clone().slow().should.equal(101);
- });
-
- it('should copy the enableTimeouts value', function(){
- this._test.clone().enableTimeouts().should.be.true();
- });
-
- it('should copy the retries value', function(){
- this._test.clone().retries().should.equal(3);
- });
-
- it('should copy the currentRetry value', function(){
- this._test.clone().currentRetry().should.equal(1);
- });
-
- it('should copy the globals value', function(){
- this._test.clone().globals().should.not.be.empty();
- });
-
- it('should copy the parent value', function(){
- this._test.clone().parent.should.equal('foo');
- });
-
- it('should copy the file value', function(){
- this._test.clone().file.should.equal('bar');
- });
- });
-
- describe('.isPending()', function(){
- beforeEach(function(){
- this._test = new Test('Is it skipped', function () {});
- });
-
- it('should not be pending by default', function(){
- should(this._test.isPending()).not.be.ok();
- });
-
- it('should be pending when marked as such', function(){
- this._test.pending = true;
- should(this._test.isPending()).be.ok();
- });
-
- it('should be pending when its parent is pending', function(){
- this._test.parent = { isPending: function(){ return true } };
- should(this._test.isPending()).be.ok();
- });
- });
-});
diff --git a/tests/lib/mocha-3.1.0/test/utils.spec.js b/tests/lib/mocha-3.1.0/test/utils.spec.js
deleted file mode 100644
index 4683809ae6..0000000000
--- a/tests/lib/mocha-3.1.0/test/utils.spec.js
+++ /dev/null
@@ -1,259 +0,0 @@
-var mocha = require('..');
-var utils = mocha.utils;
-var path = require('path');
-var JSON = require('json3');
-
-describe('utils', function() {
- describe('.clean()', function() {
- var clean = utils.clean;
- it('should remove the wrapping function declaration', function() {
- clean('function (one, two, three) {\n//code\n}').should.equal('//code');
- });
-
- it('should handle newlines in the function declaration', function() {
- clean('function (one, two, three)\n {\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');
- });
-
- it('should handle functions with tabs in their declarations', function() {
- clean('function\t(\t)\t{\n//code\n}').should.equal('//code');
- });
-
- it('should handle named functions without space after name', function() {
- clean('function withName() {\n//code\n}').should.equal('//code');
- });
-
- it('should handle named functions with space after name', function() {
- clean('function withName () {\n//code\n}').should.equal('//code');
- });
-
- it('should handle functions with no space between the end and the closing brace', function() {
- clean('function() {/*code*/}').should.equal('/*code*/');
- });
-
- it('should handle functions with parentheses in the same line', function() {
- clean('function() { if (true) { /* code */ } }').should.equal('if (true) { /* code */ }');
- });
-
- it('should handle empty functions', function() {
- clean('function() {}').should.equal('');
- });
- });
-
- describe('.isBuffer()', function() {
- var isBuffer = utils.isBuffer;
- it('should test if object is a Buffer', function() {
- isBuffer(new Buffer([0x01])).should.equal(true);
- isBuffer({}).should.equal(false);
- })
- });
-
- describe('.map()', function() {
- var map = utils.map;
- it('should behave same as Array.prototype.map', function() {
- var arr = [1, 2, 3];
- map(arr, JSON.stringify).should.eql(arr.map(JSON.stringify));
- });
-
- it('should call the callback with 3 arguments[currentValue, index, array]', function() {
- var index = 0;
- map([1, 2, 3], function(e, i, arr) {
- e.should.equal(arr[index]);
- i.should.equal(index++);
- })
- });
-
- it('should apply with the given scope', function() {
- var scope = {};
- map(['a', 'b', 'c'], function() {
- this.should.equal(scope);
- }, scope);
- });
- });
-
- describe('.parseQuery()', function() {
- var parseQuery = utils.parseQuery;
- it('should get queryString and return key-value object', function() {
- parseQuery('?foo=1&bar=2&baz=3').should.eql({
- foo: '1',
- bar: '2',
- baz: '3'
- });
-
- parseQuery('?r1=^@(?!.*\\)$)&r2=m{2}&r3=^co.*').should.eql({
- r1: '^@(?!.*\\)$)',
- r2: 'm{2}',
- r3: '^co.*'
- });
- })
- });
-
- describe('.stackTraceFilter()', function() {
- describe('on node', function() {
- var filter = utils.stackTraceFilter();
-
- describe('on POSIX OS', function () {
- before(function () {
- if (path.sep !== '/') {
- this.skip();
- }
- });
-
- it('should get a stack-trace as a string and prettify it', function () {
- var stack = [
- 'AssertionError: foo bar',
- 'at EventEmitter.<anonymous> (/usr/local/dev/test.js:16:12)',
- 'at Context.<anonymous> (/usr/local/dev/test.js:19:5)',
- 'Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:244:7)',
- 'Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:374:10)',
- '/usr/local/lib/node_modules/mocha/lib/runner.js:452:12',
- 'next (/usr/local/lib/node_modules/mocha/lib/runner.js:299:14)',
- '/usr/local/lib/node_modules/mocha/lib/runner.js:309:7',
- 'next (/usr/local/lib/node_modules/mocha/lib/runner.js:248:23)',
- 'Immediate._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:276:5)',
- 'at processImmediate [as _immediateCallback] (timers.js:321:17)'
- ];
- filter(stack.join('\n'))
- .should
- .equal(stack.slice(0, 3)
- .join('\n'));
-
- stack = [
- 'AssertionError: bar baz',
- 'at /usr/local/dev/some-test-file.js:25:8',
- 'at tryCatcher (/usr/local/dev/own/tmp/node_modules/bluebird/js/main/util.js:24:31)',
- 'at Promise._resolveFromResolver (/usr/local/dev/own/tmp/node_modules/bluebird/js/main/promise.js:439:31)',
- 'at new Promise (/usr/local/dev/own/tmp/node_modules/bluebird/js/main/promise.js:53:37)',
- 'at yourFunction (/usr/local/dev/own/tmp/test1.js:24:13)',
- 'at Context.<anonymous> (/usr/local/dev/some-test-file:30:4)',
- 'Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:218:15)',
- 'next (/usr/local/lib/node_modules/mocha/lib/runner.js:248:23)',
- 'Immediate._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:276:5)',
- 'at processImmediate [as _immediateCallback] (timers.js:321:17)'
- ];
-
- filter(stack.join('\n'))
- .should
- .equal(stack.slice(0, 7)
- .join('\n'));
- });
-
- it('does not ignore other bower_components and components',
- function () {
- var stack = [
- 'Error: failed',
- 'at assert (index.html:11:26)',
- 'at Context.<anonymous> (test.js:17:18)',
- 'at bower_components/should/should.js:4827:7',
- 'at next (file:///.../bower_components/should/should.js:4766:23)',
- 'at components/should/5.0.0/should.js:4827:7',
- 'at next (file:///.../components/should/5.0.0/should.js:4766:23)',
- 'at file:///.../bower_components/mocha/mocha.js:4794:5',
- 'at timeslice (.../components/mocha/mocha.js:6218:27)',
- 'at Test.require.register.Runnable.run (file:///.../components/mochajs/mocha/2.1.0/mocha.js:4463:15)',
- 'at Runner.require.register.Runner.runTest (file:///.../components/mochajs/mocha/2.1.0/mocha.js:4892:10)',
- 'at file:///.../components/mochajs/mocha/2.1.0/mocha.js:4970:12',
- 'at next (file:///.../components/mochajs/mocha/2.1.0/mocha.js:4817:14)'
- ];
- filter(stack.join('\n'))
- .should
- .equal(stack.slice(0, 7)
- .join('\n'));
- });
-
- it('should replace absolute with relative paths', function () {
- var stack = [
- 'Error: ' + process.cwd() + '/bla.js has a problem',
- 'at foo (' + process.cwd() + '/foo/index.js:13:226)',
- 'at bar (/usr/local/dev/own/tmp/node_modules/bluebird/js/main/promise.js:11:26)'
- ];
-
- var expected = [
- 'Error: ' + process.cwd() + '/bla.js has a problem',
- 'at foo (foo/index.js:13:226)',
- 'at bar (/usr/local/dev/own/tmp/node_modules/bluebird/js/main/promise.js:11:26)'
- ];
-
- filter(stack.join('\n'))
- .should
- .equal(expected.join('\n'));
- });
- });
-
- describe('on Windows', function() {
- before(function () {
- if (path.sep === '/') {
- this.skip();
- }
- });
-
- it('should work on Windows', function () {
- var stack = [
- 'Error: failed',
- 'at Context.<anonymous> (C:\\Users\\ishida\\src\\test\\test\\mytest.js:5:9)',
- 'at callFn (C:\\Users\\ishida\\src\\test\\node_modules\\mocha\\lib\\runnable.js:326:21)',
- 'at Test.Runnable.run (C:\\Users\\ishida\\src\\test\\node_modules\\mocha\\lib\\runnable.js:319:7)',
- 'at Runner.runTest (C:\\Users\\ishida\\src\\test\\node_modules\\mocha\\lib\\runner.js:422:10)',
- 'at C:\\Users\\ishida\\src\\test\\node_modules\\mocha\\lib\\runner.js:528:12',
- 'at next (C:\\Users\\ishida\\src\\test\\node_modules\\mocha\\lib\\runner.js:342:14)',
- 'at C:\\Users\\ishida\\src\\test\\node_modules\\mocha\\lib\\runner.js:352:7',
- 'at next (C:\\Users\\ishida\\src\\test\\node_modules\\mocha\\lib\\runner.js:284:14)',
- 'at Immediate._onImmediate (C:\\Users\\ishida\\src\\test\\node_modules\\mocha\\lib\\runner.js:320:5)'
- ];
- filter(stack.join('\n'))
- .should
- .equal(stack.slice(0, 2)
- .join('\n'));
- });
- });
- });
-
- describe('on browser', function() {
- var filter;
- before(function() {
- global.document = true;
- global.location = { href: 'localhost:3000/foo/bar/index.html' };
- filter = utils.stackTraceFilter();
- });
- it('does not strip out other bower_components', function() {
- var stack = ['Error: failed'
- , 'at assert (index.html:11:26)'
- , 'at Context.<anonymous> (test.js:17:18)'
- , 'at bower_components/should/should.js:4827:7'
- , 'at next (bower_components/should/should.js:4766:23)'
- , 'at components/should/5.0.0/should.js:4827:7'
- , 'at next (components/should/5.0.0/should.js:4766:23)'
- , 'at Runner.require.register.Runner.runTest (node_modules/mocha.js:4892:10)'
- , 'at localhost:3000/foo/bar/node_modules/mocha.js:4970:12'
- , 'at next (node_modules/mocha.js:4817:14)'];
- filter(stack.join('\n')).should.equal(stack.slice(0,7).join('\n'));
- });
-
- after(function() {
- delete global.document;
- delete global.location;
- });
- });
- });
-
- describe('.isPromise', function() {
- it('should return true if the value is Promise-ish', function() {
- utils.isPromise({then: function() {}}).should.be.true;
- });
-
- it('should return false if the value is not an object', function() {
- utils.isPromise(1).should.be.false;
- });
-
- it('should return false if the value is an object w/o a "then" function', function() {
- utils.isPromise({}).should.be.false;
- });
- });
-});