From c1bd111ea8d27cf6e4a89d703c302c9c36b7bea2 Mon Sep 17 00:00:00 2001 From: Ralic Lo Date: Thu, 24 Oct 2019 21:41:58 +0800 Subject: [PATCH 1/4] Original package-lock.json --- package-lock.json | 5685 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 5685 insertions(+) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..17081bd --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5685 @@ +{ + "name": "grunt-saucelabs", + "version": "9.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "JSV": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz", + "integrity": "sha1-0Hf2glVx+CEy+d/67Vh7QCn+/1c=", + "dev": true + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "accepts": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "dev": true, + "requires": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + } + }, + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "dev": true + }, + "agent-base": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "ajv": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", + "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" + } + }, + "alter": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/alter/-/alter-0.2.0.tgz", + "integrity": "sha1-x1iICGF1cgNKrmJICvJrHU0cs80=", + "dev": true, + "requires": { + "stable": "~0.1.3" + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "ansi": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/ansi/-/ansi-0.3.1.tgz", + "integrity": "sha1-DELU+xcWDVqa8eSEus4cZpIsGyE=", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + }, + "are-we-there-yet": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.0.6.tgz", + "integrity": "sha1-otKMkxAqpsyWJFomy5VN4G7FPww=", + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.0 || ^1.1.13" + } + }, + "argparse": { + "version": "0.1.16", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz", + "integrity": "sha1-z9AeD7uj1srtBJ+9dY1A9lGW9Xw=", + "dev": true, + "requires": { + "underscore": "~1.7.0", + "underscore.string": "~2.4.0" + }, + "dependencies": { + "underscore.string": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz", + "integrity": "sha1-jN2PusTi0uoefi6Al8QvRCKA+Fs=", + "dev": true + } + } + }, + "array-differ": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", + "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", + "dev": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "ast-traverse": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ast-traverse/-/ast-traverse-0.1.1.tgz", + "integrity": "sha1-ac8rg4bxnc2hux4F1o/jWdiJfeY=", + "dev": true + }, + "ast-types": { + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.6.tgz", + "integrity": "sha1-ECyenpAF0+fjgpvwxPok7oYu6bk=", + "dev": true + }, + "async": { + "version": "0.1.22", + "resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz", + "integrity": "sha1-D8GqoIig4+8Ovi2IMbqw3PiEUGE=", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/aws-sign/-/aws-sign-0.3.0.tgz", + "integrity": "sha1-PYHKabR0seFlGHKLUcJP8Lvtxuk=", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "babel-core": { + "version": "5.8.38", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-5.8.38.tgz", + "integrity": "sha1-H8ruedfmG3ULALjlT238nQr4ZVg=", + "dev": true, + "requires": { + "babel-plugin-constant-folding": "^1.0.1", + "babel-plugin-dead-code-elimination": "^1.0.2", + "babel-plugin-eval": "^1.0.1", + "babel-plugin-inline-environment-variables": "^1.0.1", + "babel-plugin-jscript": "^1.0.4", + "babel-plugin-member-expression-literals": "^1.0.1", + "babel-plugin-property-literals": "^1.0.1", + "babel-plugin-proto-to-assign": "^1.0.3", + "babel-plugin-react-constant-elements": "^1.0.3", + "babel-plugin-react-display-name": "^1.0.3", + "babel-plugin-remove-console": "^1.0.1", + "babel-plugin-remove-debugger": "^1.0.1", + "babel-plugin-runtime": "^1.0.7", + "babel-plugin-undeclared-variables-check": "^1.0.2", + "babel-plugin-undefined-to-void": "^1.1.6", + "babylon": "^5.8.38", + "bluebird": "^2.9.33", + "chalk": "^1.0.0", + "convert-source-map": "^1.1.0", + "core-js": "^1.0.0", + "debug": "^2.1.1", + "detect-indent": "^3.0.0", + "esutils": "^2.0.0", + "fs-readdir-recursive": "^0.1.0", + "globals": "^6.4.0", + "home-or-tmp": "^1.0.0", + "is-integer": "^1.0.4", + "js-tokens": "1.0.1", + "json5": "^0.4.0", + "lodash": "^3.10.0", + "minimatch": "^2.0.3", + "output-file-sync": "^1.1.0", + "path-exists": "^1.0.0", + "path-is-absolute": "^1.0.0", + "private": "^0.1.6", + "regenerator": "0.8.40", + "regexpu": "^1.3.0", + "repeating": "^1.1.2", + "resolve": "^1.1.6", + "shebang-regex": "^1.0.0", + "slash": "^1.0.0", + "source-map": "^0.5.0", + "source-map-support": "^0.2.10", + "to-fast-properties": "^1.0.0", + "trim-right": "^1.0.0", + "try-resolve": "^1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + }, + "minimatch": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", + "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", + "dev": true, + "requires": { + "brace-expansion": "^1.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "babel-jscs": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/babel-jscs/-/babel-jscs-2.0.5.tgz", + "integrity": "sha1-CjRwRrSBRay8pW6MjtX3NrxU+dA=", + "dev": true, + "requires": { + "babel-core": "~5.8.3", + "lodash.assign": "^3.2.0" + } + }, + "babel-plugin-constant-folding": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-constant-folding/-/babel-plugin-constant-folding-1.0.1.tgz", + "integrity": "sha1-g2HTZMmORJw2kr26Ue/whEKQqo4=", + "dev": true + }, + "babel-plugin-dead-code-elimination": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/babel-plugin-dead-code-elimination/-/babel-plugin-dead-code-elimination-1.0.2.tgz", + "integrity": "sha1-X3xFEnTc18zNv7s+C4XdKBIfD2U=", + "dev": true + }, + "babel-plugin-eval": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-eval/-/babel-plugin-eval-1.0.1.tgz", + "integrity": "sha1-ovrtJc5r5preS/7CY/cBaRlZUNo=", + "dev": true + }, + "babel-plugin-inline-environment-variables": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-inline-environment-variables/-/babel-plugin-inline-environment-variables-1.0.1.tgz", + "integrity": "sha1-H1jOkSB61qgmqL9kX6/mj/X+P/4=", + "dev": true + }, + "babel-plugin-jscript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/babel-plugin-jscript/-/babel-plugin-jscript-1.0.4.tgz", + "integrity": "sha1-jzQsOCduh6R9X6CovT1etsytj8w=", + "dev": true + }, + "babel-plugin-member-expression-literals": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-member-expression-literals/-/babel-plugin-member-expression-literals-1.0.1.tgz", + "integrity": "sha1-zF7bD6qNyScXDnTW0cAkQAIWJNM=", + "dev": true + }, + "babel-plugin-property-literals": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-property-literals/-/babel-plugin-property-literals-1.0.1.tgz", + "integrity": "sha1-AlIwGQAZKYCxwRjv6kjOk6q4MzY=", + "dev": true + }, + "babel-plugin-proto-to-assign": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/babel-plugin-proto-to-assign/-/babel-plugin-proto-to-assign-1.0.4.tgz", + "integrity": "sha1-xJ56/QL1d7xNoF6i3wAiUM980SM=", + "dev": true, + "requires": { + "lodash": "^3.9.3" + }, + "dependencies": { + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + } + } + }, + "babel-plugin-react-constant-elements": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/babel-plugin-react-constant-elements/-/babel-plugin-react-constant-elements-1.0.3.tgz", + "integrity": "sha1-lGc26DeEKcvDSdz/YvUcFDs041o=", + "dev": true + }, + "babel-plugin-react-display-name": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/babel-plugin-react-display-name/-/babel-plugin-react-display-name-1.0.3.tgz", + "integrity": "sha1-dU/jiSboQkpOexWrbqYTne4FFPw=", + "dev": true + }, + "babel-plugin-remove-console": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-remove-console/-/babel-plugin-remove-console-1.0.1.tgz", + "integrity": "sha1-2PJFVsOgUAXUKqqv0neH9T/wE6c=", + "dev": true + }, + "babel-plugin-remove-debugger": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-remove-debugger/-/babel-plugin-remove-debugger-1.0.1.tgz", + "integrity": "sha1-/S6jzWGkKK0fO5yJiC/0KT6MFMc=", + "dev": true + }, + "babel-plugin-runtime": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/babel-plugin-runtime/-/babel-plugin-runtime-1.0.7.tgz", + "integrity": "sha1-v3x9lm3Vbs1cF/ocslPJrLflSq8=", + "dev": true + }, + "babel-plugin-undeclared-variables-check": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/babel-plugin-undeclared-variables-check/-/babel-plugin-undeclared-variables-check-1.0.2.tgz", + "integrity": "sha1-XPGqU52BP/ZOmWQSkK9iCWX2Xe4=", + "dev": true, + "requires": { + "leven": "^1.0.2" + } + }, + "babel-plugin-undefined-to-void": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/babel-plugin-undefined-to-void/-/babel-plugin-undefined-to-void-1.1.6.tgz", + "integrity": "sha1-f1eO+LeN+uYAM4XYQXph7aBuL4E=", + "dev": true + }, + "babylon": { + "version": "5.8.38", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-5.8.38.tgz", + "integrity": "sha1-7JsSCxG/bM1Bc6GL8hfmC3mFn/0=", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "basic-auth": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + } + } + }, + "batch": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", + "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bluebird": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", + "integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE=", + "dev": true + }, + "boom": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/boom/-/boom-0.4.2.tgz", + "integrity": "sha1-emNune1O/O+xnO9JR6PGffrukRs=", + "dev": true, + "requires": { + "hoek": "0.9.x" + }, + "dependencies": { + "hoek": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz", + "integrity": "sha1-PTIkYrrfB3Fup+uFuviAec3c5QU=", + "dev": true + } + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "breakable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/breakable/-/breakable-1.0.0.tgz", + "integrity": "sha1-eEp5eRWjjq0nutRWtVcstLuqeME=", + "dev": true + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, + "requires": { + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" + } + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "cli": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cli/-/cli-1.0.1.tgz", + "integrity": "sha1-IoF1NPJL+klQw01TLUjsvGIbjBQ=", + "dev": true, + "requires": { + "exit": "0.1.2", + "glob": "^7.1.1" + }, + "dependencies": { + "glob": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz", + "integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "cli-table": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz", + "integrity": "sha1-9TsFJmqLGguTSz0IIebi3FkUriM=", + "dev": true, + "requires": { + "colors": "1.0.3" + }, + "dependencies": { + "colors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", + "dev": true + } + } + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "requires": { + "center-align": "^0.1.1", + "right-align": "^0.1.1", + "wordwrap": "0.0.2" + } + }, + "coffee-script": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.3.3.tgz", + "integrity": "sha1-FQ1rTLUiiUNp7+1qIQHCC8f0pPQ=", + "dev": true + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, + "requires": { + "graceful-readlink": ">= 1.0.0" + } + }, + "comment-parser": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.3.2.tgz", + "integrity": "sha1-PAPwd2uGo239mgosl8YwfzMggv4=", + "dev": true, + "requires": { + "readable-stream": "^2.0.4" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "commoner": { + "version": "0.10.8", + "resolved": "https://registry.npmjs.org/commoner/-/commoner-0.10.8.tgz", + "integrity": "sha1-NPw2cs0kOT6LtH5wyqApOBH08sU=", + "dev": true, + "requires": { + "commander": "^2.5.0", + "detective": "^4.3.1", + "glob": "^5.0.15", + "graceful-fs": "^4.1.2", + "iconv-lite": "^0.4.5", + "mkdirp": "^0.5.0", + "private": "^0.1.6", + "q": "^1.1.2", + "recast": "^0.11.17" + }, + "dependencies": { + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + }, + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "recast": { + "version": "0.11.23", + "resolved": "https://registry.npmjs.org/recast/-/recast-0.11.23.tgz", + "integrity": "sha1-RR/TAEqx5N+bTktmN2sqIZEkYtM=", + "dev": true, + "requires": { + "ast-types": "0.9.6", + "esprima": "~3.1.0", + "private": "~0.1.5", + "source-map": "~0.5.0" + } + } + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "connect": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", + "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", + "dev": true, + "requires": { + "debug": "2.6.9", + "finalhandler": "1.1.2", + "parseurl": "~1.3.3", + "utils-merge": "1.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "connect-livereload": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/connect-livereload/-/connect-livereload-0.5.4.tgz", + "integrity": "sha1-gBV9E3HJ83zBQDmrGJWXDRGdw7w=", + "dev": true + }, + "console-browserify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", + "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", + "dev": true, + "requires": { + "date-now": "^0.1.4" + } + }, + "convert-source-map": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", + "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + } + } + }, + "cookie-jar": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/cookie-jar/-/cookie-jar-0.3.0.tgz", + "integrity": "sha1-vJon1OK5fhhs1XyeIGPLmfpozMw=", + "dev": true + }, + "core-js": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cryptiles": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-0.2.2.tgz", + "integrity": "sha1-7ZH/HxetE9N0gohZT4pIoNJvMlw=", + "dev": true, + "requires": { + "boom": "0.4.x" + } + }, + "cson": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/cson/-/cson-3.0.2.tgz", + "integrity": "sha1-g+6Qids8JUvsHpjkmNmqzxGtzFQ=", + "dev": true, + "requires": { + "coffee-script": "^1.9.0", + "cson-parser": "^1.0.6", + "extract-opts": "^3.0.1", + "requirefresh": "^2.0.0", + "safefs": "^4.0.0" + }, + "dependencies": { + "coffee-script": { + "version": "1.12.7", + "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", + "integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==", + "dev": true + } + } + }, + "cson-parser": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/cson-parser/-/cson-parser-1.3.5.tgz", + "integrity": "sha1-fsZ14DkUVTO/KmqFYHPxWZ2cLSQ=", + "dev": true, + "requires": { + "coffee-script": "^1.10.0" + }, + "dependencies": { + "coffee-script": { + "version": "1.12.7", + "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", + "integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==", + "dev": true + } + } + }, + "ctype": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.2.tgz", + "integrity": "sha1-/oCR1Gijc6Cwyf+Lv7NCXACXOh0=", + "dev": true + }, + "cycle": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", + "integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI=", + "dev": true + }, + "d": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "dev": true, + "requires": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "date-now": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", + "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", + "dev": true + }, + "dateformat": { + "version": "1.0.2-1.2.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz", + "integrity": "sha1-sCIMAt6YYXQztyhRz0fePfLNvuk=", + "dev": true + }, + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.0.tgz", + "integrity": "sha512-ZbfWJq/wN1Z273o7mUSjILYqehAktR2NVoSrOukDkU9kg2v/Uv89yU4Cvz8seJeAmtN5oqiefKq8FPuXOboqLw==", + "dev": true, + "requires": { + "is-arguments": "^1.0.4", + "is-date-object": "^1.0.1", + "is-regex": "^1.0.4", + "object-is": "^1.0.1", + "object-keys": "^1.1.1", + "regexp.prototype.flags": "^1.2.0" + } + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "defined": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", + "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", + "dev": true + }, + "defs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/defs/-/defs-1.1.1.tgz", + "integrity": "sha1-siYJ8sehG6ej2xFoBcE5scr/qdI=", + "dev": true, + "requires": { + "alter": "~0.2.0", + "ast-traverse": "~0.1.1", + "breakable": "~1.0.0", + "esprima-fb": "~15001.1001.0-dev-harmony-fb", + "simple-fmt": "~0.1.0", + "simple-is": "~0.2.0", + "stringmap": "~0.2.2", + "stringset": "~0.2.1", + "tryor": "~0.1.2", + "yargs": "~3.27.0" + }, + "dependencies": { + "esprima-fb": { + "version": "15001.1001.0-dev-harmony-fb", + "resolved": "https://registry.npmjs.org/esprima-fb/-/esprima-fb-15001.1001.0-dev-harmony-fb.tgz", + "integrity": "sha1-Q761fsJujPI3092LM+QlM1d/Jlk=", + "dev": true + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "dev": true + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", + "dev": true + }, + "detect-indent": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-3.0.1.tgz", + "integrity": "sha1-ncXl3bzu+DJXZLlFGwK8bVQIT3U=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1", + "minimist": "^1.1.0", + "repeating": "^1.1.0" + } + }, + "detective": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/detective/-/detective-4.7.1.tgz", + "integrity": "sha512-H6PmeeUcZloWtdt4DAkFyzFL94arpHr3NOwwmVILFiy+9Qd4JTxxXrzfyGk/lmct2qVGBwTSwSXagqu2BxmWig==", + "dev": true, + "requires": { + "acorn": "^5.2.1", + "defined": "^1.0.0" + } + }, + "dom-serializer": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.1.tgz", + "integrity": "sha512-sK3ujri04WyjwQXVoK4PU3y8ula1stq10GJZpqHIUgoGZdsGzAGu65BnU3d08aTVSvO7mGPZUc0wTEDL+qGE0Q==", + "dev": true, + "requires": { + "domelementtype": "^2.0.1", + "entities": "^2.0.0" + }, + "dependencies": { + "domelementtype": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz", + "integrity": "sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==", + "dev": true + }, + "entities": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz", + "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==", + "dev": true + } + } + }, + "domelementtype": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", + "dev": true + }, + "domhandler": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz", + "integrity": "sha1-LeWaCCLVAn+r/28DLCsloqir5zg=", + "dev": true, + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "dev": true, + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "eachr": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/eachr/-/eachr-3.2.0.tgz", + "integrity": "sha1-LDXkPqCGUW95l8+At6pk1VpKRIQ=", + "dev": true, + "requires": { + "editions": "^1.1.1", + "typechecker": "^4.3.0" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "editions": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/editions/-/editions-1.3.4.tgz", + "integrity": "sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg==", + "dev": true + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "dev": true + }, + "entities": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", + "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=", + "dev": true + }, + "errlop": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/errlop/-/errlop-1.1.2.tgz", + "integrity": "sha512-djkRp+urJ+SmqDBd7F6LUgm4Be1TTYBxia2bhjNdFBuBDQtJDHExD2VbxR6eyst3h1TZy3qPRCdqb6FBoFttTA==", + "dev": true, + "requires": { + "editions": "^2.1.3" + }, + "dependencies": { + "editions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/editions/-/editions-2.2.0.tgz", + "integrity": "sha512-RYg3iEA2BDLCNVe8PUkD+ox5vAKxB9XS/mAhx1bdxGCF0CpX077C0pyTA9t5D6idCYA3avl5/XDHKPsHFrygfw==", + "dev": true, + "requires": { + "errlop": "^1.1.2", + "semver": "^6.3.0" + } + } + } + }, + "es5-ext": { + "version": "0.10.51", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz", + "integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==", + "dev": true, + "requires": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.1", + "next-tick": "^1.0.0" + } + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "es6-map": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", + "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "~0.10.14", + "es6-iterator": "~2.0.1", + "es6-set": "~0.1.5", + "es6-symbol": "~3.1.1", + "event-emitter": "~0.3.5" + } + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "requires": { + "es6-promise": "^4.0.3" + } + }, + "es6-set": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", + "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "~0.10.14", + "es6-iterator": "~2.0.1", + "es6-symbol": "3.1.1", + "event-emitter": "~0.3.5" + }, + "dependencies": { + "es6-symbol": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "~0.10.14" + } + } + } + }, + "es6-symbol": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.2.tgz", + "integrity": "sha512-/ZypxQsArlv+KHpGvng52/Iz8by3EQPxhmbuz8yFG89N/caTFBSbcXONDw0aMjy827gQg26XAjP4uXFvnfINmQ==", + "dev": true, + "requires": { + "d": "^1.0.1", + "es5-ext": "^0.10.51" + } + }, + "es6-weak-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz", + "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "^0.10.46", + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.1" + } + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "escope": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", + "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", + "dev": true, + "requires": { + "es6-map": "^0.1.3", + "es6-weak-map": "^2.0.1", + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "esprima": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", + "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=", + "dev": true + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "dev": true + }, + "event-emitter": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", + "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "~0.10.14" + } + }, + "eventemitter2": { + "version": "0.4.14", + "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", + "integrity": "sha1-j2G3XN4BKy6esoTUVFWDtWQ7Yas=", + "dev": true + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extract-opts": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/extract-opts/-/extract-opts-3.3.1.tgz", + "integrity": "sha1-WrvtyYwNUgLjJ4cn+Rktfghsa+E=", + "dev": true, + "requires": { + "eachr": "^3.2.0", + "editions": "^1.1.1", + "typechecker": "^4.3.0" + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=", + "dev": true + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "faye-websocket": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.4.4.tgz", + "integrity": "sha1-wUxbO/FNdBf/v9mQwKdJXNnzN7w=", + "dev": true + }, + "fg-lodash": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/fg-lodash/-/fg-lodash-0.0.2.tgz", + "integrity": "sha1-mINSU39CfaavIiEpu2OsyknmL6M=", + "requires": { + "lodash": "^2.4.1", + "underscore.string": "~2.3.3" + }, + "dependencies": { + "lodash": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", + "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" + } + } + }, + "finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "dev": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + } + } + }, + "findup-sync": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", + "integrity": "sha1-fz56l7gjksZTvwZYm9hRkOk8NoM=", + "dev": true, + "requires": { + "glob": "~3.2.9", + "lodash": "~2.4.1" + }, + "dependencies": { + "glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", + "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", + "dev": true, + "requires": { + "inherits": "2", + "minimatch": "0.3" + } + }, + "lodash": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", + "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", + "dev": true + }, + "minimatch": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", + "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", + "dev": true, + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + } + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "dev": true + }, + "fs-readdir-recursive": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-0.1.2.tgz", + "integrity": "sha1-MVtPuMHKW4xH3v7zGdBz2tNWgFk=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "gauge": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-1.2.7.tgz", + "integrity": "sha1-6c7FSD09TuDvRLYKfZnkk14TbZM=", + "dev": true, + "requires": { + "ansi": "^0.3.0", + "has-unicode": "^2.0.0", + "lodash.pad": "^4.1.0", + "lodash.padend": "^4.1.0", + "lodash.padstart": "^4.1.0" + } + }, + "gaze": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz", + "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", + "dev": true, + "requires": { + "globule": "~0.1.0" + } + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "getobject": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz", + "integrity": "sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "3.1.21", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", + "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", + "dev": true, + "requires": { + "graceful-fs": "~1.2.0", + "inherits": "1", + "minimatch": "~0.2.11" + }, + "dependencies": { + "inherits": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", + "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=", + "dev": true + } + } + }, + "globals": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/globals/-/globals-6.4.1.tgz", + "integrity": "sha1-hJgDKzttHMge68X3lpDY/in6v08=", + "dev": true + }, + "globule": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", + "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", + "dev": true, + "requires": { + "glob": "~3.1.21", + "lodash": "~1.0.1", + "minimatch": "~0.2.11" + }, + "dependencies": { + "lodash": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", + "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", + "dev": true + } + } + }, + "graceful-fs": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", + "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=", + "dev": true + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true + }, + "grunt": { + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-0.4.5.tgz", + "integrity": "sha1-VpN81RlDJK3/bSB2MYMqnWuk5/A=", + "dev": true, + "requires": { + "async": "~0.1.22", + "coffee-script": "~1.3.3", + "colors": "~0.6.2", + "dateformat": "1.0.2-1.2.3", + "eventemitter2": "~0.4.13", + "exit": "~0.1.1", + "findup-sync": "~0.1.2", + "getobject": "~0.1.0", + "glob": "~3.1.21", + "grunt-legacy-log": "~0.1.0", + "grunt-legacy-util": "~0.2.0", + "hooker": "~0.2.3", + "iconv-lite": "~0.2.11", + "js-yaml": "~2.0.5", + "lodash": "~0.9.2", + "minimatch": "~0.2.12", + "nopt": "~1.0.10", + "rimraf": "~2.2.8", + "underscore.string": "~2.2.1", + "which": "~1.0.5" + }, + "dependencies": { + "colors": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", + "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=", + "dev": true + }, + "lodash": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz", + "integrity": "sha1-jzSZxSRdNG1oLlsNO0B2fgnxqSw=", + "dev": true + }, + "underscore.string": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz", + "integrity": "sha1-18D6KvXVoaZ/QlPa7pgTLnM/Dxk=", + "dev": true + } + } + }, + "grunt-contrib-connect": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/grunt-contrib-connect/-/grunt-contrib-connect-0.11.2.tgz", + "integrity": "sha1-HAoHB9OzKNnPO0tJDrhMSV2Tau0=", + "dev": true, + "requires": { + "async": "^0.9.0", + "connect": "^3.4.0", + "connect-livereload": "^0.5.0", + "morgan": "^1.6.1", + "opn": "^1.0.0", + "portscanner": "^1.0.0", + "serve-index": "^1.7.1", + "serve-static": "^1.10.0" + }, + "dependencies": { + "async": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", + "dev": true + } + } + }, + "grunt-contrib-jshint": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-0.12.0.tgz", + "integrity": "sha1-9rLwb8cVJkg3p6tsaaHOGmicLCk=", + "dev": true, + "requires": { + "hooker": "^0.2.3", + "jshint": "~2.9.1" + } + }, + "grunt-contrib-watch": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/grunt-contrib-watch/-/grunt-contrib-watch-0.6.1.tgz", + "integrity": "sha1-ZP3LolpjX1tNobbOb5DaCutuPxU=", + "dev": true, + "requires": { + "async": "~0.2.9", + "gaze": "~0.5.1", + "lodash": "~2.4.1", + "tiny-lr-fork": "0.0.5" + }, + "dependencies": { + "async": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", + "dev": true + }, + "lodash": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", + "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", + "dev": true + } + } + }, + "grunt-jscs": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/grunt-jscs/-/grunt-jscs-2.8.0.tgz", + "integrity": "sha1-nc81LFY6Mi2Adl/pIsLNoqRkzto=", + "dev": true, + "requires": { + "hooker": "~0.2.3", + "jscs": "~2.11.0", + "lodash": "~4.6.1", + "vow": "~0.4.1" + }, + "dependencies": { + "lodash": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.6.1.tgz", + "integrity": "sha1-3wDBFkrSNrGDz8OIel6NOMxjy7w=", + "dev": true + } + } + }, + "grunt-legacy-log": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-0.1.3.tgz", + "integrity": "sha1-7ClCboAwIa9ZAp+H0vnNczWgVTE=", + "dev": true, + "requires": { + "colors": "~0.6.2", + "grunt-legacy-log-utils": "~0.1.1", + "hooker": "~0.2.3", + "lodash": "~2.4.1", + "underscore.string": "~2.3.3" + }, + "dependencies": { + "colors": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", + "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=", + "dev": true + }, + "lodash": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", + "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", + "dev": true + } + } + }, + "grunt-legacy-log-utils": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-0.1.1.tgz", + "integrity": "sha1-wHBrndkGThFvNvI/5OawSGcsD34=", + "dev": true, + "requires": { + "colors": "~0.6.2", + "lodash": "~2.4.1", + "underscore.string": "~2.3.3" + }, + "dependencies": { + "colors": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", + "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=", + "dev": true + }, + "lodash": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", + "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", + "dev": true + } + } + }, + "grunt-legacy-util": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-0.2.0.tgz", + "integrity": "sha1-kzJIhNv343qf98Am3/RR2UqeVUs=", + "dev": true, + "requires": { + "async": "~0.1.22", + "exit": "~0.1.1", + "getobject": "~0.1.0", + "hooker": "~0.2.3", + "lodash": "~0.9.2", + "underscore.string": "~2.2.1", + "which": "~1.0.5" + }, + "dependencies": { + "lodash": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz", + "integrity": "sha1-jzSZxSRdNG1oLlsNO0B2fgnxqSw=", + "dev": true + }, + "underscore.string": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz", + "integrity": "sha1-18D6KvXVoaZ/QlPa7pgTLnM/Dxk=", + "dev": true + } + } + }, + "grunt-sauce-tunnel": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/grunt-sauce-tunnel/-/grunt-sauce-tunnel-0.2.1.tgz", + "integrity": "sha1-f9IpcAbIhJ3xkuGAc1duy8Vf0Zo=", + "dev": true, + "requires": { + "sauce-tunnel": "2.0.x" + }, + "dependencies": { + "ansi-styles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", + "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", + "dev": true + }, + "asn1": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz", + "integrity": "sha1-VZvhg3bQik7E2+gId9J4GGObLfc=", + "dev": true + }, + "assert-plus": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz", + "integrity": "sha1-2T/9u2esVQd3m+MWp9ZRRkF77vg=", + "dev": true + }, + "async": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", + "dev": true + }, + "chalk": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", + "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", + "dev": true, + "requires": { + "ansi-styles": "~1.0.0", + "has-color": "~0.1.0", + "strip-ansi": "~0.1.0" + } + }, + "combined-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", + "integrity": "sha1-ATfmV7qlp1QcV6w3rF/AfXO03B8=", + "dev": true, + "requires": { + "delayed-stream": "0.0.5" + } + }, + "delayed-stream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz", + "integrity": "sha1-1LH0OpPoKW3+AmlPRoC8N6MTxz8=", + "dev": true + }, + "forever-agent": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz", + "integrity": "sha1-bQ4JxJIflKJ/Y9O0nF/v8epMUTA=", + "dev": true + }, + "form-data": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.0.8.tgz", + "integrity": "sha1-CJDNEAXFzOzAudJKiAUskkQtDbU=", + "dev": true, + "requires": { + "async": "~0.2.7", + "combined-stream": "~0.0.4", + "mime": "~1.2.2" + } + }, + "http-signature": { + "version": "0.9.11", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.9.11.tgz", + "integrity": "sha1-nognFFcjFeZ5Cl0KeVXv/x8Z5lM=", + "dev": true, + "requires": { + "asn1": "0.1.11", + "assert-plus": "0.1.2", + "ctype": "0.5.2" + } + }, + "json-stringify-safe": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-4.0.0.tgz", + "integrity": "sha1-d8JxqupUMC5o7+rMtWq78GqbGlQ=", + "dev": true + }, + "mime": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz", + "integrity": "sha1-WCA+7Ybjpe8XrtK32evUfwpg3RA=", + "dev": true + }, + "node-uuid": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", + "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=", + "dev": true + }, + "oauth-sign": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.3.0.tgz", + "integrity": "sha1-y1QPk7srIqfVlBaRoojWDo6pOG4=", + "dev": true + }, + "qs": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/qs/-/qs-0.6.6.tgz", + "integrity": "sha1-bgFQmP9RlouKPIGQAdXyyJvEsQc=", + "dev": true + }, + "request": { + "version": "2.21.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.21.0.tgz", + "integrity": "sha1-VyirnEXlqHyZ2szVMCmLZnOoaNc=", + "dev": true, + "requires": { + "aws-sign": "~0.3.0", + "cookie-jar": "~0.3.0", + "forever-agent": "~0.5.0", + "form-data": "0.0.8", + "hawk": "~0.13.0", + "http-signature": "~0.9.11", + "json-stringify-safe": "~4.0.0", + "mime": "~1.2.9", + "node-uuid": "~1.4.0", + "oauth-sign": "~0.3.0", + "qs": "~0.6.0", + "tunnel-agent": "~0.3.0" + } + }, + "sauce-tunnel": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/sauce-tunnel/-/sauce-tunnel-2.0.6.tgz", + "integrity": "sha1-ba1TGKd1Q6qlUlm9+vUJpoG3pIQ=", + "dev": true, + "requires": { + "chalk": "~0.4.0", + "request": "~2.21.0" + } + }, + "strip-ansi": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", + "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", + "dev": true + }, + "tunnel-agent": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.3.0.tgz", + "integrity": "sha1-rWgbaPUyGtKCfEz7G31d8s/pQu4=", + "dev": true + } + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-color": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", + "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", + "dev": true + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true + }, + "hawk": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-0.13.1.tgz", + "integrity": "sha1-NheViCH1gxHk1/beKR/KZitBLvQ=", + "dev": true, + "requires": { + "boom": "0.4.x", + "cryptiles": "0.2.x", + "hoek": "0.8.x", + "sntp": "0.2.x" + } + }, + "hoek": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-0.8.5.tgz", + "integrity": "sha1-Hp/XcO9+vgJ0rfy1sIBqAlpeTp8=", + "dev": true + }, + "home-or-tmp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-1.0.0.tgz", + "integrity": "sha1-S58eQIAMPlDGwn94FnavzOcfOYU=", + "dev": true, + "requires": { + "os-tmpdir": "^1.0.1", + "user-home": "^1.1.1" + } + }, + "hooker": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", + "integrity": "sha1-uDT3I8xKJCqmWWNFnfbZhMXT2Vk=", + "dev": true + }, + "htmlparser2": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", + "integrity": "sha1-mWwosZFRaovoZQGn15dX5ccMEGg=", + "dev": true, + "requires": { + "domelementtype": "1", + "domhandler": "2.3", + "domutils": "1.5", + "entities": "1.0", + "readable-stream": "1.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "dev": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + } + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-proxy-agent": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.3.tgz", + "integrity": "sha512-Ytgnz23gm2DVftnzqRRz2dOXZbGd2uiajSw/95bPp6v53zPRspQjLm/AfBgqbJ2qfeRXWIOMVLpp86+/5yX39Q==", + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + } + }, + "i": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/i/-/i-0.3.6.tgz", + "integrity": "sha1-2WyScyB28HJxG2sQ/X1PZa2O4j0=", + "dev": true + }, + "iconv-lite": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz", + "integrity": "sha1-HOYKOleGSiktEyH/RgnKS7llrcg=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherit": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/inherit/-/inherit-2.2.7.tgz", + "integrity": "sha512-dxJmC1j0Q32NFAjvbd6g3lXYLZ49HgzotgbSMwMkoiTXGhC9412Oc24g7A7M9cPPkw/vDsF2cSII+2zJwocUtQ==", + "dev": true + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "is-arguments": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", + "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==", + "dev": true + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-integer": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-integer/-/is-integer-1.0.7.tgz", + "integrity": "sha1-a96Bqs3feLZZtmKdYpytxRqIbVw=", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "dev": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jit-grunt": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/jit-grunt/-/jit-grunt-0.10.0.tgz", + "integrity": "sha1-AIw6f+Hpa9DYTiYOofoXg0V/ecI=", + "dev": true + }, + "js-tokens": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-1.0.1.tgz", + "integrity": "sha1-zENaXIuUrRWst5gxQPyAGCyJrq4=", + "dev": true + }, + "js-yaml": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-2.0.5.tgz", + "integrity": "sha1-olrmUJmZ6X3yeMZxnaEb0Gh3Q6g=", + "dev": true, + "requires": { + "argparse": "~ 0.1.11", + "esprima": "~ 1.0.2" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "jscs": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/jscs/-/jscs-2.11.0.tgz", + "integrity": "sha1-bhHvDKqgdzH53MKysn2OzuHdvLY=", + "dev": true, + "requires": { + "babel-jscs": "^2.0.0", + "chalk": "~1.1.0", + "cli-table": "~0.3.1", + "commander": "~2.9.0", + "escope": "^3.2.0", + "esprima": "~2.7.0", + "estraverse": "^4.1.0", + "exit": "~0.1.2", + "glob": "^5.0.1", + "htmlparser2": "3.8.3", + "js-yaml": "~3.4.0", + "jscs-jsdoc": "^1.3.1", + "jscs-preset-wikimedia": "~1.0.0", + "jsonlint": "~1.6.2", + "lodash": "~3.10.0", + "minimatch": "~3.0.0", + "natural-compare": "~1.2.2", + "pathval": "~0.1.1", + "prompt": "~0.2.14", + "reserved-words": "^0.1.1", + "resolve": "^1.1.6", + "strip-bom": "^2.0.0", + "strip-json-comments": "~1.0.2", + "to-double-quotes": "^2.0.0", + "to-single-quotes": "^2.0.0", + "vow": "~0.4.8", + "vow-fs": "~0.3.4", + "xmlbuilder": "^3.1.0" + }, + "dependencies": { + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + }, + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "js-yaml": { + "version": "3.4.6", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.4.6.tgz", + "integrity": "sha1-a+GyP2JJ9T0pM3D9TRqqY84bTrA=", + "dev": true, + "requires": { + "argparse": "^1.0.2", + "esprima": "^2.6.0", + "inherit": "^2.2.2" + } + }, + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "jscs-jsdoc": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/jscs-jsdoc/-/jscs-jsdoc-1.3.2.tgz", + "integrity": "sha1-HyyCtqtLl1JNqVj0a05WLgMF+ac=", + "dev": true, + "requires": { + "comment-parser": "^0.3.1", + "jsdoctypeparser": "~1.2.0" + } + }, + "jscs-preset-wikimedia": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/jscs-preset-wikimedia/-/jscs-preset-wikimedia-1.0.1.tgz", + "integrity": "sha512-RWqu6IYSUlnYuCRCF0obCOHjJV0vhpLcvKbauwxmLQoZ0PiXDTWBYlfpsEfdhg7pmREAEwrARfDRz5qWD6qknA==", + "dev": true + }, + "jsdoctypeparser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-1.2.0.tgz", + "integrity": "sha1-597cFToRhJ/8UUEUSuhqfvDCU5I=", + "dev": true, + "requires": { + "lodash": "^3.7.0" + }, + "dependencies": { + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + } + } + }, + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + }, + "jshint": { + "version": "2.9.7", + "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.9.7.tgz", + "integrity": "sha512-Q8XN38hGsVQhdlM+4gd1Xl7OB1VieSuCJf+fEJjpo59JH99bVJhXRXAh26qQ15wfdd1VPMuDWNeSWoNl53T4YA==", + "dev": true, + "requires": { + "cli": "~1.0.0", + "console-browserify": "1.1.x", + "exit": "0.1.x", + "htmlparser2": "3.8.x", + "lodash": "~4.17.10", + "minimatch": "~3.0.2", + "shelljs": "0.3.x", + "strip-json-comments": "1.0.x" + }, + "dependencies": { + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "json5": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.4.0.tgz", + "integrity": "sha1-BUNS5MTIDIbAkjh31EneF2pzLI0=", + "dev": true + }, + "jsonlint": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/jsonlint/-/jsonlint-1.6.3.tgz", + "integrity": "sha512-jMVTMzP+7gU/IyC6hvKyWpUU8tmTkK5b3BPNuMI9U8Sit+YAWLlZwB6Y6YrdCxfg2kNz05p3XY3Bmm4m26Nv3A==", + "dev": true, + "requires": { + "JSV": "^4.0.x", + "nomnom": "^1.5.x" + } + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "leven": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/leven/-/leven-1.0.2.tgz", + "integrity": "sha1-kUS27ryl8dBoAWnxpncNzqYLdcM=", + "dev": true + }, + "load-grunt-config": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/load-grunt-config/-/load-grunt-config-0.19.2.tgz", + "integrity": "sha1-UgkNSiDG5j90p2SPJJsZ57f87CQ=", + "dev": true, + "requires": { + "cson": "~3.0.2", + "glob": "~5.0.15", + "jit-grunt": "~0.10.0", + "js-yaml": "~3.4.3", + "load-grunt-tasks": "~3.3.0", + "lodash": "~3.10.1" + }, + "dependencies": { + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + }, + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "js-yaml": { + "version": "3.4.6", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.4.6.tgz", + "integrity": "sha1-a+GyP2JJ9T0pM3D9TRqqY84bTrA=", + "dev": true, + "requires": { + "argparse": "^1.0.2", + "esprima": "^2.6.0", + "inherit": "^2.2.2" + } + }, + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "load-grunt-tasks": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/load-grunt-tasks/-/load-grunt-tasks-3.3.0.tgz", + "integrity": "sha1-vliSkJRY2T3fdp60vGhRAggMYyE=", + "dev": true, + "requires": { + "arrify": "^1.0.0", + "multimatch": "^2.0.0", + "pkg-up": "^1.0.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + }, + "lodash._baseassign": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "dev": true, + "requires": { + "lodash._basecopy": "^3.0.0", + "lodash.keys": "^3.0.0" + } + }, + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._bindcallback": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz", + "integrity": "sha1-5THCdkTPi1epnhftlbNcdIeJOS4=", + "dev": true + }, + "lodash._createassigner": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz", + "integrity": "sha1-g4pbri/aymOsIt7o4Z+k5taXCxE=", + "dev": true, + "requires": { + "lodash._bindcallback": "^3.0.0", + "lodash._isiterateecall": "^3.0.0", + "lodash.restparam": "^3.0.0" + } + }, + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash.assign": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-3.2.0.tgz", + "integrity": "sha1-POnwI0tLIiPilrj6CsH+6OvKZPo=", + "dev": true, + "requires": { + "lodash._baseassign": "^3.0.0", + "lodash._createassigner": "^3.0.0", + "lodash.keys": "^3.0.0" + } + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" + } + }, + "lodash.pad": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/lodash.pad/-/lodash.pad-4.5.1.tgz", + "integrity": "sha1-QzCUmoM6fI2iLMIPaibE1Z3runA=", + "dev": true + }, + "lodash.padend": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.padend/-/lodash.padend-4.6.1.tgz", + "integrity": "sha1-U8y6BH0G4VjTEfRdpiX05J5vFm4=", + "dev": true + }, + "lodash.padstart": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.padstart/-/lodash.padstart-4.6.1.tgz", + "integrity": "sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs=", + "dev": true + }, + "lodash.restparam": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", + "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", + "dev": true + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, + "lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", + "dev": true + }, + "merge": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.1.tgz", + "integrity": "sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ==", + "dev": true + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true + }, + "mime-db": { + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", + "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" + }, + "mime-types": { + "version": "2.1.24", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", + "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "requires": { + "mime-db": "1.40.0" + } + }, + "minimatch": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", + "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", + "dev": true, + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "morgan": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz", + "integrity": "sha512-HQStPIV4y3afTiCYVxirakhlCfGkI161c76kKFca7Fk1JusM//Qeo1ej2XaMniiNeaZklMVrh3vTtIzpzwbpmA==", + "dev": true, + "requires": { + "basic-auth": "~2.0.0", + "debug": "2.6.9", + "depd": "~1.1.2", + "on-finished": "~2.3.0", + "on-headers": "~1.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "multimatch": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-2.1.0.tgz", + "integrity": "sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=", + "dev": true, + "requires": { + "array-differ": "^1.0.0", + "array-union": "^1.0.1", + "arrify": "^1.0.0", + "minimatch": "^3.0.0" + }, + "dependencies": { + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, + "natural-compare": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.2.2.tgz", + "integrity": "sha1-H5bWDjFBysG20FZTzg2urHY69qo=", + "dev": true + }, + "ncp": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/ncp/-/ncp-0.4.2.tgz", + "integrity": "sha1-q8xsvT7C7Spyn/bnwfqPAXhKhXQ=", + "dev": true + }, + "negotiator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "dev": true + }, + "next-tick": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", + "dev": true + }, + "nomnom": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz", + "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", + "dev": true, + "requires": { + "chalk": "~0.4.0", + "underscore": "~1.6.0" + }, + "dependencies": { + "ansi-styles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", + "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", + "dev": true + }, + "chalk": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", + "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", + "dev": true, + "requires": { + "ansi-styles": "~1.0.0", + "has-color": "~0.1.0", + "strip-ansi": "~0.1.0" + } + }, + "strip-ansi": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", + "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", + "dev": true + }, + "underscore": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", + "dev": true + } + } + }, + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "noptify": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/noptify/-/noptify-0.0.3.tgz", + "integrity": "sha1-WPZUpz2XU98MUdlobckhBKZ/S7s=", + "dev": true, + "requires": { + "nopt": "~2.0.0" + }, + "dependencies": { + "nopt": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-2.0.0.tgz", + "integrity": "sha1-ynQW8gpeP5w7hhgPlilfo9C1Lg0=", + "dev": true, + "requires": { + "abbrev": "1" + } + } + } + }, + "npm": { + "version": "2.15.12", + "resolved": "https://registry.npmjs.org/npm/-/npm-2.15.12.tgz", + "integrity": "sha1-33w+1aJ3w/nUtdgZsFMR0QogCuY=", + "dev": true, + "requires": { + "abbrev": "~1.0.9", + "ansi": "~0.3.1", + "ansi-regex": "*", + "ansicolors": "~0.3.2", + "ansistyles": "~0.1.3", + "archy": "~1.0.0", + "async-some": "~1.0.2", + "block-stream": "0.0.9", + "char-spinner": "~1.0.1", + "chmodr": "~1.0.2", + "chownr": "~1.0.1", + "cmd-shim": "~2.0.2", + "columnify": "~1.5.4", + "config-chain": "~1.1.10", + "dezalgo": "~1.0.3", + "editor": "~1.0.0", + "fs-vacuum": "~1.2.9", + "fs-write-stream-atomic": "~1.0.8", + "fstream": "~1.0.10", + "fstream-npm": "~1.1.1", + "github-url-from-git": "~1.4.0", + "github-url-from-username-repo": "~1.0.2", + "glob": "~7.0.6", + "graceful-fs": "~4.1.6", + "hosted-git-info": "~2.1.5", + "imurmurhash": "*", + "inflight": "~1.0.4", + "inherits": "~2.0.3", + "ini": "~1.3.4", + "init-package-json": "~1.9.4", + "lockfile": "~1.0.1", + "lru-cache": "~4.0.1", + "minimatch": "~3.0.3", + "mkdirp": "~0.5.1", + "node-gyp": "~3.6.0", + "nopt": "~3.0.6", + "normalize-git-url": "~3.0.2", + "normalize-package-data": "~2.3.5", + "npm-cache-filename": "~1.0.2", + "npm-install-checks": "~1.0.7", + "npm-package-arg": "~4.1.0", + "npm-registry-client": "~7.2.1", + "npm-user-validate": "~0.1.5", + "npmlog": "~2.0.4", + "once": "~1.4.0", + "opener": "~1.4.1", + "osenv": "~0.1.3", + "path-is-inside": "~1.0.0", + "read": "~1.0.7", + "read-installed": "~4.0.3", + "read-package-json": "~2.0.4", + "readable-stream": "~2.1.5", + "realize-package-specifier": "~3.0.1", + "request": "~2.74.0", + "retry": "~0.10.0", + "rimraf": "~2.5.4", + "semver": "~5.1.0", + "sha": "~2.0.1", + "slide": "~1.1.6", + "sorted-object": "~2.0.0", + "spdx-license-ids": "~1.2.2", + "strip-ansi": "~3.0.1", + "tar": "~2.2.1", + "text-table": "~0.2.0", + "uid-number": "0.0.6", + "umask": "~1.1.0", + "validate-npm-package-license": "~3.0.1", + "validate-npm-package-name": "~2.2.2", + "which": "~1.2.11", + "wrappy": "~1.0.2", + "write-file-atomic": "~1.1.4" + }, + "dependencies": { + "abbrev": { + "version": "1.0.9", + "bundled": true, + "dev": true + }, + "ansi": { + "version": "0.3.1", + "bundled": true, + "dev": true + }, + "ansi-regex": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "ansicolors": { + "version": "0.3.2", + "bundled": true, + "dev": true + }, + "ansistyles": { + "version": "0.1.3", + "bundled": true, + "dev": true + }, + "archy": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "async-some": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "dezalgo": "^1.0.2" + } + }, + "block-stream": { + "version": "0.0.9", + "bundled": true, + "dev": true, + "requires": { + "inherits": "~2.0.0" + } + }, + "char-spinner": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "chmodr": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "chownr": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "cmd-shim": { + "version": "2.0.2", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "mkdirp": "~0.5.0" + } + }, + "columnify": { + "version": "1.5.4", + "bundled": true, + "dev": true, + "requires": { + "strip-ansi": "^3.0.0", + "wcwidth": "^1.0.0" + }, + "dependencies": { + "wcwidth": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "defaults": "^1.0.0" + }, + "dependencies": { + "defaults": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "clone": "^1.0.2" + }, + "dependencies": { + "clone": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + } + } + } + } + }, + "config-chain": { + "version": "1.1.10", + "bundled": true, + "dev": true, + "requires": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + }, + "dependencies": { + "proto-list": { + "version": "1.2.4", + "bundled": true, + "dev": true + } + } + }, + "dezalgo": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "asap": "^2.0.0", + "wrappy": "1" + }, + "dependencies": { + "asap": { + "version": "2.0.3", + "bundled": true, + "dev": true + } + } + }, + "editor": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "fs-vacuum": { + "version": "1.2.9", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "path-is-inside": "^1.0.1", + "rimraf": "^2.5.2" + } + }, + "fs-write-stream-atomic": { + "version": "1.0.8", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" + }, + "dependencies": { + "iferr": { + "version": "0.1.5", + "bundled": true, + "dev": true + } + } + }, + "fstream": { + "version": "1.0.10", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + } + }, + "fstream-npm": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "requires": { + "fstream-ignore": "^1.0.0", + "inherits": "2" + }, + "dependencies": { + "fstream-ignore": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "requires": { + "fstream": "^1.0.0", + "inherits": "2", + "minimatch": "^3.0.0" + } + } + } + }, + "github-url-from-git": { + "version": "1.4.0", + "bundled": true, + "dev": true + }, + "github-url-from-username-repo": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "glob": { + "version": "7.0.6", + "bundled": true, + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "path-is-absolute": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "graceful-fs": { + "version": "4.1.6", + "bundled": true, + "dev": true + }, + "hosted-git-info": { + "version": "2.1.5", + "bundled": true, + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "bundled": true, + "dev": true + }, + "inflight": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.4", + "bundled": true, + "dev": true + }, + "init-package-json": { + "version": "1.9.4", + "bundled": true, + "dev": true, + "requires": { + "glob": "^6.0.0", + "npm-package-arg": "^4.0.0", + "promzard": "^0.3.0", + "read": "~1.0.1", + "read-package-json": "1 || 2", + "semver": "2.x || 3.x || 4 || 5", + "validate-npm-package-license": "^3.0.1", + "validate-npm-package-name": "^2.0.1" + }, + "dependencies": { + "glob": { + "version": "6.0.4", + "bundled": true, + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "path-is-absolute": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "promzard": { + "version": "0.3.0", + "bundled": true, + "dev": true, + "requires": { + "read": "1" + } + } + } + }, + "lockfile": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "lru-cache": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "requires": { + "pseudomap": "^1.0.1", + "yallist": "^2.0.0" + }, + "dependencies": { + "pseudomap": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "2.0.0", + "bundled": true, + "dev": true + } + } + }, + "minimatch": { + "version": "3.0.3", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "^1.0.0" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.6", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "^0.4.1", + "concat-map": "0.0.1" + }, + "dependencies": { + "balanced-match": { + "version": "0.4.2", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + } + } + }, + "node-gyp": { + "version": "3.6.0", + "bundled": true, + "dev": true, + "requires": { + "fstream": "^1.0.0", + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "minimatch": "^3.0.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": "2", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^2.0.0", + "which": "1" + }, + "dependencies": { + "semver": { + "version": "5.3.0", + "bundled": true, + "dev": true + } + } + }, + "nopt": { + "version": "3.0.6", + "bundled": true, + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-git-url": { + "version": "3.0.2", + "bundled": true, + "dev": true + }, + "normalize-package-data": { + "version": "2.3.5", + "bundled": true, + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "is-builtin-module": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "builtin-modules": "^1.0.0" + }, + "dependencies": { + "builtin-modules": { + "version": "1.1.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "npm-cache-filename": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "npm-install-checks": { + "version": "1.0.7", + "bundled": true, + "dev": true, + "requires": { + "npmlog": "0.1 || 1 || 2", + "semver": "^2.3.0 || 3.x || 4 || 5" + } + }, + "npm-package-arg": { + "version": "4.1.0", + "bundled": true, + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "semver": "4 || 5" + } + }, + "npm-registry-client": { + "version": "7.2.1", + "bundled": true, + "dev": true, + "requires": { + "concat-stream": "^1.5.2", + "graceful-fs": "^4.1.6", + "normalize-package-data": "~1.0.1 || ^2.0.0", + "npm-package-arg": "^3.0.0 || ^4.0.0", + "npmlog": "~2.0.0 || ~3.1.0", + "once": "^1.3.3", + "request": "^2.74.0", + "retry": "^0.10.0", + "semver": "2 >=2.2.1 || 3.x || 4 || 5", + "slide": "^1.1.3" + }, + "dependencies": { + "concat-stream": { + "version": "1.5.2", + "bundled": true, + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "~2.0.0", + "typedarray": "~0.0.5" + }, + "dependencies": { + "readable-stream": { + "version": "2.0.6", + "bundled": true, + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~0.10.x", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true, + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true, + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + }, + "typedarray": { + "version": "0.0.6", + "bundled": true, + "dev": true + } + } + }, + "retry": { + "version": "0.10.0", + "bundled": true, + "dev": true + } + } + }, + "npm-user-validate": { + "version": "0.1.5", + "bundled": true, + "dev": true + }, + "npmlog": { + "version": "2.0.4", + "bundled": true, + "dev": true, + "requires": { + "ansi": "~0.3.1", + "are-we-there-yet": "~1.1.2", + "gauge": "~1.2.5" + }, + "dependencies": { + "are-we-there-yet": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.0 || ^1.1.13" + }, + "dependencies": { + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "gauge": { + "version": "1.2.7", + "bundled": true, + "dev": true, + "requires": { + "ansi": "^0.3.0", + "has-unicode": "^2.0.0", + "lodash.pad": "^4.1.0", + "lodash.padend": "^4.1.0", + "lodash.padstart": "^4.1.0" + }, + "dependencies": { + "has-unicode": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "lodash._baseslice": { + "version": "4.0.0", + "bundled": true, + "dev": true + }, + "lodash._basetostring": { + "version": "4.12.0", + "bundled": true, + "dev": true + }, + "lodash.pad": { + "version": "4.4.0", + "bundled": true, + "dev": true, + "requires": { + "lodash._baseslice": "~4.0.0", + "lodash._basetostring": "~4.12.0", + "lodash.tostring": "^4.0.0" + } + }, + "lodash.padend": { + "version": "4.5.0", + "bundled": true, + "dev": true, + "requires": { + "lodash._baseslice": "~4.0.0", + "lodash._basetostring": "~4.12.0", + "lodash.tostring": "^4.0.0" + } + }, + "lodash.padstart": { + "version": "4.5.0", + "bundled": true, + "dev": true, + "requires": { + "lodash._baseslice": "~4.0.0", + "lodash._basetostring": "~4.12.0", + "lodash.tostring": "^4.0.0" + } + }, + "lodash.tostring": { + "version": "4.1.4", + "bundled": true, + "dev": true + } + } + } + } + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "opener": { + "version": "1.4.1", + "bundled": true, + "dev": true + }, + "osenv": { + "version": "0.1.3", + "bundled": true, + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + }, + "dependencies": { + "os-homedir": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "os-tmpdir": { + "version": "1.0.1", + "bundled": true, + "dev": true + } + } + }, + "path-is-inside": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "read": { + "version": "1.0.7", + "bundled": true, + "dev": true, + "requires": { + "mute-stream": "~0.0.4" + }, + "dependencies": { + "mute-stream": { + "version": "0.0.5", + "bundled": true, + "dev": true + } + } + }, + "read-installed": { + "version": "4.0.3", + "bundled": true, + "dev": true, + "requires": { + "debuglog": "^1.0.1", + "graceful-fs": "^4.1.2", + "read-package-json": "^2.0.0", + "readdir-scoped-modules": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "slide": "~1.1.3", + "util-extend": "^1.0.1" + }, + "dependencies": { + "debuglog": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "readdir-scoped-modules": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "debuglog": "^1.0.1", + "dezalgo": "^1.0.0", + "graceful-fs": "^4.1.2", + "once": "^1.3.0" + } + }, + "util-extend": { + "version": "1.0.1", + "bundled": true, + "dev": true + } + } + }, + "read-package-json": { + "version": "2.0.4", + "bundled": true, + "dev": true, + "requires": { + "glob": "^6.0.0", + "graceful-fs": "^4.1.2", + "json-parse-helpfulerror": "^1.0.2", + "normalize-package-data": "^2.0.0" + }, + "dependencies": { + "glob": { + "version": "6.0.4", + "bundled": true, + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "path-is-absolute": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "json-parse-helpfulerror": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "jju": "^1.1.0" + }, + "dependencies": { + "jju": { + "version": "1.3.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "readable-stream": { + "version": "2.1.5", + "bundled": true, + "dev": true, + "requires": { + "buffer-shims": "^1.0.0", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~0.10.x", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "buffer-shims": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true, + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true, + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + }, + "realize-package-specifier": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "dezalgo": "^1.0.1", + "npm-package-arg": "^4.0.0" + } + }, + "request": { + "version": "2.74.0", + "bundled": true, + "dev": true, + "requires": { + "aws-sign2": "~0.6.0", + "aws4": "^1.2.1", + "bl": "~1.1.2", + "caseless": "~0.11.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.0", + "forever-agent": "~0.6.1", + "form-data": "~1.0.0-rc4", + "har-validator": "~2.0.6", + "hawk": "~3.1.3", + "http-signature": "~1.1.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.7", + "node-uuid": "~1.4.7", + "oauth-sign": "~0.8.1", + "qs": "~6.2.0", + "stringstream": "~0.0.4", + "tough-cookie": "~2.3.0", + "tunnel-agent": "~0.4.1" + }, + "dependencies": { + "aws-sign2": { + "version": "0.6.0", + "bundled": true, + "dev": true + }, + "aws4": { + "version": "1.4.1", + "bundled": true, + "dev": true + }, + "bl": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "requires": { + "readable-stream": "~2.0.5" + }, + "dependencies": { + "readable-stream": { + "version": "2.0.6", + "bundled": true, + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~0.10.x", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true, + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true, + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + } + } + }, + "caseless": { + "version": "0.11.0", + "bundled": true, + "dev": true + }, + "combined-stream": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + }, + "dependencies": { + "delayed-stream": { + "version": "1.0.0", + "bundled": true, + "dev": true + } + } + }, + "extend": { + "version": "3.0.0", + "bundled": true, + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true, + "dev": true + }, + "form-data": { + "version": "1.0.0-rc4", + "bundled": true, + "dev": true, + "requires": { + "async": "^1.5.2", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.10" + }, + "dependencies": { + "async": { + "version": "1.5.2", + "bundled": true, + "dev": true + } + } + }, + "har-validator": { + "version": "2.0.6", + "bundled": true, + "dev": true, + "requires": { + "chalk": "^1.1.1", + "commander": "^2.9.0", + "is-my-json-valid": "^2.12.4", + "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "bundled": true, + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "bundled": true, + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "bundled": true, + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "bundled": true, + "dev": true + } + } + }, + "commander": { + "version": "2.9.0", + "bundled": true, + "dev": true, + "requires": { + "graceful-readlink": ">= 1.0.0" + }, + "dependencies": { + "graceful-readlink": { + "version": "1.0.1", + "bundled": true, + "dev": true + } + } + }, + "is-my-json-valid": { + "version": "2.13.1", + "bundled": true, + "dev": true, + "requires": { + "generate-function": "^2.0.0", + "generate-object-property": "^1.1.0", + "jsonpointer": "2.0.0", + "xtend": "^4.0.0" + }, + "dependencies": { + "generate-function": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "generate-object-property": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "requires": { + "is-property": "^1.0.0" + }, + "dependencies": { + "is-property": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + }, + "jsonpointer": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "xtend": { + "version": "4.0.1", + "bundled": true, + "dev": true + } + } + }, + "pinkie-promise": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "requires": { + "pinkie": "^2.0.0" + }, + "dependencies": { + "pinkie": { + "version": "2.0.4", + "bundled": true, + "dev": true + } + } + } + } + }, + "hawk": { + "version": "3.1.3", + "bundled": true, + "dev": true, + "requires": { + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" + }, + "dependencies": { + "boom": { + "version": "2.10.1", + "bundled": true, + "dev": true, + "requires": { + "hoek": "2.x.x" + } + }, + "cryptiles": { + "version": "2.0.5", + "bundled": true, + "dev": true, + "requires": { + "boom": "2.x.x" + } + }, + "hoek": { + "version": "2.16.3", + "bundled": true, + "dev": true + }, + "sntp": { + "version": "1.0.9", + "bundled": true, + "dev": true, + "requires": { + "hoek": "2.x.x" + } + } + } + }, + "http-signature": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "requires": { + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "dependencies": { + "assert-plus": { + "version": "0.2.0", + "bundled": true, + "dev": true + }, + "jsprim": { + "version": "1.3.0", + "bundled": true, + "dev": true, + "requires": { + "extsprintf": "1.0.2", + "json-schema": "0.2.2", + "verror": "1.3.6" + }, + "dependencies": { + "extsprintf": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "json-schema": { + "version": "0.2.2", + "bundled": true, + "dev": true + }, + "verror": { + "version": "1.3.6", + "bundled": true, + "dev": true, + "requires": { + "extsprintf": "1.0.2" + } + } + } + }, + "sshpk": { + "version": "1.9.2", + "bundled": true, + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jodid25519": "^1.0.0", + "jsbn": "~0.1.0", + "tweetnacl": "~0.13.0" + }, + "dependencies": { + "asn1": { + "version": "0.2.3", + "bundled": true, + "dev": true + }, + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "dashdash": { + "version": "1.14.0", + "bundled": true, + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "ecc-jsbn": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsbn": "~0.1.0" + } + }, + "getpass": { + "version": "0.1.6", + "bundled": true, + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "jodid25519": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsbn": "~0.1.0" + } + }, + "jsbn": { + "version": "0.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "tweetnacl": { + "version": "0.13.3", + "bundled": true, + "dev": true, + "optional": true + } + } + } + } + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true, + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true, + "dev": true + }, + "mime-types": { + "version": "2.1.11", + "bundled": true, + "dev": true, + "requires": { + "mime-db": "~1.23.0" + }, + "dependencies": { + "mime-db": { + "version": "1.23.0", + "bundled": true, + "dev": true + } + } + }, + "node-uuid": { + "version": "1.4.7", + "bundled": true, + "dev": true + }, + "oauth-sign": { + "version": "0.8.2", + "bundled": true, + "dev": true + }, + "qs": { + "version": "6.2.1", + "bundled": true, + "dev": true + }, + "stringstream": { + "version": "0.0.5", + "bundled": true, + "dev": true + }, + "tough-cookie": { + "version": "2.3.1", + "bundled": true, + "dev": true + }, + "tunnel-agent": { + "version": "0.4.3", + "bundled": true, + "dev": true + } + } + }, + "retry": { + "version": "0.10.0", + "bundled": true, + "dev": true + }, + "rimraf": { + "version": "2.5.4", + "bundled": true, + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "semver": { + "version": "5.1.0", + "bundled": true, + "dev": true + }, + "sha": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "readable-stream": "^2.0.2" + }, + "dependencies": { + "readable-stream": { + "version": "2.0.2", + "bundled": true, + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "process-nextick-args": "~1.0.0", + "string_decoder": "~0.10.x", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "isarray": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "process-nextick-args": { + "version": "1.0.3", + "bundled": true, + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true, + "dev": true + }, + "util-deprecate": { + "version": "1.0.1", + "bundled": true, + "dev": true + } + } + } + } + }, + "slide": { + "version": "1.1.6", + "bundled": true, + "dev": true + }, + "sorted-object": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "spdx-license-ids": { + "version": "1.2.2", + "bundled": true, + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "tar": { + "version": "2.2.1", + "bundled": true, + "dev": true, + "requires": { + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" + } + }, + "text-table": { + "version": "0.2.0", + "bundled": true, + "dev": true + }, + "uid-number": { + "version": "0.0.6", + "bundled": true, + "dev": true + }, + "umask": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "spdx-correct": "~1.0.0", + "spdx-expression-parse": "~1.0.0" + }, + "dependencies": { + "spdx-correct": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "spdx-license-ids": "^1.0.2" + } + }, + "spdx-expression-parse": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "spdx-exceptions": "^1.0.4", + "spdx-license-ids": "^1.0.0" + }, + "dependencies": { + "spdx-exceptions": { + "version": "1.0.4", + "bundled": true, + "dev": true + } + } + } + } + }, + "validate-npm-package-name": { + "version": "2.2.2", + "bundled": true, + "dev": true, + "requires": { + "builtins": "0.0.7" + }, + "dependencies": { + "builtins": { + "version": "0.0.7", + "bundled": true, + "dev": true + } + } + }, + "which": { + "version": "1.2.11", + "bundled": true, + "dev": true, + "requires": { + "isexe": "^1.1.1" + }, + "dependencies": { + "isexe": { + "version": "1.1.2", + "bundled": true, + "dev": true + } + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "write-file-atomic": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "imurmurhash": "^0.1.4", + "slide": "^1.1.5" + } + } + } + }, + "npmlog": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-1.2.1.tgz", + "integrity": "sha1-KOe+YZYJtT960d0wChDWTXFiaLY=", + "dev": true, + "requires": { + "ansi": "~0.3.0", + "are-we-there-yet": "~1.0.0", + "gauge": "~1.2.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-is": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.0.1.tgz", + "integrity": "sha1-CqYOyZiaCz7Xlc9NBvYs8a1lObY=", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dev": true, + "requires": { + "ee-first": "1.1.1" + } + }, + "on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "opn": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/opn/-/opn-1.0.2.tgz", + "integrity": "sha1-uQlkM0bQChq8l3qLlvPOPFPVz18=", + "dev": true + }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "dev": true, + "requires": { + "lcid": "^1.0.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "output-file-sync": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/output-file-sync/-/output-file-sync-1.1.2.tgz", + "integrity": "sha1-0KM+7+YaIF+suQCS6CZZjVJFznY=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.4", + "mkdirp": "^0.5.1", + "object-assign": "^4.1.0" + }, + "dependencies": { + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + } + } + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true + }, + "path-exists": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-1.0.0.tgz", + "integrity": "sha1-1aiZjrce83p0w06w2eum6HjuoIE=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "pathval": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-0.1.1.tgz", + "integrity": "sha1-CPkRzcqczllCiA2ngXvAtyO2bYI=", + "dev": true + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-up": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-1.0.0.tgz", + "integrity": "sha1-Pgj7RhUlxEIWJKM7n35tCvWwWiY=", + "dev": true, + "requires": { + "find-up": "^1.0.0" + } + }, + "pkginfo": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz", + "integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8=", + "dev": true + }, + "portscanner": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/portscanner/-/portscanner-1.2.0.tgz", + "integrity": "sha1-sUu9olfRTDEPqcwJaCrwLUCWGAI=", + "dev": true, + "requires": { + "async": "1.5.2" + }, + "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + } + } + }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "prompt": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/prompt/-/prompt-0.2.14.tgz", + "integrity": "sha1-V3VPZPVD/XsIRXB8gY7OYY8F/9w=", + "dev": true, + "requires": { + "pkginfo": "0.x.x", + "read": "1.0.x", + "revalidator": "0.1.x", + "utile": "0.2.x", + "winston": "0.8.x" + } + }, + "psl": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz", + "integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==" + }, + "publish": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/publish/-/publish-0.6.0.tgz", + "integrity": "sha1-yhJMi5YD7hx/c581wS/O+8N3b2g=", + "dev": true, + "requires": { + "nopt": "3.x.x", + "npm": "2.x.x", + "npmlog": "1.x.x", + "semver": "4.x.x" + }, + "dependencies": { + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "semver": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", + "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", + "dev": true + } + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "q": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", + "integrity": "sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true + }, + "read": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", + "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", + "dev": true, + "requires": { + "mute-stream": "~0.0.4" + } + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "recast": { + "version": "0.10.33", + "resolved": "https://registry.npmjs.org/recast/-/recast-0.10.33.tgz", + "integrity": "sha1-lCgI96oBbx+nFCxGHX5XBKqo1pc=", + "dev": true, + "requires": { + "ast-types": "0.8.12", + "esprima-fb": "~15001.1001.0-dev-harmony-fb", + "private": "~0.1.5", + "source-map": "~0.5.0" + }, + "dependencies": { + "ast-types": { + "version": "0.8.12", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.8.12.tgz", + "integrity": "sha1-oNkOQ1G7iHcWyD/WN+v4GK9K38w=", + "dev": true + }, + "esprima-fb": { + "version": "15001.1001.0-dev-harmony-fb", + "resolved": "https://registry.npmjs.org/esprima-fb/-/esprima-fb-15001.1001.0-dev-harmony-fb.tgz", + "integrity": "sha1-Q761fsJujPI3092LM+QlM1d/Jlk=", + "dev": true + } + } + }, + "regenerate": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", + "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", + "dev": true + }, + "regenerator": { + "version": "0.8.40", + "resolved": "https://registry.npmjs.org/regenerator/-/regenerator-0.8.40.tgz", + "integrity": "sha1-oORXxY69uuV1yfjNdRJ+k3VkNdg=", + "dev": true, + "requires": { + "commoner": "~0.10.3", + "defs": "~1.1.0", + "esprima-fb": "~15001.1001.0-dev-harmony-fb", + "private": "~0.1.5", + "recast": "0.10.33", + "through": "~2.3.8" + }, + "dependencies": { + "esprima-fb": { + "version": "15001.1001.0-dev-harmony-fb", + "resolved": "https://registry.npmjs.org/esprima-fb/-/esprima-fb-15001.1001.0-dev-harmony-fb.tgz", + "integrity": "sha1-Q761fsJujPI3092LM+QlM1d/Jlk=", + "dev": true + } + } + }, + "regexp.prototype.flags": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.2.0.tgz", + "integrity": "sha512-ztaw4M1VqgMwl9HlPpOuiYgItcHlunW0He2fE6eNfT6E/CF2FtYi9ofOYe4mKntstYk0Fyh/rDRBdS3AnxjlrA==", + "dev": true, + "requires": { + "define-properties": "^1.1.2" + } + }, + "regexpu": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/regexpu/-/regexpu-1.3.0.tgz", + "integrity": "sha1-5TTcmRqeWEYFDJjebX3UpVyeoW0=", + "dev": true, + "requires": { + "esprima": "^2.6.0", + "recast": "^0.10.10", + "regenerate": "^1.2.1", + "regjsgen": "^0.2.0", + "regjsparser": "^0.1.4" + }, + "dependencies": { + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + } + } + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + } + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-1.1.3.tgz", + "integrity": "sha1-PUEUIYh3U3SU+X93+Xhfq4EPpKw=", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "requestretry": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/requestretry/-/requestretry-1.9.1.tgz", + "integrity": "sha1-CioATq8hGWnEzCz+vz/p5XuSx04=", + "requires": { + "extend": "^3.0.0", + "fg-lodash": "0.0.2", + "request": "^2.74.x", + "when": "~3.7.5" + } + }, + "requirefresh": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/requirefresh/-/requirefresh-2.2.0.tgz", + "integrity": "sha512-gXQWrZkXNZZ6qVEh6PQvoASxLY3r6AR4jH8fFjZ+BfPJpDV6RTI82J4A3tkAn2wikU7rxfzU3sIPj94zEV6xPA==", + "dev": true, + "requires": { + "editions": "^2.1.3" + }, + "dependencies": { + "editions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/editions/-/editions-2.2.0.tgz", + "integrity": "sha512-RYg3iEA2BDLCNVe8PUkD+ox5vAKxB9XS/mAhx1bdxGCF0CpX077C0pyTA9t5D6idCYA3avl5/XDHKPsHFrygfw==", + "dev": true, + "requires": { + "errlop": "^1.1.2", + "semver": "^6.3.0" + } + } + } + }, + "reserved-words": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/reserved-words/-/reserved-words-0.1.2.tgz", + "integrity": "sha1-AKCUD5jNUBrqqsMWQR2a3FKzGrE=", + "dev": true + }, + "resolve": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", + "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "revalidator": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/revalidator/-/revalidator-0.1.8.tgz", + "integrity": "sha1-/s5hv6DBtSoga9axgZgYS91SOjs=", + "dev": true + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true, + "requires": { + "align-text": "^0.1.1" + } + }, + "rimraf": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", + "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", + "dev": true + }, + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" + }, + "safefs": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/safefs/-/safefs-4.1.0.tgz", + "integrity": "sha1-+CrrS9165R9lPrIPZyizBYyNZEU=", + "dev": true, + "requires": { + "editions": "^1.1.1", + "graceful-fs": "^4.1.4" + }, + "dependencies": { + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + } + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sauce-tunnel": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/sauce-tunnel/-/sauce-tunnel-2.5.0.tgz", + "integrity": "sha1-DuTE/5tH4BPosHLL+sSVt/7Y6Os=", + "requires": { + "chalk": "^1.1.3", + "request": "^2.72.0", + "split": "^1.0.0" + } + }, + "saucelabs": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/saucelabs/-/saucelabs-1.5.0.tgz", + "integrity": "sha512-jlX3FGdWvYf4Q3LFfFWS1QvPg3IGCGWxIc8QBFdPTbpTJnt/v17FHXYVAn7C8sHf1yUXo2c7yIM0isDryfYtHQ==", + "requires": { + "https-proxy-agent": "^2.2.1" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "send": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", + "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "dev": true, + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.7.2", + "mime": "1.6.0", + "ms": "2.1.1", + "on-finished": "~2.3.0", + "range-parser": "~1.2.1", + "statuses": "~1.5.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + }, + "dependencies": { + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "http-errors": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", + "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==", + "dev": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.1.1", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "setprototypeof": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", + "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", + "dev": true + } + } + }, + "serve-index": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", + "dev": true, + "requires": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "serve-static": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", + "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "dev": true, + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.17.1" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shelljs": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", + "integrity": "sha1-NZbmMHp4FUT1kfN9phg2DzHbV7E=", + "dev": true + }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", + "dev": true + }, + "simple-fmt": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/simple-fmt/-/simple-fmt-0.1.0.tgz", + "integrity": "sha1-GRv1ZqWeZTBILLJatTtKjchcOms=", + "dev": true + }, + "simple-is": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/simple-is/-/simple-is-0.2.0.tgz", + "integrity": "sha1-Krt1qt453rXMgVzhDmGRFkhQuvA=", + "dev": true + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "sntp": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz", + "integrity": "sha1-+4hfGLDzqtGJ+CSGJTa87ux1CQA=", + "dev": true, + "requires": { + "hoek": "0.9.x" + }, + "dependencies": { + "hoek": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz", + "integrity": "sha1-PTIkYrrfB3Fup+uFuviAec3c5QU=", + "dev": true + } + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-support": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.2.10.tgz", + "integrity": "sha1-6lo5AKHByyUJagrozFwrSxDe09w=", + "dev": true, + "requires": { + "source-map": "0.1.32" + }, + "dependencies": { + "source-map": { + "version": "0.1.32", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.32.tgz", + "integrity": "sha1-yLbBZ3l7pHQKjqMyUhYv8IWRsmY=", + "dev": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "split": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", + "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", + "requires": { + "through": "2" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "stable": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", + "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", + "dev": true + }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", + "dev": true + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + }, + "stringmap": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/stringmap/-/stringmap-0.2.2.tgz", + "integrity": "sha1-VWwTeyWPlCuHdvWy71gqoGnX0bE=", + "dev": true + }, + "stringset": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/stringset/-/stringset-0.2.1.tgz", + "integrity": "sha1-7yWcTjSTRDd/zRyRPdLoSMnAQrU=", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-json-comments": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz", + "integrity": "sha1-HhX7ysl9Pumb8tc7TGVrCCu6+5E=", + "dev": true + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "tiny-lr-fork": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/tiny-lr-fork/-/tiny-lr-fork-0.0.5.tgz", + "integrity": "sha1-Hpnh4qhGm3NquX2X7vqYxx927Qo=", + "dev": true, + "requires": { + "debug": "~0.7.0", + "faye-websocket": "~0.4.3", + "noptify": "~0.0.3", + "qs": "~0.5.2" + }, + "dependencies": { + "debug": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz", + "integrity": "sha1-BuHqgILCyxTjmAbiLi9vdX+Srzk=", + "dev": true + }, + "qs": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/qs/-/qs-0.5.6.tgz", + "integrity": "sha1-MbGtBYVnZRxSaSFQa5qHk5EaA4Q=", + "dev": true + } + } + }, + "to-double-quotes": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-double-quotes/-/to-double-quotes-2.0.0.tgz", + "integrity": "sha1-qvIx1vqUiUn4GTAburRITYWI5Kc=", + "dev": true + }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + }, + "to-single-quotes": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/to-single-quotes/-/to-single-quotes-2.0.1.tgz", + "integrity": "sha1-fMKRUfD18sQZRvEZ9ZMv5VQXASU=", + "dev": true + }, + "toidentifier": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", + "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", + "dev": true + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + } + } + }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, + "try-resolve": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/try-resolve/-/try-resolve-1.0.1.tgz", + "integrity": "sha1-z95vq9ctY+V5fPqrhzq76OcA6RI=", + "dev": true + }, + "tryor": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tryor/-/tryor-0.1.2.tgz", + "integrity": "sha1-gUXkynyv9ArN48z5Rui4u3W0Fys=", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==", + "dev": true + }, + "typechecker": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/typechecker/-/typechecker-4.7.0.tgz", + "integrity": "sha512-4LHc1KMNJ6NDGO+dSM/yNfZQRtp8NN7psYrPHUblD62Dvkwsp3VShsbM78kOgpcmMkRTgvwdKOTjctS+uMllgQ==", + "dev": true, + "requires": { + "editions": "^2.1.0" + }, + "dependencies": { + "editions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/editions/-/editions-2.2.0.tgz", + "integrity": "sha512-RYg3iEA2BDLCNVe8PUkD+ox5vAKxB9XS/mAhx1bdxGCF0CpX077C0pyTA9t5D6idCYA3avl5/XDHKPsHFrygfw==", + "dev": true, + "requires": { + "errlop": "^1.1.2", + "semver": "^6.3.0" + } + } + } + }, + "underscore": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", + "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=", + "dev": true + }, + "underscore.string": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", + "integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0=" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, + "user-home": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", + "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "utile": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/utile/-/utile-0.2.1.tgz", + "integrity": "sha1-kwyI6ZCY1iIINMNWy9mncFItkNc=", + "dev": true, + "requires": { + "async": "~0.2.9", + "deep-equal": "*", + "i": "0.3.x", + "mkdirp": "0.x.x", + "ncp": "0.4.x", + "rimraf": "2.x.x" + }, + "dependencies": { + "async": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", + "dev": true + } + } + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "dev": true + }, + "uuid": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", + "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "vow": { + "version": "0.4.20", + "resolved": "https://registry.npmjs.org/vow/-/vow-0.4.20.tgz", + "integrity": "sha512-YYoSYXUYABqY08D/WrjcWJxJSErcILRRTQpcPyUc0SFfgIPKSUFzVt7u1HC3TXGJZM/qhsSjCLNQstxqf7asgQ==", + "dev": true + }, + "vow-fs": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/vow-fs/-/vow-fs-0.3.6.tgz", + "integrity": "sha1-LUxZviLivyYY3fWXq0uqkjvnIA0=", + "dev": true, + "requires": { + "glob": "^7.0.5", + "uuid": "^2.0.2", + "vow": "^0.4.7", + "vow-queue": "^0.4.1" + }, + "dependencies": { + "glob": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz", + "integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "uuid": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", + "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=", + "dev": true + } + } + }, + "vow-queue": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/vow-queue/-/vow-queue-0.4.3.tgz", + "integrity": "sha512-/poAKDTFL3zYbeQg7cl4BGcfP4sGgXKrHnRFSKj97dteUFu8oyXMwIcdwu8NSx/RmPGIuYx1Bik/y5vU4H/VKw==", + "dev": true, + "requires": { + "vow": "^0.4.17" + } + }, + "when": { + "version": "3.7.8", + "resolved": "https://registry.npmjs.org/when/-/when-3.7.8.tgz", + "integrity": "sha1-xxMLan6gRpPoQs3J56Hyqjmjn4I=" + }, + "which": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/which/-/which-1.0.9.tgz", + "integrity": "sha1-RgwdoPgQED0DIam2M6+eV15kSG8=", + "dev": true + }, + "window-size": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", + "integrity": "sha1-+OGqHuWlPsW/FR/6CXQqatdpeHY=", + "dev": true + }, + "winston": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/winston/-/winston-0.8.3.tgz", + "integrity": "sha1-ZLar9M0Brcrv1QCTk7HY6L7BnbA=", + "dev": true, + "requires": { + "async": "0.2.x", + "colors": "0.6.x", + "cycle": "1.0.x", + "eyes": "0.1.x", + "isstream": "0.1.x", + "pkginfo": "0.3.x", + "stack-trace": "0.0.x" + }, + "dependencies": { + "async": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", + "dev": true + }, + "colors": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", + "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=", + "dev": true + }, + "pkginfo": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz", + "integrity": "sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE=", + "dev": true + } + } + }, + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "xmlbuilder": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-3.1.0.tgz", + "integrity": "sha1-LIaIjy1OrehQ+jjKf3Ij9yCVFuE=", + "dev": true, + "requires": { + "lodash": "^3.5.0" + }, + "dependencies": { + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + } + } + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yargs": { + "version": "3.27.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.27.0.tgz", + "integrity": "sha1-ISBUaTFuk5Ex1Z8toMbX+YIh6kA=", + "dev": true, + "requires": { + "camelcase": "^1.2.1", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "os-locale": "^1.4.0", + "window-size": "^0.1.2", + "y18n": "^3.2.0" + } + } + } +} From 22947334ab3369eb4d82df7ab251ffddd5dc7aa8 Mon Sep 17 00:00:00 2001 From: Ralic Lo Date: Thu, 24 Oct 2019 22:16:40 +0800 Subject: [PATCH 2/4] Introduce Eslint with google's style --- .eslintrc.js | 20 + Gruntfile.js | 39 +- examples/custom/Gruntfile.js | 38 +- examples/jasmine/Gruntfile.js | 38 +- .../jasmine-jsreporter/jasmine-jsreporter.js | 286 +- examples/jasmine/lib/jasmine/jasmine-html.js | 310 +- examples/jasmine/lib/jasmine/jasmine.js | 571 +- examples/jasmine/spec/PlayerSpec.js | 28 +- examples/jasmine/spec/SpecHelper.js | 6 +- examples/jasmine/src/Player.js | 4 +- examples/jasmine/src/Song.js | 4 +- examples/mocha/Gruntfile.js | 38 +- examples/mocha/lib/expect/index.js | 857 +- examples/mocha/lib/mocha/mocha.js | 7156 ++++++++--------- examples/mocha/spec/tests.js | 6 +- examples/qunit/Gruntfile.js | 38 +- examples/qunit/lib/qunit/qunit.js | 4239 +++++----- examples/qunit/tests/test.js | 4 +- examples/yui/Gruntfile.js | 38 +- examples/yui/spec/tests.js | 83 +- grunt/aliases.js | 12 +- grunt/connect.js | 8 +- grunt/jscs.js | 6 +- grunt/jshint.js | 8 +- grunt/sauce_tunnel.js | 8 +- grunt/sauce_tunnel_stop.js | 8 +- grunt/saucelabs-custom.js | 95 +- grunt/saucelabs-jasmine.js | 13 +- grunt/saucelabs-mocha.js | 13 +- grunt/saucelabs-qunit.js | 17 +- grunt/watch.js | 2 +- package-lock.json | 2929 +++---- package.json | 12 +- src/Job.js | 170 +- src/TestRunner.js | 194 +- src/WrapperError.js | 20 +- src/utils.js | 60 +- tasks/saucelabs.js | 268 +- .../jasmine/lib/jasmine-1.3.1/jasmine-html.js | 310 +- test/jasmine/lib/jasmine-1.3.1/jasmine.js | 571 +- test/jasmine/lib/jasmine-jsreporter.js | 220 +- test/jasmine/spec/PlayerSpec.js | 28 +- test/jasmine/spec/SpecHelper.js | 6 +- test/jasmine/src/Player.js | 4 +- test/jasmine/src/Song.js | 4 +- test/mocha/index.js | 6 +- test/mocha/lib/browser/debug.js | 6 +- test/mocha/lib/browser/events.js | 34 +- test/mocha/lib/browser/progress.js | 50 +- test/mocha/lib/browser/tty.js | 4 +- test/mocha/lib/context.js | 12 +- test/mocha/lib/hook.js | 4 +- test/mocha/lib/interfaces/bdd.js | 47 +- test/mocha/lib/interfaces/exports.js | 12 +- test/mocha/lib/interfaces/qunit.js | 41 +- test/mocha/lib/interfaces/tdd.js | 45 +- test/mocha/lib/mocha.js | 113 +- test/mocha/lib/ms.js | 28 +- test/mocha/lib/reporters/base.js | 272 +- test/mocha/lib/reporters/doc.js | 20 +- test/mocha/lib/reporters/dot.js | 24 +- test/mocha/lib/reporters/html-cov.js | 22 +- test/mocha/lib/reporters/html.js | 124 +- test/mocha/lib/reporters/json-cov.js | 64 +- test/mocha/lib/reporters/json-stream.js | 30 +- test/mocha/lib/reporters/json.js | 42 +- test/mocha/lib/reporters/landing.js | 40 +- test/mocha/lib/reporters/list.js | 32 +- test/mocha/lib/reporters/markdown.js | 40 +- test/mocha/lib/reporters/min.js | 4 +- test/mocha/lib/reporters/nyan.js | 102 +- test/mocha/lib/reporters/progress.js | 34 +- test/mocha/lib/reporters/spec.js | 44 +- test/mocha/lib/reporters/tap.js | 30 +- test/mocha/lib/reporters/xunit.js | 62 +- test/mocha/lib/runnable.js | 62 +- test/mocha/lib/runner.js | 165 +- test/mocha/lib/suite.js | 56 +- test/mocha/lib/test.js | 2 +- test/mocha/lib/utils.js | 145 +- test/mocha/mocha.js | 7069 ++++++++-------- test/mocha/support/compile.js | 86 +- test/mocha/support/tail.js | 60 +- test/mocha/test/acceptance/context.js | 28 +- test/mocha/test/acceptance/diffs.js | 68 +- test/mocha/test/acceptance/duration.js | 34 +- test/mocha/test/acceptance/fs.js | 24 +- test/mocha/test/acceptance/glob/glob.js | 6 +- test/mocha/test/acceptance/globals.js | 22 +- test/mocha/test/acceptance/http.js | 18 +- test/mocha/test/acceptance/interfaces/bdd.js | 56 +- .../test/acceptance/interfaces/exports.js | 44 +- .../mocha/test/acceptance/interfaces/qunit.js | 12 +- test/mocha/test/acceptance/interfaces/tdd.js | 34 +- test/mocha/test/acceptance/misc/asyncOnly.js | 12 +- test/mocha/test/acceptance/misc/bail.js | 25 +- test/mocha/test/acceptance/misc/cascade.js | 64 +- test/mocha/test/acceptance/misc/exit.js | 16 +- test/mocha/test/acceptance/misc/grep.js | 28 +- test/mocha/test/acceptance/misc/many.js | 21 +- test/mocha/test/acceptance/misc/nontty.js | 14 +- test/mocha/test/acceptance/misc/only/bdd.js | 8 +- test/mocha/test/acceptance/misc/only/qunit.js | 2 +- test/mocha/test/acceptance/misc/only/tdd.js | 8 +- test/mocha/test/acceptance/multiple.done.js | 16 +- test/mocha/test/acceptance/pending.js | 6 +- test/mocha/test/acceptance/require/a.js | 4 +- test/mocha/test/acceptance/require/c.js | 4 +- test/mocha/test/acceptance/require/require.js | 8 +- test/mocha/test/acceptance/required-tokens.js | 14 +- test/mocha/test/acceptance/root.js | 14 +- test/mocha/test/acceptance/sort/alpha.js | 6 +- test/mocha/test/acceptance/sort/beta.js | 6 +- test/mocha/test/acceptance/timeout.js | 18 +- test/mocha/test/acceptance/uncaught.js | 18 +- test/mocha/test/acceptance/utils.js | 92 +- test/mocha/test/browser/array.js | 46 +- test/mocha/test/browser/large.js | 44 +- test/mocha/test/browser/opts.js | 2 +- test/mocha/test/compiler/foo.js | 8 +- test/mocha/test/grep.js | 54 +- test/mocha/test/hook.async.js | 184 +- test/mocha/test/hook.err.js | 303 +- test/mocha/test/hook.sync.js | 144 +- test/mocha/test/hook.sync.nested.js | 130 +- test/mocha/test/hook.timeout.js | 6 +- test/mocha/test/http.meta.2.js | 60 +- test/mocha/test/http.meta.js | 44 +- test/mocha/test/jsapi/index.js | 12 +- test/mocha/test/reporters/nyan.js | 32 +- test/mocha/test/runnable.js | 247 +- test/mocha/test/runner.js | 154 +- test/mocha/test/suite.js | 211 +- test/mocha/test/utils.js | 26 +- test/qunit/async.js | 6 +- test/qunit/deepEqual.js | 2812 +++---- test/qunit/logs.js | 301 +- test/qunit/narwhal-test.js | 32 +- test/qunit/node-test.js | 32 +- test/qunit/qunit.js | 4072 +++++----- test/qunit/swarminject.js | 14 +- test/qunit/test.js | 1398 ++-- test/yui/resources/qunit.js | 4018 +++++---- test/yui/resources/tests.js | 6 +- 144 files changed, 21582 insertions(+), 21388 deletions(-) create mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..48f5ace --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,20 @@ +module.exports = { + 'env': { + 'browser': true, + 'es6': true, + 'node': true, + }, + 'extends': [ + 'google', + ], + 'globals': { + 'Atomics': 'readonly', + 'SharedArrayBuffer': 'readonly', + }, + 'parserOptions': { + 'ecmaVersion': 2018, + 'sourceType': 'module', + }, + 'rules': { + }, +}; diff --git a/Gruntfile.js b/Gruntfile.js index 993b787..c12fb0a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,27 +1,26 @@ 'use strict'; -var packageJSON = require('./package.json'); +const packageJSON = require('./package.json'); -module.exports = function (grunt) { - - var utils = require('./src/utils')(grunt); - var tunnelId = Math.floor((new Date()).getTime() / 1000 - 1230768000).toString(); +module.exports = function(grunt) { + const utils = require('./src/utils')(grunt); + const tunnelId = Math.floor((new Date()).getTime() / 1000 - 1230768000).toString(); function negateResult(result, callback) { // Reverses the job's passed status. Can be used as the onTestComplete callback for // the negative tests. - var user = process.env.SAUCE_USERNAME; - var pass = process.env.SAUCE_ACCESS_KEY; + const user = process.env.SAUCE_USERNAME; + const pass = process.env.SAUCE_ACCESS_KEY; utils - .makeRequest({ - method: 'PUT', - url: ['https://saucelabs.com/rest/v1', user, 'jobs', result.job_id].join('/'), - auth: { user: user, pass: pass }, - json: { passed: !result.passed } - }) - .thenResolve(!result.passed) - .nodeify(callback); + .makeRequest({ + method: 'PUT', + url: ['https://saucelabs.com/rest/v1', user, 'jobs', result.job_id].join('/'), + auth: {user: user, pass: pass}, + json: {passed: !result.passed}, + }) + .thenResolve(!result.passed) + .nodeify(callback); } grunt.task.loadTasks('tasks'); @@ -35,14 +34,14 @@ module.exports = function (grunt) { build: process.env.TRAVIS_JOB_ID || 'dev-'+process.env.USER+':'+Date.now(), tags: ['v'+packageJSON.version, 'grunt-saucelabs'], browsers: [ - ['Windows 7', 'chrome', ''] + ['Windows 7', 'chrome', ''], ], tunneled: false, sauceConfig: { 'video-upload-on-pass': false, - 'tunnel-identifier': tunnelId - } - } - } + 'tunnel-identifier': tunnelId, + }, + }, + }, }); }; diff --git a/examples/custom/Gruntfile.js b/examples/custom/Gruntfile.js index 4b81b0d..aa7efb9 100644 --- a/examples/custom/Gruntfile.js +++ b/examples/custom/Gruntfile.js @@ -1,56 +1,56 @@ -module.exports = function (grunt) { - var browsers = [{ +module.exports = function(grunt) { + const browsers = [{ browserName: 'firefox', version: '19', - platform: 'XP' + platform: 'XP', }, { browserName: 'googlechrome', - platform: 'XP' + platform: 'XP', }, { browserName: 'googlechrome', - platform: 'linux' + platform: 'linux', }, { browserName: 'internet explorer', platform: 'WIN8', - version: '10' + version: '10', }, { browserName: 'internet explorer', platform: 'VISTA', - version: '9' + version: '9', }]; grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - connect: { + 'pkg': grunt.file.readJSON('package.json'), + 'connect': { server: { options: { base: '', - port: 9999 - } - } + port: 9999, + }, + }, }, 'saucelabs-custom': { all: { options: { urls: [ - 'http://127.0.0.1:9999/index.html' + 'http://127.0.0.1:9999/index.html', ], browsers: browsers, build: process.env.TRAVIS_JOB_ID, testname: 'custom tests', throttled: 3, sauceConfig: { - 'video-upload-on-pass': false - } - } - } + 'video-upload-on-pass': false, + }, + }, + }, }, - watch: {} + 'watch': {}, }); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-saucelabs'); grunt.registerTask('default', ['connect', 'saucelabs-custom']); -}; \ No newline at end of file +}; diff --git a/examples/jasmine/Gruntfile.js b/examples/jasmine/Gruntfile.js index 8ed1c1e..b7e29a7 100644 --- a/examples/jasmine/Gruntfile.js +++ b/examples/jasmine/Gruntfile.js @@ -1,33 +1,33 @@ -module.exports = function (grunt) { - var browsers = [{ +module.exports = function(grunt) { + const browsers = [{ browserName: 'firefox', version: '19', - platform: 'XP' + platform: 'XP', }, { browserName: 'googlechrome', - platform: 'XP' + platform: 'XP', }, { browserName: 'googlechrome', - platform: 'linux' + platform: 'linux', }, { browserName: 'internet explorer', platform: 'WIN8', - version: '10' + version: '10', }, { browserName: 'internet explorer', platform: 'VISTA', - version: '9' + version: '9', }]; grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - connect: { + 'pkg': grunt.file.readJSON('package.json'), + 'connect': { server: { options: { base: '', - port: 9999 - } - } + port: 9999, + }, + }, }, 'saucelabs-jasmine': { @@ -35,23 +35,23 @@ module.exports = function (grunt) { options: { urls: [ 'http://127.0.0.1:9999/SpecRunner.html', - 'http://127.0.0.1:9999/SpecRunnerDos.html' + 'http://127.0.0.1:9999/SpecRunnerDos.html', ], browsers: browsers, build: process.env.TRAVIS_JOB_ID, testname: 'jasmine tests', throttled: 3, sauceConfig: { - 'video-upload-on-pass': false - } - } - } + 'video-upload-on-pass': false, + }, + }, + }, }, - watch: {} + 'watch': {}, }); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-saucelabs'); grunt.registerTask('default', ['connect', 'saucelabs-jasmine']); -}; \ No newline at end of file +}; diff --git a/examples/jasmine/lib/jasmine-jsreporter/jasmine-jsreporter.js b/examples/jasmine/lib/jasmine-jsreporter/jasmine-jsreporter.js index a5f95bc..d113791 100644 --- a/examples/jasmine/lib/jasmine-jsreporter/jasmine-jsreporter.js +++ b/examples/jasmine/lib/jasmine-jsreporter/jasmine-jsreporter.js @@ -27,10 +27,9 @@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -(function (jasmine) { - +(function(jasmine) { if (!jasmine) { - throw new Error("[Jasmine JSReporter] 'Jasmine' library not found"); + throw new Error('[Jasmine JSReporter] \'Jasmine\' library not found'); } // ------------------------------------------------------------------------ @@ -42,8 +41,8 @@ * @param startMs Start time in Milliseconds * @param finishMs Finish time in Milliseconds * @return Elapsed time in Seconds */ - function elapsedSec (startMs, finishMs) { - return (finishMs - startMs) / 1000; + function elapsedSec(startMs, finishMs) { + return (finishMs - startMs) / 1000; } /** @@ -52,129 +51,129 @@ * @param amount Amount to round * @param numOfDecDigits Number of Digits to round to. Default value is '2'. * @return Rounded amount */ - function round (amount, numOfDecDigits) { - numOfDecDigits = numOfDecDigits || 2; - return Math.round(amount * Math.pow(10, numOfDecDigits)) / Math.pow(10, numOfDecDigits); + function round(amount, numOfDecDigits) { + numOfDecDigits = numOfDecDigits || 2; + return Math.round(amount * Math.pow(10, numOfDecDigits)) / Math.pow(10, numOfDecDigits); } /** * Create a new array which contains only the failed items. * @param items Items which will be filtered - * @returns {Array} of failed items */ - function failures (items) { - var fs = [], i, v; - for (i = 0; i < items.length; i += 1) { - v = items[i]; - if (!v.passed_) { - fs.push(v); - } + * @return {Array} of failed items */ + function failures(items) { + const fs = []; let i; let v; + for (i = 0; i < items.length; i += 1) { + v = items[i]; + if (!v.passed_) { + fs.push(v); } - return fs; + } + return fs; } /** * Collect information about a Suite, recursively, and return a JSON result. * @param suite The Jasmine Suite to get data from */ - function getSuiteData (suite) { - var suiteData = { - description : suite.description, - durationSec : 0, - specs: [], - suites: [], - passed: true - }, - specs = suite.specs(), - suites = suite.suites(), - i, ilen; - - // Loop over all the Suite's Specs - for (i = 0, ilen = specs.length; i < ilen; ++i) { - suiteData.specs[i] = { - description : specs[i].description, - durationSec : specs[i].durationSec, - passed : specs[i].results().passedCount === specs[i].results().totalCount, - skipped : specs[i].results().skipped, - passedCount : specs[i].results().passedCount, - failedCount : specs[i].results().failedCount, - totalCount : specs[i].results().totalCount, - failures: failures(specs[i].results().getItems()) - }; - suiteData.passed = !suiteData.specs[i].passed ? false : suiteData.passed; - suiteData.durationSec += suiteData.specs[i].durationSec; - } + function getSuiteData(suite) { + const suiteData = { + description: suite.description, + durationSec: 0, + specs: [], + suites: [], + passed: true, + }; + const specs = suite.specs(); + const suites = suite.suites(); + let i; let ilen; + + // Loop over all the Suite's Specs + for (i = 0, ilen = specs.length; i < ilen; ++i) { + suiteData.specs[i] = { + description: specs[i].description, + durationSec: specs[i].durationSec, + passed: specs[i].results().passedCount === specs[i].results().totalCount, + skipped: specs[i].results().skipped, + passedCount: specs[i].results().passedCount, + failedCount: specs[i].results().failedCount, + totalCount: specs[i].results().totalCount, + failures: failures(specs[i].results().getItems()), + }; + suiteData.passed = !suiteData.specs[i].passed ? false : suiteData.passed; + suiteData.durationSec += suiteData.specs[i].durationSec; + } - // Loop over all the Suite's sub-Suites - for (i = 0, ilen = suites.length; i < ilen; ++i) { - suiteData.suites[i] = getSuiteData(suites[i]); //< recursive population - suiteData.passed = !suiteData.suites[i].passed ? false : suiteData.passed; - suiteData.durationSec += suiteData.suites[i].durationSec; - } + // Loop over all the Suite's sub-Suites + for (i = 0, ilen = suites.length; i < ilen; ++i) { + suiteData.suites[i] = getSuiteData(suites[i]); // < recursive population + suiteData.passed = !suiteData.suites[i].passed ? false : suiteData.passed; + suiteData.durationSec += suiteData.suites[i].durationSec; + } - // Rounding duration numbers to 3 decimal digits - suiteData.durationSec = round(suiteData.durationSec, 4); + // Rounding duration numbers to 3 decimal digits + suiteData.durationSec = round(suiteData.durationSec, 4); - return suiteData; + return suiteData; } - var JSReporter = function () { + const JSReporter = function() { }; JSReporter.prototype = { - reportRunnerStarting: function (runner) { - // Nothing to do - }, - - reportSpecStarting: function (spec) { - // Start timing this spec - spec.startedAt = new Date(); - }, - - reportSpecResults: function (spec) { - // Finish timing this spec and calculate duration/delta (in sec) - spec.finishedAt = new Date(); - // If the spec was skipped, reportSpecStarting is never called and spec.startedAt is undefined - spec.durationSec = spec.startedAt ? elapsedSec(spec.startedAt.getTime(), spec.finishedAt.getTime()) : 0; - }, - - reportSuiteResults: function (suite) { - // Nothing to do - }, - - reportRunnerResults: function (runner) { - var suites = runner.suites(), - i, j, ilen; - - // Attach results to the "jasmine" object to make those results easy to scrap/find - jasmine.runnerResults = { - suites: [], - durationSec : 0, - passed : true - }; - - // Loop over all the Suites - for (i = 0, ilen = suites.length, j = 0; i < ilen; ++i) { - if (suites[i].parentSuite === null) { - jasmine.runnerResults.suites[j] = getSuiteData(suites[i]); - // If 1 suite fails, the whole runner fails - jasmine.runnerResults.passed = !jasmine.runnerResults.suites[j].passed ? false : jasmine.runnerResults.passed; - // Add up all the durations - jasmine.runnerResults.durationSec += jasmine.runnerResults.suites[j].durationSec; - j++; - } - } - - // Decorate the 'jasmine' object with getters - jasmine.getJSReport = function () { - if (jasmine.runnerResults) { - return jasmine.runnerResults; - } - return null; - }; - jasmine.getJSReportAsString = function () { - return JSON.stringify(jasmine.getJSReport()); - }; + reportRunnerStarting: function(runner) { + // Nothing to do + }, + + reportSpecStarting: function(spec) { + // Start timing this spec + spec.startedAt = new Date(); + }, + + reportSpecResults: function(spec) { + // Finish timing this spec and calculate duration/delta (in sec) + spec.finishedAt = new Date(); + // If the spec was skipped, reportSpecStarting is never called and spec.startedAt is undefined + spec.durationSec = spec.startedAt ? elapsedSec(spec.startedAt.getTime(), spec.finishedAt.getTime()) : 0; + }, + + reportSuiteResults: function(suite) { + // Nothing to do + }, + + reportRunnerResults: function(runner) { + const suites = runner.suites(); + let i; let j; let ilen; + + // Attach results to the "jasmine" object to make those results easy to scrap/find + jasmine.runnerResults = { + suites: [], + durationSec: 0, + passed: true, + }; + + // Loop over all the Suites + for (i = 0, ilen = suites.length, j = 0; i < ilen; ++i) { + if (suites[i].parentSuite === null) { + jasmine.runnerResults.suites[j] = getSuiteData(suites[i]); + // If 1 suite fails, the whole runner fails + jasmine.runnerResults.passed = !jasmine.runnerResults.suites[j].passed ? false : jasmine.runnerResults.passed; + // Add up all the durations + jasmine.runnerResults.durationSec += jasmine.runnerResults.suites[j].durationSec; + j++; + } } + + // Decorate the 'jasmine' object with getters + jasmine.getJSReport = function() { + if (jasmine.runnerResults) { + return jasmine.runnerResults; + } + return null; + }; + jasmine.getJSReportAsString = function() { + return JSON.stringify(jasmine.getJSReport()); + }; + }, }; // export public @@ -188,14 +187,14 @@ /* Simple timer implementation */ - var Timer = function () {}; + const Timer = function() {}; - Timer.prototype.start = function () { + Timer.prototype.start = function() { this.startTime = new Date().getTime(); return this; }; - Timer.prototype.elapsed = function () { + Timer.prototype.elapsed = function() { if (this.startTime == null) { return -1; } @@ -205,21 +204,21 @@ /* Utility methods */ - var _extend = function (obj1, obj2) { - for (var prop in obj2) { + const _extend = function(obj1, obj2) { + for (const prop in obj2) { obj1[prop] = obj2[prop]; } return obj1; }; - var _clone = function (obj) { + const _clone = function(obj) { if (obj !== Object(obj)) { return obj; } return _extend({}, obj); }; - jasmine.JSReporter2 = function () { - this.specs = {}; + jasmine.JSReporter2 = function() { + this.specs = {}; this.suites = {}; this.rootSuites = []; this.suiteStack = []; @@ -229,12 +228,12 @@ jasmine.getJSReportAsString = this.getJSReportAsString; }; - var JSR = jasmine.JSReporter2.prototype; + const JSR = jasmine.JSReporter2.prototype; // Reporter API methods // -------------------- - JSR.suiteStarted = function (suite) { + JSR.suiteStarted = function(suite) { suite = this._cacheSuite(suite); // build up suite tree as we go suite.specs = []; @@ -250,14 +249,14 @@ suite.timer = new Timer().start(); }; - JSR.suiteDone = function (suite) { + JSR.suiteDone = function(suite) { suite = this._cacheSuite(suite); suite.duration = suite.timer.elapsed(); suite.durationSec = suite.duration / 1000; this.suiteStack.pop(); // maintain parent suite state - var parent = this.suites[suite.parentId]; + const parent = this.suites[suite.parentId]; if (parent) { parent.passed = parent.passed && suite.passed; } @@ -269,7 +268,7 @@ delete suite.fullName; }; - JSR.specStarted = function (spec) { + JSR.specStarted = function(spec) { spec = this._cacheSpec(spec); spec.timer = new Timer().start(); // build up suites->spec tree as we go @@ -277,7 +276,7 @@ this.suites[spec.suiteId].specs.push(spec); }; - JSR.specDone = function (spec) { + JSR.specDone = function(spec) { spec = this._cacheSpec(spec); spec.duration = spec.timer.elapsed(); @@ -293,8 +292,8 @@ spec.failedCount = spec.failedExpectations.length; spec.failures = []; - for (var i = 0, j = spec.failedExpectations.length; i < j; i++) { - var fail = spec.failedExpectations[i]; + for (let i = 0, j = spec.failedExpectations.length; i < j; i++) { + const fail = spec.failedExpectations[i]; spec.failures.push({ type: 'expect', expected: fail.expected, @@ -302,13 +301,13 @@ message: fail.message, matcherName: fail.matcherName, trace: { - stack: fail.stack - } + stack: fail.stack, + }, }); } // maintain parent suite state - var parent = this.suites[spec.suiteId]; + const parent = this.suites[spec.suiteId]; if (spec.failed) { parent.failingSpecs.push(spec); } @@ -325,17 +324,17 @@ delete spec.failedExpectations; }; - JSR.jasmineDone = function () { + JSR.jasmineDone = function() { this._buildReport(); }; - JSR.getJSReport = function () { + JSR.getJSReport = function() { if (jasmine.jsReport) { return jasmine.jsReport; } }; - JSR.getJSReportAsString = function () { + JSR.getJSReportAsString = function() { if (jasmine.jsReport) { return JSON.stringify(jasmine.jsReport); } @@ -344,12 +343,12 @@ // Private methods // --------------- - JSR._haveSpec = function (spec) { + JSR._haveSpec = function(spec) { return this.specs[spec.id] != null; }; - JSR._cacheSpec = function (spec) { - var existing = this.specs[spec.id]; + JSR._cacheSpec = function(spec) { + let existing = this.specs[spec.id]; if (existing == null) { existing = this.specs[spec.id] = _clone(spec); } else { @@ -358,12 +357,12 @@ return existing; }; - JSR._haveSuite = function (suite) { + JSR._haveSuite = function(suite) { return this.suites[suite.id] != null; }; - JSR._cacheSuite = function (suite) { - var existing = this.suites[suite.id]; + JSR._cacheSuite = function(suite) { + let existing = this.suites[suite.id]; if (existing == null) { existing = this.suites[suite.id] = _clone(suite); } else { @@ -372,13 +371,13 @@ return existing; }; - JSR._buildReport = function () { - var overallDuration = 0; - var overallPassed = true; - var overallSuites = []; + JSR._buildReport = function() { + let overallDuration = 0; + let overallPassed = true; + const overallSuites = []; - for (var i = 0, j = this.rootSuites.length; i < j; i++) { - var suite = this.suites[this.rootSuites[i]]; + for (let i = 0, j = this.rootSuites.length; i < j; i++) { + const suite = this.suites[this.rootSuites[i]]; overallDuration += suite.duration; overallPassed = overallPassed && suite.passed; overallSuites.push(suite); @@ -387,8 +386,7 @@ jasmine.jsReport = { passed: overallPassed, durationSec: overallDuration / 1000, - suites: overallSuites + suites: overallSuites, }; }; - -})(jasmine); \ No newline at end of file +})(jasmine); diff --git a/examples/jasmine/lib/jasmine/jasmine-html.js b/examples/jasmine/lib/jasmine/jasmine-html.js index 543d569..a53d611 100644 --- a/examples/jasmine/lib/jasmine/jasmine-html.js +++ b/examples/jasmine/lib/jasmine/jasmine-html.js @@ -1,10 +1,10 @@ jasmine.HtmlReporterHelpers = {}; jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) { - var el = document.createElement(type); + const el = document.createElement(type); - for (var i = 2; i < arguments.length; i++) { - var child = arguments[i]; + for (let i = 2; i < arguments.length; i++) { + const child = arguments[i]; if (typeof child === 'string') { el.appendChild(document.createTextNode(child)); @@ -15,8 +15,8 @@ jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) { } } - for (var attr in attrs) { - if (attr == "className") { + for (const attr in attrs) { + if (attr == 'className') { el[attr] = attrs[attr]; } else { el.setAttribute(attr, attrs[attr]); @@ -27,8 +27,8 @@ jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) { }; jasmine.HtmlReporterHelpers.getSpecStatus = function(child) { - var results = child.results(); - var status = results.passed() ? 'passed' : 'failed'; + const results = child.results(); + let status = results.passed() ? 'passed' : 'failed'; if (results.skipped) { status = 'skipped'; } @@ -37,9 +37,9 @@ jasmine.HtmlReporterHelpers.getSpecStatus = function(child) { }; jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) { - var parentDiv = this.dom.summary; - var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite'; - var parent = child[parentSuite]; + let parentDiv = this.dom.summary; + const parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite'; + const parent = child[parentSuite]; if (parent) { if (typeof this.views.suites[parent.id] == 'undefined') { @@ -53,24 +53,24 @@ jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) { jasmine.HtmlReporterHelpers.addHelpers = function(ctor) { - for(var fn in jasmine.HtmlReporterHelpers) { + for (const fn in jasmine.HtmlReporterHelpers) { ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn]; } }; jasmine.HtmlReporter = function(_doc) { - var self = this; - var doc = _doc || window.document; + const self = this; + const doc = _doc || window.document; - var reporterView; + let reporterView; - var dom = {}; + const dom = {}; // Jasmine Reporter Public Interface self.logRunningSpecs = false; self.reportRunnerStarting = function(runner) { - var specs = runner.specs() || []; + const specs = runner.specs() || []; if (specs.length == 0) { return; @@ -103,7 +103,7 @@ jasmine.HtmlReporter = function(_doc) { }; self.log = function() { - var console = jasmine.getGlobal().console; + const console = jasmine.getGlobal().console; if (console && console.log) { if (console.log.apply) { console.log.apply(console, arguments); @@ -124,18 +124,18 @@ jasmine.HtmlReporter = function(_doc) { return self; function focusedSpecName() { - var specName; + let specName; (function memoizeFocusedSpec() { if (specName) { return; } - var paramMap = []; - var params = jasmine.HtmlReporter.parameters(doc); + const paramMap = []; + const params = jasmine.HtmlReporter.parameters(doc); - for (var i = 0; i < params.length; i++) { - var p = params[i].split('='); + for (let i = 0; i < params.length; i++) { + const p = params[i].split('='); paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); } @@ -146,19 +146,19 @@ jasmine.HtmlReporter = function(_doc) { } function createReporterDom(version) { - dom.reporter = self.createDom('div', { id: 'HTMLReporter', className: 'jasmine_reporter' }, - dom.banner = self.createDom('div', { className: 'banner' }, - self.createDom('span', { className: 'title' }, "Jasmine "), - self.createDom('span', { className: 'version' }, version)), - - dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}), - dom.alert = self.createDom('div', {className: 'alert'}, - self.createDom('span', { className: 'exceptions' }, - self.createDom('label', { className: 'label', 'for': 'no_try_catch' }, 'No try/catch'), - self.createDom('input', { id: 'no_try_catch', type: 'checkbox' }))), - dom.results = self.createDom('div', {className: 'results'}, - dom.summary = self.createDom('div', { className: 'summary' }), - dom.details = self.createDom('div', { id: 'details' })) + dom.reporter = self.createDom('div', {id: 'HTMLReporter', className: 'jasmine_reporter'}, + dom.banner = self.createDom('div', {className: 'banner'}, + self.createDom('span', {className: 'title'}, 'Jasmine '), + self.createDom('span', {className: 'version'}, version)), + + dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}), + dom.alert = self.createDom('div', {className: 'alert'}, + self.createDom('span', {className: 'exceptions'}, + self.createDom('label', {'className': 'label', 'for': 'no_try_catch'}, 'No try/catch'), + self.createDom('input', {id: 'no_try_catch', type: 'checkbox'}))), + dom.results = self.createDom('div', {className: 'results'}, + dom.summary = self.createDom('div', {className: 'summary'}), + dom.details = self.createDom('div', {id: 'details'})) ); } @@ -167,9 +167,9 @@ jasmine.HtmlReporter = function(_doc) { } function searchWithCatch() { - var params = jasmine.HtmlReporter.parameters(window.document); - var removed = false; - var i = 0; + const params = jasmine.HtmlReporter.parameters(window.document); + let removed = false; + let i = 0; while (!removed && i < params.length) { if (params[i].match(/catch=/)) { @@ -179,14 +179,14 @@ jasmine.HtmlReporter = function(_doc) { i++; } if (jasmine.CATCH_EXCEPTIONS) { - params.push("catch=false"); + params.push('catch=false'); } - return params.join("&"); + return params.join('&'); } function setExceptionHandling() { - var chxCatch = document.getElementById('no_try_catch'); + const chxCatch = document.getElementById('no_try_catch'); if (noTryCatch()) { chxCatch.setAttribute('checked', true); @@ -198,26 +198,26 @@ jasmine.HtmlReporter = function(_doc) { } }; jasmine.HtmlReporter.parameters = function(doc) { - var paramStr = doc.location.search.substring(1); - var params = []; + const paramStr = doc.location.search.substring(1); + let params = []; if (paramStr.length > 0) { params = paramStr.split('&'); } return params; -} +}; jasmine.HtmlReporter.sectionLink = function(sectionName) { - var link = '?'; - var params = []; + let link = '?'; + const params = []; if (sectionName) { params.push('spec=' + encodeURIComponent(sectionName)); } if (!jasmine.CATCH_EXCEPTIONS) { - params.push("catch=false"); + params.push('catch=false'); } if (params.length > 0) { - link += params.join("&"); + link += params.join('&'); } return link; @@ -233,9 +233,9 @@ jasmine.HtmlReporter.ReporterView = function(dom) { this.createResultsMenu = function() { this.resultsMenu = this.createDom('span', {className: 'resultsMenu bar'}, - this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: "#"}, '0 specs'), - ' | ', - this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: "#"}, '0 failing')); + this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: '#'}, '0 specs'), + ' | ', + this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: '#'}, '0 failing')); this.summaryMenuItem.onclick = function() { dom.reporter.className = dom.reporter.className.replace(/ showDetails/g, ''); @@ -251,11 +251,11 @@ jasmine.HtmlReporter.ReporterView = function(dom) { this.views = { specs: {}, - suites: {} + suites: {}, }; - for (var i = 0; i < specs.length; i++) { - var spec = specs[i]; + for (let i = 0; i < specs.length; i++) { + const spec = specs[i]; this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom, this.views); if (specFilter(spec)) { this.runningSpecCount++; @@ -270,7 +270,7 @@ jasmine.HtmlReporter.ReporterView = function(dom) { this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom); } - var specView = this.views.specs[spec.id]; + const specView = this.views.specs[spec.id]; switch (specView.status()) { case 'passed': @@ -291,7 +291,7 @@ jasmine.HtmlReporter.ReporterView = function(dom) { }; this.suiteComplete = function(suite) { - var suiteView = this.views.suites[suite.id]; + const suiteView = this.views.suites[suite.id]; if (isUndefined(suiteView)) { return; } @@ -299,24 +299,23 @@ jasmine.HtmlReporter.ReporterView = function(dom) { }; this.refresh = function() { - if (isUndefined(this.resultsMenu)) { this.createResultsMenu(); } // currently running UI if (isUndefined(this.runningAlert)) { - this.runningAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "runningAlert bar" }); + this.runningAlert = this.createDom('a', {href: jasmine.HtmlReporter.sectionLink(), className: 'runningAlert bar'}); dom.alert.appendChild(this.runningAlert); } - this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + specPluralizedFor(this.totalSpecCount); + this.runningAlert.innerHTML = 'Running ' + this.completeSpecCount + ' of ' + specPluralizedFor(this.totalSpecCount); // skipped specs UI if (isUndefined(this.skippedAlert)) { - this.skippedAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "skippedAlert bar" }); + this.skippedAlert = this.createDom('a', {href: jasmine.HtmlReporter.sectionLink(), className: 'skippedAlert bar'}); } - this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all"; + this.skippedAlert.innerHTML = 'Skipping ' + this.skippedCount + ' of ' + specPluralizedFor(this.totalSpecCount) + ' - run all'; if (this.skippedCount === 1 && isDefined(dom.alert)) { dom.alert.appendChild(this.skippedAlert); @@ -324,15 +323,15 @@ jasmine.HtmlReporter.ReporterView = function(dom) { // passing specs UI if (isUndefined(this.passedAlert)) { - this.passedAlert = this.createDom('span', { href: jasmine.HtmlReporter.sectionLink(), className: "passingAlert bar" }); + this.passedAlert = this.createDom('span', {href: jasmine.HtmlReporter.sectionLink(), className: 'passingAlert bar'}); } - this.passedAlert.innerHTML = "Passing " + specPluralizedFor(this.passedCount); + this.passedAlert.innerHTML = 'Passing ' + specPluralizedFor(this.passedCount); // failing specs UI if (isUndefined(this.failedAlert)) { - this.failedAlert = this.createDom('span', {href: "?", className: "failingAlert bar"}); + this.failedAlert = this.createDom('span', {href: '?', className: 'failingAlert bar'}); } - this.failedAlert.innerHTML = "Failing " + specPluralizedFor(this.failedCount); + this.failedAlert.innerHTML = 'Failing ' + specPluralizedFor(this.failedCount); if (this.failedCount === 1 && isDefined(dom.alert)) { dom.alert.appendChild(this.failedAlert); @@ -340,29 +339,29 @@ jasmine.HtmlReporter.ReporterView = function(dom) { } // summary info - this.summaryMenuItem.innerHTML = "" + specPluralizedFor(this.runningSpecCount); - this.detailsMenuItem.innerHTML = "" + this.failedCount + " failing"; + this.summaryMenuItem.innerHTML = '' + specPluralizedFor(this.runningSpecCount); + this.detailsMenuItem.innerHTML = '' + this.failedCount + ' failing'; }; this.complete = function() { dom.alert.removeChild(this.runningAlert); - this.skippedAlert.innerHTML = "Ran " + this.runningSpecCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all"; + this.skippedAlert.innerHTML = 'Ran ' + this.runningSpecCount + ' of ' + specPluralizedFor(this.totalSpecCount) + ' - run all'; if (this.failedCount === 0) { - dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, "Passing " + specPluralizedFor(this.passedCount))); + dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, 'Passing ' + specPluralizedFor(this.passedCount))); } else { showDetails(); } - dom.banner.appendChild(this.createDom('span', {className: 'duration'}, "finished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s")); + dom.banner.appendChild(this.createDom('span', {className: 'duration'}, 'finished in ' + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + 's')); }; return this; function showDetails() { if (dom.reporter.className.search(/showDetails/) === -1) { - dom.reporter.className += " showDetails"; + dom.reporter.className += ' showDetails'; } } @@ -375,13 +374,12 @@ jasmine.HtmlReporter.ReporterView = function(dom) { } function specPluralizedFor(count) { - var str = count + " spec"; + let str = count + ' spec'; if (count > 1) { - str += "s" + str += 's'; } return str; } - }; jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.ReporterView); @@ -392,22 +390,22 @@ jasmine.HtmlReporter.SpecView = function(spec, dom, views) { this.dom = dom; this.views = views; - this.symbol = this.createDom('li', { className: 'pending' }); + this.symbol = this.createDom('li', {className: 'pending'}); this.dom.symbolSummary.appendChild(this.symbol); - this.summary = this.createDom('div', { className: 'specSummary' }, - this.createDom('a', { - className: 'description', - href: jasmine.HtmlReporter.sectionLink(this.spec.getFullName()), - title: this.spec.getFullName() - }, this.spec.description) + this.summary = this.createDom('div', {className: 'specSummary'}, + this.createDom('a', { + className: 'description', + href: jasmine.HtmlReporter.sectionLink(this.spec.getFullName()), + title: this.spec.getFullName(), + }, this.spec.description) ); - this.detail = this.createDom('div', { className: 'specDetail' }, + this.detail = this.createDom('div', {className: 'specDetail'}, this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(this.spec.getFullName()), - title: this.spec.getFullName() + title: this.spec.getFullName(), }, this.spec.getFullName()) ); }; @@ -442,11 +440,11 @@ jasmine.HtmlReporter.SpecView.prototype.appendSummaryToSuiteDiv = function() { jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() { this.detail.className += ' ' + this.status(); - var resultItems = this.spec.results().getItems(); - var messagesDiv = this.createDom('div', { className: 'messages' }); + const resultItems = this.spec.results().getItems(); + const messagesDiv = this.createDom('div', {className: 'messages'}); - for (var i = 0; i < resultItems.length; i++) { - var result = resultItems[i]; + for (let i = 0; i < resultItems.length; i++) { + const result = resultItems[i]; if (result.type == 'log') { messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString())); @@ -465,13 +463,13 @@ jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() { } }; -jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);jasmine.HtmlReporter.SuiteView = function(suite, dom, views) { +jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView); jasmine.HtmlReporter.SuiteView = function(suite, dom, views) { this.suite = suite; this.dom = dom; this.views = views; - this.element = this.createDom('div', { className: 'suite' }, - this.createDom('a', { className: 'description', href: jasmine.HtmlReporter.sectionLink(this.suite.getFullName()) }, this.suite.description) + this.element = this.createDom('div', {className: 'suite'}, + this.createDom('a', {className: 'description', href: jasmine.HtmlReporter.sectionLink(this.suite.getFullName())}, this.suite.description) ); this.appendToSummary(this.suite, this.element); @@ -482,7 +480,7 @@ jasmine.HtmlReporter.SuiteView.prototype.status = function() { }; jasmine.HtmlReporter.SuiteView.prototype.refresh = function() { - this.element.className += " " + this.status(); + this.element.className += ' ' + this.status(); }; jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SuiteView); @@ -496,20 +494,22 @@ jasmine.TrivialReporter = function(doc) { }; jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) { - var el = document.createElement(type); + const el = document.createElement(type); - for (var i = 2; i < arguments.length; i++) { - var child = arguments[i]; + for (let i = 2; i < arguments.length; i++) { + const child = arguments[i]; if (typeof child === 'string') { el.appendChild(document.createTextNode(child)); } else { - if (child) { el.appendChild(child); } + if (child) { + el.appendChild(child); + } } } - for (var attr in attrs) { - if (attr == "className") { + for (const attr in attrs) { + if (attr == 'className') { el[attr] = attrs[attr]; } else { el.setAttribute(attr, attrs[attr]); @@ -520,38 +520,38 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA }; jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { - var showPassed, showSkipped; - - this.outerDiv = this.createDom('div', { id: 'TrivialReporter', className: 'jasmine_reporter' }, - this.createDom('div', { className: 'banner' }, - this.createDom('div', { className: 'logo' }, - this.createDom('span', { className: 'title' }, "Jasmine"), - this.createDom('span', { className: 'version' }, runner.env.versionString())), - this.createDom('div', { className: 'options' }, - "Show ", - showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }), - this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "), - showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }), - this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped") - ) - ), - - this.runnerDiv = this.createDom('div', { className: 'runner running' }, - this.createDom('a', { className: 'run_spec', href: '?' }, "run all"), - this.runnerMessageSpan = this.createDom('span', {}, "Running..."), - this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, "")) - ); + let showPassed; let showSkipped; + + this.outerDiv = this.createDom('div', {id: 'TrivialReporter', className: 'jasmine_reporter'}, + this.createDom('div', {className: 'banner'}, + this.createDom('div', {className: 'logo'}, + this.createDom('span', {className: 'title'}, 'Jasmine'), + this.createDom('span', {className: 'version'}, runner.env.versionString())), + this.createDom('div', {className: 'options'}, + 'Show ', + showPassed = this.createDom('input', {id: '__jasmine_TrivialReporter_showPassed__', type: 'checkbox'}), + this.createDom('label', {'for': '__jasmine_TrivialReporter_showPassed__'}, ' passed '), + showSkipped = this.createDom('input', {id: '__jasmine_TrivialReporter_showSkipped__', type: 'checkbox'}), + this.createDom('label', {'for': '__jasmine_TrivialReporter_showSkipped__'}, ' skipped') + ) + ), + + this.runnerDiv = this.createDom('div', {className: 'runner running'}, + this.createDom('a', {className: 'run_spec', href: '?'}, 'run all'), + this.runnerMessageSpan = this.createDom('span', {}, 'Running...'), + this.finishedAtSpan = this.createDom('span', {className: 'finished-at'}, '')) + ); this.document.body.appendChild(this.outerDiv); - var suites = runner.suites(); - for (var i = 0; i < suites.length; i++) { - var suite = suites[i]; - var suiteDiv = this.createDom('div', { className: 'suite' }, - this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"), - this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description)); + const suites = runner.suites(); + for (let i = 0; i < suites.length; i++) { + const suite = suites[i]; + const suiteDiv = this.createDom('div', {className: 'suite'}, + this.createDom('a', {className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName())}, 'run'), + this.createDom('a', {className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName())}, suite.description)); this.suiteDivs[suite.id] = suiteDiv; - var parentDiv = this.outerDiv; + let parentDiv = this.outerDiv; if (suite.parentSuite) { parentDiv = this.suiteDivs[suite.parentSuite.id]; } @@ -560,7 +560,7 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { this.startedAt = new Date(); - var self = this; + const self = this; showPassed.onclick = function(evt) { if (showPassed.checked) { self.outerDiv.className += ' show-passed'; @@ -579,32 +579,32 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { }; jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { - var results = runner.results(); - var className = (results.failedCount > 0) ? "runner failed" : "runner passed"; - this.runnerDiv.setAttribute("class", className); - //do it twice for IE - this.runnerDiv.setAttribute("className", className); - var specs = runner.specs(); - var specCount = 0; - for (var i = 0; i < specs.length; i++) { + const results = runner.results(); + const className = (results.failedCount > 0) ? 'runner failed' : 'runner passed'; + this.runnerDiv.setAttribute('class', className); + // do it twice for IE + this.runnerDiv.setAttribute('className', className); + const specs = runner.specs(); + let specCount = 0; + for (let i = 0; i < specs.length; i++) { if (this.specFilter(specs[i])) { specCount++; } } - var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); - message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"; - this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild); + let message = '' + specCount + ' spec' + (specCount == 1 ? '' : 's' ) + ', ' + results.failedCount + ' failure' + ((results.failedCount == 1) ? '' : 's'); + message += ' in ' + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + 's'; + this.runnerMessageSpan.replaceChild(this.createDom('a', {className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild); - this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString())); + this.finishedAtSpan.appendChild(document.createTextNode('Finished at ' + new Date().toString())); }; jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { - var results = suite.results(); - var status = results.passed() ? 'passed' : 'failed'; + const results = suite.results(); + let status = results.passed() ? 'passed' : 'failed'; if (results.totalCount === 0) { // todo: change this to check results.skipped status = 'skipped'; } - this.suiteDivs[suite.id].className += " " + status; + this.suiteDivs[suite.id].className += ' ' + status; }; jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) { @@ -614,24 +614,24 @@ jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) { }; jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { - var results = spec.results(); - var status = results.passed() ? 'passed' : 'failed'; + const results = spec.results(); + let status = results.passed() ? 'passed' : 'failed'; if (results.skipped) { status = 'skipped'; } - var specDiv = this.createDom('div', { className: 'spec ' + status }, - this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), + const specDiv = this.createDom('div', {className: 'spec ' + status}, + this.createDom('a', {className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName())}, 'run'), this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(spec.getFullName()), - title: spec.getFullName() + title: spec.getFullName(), }, spec.description)); - var resultItems = results.getItems(); - var messagesDiv = this.createDom('div', { className: 'messages' }); - for (var i = 0; i < resultItems.length; i++) { - var result = resultItems[i]; + const resultItems = results.getItems(); + const messagesDiv = this.createDom('div', {className: 'messages'}); + for (let i = 0; i < resultItems.length; i++) { + const result = resultItems[i]; if (result.type == 'log') { messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString())); @@ -652,7 +652,7 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { }; jasmine.TrivialReporter.prototype.log = function() { - var console = jasmine.getGlobal().console; + const console = jasmine.getGlobal().console; if (console && console.log) { if (console.log.apply) { console.log.apply(console, arguments); @@ -667,10 +667,10 @@ jasmine.TrivialReporter.prototype.getLocation = function() { }; jasmine.TrivialReporter.prototype.specFilter = function(spec) { - var paramMap = {}; - var params = this.getLocation().search.substring(1).split('&'); - for (var i = 0; i < params.length; i++) { - var p = params[i].split('='); + const paramMap = {}; + const params = this.getLocation().search.substring(1).split('&'); + for (let i = 0; i < params.length; i++) { + const p = params[i].split('='); paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); } diff --git a/examples/jasmine/lib/jasmine/jasmine.js b/examples/jasmine/lib/jasmine/jasmine.js index 6b3459b..df018ca 100644 --- a/examples/jasmine/lib/jasmine/jasmine.js +++ b/examples/jasmine/lib/jasmine/jasmine.js @@ -1,17 +1,17 @@ -var isCommonJS = typeof window == "undefined" && typeof exports == "object"; +const isCommonJS = typeof window == 'undefined' && typeof exports == 'object'; /** * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework. * * @namespace */ -var jasmine = {}; +const jasmine = {}; if (isCommonJS) exports.jasmine = jasmine; /** * @private */ jasmine.unimplementedMethod_ = function() { - throw new Error("unimplemented method"); + throw new Error('unimplemented method'); }; /** @@ -68,7 +68,7 @@ jasmine.getGlobal = function() { * @param name {Function} function to find */ jasmine.bindOriginal_ = function(base, name) { - var original = base[name]; + const original = base[name]; if (original.apply) { return function() { return original.apply(base, arguments); @@ -91,9 +91,9 @@ jasmine.MessageResult = function(values) { }; jasmine.MessageResult.prototype.toString = function() { - var text = ""; - for (var i = 0; i < this.values.length; i++) { - if (i > 0) text += " "; + let text = ''; + for (let i = 0; i < this.values.length; i++) { + if (i > 0) text += ' '; if (jasmine.isString_(this.values[i])) { text += this.values[i]; } else { @@ -111,15 +111,15 @@ jasmine.ExpectationResult = function(params) { this.actual = params.actual; this.message = this.passed_ ? 'Passed.' : params.message; - var trace = (params.trace || new Error(this.message)); + const trace = (params.trace || new Error(this.message)); this.trace = this.passed_ ? '' : trace; }; -jasmine.ExpectationResult.prototype.toString = function () { +jasmine.ExpectationResult.prototype.toString = function() { return this.message; }; -jasmine.ExpectationResult.prototype.passed = function () { +jasmine.ExpectationResult.prototype.passed = function() { return this.passed_; }; @@ -127,7 +127,7 @@ jasmine.ExpectationResult.prototype.passed = function () { * Getter for the Jasmine environment. Ensures one gets created */ jasmine.getEnv = function() { - var env = jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env(); + const env = jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env(); return env; }; @@ -135,30 +135,30 @@ jasmine.getEnv = function() { * @ignore * @private * @param value - * @returns {Boolean} + * @return {Boolean} */ jasmine.isArray_ = function(value) { - return jasmine.isA_("Array", value); + return jasmine.isA_('Array', value); }; /** * @ignore * @private * @param value - * @returns {Boolean} + * @return {Boolean} */ jasmine.isString_ = function(value) { - return jasmine.isA_("String", value); + return jasmine.isA_('String', value); }; /** * @ignore * @private * @param value - * @returns {Boolean} + * @return {Boolean} */ jasmine.isNumber_ = function(value) { - return jasmine.isA_("Number", value); + return jasmine.isA_('Number', value); }; /** @@ -166,7 +166,7 @@ jasmine.isNumber_ = function(value) { * @private * @param {String} typeName * @param value - * @returns {Boolean} + * @return {Boolean} */ jasmine.isA_ = function(typeName, value) { return Object.prototype.toString.apply(value) === '[object ' + typeName + ']'; @@ -176,10 +176,10 @@ jasmine.isA_ = function(typeName, value) { * Pretty printer for expecations. Takes any object and turns it into a human-readable string. * * @param value {Object} an object to be outputted - * @returns {String} + * @return {String} */ jasmine.pp = function(value) { - var stringPrettyPrinter = new jasmine.StringPrettyPrinter(); + const stringPrettyPrinter = new jasmine.StringPrettyPrinter(); stringPrettyPrinter.format(value); return stringPrettyPrinter.string; }; @@ -188,7 +188,7 @@ jasmine.pp = function(value) { * Returns true if the object is a DOM Node. * * @param {Object} obj object to check - * @returns {Boolean} + * @return {Boolean} */ jasmine.isDomNode = function(obj) { return obj.nodeType > 0; @@ -202,7 +202,7 @@ jasmine.isDomNode = function(obj) { * expect(mySpy).toHaveBeenCalledWith(jasmine.any(Function)); * * @param {Class} clazz - * @returns matchable object of the type clazz + * @return matchable object of the type clazz */ jasmine.any = function(clazz) { return new jasmine.Matchers.Any(clazz); @@ -217,10 +217,10 @@ jasmine.any = function(clazz) { * expect(mySpy).toHaveBeenCalledWith(jasmine.objectContaining({foo: "bar"}); * * @param sample {Object} sample - * @returns matchable object for the sample + * @return matchable object for the sample */ -jasmine.objectContaining = function (sample) { - return new jasmine.Matchers.ObjectContaining(sample); +jasmine.objectContaining = function(sample) { + return new jasmine.Matchers.ObjectContaining(sample); }; /** @@ -401,11 +401,10 @@ jasmine.Spy.prototype.reset = function() { }; jasmine.createSpy = function(name) { - var spyObj = function() { spyObj.wasCalled = true; spyObj.callCount++; - var args = jasmine.util.argsToArray(arguments); + const args = jasmine.util.argsToArray(arguments); spyObj.mostRecentCall.object = this; spyObj.mostRecentCall.args = args; spyObj.argsForCall.push(args); @@ -413,9 +412,9 @@ jasmine.createSpy = function(name) { return spyObj.plan.apply(this, arguments); }; - var spy = new jasmine.Spy(name); + const spy = new jasmine.Spy(name); - for (var prop in spy) { + for (const prop in spy) { spyObj[prop] = spy[prop]; } @@ -428,7 +427,7 @@ jasmine.createSpy = function(name) { * Determines whether an object is a spy. * * @param {jasmine.Spy|Object} putativeSpy - * @returns {Boolean} + * @return {Boolean} */ jasmine.isSpy = function(putativeSpy) { return putativeSpy && putativeSpy.isSpy; @@ -445,8 +444,8 @@ jasmine.createSpyObj = function(baseName, methodNames) { if (!jasmine.isArray_(methodNames) || methodNames.length === 0) { throw new Error('createSpyObj requires a non-empty array of method names to create spies for'); } - var obj = {}; - for (var i = 0; i < methodNames.length; i++) { + const obj = {}; + for (let i = 0; i < methodNames.length; i++) { obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]); } return obj; @@ -458,7 +457,7 @@ jasmine.createSpyObj = function(baseName, methodNames) { * Be careful not to leave calls to jasmine.log in production code. */ jasmine.log = function() { - var spec = jasmine.getEnv().currentSpec; + const spec = jasmine.getEnv().currentSpec; spec.log.apply(spec, arguments); }; @@ -477,7 +476,7 @@ jasmine.log = function() { * @param methodName * @return {jasmine.Spy} a Jasmine spy that can be chained with all spy methods */ -var spyOn = function(obj, methodName) { +const spyOn = function(obj, methodName) { return jasmine.getEnv().currentSpec.spyOn(obj, methodName); }; if (isCommonJS) exports.spyOn = spyOn; @@ -495,7 +494,7 @@ if (isCommonJS) exports.spyOn = spyOn; * @param {String} desc description of this specification * @param {Function} func defines the preconditions and expectations of the spec */ -var it = function(desc, func) { +const it = function(desc, func) { return jasmine.getEnv().it(desc, func); }; if (isCommonJS) exports.it = it; @@ -508,7 +507,7 @@ if (isCommonJS) exports.it = it; * @param {String} desc description of this specification * @param {Function} func defines the preconditions and expectations of the spec */ -var xit = function(desc, func) { +const xit = function(desc, func) { return jasmine.getEnv().xit(desc, func); }; if (isCommonJS) exports.xit = xit; @@ -522,7 +521,7 @@ if (isCommonJS) exports.xit = xit; * @param {Object} actual Actual value to test against and expected value * @return {jasmine.Matchers} */ -var expect = function(actual) { +const expect = function(actual) { return jasmine.getEnv().currentSpec.expect(actual); }; if (isCommonJS) exports.expect = expect; @@ -532,7 +531,7 @@ if (isCommonJS) exports.expect = expect; * * @param {Function} func Function that defines part of a jasmine spec. */ -var runs = function(func) { +const runs = function(func) { jasmine.getEnv().currentSpec.runs(func); }; if (isCommonJS) exports.runs = runs; @@ -543,7 +542,7 @@ if (isCommonJS) exports.runs = runs; * @deprecated Use waitsFor() instead * @param {Number} timeout milliseconds to wait */ -var waits = function(timeout) { +const waits = function(timeout) { jasmine.getEnv().currentSpec.waits(timeout); }; if (isCommonJS) exports.waits = waits; @@ -555,7 +554,7 @@ if (isCommonJS) exports.waits = waits; * @param {String} optional_timeoutMessage * @param {Number} optional_timeout */ -var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { +const waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments); }; if (isCommonJS) exports.waitsFor = waitsFor; @@ -567,7 +566,7 @@ if (isCommonJS) exports.waitsFor = waitsFor; * * @param {Function} beforeEachFunction */ -var beforeEach = function(beforeEachFunction) { +const beforeEach = function(beforeEachFunction) { jasmine.getEnv().beforeEach(beforeEachFunction); }; if (isCommonJS) exports.beforeEach = beforeEach; @@ -579,7 +578,7 @@ if (isCommonJS) exports.beforeEach = beforeEach; * * @param {Function} afterEachFunction */ -var afterEach = function(afterEachFunction) { +const afterEach = function(afterEachFunction) { jasmine.getEnv().afterEach(afterEachFunction); }; if (isCommonJS) exports.afterEach = afterEach; @@ -599,7 +598,7 @@ if (isCommonJS) exports.afterEach = afterEach; * @param {String} description A string, usually the class under test. * @param {Function} specDefinitions function that defines several specs. */ -var describe = function(description, specDefinitions) { +const describe = function(description, specDefinitions) { return jasmine.getEnv().describe(description, specDefinitions); }; if (isCommonJS) exports.describe = describe; @@ -610,36 +609,36 @@ if (isCommonJS) exports.describe = describe; * @param {String} description A string, usually the class under test. * @param {Function} specDefinitions function that defines several specs. */ -var xdescribe = function(description, specDefinitions) { +const xdescribe = function(description, specDefinitions) { return jasmine.getEnv().xdescribe(description, specDefinitions); }; if (isCommonJS) exports.xdescribe = xdescribe; // Provide the XMLHttpRequest class for IE 5.x-6.x: -jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function() { +jasmine.XmlHttpRequest = (typeof XMLHttpRequest == 'undefined') ? function() { function tryIt(f) { try { return f(); - } catch(e) { + } catch (e) { } return null; } - var xhr = tryIt(function() { - return new ActiveXObject("Msxml2.XMLHTTP.6.0"); + const xhr = tryIt(function() { + return new ActiveXObject('Msxml2.XMLHTTP.6.0'); }) || tryIt(function() { - return new ActiveXObject("Msxml2.XMLHTTP.3.0"); + return new ActiveXObject('Msxml2.XMLHTTP.3.0'); }) || tryIt(function() { - return new ActiveXObject("Msxml2.XMLHTTP"); + return new ActiveXObject('Msxml2.XMLHTTP'); }) || tryIt(function() { - return new ActiveXObject("Microsoft.XMLHTTP"); + return new ActiveXObject('Microsoft.XMLHTTP'); }); - if (!xhr) throw new Error("This browser does not support XMLHttpRequest."); + if (!xhr) throw new Error('This browser does not support XMLHttpRequest.'); return xhr; } : XMLHttpRequest; @@ -659,31 +658,29 @@ jasmine.util.inherit = function(childClass, parentClass) { /** * @private */ - var subclass = function() { + const subclass = function() { }; subclass.prototype = parentClass.prototype; childClass.prototype = new subclass(); }; jasmine.util.formatException = function(e) { - var lineNumber; + let lineNumber; if (e.line) { lineNumber = e.line; - } - else if (e.lineNumber) { + } else if (e.lineNumber) { lineNumber = e.lineNumber; } - var file; + let file; if (e.sourceURL) { file = e.sourceURL; - } - else if (e.fileName) { + } else if (e.fileName) { file = e.fileName; } - var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString(); + let message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString(); if (file && lineNumber) { message += ' in ' + file + ' (line ' + lineNumber + ')'; @@ -695,18 +692,18 @@ jasmine.util.formatException = function(e) { jasmine.util.htmlEscape = function(str) { if (!str) return str; return str.replace(/&/g, '&') - .replace(//g, '>'); + .replace(//g, '>'); }; jasmine.util.argsToArray = function(args) { - var arrayOfArgs = []; - for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]); + const arrayOfArgs = []; + for (let i = 0; i < args.length; i++) arrayOfArgs.push(args[i]); return arrayOfArgs; }; jasmine.util.extend = function(destination, source) { - for (var property in source) destination[property] = source[property]; + for (const property in source) destination[property] = source[property]; return destination; }; @@ -749,9 +746,9 @@ jasmine.Env.prototype.setInterval = jasmine.setInterval; jasmine.Env.prototype.clearInterval = jasmine.clearInterval; /** - * @returns an object containing jasmine version build info, if set. + * @return an object containing jasmine version build info, if set. */ -jasmine.Env.prototype.version = function () { +jasmine.Env.prototype.version = function() { if (jasmine.version_) { return jasmine.version_; } else { @@ -760,33 +757,33 @@ jasmine.Env.prototype.version = function () { }; /** - * @returns string containing jasmine version build info, if set. + * @return string containing jasmine version build info, if set. */ jasmine.Env.prototype.versionString = function() { if (!jasmine.version_) { - return "version unknown"; + return 'version unknown'; } - var version = this.version(); - var versionString = version.major + "." + version.minor + "." + version.build; + const version = this.version(); + let versionString = version.major + '.' + version.minor + '.' + version.build; if (version.release_candidate) { - versionString += ".rc" + version.release_candidate; + versionString += '.rc' + version.release_candidate; } - versionString += " revision " + version.revision; + versionString += ' revision ' + version.revision; return versionString; }; /** - * @returns a sequential integer starting at 0 + * @return a sequential integer starting at 0 */ -jasmine.Env.prototype.nextSpecId = function () { +jasmine.Env.prototype.nextSpecId = function() { return this.nextSpecId_++; }; /** - * @returns a sequential integer starting at 0 + * @return a sequential integer starting at 0 */ -jasmine.Env.prototype.nextSuiteId = function () { +jasmine.Env.prototype.nextSuiteId = function() { return this.nextSuiteId_++; }; @@ -803,9 +800,9 @@ jasmine.Env.prototype.execute = function() { }; jasmine.Env.prototype.describe = function(description, specDefinitions) { - var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite); + const suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite); - var parentSuite = this.currentSuite; + const parentSuite = this.currentSuite; if (parentSuite) { parentSuite.add(suite); } else { @@ -814,15 +811,15 @@ jasmine.Env.prototype.describe = function(description, specDefinitions) { this.currentSuite = suite; - var declarationError = null; + let declarationError = null; try { specDefinitions.call(suite); - } catch(e) { + } catch (e) { declarationError = e; } if (declarationError) { - this.it("encountered a declaration exception", function() { + this.it('encountered a declaration exception', function() { throw declarationError; }); } @@ -840,7 +837,7 @@ jasmine.Env.prototype.beforeEach = function(beforeEachFunction) { } }; -jasmine.Env.prototype.currentRunner = function () { +jasmine.Env.prototype.currentRunner = function() { return this.currentRunner_; }; @@ -850,18 +847,17 @@ jasmine.Env.prototype.afterEach = function(afterEachFunction) { } else { this.currentRunner_.afterEach(afterEachFunction); } - }; jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) { return { execute: function() { - } + }, }; }; jasmine.Env.prototype.it = function(description, func) { - var spec = new jasmine.Spec(this, this.currentSuite, description); + const spec = new jasmine.Spec(this, this.currentSuite, description); this.currentSuite.add(spec); this.currentSpec = spec; @@ -876,25 +872,30 @@ jasmine.Env.prototype.xit = function(desc, func) { return { id: this.nextSpecId(), runs: function() { - } + }, }; }; jasmine.Env.prototype.compareRegExps_ = function(a, b, mismatchKeys, mismatchValues) { - if (a.source != b.source) - mismatchValues.push("expected pattern /" + b.source + "/ is not equal to the pattern /" + a.source + "/"); + if (a.source != b.source) { + mismatchValues.push('expected pattern /' + b.source + '/ is not equal to the pattern /' + a.source + '/'); + } - if (a.ignoreCase != b.ignoreCase) - mismatchValues.push("expected modifier i was" + (b.ignoreCase ? " " : " not ") + "set and does not equal the origin modifier"); + if (a.ignoreCase != b.ignoreCase) { + mismatchValues.push('expected modifier i was' + (b.ignoreCase ? ' ' : ' not ') + 'set and does not equal the origin modifier'); + } - if (a.global != b.global) - mismatchValues.push("expected modifier g was" + (b.global ? " " : " not ") + "set and does not equal the origin modifier"); + if (a.global != b.global) { + mismatchValues.push('expected modifier g was' + (b.global ? ' ' : ' not ') + 'set and does not equal the origin modifier'); + } - if (a.multiline != b.multiline) - mismatchValues.push("expected modifier m was" + (b.multiline ? " " : " not ") + "set and does not equal the origin modifier"); + if (a.multiline != b.multiline) { + mismatchValues.push('expected modifier m was' + (b.multiline ? ' ' : ' not ') + 'set and does not equal the origin modifier'); + } - if (a.sticky != b.sticky) - mismatchValues.push("expected modifier y was" + (b.sticky ? " " : " not ") + "set and does not equal the origin modifier"); + if (a.sticky != b.sticky) { + mismatchValues.push('expected modifier y was' + (b.sticky ? ' ' : ' not ') + 'set and does not equal the origin modifier'); + } return (mismatchValues.length === 0); }; @@ -907,29 +908,29 @@ jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchVal a.__Jasmine_been_here_before__ = b; b.__Jasmine_been_here_before__ = a; - var hasKey = function(obj, keyName) { + const hasKey = function(obj, keyName) { return obj !== null && obj[keyName] !== jasmine.undefined; }; for (var property in b) { if (!hasKey(a, property) && hasKey(b, property)) { - mismatchKeys.push("expected has key '" + property + "', but missing from actual."); + mismatchKeys.push('expected has key \'' + property + '\', but missing from actual.'); } } for (property in a) { if (!hasKey(b, property) && hasKey(a, property)) { - mismatchKeys.push("expected missing key '" + property + "', but present in actual."); + mismatchKeys.push('expected missing key \'' + property + '\', but present in actual.'); } } for (property in b) { if (property == '__Jasmine_been_here_before__') continue; if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) { - mismatchValues.push("'" + property + "' was '" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "' in expected, but was '" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "' in actual."); + mismatchValues.push('\'' + property + '\' was \'' + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + '\' in expected, but was \'' + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + '\' in actual.'); } } if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) { - mismatchValues.push("arrays were not the same length"); + mismatchValues.push('arrays were not the same length'); } delete a.__Jasmine_been_here_before__; @@ -941,9 +942,9 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) { mismatchKeys = mismatchKeys || []; mismatchValues = mismatchValues || []; - for (var i = 0; i < this.equalityTesters_.length; i++) { - var equalityTester = this.equalityTesters_[i]; - var result = equalityTester(a, b, this, mismatchKeys, mismatchValues); + for (let i = 0; i < this.equalityTesters_.length; i++) { + const equalityTester = this.equalityTesters_[i]; + const result = equalityTester(a, b, this, mismatchKeys, mismatchValues); if (result !== jasmine.undefined) return result; } @@ -989,17 +990,17 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) { return this.compareRegExps_(a, b, mismatchKeys, mismatchValues); } - if (typeof a === "object" && typeof b === "object") { + if (typeof a === 'object' && typeof b === 'object') { return this.compareObjects_(a, b, mismatchKeys, mismatchValues); } - //Straight check + // Straight check return (a === b); }; jasmine.Env.prototype.contains_ = function(haystack, needle) { if (jasmine.isArray_(haystack)) { - for (var i = 0; i < haystack.length; i++) { + for (let i = 0; i < haystack.length; i++) { if (this.equals_(haystack[i], needle)) return true; } return false; @@ -1017,27 +1018,27 @@ jasmine.Env.prototype.addEqualityTester = function(equalityTester) { jasmine.Reporter = function() { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.Reporter.prototype.reportRunnerStarting = function(runner) { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.Reporter.prototype.reportRunnerResults = function(runner) { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.Reporter.prototype.reportSuiteResults = function(suite) { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.Reporter.prototype.reportSpecStarting = function(spec) { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.Reporter.prototype.reportSpecResults = function(spec) { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.Reporter.prototype.log = function(str) { }; @@ -1058,8 +1059,7 @@ jasmine.Block = function(env, func, spec) { jasmine.Block.prototype.execute = function(onComplete) { if (!jasmine.CATCH_EXCEPTIONS) { this.func.apply(this.spec); - } - else { + } else { try { this.func.apply(this.spec); } catch (e) { @@ -1081,9 +1081,9 @@ jasmine.JsApiReporter = function() { jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) { this.started = true; - var suites = runner.topLevelSuites(); - for (var i = 0; i < suites.length; i++) { - var suite = suites[i]; + const suites = runner.topLevelSuites(); + for (let i = 0; i < suites.length; i++) { + const suite = suites[i]; this.suites_.push(this.summarize_(suite)); } }; @@ -1093,17 +1093,17 @@ jasmine.JsApiReporter.prototype.suites = function() { }; jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) { - var isSuite = suiteOrSpec instanceof jasmine.Suite; - var summary = { + const isSuite = suiteOrSpec instanceof jasmine.Suite; + const summary = { id: suiteOrSpec.id, name: suiteOrSpec.description, type: isSuite ? 'suite' : 'spec', - children: [] + children: [], }; - + if (isSuite) { - var children = suiteOrSpec.children(); - for (var i = 0; i < children.length; i++) { + const children = suiteOrSpec.children(); + for (let i = 0; i < children.length; i++) { summary.children.push(this.summarize_(children[i])); } } @@ -1118,55 +1118,55 @@ jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) { return this.results_[specId]; }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) { this.finished = true; }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) { this.results_[spec.id] = { messages: spec.results().getItems(), - result: spec.results().failedCount > 0 ? "failed" : "passed" + result: spec.results().failedCount > 0 ? 'failed' : 'passed', }; }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.JsApiReporter.prototype.log = function(str) { }; -jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){ - var results = {}; - for (var i = 0; i < specIds.length; i++) { - var specId = specIds[i]; +jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds) { + const results = {}; + for (let i = 0; i < specIds.length; i++) { + const specId = specIds[i]; results[specId] = this.summarizeResult_(this.results_[specId]); } return results; }; -jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){ - var summaryMessages = []; - var messagesLength = result.messages.length; - for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) { - var resultMessage = result.messages[messageIndex]; +jasmine.JsApiReporter.prototype.summarizeResult_ = function(result) { + const summaryMessages = []; + const messagesLength = result.messages.length; + for (let messageIndex = 0; messageIndex < messagesLength; messageIndex++) { + const resultMessage = result.messages[messageIndex]; summaryMessages.push({ text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined, passed: resultMessage.passed ? resultMessage.passed() : true, type: resultMessage.type, message: resultMessage.message, trace: { - stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined - } + stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined, + }, }); } return { - result : result.result, - messages : summaryMessages + result: result.result, + messages: summaryMessages, }; }; @@ -1186,26 +1186,26 @@ jasmine.Matchers = function(env, actual, spec, opt_isNot) { // todo: @deprecated as of Jasmine 0.11, remove soon [xw] jasmine.Matchers.pp = function(str) { - throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!"); + throw new Error('jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!'); }; // todo: @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. [xw] jasmine.Matchers.prototype.report = function(result, failing_message, details) { - throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs"); + throw new Error('As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs'); }; jasmine.Matchers.wrapInto_ = function(prototype, matchersClass) { - for (var methodName in prototype) { + for (const methodName in prototype) { if (methodName == 'report') continue; - var orig = prototype[methodName]; + const orig = prototype[methodName]; matchersClass.prototype[methodName] = jasmine.Matchers.matcherFn_(methodName, orig); } }; jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) { return function() { - var matcherArgs = jasmine.util.argsToArray(arguments); - var result = matcherFunction.apply(this, arguments); + const matcherArgs = jasmine.util.argsToArray(arguments); + let result = matcherFunction.apply(this, arguments); if (this.isNot) { result = !result; @@ -1213,7 +1213,7 @@ jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) { if (this.reportWasCalled_) return result; - var message; + let message; if (!result) { if (this.message) { message = this.message.apply(this, arguments); @@ -1221,23 +1221,25 @@ jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) { message = message[this.isNot ? 1 : 0]; } } else { - var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); }); - message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate; + const englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { + return ' ' + s.toLowerCase(); + }); + message = 'Expected ' + jasmine.pp(this.actual) + (this.isNot ? ' not ' : ' ') + englishyPredicate; if (matcherArgs.length > 0) { - for (var i = 0; i < matcherArgs.length; i++) { - if (i > 0) message += ","; - message += " " + jasmine.pp(matcherArgs[i]); + for (let i = 0; i < matcherArgs.length; i++) { + if (i > 0) message += ','; + message += ' ' + jasmine.pp(matcherArgs[i]); } } - message += "."; + message += '.'; } } - var expectationResult = new jasmine.ExpectationResult({ + const expectationResult = new jasmine.ExpectationResult({ matcherName: matcherName, passed: result, expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0], actual: this.actual, - message: message + message: message, }); this.spec.addMatcherResult(expectationResult); return jasmine.undefined; @@ -1245,8 +1247,6 @@ jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) { }; - - /** * toBe: compares the actual to the expected using === * @param expected @@ -1326,11 +1326,11 @@ jasmine.Matchers.prototype.toBeNull = function() { * Matcher that compares the actual to NaN. */ jasmine.Matchers.prototype.toBeNaN = function() { - this.message = function() { - return [ "Expected " + jasmine.pp(this.actual) + " to be NaN." ]; - }; + this.message = function() { + return ['Expected ' + jasmine.pp(this.actual) + ' to be NaN.']; + }; - return (this.actual !== this.actual); + return (this.actual !== this.actual); }; /** @@ -1363,8 +1363,8 @@ jasmine.Matchers.prototype.toHaveBeenCalled = function() { this.message = function() { return [ - "Expected spy " + this.actual.identity + " to have been called.", - "Expected spy " + this.actual.identity + " not to have been called." + 'Expected spy ' + this.actual.identity + ' to have been called.', + 'Expected spy ' + this.actual.identity + ' not to have been called.', ]; }; @@ -1390,8 +1390,8 @@ jasmine.Matchers.prototype.wasNotCalled = function() { this.message = function() { return [ - "Expected spy " + this.actual.identity + " to not have been called.", - "Expected spy " + this.actual.identity + " to have been called." + 'Expected spy ' + this.actual.identity + ' to not have been called.', + 'Expected spy ' + this.actual.identity + ' to have been called.', ]; }; @@ -1405,17 +1405,17 @@ jasmine.Matchers.prototype.wasNotCalled = function() { * */ jasmine.Matchers.prototype.toHaveBeenCalledWith = function() { - var expectedArgs = jasmine.util.argsToArray(arguments); + const expectedArgs = jasmine.util.argsToArray(arguments); if (!jasmine.isSpy(this.actual)) { throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); } this.message = function() { - var invertedMessage = "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was."; - var positiveMessage = ""; + const invertedMessage = 'Expected spy ' + this.actual.identity + ' not to have been called with ' + jasmine.pp(expectedArgs) + ' but it was.'; + let positiveMessage = ''; if (this.actual.callCount === 0) { - positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called."; + positiveMessage = 'Expected spy ' + this.actual.identity + ' to have been called with ' + jasmine.pp(expectedArgs) + ' but it was never called.'; } else { - positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but actual calls were " + jasmine.pp(this.actual.argsForCall).replace(/^\[ | \]$/g, '') + positiveMessage = 'Expected spy ' + this.actual.identity + ' to have been called with ' + jasmine.pp(expectedArgs) + ' but actual calls were ' + jasmine.pp(this.actual.argsForCall).replace(/^\[ | \]$/g, ''); } return [positiveMessage, invertedMessage]; }; @@ -1428,15 +1428,15 @@ jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.prototype.toHaveBeen /** @deprecated Use expect(xxx).not.toHaveBeenCalledWith() instead */ jasmine.Matchers.prototype.wasNotCalledWith = function() { - var expectedArgs = jasmine.util.argsToArray(arguments); + const expectedArgs = jasmine.util.argsToArray(arguments); if (!jasmine.isSpy(this.actual)) { throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); } this.message = function() { return [ - "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was", - "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was" + 'Expected spy not to have been called with ' + jasmine.pp(expectedArgs) + ' but it was', + 'Expected spy to have been called with ' + jasmine.pp(expectedArgs) + ' but it was', ]; }; @@ -1490,8 +1490,8 @@ jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) { * @param {String} [expected] */ jasmine.Matchers.prototype.toThrow = function(expected) { - var result = false; - var exception; + let result = false; + let exception; if (typeof this.actual != 'function') { throw new Error('Actual is not a function'); } @@ -1504,13 +1504,13 @@ jasmine.Matchers.prototype.toThrow = function(expected) { result = (expected === jasmine.undefined || this.env.equals_(exception.message || exception, expected.message || expected)); } - var not = this.isNot ? "not " : ""; + const not = this.isNot ? 'not ' : ''; this.message = function() { if (exception && (expected === jasmine.undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) { - return ["Expected function " + not + "to throw", expected ? expected.message || expected : "an exception", ", but it threw", exception.message || exception].join(' '); + return ['Expected function ' + not + 'to throw', expected ? expected.message || expected : 'an exception', ', but it threw', exception.message || exception].join(' '); } else { - return "Expected function to throw an exception."; + return 'Expected function to throw an exception.'; } }; @@ -1545,7 +1545,7 @@ jasmine.Matchers.Any.prototype.jasmineToString = function() { return ''; }; -jasmine.Matchers.ObjectContaining = function (sample) { +jasmine.Matchers.ObjectContaining = function(sample) { this.sample = sample; }; @@ -1553,26 +1553,25 @@ jasmine.Matchers.ObjectContaining.prototype.jasmineMatches = function(other, mis mismatchKeys = mismatchKeys || []; mismatchValues = mismatchValues || []; - var env = jasmine.getEnv(); + const env = jasmine.getEnv(); - var hasKey = function(obj, keyName) { + const hasKey = function(obj, keyName) { return obj != null && obj[keyName] !== jasmine.undefined; }; - for (var property in this.sample) { + for (const property in this.sample) { if (!hasKey(other, property) && hasKey(this.sample, property)) { - mismatchKeys.push("expected has key '" + property + "', but missing from actual."); - } - else if (!env.equals_(this.sample[property], other[property], mismatchKeys, mismatchValues)) { - mismatchValues.push("'" + property + "' was '" + (other[property] ? jasmine.util.htmlEscape(other[property].toString()) : other[property]) + "' in expected, but was '" + (this.sample[property] ? jasmine.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + "' in actual."); + mismatchKeys.push('expected has key \'' + property + '\', but missing from actual.'); + } else if (!env.equals_(this.sample[property], other[property], mismatchKeys, mismatchValues)) { + mismatchValues.push('\'' + property + '\' was \'' + (other[property] ? jasmine.util.htmlEscape(other[property].toString()) : other[property]) + '\' in expected, but was \'' + (this.sample[property] ? jasmine.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + '\' in actual.'); } } return (mismatchKeys.length === 0 && mismatchValues.length === 0); }; -jasmine.Matchers.ObjectContaining.prototype.jasmineToString = function () { - return ""; +jasmine.Matchers.ObjectContaining.prototype.jasmineToString = function() { + return ''; }; // Mock setTimeout, clearTimeout // Contributed by Pivotal Computer Systems, www.pivotalsf.com @@ -1580,7 +1579,7 @@ jasmine.Matchers.ObjectContaining.prototype.jasmineToString = function () { jasmine.FakeTimer = function() { this.reset(); - var self = this; + const self = this; self.setTimeout = function(funcToCall, millis) { self.timeoutsMade++; self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false); @@ -1600,7 +1599,6 @@ jasmine.FakeTimer = function() { self.clearInterval = function(timeoutKey) { self.scheduledFunctions[timeoutKey] = jasmine.undefined; }; - }; jasmine.FakeTimer.prototype.reset = function() { @@ -1610,16 +1608,16 @@ jasmine.FakeTimer.prototype.reset = function() { }; jasmine.FakeTimer.prototype.tick = function(millis) { - var oldMillis = this.nowMillis; - var newMillis = oldMillis + millis; + const oldMillis = this.nowMillis; + const newMillis = oldMillis + millis; this.runFunctionsWithinRange(oldMillis, newMillis); this.nowMillis = newMillis; }; jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) { - var scheduledFunc; - var funcsToRun = []; - for (var timeoutKey in this.scheduledFunctions) { + let scheduledFunc; + const funcsToRun = []; + for (const timeoutKey in this.scheduledFunctions) { scheduledFunc = this.scheduledFunctions[timeoutKey]; if (scheduledFunc != jasmine.undefined && scheduledFunc.runAtMillis >= oldMillis && @@ -1633,9 +1631,9 @@ jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMil funcsToRun.sort(function(a, b) { return a.runAtMillis - b.runAtMillis; }); - for (var i = 0; i < funcsToRun.length; ++i) { + for (let i = 0; i < funcsToRun.length; ++i) { try { - var funcToRun = funcsToRun[i]; + const funcToRun = funcsToRun[i]; this.nowMillis = funcToRun.runAtMillis; funcToRun.funcToCall(); if (funcToRun.recurring) { @@ -1644,7 +1642,7 @@ jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMil funcToRun.millis, true); } - } catch(e) { + } catch (e) { } } this.runFunctionsWithinRange(oldMillis, nowMillis); @@ -1657,7 +1655,7 @@ jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, funcToCall: funcToCall, recurring: recurring, timeoutKey: timeoutKey, - millis: millis + millis: millis, }; }; @@ -1687,7 +1685,7 @@ jasmine.Clock = { useMock: function() { if (!jasmine.Clock.isInstalled()) { - var spec = jasmine.getEnv().currentSpec; + const spec = jasmine.getEnv().currentSpec; spec.after(jasmine.Clock.uninstallMock); jasmine.Clock.installMock(); @@ -1707,12 +1705,12 @@ jasmine.Clock = { setTimeout: jasmine.getGlobal().setTimeout, clearTimeout: jasmine.getGlobal().clearTimeout, setInterval: jasmine.getGlobal().setInterval, - clearInterval: jasmine.getGlobal().clearInterval + clearInterval: jasmine.getGlobal().clearInterval, }, assertInstalled: function() { if (!jasmine.Clock.isInstalled()) { - throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()"); + throw new Error('Mock clock is not installed, use jasmine.Clock.useMock()'); } }, @@ -1720,11 +1718,11 @@ jasmine.Clock = { return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer; }, - installed: null + installed: null, }; jasmine.Clock.installed = jasmine.Clock.real; -//else for IE support +// else for IE support jasmine.getGlobal().setTimeout = function(funcToCall, millis) { if (jasmine.Clock.installed.setTimeout.apply) { return jasmine.Clock.installed.setTimeout.apply(this, arguments); @@ -1770,20 +1768,20 @@ jasmine.MultiReporter.prototype.addReporter = function(reporter) { }; (function() { - var functionNames = [ - "reportRunnerStarting", - "reportRunnerResults", - "reportSuiteResults", - "reportSpecStarting", - "reportSpecResults", - "log" + const functionNames = [ + 'reportRunnerStarting', + 'reportRunnerResults', + 'reportSuiteResults', + 'reportSpecStarting', + 'reportSpecResults', + 'log', ]; - for (var i = 0; i < functionNames.length; i++) { - var functionName = functionNames[i]; + for (let i = 0; i < functionNames.length; i++) { + const functionName = functionNames[i]; jasmine.MultiReporter.prototype[functionName] = (function(functionName) { return function() { - for (var j = 0; j < this.subReporters_.length; j++) { - var subReporter = this.subReporters_[j]; + for (let j = 0; j < this.subReporters_.length; j++) { + const subReporter = this.subReporters_[j]; if (subReporter[functionName]) { subReporter[functionName].apply(subReporter, arguments); } @@ -1867,7 +1865,7 @@ jasmine.NestedResults.prototype.addResult = function(result) { }; /** - * @returns {Boolean} True if everything below passed + * @return {Boolean} True if everything below passed */ jasmine.NestedResults.prototype.passed = function() { return this.passedCount === this.totalCount; @@ -1898,7 +1896,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) { } else if (typeof value === 'string') { this.emitString(value); } else if (jasmine.isSpy(value)) { - this.emitScalar("spy on " + value.identity); + this.emitScalar('spy on ' + value.identity); } else if (value instanceof RegExp) { this.emitScalar(value.toString()); } else if (typeof value === 'function') { @@ -1926,10 +1924,10 @@ jasmine.PrettyPrinter.prototype.format = function(value) { }; jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) { - for (var property in obj) { + for (const property in obj) { if (!obj.hasOwnProperty(property)) continue; if (property == '__Jasmine_been_here_before__') continue; - fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined && + fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined && obj.__lookupGetter__(property) !== null) : false); } }; @@ -1951,17 +1949,17 @@ jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) { }; jasmine.StringPrettyPrinter.prototype.emitString = function(value) { - this.append("'" + value + "'"); + this.append('\'' + value + '\''); }; jasmine.StringPrettyPrinter.prototype.emitArray = function(array) { if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) { - this.append("Array"); + this.append('Array'); return; } this.append('[ '); - for (var i = 0; i < array.length; i++) { + for (let i = 0; i < array.length; i++) { if (i > 0) { this.append(', '); } @@ -1972,13 +1970,13 @@ jasmine.StringPrettyPrinter.prototype.emitArray = function(array) { jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) { if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) { - this.append("Object"); + this.append('Object'); return; } - var self = this; + const self = this; this.append('{ '); - var first = true; + let first = true; this.iterateObject(obj, function(property, isGetter) { if (first) { @@ -2056,17 +2054,17 @@ jasmine.Queue.prototype.isRunning = function() { jasmine.Queue.LOOP_DONT_RECURSE = true; jasmine.Queue.prototype.next_ = function() { - var self = this; - var goAgain = true; + const self = this; + let goAgain = true; while (goAgain) { goAgain = false; - + if (self.index < self.blocks.length && !(this.abort && !this.ensured[self.index])) { var calledSynchronously = true; var completedSynchronously = false; - var onComplete = function () { + const onComplete = function() { if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) { completedSynchronously = true; return; @@ -2079,7 +2077,7 @@ jasmine.Queue.prototype.next_ = function() { self.offset = 0; self.index++; - var now = new Date().getTime(); + const now = new Date().getTime(); if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { self.env.lastUpdate = now; self.env.setTimeout(function() { @@ -2099,7 +2097,6 @@ jasmine.Queue.prototype.next_ = function() { if (completedSynchronously) { onComplete(); } - } else { self.running = false; if (self.onComplete) { @@ -2110,8 +2107,8 @@ jasmine.Queue.prototype.next_ = function() { }; jasmine.Queue.prototype.results = function() { - var results = new jasmine.NestedResults(); - for (var i = 0; i < this.blocks.length; i++) { + const results = new jasmine.NestedResults(); + for (let i = 0; i < this.blocks.length; i++) { if (this.blocks[i].results) { results.addResult(this.blocks[i].results()); } @@ -2127,7 +2124,7 @@ jasmine.Queue.prototype.results = function() { * @param {jasmine.Env} env */ jasmine.Runner = function(env) { - var self = this; + const self = this; self.env = env; self.queue = new jasmine.Queue(env); self.before_ = []; @@ -2136,23 +2133,23 @@ jasmine.Runner = function(env) { }; jasmine.Runner.prototype.execute = function() { - var self = this; + const self = this; if (self.env.reporter.reportRunnerStarting) { self.env.reporter.reportRunnerStarting(this); } - self.queue.start(function () { + self.queue.start(function() { self.finishCallback(); }); }; jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) { beforeEachFunction.typeName = 'beforeEach'; - this.before_.splice(0,0,beforeEachFunction); + this.before_.splice(0, 0, beforeEachFunction); }; jasmine.Runner.prototype.afterEach = function(afterEachFunction) { afterEachFunction.typeName = 'afterEach'; - this.after_.splice(0,0,afterEachFunction); + this.after_.splice(0, 0, afterEachFunction); }; @@ -2171,10 +2168,10 @@ jasmine.Runner.prototype.add = function(block) { this.queue.add(block); }; -jasmine.Runner.prototype.specs = function () { - var suites = this.suites(); - var specs = []; - for (var i = 0; i < suites.length; i++) { +jasmine.Runner.prototype.specs = function() { + const suites = this.suites(); + let specs = []; + for (let i = 0; i < suites.length; i++) { specs = specs.concat(suites[i].specs()); } return specs; @@ -2185,8 +2182,8 @@ jasmine.Runner.prototype.suites = function() { }; jasmine.Runner.prototype.topLevelSuites = function() { - var topLevelSuites = []; - for (var i = 0; i < this.suites_.length; i++) { + const topLevelSuites = []; + for (let i = 0; i < this.suites_.length; i++) { if (!this.suites_[i].parentSuite) { topLevelSuites.push(this.suites_[i]); } @@ -2212,7 +2209,7 @@ jasmine.Spec = function(env, suite, description) { if (!suite) { throw new Error('jasmine.Suite() required'); } - var spec = this; + const spec = this; spec.id = env.nextSpecId ? env.nextSpecId() : null; spec.env = env; spec.suite = suite; @@ -2245,13 +2242,13 @@ jasmine.Spec.prototype.log = function() { return this.results_.log(arguments); }; -jasmine.Spec.prototype.runs = function (func) { - var block = new jasmine.Block(this.env, func, this); +jasmine.Spec.prototype.runs = function(func) { + const block = new jasmine.Block(this.env, func, this); this.addToQueue(block); return this; }; -jasmine.Spec.prototype.addToQueue = function (block) { +jasmine.Spec.prototype.addToQueue = function(block) { if (this.queue.isRunning()) { this.queue.insertNext(block); } else { @@ -2267,7 +2264,7 @@ jasmine.Spec.prototype.addMatcherResult = function(result) { }; jasmine.Spec.prototype.expect = function(actual) { - var positive = new (this.getMatchersClass_())(this.env, actual, this); + const positive = new (this.getMatchersClass_())(this.env, actual, this); positive.not = new (this.getMatchersClass_())(this.env, actual, this, true); return positive; }; @@ -2279,7 +2276,7 @@ jasmine.Spec.prototype.expect = function(actual) { * @param {Number} timeout milliseconds to wait */ jasmine.Spec.prototype.waits = function(timeout) { - var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this); + const waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this); this.addToQueue(waitsFunc); return this; }; @@ -2292,12 +2289,12 @@ jasmine.Spec.prototype.waits = function(timeout) { * @param {Number} optional_timeout */ jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { - var latchFunction_ = null; - var optional_timeoutMessage_ = null; - var optional_timeout_ = null; + let latchFunction_ = null; + let optional_timeoutMessage_ = null; + let optional_timeout_ = null; - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; + for (let i = 0; i < arguments.length; i++) { + const arg = arguments[i]; switch (typeof arg) { case 'function': latchFunction_ = arg; @@ -2311,16 +2308,16 @@ jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessag } } - var waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this); + const waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this); this.addToQueue(waitsForFunc); return this; }; -jasmine.Spec.prototype.fail = function (e) { - var expectationResult = new jasmine.ExpectationResult({ +jasmine.Spec.prototype.fail = function(e) { + const expectationResult = new jasmine.ExpectationResult({ passed: false, message: e ? jasmine.util.formatException(e) : 'Exception', - trace: { stack: e.stack } + trace: {stack: e.stack}, }); this.results_.addResult(expectationResult); }; @@ -2330,8 +2327,8 @@ jasmine.Spec.prototype.getMatchersClass_ = function() { }; jasmine.Spec.prototype.addMatchers = function(matchersPrototype) { - var parent = this.getMatchersClass_(); - var newMatchersClass = function() { + const parent = this.getMatchersClass_(); + const newMatchersClass = function() { parent.apply(this, arguments); }; jasmine.util.inherit(newMatchersClass, parent); @@ -2360,7 +2357,7 @@ jasmine.Spec.prototype.after = function(doAfter) { }; jasmine.Spec.prototype.execute = function(onComplete) { - var spec = this; + const spec = this; if (!spec.env.specFilter(spec)) { spec.results_.skipped = true; spec.finish(onComplete); @@ -2373,14 +2370,14 @@ jasmine.Spec.prototype.execute = function(onComplete) { spec.addBeforesAndAftersToQueue(); - spec.queue.start(function () { + spec.queue.start(function() { spec.finish(onComplete); }); }; jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() { - var runner = this.env.currentRunner(); - var i; + const runner = this.env.currentRunner(); + let i; for (var suite = this.suite; suite; suite = suite.parentSuite) { for (i = 0; i < suite.before_.length; i++) { @@ -2409,7 +2406,7 @@ jasmine.Spec.prototype.explodes = function() { jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) { if (obj == jasmine.undefined) { - throw "spyOn could not find an object to spy upon for " + methodName + "()"; + throw 'spyOn could not find an object to spy upon for ' + methodName + '()'; } if (!ignoreMethodDoesntExist && obj[methodName] === jasmine.undefined) { @@ -2420,7 +2417,7 @@ jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist throw new Error(methodName + ' has already been spied upon'); } - var spyObj = jasmine.createSpy(methodName); + const spyObj = jasmine.createSpy(methodName); this.spies_.push(spyObj); spyObj.baseObj = obj; @@ -2433,8 +2430,8 @@ jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist }; jasmine.Spec.prototype.removeAllSpies = function() { - for (var i = 0; i < this.spies_.length; i++) { - var spy = this.spies_[i]; + for (let i = 0; i < this.spies_.length; i++) { + const spy = this.spies_[i]; spy.baseObj[spy.methodName] = spy.originalValue; } this.spies_ = []; @@ -2450,7 +2447,7 @@ jasmine.Spec.prototype.removeAllSpies = function() { * @param {jasmine.Suite} parentSuite */ jasmine.Suite = function(env, description, specDefinitions, parentSuite) { - var self = this; + const self = this; self.id = env.nextSuiteId ? env.nextSuiteId() : null; self.description = description; self.queue = new jasmine.Queue(env); @@ -2464,8 +2461,8 @@ jasmine.Suite = function(env, description, specDefinitions, parentSuite) { }; jasmine.Suite.prototype.getFullName = function() { - var fullName = this.description; - for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) { + let fullName = this.description; + for (let parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) { fullName = parentSuite.description + ' ' + fullName; } return fullName; @@ -2517,8 +2514,8 @@ jasmine.Suite.prototype.children = function() { }; jasmine.Suite.prototype.execute = function(onComplete) { - var self = this; - this.queue.start(function () { + const self = this; + this.queue.start(function() { self.finish(onComplete); }); }; @@ -2529,11 +2526,11 @@ jasmine.WaitsBlock = function(env, timeout, spec) { jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block); -jasmine.WaitsBlock.prototype.execute = function (onComplete) { +jasmine.WaitsBlock.prototype.execute = function(onComplete) { if (jasmine.VERBOSE) { this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...'); } - this.env.setTimeout(function () { + this.env.setTimeout(function() { onComplete(); }, this.timeout); }; @@ -2563,7 +2560,7 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) { if (jasmine.VERBOSE) { this.env.reporter.log('>> Jasmine waiting for ' + (this.message || 'something to happen')); } - var latchFunctionResult; + let latchFunctionResult; try { latchFunctionResult = this.latchFunction.apply(this.spec); } catch (e) { @@ -2575,17 +2572,17 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) { if (latchFunctionResult) { onComplete(); } else if (this.totalTimeSpentWaitingForLatch >= this.timeout) { - var message = 'timed out after ' + this.timeout + ' msec waiting for ' + (this.message || 'something to happen'); + const message = 'timed out after ' + this.timeout + ' msec waiting for ' + (this.message || 'something to happen'); this.spec.fail({ name: 'timeout', - message: message + message: message, }); this.abort = true; onComplete(); } else { this.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT; - var self = this; + const self = this; this.env.setTimeout(function() { self.execute(onComplete); }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT); @@ -2593,8 +2590,8 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) { }; jasmine.version_= { - "major": 1, - "minor": 3, - "build": 1, - "revision": 1354556913 + 'major': 1, + 'minor': 3, + 'build': 1, + 'revision': 1354556913, }; diff --git a/examples/jasmine/spec/PlayerSpec.js b/examples/jasmine/spec/PlayerSpec.js index 79f1022..395fe02 100644 --- a/examples/jasmine/spec/PlayerSpec.js +++ b/examples/jasmine/spec/PlayerSpec.js @@ -1,34 +1,34 @@ -describe("Player", function() { - var player; - var song; +describe('Player', function() { + let player; + let song; beforeEach(function() { player = new Player(); song = new Song(); }); - it("should be able to play a Song", function() { + it('should be able to play a Song', function() { player.play(song); expect(player.currentlyPlayingSong).toEqual(song); - //demonstrates use of custom matcher + // demonstrates use of custom matcher expect(player).toBePlaying(song); }); - describe("when song has been paused", function() { + describe('when song has been paused', function() { beforeEach(function() { player.play(song); player.pause(); }); - it("should indicate that the song is currently paused", function() { + it('should indicate that the song is currently paused', function() { expect(player.isPlaying).toBeFalsy(); // demonstrates use of 'not' with a custom matcher expect(player).not.toBePlaying(song); }); - it("should be possible to resume", function() { + it('should be possible to resume', function() { player.resume(); expect(player.isPlaying).toBeTruthy(); expect(player.currentlyPlayingSong).toEqual(song); @@ -36,7 +36,7 @@ describe("Player", function() { }); // demonstrates use of spies to intercept and test method calls - it("tells the current song if the user has made it a favorite", function() { + it('tells the current song if the user has made it a favorite', function() { spyOn(song, 'persistFavoriteStatus'); player.play(song); @@ -45,14 +45,14 @@ describe("Player", function() { expect(song.persistFavoriteStatus).toHaveBeenCalledWith(true); }); - //demonstrates use of expected exceptions - describe("#resume", function() { - it("should throw an exception if song is already playing", function() { + // demonstrates use of expected exceptions + describe('#resume', function() { + it('should throw an exception if song is already playing', function() { player.play(song); expect(function() { player.resume(); - }).toThrow("song is already playing"); + }).toThrow('song is already playing'); }); }); -}); \ No newline at end of file +}); diff --git a/examples/jasmine/spec/SpecHelper.js b/examples/jasmine/spec/SpecHelper.js index e9b8284..3db8f01 100644 --- a/examples/jasmine/spec/SpecHelper.js +++ b/examples/jasmine/spec/SpecHelper.js @@ -1,9 +1,9 @@ beforeEach(function() { this.addMatchers({ toBePlaying: function(expectedSong) { - var player = this.actual; - return player.currentlyPlayingSong === expectedSong && + const player = this.actual; + return player.currentlyPlayingSong === expectedSong && player.isPlaying; - } + }, }); }); diff --git a/examples/jasmine/src/Player.js b/examples/jasmine/src/Player.js index fcce826..1d973b2 100644 --- a/examples/jasmine/src/Player.js +++ b/examples/jasmine/src/Player.js @@ -11,7 +11,7 @@ Player.prototype.pause = function() { Player.prototype.resume = function() { if (this.isPlaying) { - throw new Error("song is already playing"); + throw new Error('song is already playing'); } this.isPlaying = true; @@ -19,4 +19,4 @@ Player.prototype.resume = function() { Player.prototype.makeFavorite = function() { this.currentlyPlayingSong.persistFavoriteStatus(true); -}; \ No newline at end of file +}; diff --git a/examples/jasmine/src/Song.js b/examples/jasmine/src/Song.js index a8a3f2d..2012cb4 100644 --- a/examples/jasmine/src/Song.js +++ b/examples/jasmine/src/Song.js @@ -3,5 +3,5 @@ function Song() { Song.prototype.persistFavoriteStatus = function(value) { // something complicated - throw new Error("not yet implemented"); -}; \ No newline at end of file + throw new Error('not yet implemented'); +}; diff --git a/examples/mocha/Gruntfile.js b/examples/mocha/Gruntfile.js index 3711917..9f0a4be 100644 --- a/examples/mocha/Gruntfile.js +++ b/examples/mocha/Gruntfile.js @@ -1,56 +1,56 @@ -module.exports = function (grunt) { - var browsers = [{ +module.exports = function(grunt) { + const browsers = [{ browserName: 'firefox', version: '19', - platform: 'XP' + platform: 'XP', }, { browserName: 'googlechrome', - platform: 'XP' + platform: 'XP', }, { browserName: 'googlechrome', - platform: 'linux' + platform: 'linux', }, { browserName: 'internet explorer', platform: 'WIN8', - version: '10' + version: '10', }, { browserName: 'internet explorer', platform: 'VISTA', - version: '9' + version: '9', }]; grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - connect: { + 'pkg': grunt.file.readJSON('package.json'), + 'connect': { server: { options: { base: '', - port: 9999 - } - } + port: 9999, + }, + }, }, 'saucelabs-mocha': { all: { options: { urls: [ - 'http://127.0.0.1:9999/index.html' + 'http://127.0.0.1:9999/index.html', ], browsers: browsers, build: process.env.TRAVIS_JOB_ID, testname: 'mocha tests', throttled: 3, sauceConfig: { - 'video-upload-on-pass': false - } - } - } + 'video-upload-on-pass': false, + }, + }, + }, }, - watch: {} + 'watch': {}, }); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-saucelabs'); grunt.registerTask('default', ['connect', 'saucelabs-mocha']); -}; \ No newline at end of file +}; diff --git a/examples/mocha/lib/expect/index.js b/examples/mocha/lib/expect/index.js index b1e921d..c295b12 100644 --- a/examples/mocha/lib/expect/index.js +++ b/examples/mocha/lib/expect/index.js @@ -1,6 +1,5 @@ -(function (global, module) { - - var exports = module.exports; +(function(global, module) { + const exports = module.exports; /** * Exports. @@ -19,15 +18,15 @@ * Possible assertion flags. */ - var flags = { - not: ['to', 'be', 'have', 'include', 'only'] - , to: ['be', 'have', 'include', 'only', 'not'] - , only: ['have'] - , have: ['own'] - , be: ['an'] + const flags = { + not: ['to', 'be', 'have', 'include', 'only'], + to: ['be', 'have', 'include', 'only', 'not'], + only: ['have'], + have: ['own'], + be: ['an'], }; - function expect (obj) { + function expect(obj) { return new Assertion(obj); } @@ -37,7 +36,7 @@ * @api private */ - function Assertion (obj, flag, parent) { + function Assertion(obj, flag, parent) { this.obj = obj; this.flags = {}; @@ -51,25 +50,25 @@ } } - var $flags = flag ? flags[flag] : keys(flags) - , self = this; + const $flags = flag ? flags[flag] : keys(flags) + ; const self = this; if ($flags) { for (var i = 0, l = $flags.length; i < l; i++) { // avoid recursion if (this.flags[$flags[i]]) continue; - var name = $flags[i] - , assertion = new Assertion(this.obj, name, this) + const name = $flags[i] + ; const assertion = new Assertion(this.obj, name, this); if ('function' == typeof Assertion.prototype[name]) { // clone the function, make sure we dont touch the prot reference var old = this[name]; - this[name] = function () { + this[name] = function() { return old.apply(self, arguments); }; - for (var fn in Assertion.prototype) { + for (const fn in Assertion.prototype) { if (Assertion.prototype.hasOwnProperty(fn) && fn != name) { this[name][fn] = bind(assertion[fn], assertion); } @@ -87,10 +86,10 @@ * @api private */ - Assertion.prototype.assert = function (truth, msg, error, expected) { + Assertion.prototype.assert = function(truth, msg, error, expected) { var msg = this.flags.not ? error : msg - , ok = this.flags.not ? !truth : truth - , err; + ; const ok = this.flags.not ? !truth : truth + ; let err; if (!ok) { err = new Error(msg.call(this)); @@ -111,11 +110,15 @@ * @api public */ - Assertion.prototype.ok = function () { + Assertion.prototype.ok = function() { this.assert( !!this.obj - , function(){ return 'expected ' + i(this.obj) + ' to be truthy' } - , function(){ return 'expected ' + i(this.obj) + ' to be falsy' }); + , function() { + return 'expected ' + i(this.obj) + ' to be truthy'; + } + , function() { + return 'expected ' + i(this.obj) + ' to be falsy'; + }); }; /** @@ -126,9 +129,11 @@ Assertion.prototype.withArgs = function() { expect(this.obj).to.be.a('function'); - var fn = this.obj; - var args = Array.prototype.slice.call(arguments); - return expect(function() { fn.apply(null, args); }); + const fn = this.obj; + const args = Array.prototype.slice.call(arguments); + return expect(function() { + fn.apply(null, args); + }); }; /** @@ -139,17 +144,17 @@ */ Assertion.prototype.throwError = - Assertion.prototype.throwException = function (fn) { + Assertion.prototype.throwException = function(fn) { expect(this.obj).to.be.a('function'); - var thrown = false - , not = this.flags.not; + let thrown = false + ; const not = this.flags.not; try { this.obj(); } catch (e) { if (isRegExp(fn)) { - var subject = 'string' == typeof e ? e : e.message; + const subject = 'string' == typeof e ? e : e.message; if (not) { expect(subject).to.not.match(fn); } else { @@ -167,11 +172,15 @@ this.flags.not = false; } - var name = this.obj.name || 'fn'; + const name = this.obj.name || 'fn'; this.assert( thrown - , function(){ return 'expected ' + name + ' to throw an exception' } - , function(){ return 'expected ' + name + ' not to throw an exception' }); + , function() { + return 'expected ' + name + ' to throw an exception'; + } + , function() { + return 'expected ' + name + ' not to throw an exception'; + }); }; /** @@ -180,8 +189,8 @@ * @api public */ - Assertion.prototype.empty = function () { - var expectation; + Assertion.prototype.empty = function() { + let expectation; if ('object' == typeof this.obj && null !== this.obj && !isArray(this.obj)) { if ('number' == typeof this.obj.length) { @@ -200,8 +209,12 @@ this.assert( expectation - , function(){ return 'expected ' + i(this.obj) + ' to be empty' } - , function(){ return 'expected ' + i(this.obj) + ' to not be empty' }); + , function() { + return 'expected ' + i(this.obj) + ' to be empty'; + } + , function() { + return 'expected ' + i(this.obj) + ' to not be empty'; + }); return this; }; @@ -212,11 +225,15 @@ */ Assertion.prototype.be = - Assertion.prototype.equal = function (obj) { + Assertion.prototype.equal = function(obj) { this.assert( obj === this.obj - , function(){ return 'expected ' + i(this.obj) + ' to equal ' + i(obj) } - , function(){ return 'expected ' + i(this.obj) + ' to not equal ' + i(obj) }); + , function() { + return 'expected ' + i(this.obj) + ' to equal ' + i(obj); + } + , function() { + return 'expected ' + i(this.obj) + ' to not equal ' + i(obj); + }); return this; }; @@ -226,12 +243,16 @@ * @api public */ - Assertion.prototype.eql = function (obj) { + Assertion.prototype.eql = function(obj) { this.assert( expect.eql(this.obj, obj) - , function(){ return 'expected ' + i(this.obj) + ' to sort of equal ' + i(obj) } - , function(){ return 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj) } - , obj); + , function() { + return 'expected ' + i(this.obj) + ' to sort of equal ' + i(obj); + } + , function() { + return 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj); + } + , obj); return this; }; @@ -243,12 +264,16 @@ * @api public */ - Assertion.prototype.within = function (start, finish) { - var range = start + '..' + finish; + Assertion.prototype.within = function(start, finish) { + const range = start + '..' + finish; this.assert( this.obj >= start && this.obj <= finish - , function(){ return 'expected ' + i(this.obj) + ' to be within ' + range } - , function(){ return 'expected ' + i(this.obj) + ' to not be within ' + range }); + , function() { + return 'expected ' + i(this.obj) + ' to be within ' + range; + } + , function() { + return 'expected ' + i(this.obj) + ' to not be within ' + range; + }); return this; }; @@ -259,27 +284,35 @@ */ Assertion.prototype.a = - Assertion.prototype.an = function (type) { + Assertion.prototype.an = function(type) { if ('string' == typeof type) { // proper english in error msg - var n = /^[aeiou]/.test(type) ? 'n' : ''; + const n = /^[aeiou]/.test(type) ? 'n' : ''; // typeof with support for 'array' this.assert( 'array' == type ? isArray(this.obj) : 'regexp' == type ? isRegExp(this.obj) : - 'object' == type - ? 'object' == typeof this.obj && null !== this.obj - : type == typeof this.obj - , function(){ return 'expected ' + i(this.obj) + ' to be a' + n + ' ' + type } - , function(){ return 'expected ' + i(this.obj) + ' not to be a' + n + ' ' + type }); + 'object' == type ? + 'object' == typeof this.obj && null !== this.obj : + type == typeof this.obj + , function() { + return 'expected ' + i(this.obj) + ' to be a' + n + ' ' + type; + } + , function() { + return 'expected ' + i(this.obj) + ' not to be a' + n + ' ' + type; + }); } else { // instanceof - var name = type.name || 'supplied constructor'; + const name = type.name || 'supplied constructor'; this.assert( this.obj instanceof type - , function(){ return 'expected ' + i(this.obj) + ' to be an instance of ' + name } - , function(){ return 'expected ' + i(this.obj) + ' not to be an instance of ' + name }); + , function() { + return 'expected ' + i(this.obj) + ' to be an instance of ' + name; + } + , function() { + return 'expected ' + i(this.obj) + ' not to be an instance of ' + name; + }); } return this; @@ -293,11 +326,15 @@ */ Assertion.prototype.greaterThan = - Assertion.prototype.above = function (n) { + Assertion.prototype.above = function(n) { this.assert( this.obj > n - , function(){ return 'expected ' + i(this.obj) + ' to be above ' + n } - , function(){ return 'expected ' + i(this.obj) + ' to be below ' + n }); + , function() { + return 'expected ' + i(this.obj) + ' to be above ' + n; + } + , function() { + return 'expected ' + i(this.obj) + ' to be below ' + n; + }); return this; }; @@ -309,11 +346,15 @@ */ Assertion.prototype.lessThan = - Assertion.prototype.below = function (n) { + Assertion.prototype.below = function(n) { this.assert( this.obj < n - , function(){ return 'expected ' + i(this.obj) + ' to be below ' + n } - , function(){ return 'expected ' + i(this.obj) + ' to be above ' + n }); + , function() { + return 'expected ' + i(this.obj) + ' to be below ' + n; + } + , function() { + return 'expected ' + i(this.obj) + ' to be above ' + n; + }); return this; }; @@ -324,11 +365,15 @@ * @api public */ - Assertion.prototype.match = function (regexp) { + Assertion.prototype.match = function(regexp) { this.assert( regexp.exec(this.obj) - , function(){ return 'expected ' + i(this.obj) + ' to match ' + regexp } - , function(){ return 'expected ' + i(this.obj) + ' not to match ' + regexp }); + , function() { + return 'expected ' + i(this.obj) + ' to match ' + regexp; + } + , function() { + return 'expected ' + i(this.obj) + ' not to match ' + regexp; + }); return this; }; @@ -339,13 +384,17 @@ * @api public */ - Assertion.prototype.length = function (n) { + Assertion.prototype.length = function(n) { expect(this.obj).to.have.property('length'); - var len = this.obj.length; + const len = this.obj.length; this.assert( n == len - , function(){ return 'expected ' + i(this.obj) + ' to have a length of ' + n + ' but got ' + len } - , function(){ return 'expected ' + i(this.obj) + ' to not have a length of ' + len }); + , function() { + return 'expected ' + i(this.obj) + ' to have a length of ' + n + ' but got ' + len; + } + , function() { + return 'expected ' + i(this.obj) + ' to not have a length of ' + len; + }); return this; }; @@ -357,12 +406,16 @@ * @api public */ - Assertion.prototype.property = function (name, val) { + Assertion.prototype.property = function(name, val) { if (this.flags.own) { this.assert( Object.prototype.hasOwnProperty.call(this.obj, name) - , function(){ return 'expected ' + i(this.obj) + ' to have own property ' + i(name) } - , function(){ return 'expected ' + i(this.obj) + ' to not have own property ' + i(name) }); + , function() { + return 'expected ' + i(this.obj) + ' to have own property ' + i(name); + } + , function() { + return 'expected ' + i(this.obj) + ' to not have own property ' + i(name); + }); return this; } @@ -371,26 +424,34 @@ throw new Error(i(this.obj) + ' has no property ' + i(name)); } } else { - var hasProp; + let hasProp; try { - hasProp = name in this.obj + hasProp = name in this.obj; } catch (e) { - hasProp = undefined !== this.obj[name] + hasProp = undefined !== this.obj[name]; } this.assert( hasProp - , function(){ return 'expected ' + i(this.obj) + ' to have a property ' + i(name) } - , function(){ return 'expected ' + i(this.obj) + ' to not have a property ' + i(name) }); + , function() { + return 'expected ' + i(this.obj) + ' to have a property ' + i(name); + } + , function() { + return 'expected ' + i(this.obj) + ' to not have a property ' + i(name); + }); } if (undefined !== val) { this.assert( val === this.obj[name] - , function(){ return 'expected ' + i(this.obj) + ' to have a property ' + i(name) - + ' of ' + i(val) + ', but got ' + i(this.obj[name]) } - , function(){ return 'expected ' + i(this.obj) + ' to not have a property ' + i(name) - + ' of ' + i(val) }); + , function() { + return 'expected ' + i(this.obj) + ' to have a property ' + i(name) + + ' of ' + i(val) + ', but got ' + i(this.obj[name]); + } + , function() { + return 'expected ' + i(this.obj) + ' to not have a property ' + i(name) + + ' of ' + i(val); + }); } this.obj = this.obj[name]; @@ -405,17 +466,25 @@ */ Assertion.prototype.string = - Assertion.prototype.contain = function (obj) { + Assertion.prototype.contain = function(obj) { if ('string' == typeof this.obj) { this.assert( ~this.obj.indexOf(obj) - , function(){ return 'expected ' + i(this.obj) + ' to contain ' + i(obj) } - , function(){ return 'expected ' + i(this.obj) + ' to not contain ' + i(obj) }); + , function() { + return 'expected ' + i(this.obj) + ' to contain ' + i(obj); + } + , function() { + return 'expected ' + i(this.obj) + ' to not contain ' + i(obj); + }); } else { this.assert( ~indexOf(this.obj, obj) - , function(){ return 'expected ' + i(this.obj) + ' to contain ' + i(obj) } - , function(){ return 'expected ' + i(this.obj) + ' to not contain ' + i(obj) }); + , function() { + return 'expected ' + i(this.obj) + ' to contain ' + i(obj); + } + , function() { + return 'expected ' + i(this.obj) + ' to not contain ' + i(obj); + }); } return this; }; @@ -429,21 +498,21 @@ */ Assertion.prototype.key = - Assertion.prototype.keys = function ($keys) { - var str - , ok = true; + Assertion.prototype.keys = function($keys) { + let str + ; let ok = true; - $keys = isArray($keys) - ? $keys - : Array.prototype.slice.call(arguments); + $keys = isArray($keys) ? + $keys : + Array.prototype.slice.call(arguments); if (!$keys.length) throw new Error('keys required'); - var actual = keys(this.obj) - , len = $keys.length; + const actual = keys(this.obj) + ; const len = $keys.length; // Inclusion - ok = every($keys, function (key) { + ok = every($keys, function(key) { return ~indexOf(actual, key); }); @@ -454,10 +523,10 @@ // Key string if (len > 1) { - $keys = map($keys, function (key) { + $keys = map($keys, function(key) { return i(key); }); - var last = $keys.pop(); + const last = $keys.pop(); str = $keys.join(', ') + ', and ' + last; } else { str = i($keys[0]); @@ -472,8 +541,12 @@ // Assertion this.assert( ok - , function(){ return 'expected ' + i(this.obj) + ' to ' + str } - , function(){ return 'expected ' + i(this.obj) + ' to not ' + str }); + , function() { + return 'expected ' + i(this.obj) + ' to ' + str; + } + , function() { + return 'expected ' + i(this.obj) + ' to not ' + str; + }); return this; }; @@ -484,8 +557,10 @@ * @param {String ...} custom message * @api public */ - Assertion.prototype.fail = function (msg) { - var error = function() { return msg || "explicit failure"; } + Assertion.prototype.fail = function(msg) { + const error = function() { + return msg || 'explicit failure'; + }; this.assert(false, error, error); return this; }; @@ -494,10 +569,10 @@ * Function bind implementation. */ - function bind (fn, scope) { - return function () { + function bind(fn, scope) { + return function() { return fn.apply(scope, arguments); - } + }; } /** @@ -507,9 +582,9 @@ * @api public */ - function every (arr, fn, thisObj) { - var scope = thisObj || global; - for (var i = 0, j = arr.length; i < j; ++i) { + function every(arr, fn, thisObj) { + const scope = thisObj || global; + for (let i = 0, j = arr.length; i < j; ++i) { if (!fn.call(scope, arr[i], i, arr)) { return false; } @@ -524,7 +599,7 @@ * @api public */ - function indexOf (arr, o, i) { + function indexOf(arr, o, i) { if (Array.prototype.indexOf) { return Array.prototype.indexOf.call(arr, o, i); } @@ -534,18 +609,18 @@ } for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0 - ; i < j && arr[i] !== o; i++); + ; i < j && arr[i] !== o; i++); return j <= i ? -1 : i; } // https://gist.github.com/1044128/ - var getOuterHTML = function(element) { + const getOuterHTML = function(element) { if ('outerHTML' in element) return element.outerHTML; - var ns = "http://www.w3.org/1999/xhtml"; - var container = document.createElementNS(ns, '_'); - var xmlSerializer = new XMLSerializer(); - var html; + const ns = 'http://www.w3.org/1999/xhtml'; + const container = document.createElementNS(ns, '_'); + const xmlSerializer = new XMLSerializer(); + let html; if (document.xmlVersion) { return xmlSerializer.serializeToString(element); } else { @@ -557,7 +632,7 @@ }; // Returns true if object is a DOM element. - var isDOMElement = function (object) { + const isDOMElement = function(object) { if (typeof HTMLElement === 'object') { return object instanceof HTMLElement; } else { @@ -575,14 +650,14 @@ * @api private */ - function i (obj, showHidden, depth) { - var seen = []; + function i(obj, showHidden, depth) { + const seen = []; - function stylize (str) { + function stylize(str) { return str; } - function format (value, recurseTimes) { + function format(value, recurseTimes) { // Provide a hook for user-specified inspect functions. // Check that value is an object with an inspect function on it if (value && typeof value.inspect === 'function' && @@ -600,8 +675,8 @@ case 'string': var simple = '\'' + json.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; + .replace(/'/g, '\\\'') + .replace(/\\"/g, '"') + '\''; return stylize(simple, 'string'); case 'number': @@ -620,15 +695,15 @@ } // Look up the keys of the object. - var visible_keys = keys(value); - var $keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys; + const visible_keys = keys(value); + const $keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys; // Functions without properties can be shortcutted. if (typeof value === 'function' && $keys.length === 0) { if (isRegExp(value)) { return stylize('' + value, 'regexp'); } else { - var name = value.name ? ': ' + value.name : ''; + const name = value.name ? ': ' + value.name : ''; return stylize('[Function' + name + ']', 'special'); } } @@ -637,13 +712,13 @@ if (isDate(value) && $keys.length === 0) { return stylize(value.toUTCString(), 'date'); } - + // Error objects can be shortcutted if (value instanceof Error) { - return stylize("["+value.toString()+"]", 'Error'); + return stylize('['+value.toString()+']', 'Error'); } - var base, type, braces; + let base; let type; let braces; // Determine the object type if (isArray(value)) { type = 'Array'; @@ -655,7 +730,7 @@ // Make functions say that they are functions if (typeof value === 'function') { - var n = value.name ? ': ' + value.name : ''; + const n = value.name ? ': ' + value.name : ''; base = (isRegExp(value)) ? ' ' + value : ' [Function' + n + ']'; } else { base = ''; @@ -680,8 +755,8 @@ seen.push(value); - var output = map($keys, function (key) { - var name, str; + let output = map($keys, function(key) { + let name; let str; if (value.__lookupGetter__) { if (value.__lookupGetter__(key)) { if (value.__lookupSetter__(key)) { @@ -707,11 +782,11 @@ } if (str.indexOf('\n') > -1) { if (isArray(value)) { - str = map(str.split('\n'), function (line) { + str = map(str.split('\n'), function(line) { return ' ' + line; }).join('\n').substr(2); } else { - str = '\n' + map(str.split('\n'), function (line) { + str = '\n' + map(str.split('\n'), function(line) { return ' ' + line; }).join('\n'); } @@ -729,9 +804,9 @@ name = name.substr(1, name.length - 2); name = stylize(name, 'name'); } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); + name = name.replace(/'/g, '\\\'') + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, '\''); name = stylize(name, 'string'); } } @@ -741,8 +816,8 @@ seen.pop(); - var numLinesEst = 0; - var length = reduce(output, function (prev, cur) { + let numLinesEst = 0; + const length = reduce(output, function(prev, cur) { numLinesEst++; if (indexOf(cur, '\n') >= 0) numLinesEst++; return prev + cur.length + 1; @@ -755,7 +830,6 @@ output.join(',\n ') + ' ' + braces[1]; - } else { output = braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; } @@ -767,12 +841,12 @@ expect.stringify = i; - function isArray (ar) { + function isArray(ar) { return Object.prototype.toString.call(ar) === '[object Array]'; } function isRegExp(re) { - var s; + let s; try { s = '' + re; } catch (e) { @@ -793,14 +867,14 @@ return d instanceof Date; } - function keys (obj) { + function keys(obj) { if (Object.keys) { return Object.keys(obj); } - var keys = []; + const keys = []; - for (var i in obj) { + for (const i in obj) { if (Object.prototype.hasOwnProperty.call(obj, i)) { keys.push(i); } @@ -809,38 +883,42 @@ return keys; } - function map (arr, mapper, that) { + function map(arr, mapper, that) { if (Array.prototype.map) { return Array.prototype.map.call(arr, mapper, that); } - var other= new Array(arr.length); + const other= new Array(arr.length); - for (var i= 0, n = arr.length; i= 2) { var rv = arguments[1]; } else { @@ -851,14 +929,16 @@ } // if array contains no values, no initial value to return - if (++i >= len) + if (++i >= len) { throw new TypeError(); + } } while (true); } for (; i < len; i++) { - if (i in this) + if (i in this) { rv = fun.call(null, rv, this[i], i, this); + } } return rv; @@ -875,11 +955,11 @@ // 7.1. All identical values are equivalent, as determined by ===. if (actual === expected) { return true; - } else if ('undefined' != typeof Buffer - && Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { + } else if ('undefined' != typeof Buffer && + Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { if (actual.length != expected.length) return false; - for (var i = 0; i < actual.length; i++) { + for (let i = 0; i < actual.length; i++) { if (actual[i] !== expected[i]) return false; } @@ -909,25 +989,26 @@ } }; - function isUndefinedOrNull (value) { + function isUndefinedOrNull(value) { return value === null || value === undefined; } - function isArguments (object) { + function isArguments(object) { return Object.prototype.toString.call(object) == '[object Arguments]'; } - function regExpEquiv (a, b) { + function regExpEquiv(a, b) { return a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline; } - function objEquiv (a, b) { - if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) + function objEquiv(a, b) { + if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) { return false; + } // an identical "prototype" property. if (a.prototype !== b.prototype) return false; - //~~~I've managed to break Object.keys through screwy arguments passing. + // ~~~I've managed to break Object.keys through screwy arguments passing. // Converting to array solves the problem. if (isArguments(a)) { if (!isArguments(b)) { @@ -937,338 +1018,333 @@ b = pSlice.call(b); return expect.eql(a, b); } - try{ - var ka = keys(a), - kb = keys(b), - key, i; - } catch (e) {//happens when one is a string literal and the other isn't + try { + var ka = keys(a); + var kb = keys(b); + var key; var i; + } catch (e) {// happens when one is a string literal and the other isn't return false; } // having the same number of owned properties (keys incorporates hasOwnProperty) - if (ka.length != kb.length) + if (ka.length != kb.length) { return false; - //the same set of keys (although not necessarily the same order), + } + // the same set of keys (although not necessarily the same order), ka.sort(); kb.sort(); - //~~~cheap key test + // ~~~cheap key test for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) + if (ka[i] != kb[i]) { return false; + } } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test + // equivalent values for every corresponding key, and + // ~~~possibly expensive deep test for (i = ka.length - 1; i >= 0; i--) { key = ka[i]; - if (!expect.eql(a[key], b[key])) - return false; + if (!expect.eql(a[key], b[key])) { + return false; + } } return true; } - var json = (function () { - "use strict"; + var json = (function() { + 'use strict'; if ('object' == typeof JSON && JSON.parse && JSON.stringify) { return { - parse: nativeJSON.parse - , stringify: nativeJSON.stringify - } + parse: nativeJSON.parse, + stringify: nativeJSON.stringify, + }; } var JSON = {}; function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; + // Format integers to have at least two digits. + return n < 10 ? '0' + n : n; } function date(d, key) { return isFinite(d.valueOf()) ? - d.getUTCFullYear() + '-' + + d.getUTCFullYear() + '-' + f(d.getUTCMonth() + 1) + '-' + - f(d.getUTCDate()) + 'T' + - f(d.getUTCHours()) + ':' + - f(d.getUTCMinutes()) + ':' + - f(d.getUTCSeconds()) + 'Z' : null; + f(d.getUTCDate()) + 'T' + + f(d.getUTCHours()) + ':' + + f(d.getUTCMinutes()) + ':' + + f(d.getUTCSeconds()) + 'Z' : null; } - var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - gap, - indent, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - rep; + const cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; + const escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; + let gap; + let indent; + const meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"': '\\"', + '\\': '\\\\', + }; + let rep; function quote(string) { - - // If the string contains no control characters, no quote characters, and no - // backslash characters, then we can safely slap some quotes around it. - // Otherwise we must also replace the offending characters with safe escape - // sequences. - - escapable.lastIndex = 0; - return escapable.test(string) ? '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' ? c : + // If the string contains no control characters, no quote characters, and no + // backslash characters, then we can safely slap some quotes around it. + // Otherwise we must also replace the offending characters with safe escape + // sequences. + + escapable.lastIndex = 0; + return escapable.test(string) ? '"' + string.replace(escapable, function(a) { + const c = meta[a]; + return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : '"' + string + '"'; + }) + '"' : '"' + string + '"'; } function str(key, holder) { + // Produce a string from holder[key]. - // Produce a string from holder[key]. + let i; // The loop counter. + let k; // The member key. + let v; // The member value. + let length; + const mind = gap; + let partial; + let value = holder[key]; - var i, // The loop counter. - k, // The member key. - v, // The member value. - length, - mind = gap, - partial, - value = holder[key]; + // If the value has a toJSON method, call it to obtain a replacement value. - // If the value has a toJSON method, call it to obtain a replacement value. - - if (value instanceof Date) { - value = date(key); - } + if (value instanceof Date) { + value = date(key); + } - // If we were called with a replacer function, then call the replacer to - // obtain a replacement value. + // If we were called with a replacer function, then call the replacer to + // obtain a replacement value. - if (typeof rep === 'function') { - value = rep.call(holder, key, value); - } + if (typeof rep === 'function') { + value = rep.call(holder, key, value); + } - // What happens next depends on the value's type. + // What happens next depends on the value's type. - switch (typeof value) { + switch (typeof value) { case 'string': - return quote(value); + return quote(value); case 'number': - // JSON numbers must be finite. Encode non-finite numbers as null. + // JSON numbers must be finite. Encode non-finite numbers as null. - return isFinite(value) ? String(value) : 'null'; + return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': - // If the value is a boolean or null, convert it to a string. Note: - // typeof null does not produce 'null'. The case is included here in - // the remote chance that this gets fixed someday. + // If the value is a boolean or null, convert it to a string. Note: + // typeof null does not produce 'null'. The case is included here in + // the remote chance that this gets fixed someday. - return String(value); + return String(value); - // If the type is 'object', we might be dealing with an object or an array or - // null. + // If the type is 'object', we might be dealing with an object or an array or + // null. case 'object': - // Due to a specification blunder in ECMAScript, typeof null is 'object', - // so watch out for that case. - - if (!value) { - return 'null'; - } + // Due to a specification blunder in ECMAScript, typeof null is 'object', + // so watch out for that case. - // Make an array to hold the partial results of stringifying this object value. + if (!value) { + return 'null'; + } - gap += indent; - partial = []; + // Make an array to hold the partial results of stringifying this object value. - // Is the value an array? + gap += indent; + partial = []; - if (Object.prototype.toString.apply(value) === '[object Array]') { + // Is the value an array? - // The value is an array. Stringify every element. Use null as a placeholder - // for non-JSON values. + if (Object.prototype.toString.apply(value) === '[object Array]') { + // The value is an array. Stringify every element. Use null as a placeholder + // for non-JSON values. - length = value.length; - for (i = 0; i < length; i += 1) { - partial[i] = str(i, value) || 'null'; - } + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || 'null'; + } - // Join all of the elements together, separated with commas, and wrap them in - // brackets. + // Join all of the elements together, separated with commas, and wrap them in + // brackets. - v = partial.length === 0 ? '[]' : gap ? + v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']'; - gap = mind; - return v; - } + gap = mind; + return v; + } - // If the replacer is an array, use it to select the members to be stringified. - - if (rep && typeof rep === 'object') { - length = rep.length; - for (i = 0; i < length; i += 1) { - if (typeof rep[i] === 'string') { - k = rep[i]; - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } else { + // If the replacer is an array, use it to select the members to be stringified. - // Otherwise, iterate through all of the keys in the object. + if (rep && typeof rep === 'object') { + length = rep.length; + for (i = 0; i < length; i += 1) { + if (typeof rep[i] === 'string') { + k = rep[i]; + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } else { + // Otherwise, iterate through all of the keys in the object. - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); } + } } + } - // Join all of the member texts together, separated with commas, - // and wrap them in braces. + // Join all of the member texts together, separated with commas, + // and wrap them in braces. - v = partial.length === 0 ? '{}' : gap ? + v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}'; - gap = mind; - return v; - } + gap = mind; + return v; + } } - // If the JSON object does not yet have a stringify method, give it one. - - JSON.stringify = function (value, replacer, space) { + // If the JSON object does not yet have a stringify method, give it one. - // The stringify method takes a value and an optional replacer, and an optional - // space parameter, and returns a JSON text. The replacer can be a function - // that can replace values, or an array of strings that will select the keys. - // A default replacer method can be provided. Use of the space parameter can - // produce text that is more easily readable. + JSON.stringify = function(value, replacer, space) { + // The stringify method takes a value and an optional replacer, and an optional + // space parameter, and returns a JSON text. The replacer can be a function + // that can replace values, or an array of strings that will select the keys. + // A default replacer method can be provided. Use of the space parameter can + // produce text that is more easily readable. - var i; - gap = ''; - indent = ''; + let i; + gap = ''; + indent = ''; - // If the space parameter is a number, make an indent string containing that - // many spaces. + // If the space parameter is a number, make an indent string containing that + // many spaces. - if (typeof space === 'number') { - for (i = 0; i < space; i += 1) { - indent += ' '; - } - - // If the space parameter is a string, it will be used as the indent string. - - } else if (typeof space === 'string') { - indent = space; + if (typeof space === 'number') { + for (i = 0; i < space; i += 1) { + indent += ' '; } - // If there is a replacer, it must be a function or an array. - // Otherwise, throw an error. + // If the space parameter is a string, it will be used as the indent string. + } else if (typeof space === 'string') { + indent = space; + } + + // If there is a replacer, it must be a function or an array. + // Otherwise, throw an error. - rep = replacer; - if (replacer && typeof replacer !== 'function' && + rep = replacer; + if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { - throw new Error('JSON.stringify'); - } + throw new Error('JSON.stringify'); + } - // Make a fake root object containing our value under the key of ''. - // Return the result of stringifying the value. + // Make a fake root object containing our value under the key of ''. + // Return the result of stringifying the value. - return str('', {'': value}); + return str('', {'': value}); }; - // If the JSON object does not yet have a parse method, give it one. + // If the JSON object does not yet have a parse method, give it one. - JSON.parse = function (text, reviver) { + JSON.parse = function(text, reviver) { // The parse method takes a text and an optional reviver function, and returns // a JavaScript value if the text is a valid JSON text. - var j; + let j; - function walk(holder, key) { + function walk(holder, key) { + // The walk method is used to recursively walk the resulting structure so + // that modifications can be made. - // The walk method is used to recursively walk the resulting structure so - // that modifications can be made. - - var k, v, value = holder[key]; - if (value && typeof value === 'object') { - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - } - } + let k; let v; const value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } } - return reviver.call(holder, key, value); + } } + return reviver.call(holder, key, value); + } - // Parsing happens in four stages. In the first stage, we replace certain - // Unicode characters with escape sequences. JavaScript handles many characters - // incorrectly, either silently deleting them, or treating them as line endings. + // Parsing happens in four stages. In the first stage, we replace certain + // Unicode characters with escape sequences. JavaScript handles many characters + // incorrectly, either silently deleting them, or treating them as line endings. - text = String(text); - cx.lastIndex = 0; - if (cx.test(text)) { - text = text.replace(cx, function (a) { - return '\\u' + + text = String(text); + cx.lastIndex = 0; + if (cx.test(text)) { + text = text.replace(cx, function(a) { + return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }); - } - - // In the second stage, we run the text against regular expressions that look - // for non-JSON patterns. We are especially concerned with '()' and 'new' - // because they can cause invocation, and '=' because it can cause mutation. - // But just to be safe, we want to reject all unexpected forms. - - // We split the second stage into 4 regexp operations in order to work around - // crippling inefficiencies in IE's and Safari's regexp engines. First we - // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we - // replace all simple value tokens with ']' characters. Third, we delete all - // open brackets that follow a colon or comma or that begin the text. Finally, - // we look to see that the remaining characters are only whitespace or ']' or - // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. - - if (/^[\],:{}\s]*$/ - .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') - .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') - .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { - - // In the third stage we use the eval function to compile the text into a - // JavaScript structure. The '{' operator is subject to a syntactic ambiguity - // in JavaScript: it can begin a block or an object literal. We wrap the text - // in parens to eliminate the ambiguity. - - j = eval('(' + text + ')'); - - // In the optional fourth stage, we recursively walk the new structure, passing - // each name/value pair to a reviver function for possible transformation. + }); + } - return typeof reviver === 'function' ? + // In the second stage, we run the text against regular expressions that look + // for non-JSON patterns. We are especially concerned with '()' and 'new' + // because they can cause invocation, and '=' because it can cause mutation. + // But just to be safe, we want to reject all unexpected forms. + + // We split the second stage into 4 regexp operations in order to work around + // crippling inefficiencies in IE's and Safari's regexp engines. First we + // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we + // replace all simple value tokens with ']' characters. Third, we delete all + // open brackets that follow a colon or comma or that begin the text. Finally, + // we look to see that the remaining characters are only whitespace or ']' or + // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. + + if (/^[\],:{}\s]*$/ + .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') + .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') + .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { + // In the third stage we use the eval function to compile the text into a + // JavaScript structure. The '{' operator is subject to a syntactic ambiguity + // in JavaScript: it can begin a block or an object literal. We wrap the text + // in parens to eliminate the ambiguity. + + j = eval('(' + text + ')'); + + // In the optional fourth stage, we recursively walk the new structure, passing + // each name/value pair to a reviver function for possible transformation. + + return typeof reviver === 'function' ? walk({'': j}, '') : j; - } + } - // If the text is not JSON parseable, then a SyntaxError is thrown. + // If the text is not JSON parseable, then a SyntaxError is thrown. - throw new SyntaxError('JSON.parse'); + throw new SyntaxError('JSON.parse'); }; return JSON; @@ -1277,8 +1353,7 @@ if ('undefined' != typeof window) { window.expect = module.exports; } - })( this - , 'undefined' != typeof module ? module : {exports: {}} + , 'undefined' != typeof module ? module : {exports: {}} ); diff --git a/examples/mocha/lib/mocha/mocha.js b/examples/mocha/lib/mocha/mocha.js index 19edc87..8975caa 100644 --- a/examples/mocha/lib/mocha/mocha.js +++ b/examples/mocha/lib/mocha/mocha.js @@ -1,10 +1,9 @@ -;(function(){ +;(function() { + // CommonJS require() -// CommonJS require() - -function require(p){ - var path = require.resolve(p) - , mod = require.modules[path]; + function require(p) { + const path = require.resolve(p) + ; const mod = require.modules[path]; if (!mod) throw new Error('failed to require "' + p + '"'); if (!mod.exports) { mod.exports = {}; @@ -13,31 +12,31 @@ function require(p){ return mod.exports; } -require.modules = {}; + require.modules = {}; -require.resolve = function (path){ - var orig = path - , reg = path + '.js' - , index = path + '/index.js'; - return require.modules[reg] && reg - || require.modules[index] && index - || orig; + require.resolve = function(path) { + const orig = path + ; const reg = path + '.js' + ; const index = path + '/index.js'; + return require.modules[reg] && reg || + require.modules[index] && index || + orig; }; -require.register = function (path, fn){ + require.register = function(path, fn) { require.modules[path] = fn; }; -require.relative = function (parent) { - return function(p){ + require.relative = function(parent) { + return function(p) { if ('.' != p.charAt(0)) return require(p); - var path = parent.split('/') - , segs = p.split('/'); + const path = parent.split('/') + ; const segs = p.split('/'); path.pop(); - for (var i = 0; i < segs.length; i++) { - var seg = segs[i]; + for (let i = 0; i < segs.length; i++) { + const seg = segs[i]; if ('..' == seg) path.pop(); else if ('.' != seg) path.push(seg); } @@ -47,19 +46,17 @@ require.relative = function (parent) { }; -require.register("browser/debug.js", function(module, exports, require){ - -module.exports = function(type){ - return function(){ - } -}; - -}); // module: browser/debug.js + require.register('browser/debug.js', function(module, exports, require) { + module.exports = function(type) { + return function() { + }; + }; + }); // module: browser/debug.js -require.register("browser/diff.js", function(module, exports, require){ -/* See LICENSE file for terms of use */ + require.register('browser/diff.js', function(module, exports, require) { + /* See LICENSE file for terms of use */ -/* + /* * Text diff implementation. * * This library supports the following APIS: @@ -73,555 +70,567 @@ require.register("browser/diff.js", function(module, exports, require){ * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986). * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 */ -var JsDiff = (function() { - /*jshint maxparams: 5*/ - 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]); + const JsDiff = (function() { + /* jshint maxparams: 5*/ + function clonePath(path) { + return {newPos: path.newPos, components: path.components.slice(0)}; + } + function removeEmpty(array) { + const ret = []; + for (let i = 0; i < array.length; i++) { + if (array[i]) { + ret.push(array[i]); + } + } + return ret; + } + function escapeHTML(s) { + let n = s; + n = n.replace(/&/g, '&'); + n = n.replace(//g, '>'); + n = n.replace(/"/g, '"'); + + return n; } - } - return ret; - } - function escapeHTML(s) { - var n = s; - n = n.replace(/&/g, '&'); - n = n.replace(//g, '>'); - n = n.replace(/"/g, '"'); - - return n; - } - var Diff = function(ignoreWhitespace) { - this.ignoreWhitespace = ignoreWhitespace; - }; - Diff.prototype = { - diff: function(oldString, newString) { + const Diff = function(ignoreWhitespace) { + this.ignoreWhitespace = ignoreWhitespace; + }; + Diff.prototype = { + diff: function(oldString, newString) { // Handle the identity case (this is due to unrolling editLength == 0 - if (newString === oldString) { - return [{ value: newString }]; - } - if (!newString) { - return [{ value: oldString, removed: true }]; - } - if (!oldString) { - return [{ value: newString, added: true }]; - } + if (newString === oldString) { + return [{value: newString}]; + } + if (!newString) { + return [{value: oldString, removed: true}]; + } + if (!oldString) { + return [{value: newString, added: true}]; + } - newString = this.tokenize(newString); - oldString = this.tokenize(oldString); + newString = this.tokenize(newString); + oldString = this.tokenize(oldString); - var newLen = newString.length, oldLen = oldString.length; - var maxEditLength = newLen + oldLen; - var bestPath = [{ newPos: -1, components: [] }]; + const newLen = newString.length; const oldLen = oldString.length; + const maxEditLength = newLen + oldLen; + const bestPath = [{newPos: -1, components: []}]; - // Seed editLength = 0 - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); - if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) { - return bestPath[0].components; - } + // Seed editLength = 0 + var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); + if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) { + return bestPath[0].components; + } - for (var editLength = 1; editLength <= maxEditLength; editLength++) { - 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) { + for (let editLength = 1; editLength <= maxEditLength; editLength++) { + for (let diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) { + var basePath; + const addPath = bestPath[diagonalPath-1]; + const 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; - } + bestPath[diagonalPath-1] = undefined; + } - var canAdd = addPath && addPath.newPos+1 < newLen; - var canRemove = removePath && 0 <= oldPos && oldPos < oldLen; - if (!canAdd && !canRemove) { - bestPath[diagonalPath] = undefined; - continue; - } + const canAdd = addPath && addPath.newPos+1 < newLen; + const canRemove = removePath && 0 <= oldPos && oldPos < oldLen; + if (!canAdd && !canRemove) { + 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); - this.pushComponent(basePath.components, oldString[oldPos], undefined, true); - } else { - basePath = clonePath(addPath); - basePath.newPos++; - this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined); - } + // 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); + this.pushComponent(basePath.components, oldString[oldPos], undefined, true); + } else { + basePath = clonePath(addPath); + basePath.newPos++; + this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined); + } - var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath); + var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath); - if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) { - return basePath.components; - } else { - bestPath[diagonalPath] = basePath; + if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) { + return basePath.components; + } else { + bestPath[diagonalPath] = basePath; + } } } - } - }, + }, - pushComponent: function(components, value, added, removed) { - var last = components[components.length-1]; - if (last && last.added === added && last.removed === removed) { + pushComponent: function(components, value, added, removed) { + const 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] = - {value: this.join(last.value, value), added: added, removed: removed }; - } else { - components.push({value: value, added: added, removed: removed }); - } - }, - extractCommon: function(basePath, newString, oldString, diagonalPath) { - var newLen = newString.length, - oldLen = oldString.length, - newPos = basePath.newPos, - oldPos = newPos - diagonalPath; - while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) { - newPos++; - oldPos++; - - this.pushComponent(basePath.components, newString[newPos], undefined, undefined); - } - basePath.newPos = newPos; - return oldPos; - }, - - equals: function(left, right) { - var reWhitespace = /\S/; - if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) { - return true; - } else { - return left === right; - } - }, - join: function(left, right) { - return left + right; - }, - tokenize: function(value) { - return value; - } - }; - - 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(); - LineDiff.tokenize = function(value) { - return value.split(/^/m); - }; - - return { - Diff: Diff, - - diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); }, - diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); }, - diffWordsWithSpace: function(oldStr, newStr) { return WordWithSpaceDiff.diff(oldStr, newStr); }, - diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); }, - - diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); }, - - createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) { - var ret = []; - - ret.push('Index: ' + fileName); - ret.push('==================================================================='); - ret.push('--- ' + fileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader)); - ret.push('+++ ' + fileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader)); - - var diff = LineDiff.diff(oldStr, newStr); - if (!diff[diff.length-1].value) { - diff.pop(); // Remove trailing newline add - } - diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier - - function contextLines(lines) { - return lines.map(function(entry) { return ' ' + entry; }); - } - 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 || current.removed !== last.removed); - - // 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'); - } - } + components[components.length-1] = + {value: this.join(last.value, value), added: added, removed: removed}; + } else { + components.push({value: value, added: added, removed: removed}); + } + }, + extractCommon: function(basePath, newString, oldString, diagonalPath) { + const newLen = newString.length; + const oldLen = oldString.length; + let newPos = basePath.newPos; + let oldPos = newPos - diagonalPath; + while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) { + newPos++; + oldPos++; + + this.pushComponent(basePath.components, newString[newPos], undefined, undefined); + } + basePath.newPos = newPos; + return oldPos; + }, + + equals: function(left, right) { + const reWhitespace = /\S/; + if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) { + return true; + } else { + return left === right; + } + }, + join: function(left, right) { + return left + right; + }, + tokenize: function(value) { + return value; + }, + }; + + const CharDiff = new Diff(); + + const WordDiff = new Diff(true); + const WordWithSpaceDiff = new Diff(); + WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) { + return removeEmpty(value.split(/(\s+|\b)/)); + }; + + const CssDiff = new Diff(true); + CssDiff.tokenize = function(value) { + return removeEmpty(value.split(/([{}:;,]|\s+)/)); + }; + + const LineDiff = new Diff(); + LineDiff.tokenize = function(value) { + return value.split(/^/m); + }; + + return { + Diff: Diff, + + diffChars: function(oldStr, newStr) { + return CharDiff.diff(oldStr, newStr); + }, + diffWords: function(oldStr, newStr) { + return WordDiff.diff(oldStr, newStr); + }, + diffWordsWithSpace: function(oldStr, newStr) { + return WordWithSpaceDiff.diff(oldStr, newStr); + }, + diffLines: function(oldStr, newStr) { + return LineDiff.diff(oldStr, newStr); + }, + + diffCss: function(oldStr, newStr) { + return CssDiff.diff(oldStr, newStr); + }, + + createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) { + const ret = []; + + ret.push('Index: ' + fileName); + ret.push('==================================================================='); + ret.push('--- ' + fileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader)); + ret.push('+++ ' + fileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader)); + + const diff = LineDiff.diff(oldStr, newStr); + if (!diff[diff.length-1].value) { + diff.pop(); // Remove trailing newline add + } + diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier - 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 (!oldRangeStart) { - var prev = diff[i-1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = contextLines(prev.lines.slice(-4)); - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; + function contextLines(lines) { + return lines.map(function(entry) { + return ' ' + entry; + }); + } + function eofNL(curRange, i, current) { + const last = diff[diff.length-2]; + const isLast = i === diff.length-2; + const isLastOfType = i === diff.length-3 && (current.added !== last.added || current.removed !== last.removed); + + // 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'); } } - curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?'+':'-') + entry; })); - eofNL(curRange, i, current); - if (current.added) { - newLine += lines.length; - } else { - oldLine += lines.length; - } - } else { - 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)); + let oldRangeStart = 0; let newRangeStart = 0; let curRange = []; + let oldLine = 1; let newLine = 1; + for (let i = 0; i < diff.length; i++) { + var current = diff[i]; + const lines = current.lines || current.value.replace(/\n$/, '').split('\n'); + current.lines = lines; + + if (current.added || current.removed) { + if (!oldRangeStart) { + const prev = diff[i-1]; + oldRangeStart = oldLine; + newRangeStart = newLine; + + if (prev) { + curRange = contextLines(prev.lines.slice(-4)); + oldRangeStart -= curRange.length; + newRangeStart -= curRange.length; + } + } + curRange.push.apply(curRange, lines.map(function(entry) { + return (current.added?'+':'-') + entry; + })); + eofNL(curRange, i, current); + + if (current.added) { + newLine += lines.length; + } else { + oldLine += lines.length; + } } 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); + 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 + const 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; + } + } - oldRangeStart = 0; newRangeStart = 0; curRange = []; + return ret.join('\n') + '\n'; + }, + + applyPatch: function(oldStr, uniDiff) { + const diffstr = uniDiff.split('\n'); + const diff = []; + let remEOFNL = false; + let addEOFNL = false; + + for (var i = (diffstr[0][0]==='I'?4:0); i < diffstr.length; i++) { + if (diffstr[i][0] === '@') { + const meh = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/); + diff.unshift({ + start: meh[3], + oldlength: meh[2], + oldlines: [], + newlength: meh[4], + newlines: [], + }); + } else if (diffstr[i][0] === '+') { + diff[0].newlines.push(diffstr[i].substr(1)); + } else if (diffstr[i][0] === '-') { + diff[0].oldlines.push(diffstr[i].substr(1)); + } else if (diffstr[i][0] === ' ') { + diff[0].newlines.push(diffstr[i].substr(1)); + diff[0].oldlines.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; + } } } - oldLine += lines.length; - newLine += lines.length; - } - } - return ret.join('\n') + '\n'; - }, - - applyPatch: function(oldStr, uniDiff) { - var diffstr = uniDiff.split('\n'); - var diff = []; - var remEOFNL = false, - addEOFNL = false; - - for (var i = (diffstr[0][0]==='I'?4:0); i < diffstr.length; i++) { - if(diffstr[i][0] === '@') { - var meh = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/); - diff.unshift({ - start:meh[3], - oldlength:meh[2], - oldlines:[], - newlength:meh[4], - newlines:[] - }); - } else if(diffstr[i][0] === '+') { - diff[0].newlines.push(diffstr[i].substr(1)); - } else if(diffstr[i][0] === '-') { - diff[0].oldlines.push(diffstr[i].substr(1)); - } else if(diffstr[i][0] === ' ') { - diff[0].newlines.push(diffstr[i].substr(1)); - diff[0].oldlines.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; + const str = oldStr.split('\n'); + for (var i = diff.length - 1; i >= 0; i--) { + const d = diff[i]; + for (let j = 0; j < d.oldlength; j++) { + if (str[d.start-1+j] !== d.oldlines[j]) { + return false; + } + } + Array.prototype.splice.apply(str, [d.start-1, +d.oldlength].concat(d.newlines)); } - } - } - var str = oldStr.split('\n'); - for (var i = diff.length - 1; i >= 0; i--) { - var d = diff[i]; - for (var j = 0; j < d.oldlength; j++) { - if(str[d.start-1+j] !== d.oldlines[j]) { - return false; + if (remEOFNL) { + while (!str[str.length-1]) { + str.pop(); + } + } else if (addEOFNL) { + str.push(''); } - } - Array.prototype.splice.apply(str,[d.start-1,+d.oldlength].concat(d.newlines)); - } + return str.join('\n'); + }, + + convertChangesToXML: function(changes) { + const ret = []; + for ( let i = 0; i < changes.length; i++) { + const change = changes[i]; + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } - if (remEOFNL) { - while (!str[str.length-1]) { - str.pop(); - } - } else if (addEOFNL) { - str.push(''); - } - return str.join('\n'); - }, - - convertChangesToXML: function(changes){ - var ret = []; - for ( var i = 0; i < changes.length; i++) { - var change = changes[i]; - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } + ret.push(escapeHTML(change.value)); - ret.push(escapeHTML(change.value)); + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + } + return ret.join(''); + }, + + // See: http://code.google.com/p/google-diff-match-patch/wiki/API + convertChangesToDMP: function(changes) { + const ret = []; let change; + for ( let i = 0; i < changes.length; i++) { + change = changes[i]; + ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]); + } + return ret; + }, + }; + })(); - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - } - return ret.join(''); - }, - - // See: http://code.google.com/p/google-diff-match-patch/wiki/API - convertChangesToDMP: function(changes){ - var ret = [], change; - for ( var i = 0; i < changes.length; i++) { - change = changes[i]; - ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]); - } - return ret; + if (typeof module !== 'undefined') { + module.exports = JsDiff; } - }; -})(); - -if (typeof module !== 'undefined') { - module.exports = JsDiff; -} - -}); // module: browser/diff.js - -require.register("browser/events.js", function(module, exports, require){ + }); // module: browser/diff.js -/** + require.register('browser/events.js', function(module, exports, require) { + /** * Module exports. */ -exports.EventEmitter = EventEmitter; + exports.EventEmitter = EventEmitter; -/** + /** * Check if `obj` is an array. */ -function isArray(obj) { - return '[object Array]' == {}.toString.call(obj); -} + function isArray(obj) { + return '[object Array]' == {}.toString.call(obj); + } -/** + /** * Event emitter constructor. * * @api public */ -function EventEmitter(){}; + function EventEmitter() {}; -/** + /** * Adds a listener. * * @api public */ -EventEmitter.prototype.on = function (name, fn) { - if (!this.$events) { - this.$events = {}; - } + 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]; - } + 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; -}; + return this; + }; -EventEmitter.prototype.addListener = EventEmitter.prototype.on; + EventEmitter.prototype.addListener = EventEmitter.prototype.on; -/** + /** * Adds a volatile listener. * * @api public */ -EventEmitter.prototype.once = function (name, fn) { - var self = this; + EventEmitter.prototype.once = function(name, fn) { + const self = this; - function on () { - self.removeListener(name, on); - fn.apply(this, arguments); - }; + function on() { + self.removeListener(name, on); + fn.apply(this, arguments); + }; - on.listener = fn; - this.on(name, on); + on.listener = fn; + this.on(name, on); - return this; -}; + return this; + }; -/** + /** * Removes a listener. * * @api public */ -EventEmitter.prototype.removeListener = function (name, fn) { - if (this.$events && this.$events[name]) { - var list = this.$events[name]; + EventEmitter.prototype.removeListener = function(name, fn) { + if (this.$events && this.$events[name]) { + const list = this.$events[name]; - if (isArray(list)) { - var pos = -1; + if (isArray(list)) { + let 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; - } - } + for (let 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; - } + if (pos < 0) { + return this; + } - list.splice(pos, 1); + list.splice(pos, 1); - if (!list.length) { - delete this.$events[name]; + if (!list.length) { + delete this.$events[name]; + } + } else if (list === fn || (list.listener && list.listener === fn)) { + delete this.$events[name]; + } } - } else if (list === fn || (list.listener && list.listener === fn)) { - delete this.$events[name]; - } - } - return this; -}; + return this; + }; -/** + /** * Removes all listeners for an event. * * @api public */ -EventEmitter.prototype.removeAllListeners = function (name) { - if (name === undefined) { - this.$events = {}; - return this; - } + EventEmitter.prototype.removeAllListeners = function(name) { + if (name === undefined) { + this.$events = {}; + return this; + } - if (this.$events && this.$events[name]) { - this.$events[name] = null; - } + if (this.$events && this.$events[name]) { + this.$events[name] = null; + } - return this; -}; + return this; + }; -/** + /** * Gets all listeners for a certain event. * * @api public */ -EventEmitter.prototype.listeners = function (name) { - if (!this.$events) { - this.$events = {}; - } + EventEmitter.prototype.listeners = function(name) { + if (!this.$events) { + this.$events = {}; + } - if (!this.$events[name]) { - this.$events[name] = []; - } + if (!this.$events[name]) { + this.$events[name] = []; + } - if (!isArray(this.$events[name])) { - this.$events[name] = [this.$events[name]]; - } + if (!isArray(this.$events[name])) { + this.$events[name] = [this.$events[name]]; + } - return this.$events[name]; -}; + return this.$events[name]; + }; -/** + /** * Emits an event. * * @api public */ -EventEmitter.prototype.emit = function (name) { - if (!this.$events) { - return false; - } + EventEmitter.prototype.emit = function(name) { + if (!this.$events) { + return false; + } - var handler = this.$events[name]; + const handler = this.$events[name]; - if (!handler) { - return false; - } + if (!handler) { + return false; + } - var args = [].slice.call(arguments, 1); + const args = [].slice.call(arguments, 1); - if ('function' == typeof handler) { - handler.apply(this, args); - } else if (isArray(handler)) { - var listeners = handler.slice(); + if ('function' == typeof handler) { + handler.apply(this, args); + } else if (isArray(handler)) { + const listeners = handler.slice(); - for (var i = 0, l = listeners.length; i < l; i++) { - listeners[i].apply(this, args); - } - } else { - return false; - } + for (let i = 0, l = listeners.length; i < l; i++) { + listeners[i].apply(this, args); + } + } else { + return false; + } - return true; -}; -}); // module: browser/events.js + return true; + }; + }); // module: browser/events.js -require.register("browser/fs.js", function(module, exports, require){ + require.register('browser/fs.js', function(module, exports, require) { -}); // module: browser/fs.js + }); // module: browser/fs.js -require.register("browser/path.js", function(module, exports, require){ + require.register('browser/path.js', function(module, exports, require) { -}); // module: browser/path.js + }); // module: browser/path.js -require.register("browser/progress.js", function(module, exports, require){ -/** + require.register('browser/progress.js', function(module, exports, require) { + /** * Expose `Progress`. */ -module.exports = 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'); -} + function Progress() { + this.percent = 0; + this.size(0); + this.fontSize(11); + this.font('helvetica, arial, sans-serif'); + } -/** + /** * Set progress size to `n`. * * @param {Number} n @@ -629,12 +638,12 @@ function Progress() { * @api public */ -Progress.prototype.size = function(n){ - this._size = n; - return this; -}; + Progress.prototype.size = function(n) { + this._size = n; + return this; + }; -/** + /** * Set text to `str`. * * @param {String} str @@ -642,12 +651,12 @@ Progress.prototype.size = function(n){ * @api public */ -Progress.prototype.text = function(str){ - this._text = str; - return this; -}; + Progress.prototype.text = function(str) { + this._text = str; + return this; + }; -/** + /** * Set font size to `n`. * * @param {Number} n @@ -655,117 +664,113 @@ Progress.prototype.text = function(str){ * @api public */ -Progress.prototype.fontSize = function(n){ - this._fontSize = n; - return this; -}; + Progress.prototype.fontSize = function(n) { + this._fontSize = n; + return this; + }; -/** + /** * Set font `family`. * * @param {String} family * @return {Progress} for chaining */ -Progress.prototype.font = function(family){ - this._font = family; - return this; -}; + Progress.prototype.font = function(family) { + this._font = family; + return this; + }; -/** + /** * Update percentage to `n`. * * @param {Number} n * @return {Progress} for chaining */ -Progress.prototype.update = function(n){ - this.percent = n; - return this; -}; + Progress.prototype.update = function(n) { + this.percent = n; + return this; + }; -/** + /** * Draw on `ctx`. * * @param {CanvasRenderingContext2d} ctx * @return {Progress} for chaining */ -Progress.prototype.draw = function(ctx){ - try { - var percent = Math.min(this.percent, 100) - , size = this._size - , half = size / 2 - , x = half - , y = half - , rad = half - 1 - , 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) + '%' - , w = ctx.measureText(text).width; - - ctx.fillText( - text - , x - w / 2 + 1 - , y + fontSize / 2 - 1); - } catch (ex) {} //don't fail if we can't render progress - return this; -}; - -}); // module: browser/progress.js - -require.register("browser/tty.js", function(module, exports, require){ - -exports.isatty = function(){ - return true; -}; - -exports.getWindowSize = function(){ - if ('innerHeight' in global) { - return [global.innerHeight, global.innerWidth]; - } else { - // In a Web Worker, the DOM Window is not available. - return [640, 480]; - } -}; + Progress.prototype.draw = function(ctx) { + try { + const percent = Math.min(this.percent, 100) + ; const size = this._size + ; const half = size / 2 + ; const x = half + ; const y = half + ; const rad = half - 1 + ; const fontSize = this._fontSize; + + ctx.font = fontSize + 'px ' + this._font; + + const 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 + const text = this._text || (percent | 0) + '%' + ; const w = ctx.measureText(text).width; + + ctx.fillText( + text + , x - w / 2 + 1 + , y + fontSize / 2 - 1); + } catch (ex) {} // don't fail if we can't render progress + return this; + }; + }); // module: browser/progress.js -}); // module: browser/tty.js + require.register('browser/tty.js', function(module, exports, require) { + exports.isatty = function() { + return true; + }; -require.register("context.js", function(module, exports, require){ + exports.getWindowSize = function() { + if ('innerHeight' in global) { + return [global.innerHeight, global.innerWidth]; + } else { + // In a Web Worker, the DOM Window is not available. + return [640, 480]; + } + }; + }); // module: browser/tty.js -/** + require.register('context.js', function(module, exports, require) { + /** * Expose `Context`. */ -module.exports = Context; + module.exports = Context; -/** + /** * Initialize a new `Context`. * * @api private */ -function Context(){} + function Context() {} -/** + /** * Set or get the context `Runnable` to `runnable`. * * @param {Runnable} runnable @@ -773,13 +778,13 @@ function Context(){} * @api private */ -Context.prototype.runnable = function(runnable){ - if (0 == arguments.length) return this._runnable; - this.test = this._runnable = runnable; - return this; -}; + Context.prototype.runnable = function(runnable) { + if (0 == arguments.length) return this._runnable; + this.test = this._runnable = runnable; + return this; + }; -/** + /** * Set test timeout `ms`. * * @param {Number} ms @@ -787,12 +792,12 @@ Context.prototype.runnable = function(runnable){ * @api private */ -Context.prototype.timeout = function(ms){ - this.runnable().timeout(ms); - return this; -}; + Context.prototype.timeout = function(ms) { + this.runnable().timeout(ms); + return this; + }; -/** + /** * Set test slowness threshold `ms`. * * @param {Number} ms @@ -800,43 +805,41 @@ Context.prototype.timeout = function(ms){ * @api private */ -Context.prototype.slow = function(ms){ - this.runnable().slow(ms); - return this; -}; + Context.prototype.slow = function(ms) { + this.runnable().slow(ms); + return this; + }; -/** + /** * Inspect the context void of `._runnable`. * * @return {String} * @api private */ -Context.prototype.inspect = function(){ - return JSON.stringify(this, function(key, val){ - if ('_runnable' == key) return; - if ('test' == key) return; - return val; - }, 2); -}; - -}); // module: context.js - -require.register("hook.js", function(module, exports, require){ + Context.prototype.inspect = function() { + return JSON.stringify(this, function(key, val) { + if ('_runnable' == key) return; + if ('test' == key) return; + return val; + }, 2); + }; + }); // module: context.js -/** + require.register('hook.js', function(module, exports, require) { + /** * Module dependencies. */ -var Runnable = require('./runnable'); + const Runnable = require('./runnable'); -/** + /** * Expose `Hook`. */ -module.exports = Hook; + module.exports = Hook; -/** + /** * Initialize a new `Hook` with the given `title` and callback `fn`. * * @param {String} title @@ -844,22 +847,22 @@ module.exports = Hook; * @api private */ -function Hook(title, fn) { - Runnable.call(this, title, fn); - this.type = 'hook'; -} + function Hook(title, fn) { + Runnable.call(this, title, fn); + this.type = 'hook'; + } -/** + /** * Inherit from `Runnable.prototype`. */ -function F(){}; -F.prototype = Runnable.prototype; -Hook.prototype = new F; -Hook.prototype.constructor = Hook; + function F() {}; + F.prototype = Runnable.prototype; + Hook.prototype = new F; + Hook.prototype.constructor = Hook; -/** + /** * Get or set the test `err`. * * @param {Error} err @@ -867,29 +870,27 @@ Hook.prototype.constructor = Hook; * @api public */ -Hook.prototype.error = function(err){ - if (0 == arguments.length) { - var err = this._error; - this._error = null; - return err; - } - - this._error = err; -}; - -}); // module: hook.js + Hook.prototype.error = function(err) { + if (0 == arguments.length) { + var err = this._error; + this._error = null; + return err; + } -require.register("interfaces/bdd.js", function(module, exports, require){ + this._error = err; + }; + }); // module: hook.js -/** + require.register('interfaces/bdd.js', function(module, exports, require) { + /** * Module dependencies. */ -var Suite = require('../suite') - , Test = require('../test') - , utils = require('../utils'); + const Suite = require('../suite') + ; const Test = require('../test') + ; const utils = require('../utils'); -/** + /** * BDD-style interface: * * describe('Array', function(){ @@ -906,130 +907,127 @@ var Suite = require('../suite') * */ -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ + module.exports = function(suite) { + const suites = [suite]; - /** + suite.on('pre-require', function(context, file, mocha) { + /** * Execute before running tests. */ - context.before = function(name, fn){ - suites[0].beforeAll(name, fn); - }; + context.before = function(name, fn) { + suites[0].beforeAll(name, fn); + }; - /** + /** * Execute after running tests. */ - context.after = function(name, fn){ - suites[0].afterAll(name, fn); - }; + context.after = function(name, fn) { + suites[0].afterAll(name, fn); + }; - /** + /** * Execute before each test case. */ - context.beforeEach = function(name, fn){ - suites[0].beforeEach(name, fn); - }; + context.beforeEach = function(name, fn) { + suites[0].beforeEach(name, fn); + }; - /** + /** * Execute after each test case. */ - context.afterEach = function(name, fn){ - suites[0].afterEach(name, fn); - }; + context.afterEach = function(name, fn) { + suites[0].afterEach(name, fn); + }; - /** + /** * Describe a "suite" with the given `title` * and callback `fn` containing nested suites * and/or tests. */ - context.describe = context.context = function(title, fn){ - var suite = Suite.create(suites[0], title); - suites.unshift(suite); - fn.call(suite); - suites.shift(); - return suite; - }; + context.describe = context.context = function(title, fn) { + const suite = Suite.create(suites[0], title); + suites.unshift(suite); + fn.call(suite); + suites.shift(); + return suite; + }; - /** + /** * Pending describe. */ - context.xdescribe = + context.xdescribe = context.xcontext = - context.describe.skip = function(title, fn){ - var suite = Suite.create(suites[0], title); + context.describe.skip = function(title, fn) { + const suite = Suite.create(suites[0], title); suite.pending = true; suites.unshift(suite); fn.call(suite); suites.shift(); }; - /** + /** * Exclusive suite. */ - context.describe.only = function(title, fn){ - var suite = context.describe(title, fn); - mocha.grep(suite.fullTitle()); - return suite; - }; + context.describe.only = function(title, fn) { + const suite = context.describe(title, fn); + mocha.grep(suite.fullTitle()); + return suite; + }; - /** + /** * 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.pending) var fn = null; - var test = new Test(title, fn); - suite.addTest(test); - return test; - }; + context.it = context.specify = function(title, fn) { + const suite = suites[0]; + if (suite.pending) var fn = null; + const test = new Test(title, fn); + suite.addTest(test); + return test; + }; - /** + /** * Exclusive test-case. */ - context.it.only = function(title, fn){ - var test = context.it(title, fn); - var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - return test; - }; + context.it.only = function(title, fn) { + const test = context.it(title, fn); + const reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; + mocha.grep(new RegExp(reString)); + return test; + }; - /** + /** * Pending test case. */ - context.xit = + context.xit = context.xspecify = - context.it.skip = function(title){ + context.it.skip = function(title) { context.it(title); }; - }); -}; - -}); // module: interfaces/bdd.js - -require.register("interfaces/exports.js", function(module, exports, require){ + }); + }; + }); // module: interfaces/bdd.js -/** + require.register('interfaces/exports.js', function(module, exports, require) { + /** * Module dependencies. */ -var Suite = require('../suite') - , Test = require('../test'); + const Suite = require('../suite') + ; const Test = require('../test'); -/** + /** * TDD-style interface: * * exports.Array = { @@ -1046,64 +1044,60 @@ var Suite = require('../suite') * */ -module.exports = function(suite){ - var suites = [suite]; - - suite.on('require', visit); - - function visit(obj) { - var suite; - for (var key in obj) { - if ('function' == typeof obj[key]) { - 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: - suites[0].addTest(new Test(key, fn)); + module.exports = function(suite) { + const suites = [suite]; + + suite.on('require', visit); + + function visit(obj) { + var suite; + for (const key in obj) { + if ('function' == typeof obj[key]) { + const 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: + suites[0].addTest(new Test(key, fn)); + } + } else { + var suite = Suite.create(suites[0], key); + suites.unshift(suite); + visit(obj[key]); + suites.shift(); + } } - } else { - var suite = Suite.create(suites[0], key); - suites.unshift(suite); - visit(obj[key]); - suites.shift(); } - } - } -}; - -}); // module: interfaces/exports.js - -require.register("interfaces/index.js", function(module, exports, require){ - -exports.bdd = require('./bdd'); -exports.tdd = require('./tdd'); -exports.qunit = require('./qunit'); -exports.exports = require('./exports'); - -}); // module: interfaces/index.js + }; + }); // module: interfaces/exports.js -require.register("interfaces/qunit.js", function(module, exports, require){ + require.register('interfaces/index.js', function(module, exports, require) { + exports.bdd = require('./bdd'); + exports.tdd = require('./tdd'); + exports.qunit = require('./qunit'); + exports.exports = require('./exports'); + }); // module: interfaces/index.js -/** + require.register('interfaces/qunit.js', function(module, exports, require) { + /** * Module dependencies. */ -var Suite = require('../suite') - , Test = require('../test') - , utils = require('../utils'); + const Suite = require('../suite') + ; const Test = require('../test') + ; const utils = require('../utils'); -/** + /** * QUnit-style interface: * * suite('Array'); @@ -1128,108 +1122,105 @@ var Suite = require('../suite') * */ -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ + module.exports = function(suite) { + const suites = [suite]; - /** + suite.on('pre-require', function(context, file, mocha) { + /** * Execute before running tests. */ - context.before = function(name, fn){ - suites[0].beforeAll(name, fn); - }; + context.before = function(name, fn) { + suites[0].beforeAll(name, fn); + }; - /** + /** * Execute after running tests. */ - context.after = function(name, fn){ - suites[0].afterAll(name, fn); - }; + context.after = function(name, fn) { + suites[0].afterAll(name, fn); + }; - /** + /** * Execute before each test case. */ - context.beforeEach = function(name, fn){ - suites[0].beforeEach(name, fn); - }; + context.beforeEach = function(name, fn) { + suites[0].beforeEach(name, fn); + }; - /** + /** * Execute after each test case. */ - context.afterEach = function(name, fn){ - suites[0].afterEach(name, fn); - }; + context.afterEach = function(name, fn) { + suites[0].afterEach(name, fn); + }; - /** + /** * Describe a "suite" with the given `title`. */ - context.suite = function(title){ - if (suites.length > 1) suites.shift(); - var suite = Suite.create(suites[0], title); - suites.unshift(suite); - return suite; - }; + context.suite = function(title) { + if (suites.length > 1) suites.shift(); + const suite = Suite.create(suites[0], title); + suites.unshift(suite); + return suite; + }; - /** + /** * Exclusive test-case. */ - context.suite.only = function(title, fn){ - var suite = context.suite(title, fn); - mocha.grep(suite.fullTitle()); - }; + context.suite.only = function(title, fn) { + const suite = context.suite(title, fn); + mocha.grep(suite.fullTitle()); + }; - /** + /** * 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); - suites[0].addTest(test); - return test; - }; + context.test = function(title, fn) { + const test = new Test(title, fn); + suites[0].addTest(test); + return test; + }; - /** + /** * Exclusive test-case. */ - context.test.only = function(title, fn){ - var test = context.test(title, fn); - var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - }; + context.test.only = function(title, fn) { + const test = context.test(title, fn); + const reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; + mocha.grep(new RegExp(reString)); + }; - /** + /** * Pending test case. */ - context.test.skip = function(title){ - context.test(title); + context.test.skip = function(title) { + context.test(title); + }; + }); }; - }); -}; - -}); // module: interfaces/qunit.js + }); // module: interfaces/qunit.js -require.register("interfaces/tdd.js", function(module, exports, require){ - -/** + require.register('interfaces/tdd.js', function(module, exports, require) { + /** * Module dependencies. */ -var Suite = require('../suite') - , Test = require('../test') - , utils = require('../utils');; + const Suite = require('../suite') + ; const Test = require('../test') + ; const utils = require('../utils'); ; -/** + /** * TDD-style interface: * * suite('Array', function(){ @@ -1254,148 +1245,146 @@ var Suite = require('../suite') * */ -module.exports = function(suite){ - var suites = [suite]; + module.exports = function(suite) { + const suites = [suite]; - suite.on('pre-require', function(context, file, mocha){ - - /** + suite.on('pre-require', function(context, file, mocha) { + /** * Execute before each test case. */ - context.setup = function(name, fn){ - suites[0].beforeEach(name, fn); - }; + context.setup = function(name, fn) { + suites[0].beforeEach(name, fn); + }; - /** + /** * Execute after each test case. */ - context.teardown = function(name, fn){ - suites[0].afterEach(name, fn); - }; + context.teardown = function(name, fn) { + suites[0].afterEach(name, fn); + }; - /** + /** * Execute before the suite. */ - context.suiteSetup = function(name, fn){ - suites[0].beforeAll(name, fn); - }; + context.suiteSetup = function(name, fn) { + suites[0].beforeAll(name, fn); + }; - /** + /** * Execute after the suite. */ - context.suiteTeardown = function(name, fn){ - suites[0].afterAll(name, fn); - }; + context.suiteTeardown = function(name, fn) { + suites[0].afterAll(name, fn); + }; - /** + /** * Describe a "suite" with the given `title` * and callback `fn` containing nested suites * and/or tests. */ - context.suite = function(title, fn){ - var suite = Suite.create(suites[0], title); - suites.unshift(suite); - fn.call(suite); - suites.shift(); - return suite; - }; + context.suite = function(title, fn) { + const suite = Suite.create(suites[0], title); + suites.unshift(suite); + fn.call(suite); + suites.shift(); + return suite; + }; - /** + /** * Pending suite. */ - context.suite.skip = function(title, fn) { - var suite = Suite.create(suites[0], title); - suite.pending = true; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - }; - - /** + context.suite.skip = function(title, fn) { + const suite = Suite.create(suites[0], title); + suite.pending = true; + suites.unshift(suite); + fn.call(suite); + suites.shift(); + }; + + /** * Exclusive test-case. */ - context.suite.only = function(title, fn){ - var suite = context.suite(title, fn); - mocha.grep(suite.fullTitle()); - }; + context.suite.only = function(title, fn) { + const suite = context.suite(title, fn); + mocha.grep(suite.fullTitle()); + }; - /** + /** * 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.pending) var fn = null; - var test = new Test(title, fn); - suite.addTest(test); - return test; - }; + context.test = function(title, fn) { + const suite = suites[0]; + if (suite.pending) var fn = null; + const test = new Test(title, fn); + suite.addTest(test); + return test; + }; - /** + /** * Exclusive test-case. */ - context.test.only = function(title, fn){ - var test = context.test(title, fn); - var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - }; + context.test.only = function(title, fn) { + const test = context.test(title, fn); + const reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; + mocha.grep(new RegExp(reString)); + }; - /** + /** * Pending test case. */ - context.test.skip = function(title){ - context.test(title); + context.test.skip = function(title) { + context.test(title); + }; + }); }; - }); -}; - -}); // module: interfaces/tdd.js + }); // module: interfaces/tdd.js -require.register("mocha.js", function(module, exports, require){ -/*! + require.register('mocha.js', function(module, exports, require) { + /* ! * mocha * Copyright(c) 2011 TJ Holowaychuk * MIT Licensed */ -/** + /** * Module dependencies. */ -var path = require('browser/path') - , utils = require('./utils'); + const path = require('browser/path') + ; const utils = require('./utils'); -/** + /** * Expose `Mocha`. */ -exports = module.exports = Mocha; + exports = module.exports = Mocha; -/** + /** * Expose internals. */ -exports.utils = utils; -exports.interfaces = require('./interfaces'); -exports.reporters = require('./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'); + exports.utils = utils; + exports.interfaces = require('./interfaces'); + exports.reporters = require('./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. * * @param {String} name @@ -1403,11 +1392,11 @@ exports.Test = require('./test'); * @api private */ -function image(name) { - return __dirname + '/../images/' + name + '.png'; -} + function image(name) { + return __dirname + '/../images/' + name + '.png'; + } -/** + /** * Setup mocha with `options`. * * Options: @@ -1425,145 +1414,156 @@ function image(name) { * @api public */ -function Mocha(options) { - options = options || {}; - this.files = []; - this.options = options; - this.grep(options.grep); - this.suite = new exports.Suite('', new exports.Context); - this.ui(options.ui); - this.bail(options.bail); - this.reporter(options.reporter); - if (null != options.timeout) this.timeout(options.timeout); - this.useColors(options.useColors) - if (options.slow) this.slow(options.slow); - - 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; - }); -} - -/** + function Mocha(options) { + options = options || {}; + this.files = []; + this.options = options; + this.grep(options.grep); + this.suite = new exports.Suite('', new exports.Context); + this.ui(options.ui); + this.bail(options.bail); + this.reporter(options.reporter); + if (null != options.timeout) this.timeout(options.timeout); + this.useColors(options.useColors); + if (options.slow) this.slow(options.slow); + + 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; + }); + } + + /** * Enable or disable bailing on the first failure. * * @param {Boolean} [bail] * @api public */ -Mocha.prototype.bail = function(bail){ - if (0 == arguments.length) bail = true; - this.suite.bail(bail); - return this; -}; + Mocha.prototype.bail = function(bail) { + if (0 == arguments.length) bail = true; + this.suite.bail(bail); + return this; + }; -/** + /** * Add test `file`. * * @param {String} file * @api public */ -Mocha.prototype.addFile = function(file){ - this.files.push(file); - return this; -}; + Mocha.prototype.addFile = function(file) { + this.files.push(file); + return this; + }; -/** + /** * Set reporter to `reporter`, defaults to "dot". * * @param {String|Function} reporter name or constructor * @api public */ -Mocha.prototype.reporter = function(reporter){ - if ('function' == typeof reporter) { - this._reporter = reporter; - } else { - reporter = reporter || 'dot'; - var _reporter; - try { _reporter = require('./reporters/' + reporter); } catch (err) {}; - if (!_reporter) try { _reporter = require(reporter); } catch (err) {}; - if (!_reporter && reporter === 'teamcity') - console.warn('The Teamcity reporter was moved to a package named ' + + Mocha.prototype.reporter = function(reporter) { + if ('function' == typeof reporter) { + this._reporter = reporter; + } else { + reporter = reporter || 'dot'; + let _reporter; + try { + _reporter = require('./reporters/' + reporter); + } catch (err) {}; + if (!_reporter) { + try { + _reporter = require(reporter); + } catch (err) {} + }; + 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; - } - return this; -}; + } + if (!_reporter) throw new Error('invalid reporter "' + reporter + '"'); + this._reporter = _reporter; + } + return this; + }; -/** + /** * Set test UI `name`, defaults to "bdd". * * @param {String} bdd * @api public */ -Mocha.prototype.ui = function(name){ - name = name || 'bdd'; - this._ui = exports.interfaces[name]; - if (!this._ui) try { this._ui = require(name); } catch (err) {}; - if (!this._ui) throw new Error('invalid interface "' + name + '"'); - this._ui = this._ui(this.suite); - return this; -}; + Mocha.prototype.ui = function(name) { + name = name || 'bdd'; + this._ui = exports.interfaces[name]; + if (!this._ui) { + try { + this._ui = require(name); + } catch (err) {} + }; + if (!this._ui) throw new Error('invalid interface "' + name + '"'); + this._ui = this._ui(this.suite); + return this; + }; -/** + /** * Load registered files. * * @api private */ -Mocha.prototype.loadFiles = function(fn){ - var self = this; - var suite = this.suite; - var pending = this.files.length; - 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); - --pending || (fn && fn()); - }); -}; - -/** + Mocha.prototype.loadFiles = function(fn) { + const self = this; + const suite = this.suite; + let pending = this.files.length; + 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); + --pending || (fn && fn()); + }); + }; + + /** * Enable growl support. * * @api private */ -Mocha.prototype._growl = function(runner, reporter) { - var notify = require('growl'); + Mocha.prototype._growl = function(runner, reporter) { + const 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') + runner.on('end', function() { + const stats = reporter.stats; + if (stats.failures) { + const 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'), + }); + } }); - } - }); -}; + }; -/** + /** * Add regexp to grep, if `re` is a string it is escaped. * * @param {RegExp|String} re @@ -1571,26 +1571,26 @@ Mocha.prototype._growl = function(runner, reporter) { * @api public */ -Mocha.prototype.grep = function(re){ - this.options.grep = 'string' == typeof re - ? new RegExp(utils.escapeRegexp(re)) - : re; - return this; -}; + Mocha.prototype.grep = function(re) { + this.options.grep = 'string' == typeof re ? + new RegExp(utils.escapeRegexp(re)) : + re; + return this; + }; -/** + /** * Invert `.grep()` matches. * * @return {Mocha} * @api public */ -Mocha.prototype.invert = function(){ - this.options.invert = true; - return this; -}; + Mocha.prototype.invert = function() { + this.options.invert = true; + return this; + }; -/** + /** * Ignore global leaks. * * @param {Boolean} ignore @@ -1598,36 +1598,36 @@ Mocha.prototype.invert = function(){ * @api public */ -Mocha.prototype.ignoreLeaks = function(ignore){ - this.options.ignoreLeaks = !!ignore; - return this; -}; + Mocha.prototype.ignoreLeaks = function(ignore) { + this.options.ignoreLeaks = !!ignore; + return this; + }; -/** + /** * Enable global leak checking. * * @return {Mocha} * @api public */ -Mocha.prototype.checkLeaks = function(){ - this.options.ignoreLeaks = false; - return this; -}; + Mocha.prototype.checkLeaks = function() { + this.options.ignoreLeaks = false; + return this; + }; -/** + /** * Enable growl support. * * @return {Mocha} * @api public */ -Mocha.prototype.growl = function(){ - this.options.growl = true; - return this; -}; + Mocha.prototype.growl = function() { + this.options.growl = true; + return this; + }; -/** + /** * Ignore `globals` array or string. * * @param {Array|String} globals @@ -1635,12 +1635,12 @@ Mocha.prototype.growl = function(){ * @api public */ -Mocha.prototype.globals = function(globals){ - this.options.globals = (this.options.globals || []).concat(globals); - return this; -}; + Mocha.prototype.globals = function(globals) { + this.options.globals = (this.options.globals || []).concat(globals); + return this; + }; -/** + /** * Emit color output. * * @param {Boolean} colors @@ -1648,14 +1648,14 @@ Mocha.prototype.globals = function(globals){ * @api public */ -Mocha.prototype.useColors = function(colors){ - this.options.useColors = arguments.length && colors != undefined - ? colors - : true; - return this; -}; + Mocha.prototype.useColors = function(colors) { + this.options.useColors = arguments.length && colors != undefined ? + colors : + true; + return this; + }; -/** + /** * Use inline diffs rather than +/-. * * @param {Boolean} inlineDiffs @@ -1663,14 +1663,14 @@ Mocha.prototype.useColors = function(colors){ * @api public */ -Mocha.prototype.useInlineDiffs = function(inlineDiffs) { - this.options.useInlineDiffs = arguments.length && inlineDiffs != undefined - ? inlineDiffs - : false; - return this; -}; + Mocha.prototype.useInlineDiffs = function(inlineDiffs) { + this.options.useInlineDiffs = arguments.length && inlineDiffs != undefined ? + inlineDiffs : + false; + return this; + }; -/** + /** * Set the timeout in milliseconds. * * @param {Number} timeout @@ -1678,12 +1678,12 @@ Mocha.prototype.useInlineDiffs = function(inlineDiffs) { * @api public */ -Mocha.prototype.timeout = function(timeout){ - this.suite.timeout(timeout); - return this; -}; + Mocha.prototype.timeout = function(timeout) { + this.suite.timeout(timeout); + return this; + }; -/** + /** * Set slowness threshold in milliseconds. * * @param {Number} slow @@ -1691,24 +1691,24 @@ Mocha.prototype.timeout = function(timeout){ * @api public */ -Mocha.prototype.slow = function(slow){ - this.suite.slow(slow); - return this; -}; + Mocha.prototype.slow = function(slow) { + this.suite.slow(slow); + return this; + }; -/** + /** * Makes all tests async (accepting a callback) * * @return {Mocha} * @api public */ -Mocha.prototype.asyncOnly = function(){ - this.options.asyncOnly = true; - return this; -}; + Mocha.prototype.asyncOnly = function() { + this.options.asyncOnly = true; + return this; + }; -/** + /** * Run tests and invoke `fn()` when complete. * * @param {Function} fn @@ -1716,37 +1716,36 @@ Mocha.prototype.asyncOnly = function(){ * @api public */ -Mocha.prototype.run = function(fn){ - if (this.files.length) this.loadFiles(); - var suite = this.suite; - var options = this.options; - options.files = this.files; - var runner = new exports.Runner(suite); - var reporter = new this._reporter(runner, options); - runner.ignoreLeaks = false !== options.ignoreLeaks; - runner.asyncOnly = options.asyncOnly; - if (options.grep) runner.grep(options.grep, options.invert); - if (options.globals) runner.globals(options.globals); - if (options.growl) this._growl(runner, reporter); - exports.reporters.Base.useColors = options.useColors; - exports.reporters.Base.inlineDiffs = options.useInlineDiffs; - return runner.run(fn); -}; - -}); // module: mocha.js - -require.register("ms.js", function(module, exports, require){ -/** + Mocha.prototype.run = function(fn) { + if (this.files.length) this.loadFiles(); + const suite = this.suite; + const options = this.options; + options.files = this.files; + const runner = new exports.Runner(suite); + const reporter = new this._reporter(runner, options); + runner.ignoreLeaks = false !== options.ignoreLeaks; + runner.asyncOnly = options.asyncOnly; + if (options.grep) runner.grep(options.grep, options.invert); + if (options.globals) runner.globals(options.globals); + if (options.growl) this._growl(runner, reporter); + exports.reporters.Base.useColors = options.useColors; + exports.reporters.Base.inlineDiffs = options.useInlineDiffs; + return runner.run(fn); + }; + }); // module: mocha.js + + require.register('ms.js', function(module, exports, require) { + /** * Helpers. */ -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; + const s = 1000; + const m = s * 60; + const h = m * 60; + const d = h * 24; + const y = d * 365.25; -/** + /** * Parse or format the given `val`. * * Options: @@ -1759,13 +1758,13 @@ var y = d * 365.25; * @api public */ -module.exports = function(val, options){ - options = options || {}; - if ('string' == typeof val) return parse(val); - return options.long ? longFormat(val) : shortFormat(val); -}; + module.exports = function(val, options) { + options = options || {}; + if ('string' == typeof val) return parse(val); + return options.long ? longFormat(val) : shortFormat(val); + }; -/** + /** * Parse the given `str` and return milliseconds. * * @param {String} str @@ -1773,38 +1772,38 @@ module.exports = function(val, options){ * @api private */ -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; - } -} + function parse(str) { + const match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str); + if (!match) return; + const n = parseFloat(match[1]); + const 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; + } + } -/** + /** * Short format for `ms`. * * @param {Number} ms @@ -1812,15 +1811,15 @@ function parse(str) { * @api private */ -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'; -} + 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`. * * @param {Number} ms @@ -1828,115 +1827,113 @@ function shortFormat(ms) { * @api private */ -function longFormat(ms) { - return plural(ms, d, 'day') - || plural(ms, h, 'hour') - || plural(ms, m, 'minute') - || plural(ms, s, 'second') - || ms + ' ms'; -} + function longFormat(ms) { + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; + } -/** + /** * Pluralization helper. */ -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'; -} - -}); // module: ms.js - -require.register("reporters/base.js", function(module, exports, require){ + 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'; + } + }); // module: ms.js -/** + require.register('reporters/base.js', function(module, exports, require) { + /** * Module dependencies. */ -var tty = require('browser/tty') - , diff = require('browser/diff') - , ms = require('../ms') - , utils = require('../utils'); + const tty = require('browser/tty') + ; const diff = require('browser/diff') + ; const ms = require('../ms') + ; const utils = require('../utils'); -/** + /** * Save timer references to avoid Sinon interfering (see GH-237). */ -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; + const Date = global.Date + ; const setTimeout = global.setTimeout + ; const setInterval = global.setInterval + ; const clearTimeout = global.clearTimeout + ; const clearInterval = global.clearInterval; -/** + /** * Check if both stdio streams are associated with a tty. */ -var isatty = tty.isatty(1) && tty.isatty(2); + const isatty = tty.isatty(1) && tty.isatty(2); -/** + /** * Expose `Base`. */ -exports = module.exports = Base; + exports = module.exports = Base; -/** + /** * Enable coloring by default. */ -exports.useColors = isatty || (process.env.MOCHA_COLORS !== undefined); + exports.useColors = isatty || (process.env.MOCHA_COLORS !== undefined); -/** + /** * Inline diffs instead of +/- */ -exports.inlineDiffs = false; + 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': 42 - , 'diff removed': 41 -}; - -/** + 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': 42, + 'diff removed': 41, + }; + + /** * Default symbol map. */ -exports.symbols = { - ok: '✓', - err: '✖', - dot: '․' -}; + exports.symbols = { + ok: '✓', + err: '✖', + dot: '․', + }; -// With node.js on Windows: use symbols available in terminal default fonts -if ('win32' == process.platform) { - exports.symbols.ok = '\u221A'; - exports.symbols.err = '\u00D7'; - exports.symbols.dot = '.'; -} + // With node.js on Windows: use symbols available in terminal default fonts + if ('win32' == process.platform) { + 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 @@ -1948,115 +1945,115 @@ if ('win32' == process.platform) { * @api private */ -var color = exports.color = function(type, str) { - if (!exports.useColors) return str; - return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m'; -}; + const color = exports.color = function(type, str) { + if (!exports.useColors) return 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: isatty - ? process.stdout.getWindowSize - ? process.stdout.getWindowSize(1)[0] - : tty.getWindowSize()[1] - : 75 -}; + exports.window = { + width: isatty ? + process.stdout.getWindowSize ? + process.stdout.getWindowSize(1)[0] : + tty.getWindowSize()[1] : + 75, + }; -/** + /** * Expose some basic cursor interactions * that are common among reporters. */ -exports.cursor = { - hide: function(){ - isatty && process.stdout.write('\u001b[?25l'); - }, + exports.cursor = { + hide: function() { + isatty && process.stdout.write('\u001b[?25l'); + }, - show: function(){ - isatty && process.stdout.write('\u001b[?25h'); - }, + show: function() { + isatty && process.stdout.write('\u001b[?25h'); + }, - deleteLine: function(){ - isatty && process.stdout.write('\u001b[2K'); - }, + deleteLine: function() { + isatty && process.stdout.write('\u001b[2K'); + }, - beginningOfLine: function(){ - isatty && process.stdout.write('\u001b[0G'); - }, + beginningOfLine: function() { + isatty && process.stdout.write('\u001b[0G'); + }, - CR: function(){ - if (isatty) { - exports.cursor.deleteLine(); - exports.cursor.beginningOfLine(); - } else { - process.stdout.write('\r'); - } - } -}; + 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.error(); - 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 err = test.err - , message = err.message || '' - , stack = err.stack || message - , index = stack.indexOf(message) + message.length - , msg = stack.slice(0, index) - , actual = err.actual - , expected = err.expected - , escape = true; - - // uncaught - if (err.uncaught) { - msg = 'Uncaught ' + msg; - } + exports.list = function(failures) { + console.error(); + failures.forEach(function(test, i) { + // format + let fmt = color('error title', ' %s) %s:\n') + + color('error message', ' %s') + + color('error stack', '\n%s\n'); + + // msg + const err = test.err + ; const message = err.message || '' + ; let stack = err.stack || message + ; const index = stack.indexOf(message) + message.length + ; let msg = stack.slice(0, index) + ; let actual = err.actual + ; let expected = err.expected + ; let escape = true; + + // uncaught + if (err.uncaught) { + msg = 'Uncaught ' + msg; + } - // explicitly show diff - if (err.showDiff && sameType(actual, expected)) { - escape = false; - err.actual = actual = stringify(canonicalize(actual)); - err.expected = expected = stringify(canonicalize(expected)); - } + // explicitly show diff + if (err.showDiff && sameType(actual, expected)) { + escape = false; + err.actual = actual = stringify(canonicalize(actual)); + err.expected = expected = stringify(canonicalize(expected)); + } - // actual / expected diff - if ('string' == typeof actual && 'string' == typeof 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); + // actual / expected diff + if ('string' == typeof actual && 'string' == typeof expected) { + fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n'); + const 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); - } - } + if (exports.inlineDiffs) { + msg += inlineDiff(err, escape); + } else { + msg += unifiedDiff(err, escape); + } + } - // indent stack trace without msg - stack = stack.slice(index ? index + 1 : index) - .replace(/^/gm, ' '); + // indent stack trace without msg + stack = stack.slice(index ? index + 1 : index) + .replace(/^/gm, ' '); - console.error(fmt, (i + 1), test.fullTitle(), msg, stack); - }); -}; + console.error(fmt, (i + 1), test.fullTitle(), msg, stack); + }); + }; -/** + /** * Initialize a new `Base` reporter. * * All other reporters generally @@ -2068,106 +2065,106 @@ exports.list = function(failures){ * @api public */ -function Base(runner) { - var self = this - , stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 } - , failures = this.failures = []; + function Base(runner) { + const self = this + ; const stats = this.stats = {suites: 0, tests: 0, passes: 0, pending: 0, failures: 0} + ; const failures = this.failures = []; - if (!runner) return; - this.runner = runner; + if (!runner) return; + this.runner = runner; - runner.stats = stats; + runner.stats = stats; - runner.on('start', function(){ - stats.start = new Date; - }); + runner.on('start', function() { + stats.start = new Date; + }); - runner.on('suite', function(suite){ - stats.suites = stats.suites || 0; - suite.root || stats.suites++; - }); + runner.on('suite', function(suite) { + stats.suites = stats.suites || 0; + suite.root || stats.suites++; + }); - runner.on('test end', function(test){ - stats.tests = stats.tests || 0; - stats.tests++; - }); + runner.on('test end', function(test) { + stats.tests = stats.tests || 0; + stats.tests++; + }); - runner.on('pass', function(test){ - stats.passes = stats.passes || 0; + runner.on('pass', function(test) { + stats.passes = stats.passes || 0; - var medium = test.slow() / 2; - test.speed = test.duration > test.slow() - ? 'slow' - : test.duration > medium - ? 'medium' - : 'fast'; + const medium = test.slow() / 2; + test.speed = test.duration > test.slow() ? + 'slow' : + test.duration > medium ? + 'medium' : + 'fast'; - stats.passes++; - }); + stats.passes++; + }); - runner.on('fail', function(test, err){ - stats.failures = stats.failures || 0; - stats.failures++; - test.err = err; - failures.push(test); - }); + 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('end', function() { + stats.end = new Date; + stats.duration = new Date - stats.start; + }); - runner.on('pending', function(){ - stats.pending++; - }); -} + 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 tests; - var fmt; + Base.prototype.epilogue = function() { + const stats = this.stats; + let tests; + let fmt; - console.log(); + console.log(); - // passes - fmt = color('bright pass', ' ') - + color('green', ' %d passing') - + color('light', ' (%s)'); + // passes + fmt = color('bright pass', ' ') + + color('green', ' %d passing') + + color('light', ' (%s)'); - console.log(fmt, - stats.passes || 0, - ms(stats.duration)); + console.log(fmt, + stats.passes || 0, + ms(stats.duration)); - // pending - if (stats.pending) { - fmt = color('pending', ' ') - + color('pending', ' %d pending'); + // pending + if (stats.pending) { + fmt = color('pending', ' ') + + color('pending', ' %d pending'); - console.log(fmt, stats.pending); - } + console.log(fmt, stats.pending); + } - // failures - if (stats.failures) { - fmt = color('fail', ' %d failing'); + // failures + if (stats.failures) { + fmt = color('fail', ' %d failing'); - console.error(fmt, - stats.failures); + console.error(fmt, + stats.failures); - Base.list(this.failures); - console.error(); - } + Base.list(this.failures); + console.error(); + } - console.log(); -}; + console.log(); + }; -/** + /** * Pad the given `str` to `len`. * * @param {String} str @@ -2176,13 +2173,13 @@ Base.prototype.epilogue = function(){ * @api private */ -function pad(str, len) { - str = String(str); - return Array(len - str.length + 1).join(' ') + str; -} + 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 * * @param {Error} Error with actual/expected @@ -2190,33 +2187,33 @@ function pad(str, len) { * @api private */ -function inlineDiff(err, escape) { - var msg = errorDiff(err, 'WordsWithSpace', escape); + function inlineDiff(err, escape) { + let 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'); - } + // linenos + const lines = msg.split('\n'); + if (lines.length > 4) { + const 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; + } - // 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 2 strings * * @param {Error} Error with actual/expected @@ -2224,31 +2221,31 @@ function inlineDiff(err, escape) { * @api private */ -function unifiedDiff(err, escape) { - var indent = ' '; - function cleanUp(line) { - if (escape) { - line = escapeInvisibles(line); + function unifiedDiff(err, escape) { + const 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; + else return indent + line; + } + function notBlank(line) { + return line != null; + } + msg = diff.createPatch('string', err.actual, err.expected); + const 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'); } - 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; - else return indent + line; - } - function notBlank(line) { - return line != null; - } - 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`. * * @param {Error} err @@ -2256,30 +2253,30 @@ function unifiedDiff(err, escape) { * @api private */ -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(''); -} + function errorDiff(err, type, escape) { + const actual = escape ? escapeInvisibles(err.actual) : err.actual; + const 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 * * @param {String} line * @return {String} * @api private */ -function escapeInvisibles(line) { - return line.replace(/\t/g, '') - .replace(/\r/g, '') - .replace(/\n/g, '\n'); -} + function escapeInvisibles(line) { + return line.replace(/\t/g, '') + .replace(/\r/g, '') + .replace(/\n/g, '\n'); + } -/** + /** * Color lines for `str`, using the color `name`. * * @param {String} name @@ -2288,13 +2285,13 @@ function escapeInvisibles(line) { * @api private */ -function colorLines(name, str) { - return str.split('\n').map(function(str){ - return color(name, str); - }).join('\n'); -} + function colorLines(name, str) { + return str.split('\n').map(function(str) { + return color(name, str); + }).join('\n'); + } -/** + /** * Stringify `obj`. * * @param {Object} obj @@ -2302,46 +2299,46 @@ function colorLines(name, str) { * @api private */ -function stringify(obj) { - if (obj instanceof RegExp) return obj.toString(); - return JSON.stringify(obj, null, 2); -} + function stringify(obj) { + if (obj instanceof RegExp) return obj.toString(); + return JSON.stringify(obj, null, 2); + } -/** + /** * Return a new object that has the keys in sorted order. * @param {Object} obj * @return {Object} * @api private */ - function canonicalize(obj, stack) { - stack = stack || []; + function canonicalize(obj, stack) { + stack = stack || []; - if (utils.indexOf(stack, obj) !== -1) return obj; + if (utils.indexOf(stack, obj) !== -1) return obj; - var canonicalizedObj; + let canonicalizedObj; - if ('[object Array]' == {}.toString.call(obj)) { - stack.push(obj); - canonicalizedObj = utils.map(obj, function(item) { - return canonicalize(item, stack); - }); - stack.pop(); - } else if (typeof obj === 'object' && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - utils.forEach(utils.keys(obj).sort(), function(key) { - canonicalizedObj[key] = canonicalize(obj[key], stack); - }); - stack.pop(); - } else { - canonicalizedObj = obj; - } + if ('[object Array]' == {}.toString.call(obj)) { + stack.push(obj); + canonicalizedObj = utils.map(obj, function(item) { + return canonicalize(item, stack); + }); + stack.pop(); + } else if (typeof obj === 'object' && obj !== null) { + stack.push(obj); + canonicalizedObj = {}; + utils.forEach(utils.keys(obj).sort(), function(key) { + canonicalizedObj[key] = canonicalize(obj[key], stack); + }); + stack.pop(); + } else { + canonicalizedObj = obj; + } - return canonicalizedObj; - } + return canonicalizedObj; + } -/** + /** * Check that a / b have the same type. * * @param {Object} a @@ -2350,512 +2347,500 @@ function stringify(obj) { * @api private */ -function sameType(a, b) { - a = Object.prototype.toString.call(a); - b = Object.prototype.toString.call(b); - return a == b; -} - - -}); // module: reporters/base.js - -require.register("reporters/doc.js", function(module, exports, require){ + function sameType(a, b) { + a = Object.prototype.toString.call(a); + b = Object.prototype.toString.call(b); + return a == b; + } + }); // module: reporters/base.js -/** + require.register('reporters/doc.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , utils = require('../utils'); + const Base = require('./base') + ; const utils = require('../utils'); -/** + /** * Expose `Doc`. */ -exports = module.exports = Doc; + exports = module.exports = Doc; -/** + /** * Initialize a new `Doc` reporter. * * @param {Runner} runner * @api public */ -function Doc(runner) { - Base.call(this, runner); + function Doc(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , total = runner.total - , indents = 2; + const self = this + ; const stats = this.stats + ; const total = runner.total + ; let indents = 2; - function indent() { - return Array(indents).join(' '); - } + function indent() { + return Array(indents).join(' '); + } + + runner.on('suite', function(suite) { + if (suite.root) return; + ++indents; + console.log('%s
', indent()); + ++indents; + console.log('%s

%s

', indent(), utils.escape(suite.title)); + console.log('%s
', indent()); + }); - runner.on('suite', function(suite){ - if (suite.root) return; - ++indents; - console.log('%s
', indent()); - ++indents; - console.log('%s

%s

', indent(), utils.escape(suite.title)); - console.log('%s
', indent()); - }); - - runner.on('suite end', function(suite){ - if (suite.root) return; - console.log('%s
', indent()); - --indents; - console.log('%s
', indent()); - --indents; - }); - - runner.on('pass', function(test){ - console.log('%s
%s
', indent(), utils.escape(test.title)); - var code = utils.escape(utils.clean(test.fn.toString())); - console.log('%s
%s
', indent(), code); - }); -} - -}); // module: reporters/doc.js - -require.register("reporters/dot.js", function(module, exports, require){ - -/** + runner.on('suite end', function(suite) { + if (suite.root) return; + console.log('%s
', indent()); + --indents; + console.log('%s
', indent()); + --indents; + }); + + runner.on('pass', function(test) { + console.log('%s
%s
', indent(), utils.escape(test.title)); + const code = utils.escape(utils.clean(test.fn.toString())); + console.log('%s
%s
', indent(), code); + }); + } + }); // module: reporters/doc.js + + require.register('reporters/dot.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , color = Base.color; + const Base = require('./base') + ; const color = Base.color; -/** + /** * Expose `Dot`. */ -exports = module.exports = Dot; + exports = module.exports = Dot; -/** + /** * Initialize a new `Dot` matrix test reporter. * * @param {Runner} runner * @api public */ -function Dot(runner) { - Base.call(this, runner); + function Dot(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , n = 0; + const self = this + ; const stats = this.stats + ; const width = Base.window.width * .75 | 0 + ; let n = 0; - runner.on('start', function(){ - process.stdout.write('\n '); - }); + runner.on('start', function() { + process.stdout.write('\n '); + }); - runner.on('pending', function(test){ - process.stdout.write(color('pending', Base.symbols.dot)); - }); + runner.on('pending', function(test) { + process.stdout.write(color('pending', Base.symbols.dot)); + }); - runner.on('pass', function(test){ - if (++n % width == 0) process.stdout.write('\n '); - if ('slow' == test.speed) { - process.stdout.write(color('bright yellow', Base.symbols.dot)); - } else { - process.stdout.write(color(test.speed, Base.symbols.dot)); - } - }); + runner.on('pass', function(test) { + if (++n % width == 0) process.stdout.write('\n '); + if ('slow' == test.speed) { + process.stdout.write(color('bright yellow', Base.symbols.dot)); + } else { + process.stdout.write(color(test.speed, Base.symbols.dot)); + } + }); - runner.on('fail', function(test, err){ - if (++n % width == 0) process.stdout.write('\n '); - process.stdout.write(color('fail', Base.symbols.dot)); - }); + runner.on('fail', function(test, err) { + if (++n % width == 0) process.stdout.write('\n '); + process.stdout.write(color('fail', Base.symbols.dot)); + }); - runner.on('end', function(){ - console.log(); - self.epilogue(); - }); -} + runner.on('end', function() { + console.log(); + self.epilogue(); + }); + } -/** + /** * Inherit from `Base.prototype`. */ -function F(){}; -F.prototype = Base.prototype; -Dot.prototype = new F; -Dot.prototype.constructor = Dot; - -}); // module: reporters/dot.js + function F() {}; + F.prototype = Base.prototype; + Dot.prototype = new F; + Dot.prototype.constructor = Dot; + }); // module: reporters/dot.js -require.register("reporters/html-cov.js", function(module, exports, require){ - -/** + require.register('reporters/html-cov.js', function(module, exports, require) { + /** * Module dependencies. */ -var JSONCov = require('./json-cov') - , fs = require('browser/fs'); + const JSONCov = require('./json-cov') + ; const fs = require('browser/fs'); -/** + /** * Expose `HTMLCov`. */ -exports = module.exports = HTMLCov; + exports = module.exports = HTMLCov; -/** + /** * Initialize a new `JsCoverage` reporter. * * @param {Runner} runner * @api public */ -function HTMLCov(runner) { - var jade = require('jade') - , file = __dirname + '/templates/coverage.jade' - , str = fs.readFileSync(file, 'utf8') - , fn = jade.compile(str, { filename: file }) - , self = this; + function HTMLCov(runner) { + const jade = require('jade') + ; const file = __dirname + '/templates/coverage.jade' + ; const str = fs.readFileSync(file, 'utf8') + ; const fn = jade.compile(str, {filename: file}) + ; const self = this; - JSONCov.call(this, runner, false); + JSONCov.call(this, runner, false); - runner.on('end', function(){ - process.stdout.write(fn({ - cov: self.cov - , coverageClass: coverageClass - })); - }); -} + runner.on('end', function() { + process.stdout.write(fn({ + cov: self.cov, + coverageClass: coverageClass, + })); + }); + } -/** + /** * Return coverage class for `n`. * * @return {String} * @api private */ -function coverageClass(n) { - if (n >= 75) return 'high'; - if (n >= 50) return 'medium'; - if (n >= 25) return 'low'; - return 'terrible'; -} -}); // module: reporters/html-cov.js - -require.register("reporters/html.js", function(module, exports, require){ + function coverageClass(n) { + if (n >= 75) return 'high'; + if (n >= 50) return 'medium'; + if (n >= 25) return 'low'; + return 'terrible'; + } + }); // module: reporters/html-cov.js -/** + require.register('reporters/html.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , utils = require('../utils') - , Progress = require('../browser/progress') - , escape = utils.escape; + const Base = require('./base') + ; const utils = require('../utils') + ; const Progress = require('../browser/progress') + ; const escape = utils.escape; -/** + /** * Save timer references to avoid Sinon interfering (see GH-237). */ -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; + const Date = global.Date + ; const setTimeout = global.setTimeout + ; const setInterval = global.setInterval + ; const clearTimeout = global.clearTimeout + ; const clearInterval = global.clearInterval; -/** + /** * Expose `HTML`. */ -exports = module.exports = HTML; + exports = module.exports = HTML; -/** + /** * Stats template. */ -var statsTemplate = ''; + const statsTemplate = ''; -/** + /** * Initialize a new `HTML` reporter. * * @param {Runner} runner * @api public */ -function HTML(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , total = runner.total - , stat = fragment(statsTemplate) - , items = stat.getElementsByTagName('li') - , passes = items[1].getElementsByTagName('em')[0] - , passesLink = items[1].getElementsByTagName('a')[0] - , failures = items[2].getElementsByTagName('em')[0] - , failuresLink = items[2].getElementsByTagName('a')[0] - , duration = items[3].getElementsByTagName('em')[0] - , canvas = stat.getElementsByTagName('canvas')[0] - , report = fragment('
    ') - , stack = [report] - , progress - , ctx - , 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; - } + function HTML(runner) { + Base.call(this, runner); + + const self = this + ; const stats = this.stats + ; const total = runner.total + ; const stat = fragment(statsTemplate) + ; const items = stat.getElementsByTagName('li') + ; const passes = items[1].getElementsByTagName('em')[0] + ; const passesLink = items[1].getElementsByTagName('a')[0] + ; const failures = items[2].getElementsByTagName('em')[0] + ; const failuresLink = items[2].getElementsByTagName('a')[0] + ; const duration = items[3].getElementsByTagName('em')[0] + ; const canvas = stat.getElementsByTagName('canvas')[0] + ; const report = fragment('
      ') + ; const stack = [report] + ; let progress + ; let ctx + ; const root = document.getElementById('mocha'); + + if (canvas.getContext) { + const 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(){ - 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(){ - 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('
    • %s

    • ', 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) return; - stack.shift(); - }); - - runner.on('fail', function(test, err){ - if ('hook' == test.type) runner.emit('test end', test); - }); - - runner.on('test end', function(test){ - // TODO: add to stats - var percent = stats.tests / this.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)); - - // test - if ('passed' == test.state) { - var url = self.testURL(test); - var el = fragment('
    • %e%ems

    • ', test.speed, test.title, test.duration, url); - } else if (test.pending) { - var el = fragment('
    • %e

    • ', test.title); - } else { - var el = fragment('
    • %e

    • ', test.title, encodeURIComponent(test.fullTitle())); - var str = test.err.stack || test.err.toString(); + if (!root) return error('#mocha div missing, add it to your document'); - // FF / Opera do not add the message - if (!~str.indexOf(test.err.message)) { - str = test.err.message + '\n' + str; - } + // pass toggle + on(passesLink, 'click', function() { + unhide(); + const 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() { + unhide(); + const name = /fail/.test(report.className) ? '' : ' fail'; + report.className = report.className.replace(/fail|pass/g, '') + name; + if (report.className.trim()) hideSuitesWithout('test fail'); + }); - // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we - // check for the result of the stringifying. - if ('[object Error]' == str) str = test.err.message; + root.appendChild(stat); + root.appendChild(report); - // Safari doesn't give you a stack. Let's at least provide a source line. - if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) { - str += "\n(" + test.err.sourceURL + ":" + test.err.line + ")"; - } + if (progress) progress.size(40); - el.appendChild(fragment('
      %e
      ', str)); - } + runner.on('suite', function(suite) { + if (suite.root) return; - // toggle code - // TODO: defer - if (!test.pending) { - var h2 = el.getElementsByTagName('h2')[0]; + // suite + const url = self.suiteURL(suite); + const el = fragment('
    • %s

    • ', url, escape(suite.title)); - on(h2, 'click', function(){ - pre.style.display = 'none' == pre.style.display - ? 'block' - : 'none'; + // container + stack[0].appendChild(el); + stack.unshift(document.createElement('ul')); + el.appendChild(stack[0]); }); - var pre = fragment('
      %e
      ', utils.clean(test.fn.toString())); - el.appendChild(pre); - pre.style.display = 'none'; - } + runner.on('suite end', function(suite) { + if (suite.root) return; + stack.shift(); + }); + + runner.on('fail', function(test, err) { + if ('hook' == test.type) runner.emit('test end', test); + }); + + runner.on('test end', function(test) { + // TODO: add to stats + const percent = stats.tests / this.total * 100 | 0; + if (progress) progress.update(percent).draw(ctx); + + // update stats + const ms = new Date - stats.start; + text(passes, stats.passes); + text(failures, stats.failures); + text(duration, (ms / 1000).toFixed(2)); + + // test + if ('passed' == test.state) { + const url = self.testURL(test); + var el = fragment('
    • %e%ems

    • ', test.speed, test.title, test.duration, url); + } else if (test.pending) { + var el = fragment('
    • %e

    • ', test.title); + } else { + var el = fragment('
    • %e

    • ', test.title, encodeURIComponent(test.fullTitle())); + let str = test.err.stack || test.err.toString(); + + // FF / Opera do not add the message + if (!~str.indexOf(test.err.message)) { + str = test.err.message + '\n' + str; + } + + // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we + // check for the result of the stringifying. + if ('[object Error]' == str) str = test.err.message; + + // Safari doesn't give you a stack. Let's at least provide a source line. + if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) { + str += '\n(' + test.err.sourceURL + ':' + test.err.line + ')'; + } + + el.appendChild(fragment('
      %e
      ', str)); + } - // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack. - if (stack[0]) stack[0].appendChild(el); - }); -} + // toggle code + // TODO: defer + if (!test.pending) { + const h2 = el.getElementsByTagName('h2')[0]; -/** + on(h2, 'click', function() { + pre.style.display = 'none' == pre.style.display ? + 'block' : + 'none'; + }); + + var pre = fragment('
      %e
      ', utils.clean(test.fn.toString())); + el.appendChild(pre); + pre.style.display = 'none'; + } + + // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack. + if (stack[0]) stack[0].appendChild(el); + }); + } + + /** * Provide suite URL * * @param {Object} [suite] */ -HTML.prototype.suiteURL = function(suite){ - return '?grep=' + encodeURIComponent(suite.fullTitle()); -}; + HTML.prototype.suiteURL = function(suite) { + return '?grep=' + encodeURIComponent(suite.fullTitle()); + }; -/** + /** * Provide test URL * * @param {Object} [test] */ -HTML.prototype.testURL = function(test){ - return '?grep=' + encodeURIComponent(test.fullTitle()); -}; + HTML.prototype.testURL = function(test) { + return '?grep=' + encodeURIComponent(test.fullTitle()); + }; -/** + /** * Display error `msg`. */ -function error(msg) { - document.body.appendChild(fragment('
      %s
      ', msg)); -} + function error(msg) { + document.body.appendChild(fragment('
      %s
      ', msg)); + } -/** + /** * Return a DOM fragment from `html`. */ -function fragment(html) { - var args = arguments - , div = document.createElement('div') - , i = 1; + function fragment(html) { + const args = arguments + ; const div = document.createElement('div') + ; let i = 1; - div.innerHTML = html.replace(/%([se])/g, function(_, type){ - switch (type) { - case 's': return String(args[i++]); - case 'e': return escape(args[i++]); - } - }); + div.innerHTML = html.replace(/%([se])/g, function(_, type) { + switch (type) { + case 's': return String(args[i++]); + case 'e': return escape(args[i++]); + } + }); - return div.firstChild; -} + return div.firstChild; + } -/** + /** * Check for suites that do not have elements * with `classname`, and hide them. */ -function hideSuitesWithout(classname) { - var suites = document.getElementsByClassName('suite'); - for (var i = 0; i < suites.length; i++) { - var els = suites[i].getElementsByClassName(classname); - if (0 == els.length) suites[i].className += ' hidden'; - } -} + function hideSuitesWithout(classname) { + const suites = document.getElementsByClassName('suite'); + for (let i = 0; i < suites.length; i++) { + const els = suites[i].getElementsByClassName(classname); + if (0 == 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'); - } -} + function unhide() { + const els = document.getElementsByClassName('suite hidden'); + for (let i = 0; i < els.length; ++i) { + els[i].className = els[i].className.replace('suite hidden', 'suite'); + } + } -/** + /** * Set `el` text to `str`. */ -function text(el, str) { - if (el.textContent) { - el.textContent = str; - } else { - el.innerText = str; - } -} + function text(el, str) { + if (el.textContent) { + el.textContent = str; + } else { + el.innerText = str; + } + } -/** + /** * 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); - } -} - -}); // module: reporters/html.js - -require.register("reporters/index.js", function(module, exports, require){ - -exports.Base = require('./base'); -exports.Dot = require('./dot'); -exports.Doc = require('./doc'); -exports.TAP = require('./tap'); -exports.JSON = require('./json'); -exports.HTML = require('./html'); -exports.List = require('./list'); -exports.Min = require('./min'); -exports.Spec = require('./spec'); -exports.Nyan = require('./nyan'); -exports.XUnit = require('./xunit'); -exports.Markdown = require('./markdown'); -exports.Progress = require('./progress'); -exports.Landing = require('./landing'); -exports.JSONCov = require('./json-cov'); -exports.HTMLCov = require('./html-cov'); -exports.JSONStream = require('./json-stream'); - -}); // module: reporters/index.js - -require.register("reporters/json-cov.js", function(module, exports, require){ - -/** + function on(el, event, fn) { + if (el.addEventListener) { + el.addEventListener(event, fn, false); + } else { + el.attachEvent('on' + event, fn); + } + } + }); // module: reporters/html.js + + require.register('reporters/index.js', function(module, exports, require) { + exports.Base = require('./base'); + exports.Dot = require('./dot'); + exports.Doc = require('./doc'); + exports.TAP = require('./tap'); + exports.JSON = require('./json'); + exports.HTML = require('./html'); + exports.List = require('./list'); + exports.Min = require('./min'); + exports.Spec = require('./spec'); + exports.Nyan = require('./nyan'); + exports.XUnit = require('./xunit'); + exports.Markdown = require('./markdown'); + exports.Progress = require('./progress'); + exports.Landing = require('./landing'); + exports.JSONCov = require('./json-cov'); + exports.HTMLCov = require('./html-cov'); + exports.JSONStream = require('./json-stream'); + }); // module: reporters/index.js + + require.register('reporters/json-cov.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base'); + const Base = require('./base'); -/** + /** * Expose `JSONCov`. */ -exports = module.exports = JSONCov; + exports = module.exports = JSONCov; -/** + /** * Initialize a new `JsCoverage` reporter. * * @param {Runner} runner @@ -2863,41 +2848,41 @@ exports = module.exports = JSONCov; * @api public */ -function JSONCov(runner, output) { - var self = this - , output = 1 == arguments.length ? true : output; + function JSONCov(runner, output) { + const self = this + ; var output = 1 == arguments.length ? true : output; - Base.call(this, runner); + Base.call(this, runner); - var tests = [] - , failures = [] - , passes = []; + const tests = [] + ; const failures = [] + ; const passes = []; - runner.on('test end', function(test){ - tests.push(test); - }); + runner.on('test end', function(test) { + tests.push(test); + }); - runner.on('pass', function(test){ - passes.push(test); - }); + runner.on('pass', function(test) { + passes.push(test); + }); - runner.on('fail', function(test){ - failures.push(test); - }); + runner.on('fail', function(test) { + failures.push(test); + }); - runner.on('end', function(){ - var cov = global._$jscoverage || {}; - var result = self.cov = map(cov); - result.stats = self.stats; - result.tests = tests.map(clean); - result.failures = failures.map(clean); - result.passes = passes.map(clean); - if (!output) return; - process.stdout.write(JSON.stringify(result, null, 2 )); - }); -} + runner.on('end', function() { + const cov = global._$jscoverage || {}; + const result = self.cov = map(cov); + result.stats = self.stats; + result.tests = tests.map(clean); + result.failures = failures.map(clean); + result.passes = passes.map(clean); + if (!output) return; + process.stdout.write(JSON.stringify(result, null, 2 )); + }); + } -/** + /** * Map jscoverage data to a JSON structure * suitable for reporting. * @@ -2906,36 +2891,36 @@ function JSONCov(runner, output) { * @api private */ -function map(cov) { - var ret = { - instrumentation: 'node-jscoverage' - , sloc: 0 - , hits: 0 - , misses: 0 - , coverage: 0 - , files: [] - }; - - for (var filename in cov) { - var data = coverage(filename, cov[filename]); - ret.files.push(data); - ret.hits += data.hits; - ret.misses += data.misses; - ret.sloc += data.sloc; - } + function map(cov) { + const ret = { + instrumentation: 'node-jscoverage', + sloc: 0, + hits: 0, + misses: 0, + coverage: 0, + files: [], + }; + + for (const filename in cov) { + const data = coverage(filename, cov[filename]); + ret.files.push(data); + ret.hits += data.hits; + ret.misses += data.misses; + ret.sloc += data.sloc; + } - ret.files.sort(function(a, b) { - return a.filename.localeCompare(b.filename); - }); + ret.files.sort(function(a, b) { + return a.filename.localeCompare(b.filename); + }); - if (ret.sloc > 0) { - ret.coverage = (ret.hits / ret.sloc) * 100; - } + if (ret.sloc > 0) { + ret.coverage = (ret.hits / ret.sloc) * 100; + } - return ret; -}; + return ret; + }; -/** + /** * Map jscoverage data for a single source file * to a JSON structure suitable for reporting. * @@ -2945,41 +2930,41 @@ function map(cov) { * @api private */ -function coverage(filename, data) { - var ret = { - filename: filename, - coverage: 0, - hits: 0, - misses: 0, - sloc: 0, - source: {} - }; - - data.source.forEach(function(line, num){ - num++; - - if (data[num] === 0) { - ret.misses++; - ret.sloc++; - } else if (data[num] !== undefined) { - ret.hits++; - ret.sloc++; - } + function coverage(filename, data) { + const ret = { + filename: filename, + coverage: 0, + hits: 0, + misses: 0, + sloc: 0, + source: {}, + }; + + data.source.forEach(function(line, num) { + num++; + + if (data[num] === 0) { + ret.misses++; + ret.sloc++; + } else if (data[num] !== undefined) { + ret.hits++; + ret.sloc++; + } - ret.source[num] = { - source: line - , coverage: data[num] === undefined - ? '' - : data[num] - }; - }); + ret.source[num] = { + source: line, + coverage: data[num] === undefined ? + '' : + data[num], + }; + }); - ret.coverage = ret.hits / ret.sloc * 100; + ret.coverage = ret.hits / ret.sloc * 100; - return ret; -} + return ret; + } -/** + /** * Return a plain-object representation of `test` * free of cyclic properties etc. * @@ -2988,63 +2973,61 @@ function coverage(filename, data) { * @api private */ -function clean(test) { - return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} - -}); // module: reporters/json-cov.js - -require.register("reporters/json-stream.js", function(module, exports, require){ + function clean(test) { + return { + title: test.title, + fullTitle: test.fullTitle(), + duration: test.duration, + }; + } + }); // module: reporters/json-cov.js -/** + require.register('reporters/json-stream.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , color = Base.color; + const Base = require('./base') + ; const color = Base.color; -/** + /** * Expose `List`. */ -exports = module.exports = List; + exports = module.exports = List; -/** + /** * Initialize a new `List` test reporter. * * @param {Runner} runner * @api public */ -function List(runner) { - Base.call(this, runner); + function List(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , total = runner.total; + const self = this + ; const stats = this.stats + ; const total = runner.total; - runner.on('start', function(){ - console.log(JSON.stringify(['start', { total: 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('pass', function(test) { + console.log(JSON.stringify(['pass', clean(test)])); + }); - runner.on('fail', function(test, err){ - console.log(JSON.stringify(['fail', clean(test)])); - }); + runner.on('fail', function(test, err) { + console.log(JSON.stringify(['fail', clean(test)])); + }); - runner.on('end', function(){ - process.stdout.write(JSON.stringify(['end', self.stats])); - }); -} + runner.on('end', function() { + process.stdout.write(JSON.stringify(['end', self.stats])); + }); + } -/** + /** * Return a plain-object representation of `test` * free of cyclic properties etc. * @@ -3053,71 +3036,70 @@ function List(runner) { * @api private */ -function clean(test) { - return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} -}); // module: reporters/json-stream.js - -require.register("reporters/json.js", function(module, exports, require){ + function clean(test) { + return { + title: test.title, + fullTitle: test.fullTitle(), + duration: test.duration, + }; + } + }); // module: reporters/json-stream.js -/** + require.register('reporters/json.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; + const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; -/** + /** * Expose `JSON`. */ -exports = module.exports = JSONReporter; + exports = module.exports = JSONReporter; -/** + /** * Initialize a new `JSON` reporter. * * @param {Runner} runner * @api public */ -function JSONReporter(runner) { - var self = this; - Base.call(this, runner); + function JSONReporter(runner) { + const self = this; + Base.call(this, runner); - var tests = [] - , failures = [] - , passes = []; + const tests = [] + ; const failures = [] + ; const passes = []; - runner.on('test end', function(test){ - tests.push(test); - }); + runner.on('test end', function(test) { + tests.push(test); + }); - runner.on('pass', function(test){ - passes.push(test); - }); + runner.on('pass', function(test) { + passes.push(test); + }); - runner.on('fail', function(test){ - failures.push(test); - }); + runner.on('fail', function(test) { + failures.push(test); + }); - runner.on('end', function(){ - var obj = { - stats: self.stats - , tests: tests.map(clean) - , failures: failures.map(clean) - , passes: passes.map(clean) - }; + runner.on('end', function() { + const obj = { + stats: self.stats, + tests: tests.map(clean), + failures: failures.map(clean), + passes: passes.map(clean), + }; - process.stdout.write(JSON.stringify(obj, null, 2)); - }); -} + process.stdout.write(JSON.stringify(obj, null, 2)); + }); + } -/** + /** * Return a plain-object representation of `test` * free of cyclic properties etc. * @@ -3126,566 +3108,558 @@ function JSONReporter(runner) { * @api private */ -function clean(test) { - return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} -}); // module: reporters/json.js - -require.register("reporters/landing.js", function(module, exports, require){ + function clean(test) { + return { + title: test.title, + fullTitle: test.fullTitle(), + duration: test.duration, + }; + } + }); // module: reporters/json.js -/** + require.register('reporters/landing.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; + const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; -/** + /** * Expose `Landing`. */ -exports = module.exports = Landing; + exports = module.exports = Landing; -/** + /** * Airplane color. */ -Base.colors.plane = 0; + Base.colors.plane = 0; -/** + /** * Airplane crash color. */ -Base.colors['plane crash'] = 31; + Base.colors['plane crash'] = 31; -/** + /** * Runway color. */ -Base.colors.runway = 90; + Base.colors.runway = 90; -/** + /** * Initialize a new `Landing` reporter. * * @param {Runner} runner * @api public */ -function Landing(runner) { - Base.call(this, runner); + function Landing(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , total = runner.total - , stream = process.stdout - , plane = color('plane', '✈') - , crashed = -1 - , n = 0; + const self = this + ; const stats = this.stats + ; const width = Base.window.width * .75 | 0 + ; const total = runner.total + ; const stream = process.stdout + ; let plane = color('plane', '✈') + ; let crashed = -1 + ; let n = 0; - function runway() { - var buf = Array(width).join('-'); - return ' ' + color('runway', buf); - } + function runway() { + const buf = Array(width).join('-'); + return ' ' + color('runway', buf); + } + + runner.on('start', function() { + stream.write('\n '); + cursor.hide(); + }); - runner.on('start', function(){ - stream.write('\n '); - cursor.hide(); - }); - - runner.on('test end', function(test){ - // check if the plane crashed - var col = -1 == crashed - ? width * ++n / total | 0 - : crashed; - - // show the crash - if ('failed' == test.state) { - plane = color('plane crash', '✈'); - crashed = col; + runner.on('test end', function(test) { + // check if the plane crashed + const col = -1 == crashed ? + width * ++n / total | 0 : + crashed; + + // show the crash + if ('failed' == test.state) { + plane = color('plane crash', '✈'); + crashed = col; + } + + // render landing strip + stream.write('\u001b[4F\n\n'); + 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(); + }); } - // render landing strip - stream.write('\u001b[4F\n\n'); - 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`. */ -function F(){}; -F.prototype = Base.prototype; -Landing.prototype = new F; -Landing.prototype.constructor = Landing; - -}); // module: reporters/landing.js + function F() {}; + F.prototype = Base.prototype; + Landing.prototype = new F; + Landing.prototype.constructor = Landing; + }); // module: reporters/landing.js -require.register("reporters/list.js", function(module, exports, require){ - -/** + require.register('reporters/list.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; + const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; -/** + /** * Expose `List`. */ -exports = module.exports = List; + exports = module.exports = List; -/** + /** * Initialize a new `List` test reporter. * * @param {Runner} runner * @api public */ -function List(runner) { - Base.call(this, runner); + function List(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , n = 0; + const self = this + ; const stats = this.stats + ; let n = 0; - runner.on('start', function(){ - console.log(); - }); + runner.on('start', function() { + console.log(); + }); - runner.on('test', function(test){ - process.stdout.write(color('pass', ' ' + test.fullTitle() + ': ')); - }); + 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('pending', function(test) { + const 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('pass', function(test) { + const 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, err){ - cursor.CR(); - console.log(color('fail', ' %d) %s'), ++n, test.fullTitle()); - }); + runner.on('fail', function(test, err) { + cursor.CR(); + console.log(color('fail', ' %d) %s'), ++n, test.fullTitle()); + }); - runner.on('end', self.epilogue.bind(self)); -} + runner.on('end', self.epilogue.bind(self)); + } -/** + /** * Inherit from `Base.prototype`. */ -function F(){}; -F.prototype = Base.prototype; -List.prototype = new F; -List.prototype.constructor = List; - + function F() {}; + F.prototype = Base.prototype; + List.prototype = new F; + List.prototype.constructor = List; + }); // module: reporters/list.js -}); // module: reporters/list.js - -require.register("reporters/markdown.js", function(module, exports, require){ -/** + require.register('reporters/markdown.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , utils = require('../utils'); + const Base = require('./base') + ; const utils = require('../utils'); -/** + /** * Expose `Markdown`. */ -exports = module.exports = Markdown; + exports = module.exports = Markdown; -/** + /** * Initialize a new `Markdown` reporter. * * @param {Runner} runner * @api public */ -function Markdown(runner) { - Base.call(this, runner); + function Markdown(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , level = 0 - , buf = ''; + const self = this + ; const stats = this.stats + ; let level = 0 + ; let buf = ''; - function title(str) { - return Array(level).join('#') + ' ' + str; - } + function title(str) { + return Array(level).join('#') + ' ' + str; + } - function indent() { - return Array(level).join(' '); - } + function indent() { + return Array(level).join(' '); + } - function mapTOC(suite, obj) { - var ret = obj; - obj = obj[suite.title] = obj[suite.title] || { suite: suite }; - suite.suites.forEach(function(suite){ - mapTOC(suite, obj); - }); - return ret; - } + function mapTOC(suite, obj) { + const ret = obj; + obj = obj[suite.title] = obj[suite.title] || {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 ('suite' == key) continue; - if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n'; - if (key) buf += Array(level).join(' ') + link; - buf += stringifyTOC(obj[key], level); - } - --level; - return buf; - } + function stringifyTOC(obj, level) { + ++level; + let buf = ''; + let link; + for (const key in obj) { + if ('suite' == key) continue; + if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n'; + if (key) buf += Array(level).join(' ') + link; + buf += stringifyTOC(obj[key], level); + } + --level; + return buf; + } - function generateTOC(suite) { - var obj = mapTOC(suite, {}); - return stringifyTOC(obj, 0); - } + function generateTOC(suite) { + const obj = mapTOC(suite, {}); + return stringifyTOC(obj, 0); + } + + generateTOC(runner.suite); + + runner.on('suite', function(suite) { + ++level; + const slug = utils.slug(suite.fullTitle()); + buf += '' + '\n'; + buf += title(suite.title) + '\n'; + }); - generateTOC(runner.suite); - - runner.on('suite', function(suite){ - ++level; - var slug = utils.slug(suite.fullTitle()); - buf += '' + '\n'; - buf += title(suite.title) + '\n'; - }); - - runner.on('suite end', function(suite){ - --level; - }); - - runner.on('pass', function(test){ - var code = utils.clean(test.fn.toString()); - 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); - }); -} -}); // module: reporters/markdown.js - -require.register("reporters/min.js", function(module, exports, require){ - -/** + runner.on('suite end', function(suite) { + --level; + }); + + runner.on('pass', function(test) { + const code = utils.clean(test.fn.toString()); + 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); + }); + } + }); // module: reporters/markdown.js + + require.register('reporters/min.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base'); + const Base = require('./base'); -/** + /** * Expose `Min`. */ -exports = module.exports = Min; + exports = module.exports = Min; -/** + /** * Initialize a new `Min` minimal test reporter (best used with --watch). * * @param {Runner} runner * @api public */ -function Min(runner) { - Base.call(this, 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('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)); -} + runner.on('end', this.epilogue.bind(this)); + } -/** + /** * Inherit from `Base.prototype`. */ -function F(){}; -F.prototype = Base.prototype; -Min.prototype = new F; -Min.prototype.constructor = Min; - + function F() {}; + F.prototype = Base.prototype; + Min.prototype = new F; + Min.prototype.constructor = Min; + }); // module: reporters/min.js -}); // module: reporters/min.js - -require.register("reporters/nyan.js", function(module, exports, require){ -/** + require.register('reporters/nyan.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , color = Base.color; + const Base = require('./base') + ; const color = Base.color; -/** + /** * Expose `Dot`. */ -exports = module.exports = NyanCat; + 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 - , stats = this.stats - , width = Base.window.width * .75 | 0 - , rainbowColors = this.rainbowColors = self.generateColors() - , colorIndex = this.colorIndex = 0 - , numerOfLines = this.numberOfLines = 4 - , trajectories = this.trajectories = [[], [], [], []] - , nyanCatWidth = this.nyanCatWidth = 11 - , trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth) - , scoreboardWidth = this.scoreboardWidth = 5 - , tick = this.tick = 0 - , n = 0; - - runner.on('start', function(){ - Base.cursor.hide(); - self.draw(); - }); - - runner.on('pending', function(test){ - self.draw(); - }); - - runner.on('pass', function(test){ - self.draw(); - }); - - runner.on('fail', function(test, err){ - self.draw(); - }); - - runner.on('end', function(){ - Base.cursor.show(); - for (var i = 0; i < self.numberOfLines; i++) write('\n'); - self.epilogue(); - }); -} - -/** + function NyanCat(runner) { + Base.call(this, runner); + const self = this + ; const stats = this.stats + ; const width = Base.window.width * .75 | 0 + ; const rainbowColors = this.rainbowColors = self.generateColors() + ; const colorIndex = this.colorIndex = 0 + ; const numerOfLines = this.numberOfLines = 4 + ; const trajectories = this.trajectories = [[], [], [], []] + ; const nyanCatWidth = this.nyanCatWidth = 11 + ; const trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth) + ; const scoreboardWidth = this.scoreboardWidth = 5 + ; const tick = this.tick = 0 + ; const n = 0; + + runner.on('start', function() { + Base.cursor.hide(); + self.draw(); + }); + + runner.on('pending', function(test) { + self.draw(); + }); + + runner.on('pass', function(test) { + self.draw(); + }); + + runner.on('fail', function(test, err) { + self.draw(); + }); + + runner.on('end', function() { + Base.cursor.show(); + for (let i = 0; i < self.numberOfLines; i++) write('\n'); + self.epilogue(); + }); + } + + /** * Draw the nyan cat * * @api private */ -NyanCat.prototype.draw = function(){ - this.appendRainbow(); - this.drawScoreboard(); - this.drawRainbow(); - this.drawNyanCat(); - this.tick = !this.tick; -}; + 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; - var colors = Base.colors; + NyanCat.prototype.drawScoreboard = function() { + const stats = this.stats; + const colors = Base.colors; - function draw(color, n) { - write(' '); - write('\u001b[' + color + 'm' + n + '\u001b[0m'); - write('\n'); - } + function draw(color, n) { + write(' '); + write('\u001b[' + color + 'm' + n + '\u001b[0m'); + write('\n'); + } - draw(colors.green, stats.passes); - draw(colors.fail, stats.failures); - draw(colors.pending, stats.pending); - write('\n'); + draw(colors.green, stats.passes); + draw(colors.fail, stats.failures); + draw(colors.pending, stats.pending); + write('\n'); - this.cursorUp(this.numberOfLines); -}; + this.cursorUp(this.numberOfLines); + }; -/** + /** * Append the rainbow. * * @api private */ -NyanCat.prototype.appendRainbow = function(){ - var segment = this.tick ? '_' : '-'; - var rainbowified = this.rainbowify(segment); + NyanCat.prototype.appendRainbow = function() { + const segment = this.tick ? '_' : '-'; + const 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); - } -}; + for (let index = 0; index < this.numberOfLines; index++) { + const 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; + NyanCat.prototype.drawRainbow = function() { + const self = this; - this.trajectories.forEach(function(line, index) { - write('\u001b[' + self.scoreboardWidth + 'C'); - write(line.join('')); - write('\n'); - }); + this.trajectories.forEach(function(line, index) { + write('\u001b[' + self.scoreboardWidth + 'C'); + write(line.join('')); + write('\n'); + }); - this.cursorUp(this.numberOfLines); -}; + 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 color = '\u001b[' + startWidth + 'C'; - var padding = ''; + NyanCat.prototype.drawNyanCat = function() { + const self = this; + const startWidth = this.scoreboardWidth + this.trajectories[0].length; + const color = '\u001b[' + startWidth + 'C'; + let padding = ''; - write(color); - write('_,------,'); - write('\n'); + write(color); + write('_,------,'); + write('\n'); - write(color); - padding = self.tick ? ' ' : ' '; - write('_|' + padding + '/\\_/\\ '); - write('\n'); + write(color); + padding = self.tick ? ' ' : ' '; + write('_|' + padding + '/\\_/\\ '); + write('\n'); - write(color); - padding = self.tick ? '_' : '__'; - var tail = self.tick ? '~' : '^'; - var face; - write(tail + '|' + padding + this.face() + ' '); - write('\n'); + write(color); + padding = self.tick ? '_' : '__'; + const tail = self.tick ? '~' : '^'; + let face; + write(tail + '|' + padding + this.face() + ' '); + write('\n'); - write(color); - padding = self.tick ? ' ' : ' '; - write(padding + '"" "" '); - write('\n'); + write(color); + padding = self.tick ? ' ' : ' '; + write(padding + '"" "" '); + write('\n'); - this.cursorUp(this.numberOfLines); -}; + this.cursorUp(this.numberOfLines); + }; -/** + /** * Draw nyan cat face. * * @return {String} * @api private */ -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 '( ^ .^)'; - } else { - return '( - .-)'; - } -} + NyanCat.prototype.face = function() { + const stats = this.stats; + if (stats.failures) { + return '( x .x)'; + } else if (stats.pending) { + return '( o .o)'; + } else if (stats.passes) { + return '( ^ .^)'; + } else { + return '( - .-)'; + } + }; -/** + /** * Move cursor up `n`. * * @param {Number} n * @api private */ -NyanCat.prototype.cursorUp = function(n) { - write('\u001b[' + n + 'A'); -}; + NyanCat.prototype.cursorUp = function(n) { + write('\u001b[' + n + 'A'); + }; -/** + /** * Move cursor down `n`. * * @param {Number} n * @api private */ -NyanCat.prototype.cursorDown = function(n) { - write('\u001b[' + n + 'B'); -}; + NyanCat.prototype.cursorDown = function(n) { + write('\u001b[' + n + 'B'); + }; -/** + /** * Generate rainbow colors. * * @return {Array} * @api private */ -NyanCat.prototype.generateColors = function(){ - var colors = []; + NyanCat.prototype.generateColors = function() { + const 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); - } + for (let i = 0; i < (6 * 7); i++) { + const pi3 = Math.floor(Math.PI / 3); + const n = (i * (1.0 / 6)); + const r = Math.floor(3 * Math.sin(n) + 3); + const g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3); + const b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3); + colors.push(36 * r + 6 * g + b + 16); + } - return colors; -}; + return colors; + }; -/** + /** * Apply rainbow to the given `str`. * * @param {String} str @@ -3693,55 +3667,52 @@ NyanCat.prototype.generateColors = function(){ * @api private */ -NyanCat.prototype.rainbowify = function(str){ - var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length]; - this.colorIndex += 1; - return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m'; -}; + NyanCat.prototype.rainbowify = function(str) { + const color = this.rainbowColors[this.colorIndex % this.rainbowColors.length]; + this.colorIndex += 1; + return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m'; + }; -/** + /** * Stdout helper. */ -function write(string) { - process.stdout.write(string); -} + function write(string) { + process.stdout.write(string); + } -/** + /** * Inherit from `Base.prototype`. */ -function F(){}; -F.prototype = Base.prototype; -NyanCat.prototype = new F; -NyanCat.prototype.constructor = NyanCat; - - -}); // module: reporters/nyan.js + function F() {}; + F.prototype = Base.prototype; + NyanCat.prototype = new F; + NyanCat.prototype.constructor = NyanCat; + }); // module: reporters/nyan.js -require.register("reporters/progress.js", function(module, exports, require){ - -/** + require.register('reporters/progress.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; + const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; -/** + /** * Expose `Progress`. */ -exports = module.exports = Progress; + exports = module.exports = Progress; -/** + /** * General progress bar color. */ -Base.colors.progress = 90; + Base.colors.progress = 90; -/** + /** * Initialize a new `Progress` bar test reporter. * * @param {Runner} runner @@ -3749,225 +3720,219 @@ Base.colors.progress = 90; * @api public */ -function Progress(runner, options) { - Base.call(this, runner); - - var self = this - , options = options || {} - , stats = this.stats - , width = Base.window.width * .50 | 0 - , total = runner.total - , complete = 0 - , max = Math.max; - - // default chars - 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 incomplete = total - complete - , percent = complete / total - , n = width * percent | 0 - , i = width - 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`. - */ + function Progress(runner, options) { + Base.call(this, runner); + + const self = this + ; var options = options || {} + ; const stats = this.stats + ; const width = Base.window.width * .50 | 0 + ; const total = runner.total + ; let complete = 0 + ; const max = Math.max; + + // default chars + 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(); + }); -function F(){}; -F.prototype = Base.prototype; -Progress.prototype = new F; -Progress.prototype.constructor = Progress; + // tests complete + runner.on('test end', function() { + complete++; + const incomplete = total - complete + ; const percent = complete / total + ; const n = width * percent | 0 + ; const i = width - 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(); + }); + } -}); // module: reporters/progress.js + /** + * Inherit from `Base.prototype`. + */ -require.register("reporters/spec.js", function(module, exports, require){ + function F() {}; + F.prototype = Base.prototype; + Progress.prototype = new F; + Progress.prototype.constructor = Progress; + }); // module: reporters/progress.js -/** + require.register('reporters/spec.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; + const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; -/** + /** * Expose `Spec`. */ -exports = module.exports = Spec; + exports = module.exports = Spec; -/** + /** * Initialize a new `Spec` test reporter. * * @param {Runner} runner * @api public */ -function Spec(runner) { - Base.call(this, runner); + function Spec(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , indents = 0 - , n = 0; + const self = this + ; const stats = this.stats + ; let indents = 0 + ; let n = 0; - function indent() { - return Array(indents).join(' ') - } + 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(suite){ - --indents; - if (1 == indents) console.log(); - }); - - runner.on('pending', function(test){ - var fmt = indent() + color('pending', ' - %s'); - console.log(fmt, test.title); - }); - - runner.on('pass', function(test){ - if ('fast' == test.speed) { - var fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s '); - cursor.CR(); - console.log(fmt, test.title); - } else { - var fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s ') - + color(test.speed, '(%dms)'); - cursor.CR(); - console.log(fmt, test.title, test.duration); - } - }); + runner.on('start', function() { + console.log(); + }); - runner.on('fail', function(test, err){ - cursor.CR(); - console.log(indent() + color('fail', ' %d) %s'), ++n, test.title); - }); + runner.on('suite', function(suite) { + ++indents; + console.log(color('suite', '%s%s'), indent(), suite.title); + }); - runner.on('end', self.epilogue.bind(self)); -} + runner.on('suite end', function(suite) { + --indents; + if (1 == indents) console.log(); + }); -/** - * Inherit from `Base.prototype`. - */ + runner.on('pending', function(test) { + const fmt = indent() + color('pending', ' - %s'); + console.log(fmt, test.title); + }); + + runner.on('pass', function(test) { + if ('fast' == test.speed) { + var fmt = indent() + + color('checkmark', ' ' + Base.symbols.ok) + + color('pass', ' %s '); + cursor.CR(); + console.log(fmt, test.title); + } else { + var fmt = indent() + + color('checkmark', ' ' + Base.symbols.ok) + + color('pass', ' %s ') + + color(test.speed, '(%dms)'); + cursor.CR(); + console.log(fmt, test.title, test.duration); + } + }); -function F(){}; -F.prototype = Base.prototype; -Spec.prototype = new F; -Spec.prototype.constructor = Spec; + runner.on('fail', function(test, err) { + cursor.CR(); + console.log(indent() + color('fail', ' %d) %s'), ++n, test.title); + }); + runner.on('end', self.epilogue.bind(self)); + } -}); // module: reporters/spec.js + /** + * Inherit from `Base.prototype`. + */ -require.register("reporters/tap.js", function(module, exports, require){ + function F() {}; + F.prototype = Base.prototype; + Spec.prototype = new F; + Spec.prototype.constructor = Spec; + }); // module: reporters/spec.js -/** + require.register('reporters/tap.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; + const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; -/** + /** * Expose `TAP`. */ -exports = module.exports = TAP; + exports = module.exports = TAP; -/** + /** * Initialize a new `TAP` reporter. * * @param {Runner} runner * @api public */ -function TAP(runner) { - Base.call(this, runner); + function TAP(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , n = 1 - , passes = 0 - , failures = 0; + const self = this + ; const stats = this.stats + ; let n = 1 + ; let passes = 0 + ; let failures = 0; - runner.on('start', function(){ - var total = runner.grepTotal(runner.suite); - console.log('%d..%d', 1, total); - }); + runner.on('start', function() { + const total = runner.grepTotal(runner.suite); + console.log('%d..%d', 1, total); + }); - runner.on('test end', function(){ - ++n; - }); + runner.on('test end', function() { + ++n; + }); - runner.on('pending', function(test){ - console.log('ok %d %s # SKIP -', n, title(test)); - }); + 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('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('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); - }); -} + runner.on('end', function() { + console.log('# tests ' + (passes + failures)); + console.log('# pass ' + passes); + console.log('# fail ' + failures); + }); + } -/** + /** * Return a TAP-safe title of `test` * * @param {Object} test @@ -3975,172 +3940,168 @@ function TAP(runner) { * @api private */ -function title(test) { - return test.fullTitle().replace(/#/g, ''); -} - -}); // module: reporters/tap.js - -require.register("reporters/xunit.js", function(module, exports, require){ + function title(test) { + return test.fullTitle().replace(/#/g, ''); + } + }); // module: reporters/tap.js -/** + require.register('reporters/xunit.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , utils = require('../utils') - , escape = utils.escape; + const Base = require('./base') + ; const utils = require('../utils') + ; const escape = utils.escape; -/** + /** * Save timer references to avoid Sinon interfering (see GH-237). */ -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; + const Date = global.Date + ; const setTimeout = global.setTimeout + ; const setInterval = global.setInterval + ; const clearTimeout = global.clearTimeout + ; const clearInterval = global.clearInterval; -/** + /** * Expose `XUnit`. */ -exports = module.exports = XUnit; + exports = module.exports = XUnit; -/** + /** * Initialize a new `XUnit` reporter. * * @param {Runner} runner * @api public */ -function XUnit(runner) { - Base.call(this, runner); - var stats = this.stats - , tests = [] - , self = this; - - 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(){ - console.log(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(test); - console.log(''); - }); -} - -/** + function XUnit(runner) { + Base.call(this, runner); + const stats = this.stats + ; const tests = [] + ; const self = this; + + 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() { + console.log(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(test); + console.log(''); + }); + } + + /** * Inherit from `Base.prototype`. */ -function F(){}; -F.prototype = Base.prototype; -XUnit.prototype = new F; -XUnit.prototype.constructor = XUnit; + function F() {}; + F.prototype = Base.prototype; + XUnit.prototype = new F; + XUnit.prototype.constructor = XUnit; -/** + /** * Output tag for the given `test.` */ -function test(test) { - var attrs = { - classname: test.parent.fullTitle() - , name: test.title - , time: (test.duration / 1000) || 0 - }; + function test(test) { + const attrs = { + classname: test.parent.fullTitle(), + name: test.title, + time: (test.duration / 1000) || 0, + }; - if ('failed' == test.state) { - var err = test.err; - attrs.message = escape(err.message); - console.log(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(err.stack)))); - } else if (test.pending) { - console.log(tag('testcase', attrs, false, tag('skipped', {}, true))); - } else { - console.log(tag('testcase', attrs, true) ); - } -} + if ('failed' == test.state) { + const err = test.err; + attrs.message = escape(err.message); + console.log(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(err.stack)))); + } else if (test.pending) { + console.log(tag('testcase', attrs, false, tag('skipped', {}, true))); + } else { + console.log(tag('testcase', attrs, true) ); + } + } -/** + /** * HTML tag helper. */ -function tag(name, attrs, close, content) { - var end = close ? '/>' : '>' - , pairs = [] - , tag; + function tag(name, attrs, close, content) { + const end = close ? '/>' : '>' + ; const pairs = [] + ; let tag; - for (var key in attrs) { - pairs.push(key + '="' + escape(attrs[key]) + '"'); - } + for (const key in attrs) { + pairs.push(key + '="' + escape(attrs[key]) + '"'); + } - tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end; - if (content) tag += content + ''; -} - -}); // module: reporters/xunit.js - -require.register("runnable.js", function(module, exports, require){ + function cdata(str) { + return ''; + } + }); // module: reporters/xunit.js -/** + require.register('runnable.js', function(module, exports, require) { + /** * Module dependencies. */ -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:runnable') - , milliseconds = require('./ms'); + const EventEmitter = require('browser/events').EventEmitter + ; const debug = require('browser/debug')('mocha:runnable') + ; const milliseconds = require('./ms'); -/** + /** * Save timer references to avoid Sinon interfering (see GH-237). */ -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; + const Date = global.Date + ; const setTimeout = global.setTimeout + ; const setInterval = global.setInterval + ; const clearTimeout = global.clearTimeout + ; const clearInterval = global.clearInterval; -/** + /** * Object#toString(). */ -var toString = Object.prototype.toString; + const toString = Object.prototype.toString; -/** + /** * Expose `Runnable`. */ -module.exports = Runnable; + module.exports = Runnable; -/** + /** * Initialize a new `Runnable` with the given `title` and callback `fn`. * * @param {String} title @@ -4148,27 +4109,27 @@ module.exports = Runnable; * @api private */ -function Runnable(title, fn) { - this.title = title; - this.fn = fn; - this.async = fn && fn.length; - this.sync = ! this.async; - this._timeout = 2000; - this._slow = 75; - this.timedOut = false; -} + function Runnable(title, fn) { + this.title = title; + this.fn = fn; + this.async = fn && fn.length; + this.sync = ! this.async; + this._timeout = 2000; + this._slow = 75; + this.timedOut = false; + } -/** + /** * Inherit from `EventEmitter.prototype`. */ -function F(){}; -F.prototype = EventEmitter.prototype; -Runnable.prototype = new F; -Runnable.prototype.constructor = Runnable; + function F() {}; + F.prototype = EventEmitter.prototype; + Runnable.prototype = new F; + Runnable.prototype.constructor = Runnable; -/** + /** * Set & get timeout `ms`. * * @param {Number|String} ms @@ -4176,16 +4137,16 @@ Runnable.prototype.constructor = Runnable; * @api private */ -Runnable.prototype.timeout = function(ms){ - if (0 == arguments.length) return this._timeout; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('timeout %d', ms); - this._timeout = ms; - if (this.timer) this.resetTimeout(); - return this; -}; + Runnable.prototype.timeout = function(ms) { + if (0 == arguments.length) return this._timeout; + if ('string' == typeof ms) ms = milliseconds(ms); + debug('timeout %d', ms); + this._timeout = ms; + if (this.timer) this.resetTimeout(); + return this; + }; -/** + /** * Set & get slow `ms`. * * @param {Number|String} ms @@ -4193,15 +4154,15 @@ Runnable.prototype.timeout = function(ms){ * @api private */ -Runnable.prototype.slow = function(ms){ - if (0 === arguments.length) return this._slow; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('timeout %d', ms); - this._slow = ms; - return this; -}; + Runnable.prototype.slow = function(ms) { + if (0 === arguments.length) return this._slow; + if ('string' == typeof ms) ms = milliseconds(ms); + debug('timeout %d', ms); + this._slow = ms; + return this; + }; -/** + /** * Return the full title generated by recursively * concatenating the parent's full title. * @@ -4209,176 +4170,177 @@ Runnable.prototype.slow = function(ms){ * @api public */ -Runnable.prototype.fullTitle = function(){ - return this.parent.fullTitle() + ' ' + this.title; -}; + Runnable.prototype.fullTitle = function() { + return this.parent.fullTitle() + ' ' + this.title; + }; -/** + /** * Clear the timeout. * * @api private */ -Runnable.prototype.clearTimeout = function(){ - clearTimeout(this.timer); -}; + Runnable.prototype.clearTimeout = function() { + clearTimeout(this.timer); + }; -/** + /** * Inspect the runnable void of private properties. * * @return {String} * @api private */ -Runnable.prototype.inspect = function(){ - return JSON.stringify(this, function(key, val){ - if ('_' == key[0]) return; - if ('parent' == key) return '#'; - if ('ctx' == key) return '#'; - return val; - }, 2); -}; + Runnable.prototype.inspect = function() { + return JSON.stringify(this, function(key, val) { + if ('_' == key[0]) return; + if ('parent' == key) return '#'; + if ('ctx' == key) return '#'; + return val; + }, 2); + }; -/** + /** * Reset the timeout. * * @api private */ -Runnable.prototype.resetTimeout = function(){ - var self = this; - var ms = this.timeout() || 1e9; + Runnable.prototype.resetTimeout = function() { + const self = this; + const ms = this.timeout() || 1e9; - this.clearTimeout(); - this.timer = setTimeout(function(){ - self.callback(new Error('timeout of ' + ms + 'ms exceeded')); - self.timedOut = true; - }, ms); -}; + this.clearTimeout(); + this.timer = setTimeout(function() { + self.callback(new Error('timeout of ' + ms + 'ms exceeded')); + self.timedOut = true; + }, ms); + }; -/** + /** * Whitelist these globals for this test run * * @api private */ -Runnable.prototype.globals = function(arr){ - var self = this; - this._allowedGlobals = arr; -}; + Runnable.prototype.globals = function(arr) { + const self = this; + this._allowedGlobals = arr; + }; -/** + /** * Run the test and invoke `fn(err)`. * * @param {Function} fn * @api private */ -Runnable.prototype.run = function(fn){ - var self = this - , ms = this.timeout() - , start = new Date - , ctx = this.ctx - , finished - , emitted; - - if (ctx) ctx.runnable(this); + Runnable.prototype.run = function(fn) { + const self = this + ; const ms = this.timeout() + ; const start = new Date + ; const ctx = this.ctx + ; let finished + ; let emitted; - // called multiple times - function multiple(err) { - if (emitted) return; - emitted = true; - self.emit('error', err || new Error('done() called multiple times')); - } + if (ctx) ctx.runnable(this); - // finished - function done(err) { - if (self.timedOut) return; - if (finished) return multiple(err); - self.clearTimeout(); - self.duration = new Date - start; - finished = true; - fn(err); - } + // called multiple times + function multiple(err) { + if (emitted) return; + emitted = true; + self.emit('error', err || new Error('done() called multiple times')); + } - // for .resetTimeout() - this.callback = done; + // finished + function done(err) { + if (self.timedOut) return; + if (finished) return multiple(err); + self.clearTimeout(); + self.duration = new Date - start; + finished = true; + fn(err); + } - // explicit async with `done` argument - if (this.async) { - this.resetTimeout(); + // for .resetTimeout() + this.callback = done; - try { - this.fn.call(ctx, function(err){ - if (err instanceof Error || toString.call(err) === "[object Error]") return done(err); - if (null != err) return done(new Error('done() invoked with non-Error: ' + err)); - done(); - }); - } catch (err) { - done(err); - } - return; - } + // explicit async with `done` argument + if (this.async) { + this.resetTimeout(); - if (this.asyncOnly) { - return done(new Error('--async-only option in use without declaring `done()`')); - } + try { + this.fn.call(ctx, function(err) { + if (err instanceof Error || toString.call(err) === '[object Error]') return done(err); + if (null != err) return done(new Error('done() invoked with non-Error: ' + err)); + done(); + }); + } catch (err) { + done(err); + } + return; + } - // sync or promise-returning - try { - if (this.pending) { - done(); - } else { - callFn(this.fn); - } - } catch (err) { - done(err); - } + if (this.asyncOnly) { + return done(new Error('--async-only option in use without declaring `done()`')); + } - function callFn(fn) { - var result = fn.call(ctx); - if (result && typeof result.then === 'function') { - self.resetTimeout(); - result.then(function(){ done() }, done); - } else { - done(); - } - } -}; + // sync or promise-returning + try { + if (this.pending) { + done(); + } else { + callFn(this.fn); + } + } catch (err) { + done(err); + } -}); // module: runnable.js + function callFn(fn) { + const result = fn.call(ctx); + if (result && typeof result.then === 'function') { + self.resetTimeout(); + result.then(function() { + done(); + }, done); + } else { + done(); + } + } + }; + }); // module: runnable.js -require.register("runner.js", function(module, exports, require){ -/** + require.register('runner.js', function(module, exports, require) { + /** * Module dependencies. */ -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:runner') - , Test = require('./test') - , utils = require('./utils') - , filter = utils.filter - , keys = utils.keys; + const EventEmitter = require('browser/events').EventEmitter + ; const debug = require('browser/debug')('mocha:runner') + ; const Test = require('./test') + ; const utils = require('./utils') + ; const filter = utils.filter + ; const keys = utils.keys; -/** + /** * Non-enumerable globals. */ -var globals = [ - 'setTimeout', - 'clearTimeout', - 'setInterval', - 'clearInterval', - 'XMLHttpRequest', - 'Date' -]; + const globals = [ + 'setTimeout', + 'clearTimeout', + 'setInterval', + 'clearInterval', + 'XMLHttpRequest', + 'Date', + ]; -/** + /** * Expose `Runner`. */ -module.exports = Runner; + module.exports = Runner; -/** + /** * Initialize a `Runner` for the given `suite`. * * Events: @@ -4398,39 +4360,43 @@ module.exports = Runner; * @api public */ -function Runner(suite) { - var self = this; - this._globals = []; - this._abort = false; - this.suite = suite; - 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.grep(/.*/); - this.globals(this.globalProps().concat(extraGlobals())); -} - -/** + function Runner(suite) { + const self = this; + this._globals = []; + this._abort = false; + this.suite = suite; + 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.grep(/.*/); + 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; + Runner.immediately = global.setImmediate || process.nextTick; -/** + /** * Inherit from `EventEmitter.prototype`. */ -function F(){}; -F.prototype = EventEmitter.prototype; -Runner.prototype = new F; -Runner.prototype.constructor = Runner; + function F() {}; + F.prototype = EventEmitter.prototype; + Runner.prototype = new F; + Runner.prototype.constructor = Runner; -/** + /** * Run tests with full titles matching `re`. Updates runner.total * with number of tests matched. * @@ -4440,15 +4406,15 @@ Runner.prototype.constructor = Runner; * @api public */ -Runner.prototype.grep = function(re, invert){ - debug('grep %s', re); - this._grep = re; - this._invert = invert; - this.total = this.grepTotal(this.suite); - return this; -}; + 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. * @@ -4457,39 +4423,39 @@ Runner.prototype.grep = function(re, invert){ * @api public */ -Runner.prototype.grepTotal = function(suite) { - var self = this; - var total = 0; + Runner.prototype.grepTotal = function(suite) { + const self = this; + let total = 0; - suite.eachTest(function(test){ - var match = self._grep.test(test.fullTitle()); - if (self._invert) match = !match; - if (match) total++; - }); + suite.eachTest(function(test) { + let match = self._grep.test(test.fullTitle()); + if (self._invert) match = !match; + if (match) total++; + }); - return total; -}; + return total; + }; -/** + /** * Return a list of global properties. * * @return {Array} * @api private */ -Runner.prototype.globalProps = function() { - var props = utils.keys(global); + Runner.prototype.globalProps = function() { + const props = utils.keys(global); - // non-enumerables - for (var i = 0; i < globals.length; ++i) { - if (~utils.indexOf(props, globals[i])) continue; - props.push(globals[i]); - } + // non-enumerables + for (let i = 0; i < globals.length; ++i) { + if (~utils.indexOf(props, globals[i])) continue; + props.push(globals[i]); + } - return props; -}; + return props; + }; -/** + /** * Allow the given `arr` of globals. * * @param {Array} arr @@ -4497,45 +4463,45 @@ Runner.prototype.globalProps = function() { * @api public */ -Runner.prototype.globals = function(arr){ - if (0 == arguments.length) return this._globals; - debug('globals %j', arr); - this._globals = this._globals.concat(arr); - return this; -}; + Runner.prototype.globals = function(arr) { + if (0 == 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; + Runner.prototype.checkGlobals = function(test) { + if (this.ignoreLeaks) return; + let ok = this._globals; - var globals = this.globalProps(); - var isNode = process.kill; - var leaks; + const globals = this.globalProps(); + const isNode = process.kill; + let leaks; - if (test) { - ok = ok.concat(test._allowedGlobals || []); - } + if (test) { + ok = ok.concat(test._allowedGlobals || []); + } - if(this.prevGlobalsLength == globals.length) return; - this.prevGlobalsLength = globals.length; + if (this.prevGlobalsLength == globals.length) return; + this.prevGlobalsLength = globals.length; - leaks = filterLeaks(ok, globals); - this._globals = this._globals.concat(leaks); + 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])); - } -}; + 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`. * * @param {Test} test @@ -4543,18 +4509,18 @@ Runner.prototype.checkGlobals = function(test){ * @api private */ -Runner.prototype.fail = function(test, err){ - ++this.failures; - test.state = 'failed'; + Runner.prototype.fail = function(test, err) { + ++this.failures; + test.state = 'failed'; - if ('string' == typeof err) { - err = new Error('the string "' + err + '" was thrown, throw an Error :)'); - } + if ('string' == typeof err) { + err = new Error('the string "' + err + '" was thrown, throw an Error :)'); + } - this.emit('fail', test, err); -}; + this.emit('fail', test, err); + }; -/** + /** * Fail the given `hook` with `err`. * * Hook failures work in the following pattern: @@ -4575,14 +4541,14 @@ Runner.prototype.fail = function(test, err){ * @api private */ -Runner.prototype.failHook = function(hook, err){ - this.fail(hook, err); - if (this.suite.bail()) { - this.emit('end'); - } -}; + Runner.prototype.failHook = function(hook, err) { + this.fail(hook, err); + if (this.suite.bail()) { + this.emit('end'); + } + }; -/** + /** * Run hook `name` callbacks and then invoke `fn()`. * * @param {String} name @@ -4590,48 +4556,48 @@ Runner.prototype.failHook = function(hook, err){ * @api private */ -Runner.prototype.hook = function(name, fn){ - var suite = this.suite - , hooks = suite['_' + name] - , self = this - , timer; + Runner.prototype.hook = function(name, fn) { + const suite = this.suite + ; const hooks = suite['_' + name] + ; const self = this + ; let timer; - function next(i) { - var hook = hooks[i]; - if (!hook) return fn(); - if (self.failures && suite.bail()) return fn(); - self.currentRunnable = hook; + function next(i) { + const hook = hooks[i]; + if (!hook) return fn(); + if (self.failures && suite.bail()) return fn(); + self.currentRunnable = hook; - hook.ctx.currentTest = self.test; + hook.ctx.currentTest = self.test; - self.emit('hook', hook); + self.emit('hook', hook); - hook.on('error', function(err){ - self.failHook(hook, err); - }); + hook.on('error', function(err) { + self.failHook(hook, err); + }); - hook.run(function(err){ - hook.removeAllListeners('error'); - var testError = hook.error(); - if (testError) self.fail(self.test, testError); - if (err) { - self.failHook(hook, err); + hook.run(function(err) { + hook.removeAllListeners('error'); + const testError = hook.error(); + if (testError) self.fail(self.test, testError); + if (err) { + self.failHook(hook, err); - // stop executing hooks, notify callee of hook err - return fn(err); + // stop executing hooks, notify callee of hook err + return fn(err); + } + self.emit('hook end', hook); + delete hook.ctx.currentTest; + next(++i); + }); } - self.emit('hook end', hook); - delete hook.ctx.currentTest; - next(++i); - }); - } - Runner.immediately(function(){ - next(0); - }); -}; + Runner.immediately(function() { + next(0); + }); + }; -/** + /** * Run hook `name` for the given array of `suites` * in order, and callback `fn(err, errSuite)`. * @@ -4641,33 +4607,33 @@ Runner.prototype.hook = function(name, fn){ * @api private */ -Runner.prototype.hooks = function(name, suites, fn){ - var self = this - , orig = this.suite; + Runner.prototype.hooks = function(name, suites, fn) { + const self = this + ; const orig = this.suite; - function next(suite) { - self.suite = suite; + function next(suite) { + self.suite = suite; - if (!suite) { - self.suite = orig; - return fn(); - } + if (!suite) { + self.suite = orig; + return fn(); + } + + self.hook(name, function(err) { + if (err) { + const errSuite = self.suite; + self.suite = orig; + return fn(err, errSuite); + } - self.hook(name, function(err){ - if (err) { - var errSuite = self.suite; - self.suite = orig; - return fn(err, errSuite); + next(suites.pop()); + }); } next(suites.pop()); - }); - } - - next(suites.pop()); -}; + }; -/** + /** * Run hooks from the top level down. * * @param {String} name @@ -4675,12 +4641,12 @@ Runner.prototype.hooks = function(name, suites, fn){ * @api private */ -Runner.prototype.hookUp = function(name, fn){ - var suites = [this.suite].concat(this.parents()).reverse(); - this.hooks(name, suites, fn); -}; + Runner.prototype.hookUp = function(name, fn) { + const suites = [this.suite].concat(this.parents()).reverse(); + this.hooks(name, suites, fn); + }; -/** + /** * Run hooks from the bottom up. * * @param {String} name @@ -4688,12 +4654,12 @@ Runner.prototype.hookUp = function(name, fn){ * @api private */ -Runner.prototype.hookDown = function(name, fn){ - var suites = [this.suite].concat(this.parents()); - this.hooks(name, suites, fn); -}; + Runner.prototype.hookDown = function(name, fn) { + const suites = [this.suite].concat(this.parents()); + this.hooks(name, suites, fn); + }; -/** + /** * Return an array of parent Suites from * closest to furthest. * @@ -4701,37 +4667,37 @@ Runner.prototype.hookDown = function(name, fn){ * @api private */ -Runner.prototype.parents = function(){ - var suite = this.suite - , suites = []; - while (suite = suite.parent) suites.push(suite); - return suites; -}; + Runner.prototype.parents = function() { + let suite = this.suite + ; const suites = []; + while (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 test = this.test - , self = this; + Runner.prototype.runTest = function(fn) { + const test = this.test + ; const self = this; - if (this.asyncOnly) test.asyncOnly = true; + if (this.asyncOnly) test.asyncOnly = true; - try { - test.on('error', function(err){ - self.fail(test, err); - }); - test.run(fn); - } catch (err) { - fn(err); - } -}; + 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. * @@ -4740,91 +4706,90 @@ Runner.prototype.runTest = function(fn){ * @api private */ -Runner.prototype.runTests = function(suite, fn){ - var self = this - , tests = suite.tests.slice() - , test; - + Runner.prototype.runTests = function(suite, fn) { + const self = this + ; const tests = suite.tests.slice() + ; let test; - function hookErr(err, 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; + function hookErr(err, errSuite, after) { + // before/after Each hook for errSuite failed: + const orig = self.suite; - 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); - } - } + // for failed 'after each' hook start from errSuite parent, + // otherwise start from errSuite itself + self.suite = after ? errSuite.parent : errSuite; - function next(err, errSuite) { - // if we bail after first err - if (self.failures && suite._bail) return fn(); + 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); + } + } - if (self._abort) return fn(); + function next(err, errSuite) { + // if we bail after first err + if (self.failures && suite._bail) return fn(); - if (err) return hookErr(err, errSuite, true); + if (self._abort) return fn(); - // next test - test = tests.shift(); + if (err) return hookErr(err, errSuite, true); - // all done - if (!test) return fn(); + // next test + test = tests.shift(); - // grep - var match = self._grep.test(test.fullTitle()); - if (self._invert) match = !match; - if (!match) return next(); + // all done + if (!test) return fn(); - // pending - if (test.pending) { - self.emit('pending', test); - self.emit('test end', test); - return next(); - } + // grep + let match = self._grep.test(test.fullTitle()); + if (self._invert) match = !match; + if (!match) return next(); - // execute test and hook(s) - self.emit('test', self.test = test); - self.hookDown('beforeEach', function(err, errSuite){ + // pending + if (test.pending) { + self.emit('pending', test); + self.emit('test end', test); + return next(); + } - if (err) return hookErr(err, errSuite, false); + // execute test and hook(s) + self.emit('test', self.test = test); + self.hookDown('beforeEach', function(err, errSuite) { + if (err) return hookErr(err, errSuite, false); - self.currentRunnable = self.test; - self.runTest(function(err){ - test = self.test; + self.currentRunnable = self.test; + self.runTest(function(err) { + test = self.test; - if (err) { - self.fail(test, err); - self.emit('test end', test); - return self.hookUp('afterEach', next); - } + if (err) { + self.fail(test, err); + self.emit('test end', test); + return self.hookUp('afterEach', next); + } - test.state = 'passed'; - self.emit('pass', test); - self.emit('test end', test); - self.hookUp('afterEach', next); - }); - }); - } + test.state = 'passed'; + self.emit('pass', test); + self.emit('test end', test); + self.hookUp('afterEach', next); + }); + }); + } - this.next = next; - next(); -}; + this.next = next; + next(); + }; -/** + /** * Run the given `suite` and invoke the * callback `fn()` when complete. * @@ -4833,79 +4798,79 @@ Runner.prototype.runTests = function(suite, fn){ * @api private */ -Runner.prototype.runSuite = function(suite, fn){ - var total = this.grepTotal(suite) - , self = this - , i = 0; + Runner.prototype.runSuite = function(suite, fn) { + const total = this.grepTotal(suite) + ; const self = this + ; let i = 0; - debug('run suite %s', suite.fullTitle()); + debug('run suite %s', suite.fullTitle()); - if (!total) return fn(); + if (!total) return fn(); - this.emit('suite', this.suite = suite); + 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(); - } else { - // errSuite is among the parents of current suite - // stop execution of errSuite and all sub-suites - return done(errSuite); - } - } + 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(); + } else { + // errSuite is among the parents of current suite + // stop execution of errSuite and all sub-suites + return done(errSuite); + } + } - if (self._abort) return done(); + if (self._abort) return done(); - var curr = suite.suites[i++]; - if (!curr) return done(); - self.runSuite(curr, next); - } + const curr = suite.suites[i++]; + if (!curr) return done(); + self.runSuite(curr, next); + } - function done(errSuite) { - self.suite = suite; - self.hook('afterAll', function(){ - self.emit('suite end', suite); - fn(errSuite); - }); - } + function done(errSuite) { + self.suite = suite; + self.hook('afterAll', function() { + self.emit('suite end', suite); + fn(errSuite); + }); + } - this.hook('beforeAll', function(err){ - if (err) return done(); - self.runTests(suite, 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){ - debug('uncaught exception %s', err.message); - var runnable = this.currentRunnable; - if (!runnable || 'failed' == runnable.state) return; - runnable.clearTimeout(); - err.uncaught = true; - this.fail(runnable, err); + Runner.prototype.uncaught = function(err) { + debug('uncaught exception %s', err.message); + const runnable = this.currentRunnable; + if (!runnable || 'failed' == runnable.state) return; + runnable.clearTimeout(); + err.uncaught = true; + this.fail(runnable, err); - // recover from test - if ('test' == runnable.type) { - this.emit('test end', runnable); - this.hookUp('afterEach', this.next); - return; - } + // recover from test + if ('test' == runnable.type) { + this.emit('test end', runnable); + this.hookUp('afterEach', this.next); + return; + } - // bail on hooks - this.emit('end'); -}; + // bail on hooks + this.emit('end'); + }; -/** + /** * Run the root suite and invoke `fn(failures)` * on completion. * @@ -4914,48 +4879,48 @@ Runner.prototype.uncaught = function(err){ * @api public */ -Runner.prototype.run = function(fn){ - var self = this - , fn = fn || function(){}; + Runner.prototype.run = function(fn) { + const self = this + ; var fn = fn || function() {}; - function uncaught(err){ - self.uncaught(err); - } + function uncaught(err) { + self.uncaught(err); + } - debug('start'); + debug('start'); - // callback - this.on('end', function(){ - debug('end'); - process.removeListener('uncaughtException', uncaught); - fn(self.failures); - }); + // callback + this.on('end', function() { + debug('end'); + process.removeListener('uncaughtException', uncaught); + fn(self.failures); + }); - // run suites - this.emit('start'); - this.runSuite(this.suite, function(){ - debug('finished running'); - self.emit('end'); - }); + // run suites + this.emit('start'); + this.runSuite(this.suite, function() { + debug('finished running'); + self.emit('end'); + }); - // uncaught exception - process.on('uncaughtException', uncaught); + // uncaught exception + process.on('uncaughtException', uncaught); - return this; -}; + return this; + }; -/** + /** * Cleanly abort execution * * @return {Runner} for chaining * @api public */ -Runner.prototype.abort = function(){ - debug('aborting'); - this._abort = true; -} + Runner.prototype.abort = function() { + debug('aborting'); + this._abort = true; + }; -/** + /** * Filter leaks with the given globals flagged as `ok`. * * @param {Array} ok @@ -4964,77 +4929,74 @@ Runner.prototype.abort = function(){ * @api private */ -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; + 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; + // 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; + // 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; + // 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 0 == key.indexOf(ok.split('*')[0]); - return key == ok; - }); - return matched.length == 0 && (!global.navigator || 'onerror' !== key); - }); -} + const matched = filter(ok, function(ok) { + if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]); + return key == ok; + }); + return matched.length == 0 && (!global.navigator || 'onerror' !== key); + }); + } -/** + /** * Array of globals dependent on the environment. * * @return {Array} * @api private */ - function extraGlobals() { - if (typeof(process) === 'object' && + function extraGlobals() { + if (typeof(process) === 'object' && typeof(process.version) === 'string') { + const nodeVersion = process.version.split('.').reduce(function(a, v) { + return a << 8 | v; + }); - var nodeVersion = process.version.split('.').reduce(function(a, v) { - return a << 8 | v; - }); + // 'errno' was renamed to process._errno in v0.9.11. - // 'errno' was renamed to process._errno in v0.9.11. + if (nodeVersion < 0x00090B) { + return ['errno']; + } + } - if (nodeVersion < 0x00090B) { - return ['errno']; + return []; } - } - - return []; - } - -}); // module: runner.js + }); // module: runner.js -require.register("suite.js", function(module, exports, require){ - -/** + require.register('suite.js', function(module, exports, require) { + /** * Module dependencies. */ -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:suite') - , milliseconds = require('./ms') - , utils = require('./utils') - , Hook = require('./hook'); + const EventEmitter = require('browser/events').EventEmitter + ; const debug = require('browser/debug')('mocha:suite') + ; const milliseconds = require('./ms') + ; const utils = require('./utils') + ; const Hook = require('./hook'); -/** + /** * Expose `Suite`. */ -exports = module.exports = 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 @@ -5047,16 +5009,16 @@ exports = module.exports = Suite; * @api public */ -exports.create = function(parent, title){ - var suite = new Suite(title, parent.ctx); - suite.parent = parent; - if (parent.pending) suite.pending = true; - title = suite.fullTitle(); - parent.addSuite(suite); - return suite; -}; + exports.create = function(parent, title) { + const suite = new Suite(title, parent.ctx); + suite.parent = parent; + if (parent.pending) suite.pending = true; + title = suite.fullTitle(); + parent.addSuite(suite); + return suite; + }; -/** + /** * Initialize a new `Suite` with the given * `title` and `ctx`. * @@ -5065,52 +5027,52 @@ exports.create = function(parent, title){ * @api private */ -function Suite(title, parentContext) { - this.title = title; - var context = function () {}; - 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._slow = 75; - this._bail = false; -} - -/** + function Suite(title, parentContext) { + this.title = title; + const context = function() {}; + 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._slow = 75; + this._bail = false; + } + + /** * Inherit from `EventEmitter.prototype`. */ -function F(){}; -F.prototype = EventEmitter.prototype; -Suite.prototype = new F; -Suite.prototype.constructor = Suite; + function F() {}; + F.prototype = EventEmitter.prototype; + Suite.prototype = new F; + Suite.prototype.constructor = Suite; -/** + /** * Return a clone of this `Suite`. * * @return {Suite} * @api private */ -Suite.prototype.clone = function(){ - var suite = new Suite(this.title); - debug('clone'); - suite.ctx = this.ctx; - suite.timeout(this.timeout()); - suite.slow(this.slow()); - suite.bail(this.bail()); - return suite; -}; + Suite.prototype.clone = function() { + const suite = new Suite(this.title); + debug('clone'); + suite.ctx = this.ctx; + suite.timeout(this.timeout()); + suite.slow(this.slow()); + suite.bail(this.bail()); + return suite; + }; -/** + /** * Set timeout `ms` or short-hand such as "2s". * * @param {Number|String} ms @@ -5118,15 +5080,15 @@ Suite.prototype.clone = function(){ * @api private */ -Suite.prototype.timeout = function(ms){ - if (0 == arguments.length) return this._timeout; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('timeout %d', ms); - this._timeout = parseInt(ms, 10); - return this; -}; + Suite.prototype.timeout = function(ms) { + if (0 == arguments.length) return this._timeout; + if ('string' == typeof ms) ms = milliseconds(ms); + debug('timeout %d', ms); + this._timeout = parseInt(ms, 10); + return this; + }; -/** + /** * Set slow `ms` or short-hand such as "2s". * * @param {Number|String} ms @@ -5134,15 +5096,15 @@ Suite.prototype.timeout = function(ms){ * @api private */ -Suite.prototype.slow = function(ms){ - if (0 === arguments.length) return this._slow; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('slow %d', ms); - this._slow = ms; - return this; -}; + Suite.prototype.slow = function(ms) { + if (0 === arguments.length) return this._slow; + if ('string' == typeof ms) ms = milliseconds(ms); + debug('slow %d', ms); + this._slow = ms; + return this; + }; -/** + /** * Sets whether to bail after first error. * * @parma {Boolean} bail @@ -5150,14 +5112,14 @@ Suite.prototype.slow = function(ms){ * @api private */ -Suite.prototype.bail = function(bail){ - if (0 == arguments.length) return this._bail; - debug('bail %s', bail); - this._bail = bail; - return this; -}; + Suite.prototype.bail = function(bail) { + if (0 == arguments.length) return this._bail; + debug('bail %s', bail); + this._bail = bail; + return this; + }; -/** + /** * Run `fn(test[, done])` before running tests. * * @param {Function} fn @@ -5165,25 +5127,25 @@ Suite.prototype.bail = function(bail){ * @api private */ -Suite.prototype.beforeAll = function(title, fn){ - if (this.pending) return this; - if ('function' === typeof title) { - 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.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeAll.push(hook); - this.emit('beforeAll', hook); - return this; -}; - -/** + Suite.prototype.beforeAll = function(title, fn) { + if (this.pending) return this; + if ('function' === typeof title) { + fn = title; + title = fn.name; + } + title = '"before all" hook' + (title ? ': ' + title : ''); + + const hook = new Hook(title, fn); + hook.parent = this; + hook.timeout(this.timeout()); + 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. * * @param {Function} fn @@ -5191,25 +5153,25 @@ Suite.prototype.beforeAll = function(title, fn){ * @api private */ -Suite.prototype.afterAll = function(title, fn){ - if (this.pending) return this; - if ('function' === typeof title) { - 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.slow(this.slow()); - hook.ctx = this.ctx; - this._afterAll.push(hook); - this.emit('afterAll', hook); - return this; -}; - -/** + Suite.prototype.afterAll = function(title, fn) { + if (this.pending) return this; + if ('function' === typeof title) { + fn = title; + title = fn.name; + } + title = '"after all" hook' + (title ? ': ' + title : ''); + + const hook = new Hook(title, fn); + hook.parent = this; + hook.timeout(this.timeout()); + 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. * * @param {Function} fn @@ -5217,25 +5179,25 @@ Suite.prototype.afterAll = function(title, fn){ * @api private */ -Suite.prototype.beforeEach = function(title, fn){ - if (this.pending) return this; - if ('function' === typeof title) { - 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.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeEach.push(hook); - this.emit('beforeEach', hook); - return this; -}; - -/** + Suite.prototype.beforeEach = function(title, fn) { + if (this.pending) return this; + if ('function' === typeof title) { + fn = title; + title = fn.name; + } + title = '"before each" hook' + (title ? ': ' + title : ''); + + const hook = new Hook(title, fn); + hook.parent = this; + hook.timeout(this.timeout()); + 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. * * @param {Function} fn @@ -5243,25 +5205,25 @@ Suite.prototype.beforeEach = function(title, fn){ * @api private */ -Suite.prototype.afterEach = function(title, fn){ - if (this.pending) return this; - if ('function' === typeof title) { - 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.slow(this.slow()); - hook.ctx = this.ctx; - this._afterEach.push(hook); - this.emit('afterEach', hook); - return this; -}; - -/** + Suite.prototype.afterEach = function(title, fn) { + if (this.pending) return this; + if ('function' === typeof title) { + fn = title; + title = fn.name; + } + title = '"after each" hook' + (title ? ': ' + title : ''); + + const hook = new Hook(title, fn); + hook.parent = this; + hook.timeout(this.timeout()); + hook.slow(this.slow()); + hook.ctx = this.ctx; + this._afterEach.push(hook); + this.emit('afterEach', hook); + return this; + }; + + /** * Add a test `suite`. * * @param {Suite} suite @@ -5269,17 +5231,17 @@ Suite.prototype.afterEach = function(title, fn){ * @api private */ -Suite.prototype.addSuite = function(suite){ - suite.parent = this; - suite.timeout(this.timeout()); - suite.slow(this.slow()); - suite.bail(this.bail()); - this.suites.push(suite); - this.emit('suite', suite); - return this; -}; + Suite.prototype.addSuite = function(suite) { + suite.parent = this; + suite.timeout(this.timeout()); + suite.slow(this.slow()); + suite.bail(this.bail()); + this.suites.push(suite); + this.emit('suite', suite); + return this; + }; -/** + /** * Add a `test` to this suite. * * @param {Test} test @@ -5287,17 +5249,17 @@ Suite.prototype.addSuite = function(suite){ * @api private */ -Suite.prototype.addTest = function(test){ - test.parent = this; - test.timeout(this.timeout()); - test.slow(this.slow()); - test.ctx = this.ctx; - this.tests.push(test); - this.emit('test', test); - return this; -}; + Suite.prototype.addTest = function(test) { + test.parent = this; + test.timeout(this.timeout()); + 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. * @@ -5305,28 +5267,28 @@ Suite.prototype.addTest = function(test){ * @api public */ -Suite.prototype.fullTitle = function(){ - if (this.parent) { - var full = this.parent.fullTitle(); - if (full) return full + ' ' + this.title; - } - return this.title; -}; + Suite.prototype.fullTitle = function() { + if (this.parent) { + const full = this.parent.fullTitle(); + if (full) return full + ' ' + this.title; + } + return this.title; + }; -/** + /** * Return the total number of tests. * * @return {Number} * @api public */ -Suite.prototype.total = function(){ - return utils.reduce(this.suites, function(sum, suite){ - return sum + suite.total(); - }, 0) + this.tests.length; -}; + 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)`. @@ -5336,31 +5298,29 @@ Suite.prototype.total = function(){ * @api private */ -Suite.prototype.eachTest = function(fn){ - utils.forEach(this.tests, fn); - utils.forEach(this.suites, function(suite){ - suite.eachTest(fn); - }); - return this; -}; - -}); // module: suite.js - -require.register("test.js", function(module, exports, require){ + Suite.prototype.eachTest = function(fn) { + utils.forEach(this.tests, fn); + utils.forEach(this.suites, function(suite) { + suite.eachTest(fn); + }); + return this; + }; + }); // module: suite.js -/** + require.register('test.js', function(module, exports, require) { + /** * Module dependencies. */ -var Runnable = require('./runnable'); + const Runnable = require('./runnable'); -/** + /** * Expose `Test`. */ -module.exports = Test; + module.exports = Test; -/** + /** * Initialize a new `Test` with the given `title` and callback `fn`. * * @param {String} title @@ -5368,41 +5328,39 @@ module.exports = Test; * @api private */ -function Test(title, fn) { - Runnable.call(this, title, fn); - this.pending = !fn; - this.type = 'test'; -} + function Test(title, fn) { + Runnable.call(this, title, fn); + this.pending = !fn; + this.type = 'test'; + } -/** + /** * Inherit from `Runnable.prototype`. */ -function F(){}; -F.prototype = Runnable.prototype; -Test.prototype = new F; -Test.prototype.constructor = Test; - + function F() {}; + F.prototype = Runnable.prototype; + Test.prototype = new F; + Test.prototype.constructor = Test; + }); // module: test.js -}); // module: test.js - -require.register("utils.js", function(module, exports, require){ -/** + require.register('utils.js', function(module, exports, require) { + /** * Module dependencies. */ -var fs = require('browser/fs') - , path = require('browser/path') - , join = path.join - , debug = require('browser/debug')('mocha:watch'); + const fs = require('browser/fs') + ; const path = require('browser/path') + ; const join = path.join + ; const debug = require('browser/debug')('mocha:watch'); -/** + /** * Ignored directories. */ -var ignore = ['node_modules', '.git']; + const ignore = ['node_modules', '.git']; -/** + /** * Escape special characters in the given string of html. * * @param {String} html @@ -5410,15 +5368,15 @@ var ignore = ['node_modules', '.git']; * @api private */ -exports.escape = function(html){ - return String(html) - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(//g, '>'); -}; + exports.escape = function(html) { + return String(html) + .replace(/&/g, '&') + .replace(/"/g, '"') + .replace(//g, '>'); + }; -/** + /** * Array#forEach (<=IE8) * * @param {Array} array @@ -5427,12 +5385,13 @@ exports.escape = function(html){ * @api private */ -exports.forEach = function(arr, fn, scope){ - for (var i = 0, l = arr.length; i < l; i++) - fn.call(scope, arr[i], i); -}; + exports.forEach = function(arr, fn, scope) { + for (let i = 0, l = arr.length; i < l; i++) { + fn.call(scope, arr[i], i); + } + }; -/** + /** * Array#map (<=IE8) * * @param {Array} array @@ -5441,14 +5400,15 @@ exports.forEach = function(arr, fn, scope){ * @api private */ -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)); - return result; -}; + exports.map = function(arr, fn, scope) { + const result = []; + for (let i = 0, l = arr.length; i < l; i++) { + result.push(fn.call(scope, arr[i], i)); + } + return result; + }; -/** + /** * Array#indexOf (<=IE8) * * @parma {Array} arr @@ -5457,15 +5417,16 @@ exports.map = function(arr, fn, scope){ * @api private */ -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; -}; + exports.indexOf = function(arr, obj, start) { + for (let i = start || 0, l = arr.length; i < l; i++) { + if (arr[i] === obj) { + return i; + } + } + return -1; + }; -/** + /** * Array#reduce (<=IE8) * * @param {Array} array @@ -5474,17 +5435,17 @@ exports.indexOf = function(arr, obj, start){ * @api private */ -exports.reduce = function(arr, fn, val){ - var rval = val; + exports.reduce = function(arr, fn, val) { + let rval = val; - for (var i = 0, l = arr.length; i < l; i++) { - rval = fn(rval, arr[i], i, arr); - } + for (let i = 0, l = arr.length; i < l; i++) { + rval = fn(rval, arr[i], i, arr); + } - return rval; -}; + return rval; + }; -/** + /** * Array#filter (<=IE8) * * @param {Array} array @@ -5492,18 +5453,18 @@ exports.reduce = function(arr, fn, val){ * @api private */ -exports.filter = function(arr, fn){ - var ret = []; + exports.filter = function(arr, fn) { + const ret = []; - for (var i = 0, l = arr.length; i < l; i++) { - var val = arr[i]; - if (fn(val, i, arr)) ret.push(val); - } + for (let i = 0, l = arr.length; i < l; i++) { + const val = arr[i]; + if (fn(val, i, arr)) ret.push(val); + } - return ret; -}; + return ret; + }; -/** + /** * Object.keys (<=IE8) * * @param {Object} obj @@ -5511,20 +5472,20 @@ exports.filter = function(arr, fn){ * @api private */ -exports.keys = Object.keys || function(obj) { - var keys = [] - , has = Object.prototype.hasOwnProperty // for `window` on <=IE8 + exports.keys = Object.keys || function(obj) { + const keys = [] + ; const has = Object.prototype.hasOwnProperty; // for `window` on <=IE8 - for (var key in obj) { - if (has.call(obj, key)) { - keys.push(key); - } - } + for (const key in obj) { + if (has.call(obj, key)) { + keys.push(key); + } + } - return keys; -}; + return keys; + }; -/** + /** * Watch the given `files` for changes * and invoke `fn(file)` on modification. * @@ -5533,49 +5494,49 @@ exports.keys = Object.keys || function(obj) { * @api private */ -exports.watch = function(files, fn){ - var options = { interval: 100 }; - files.forEach(function(file){ - debug('file %s', file); - fs.watchFile(file, options, function(curr, prev){ - if (prev.mtime < curr.mtime) fn(file); - }); - }); -}; + exports.watch = function(files, fn) { + const options = {interval: 100}; + files.forEach(function(file) { + debug('file %s', file); + fs.watchFile(file, options, function(curr, prev) { + if (prev.mtime < curr.mtime) fn(file); + }); + }); + }; -/** + /** * Ignored files. */ -function ignored(path){ - return !~ignore.indexOf(path); -} + function ignored(path) { + return !~ignore.indexOf(path); + } -/** + /** * Lookup files in the given `dir`. * * @return {Array} * @api private */ -exports.files = function(dir, ret){ - ret = ret || []; + exports.files = function(dir, ret) { + ret = ret || []; - fs.readdirSync(dir) - .filter(ignored) - .forEach(function(path){ - path = join(dir, path); - if (fs.statSync(path).isDirectory()) { - exports.files(path, ret); - } else if (path.match(/\.(js|coffee|litcoffee|coffee.md)$/)) { - ret.push(path); - } - }); + fs.readdirSync(dir) + .filter(ignored) + .forEach(function(path) { + path = join(dir, path); + if (fs.statSync(path).isDirectory()) { + exports.files(path, ret); + } else if (path.match(/\.(js|coffee|litcoffee|coffee.md)$/)) { + ret.push(path); + } + }); - return ret; -}; + return ret; + }; -/** + /** * Compute a slug from the given `str`. * * @param {String} str @@ -5583,34 +5544,34 @@ exports.files = function(dir, ret){ * @api private */ -exports.slug = function(str){ - return str - .toLowerCase() - .replace(/ +/g, '-') - .replace(/[^-\w]/g, ''); -}; + exports.slug = function(str) { + return str + .toLowerCase() + .replace(/ +/g, '-') + .replace(/[^-\w]/g, ''); + }; -/** + /** * Strip the function definition from `str`, * and re-indent for pre whitespace. */ -exports.clean = function(str) { - str = str - .replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, '') - .replace(/^function *\(.*\) *{/, '') - .replace(/\s+\}$/, ''); + exports.clean = function(str) { + str = str + .replace(/\r\n?|[\n\u2028\u2029]/g, '\n').replace(/^\uFEFF/, '') + .replace(/^function *\(.*\) *{/, '') + .replace(/\s+\}$/, ''); - var spaces = str.match(/^\n?( *)/)[1].length - , tabs = str.match(/^\n?(\t*)/)[1].length - , re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm'); + const spaces = str.match(/^\n?( *)/)[1].length + ; const tabs = str.match(/^\n?(\t*)/)[1].length + ; const re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm'); - str = str.replace(re, ''); + str = str.replace(re, ''); - return exports.trim(str); -}; + return exports.trim(str); + }; -/** + /** * Escape regular expression characters in `str`. * * @param {String} str @@ -5618,11 +5579,11 @@ exports.clean = function(str) { * @api private */ -exports.escapeRegexp = function(str){ - return str.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); -}; + exports.escapeRegexp = function(str) { + return str.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); + }; -/** + /** * Trim the given `str`. * * @param {String} str @@ -5630,11 +5591,11 @@ exports.escapeRegexp = function(str){ * @api private */ -exports.trim = function(str){ - return str.replace(/^\s+|\s+$/g, ''); -}; + exports.trim = function(str) { + return str.replace(/^\s+|\s+$/g, ''); + }; -/** + /** * Parse the given `qs`. * * @param {String} qs @@ -5642,18 +5603,18 @@ exports.trim = function(str){ * @api private */ -exports.parseQuery = function(qs){ - return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){ - var i = pair.indexOf('=') - , key = pair.slice(0, i) - , val = pair.slice(++i); + exports.parseQuery = function(qs) { + return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair) { + let i = pair.indexOf('=') + ; const key = pair.slice(0, i) + ; const val = pair.slice(++i); - obj[key] = decodeURIComponent(val); - return obj; - }, {}); -}; + obj[key] = decodeURIComponent(val); + return obj; + }, {}); + }; -/** + /** * Highlight the given string of `js`. * * @param {String} js @@ -5661,47 +5622,48 @@ exports.parseQuery = function(qs){ * @api private */ -function highlight(js) { - return js - .replace(//g, '>') - .replace(/\/\/(.*)/gm, '//$1') - .replace(/('.*?')/gm, '$1') - .replace(/(\d+\.\d+)/gm, '$1') - .replace(/(\d+)/gm, '$1') - .replace(/\bnew *(\w+)/gm, 'new $1') - .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '$1') -} + function highlight(js) { + return js + .replace(//g, '>') + .replace(/\/\/(.*)/gm, '//$1') + .replace(/('.*?')/gm, '$1') + .replace(/(\d+\.\d+)/gm, '$1') + .replace(/(\d+)/gm, '$1') + .replace(/\bnew *(\w+)/gm, 'new $1') + .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '$1'); + } -/** + /** * Highlight the contents of tag `name`. * * @param {String} name * @api private */ -exports.highlightTags = function(name) { - var code = document.getElementsByTagName(name); - for (var i = 0, len = code.length; i < len; ++i) { - code[i].innerHTML = highlight(code[i].innerHTML); - } -}; - -}); // module: utils.js -// The global object is "self" in Web Workers. -global = (function() { return this; })(); + exports.highlightTags = function(name) { + const code = document.getElementsByTagName(name); + for (let i = 0, len = code.length; i < len; ++i) { + code[i].innerHTML = highlight(code[i].innerHTML); + } + }; + }); // module: utils.js + // The global object is "self" in Web Workers. + global = (function() { + return this; + })(); -/** + /** * 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; + const Date = global.Date; + const setTimeout = global.setTimeout; + const setInterval = global.setInterval; + const clearTimeout = global.clearTimeout; + const clearInterval = global.clearInterval; -/** + /** * Node shims. * * These are meant only to allow @@ -5710,133 +5672,135 @@ var clearInterval = global.clearInterval; * the browser. */ -var process = {}; -process.exit = function(status){}; -process.stdout = {}; + var process = {}; + process.exit = function(status) {}; + process.stdout = {}; -var uncaughtExceptionHandlers = []; + const uncaughtExceptionHandlers = []; -/** + /** * Remove uncaughtException listener. */ -process.removeListener = function(e, fn){ - if ('uncaughtException' == e) { - global.onerror = function() {}; - var i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn); - if (i != -1) { uncaughtExceptionHandlers.splice(i, 1); } - } -}; + process.removeListener = function(e, fn) { + if ('uncaughtException' == e) { + global.onerror = function() {}; + const i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn); + if (i != -1) { + uncaughtExceptionHandlers.splice(i, 1); + } + } + }; -/** + /** * Implements uncaughtException listener. */ -process.on = function(e, fn){ - if ('uncaughtException' == e) { - global.onerror = function(err, url, line){ - fn(new Error(err + ' (' + url + ':' + line + ')')); - return true; - }; - uncaughtExceptionHandlers.push(fn); - } -}; + process.on = function(e, fn) { + if ('uncaughtException' == e) { + global.onerror = function(err, url, line) { + fn(new Error(err + ' (' + url + ':' + line + ')')); + return true; + }; + uncaughtExceptionHandlers.push(fn); + } + }; -/** + /** * Expose mocha. */ -var Mocha = global.Mocha = require('mocha'), - mocha = global.mocha = new Mocha({ reporter: 'html' }); + var Mocha = global.Mocha = require('mocha'); + const mocha = global.mocha = new Mocha({reporter: 'html'}); -// 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'); + // 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 = [] - , immediateTimeout; + const immediateQueue = [] + ; let 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; + function timeslice() { + const 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); - } -}; + 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; -}; + 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; -}; + 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 ('string' == typeof opts) opts = { ui: opts }; - for (var opt in opts) this[opt](opts[opt]); - return this; -}; + mocha.setup = function(opts) { + if ('string' == typeof opts) opts = {ui: opts}; + for (const opt in opts) this[opt](opts[opt]); + return this; + }; -/** + /** * Run mocha, returning the Runner. */ -mocha.run = function(fn){ - var options = mocha.options; - mocha.globals('location'); + mocha.run = function(fn) { + const options = mocha.options; + mocha.globals('location'); - var query = Mocha.utils.parseQuery(global.location.search || ''); - if (query.grep) mocha.grep(query.grep); - if (query.invert) mocha.invert(); + const query = Mocha.utils.parseQuery(global.location.search || ''); + if (query.grep) mocha.grep(query.grep); + if (query.invert) mocha.invert(); - return Mocha.prototype.run.call(mocha, function(){ + return Mocha.prototype.run.call(mocha, function() { // The DOM Document is not available in Web Workers. - if (global.document) { - Mocha.utils.highlightTags('code'); - } - if (fn) fn(); - }); -}; + if (global.document) { + Mocha.utils.highlightTags('code'); + } + if (fn) fn(); + }); + }; -/** + /** * Expose the process shim. */ -Mocha.process = process; -})(); \ No newline at end of file + Mocha.process = process; +})(); diff --git a/examples/mocha/spec/tests.js b/examples/mocha/spec/tests.js index 80998a2..140aae3 100644 --- a/examples/mocha/spec/tests.js +++ b/examples/mocha/spec/tests.js @@ -1,5 +1,5 @@ -describe('This spec', function () { - it('should succeed', function () { +describe('This spec', function() { + it('should succeed', function() { expect(5).to.be.a('number'); }); -}); \ No newline at end of file +}); diff --git a/examples/qunit/Gruntfile.js b/examples/qunit/Gruntfile.js index 40a790b..5bafd0d 100644 --- a/examples/qunit/Gruntfile.js +++ b/examples/qunit/Gruntfile.js @@ -1,56 +1,56 @@ -module.exports = function (grunt) { - var browsers = [{ +module.exports = function(grunt) { + const browsers = [{ browserName: 'firefox', version: '19', - platform: 'XP' + platform: 'XP', }, { browserName: 'googlechrome', - platform: 'XP' + platform: 'XP', }, { browserName: 'googlechrome', - platform: 'linux' + platform: 'linux', }, { browserName: 'internet explorer', platform: 'WIN8', - version: '10' + version: '10', }, { browserName: 'internet explorer', platform: 'VISTA', - version: '9' + version: '9', }]; grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - connect: { + 'pkg': grunt.file.readJSON('package.json'), + 'connect': { server: { options: { base: '', - port: 9999 - } - } + port: 9999, + }, + }, }, 'saucelabs-qunit': { all: { options: { urls: [ - 'http://127.0.0.1:9999/index.html' + 'http://127.0.0.1:9999/index.html', ], browsers: browsers, build: process.env.TRAVIS_JOB_ID, testname: 'qunit tests', throttled: 3, sauceConfig: { - 'video-upload-on-pass': false - } - } - } + 'video-upload-on-pass': false, + }, + }, + }, }, - watch: {} + 'watch': {}, }); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-saucelabs'); grunt.registerTask('default', ['connect', 'saucelabs-qunit']); -}; \ No newline at end of file +}; diff --git a/examples/qunit/lib/qunit/qunit.js b/examples/qunit/lib/qunit/qunit.js index 0e279fd..facce34 100644 --- a/examples/qunit/lib/qunit/qunit.js +++ b/examples/qunit/lib/qunit/qunit.js @@ -1,4 +1,4 @@ -/*! +/* ! * QUnit 1.14.0 * http://qunitjs.com/ * @@ -10,34 +10,33 @@ */ (function( window ) { - -var QUnit, - assert, - config, - onErrorFnPrev, - testId = 0, - fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""), - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - // Keep a local reference to Date (GH-283) - Date = window.Date, - setTimeout = window.setTimeout, - clearTimeout = window.clearTimeout, - defined = { - document: typeof window.document !== "undefined", - setTimeout: typeof window.setTimeout !== "undefined", - sessionStorage: (function() { - var x = "qunit-test-string"; - try { - sessionStorage.setItem( x, x ); - sessionStorage.removeItem( x ); - return true; - } catch( e ) { - return false; - } - }()) - }, - /** + let QUnit; + let assert; + let config; + let onErrorFnPrev; + let testId = 0; + const fileName = (sourceFromStacktrace( 0 ) || '' ).replace(/(:\d+)+\)?/, '').replace(/.+\//, ''); + const toString = Object.prototype.toString; + const hasOwn = Object.prototype.hasOwnProperty; + // Keep a local reference to Date (GH-283) + const Date = window.Date; + const setTimeout = window.setTimeout; + const clearTimeout = window.clearTimeout; + const defined = { + document: typeof window.document !== 'undefined', + setTimeout: typeof window.setTimeout !== 'undefined', + sessionStorage: (function() { + const x = 'qunit-test-string'; + try { + sessionStorage.setItem( x, x ); + sessionStorage.removeItem( x ); + return true; + } catch ( e ) { + return false; + } + }()), + }; + /** * Provides a normalized error string, correcting an issue * with IE 7 (and prior) where Error.prototype.toString is * not properly implemented @@ -47,1703 +46,1695 @@ var QUnit, * @param {String|Error} error * @return {String} error message */ - errorString = function( error ) { - var name, message, - errorString = error.toString(); - if ( errorString.substring( 0, 7 ) === "[object" ) { - name = error.name ? error.name.toString() : "Error"; - message = error.message ? error.message.toString() : ""; - if ( name && message ) { - return name + ": " + message; - } else if ( name ) { - return name; - } else if ( message ) { - return message; - } else { - return "Error"; - } - } else { - return errorString; - } - }, - /** + const errorString = function( error ) { + let name; let message; + const errorString = error.toString(); + if ( errorString.substring( 0, 7 ) === '[object' ) { + name = error.name ? error.name.toString() : 'Error'; + message = error.message ? error.message.toString() : ''; + if ( name && message ) { + return name + ': ' + message; + } else if ( name ) { + return name; + } else if ( message ) { + return message; + } else { + return 'Error'; + } + } else { + return errorString; + } + }; + /** * Makes a clone of an object using only Array or Object as base, * and copies over the own enumerable properties. * * @param {Object} obj * @return {Object} New object with only the own properties (recursively). */ - objectValues = function( obj ) { - // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392. - /*jshint newcap: false */ - var key, val, - vals = QUnit.is( "array", obj ) ? [] : {}; - for ( key in obj ) { - if ( hasOwn.call( obj, key ) ) { - val = obj[key]; - vals[key] = val === Object(val) ? objectValues(val) : val; - } - } - return vals; - }; - - -// Root QUnit object. -// `QUnit` initialized at top of scope -QUnit = { - - // call on start of module test to prepend name to all tests - module: function( name, testEnvironment ) { - config.currentModule = name; - config.currentModuleTestEnvironment = testEnvironment; - config.modules[name] = true; - }, - - asyncTest: function( testName, expected, callback ) { - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - QUnit.test( testName, expected, callback, true ); - }, - - test: function( testName, expected, callback, async ) { - var test, - nameHtml = "" + escapeText( testName ) + ""; - - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - if ( config.currentModule ) { - nameHtml = "" + escapeText( config.currentModule ) + ": " + nameHtml; - } - - test = new Test({ - nameHtml: nameHtml, - testName: testName, - expected: expected, - async: async, - callback: callback, - module: config.currentModule, - moduleTestEnvironment: config.currentModuleTestEnvironment, - stack: sourceFromStacktrace( 2 ) - }); - - if ( !validTest( test ) ) { - return; - } - - test.queue(); - }, - - // Specify the number of expected assertions to guarantee that failed test (no assertions are run at all) don't slip through. - expect: function( asserts ) { - if (arguments.length === 1) { - config.current.expected = asserts; - } else { - return config.current.expected; - } - }, - - start: function( count ) { - // QUnit hasn't been initialized yet. - // Note: RequireJS (et al) may delay onLoad - if ( config.semaphore === undefined ) { - QUnit.begin(function() { - // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first - setTimeout(function() { - QUnit.start( count ); - }); - }); - return; - } - - config.semaphore -= count || 1; - // don't start until equal number of stop-calls - if ( config.semaphore > 0 ) { - return; - } - // ignore if start is called more often then stop - if ( config.semaphore < 0 ) { - config.semaphore = 0; - QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)", null, sourceFromStacktrace(2) ); - return; - } - // A slight delay, to avoid any current callbacks - if ( defined.setTimeout ) { - setTimeout(function() { - if ( config.semaphore > 0 ) { - return; - } - if ( config.timeout ) { - clearTimeout( config.timeout ); - } - - config.blocking = false; - process( true ); - }, 13); - } else { - config.blocking = false; - process( true ); - } - }, - - stop: function( count ) { - config.semaphore += count || 1; - config.blocking = true; - - if ( config.testTimeout && defined.setTimeout ) { - clearTimeout( config.timeout ); - config.timeout = setTimeout(function() { - QUnit.ok( false, "Test timed out" ); - config.semaphore = 1; - QUnit.start(); - }, config.testTimeout ); - } - } -}; - -// We use the prototype to distinguish between properties that should -// be exposed as globals (and in exports) and those that shouldn't -(function() { - function F() {} - F.prototype = QUnit; - QUnit = new F(); - // Make F QUnit's constructor so that we can add to the prototype later - QUnit.constructor = F; -}()); - -/** + var objectValues = function( obj ) { + // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392. + /* jshint newcap: false */ + let key; let val; + const vals = QUnit.is( 'array', obj ) ? [] : {}; + for ( key in obj ) { + if ( hasOwn.call( obj, key ) ) { + val = obj[key]; + vals[key] = val === Object(val) ? objectValues(val) : val; + } + } + return vals; + }; + + + // Root QUnit object. + // `QUnit` initialized at top of scope + QUnit = { + + // call on start of module test to prepend name to all tests + module: function( name, testEnvironment ) { + config.currentModule = name; + config.currentModuleTestEnvironment = testEnvironment; + config.modules[name] = true; + }, + + asyncTest: function( testName, expected, callback ) { + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + QUnit.test( testName, expected, callback, true ); + }, + + test: function( testName, expected, callback, async ) { + let test; + let nameHtml = '' + escapeText( testName ) + ''; + + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + if ( config.currentModule ) { + nameHtml = '' + escapeText( config.currentModule ) + ': ' + nameHtml; + } + + test = new Test({ + nameHtml: nameHtml, + testName: testName, + expected: expected, + async: async, + callback: callback, + module: config.currentModule, + moduleTestEnvironment: config.currentModuleTestEnvironment, + stack: sourceFromStacktrace( 2 ), + }); + + if ( !validTest( test ) ) { + return; + } + + test.queue(); + }, + + // Specify the number of expected assertions to guarantee that failed test (no assertions are run at all) don't slip through. + expect: function( asserts ) { + if (arguments.length === 1) { + config.current.expected = asserts; + } else { + return config.current.expected; + } + }, + + start: function( count ) { + // QUnit hasn't been initialized yet. + // Note: RequireJS (et al) may delay onLoad + if ( config.semaphore === undefined ) { + QUnit.begin(function() { + // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first + setTimeout(function() { + QUnit.start( count ); + }); + }); + return; + } + + config.semaphore -= count || 1; + // don't start until equal number of stop-calls + if ( config.semaphore > 0 ) { + return; + } + // ignore if start is called more often then stop + if ( config.semaphore < 0 ) { + config.semaphore = 0; + QUnit.pushFailure( 'Called start() while already started (QUnit.config.semaphore was 0 already)', null, sourceFromStacktrace(2) ); + return; + } + // A slight delay, to avoid any current callbacks + if ( defined.setTimeout ) { + setTimeout(function() { + if ( config.semaphore > 0 ) { + return; + } + if ( config.timeout ) { + clearTimeout( config.timeout ); + } + + config.blocking = false; + process( true ); + }, 13); + } else { + config.blocking = false; + process( true ); + } + }, + + stop: function( count ) { + config.semaphore += count || 1; + config.blocking = true; + + if ( config.testTimeout && defined.setTimeout ) { + clearTimeout( config.timeout ); + config.timeout = setTimeout(function() { + QUnit.ok( false, 'Test timed out' ); + config.semaphore = 1; + QUnit.start(); + }, config.testTimeout ); + } + }, + }; + + // We use the prototype to distinguish between properties that should + // be exposed as globals (and in exports) and those that shouldn't + (function() { + function F() {} + F.prototype = QUnit; + QUnit = new F(); + // Make F QUnit's constructor so that we can add to the prototype later + QUnit.constructor = F; + }()); + + /** * Config object: Maintain internal state * Later exposed as QUnit.config * `config` initialized at top of scope */ -config = { - // The queue of tests to run - queue: [], - - // block until document ready - blocking: true, - - // when enabled, show only failing tests - // gets persisted through sessionStorage and can be changed in UI via checkbox - hidepassed: false, - - // by default, run previously failed tests first - // very useful in combination with "Hide passed tests" checked - reorder: true, - - // by default, modify document.title when suite is done - altertitle: true, - - // by default, scroll to top of the page when suite is done - scrolltop: true, - - // when enabled, all tests must call expect() - requireExpects: false, - - // add checkboxes that are persisted in the query-string - // when enabled, the id is set to `true` as a `QUnit.config` property - urlConfig: [ - { - id: "noglobals", - label: "Check for Globals", - tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings." - }, - { - id: "notrycatch", - label: "No try-catch", - tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings." - } - ], - - // Set of all modules. - modules: {}, - - // logging callback queues - begin: [], - done: [], - log: [], - testStart: [], - testDone: [], - moduleStart: [], - moduleDone: [] -}; - -// Initialize more QUnit.config and QUnit.urlParams -(function() { - var i, current, - location = window.location || { search: "", protocol: "file:" }, - params = location.search.slice( 1 ).split( "&" ), - length = params.length, - urlParams = {}; - - if ( params[ 0 ] ) { - for ( i = 0; i < length; i++ ) { - current = params[ i ].split( "=" ); - current[ 0 ] = decodeURIComponent( current[ 0 ] ); - - // allow just a key to turn on a flag, e.g., test.html?noglobals - current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; - if ( urlParams[ current[ 0 ] ] ) { - urlParams[ current[ 0 ] ] = [].concat( urlParams[ current[ 0 ] ], current[ 1 ] ); - } else { - urlParams[ current[ 0 ] ] = current[ 1 ]; - } - } - } - - QUnit.urlParams = urlParams; - - // String search anywhere in moduleName+testName - config.filter = urlParams.filter; - - // Exact match of the module name - config.module = urlParams.module; - - config.testNumber = []; - if ( urlParams.testNumber ) { - - // Ensure that urlParams.testNumber is an array - urlParams.testNumber = [].concat( urlParams.testNumber ); - for ( i = 0; i < urlParams.testNumber.length; i++ ) { - current = urlParams.testNumber[ i ]; - config.testNumber.push( parseInt( current, 10 ) ); - } - } - - // Figure out if we're running the tests from a server or not - QUnit.isLocal = location.protocol === "file:"; -}()); - -extend( QUnit, { - - config: config, - - // Initialize the configuration options - init: function() { - extend( config, { - stats: { all: 0, bad: 0 }, - moduleStats: { all: 0, bad: 0 }, - started: +new Date(), - updateRate: 1000, - blocking: false, - autostart: true, - autorun: false, - filter: "", - queue: [], - semaphore: 1 - }); - - var tests, banner, result, - qunit = id( "qunit" ); - - if ( qunit ) { - qunit.innerHTML = - "

      " + escapeText( document.title ) + "

      " + - "

      " + - "
      " + - "

      " + - "
        "; - } - - tests = id( "qunit-tests" ); - banner = id( "qunit-banner" ); - result = id( "qunit-testresult" ); - - if ( tests ) { - tests.innerHTML = ""; - } - - if ( banner ) { - banner.className = ""; - } - - if ( result ) { - result.parentNode.removeChild( result ); - } - - if ( tests ) { - result = document.createElement( "p" ); - result.id = "qunit-testresult"; - result.className = "result"; - tests.parentNode.insertBefore( result, tests ); - result.innerHTML = "Running...
         "; - } - }, - - // Resets the test setup. Useful for tests that modify the DOM. - /* + config = { + // The queue of tests to run + queue: [], + + // block until document ready + blocking: true, + + // when enabled, show only failing tests + // gets persisted through sessionStorage and can be changed in UI via checkbox + hidepassed: false, + + // by default, run previously failed tests first + // very useful in combination with "Hide passed tests" checked + reorder: true, + + // by default, modify document.title when suite is done + altertitle: true, + + // by default, scroll to top of the page when suite is done + scrolltop: true, + + // when enabled, all tests must call expect() + requireExpects: false, + + // add checkboxes that are persisted in the query-string + // when enabled, the id is set to `true` as a `QUnit.config` property + urlConfig: [ + { + id: 'noglobals', + label: 'Check for Globals', + tooltip: 'Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings.', + }, + { + id: 'notrycatch', + label: 'No try-catch', + tooltip: 'Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings.', + }, + ], + + // Set of all modules. + modules: {}, + + // logging callback queues + begin: [], + done: [], + log: [], + testStart: [], + testDone: [], + moduleStart: [], + moduleDone: [], + }; + + // Initialize more QUnit.config and QUnit.urlParams + (function() { + let i; let current; + const location = window.location || {search: '', protocol: 'file:'}; + const params = location.search.slice( 1 ).split( '&' ); + const length = params.length; + const urlParams = {}; + + if ( params[0] ) { + for ( i = 0; i < length; i++ ) { + current = params[i].split( '=' ); + current[0] = decodeURIComponent( current[0] ); + + // allow just a key to turn on a flag, e.g., test.html?noglobals + current[1] = current[1] ? decodeURIComponent( current[1] ) : true; + if ( urlParams[current[0]] ) { + urlParams[current[0]] = [].concat( urlParams[current[0]], current[1] ); + } else { + urlParams[current[0]] = current[1]; + } + } + } + + QUnit.urlParams = urlParams; + + // String search anywhere in moduleName+testName + config.filter = urlParams.filter; + + // Exact match of the module name + config.module = urlParams.module; + + config.testNumber = []; + if ( urlParams.testNumber ) { + // Ensure that urlParams.testNumber is an array + urlParams.testNumber = [].concat( urlParams.testNumber ); + for ( i = 0; i < urlParams.testNumber.length; i++ ) { + current = urlParams.testNumber[i]; + config.testNumber.push( parseInt( current, 10 ) ); + } + } + + // Figure out if we're running the tests from a server or not + QUnit.isLocal = location.protocol === 'file:'; + }()); + + extend( QUnit, { + + config: config, + + // Initialize the configuration options + init: function() { + extend( config, { + stats: {all: 0, bad: 0}, + moduleStats: {all: 0, bad: 0}, + started: +new Date(), + updateRate: 1000, + blocking: false, + autostart: true, + autorun: false, + filter: '', + queue: [], + semaphore: 1, + }); + + let tests; let banner; let result; + const qunit = id( 'qunit' ); + + if ( qunit ) { + qunit.innerHTML = + '

        ' + escapeText( document.title ) + '

        ' + + '

        ' + + '
        ' + + '

        ' + + '
          '; + } + + tests = id( 'qunit-tests' ); + banner = id( 'qunit-banner' ); + result = id( 'qunit-testresult' ); + + if ( tests ) { + tests.innerHTML = ''; + } + + if ( banner ) { + banner.className = ''; + } + + if ( result ) { + result.parentNode.removeChild( result ); + } + + if ( tests ) { + result = document.createElement( 'p' ); + result.id = 'qunit-testresult'; + result.className = 'result'; + tests.parentNode.insertBefore( result, tests ); + result.innerHTML = 'Running...
           '; + } + }, + + // Resets the test setup. Useful for tests that modify the DOM. + /* DEPRECATED: Use multiple tests instead of resetting inside a test. Use testStart or testDone for custom cleanup. This method will throw an error in 2.0, and will be removed in 2.1 */ - reset: function() { - var fixture = id( "qunit-fixture" ); - if ( fixture ) { - fixture.innerHTML = config.fixture; - } - }, - - // Safe object type checking - is: function( type, obj ) { - return QUnit.objectType( obj ) === type; - }, - - objectType: function( obj ) { - if ( typeof obj === "undefined" ) { - return "undefined"; - } - - // Consider: typeof null === object - if ( obj === null ) { - return "null"; - } - - var match = toString.call( obj ).match(/^\[object\s(.*)\]$/), - type = match && match[1] || ""; - - switch ( type ) { - case "Number": - if ( isNaN(obj) ) { - return "nan"; - } - return "number"; - case "String": - case "Boolean": - case "Array": - case "Date": - case "RegExp": - case "Function": - return type.toLowerCase(); - } - if ( typeof obj === "object" ) { - return "object"; - } - return undefined; - }, - - push: function( result, actual, expected, message ) { - if ( !config.current ) { - throw new Error( "assertion outside test context, was " + sourceFromStacktrace() ); - } - - var output, source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: message, - actual: actual, - expected: expected - }; - - message = escapeText( message ) || ( result ? "okay" : "failed" ); - message = "" + message + ""; - output = message; - - if ( !result ) { - expected = escapeText( QUnit.jsDump.parse(expected) ); - actual = escapeText( QUnit.jsDump.parse(actual) ); - output += ""; - - if ( actual !== expected ) { - output += ""; - output += ""; - } - - source = sourceFromStacktrace(); - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
          Expected:
          " + expected + "
          Result:
          " + actual + "
          Diff:
          " + QUnit.diff( expected, actual ) + "
          Source:
          " + escapeText( source ) + "
          "; - } - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: !!result, - message: output - }); - }, - - pushFailure: function( message, source, actual ) { - if ( !config.current ) { - throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - - var output, - details = { - module: config.current.module, - name: config.current.testName, - result: false, - message: message - }; - - message = escapeText( message ) || "error"; - message = "" + message + ""; - output = message; - - output += ""; - - if ( actual ) { - output += ""; - } - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
          Result:
          " + escapeText( actual ) + "
          Source:
          " + escapeText( source ) + "
          "; - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: false, - message: output - }); - }, - - url: function( params ) { - params = extend( extend( {}, QUnit.urlParams ), params ); - var key, - querystring = "?"; - - for ( key in params ) { - if ( hasOwn.call( params, key ) ) { - querystring += encodeURIComponent( key ) + "=" + - encodeURIComponent( params[ key ] ) + "&"; - } - } - return window.location.protocol + "//" + window.location.host + + reset: function() { + const fixture = id( 'qunit-fixture' ); + if ( fixture ) { + fixture.innerHTML = config.fixture; + } + }, + + // Safe object type checking + is: function( type, obj ) { + return QUnit.objectType( obj ) === type; + }, + + objectType: function( obj ) { + if ( typeof obj === 'undefined' ) { + return 'undefined'; + } + + // Consider: typeof null === object + if ( obj === null ) { + return 'null'; + } + + const match = toString.call( obj ).match(/^\[object\s(.*)\]$/); + const type = match && match[1] || ''; + + switch ( type ) { + case 'Number': + if ( isNaN(obj) ) { + return 'nan'; + } + return 'number'; + case 'String': + case 'Boolean': + case 'Array': + case 'Date': + case 'RegExp': + case 'Function': + return type.toLowerCase(); + } + if ( typeof obj === 'object' ) { + return 'object'; + } + return undefined; + }, + + push: function( result, actual, expected, message ) { + if ( !config.current ) { + throw new Error( 'assertion outside test context, was ' + sourceFromStacktrace() ); + } + + let output; let source; + const details = { + module: config.current.module, + name: config.current.testName, + result: result, + message: message, + actual: actual, + expected: expected, + }; + + message = escapeText( message ) || ( result ? 'okay' : 'failed' ); + message = '' + message + ''; + output = message; + + if ( !result ) { + expected = escapeText( QUnit.jsDump.parse(expected) ); + actual = escapeText( QUnit.jsDump.parse(actual) ); + output += ''; + + if ( actual !== expected ) { + output += ''; + output += ''; + } + + source = sourceFromStacktrace(); + + if ( source ) { + details.source = source; + output += ''; + } + + output += '
          Expected:
          ' + expected + '
          Result:
          ' + actual + '
          Diff:
          ' + QUnit.diff( expected, actual ) + '
          Source:
          ' + escapeText( source ) + '
          '; + } + + runLoggingCallbacks( 'log', QUnit, details ); + + config.current.assertions.push({ + result: !!result, + message: output, + }); + }, + + pushFailure: function( message, source, actual ) { + if ( !config.current ) { + throw new Error( 'pushFailure() assertion outside test context, was ' + sourceFromStacktrace(2) ); + } + + let output; + const details = { + module: config.current.module, + name: config.current.testName, + result: false, + message: message, + }; + + message = escapeText( message ) || 'error'; + message = '' + message + ''; + output = message; + + output += ''; + + if ( actual ) { + output += ''; + } + + if ( source ) { + details.source = source; + output += ''; + } + + output += '
          Result:
          ' + escapeText( actual ) + '
          Source:
          ' + escapeText( source ) + '
          '; + + runLoggingCallbacks( 'log', QUnit, details ); + + config.current.assertions.push({ + result: false, + message: output, + }); + }, + + url: function( params ) { + params = extend( extend( {}, QUnit.urlParams ), params ); + let key; + let querystring = '?'; + + for ( key in params ) { + if ( hasOwn.call( params, key ) ) { + querystring += encodeURIComponent( key ) + '=' + + encodeURIComponent( params[key] ) + '&'; + } + } + return window.location.protocol + '//' + window.location.host + window.location.pathname + querystring.slice( 0, -1 ); - }, - - extend: extend, - id: id, - addEvent: addEvent, - addClass: addClass, - hasClass: hasClass, - removeClass: removeClass - // load, equiv, jsDump, diff: Attached later -}); - -/** + }, + + extend: extend, + id: id, + addEvent: addEvent, + addClass: addClass, + hasClass: hasClass, + removeClass: removeClass, + // load, equiv, jsDump, diff: Attached later + }); + + /** * @deprecated: Created for backwards compatibility with test runner that set the hook function * into QUnit.{hook}, instead of invoking it and passing the hook function. * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here. * Doing this allows us to tell if the following methods have been overwritten on the actual * QUnit object. */ -extend( QUnit.constructor.prototype, { - - // Logging callbacks; all receive a single argument with the listed properties - // run test/logs.html for any related changes - begin: registerLoggingCallback( "begin" ), - - // done: { failed, passed, total, runtime } - done: registerLoggingCallback( "done" ), - - // log: { result, actual, expected, message } - log: registerLoggingCallback( "log" ), - - // testStart: { name } - testStart: registerLoggingCallback( "testStart" ), - - // testDone: { name, failed, passed, total, runtime } - testDone: registerLoggingCallback( "testDone" ), - - // moduleStart: { name } - moduleStart: registerLoggingCallback( "moduleStart" ), - - // moduleDone: { name, failed, passed, total } - moduleDone: registerLoggingCallback( "moduleDone" ) -}); - -if ( !defined.document || document.readyState === "complete" ) { - config.autorun = true; -} - -QUnit.load = function() { - runLoggingCallbacks( "begin", QUnit, {} ); - - // Initialize the config, saving the execution queue - var banner, filter, i, j, label, len, main, ol, toolbar, val, selection, - urlConfigContainer, moduleFilter, userAgent, - numModules = 0, - moduleNames = [], - moduleFilterHtml = "", - urlConfigHtml = "", - oldconfig = extend( {}, config ); - - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - len = config.urlConfig.length; - - for ( i = 0; i < len; i++ ) { - val = config.urlConfig[i]; - if ( typeof val === "string" ) { - val = { - id: val, - label: val - }; - } - config[ val.id ] = QUnit.urlParams[ val.id ]; - if ( !val.value || typeof val.value === "string" ) { - urlConfigHtml += ""; - } else { - urlConfigHtml += ""; - } - } - for ( i in config.modules ) { - if ( config.modules.hasOwnProperty( i ) ) { - moduleNames.push(i); - } - } - numModules = moduleNames.length; - moduleNames.sort( function( a, b ) { - return a.localeCompare( b ); - }); - moduleFilterHtml += ""; - - // `userAgent` initialized at top of scope - userAgent = id( "qunit-userAgent" ); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - - // `banner` initialized at top of scope - banner = id( "qunit-header" ); - if ( banner ) { - banner.innerHTML = "" + banner.innerHTML + " "; - } - - // `toolbar` initialized at top of scope - toolbar = id( "qunit-testrunner-toolbar" ); - if ( toolbar ) { - // `filter` initialized at top of scope - filter = document.createElement( "input" ); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - - addEvent( filter, "click", function() { - var tmp, - ol = id( "qunit-tests" ); - - if ( filter.checked ) { - ol.className = ol.className + " hidepass"; - } else { - tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; - ol.className = tmp.replace( / hidepass /, " " ); - } - if ( defined.sessionStorage ) { - if (filter.checked) { - sessionStorage.setItem( "qunit-filter-passed-tests", "true" ); - } else { - sessionStorage.removeItem( "qunit-filter-passed-tests" ); - } - } - }); - - if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) { - filter.checked = true; - // `ol` initialized at top of scope - ol = id( "qunit-tests" ); - ol.className = ol.className + " hidepass"; - } - toolbar.appendChild( filter ); - - // `label` initialized at top of scope - label = document.createElement( "label" ); - label.setAttribute( "for", "qunit-filter-pass" ); - label.setAttribute( "title", "Only show tests and assertions that fail. Stored in sessionStorage." ); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - - urlConfigContainer = document.createElement("span"); - urlConfigContainer.innerHTML = urlConfigHtml; - // For oldIE support: - // * Add handlers to the individual elements instead of the container - // * Use "click" instead of "change" for checkboxes - // * Fallback from event.target to event.srcElement - addEvents( urlConfigContainer.getElementsByTagName("input"), "click", function( event ) { - var params = {}, - target = event.target || event.srcElement; - params[ target.name ] = target.checked ? + extend( QUnit.constructor.prototype, { + + // Logging callbacks; all receive a single argument with the listed properties + // run test/logs.html for any related changes + begin: registerLoggingCallback( 'begin' ), + + // done: { failed, passed, total, runtime } + done: registerLoggingCallback( 'done' ), + + // log: { result, actual, expected, message } + log: registerLoggingCallback( 'log' ), + + // testStart: { name } + testStart: registerLoggingCallback( 'testStart' ), + + // testDone: { name, failed, passed, total, runtime } + testDone: registerLoggingCallback( 'testDone' ), + + // moduleStart: { name } + moduleStart: registerLoggingCallback( 'moduleStart' ), + + // moduleDone: { name, failed, passed, total } + moduleDone: registerLoggingCallback( 'moduleDone' ), + }); + + if ( !defined.document || document.readyState === 'complete' ) { + config.autorun = true; + } + + QUnit.load = function() { + runLoggingCallbacks( 'begin', QUnit, {} ); + + // Initialize the config, saving the execution queue + let banner; let filter; let i; let j; let label; let len; let main; let ol; let toolbar; let val; let selection; + let urlConfigContainer; let moduleFilter; let userAgent; + let numModules = 0; + const moduleNames = []; + let moduleFilterHtml = ''; + let urlConfigHtml = ''; + const oldconfig = extend( {}, config ); + + QUnit.init(); + extend(config, oldconfig); + + config.blocking = false; + + len = config.urlConfig.length; + + for ( i = 0; i < len; i++ ) { + val = config.urlConfig[i]; + if ( typeof val === 'string' ) { + val = { + id: val, + label: val, + }; + } + config[val.id] = QUnit.urlParams[val.id]; + if ( !val.value || typeof val.value === 'string' ) { + urlConfigHtml += ''; + } else { + urlConfigHtml += ''; + } + } + for ( i in config.modules ) { + if ( config.modules.hasOwnProperty( i ) ) { + moduleNames.push(i); + } + } + numModules = moduleNames.length; + moduleNames.sort( function( a, b ) { + return a.localeCompare( b ); + }); + moduleFilterHtml += ''; + + // `userAgent` initialized at top of scope + userAgent = id( 'qunit-userAgent' ); + if ( userAgent ) { + userAgent.innerHTML = navigator.userAgent; + } + + // `banner` initialized at top of scope + banner = id( 'qunit-header' ); + if ( banner ) { + banner.innerHTML = '' + banner.innerHTML + ' '; + } + + // `toolbar` initialized at top of scope + toolbar = id( 'qunit-testrunner-toolbar' ); + if ( toolbar ) { + // `filter` initialized at top of scope + filter = document.createElement( 'input' ); + filter.type = 'checkbox'; + filter.id = 'qunit-filter-pass'; + + addEvent( filter, 'click', function() { + let tmp; + const ol = id( 'qunit-tests' ); + + if ( filter.checked ) { + ol.className = ol.className + ' hidepass'; + } else { + tmp = ' ' + ol.className.replace( /[\n\t\r]/g, ' ' ) + ' '; + ol.className = tmp.replace( / hidepass /, ' ' ); + } + if ( defined.sessionStorage ) { + if (filter.checked) { + sessionStorage.setItem( 'qunit-filter-passed-tests', 'true' ); + } else { + sessionStorage.removeItem( 'qunit-filter-passed-tests' ); + } + } + }); + + if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( 'qunit-filter-passed-tests' ) ) { + filter.checked = true; + // `ol` initialized at top of scope + ol = id( 'qunit-tests' ); + ol.className = ol.className + ' hidepass'; + } + toolbar.appendChild( filter ); + + // `label` initialized at top of scope + label = document.createElement( 'label' ); + label.setAttribute( 'for', 'qunit-filter-pass' ); + label.setAttribute( 'title', 'Only show tests and assertions that fail. Stored in sessionStorage.' ); + label.innerHTML = 'Hide passed tests'; + toolbar.appendChild( label ); + + urlConfigContainer = document.createElement('span'); + urlConfigContainer.innerHTML = urlConfigHtml; + // For oldIE support: + // * Add handlers to the individual elements instead of the container + // * Use "click" instead of "change" for checkboxes + // * Fallback from event.target to event.srcElement + addEvents( urlConfigContainer.getElementsByTagName('input'), 'click', function( event ) { + const params = {}; + const target = event.target || event.srcElement; + params[target.name] = target.checked ? target.defaultValue || true : undefined; - window.location = QUnit.url( params ); - }); - addEvents( urlConfigContainer.getElementsByTagName("select"), "change", function( event ) { - var params = {}, - target = event.target || event.srcElement; - params[ target.name ] = target.options[ target.selectedIndex ].value || undefined; - window.location = QUnit.url( params ); - }); - toolbar.appendChild( urlConfigContainer ); - - if (numModules > 1) { - moduleFilter = document.createElement( "span" ); - moduleFilter.setAttribute( "id", "qunit-modulefilter-container" ); - moduleFilter.innerHTML = moduleFilterHtml; - addEvent( moduleFilter.lastChild, "change", function() { - var selectBox = moduleFilter.getElementsByTagName("select")[0], - selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); - - window.location = QUnit.url({ - module: ( selectedModule === "" ) ? undefined : selectedModule, - // Remove any existing filters - filter: undefined, - testNumber: undefined - }); - }); - toolbar.appendChild(moduleFilter); - } - } - - // `main` initialized at top of scope - main = id( "qunit-fixture" ); - if ( main ) { - config.fixture = main.innerHTML; - } - - if ( config.autostart ) { - QUnit.start(); - } -}; - -if ( defined.document ) { - addEvent( window, "load", QUnit.load ); -} - -// `onErrorFnPrev` initialized at top of scope -// Preserve other handlers -onErrorFnPrev = window.onerror; - -// Cover uncaught exceptions -// Returning true will suppress the default browser handler, -// returning false will let it run. -window.onerror = function ( error, filePath, linerNr ) { - var ret = false; - if ( onErrorFnPrev ) { - ret = onErrorFnPrev( error, filePath, linerNr ); - } - - // Treat return value as window.onerror itself does, - // Only do our handling if not suppressed. - if ( ret !== true ) { - if ( QUnit.config.current ) { - if ( QUnit.config.current.ignoreGlobalErrors ) { - return true; - } - QUnit.pushFailure( error, filePath + ":" + linerNr ); - } else { - QUnit.test( "global failure", extend( function() { - QUnit.pushFailure( error, filePath + ":" + linerNr ); - }, { validTest: validTest } ) ); - } - return false; - } - - return ret; -}; - -function done() { - config.autorun = true; - - // Log the last module results - if ( config.previousModule ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.previousModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - delete config.previousModule; - - var i, key, - banner = id( "qunit-banner" ), - tests = id( "qunit-tests" ), - runtime = +new Date() - config.started, - passed = config.stats.all - config.stats.bad, - html = [ - "Tests completed in ", - runtime, - " milliseconds.
          ", - "", - passed, - " assertions of ", - config.stats.all, - " passed, ", - config.stats.bad, - " failed." - ].join( "" ); - - if ( banner ) { - banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" ); - } - - if ( tests ) { - id( "qunit-testresult" ).innerHTML = html; - } - - if ( config.altertitle && defined.document && document.title ) { - // show ✖ for good, ✔ for bad suite result in title - // use escape sequences in case file gets loaded with non-utf-8-charset - document.title = [ - ( config.stats.bad ? "\u2716" : "\u2714" ), - document.title.replace( /^[\u2714\u2716] /i, "" ) - ].join( " " ); - } - - // clear own sessionStorage items if all tests passed - if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { - // `key` & `i` initialized at top of scope - for ( i = 0; i < sessionStorage.length; i++ ) { - key = sessionStorage.key( i++ ); - if ( key.indexOf( "qunit-test-" ) === 0 ) { - sessionStorage.removeItem( key ); - } - } - } - - // scroll back to top to show results - if ( config.scrolltop && window.scrollTo ) { - window.scrollTo(0, 0); - } - - runLoggingCallbacks( "done", QUnit, { - failed: config.stats.bad, - passed: passed, - total: config.stats.all, - runtime: runtime - }); -} - -/** @return Boolean: true if this test should be ran */ -function validTest( test ) { - var include, - filter = config.filter && config.filter.toLowerCase(), - module = config.module && config.module.toLowerCase(), - fullName = ( test.module + ": " + test.testName ).toLowerCase(); - - // Internally-generated tests are always valid - if ( test.callback && test.callback.validTest === validTest ) { - delete test.callback.validTest; - return true; - } - - if ( config.testNumber.length > 0 ) { - if ( inArray( test.testNumber, config.testNumber ) < 0 ) { - return false; - } - } - - if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { - return false; - } - - if ( !filter ) { - return true; - } - - include = filter.charAt( 0 ) !== "!"; - if ( !include ) { - filter = filter.slice( 1 ); - } - - // If the filter matches, we need to honour include - if ( fullName.indexOf( filter ) !== -1 ) { - return include; - } - - // Otherwise, do the opposite - return !include; -} - -// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) -// Later Safari and IE10 are supposed to support error.stack as well -// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack -function extractStacktrace( e, offset ) { - offset = offset === undefined ? 3 : offset; - - var stack, include, i; - - if ( e.stacktrace ) { - // Opera - return e.stacktrace.split( "\n" )[ offset + 3 ]; - } else if ( e.stack ) { - // Firefox, Chrome - stack = e.stack.split( "\n" ); - if (/^error$/i.test( stack[0] ) ) { - stack.shift(); - } - if ( fileName ) { - include = []; - for ( i = offset; i < stack.length; i++ ) { - if ( stack[ i ].indexOf( fileName ) !== -1 ) { - break; - } - include.push( stack[ i ] ); - } - if ( include.length ) { - return include.join( "\n" ); - } - } - return stack[ offset ]; - } else if ( e.sourceURL ) { - // Safari, PhantomJS - // hopefully one day Safari provides actual stacktraces - // exclude useless self-reference for generated Error objects - if ( /qunit.js$/.test( e.sourceURL ) ) { - return; - } - // for actual exceptions, this is useful - return e.sourceURL + ":" + e.line; - } -} -function sourceFromStacktrace( offset ) { - try { - throw new Error(); - } catch ( e ) { - return extractStacktrace( e, offset ); - } -} - -/** + window.location = QUnit.url( params ); + }); + addEvents( urlConfigContainer.getElementsByTagName('select'), 'change', function( event ) { + const params = {}; + const target = event.target || event.srcElement; + params[target.name] = target.options[target.selectedIndex].value || undefined; + window.location = QUnit.url( params ); + }); + toolbar.appendChild( urlConfigContainer ); + + if (numModules > 1) { + moduleFilter = document.createElement( 'span' ); + moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' ); + moduleFilter.innerHTML = moduleFilterHtml; + addEvent( moduleFilter.lastChild, 'change', function() { + const selectBox = moduleFilter.getElementsByTagName('select')[0]; + const selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); + + window.location = QUnit.url({ + module: ( selectedModule === '' ) ? undefined : selectedModule, + // Remove any existing filters + filter: undefined, + testNumber: undefined, + }); + }); + toolbar.appendChild(moduleFilter); + } + } + + // `main` initialized at top of scope + main = id( 'qunit-fixture' ); + if ( main ) { + config.fixture = main.innerHTML; + } + + if ( config.autostart ) { + QUnit.start(); + } + }; + + if ( defined.document ) { + addEvent( window, 'load', QUnit.load ); + } + + // `onErrorFnPrev` initialized at top of scope + // Preserve other handlers + onErrorFnPrev = window.onerror; + + // Cover uncaught exceptions + // Returning true will suppress the default browser handler, + // returning false will let it run. + window.onerror = function( error, filePath, linerNr ) { + let ret = false; + if ( onErrorFnPrev ) { + ret = onErrorFnPrev( error, filePath, linerNr ); + } + + // Treat return value as window.onerror itself does, + // Only do our handling if not suppressed. + if ( ret !== true ) { + if ( QUnit.config.current ) { + if ( QUnit.config.current.ignoreGlobalErrors ) { + return true; + } + QUnit.pushFailure( error, filePath + ':' + linerNr ); + } else { + QUnit.test( 'global failure', extend( function() { + QUnit.pushFailure( error, filePath + ':' + linerNr ); + }, {validTest: validTest} ) ); + } + return false; + } + + return ret; + }; + + function done() { + config.autorun = true; + + // Log the last module results + if ( config.previousModule ) { + runLoggingCallbacks( 'moduleDone', QUnit, { + name: config.previousModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all, + }); + } + delete config.previousModule; + + let i; let key; + const banner = id( 'qunit-banner' ); + const tests = id( 'qunit-tests' ); + const runtime = +new Date() - config.started; + const passed = config.stats.all - config.stats.bad; + const html = [ + 'Tests completed in ', + runtime, + ' milliseconds.
          ', + '', + passed, + ' assertions of ', + config.stats.all, + ' passed, ', + config.stats.bad, + ' failed.', + ].join( '' ); + + if ( banner ) { + banner.className = ( config.stats.bad ? 'qunit-fail' : 'qunit-pass' ); + } + + if ( tests ) { + id( 'qunit-testresult' ).innerHTML = html; + } + + if ( config.altertitle && defined.document && document.title ) { + // show ✖ for good, ✔ for bad suite result in title + // use escape sequences in case file gets loaded with non-utf-8-charset + document.title = [ + ( config.stats.bad ? '\u2716' : '\u2714' ), + document.title.replace( /^[\u2714\u2716] /i, '' ), + ].join( ' ' ); + } + + // clear own sessionStorage items if all tests passed + if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { + // `key` & `i` initialized at top of scope + for ( i = 0; i < sessionStorage.length; i++ ) { + key = sessionStorage.key( i++ ); + if ( key.indexOf( 'qunit-test-' ) === 0 ) { + sessionStorage.removeItem( key ); + } + } + } + + // scroll back to top to show results + if ( config.scrolltop && window.scrollTo ) { + window.scrollTo(0, 0); + } + + runLoggingCallbacks( 'done', QUnit, { + failed: config.stats.bad, + passed: passed, + total: config.stats.all, + runtime: runtime, + }); + } + + /** @return Boolean: true if this test should be ran */ + function validTest( test ) { + let include; + let filter = config.filter && config.filter.toLowerCase(); + const module = config.module && config.module.toLowerCase(); + const fullName = ( test.module + ': ' + test.testName ).toLowerCase(); + + // Internally-generated tests are always valid + if ( test.callback && test.callback.validTest === validTest ) { + delete test.callback.validTest; + return true; + } + + if ( config.testNumber.length > 0 ) { + if ( inArray( test.testNumber, config.testNumber ) < 0 ) { + return false; + } + } + + if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { + return false; + } + + if ( !filter ) { + return true; + } + + include = filter.charAt( 0 ) !== '!'; + if ( !include ) { + filter = filter.slice( 1 ); + } + + // If the filter matches, we need to honour include + if ( fullName.indexOf( filter ) !== -1 ) { + return include; + } + + // Otherwise, do the opposite + return !include; + } + + // so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) + // Later Safari and IE10 are supposed to support error.stack as well + // See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack + function extractStacktrace( e, offset ) { + offset = offset === undefined ? 3 : offset; + + let stack; let include; let i; + + if ( e.stacktrace ) { + // Opera + return e.stacktrace.split( '\n' )[offset + 3]; + } else if ( e.stack ) { + // Firefox, Chrome + stack = e.stack.split( '\n' ); + if (/^error$/i.test( stack[0] ) ) { + stack.shift(); + } + if ( fileName ) { + include = []; + for ( i = offset; i < stack.length; i++ ) { + if ( stack[i].indexOf( fileName ) !== -1 ) { + break; + } + include.push( stack[i] ); + } + if ( include.length ) { + return include.join( '\n' ); + } + } + return stack[offset]; + } else if ( e.sourceURL ) { + // Safari, PhantomJS + // hopefully one day Safari provides actual stacktraces + // exclude useless self-reference for generated Error objects + if ( /qunit.js$/.test( e.sourceURL ) ) { + return; + } + // for actual exceptions, this is useful + return e.sourceURL + ':' + e.line; + } + } + function sourceFromStacktrace( offset ) { + try { + throw new Error(); + } catch ( e ) { + return extractStacktrace( e, offset ); + } + } + + /** * Escape text for attribute or text content. */ -function escapeText( s ) { - if ( !s ) { - return ""; - } - s = s + ""; - // Both single quotes and double quotes (for attributes) - return s.replace( /['"<>&]/g, function( s ) { - switch( s ) { - case "'": - return "'"; - case "\"": - return """; - case "<": - return "<"; - case ">": - return ">"; - case "&": - return "&"; - } - }); -} - -function synchronize( callback, last ) { - config.queue.push( callback ); - - if ( config.autorun && !config.blocking ) { - process( last ); - } -} - -function process( last ) { - function next() { - process( last ); - } - var start = new Date().getTime(); - config.depth = config.depth ? config.depth + 1 : 1; - - while ( config.queue.length && !config.blocking ) { - if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { - config.queue.shift()(); - } else { - setTimeout( next, 13 ); - break; - } - } - config.depth--; - if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { - done(); - } -} - -function saveGlobal() { - config.pollution = []; - - if ( config.noglobals ) { - for ( var key in window ) { - if ( hasOwn.call( window, key ) ) { - // in Opera sometimes DOM element ids show up here, ignore them - if ( /^qunit-test-output/.test( key ) ) { - continue; - } - config.pollution.push( key ); - } - } - } -} - -function checkPollution() { - var newGlobals, - deletedGlobals, - old = config.pollution; - - saveGlobal(); - - newGlobals = diff( config.pollution, old ); - if ( newGlobals.length > 0 ) { - QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") ); - } - - deletedGlobals = diff( old, config.pollution ); - if ( deletedGlobals.length > 0 ) { - QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") ); - } -} - -// returns a new Array with the elements that are in a but not in b -function diff( a, b ) { - var i, j, - result = a.slice(); - - for ( i = 0; i < result.length; i++ ) { - for ( j = 0; j < b.length; j++ ) { - if ( result[i] === b[j] ) { - result.splice( i, 1 ); - i--; - break; - } - } - } - return result; -} - -function extend( a, b ) { - for ( var prop in b ) { - if ( hasOwn.call( b, prop ) ) { - // Avoid "Member not found" error in IE8 caused by messing with window.constructor - if ( !( prop === "constructor" && a === window ) ) { - if ( b[ prop ] === undefined ) { - delete a[ prop ]; - } else { - a[ prop ] = b[ prop ]; - } - } - } - } - - return a; -} - -/** + function escapeText( s ) { + if ( !s ) { + return ''; + } + s = s + ''; + // Both single quotes and double quotes (for attributes) + return s.replace( /['"<>&]/g, function( s ) { + switch ( s ) { + case '\'': + return '''; + case '"': + return '"'; + case '<': + return '<'; + case '>': + return '>'; + case '&': + return '&'; + } + }); + } + + function synchronize( callback, last ) { + config.queue.push( callback ); + + if ( config.autorun && !config.blocking ) { + process( last ); + } + } + + function process( last ) { + function next() { + process( last ); + } + const start = new Date().getTime(); + config.depth = config.depth ? config.depth + 1 : 1; + + while ( config.queue.length && !config.blocking ) { + if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { + config.queue.shift()(); + } else { + setTimeout( next, 13 ); + break; + } + } + config.depth--; + if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { + done(); + } + } + + function saveGlobal() { + config.pollution = []; + + if ( config.noglobals ) { + for ( const key in window ) { + if ( hasOwn.call( window, key ) ) { + // in Opera sometimes DOM element ids show up here, ignore them + if ( /^qunit-test-output/.test( key ) ) { + continue; + } + config.pollution.push( key ); + } + } + } + } + + function checkPollution() { + let newGlobals; + let deletedGlobals; + const old = config.pollution; + + saveGlobal(); + + newGlobals = diff( config.pollution, old ); + if ( newGlobals.length > 0 ) { + QUnit.pushFailure( 'Introduced global variable(s): ' + newGlobals.join(', ') ); + } + + deletedGlobals = diff( old, config.pollution ); + if ( deletedGlobals.length > 0 ) { + QUnit.pushFailure( 'Deleted global variable(s): ' + deletedGlobals.join(', ') ); + } + } + + // returns a new Array with the elements that are in a but not in b + function diff( a, b ) { + let i; let j; + const result = a.slice(); + + for ( i = 0; i < result.length; i++ ) { + for ( j = 0; j < b.length; j++ ) { + if ( result[i] === b[j] ) { + result.splice( i, 1 ); + i--; + break; + } + } + } + return result; + } + + function extend( a, b ) { + for ( const prop in b ) { + if ( hasOwn.call( b, prop ) ) { + // Avoid "Member not found" error in IE8 caused by messing with window.constructor + if ( !( prop === 'constructor' && a === window ) ) { + if ( b[prop] === undefined ) { + delete a[prop]; + } else { + a[prop] = b[prop]; + } + } + } + } + + return a; + } + + /** * @param {HTMLElement} elem * @param {string} type * @param {Function} fn */ -function addEvent( elem, type, fn ) { - if ( elem.addEventListener ) { - - // Standards-based browsers - elem.addEventListener( type, fn, false ); - } else if ( elem.attachEvent ) { - - // support: IE <9 - elem.attachEvent( "on" + type, fn ); - } else { - - // Caller must ensure support for event listeners is present - throw new Error( "addEvent() was called in a context without event listener support" ); - } -} - -/** + function addEvent( elem, type, fn ) { + if ( elem.addEventListener ) { + // Standards-based browsers + elem.addEventListener( type, fn, false ); + } else if ( elem.attachEvent ) { + // support: IE <9 + elem.attachEvent( 'on' + type, fn ); + } else { + // Caller must ensure support for event listeners is present + throw new Error( 'addEvent() was called in a context without event listener support' ); + } + } + + /** * @param {Array|NodeList} elems * @param {string} type * @param {Function} fn */ -function addEvents( elems, type, fn ) { - var i = elems.length; - while ( i-- ) { - addEvent( elems[i], type, fn ); - } -} - -function hasClass( elem, name ) { - return (" " + elem.className + " ").indexOf(" " + name + " ") > -1; -} - -function addClass( elem, name ) { - if ( !hasClass( elem, name ) ) { - elem.className += (elem.className ? " " : "") + name; - } -} - -function removeClass( elem, name ) { - var set = " " + elem.className + " "; - // Class name may appear multiple times - while ( set.indexOf(" " + name + " ") > -1 ) { - set = set.replace(" " + name + " " , " "); - } - // If possible, trim it for prettiness, but not necessarily - elem.className = typeof set.trim === "function" ? set.trim() : set.replace(/^\s+|\s+$/g, ""); -} - -function id( name ) { - return defined.document && document.getElementById && document.getElementById( name ); -} - -function registerLoggingCallback( key ) { - return function( callback ) { - config[key].push( callback ); - }; -} - -// Supports deprecated method of completely overwriting logging callbacks -function runLoggingCallbacks( key, scope, args ) { - var i, callbacks; - if ( QUnit.hasOwnProperty( key ) ) { - QUnit[ key ].call(scope, args ); - } else { - callbacks = config[ key ]; - for ( i = 0; i < callbacks.length; i++ ) { - callbacks[ i ].call( scope, args ); - } - } -} - -// from jquery.js -function inArray( elem, array ) { - if ( array.indexOf ) { - return array.indexOf( elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; -} - -function Test( settings ) { - extend( this, settings ); - this.assertions = []; - this.testNumber = ++Test.count; -} - -Test.count = 0; - -Test.prototype = { - init: function() { - var a, b, li, - tests = id( "qunit-tests" ); - - if ( tests ) { - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml; - - // `a` initialized at top of scope - a = document.createElement( "a" ); - a.innerHTML = "Rerun"; - a.href = QUnit.url({ testNumber: this.testNumber }); - - li = document.createElement( "li" ); - li.appendChild( b ); - li.appendChild( a ); - li.className = "running"; - li.id = this.id = "qunit-test-output" + testId++; - - tests.appendChild( li ); - } - }, - setup: function() { - if ( - // Emit moduleStart when we're switching from one module to another - this.module !== config.previousModule || + function addEvents( elems, type, fn ) { + let i = elems.length; + while ( i-- ) { + addEvent( elems[i], type, fn ); + } + } + + function hasClass( elem, name ) { + return (' ' + elem.className + ' ').indexOf(' ' + name + ' ') > -1; + } + + function addClass( elem, name ) { + if ( !hasClass( elem, name ) ) { + elem.className += (elem.className ? ' ' : '') + name; + } + } + + function removeClass( elem, name ) { + let set = ' ' + elem.className + ' '; + // Class name may appear multiple times + while ( set.indexOf(' ' + name + ' ') > -1 ) { + set = set.replace(' ' + name + ' ', ' '); + } + // If possible, trim it for prettiness, but not necessarily + elem.className = typeof set.trim === 'function' ? set.trim() : set.replace(/^\s+|\s+$/g, ''); + } + + function id( name ) { + return defined.document && document.getElementById && document.getElementById( name ); + } + + function registerLoggingCallback( key ) { + return function( callback ) { + config[key].push( callback ); + }; + } + + // Supports deprecated method of completely overwriting logging callbacks + function runLoggingCallbacks( key, scope, args ) { + let i; let callbacks; + if ( QUnit.hasOwnProperty( key ) ) { + QUnit[key].call(scope, args ); + } else { + callbacks = config[key]; + for ( i = 0; i < callbacks.length; i++ ) { + callbacks[i].call( scope, args ); + } + } + } + + // from jquery.js + function inArray( elem, array ) { + if ( array.indexOf ) { + return array.indexOf( elem ); + } + + for ( let i = 0, length = array.length; i < length; i++ ) { + if ( array[i] === elem ) { + return i; + } + } + + return -1; + } + + function Test( settings ) { + extend( this, settings ); + this.assertions = []; + this.testNumber = ++Test.count; + } + + Test.count = 0; + + Test.prototype = { + init: function() { + let a; let b; let li; + const tests = id( 'qunit-tests' ); + + if ( tests ) { + b = document.createElement( 'strong' ); + b.innerHTML = this.nameHtml; + + // `a` initialized at top of scope + a = document.createElement( 'a' ); + a.innerHTML = 'Rerun'; + a.href = QUnit.url({testNumber: this.testNumber}); + + li = document.createElement( 'li' ); + li.appendChild( b ); + li.appendChild( a ); + li.className = 'running'; + li.id = this.id = 'qunit-test-output' + testId++; + + tests.appendChild( li ); + } + }, + setup: function() { + if ( + // Emit moduleStart when we're switching from one module to another + this.module !== config.previousModule || // They could be equal (both undefined) but if the previousModule property doesn't // yet exist it means this is the first test in a suite that isn't wrapped in a // module, in which case we'll just emit a moduleStart event for 'undefined'. // Without this, reporters can get testStart before moduleStart which is a problem. - !hasOwn.call( config, "previousModule" ) - ) { - if ( hasOwn.call( config, "previousModule" ) ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.previousModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - config.previousModule = this.module; - config.moduleStats = { all: 0, bad: 0 }; - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); - } - - config.current = this; - - this.testEnvironment = extend({ - setup: function() {}, - teardown: function() {} - }, this.moduleTestEnvironment ); - - this.started = +new Date(); - runLoggingCallbacks( "testStart", QUnit, { - name: this.testName, - module: this.module - }); - - /*jshint camelcase:false */ - - - /** + !hasOwn.call( config, 'previousModule' ) + ) { + if ( hasOwn.call( config, 'previousModule' ) ) { + runLoggingCallbacks( 'moduleDone', QUnit, { + name: config.previousModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all, + }); + } + config.previousModule = this.module; + config.moduleStats = {all: 0, bad: 0}; + runLoggingCallbacks( 'moduleStart', QUnit, { + name: this.module, + }); + } + + config.current = this; + + this.testEnvironment = extend({ + setup: function() {}, + teardown: function() {}, + }, this.moduleTestEnvironment ); + + this.started = +new Date(); + runLoggingCallbacks( 'testStart', QUnit, { + name: this.testName, + module: this.module, + }); + + /* jshint camelcase:false */ + + + /** * Expose the current test environment. * * @deprecated since 1.12.0: Use QUnit.config.current.testEnvironment instead. */ - QUnit.current_testEnvironment = this.testEnvironment; - - /*jshint camelcase:true */ - - if ( !config.pollution ) { - saveGlobal(); - } - if ( config.notrycatch ) { - this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert ); - return; - } - try { - this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert ); - } catch( e ) { - QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - }, - run: function() { - config.current = this; - - var running = id( "qunit-testresult" ); - - if ( running ) { - running.innerHTML = "Running:
          " + this.nameHtml; - } - - if ( this.async ) { - QUnit.stop(); - } - - this.callbackStarted = +new Date(); - - if ( config.notrycatch ) { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - return; - } - - try { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - } catch( e ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - - QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) ); - // else next test will carry the responsibility - saveGlobal(); - - // Restart the tests if they're blocking - if ( config.blocking ) { - QUnit.start(); - } - } - }, - teardown: function() { - config.current = this; - if ( config.notrycatch ) { - if ( typeof this.callbackRuntime === "undefined" ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - } - this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert ); - return; - } else { - try { - this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert ); - } catch( e ) { - QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - } - checkPollution(); - }, - finish: function() { - config.current = this; - if ( config.requireExpects && this.expected === null ) { - QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack ); - } else if ( this.expected !== null && this.expected !== this.assertions.length ) { - QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack ); - } else if ( this.expected === null && !this.assertions.length ) { - QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack ); - } - - var i, assertion, a, b, time, li, ol, - test = this, - good = 0, - bad = 0, - tests = id( "qunit-tests" ); - - this.runtime = +new Date() - this.started; - config.stats.all += this.assertions.length; - config.moduleStats.all += this.assertions.length; - - if ( tests ) { - ol = document.createElement( "ol" ); - ol.className = "qunit-assert-list"; - - for ( i = 0; i < this.assertions.length; i++ ) { - assertion = this.assertions[i]; - - li = document.createElement( "li" ); - li.className = assertion.result ? "pass" : "fail"; - li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" ); - ol.appendChild( li ); - - if ( assertion.result ) { - good++; - } else { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - - // store result when possible - if ( QUnit.config.reorder && defined.sessionStorage ) { - if ( bad ) { - sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad ); - } else { - sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName ); - } - } - - if ( bad === 0 ) { - addClass( ol, "qunit-collapsed" ); - } - - // `b` initialized at top of scope - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml + " (" + bad + ", " + good + ", " + this.assertions.length + ")"; - - addEvent(b, "click", function() { - var next = b.parentNode.lastChild, - collapsed = hasClass( next, "qunit-collapsed" ); - ( collapsed ? removeClass : addClass )( next, "qunit-collapsed" ); - }); - - addEvent(b, "dblclick", function( e ) { - var target = e && e.target ? e.target : window.event.srcElement; - if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) { - target = target.parentNode; - } - if ( window.location && target.nodeName.toLowerCase() === "strong" ) { - window.location = QUnit.url({ testNumber: test.testNumber }); - } - }); - - // `time` initialized at top of scope - time = document.createElement( "span" ); - time.className = "runtime"; - time.innerHTML = this.runtime + " ms"; - - // `li` initialized at top of scope - li = id( this.id ); - li.className = bad ? "fail" : "pass"; - li.removeChild( li.firstChild ); - a = li.firstChild; - li.appendChild( b ); - li.appendChild( a ); - li.appendChild( time ); - li.appendChild( ol ); - - } else { - for ( i = 0; i < this.assertions.length; i++ ) { - if ( !this.assertions[i].result ) { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - } - - runLoggingCallbacks( "testDone", QUnit, { - name: this.testName, - module: this.module, - failed: bad, - passed: this.assertions.length - bad, - total: this.assertions.length, - runtime: this.runtime, - // DEPRECATED: this property will be removed in 2.0.0, use runtime instead - duration: this.runtime - }); - - QUnit.reset(); - - config.current = undefined; - }, - - queue: function() { - var bad, - test = this; - - synchronize(function() { - test.init(); - }); - function run() { - // each of these can by async - synchronize(function() { - test.setup(); - }); - synchronize(function() { - test.run(); - }); - synchronize(function() { - test.teardown(); - }); - synchronize(function() { - test.finish(); - }); - } - - // `bad` initialized at top of scope - // defer when previous test run passed, if storage is available - bad = QUnit.config.reorder && defined.sessionStorage && - +sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName ); - - if ( bad ) { - run(); - } else { - synchronize( run, true ); - } - } -}; - -// `assert` initialized at top of scope -// Assert helpers -// All of these must either call QUnit.push() or manually do: -// - runLoggingCallbacks( "log", .. ); -// - config.current.assertions.push({ .. }); -assert = QUnit.assert = { - /** + QUnit.current_testEnvironment = this.testEnvironment; + + /* jshint camelcase:true */ + + if ( !config.pollution ) { + saveGlobal(); + } + if ( config.notrycatch ) { + this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert ); + return; + } + try { + this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert ); + } catch ( e ) { + QUnit.pushFailure( 'Setup failed on ' + this.testName + ': ' + ( e.message || e ), extractStacktrace( e, 1 ) ); + } + }, + run: function() { + config.current = this; + + const running = id( 'qunit-testresult' ); + + if ( running ) { + running.innerHTML = 'Running:
          ' + this.nameHtml; + } + + if ( this.async ) { + QUnit.stop(); + } + + this.callbackStarted = +new Date(); + + if ( config.notrycatch ) { + this.callback.call( this.testEnvironment, QUnit.assert ); + this.callbackRuntime = +new Date() - this.callbackStarted; + return; + } + + try { + this.callback.call( this.testEnvironment, QUnit.assert ); + this.callbackRuntime = +new Date() - this.callbackStarted; + } catch ( e ) { + this.callbackRuntime = +new Date() - this.callbackStarted; + + QUnit.pushFailure( 'Died on test #' + (this.assertions.length + 1) + ' ' + this.stack + ': ' + ( e.message || e ), extractStacktrace( e, 0 ) ); + // else next test will carry the responsibility + saveGlobal(); + + // Restart the tests if they're blocking + if ( config.blocking ) { + QUnit.start(); + } + } + }, + teardown: function() { + config.current = this; + if ( config.notrycatch ) { + if ( typeof this.callbackRuntime === 'undefined' ) { + this.callbackRuntime = +new Date() - this.callbackStarted; + } + this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert ); + return; + } else { + try { + this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert ); + } catch ( e ) { + QUnit.pushFailure( 'Teardown failed on ' + this.testName + ': ' + ( e.message || e ), extractStacktrace( e, 1 ) ); + } + } + checkPollution(); + }, + finish: function() { + config.current = this; + if ( config.requireExpects && this.expected === null ) { + QUnit.pushFailure( 'Expected number of assertions to be defined, but expect() was not called.', this.stack ); + } else if ( this.expected !== null && this.expected !== this.assertions.length ) { + QUnit.pushFailure( 'Expected ' + this.expected + ' assertions, but ' + this.assertions.length + ' were run', this.stack ); + } else if ( this.expected === null && !this.assertions.length ) { + QUnit.pushFailure( 'Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.', this.stack ); + } + + let i; let assertion; let a; let b; let time; let li; let ol; + const test = this; + let good = 0; + let bad = 0; + const tests = id( 'qunit-tests' ); + + this.runtime = +new Date() - this.started; + config.stats.all += this.assertions.length; + config.moduleStats.all += this.assertions.length; + + if ( tests ) { + ol = document.createElement( 'ol' ); + ol.className = 'qunit-assert-list'; + + for ( i = 0; i < this.assertions.length; i++ ) { + assertion = this.assertions[i]; + + li = document.createElement( 'li' ); + li.className = assertion.result ? 'pass' : 'fail'; + li.innerHTML = assertion.message || ( assertion.result ? 'okay' : 'failed' ); + ol.appendChild( li ); + + if ( assertion.result ) { + good++; + } else { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + + // store result when possible + if ( QUnit.config.reorder && defined.sessionStorage ) { + if ( bad ) { + sessionStorage.setItem( 'qunit-test-' + this.module + '-' + this.testName, bad ); + } else { + sessionStorage.removeItem( 'qunit-test-' + this.module + '-' + this.testName ); + } + } + + if ( bad === 0 ) { + addClass( ol, 'qunit-collapsed' ); + } + + // `b` initialized at top of scope + b = document.createElement( 'strong' ); + b.innerHTML = this.nameHtml + ' (' + bad + ', ' + good + ', ' + this.assertions.length + ')'; + + addEvent(b, 'click', function() { + const next = b.parentNode.lastChild; + const collapsed = hasClass( next, 'qunit-collapsed' ); + ( collapsed ? removeClass : addClass )( next, 'qunit-collapsed' ); + }); + + addEvent(b, 'dblclick', function( e ) { + let target = e && e.target ? e.target : window.event.srcElement; + if ( target.nodeName.toLowerCase() === 'span' || target.nodeName.toLowerCase() === 'b' ) { + target = target.parentNode; + } + if ( window.location && target.nodeName.toLowerCase() === 'strong' ) { + window.location = QUnit.url({testNumber: test.testNumber}); + } + }); + + // `time` initialized at top of scope + time = document.createElement( 'span' ); + time.className = 'runtime'; + time.innerHTML = this.runtime + ' ms'; + + // `li` initialized at top of scope + li = id( this.id ); + li.className = bad ? 'fail' : 'pass'; + li.removeChild( li.firstChild ); + a = li.firstChild; + li.appendChild( b ); + li.appendChild( a ); + li.appendChild( time ); + li.appendChild( ol ); + } else { + for ( i = 0; i < this.assertions.length; i++ ) { + if ( !this.assertions[i].result ) { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + } + + runLoggingCallbacks( 'testDone', QUnit, { + name: this.testName, + module: this.module, + failed: bad, + passed: this.assertions.length - bad, + total: this.assertions.length, + runtime: this.runtime, + // DEPRECATED: this property will be removed in 2.0.0, use runtime instead + duration: this.runtime, + }); + + QUnit.reset(); + + config.current = undefined; + }, + + queue: function() { + let bad; + const test = this; + + synchronize(function() { + test.init(); + }); + function run() { + // each of these can by async + synchronize(function() { + test.setup(); + }); + synchronize(function() { + test.run(); + }); + synchronize(function() { + test.teardown(); + }); + synchronize(function() { + test.finish(); + }); + } + + // `bad` initialized at top of scope + // defer when previous test run passed, if storage is available + bad = QUnit.config.reorder && defined.sessionStorage && + +sessionStorage.getItem( 'qunit-test-' + this.module + '-' + this.testName ); + + if ( bad ) { + run(); + } else { + synchronize( run, true ); + } + }, + }; + + // `assert` initialized at top of scope + // Assert helpers + // All of these must either call QUnit.push() or manually do: + // - runLoggingCallbacks( "log", .. ); + // - config.current.assertions.push({ .. }); + assert = QUnit.assert = { + /** * Asserts rough true-ish result. * @name ok * @function * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); */ - ok: function( result, msg ) { - if ( !config.current ) { - throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - result = !!result; - msg = msg || ( result ? "okay" : "failed" ); - - var source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: msg - }; - - msg = "" + escapeText( msg ) + ""; - - if ( !result ) { - source = sourceFromStacktrace( 2 ); - if ( source ) { - details.source = source; - msg += "
          Source:
          " +
          +    'ok': function( result, msg ) {
          +      if ( !config.current ) {
          +        throw new Error( 'ok() assertion outside test context, was ' + sourceFromStacktrace(2) );
          +      }
          +      result = !!result;
          +      msg = msg || ( result ? 'okay' : 'failed' );
          +
          +      let source;
          +      const details = {
          +        module: config.current.module,
          +        name: config.current.testName,
          +        result: result,
          +        message: msg,
          +      };
          +
          +      msg = '' + escapeText( msg ) + '';
          +
          +      if ( !result ) {
          +        source = sourceFromStacktrace( 2 );
          +        if ( source ) {
          +          details.source = source;
          +          msg += '
          Source:
          ' +
           					escapeText( source ) +
          -					"
          "; - } - } - runLoggingCallbacks( "log", QUnit, details ); - config.current.assertions.push({ - result: result, - message: msg - }); - }, - - /** + '
          '; + } + } + runLoggingCallbacks( 'log', QUnit, details ); + config.current.assertions.push({ + result: result, + message: msg, + }); + }, + + /** * Assert that the first two arguments are equal, with an optional message. * Prints out both actual and expected values. * @name equal * @function * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" ); */ - equal: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected == actual, actual, expected, message ); - }, + 'equal': function( actual, expected, message ) { + /* jshint eqeqeq:false */ + QUnit.push( expected == actual, actual, expected, message ); + }, - /** + /** * @name notEqual * @function */ - notEqual: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected != actual, actual, expected, message ); - }, + 'notEqual': function( actual, expected, message ) { + /* jshint eqeqeq:false */ + QUnit.push( expected != actual, actual, expected, message ); + }, - /** + /** * @name propEqual * @function */ - propEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, + 'propEqual': function( actual, expected, message ) { + actual = objectValues(actual); + expected = objectValues(expected); + QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); + }, - /** + /** * @name notPropEqual * @function */ - notPropEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, + 'notPropEqual': function( actual, expected, message ) { + actual = objectValues(actual); + expected = objectValues(expected); + QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); + }, - /** + /** * @name deepEqual * @function */ - deepEqual: function( actual, expected, message ) { - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, + 'deepEqual': function( actual, expected, message ) { + QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); + }, - /** + /** * @name notDeepEqual * @function */ - notDeepEqual: function( actual, expected, message ) { - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, + 'notDeepEqual': function( actual, expected, message ) { + QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); + }, - /** + /** * @name strictEqual * @function */ - strictEqual: function( actual, expected, message ) { - QUnit.push( expected === actual, actual, expected, message ); - }, + 'strictEqual': function( actual, expected, message ) { + QUnit.push( expected === actual, actual, expected, message ); + }, - /** + /** * @name notStrictEqual * @function */ - notStrictEqual: function( actual, expected, message ) { - QUnit.push( expected !== actual, actual, expected, message ); - }, - - "throws": function( block, expected, message ) { - var actual, - expectedOutput = expected, - ok = false; - - // 'expected' is optional - if ( !message && typeof expected === "string" ) { - message = expected; - expected = null; - } - - config.current.ignoreGlobalErrors = true; - try { - block.call( config.current.testEnvironment ); - } catch (e) { - actual = e; - } - config.current.ignoreGlobalErrors = false; - - if ( actual ) { - - // we don't want to validate thrown error - if ( !expected ) { - ok = true; - expectedOutput = null; - - // expected is an Error object - } else if ( expected instanceof Error ) { - ok = actual instanceof Error && + 'notStrictEqual': function( actual, expected, message ) { + QUnit.push( expected !== actual, actual, expected, message ); + }, + + 'throws': function( block, expected, message ) { + let actual; + let expectedOutput = expected; + let ok = false; + + // 'expected' is optional + if ( !message && typeof expected === 'string' ) { + message = expected; + expected = null; + } + + config.current.ignoreGlobalErrors = true; + try { + block.call( config.current.testEnvironment ); + } catch (e) { + actual = e; + } + config.current.ignoreGlobalErrors = false; + + if ( actual ) { + // we don't want to validate thrown error + if ( !expected ) { + ok = true; + expectedOutput = null; + + // expected is an Error object + } else if ( expected instanceof Error ) { + ok = actual instanceof Error && actual.name === expected.name && actual.message === expected.message; - // expected is a regexp - } else if ( QUnit.objectType( expected ) === "regexp" ) { - ok = expected.test( errorString( actual ) ); + // expected is a regexp + } else if ( QUnit.objectType( expected ) === 'regexp' ) { + ok = expected.test( errorString( actual ) ); - // expected is a string - } else if ( QUnit.objectType( expected ) === "string" ) { - ok = expected === errorString( actual ); + // expected is a string + } else if ( QUnit.objectType( expected ) === 'string' ) { + ok = expected === errorString( actual ); - // expected is a constructor - } else if ( actual instanceof expected ) { - ok = true; + // expected is a constructor + } else if ( actual instanceof expected ) { + ok = true; - // expected is a validation function which returns true is validation passed - } else if ( expected.call( {}, actual ) === true ) { - expectedOutput = null; - ok = true; - } + // expected is a validation function which returns true is validation passed + } else if ( expected.call( {}, actual ) === true ) { + expectedOutput = null; + ok = true; + } - QUnit.push( ok, actual, expectedOutput, message ); - } else { - QUnit.pushFailure( message, null, "No exception was thrown." ); - } - } -}; + QUnit.push( ok, actual, expectedOutput, message ); + } else { + QUnit.pushFailure( message, null, 'No exception was thrown.' ); + } + }, + }; -/** + /** * @deprecated since 1.8.0 * Kept assertion helpers in root for backwards compatibility. */ -extend( QUnit.constructor.prototype, assert ); + extend( QUnit.constructor.prototype, assert ); -/** + /** * @deprecated since 1.9.0 * Kept to avoid TypeErrors for undefined methods. */ -QUnit.constructor.prototype.raises = function() { - QUnit.push( false, false, false, "QUnit.raises has been deprecated since 2012 (fad3c1ea), use QUnit.throws instead" ); -}; + QUnit.constructor.prototype.raises = function() { + QUnit.push( false, false, false, 'QUnit.raises has been deprecated since 2012 (fad3c1ea), use QUnit.throws instead' ); + }; -/** + /** * @deprecated since 1.0.0, replaced with error pushes since 1.3.0 * Kept to avoid TypeErrors for undefined methods. */ -QUnit.constructor.prototype.equals = function() { - QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" ); -}; -QUnit.constructor.prototype.same = function() { - QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" ); -}; - -// Test for equality any JavaScript type. -// Author: Philippe Rathé -QUnit.equiv = (function() { - - // Call the o related callback with the given arguments. - function bindCallbacks( o, callbacks, args ) { - var prop = QUnit.objectType( o ); - if ( prop ) { - if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) { - return callbacks[ prop ].apply( callbacks, args ); - } else { - return callbacks[ prop ]; // or undefined - } - } - } - - // the real equiv function - var innerEquiv, - // stack to decide between skip/abort functions - callers = [], - // stack to avoiding loops from circular referencing - parents = [], - parentsB = [], - - getProto = Object.getPrototypeOf || function ( obj ) { - /*jshint camelcase:false */ - return obj.__proto__; - }, - callbacks = (function () { - - // for string, boolean, number and null - function useStrictEquality( b, a ) { - /*jshint eqeqeq:false */ - if ( b instanceof a.constructor || a instanceof b.constructor ) { - // to catch short annotation VS 'new' annotation of a - // declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function( b ) { - return isNaN( b ); - }, - - "date": function( b, a ) { - return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function( b, a ) { - return QUnit.objectType( b ) === "regexp" && + QUnit.constructor.prototype.equals = function() { + QUnit.push( false, false, false, 'QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead' ); + }; + QUnit.constructor.prototype.same = function() { + QUnit.push( false, false, false, 'QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead' ); + }; + + // Test for equality any JavaScript type. + // Author: Philippe Rathé + QUnit.equiv = (function() { + // Call the o related callback with the given arguments. + function bindCallbacks( o, callbacks, args ) { + const prop = QUnit.objectType( o ); + if ( prop ) { + if ( QUnit.objectType( callbacks[prop] ) === 'function' ) { + return callbacks[prop].apply( callbacks, args ); + } else { + return callbacks[prop]; // or undefined + } + } + } + + // the real equiv function + let innerEquiv; + // stack to decide between skip/abort functions + const callers = []; + // stack to avoiding loops from circular referencing + const parents = []; + const parentsB = []; + + const getProto = Object.getPrototypeOf || function( obj ) { + /* jshint camelcase:false */ + return obj.__proto__; + }; + const callbacks = (function() { + // for string, boolean, number and null + function useStrictEquality( b, a ) { + /* jshint eqeqeq:false */ + if ( b instanceof a.constructor || a instanceof b.constructor ) { + // to catch short annotation VS 'new' annotation of a + // declaration + // e.g. var i = 1; + // var j = new Number(1); + return a == b; + } else { + return a === b; + } + } + + return { + 'string': useStrictEquality, + 'boolean': useStrictEquality, + 'number': useStrictEquality, + 'null': useStrictEquality, + 'undefined': useStrictEquality, + + 'nan': function( b ) { + return isNaN( b ); + }, + + 'date': function( b, a ) { + return QUnit.objectType( b ) === 'date' && a.valueOf() === b.valueOf(); + }, + + 'regexp': function( b, a ) { + return QUnit.objectType( b ) === 'regexp' && // the regex itself a.source === b.source && // and its modifiers @@ -1752,146 +1743,146 @@ QUnit.equiv = (function() { a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function() { - var caller = callers[callers.length - 1]; - return caller !== Object && typeof caller !== "undefined"; - }, - - "array": function( b, a ) { - var i, j, len, loop, aCircular, bCircular; - - // b could be an object literal here - if ( QUnit.objectType( b ) !== "array" ) { - return false; - } - - len = a.length; - if ( len !== b.length ) { - // safe and faster - return false; - } - - // track reference to avoid circular references - parents.push( a ); - parentsB.push( b ); - for ( i = 0; i < len; i++ ) { - loop = false; - for ( j = 0; j < parents.length; j++ ) { - aCircular = parents[j] === a[i]; - bCircular = parentsB[j] === b[i]; - if ( aCircular || bCircular ) { - if ( a[i] === b[i] || aCircular && bCircular ) { - loop = true; - } else { - parents.pop(); - parentsB.pop(); - return false; - } - } - } - if ( !loop && !innerEquiv(a[i], b[i]) ) { - parents.pop(); - parentsB.pop(); - return false; - } - } - parents.pop(); - parentsB.pop(); - return true; - }, - - "object": function( b, a ) { - /*jshint forin:false */ - var i, j, loop, aCircular, bCircular, - // Default to true - eq = true, - aProperties = [], - bProperties = []; - - // comparing constructors is more strict than using - // instanceof - if ( a.constructor !== b.constructor ) { - // Allow objects with no prototype to be equivalent to - // objects with Object as their constructor. - if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || + }, + + // - skip when the property is a method of an instance (OOP) + // - abort otherwise, + // initial === would have catch identical references anyway + 'function': function() { + const caller = callers[callers.length - 1]; + return caller !== Object && typeof caller !== 'undefined'; + }, + + 'array': function( b, a ) { + let i; let j; let len; let loop; let aCircular; let bCircular; + + // b could be an object literal here + if ( QUnit.objectType( b ) !== 'array' ) { + return false; + } + + len = a.length; + if ( len !== b.length ) { + // safe and faster + return false; + } + + // track reference to avoid circular references + parents.push( a ); + parentsB.push( b ); + for ( i = 0; i < len; i++ ) { + loop = false; + for ( j = 0; j < parents.length; j++ ) { + aCircular = parents[j] === a[i]; + bCircular = parentsB[j] === b[i]; + if ( aCircular || bCircular ) { + if ( a[i] === b[i] || aCircular && bCircular ) { + loop = true; + } else { + parents.pop(); + parentsB.pop(); + return false; + } + } + } + if ( !loop && !innerEquiv(a[i], b[i]) ) { + parents.pop(); + parentsB.pop(); + return false; + } + } + parents.pop(); + parentsB.pop(); + return true; + }, + + 'object': function( b, a ) { + /* jshint forin:false */ + let i; let j; let loop; let aCircular; let bCircular; + // Default to true + let eq = true; + const aProperties = []; + const bProperties = []; + + // comparing constructors is more strict than using + // instanceof + if ( a.constructor !== b.constructor ) { + // Allow objects with no prototype to be equivalent to + // objects with Object as their constructor. + if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || ( getProto(b) === null && getProto(a) === Object.prototype ) ) ) { - return false; - } - } - - // stack constructor before traversing properties - callers.push( a.constructor ); - - // track reference to avoid circular references - parents.push( a ); - parentsB.push( b ); - - // be strict: don't ensure hasOwnProperty and go deep - for ( i in a ) { - loop = false; - for ( j = 0; j < parents.length; j++ ) { - aCircular = parents[j] === a[i]; - bCircular = parentsB[j] === b[i]; - if ( aCircular || bCircular ) { - if ( a[i] === b[i] || aCircular && bCircular ) { - loop = true; - } else { - eq = false; - break; - } - } - } - aProperties.push(i); - if ( !loop && !innerEquiv(a[i], b[i]) ) { - eq = false; - break; - } - } - - parents.pop(); - parentsB.pop(); - callers.pop(); // unstack, we are done - - for ( i in b ) { - bProperties.push( i ); // collect b's properties - } - - // Ensures identical properties name - return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); - } - }; - }()); - - innerEquiv = function() { // can take multiple arguments - var args = [].slice.apply( arguments ); - if ( args.length < 2 ) { - return true; // end transition - } - - return (function( a, b ) { - if ( a === b ) { - return true; // catch the most you can - } else if ( a === null || b === null || typeof a === "undefined" || - typeof b === "undefined" || + return false; + } + } + + // stack constructor before traversing properties + callers.push( a.constructor ); + + // track reference to avoid circular references + parents.push( a ); + parentsB.push( b ); + + // be strict: don't ensure hasOwnProperty and go deep + for ( i in a ) { + loop = false; + for ( j = 0; j < parents.length; j++ ) { + aCircular = parents[j] === a[i]; + bCircular = parentsB[j] === b[i]; + if ( aCircular || bCircular ) { + if ( a[i] === b[i] || aCircular && bCircular ) { + loop = true; + } else { + eq = false; + break; + } + } + } + aProperties.push(i); + if ( !loop && !innerEquiv(a[i], b[i]) ) { + eq = false; + break; + } + } + + parents.pop(); + parentsB.pop(); + callers.pop(); // unstack, we are done + + for ( i in b ) { + bProperties.push( i ); // collect b's properties + } + + // Ensures identical properties name + return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); + }, + }; + }()); + + innerEquiv = function() { // can take multiple arguments + const args = [].slice.apply( arguments ); + if ( args.length < 2 ) { + return true; // end transition + } + + return (function( a, b ) { + if ( a === b ) { + return true; // catch the most you can + } else if ( a === null || b === null || typeof a === 'undefined' || + typeof b === 'undefined' || QUnit.objectType(a) !== QUnit.objectType(b) ) { - return false; // don't lose time with error prone cases - } else { - return bindCallbacks(a, callbacks, [ b, a ]); - } + return false; // don't lose time with error prone cases + } else { + return bindCallbacks(a, callbacks, [b, a]); + } - // apply transition with (1..n) arguments - }( args[0], args[1] ) && innerEquiv.apply( this, args.splice(1, args.length - 1 )) ); - }; + // apply transition with (1..n) arguments + }( args[0], args[1] ) && innerEquiv.apply( this, args.splice(1, args.length - 1 )) ); + }; - return innerEquiv; -}()); + return innerEquiv; + }()); -/** + /** * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | * http://flesler.blogspot.com Licensed under BSD * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 @@ -1901,228 +1892,228 @@ QUnit.equiv = (function() { * @author Ariel Flesler * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} */ -QUnit.jsDump = (function() { - function quote( str ) { - return "\"" + str.toString().replace( /"/g, "\\\"" ) + "\""; - } - function literal( o ) { - return o + ""; - } - function join( pre, arr, post ) { - var s = jsDump.separator(), - base = jsDump.indent(), - inner = jsDump.indent(1); - if ( arr.join ) { - arr = arr.join( "," + s + inner ); - } - if ( !arr ) { - return pre + post; - } - return [ pre, inner + arr, base + post ].join(s); - } - function array( arr, stack ) { - var i = arr.length, ret = new Array(i); - this.up(); - while ( i-- ) { - ret[i] = this.parse( arr[i] , undefined , stack); - } - this.down(); - return join( "[", ret, "]" ); - } - - var reName = /^function (\w+)/, - jsDump = { - // type is used mostly internally, you can fix a (custom)type in advance - parse: function( obj, type, stack ) { - stack = stack || [ ]; - var inStack, res, - parser = this.parsers[ type || this.typeOf(obj) ]; - - type = typeof parser; - inStack = inArray( obj, stack ); - - if ( inStack !== -1 ) { - return "recursion(" + (inStack - stack.length) + ")"; - } - if ( type === "function" ) { - stack.push( obj ); - res = parser.call( this, obj, stack ); - stack.pop(); - return res; - } - return ( type === "string" ) ? parser : this.parsers.error; - }, - typeOf: function( obj ) { - var type; - if ( obj === null ) { - type = "null"; - } else if ( typeof obj === "undefined" ) { - type = "undefined"; - } else if ( QUnit.is( "regexp", obj) ) { - type = "regexp"; - } else if ( QUnit.is( "date", obj) ) { - type = "date"; - } else if ( QUnit.is( "function", obj) ) { - type = "function"; - } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) { - type = "window"; - } else if ( obj.nodeType === 9 ) { - type = "document"; - } else if ( obj.nodeType ) { - type = "node"; - } else if ( - // native arrays - toString.call( obj ) === "[object Array]" || + QUnit.jsDump = (function() { + function quote( str ) { + return '"' + str.toString().replace( /"/g, '\\"' ) + '"'; + } + function literal( o ) { + return o + ''; + } + function join( pre, arr, post ) { + const s = jsDump.separator(); + const base = jsDump.indent(); + const inner = jsDump.indent(1); + if ( arr.join ) { + arr = arr.join( ',' + s + inner ); + } + if ( !arr ) { + return pre + post; + } + return [pre, inner + arr, base + post].join(s); + } + function array( arr, stack ) { + let i = arr.length; const ret = new Array(i); + this.up(); + while ( i-- ) { + ret[i] = this.parse( arr[i], undefined, stack); + } + this.down(); + return join( '[', ret, ']' ); + } + + const reName = /^function (\w+)/; + var jsDump = { + // type is used mostly internally, you can fix a (custom)type in advance + parse: function( obj, type, stack ) { + stack = stack || []; + let inStack; let res; + const parser = this.parsers[type || this.typeOf(obj)]; + + type = typeof parser; + inStack = inArray( obj, stack ); + + if ( inStack !== -1 ) { + return 'recursion(' + (inStack - stack.length) + ')'; + } + if ( type === 'function' ) { + stack.push( obj ); + res = parser.call( this, obj, stack ); + stack.pop(); + return res; + } + return ( type === 'string' ) ? parser : this.parsers.error; + }, + typeOf: function( obj ) { + let type; + if ( obj === null ) { + type = 'null'; + } else if ( typeof obj === 'undefined' ) { + type = 'undefined'; + } else if ( QUnit.is( 'regexp', obj) ) { + type = 'regexp'; + } else if ( QUnit.is( 'date', obj) ) { + type = 'date'; + } else if ( QUnit.is( 'function', obj) ) { + type = 'function'; + } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== 'undefined' && typeof obj.nodeType === 'undefined' ) { + type = 'window'; + } else if ( obj.nodeType === 9 ) { + type = 'document'; + } else if ( obj.nodeType ) { + type = 'node'; + } else if ( + // native arrays + toString.call( obj ) === '[object Array]' || // NodeList objects - ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) - ) { - type = "array"; - } else if ( obj.constructor === Error.prototype.constructor ) { - type = "error"; - } else { - type = typeof obj; - } - return type; - }, - separator: function() { - return this.multiline ? this.HTML ? "
          " : "\n" : this.HTML ? " " : " "; - }, - // extra can be a number, shortcut for increasing-calling-decreasing - indent: function( extra ) { - if ( !this.multiline ) { - return ""; - } - var chr = this.indentChar; - if ( this.HTML ) { - chr = chr.replace( /\t/g, " " ).replace( / /g, " " ); - } - return new Array( this.depth + ( extra || 0 ) ).join(chr); - }, - up: function( a ) { - this.depth += a || 1; - }, - down: function( a ) { - this.depth -= a || 1; - }, - setParser: function( name, parser ) { - this.parsers[name] = parser; - }, - // The next 3 are exposed so you can use them - quote: quote, - literal: literal, - join: join, - // - depth: 1, - // This is the list of parsers, to modify them, use jsDump.setParser - parsers: { - window: "[Window]", - document: "[Document]", - error: function(error) { - return "Error(\"" + error.message + "\")"; - }, - unknown: "[Unknown]", - "null": "null", - "undefined": "undefined", - "function": function( fn ) { - var ret = "function", - // functions never have name in IE - name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1]; - - if ( name ) { - ret += " " + name; - } - ret += "( "; - - ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" ); - return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" ); - }, - array: array, - nodelist: array, - "arguments": array, - object: function( map, stack ) { - /*jshint forin:false */ - var ret = [ ], keys, key, val, i; - QUnit.jsDump.up(); - keys = []; - for ( key in map ) { - keys.push( key ); - } - keys.sort(); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - val = map[ key ]; - ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) ); - } - QUnit.jsDump.down(); - return join( "{", ret, "}" ); - }, - node: function( node ) { - var len, i, val, - open = QUnit.jsDump.HTML ? "<" : "<", - close = QUnit.jsDump.HTML ? ">" : ">", - tag = node.nodeName.toLowerCase(), - ret = open + tag, - attrs = node.attributes; - - if ( attrs ) { - for ( i = 0, len = attrs.length; i < len; i++ ) { - val = attrs[i].nodeValue; - // IE6 includes all attributes in .attributes, even ones not explicitly set. - // Those have values like undefined, null, 0, false, "" or "inherit". - if ( val && val !== "inherit" ) { - ret += " " + attrs[i].nodeName + "=" + QUnit.jsDump.parse( val, "attribute" ); - } - } - } - ret += close; - - // Show content of TextNode or CDATASection - if ( node.nodeType === 3 || node.nodeType === 4 ) { - ret += node.nodeValue; - } - - return ret + open + "/" + tag + close; - }, - // function calls it internally, it's the arguments part of the function - functionArgs: function( fn ) { - var args, - l = fn.length; - - if ( !l ) { - return ""; - } - - args = new Array(l); - while ( l-- ) { - // 97 is 'a' - args[l] = String.fromCharCode(97+l); - } - return " " + args.join( ", " ) + " "; - }, - // object calls it internally, the key part of an item in a map - key: quote, - // function calls it internally, it's the content of the function - functionCode: "[code]", - // node calls it internally, it's an html attribute value - attribute: quote, - string: quote, - date: quote, - regexp: literal, - number: literal, - "boolean": literal - }, - // if true, entities are escaped ( <, >, \t, space and \n ) - HTML: false, - // indentation unit - indentChar: " ", - // if true, items in a collection, are separated by a \n, else just a space. - multiline: true - }; - - return jsDump; -}()); - -/* + ( typeof obj.length === 'number' && typeof obj.item !== 'undefined' && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === 'undefined' ) ) ) + ) { + type = 'array'; + } else if ( obj.constructor === Error.prototype.constructor ) { + type = 'error'; + } else { + type = typeof obj; + } + return type; + }, + separator: function() { + return this.multiline ? this.HTML ? '
          ' : '\n' : this.HTML ? ' ' : ' '; + }, + // extra can be a number, shortcut for increasing-calling-decreasing + indent: function( extra ) { + if ( !this.multiline ) { + return ''; + } + let chr = this.indentChar; + if ( this.HTML ) { + chr = chr.replace( /\t/g, ' ' ).replace( / /g, ' ' ); + } + return new Array( this.depth + ( extra || 0 ) ).join(chr); + }, + up: function( a ) { + this.depth += a || 1; + }, + down: function( a ) { + this.depth -= a || 1; + }, + setParser: function( name, parser ) { + this.parsers[name] = parser; + }, + // The next 3 are exposed so you can use them + quote: quote, + literal: literal, + join: join, + // + depth: 1, + // This is the list of parsers, to modify them, use jsDump.setParser + parsers: { + 'window': '[Window]', + 'document': '[Document]', + 'error': function(error) { + return 'Error("' + error.message + '")'; + }, + 'unknown': '[Unknown]', + 'null': 'null', + 'undefined': 'undefined', + 'function': function( fn ) { + let ret = 'function'; + // functions never have name in IE + const name = 'name' in fn ? fn.name : (reName.exec(fn) || [])[1]; + + if ( name ) { + ret += ' ' + name; + } + ret += '( '; + + ret = [ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join( '' ); + return join( ret, QUnit.jsDump.parse(fn, 'functionCode' ), '}' ); + }, + 'array': array, + 'nodelist': array, + 'arguments': array, + 'object': function( map, stack ) { + /* jshint forin:false */ + const ret = []; let keys; let key; let val; let i; + QUnit.jsDump.up(); + keys = []; + for ( key in map ) { + keys.push( key ); + } + keys.sort(); + for ( i = 0; i < keys.length; i++ ) { + key = keys[i]; + val = map[key]; + ret.push( QUnit.jsDump.parse( key, 'key' ) + ': ' + QUnit.jsDump.parse( val, undefined, stack ) ); + } + QUnit.jsDump.down(); + return join( '{', ret, '}' ); + }, + 'node': function( node ) { + let len; let i; let val; + const open = QUnit.jsDump.HTML ? '<' : '<'; + const close = QUnit.jsDump.HTML ? '>' : '>'; + const tag = node.nodeName.toLowerCase(); + let ret = open + tag; + const attrs = node.attributes; + + if ( attrs ) { + for ( i = 0, len = attrs.length; i < len; i++ ) { + val = attrs[i].nodeValue; + // IE6 includes all attributes in .attributes, even ones not explicitly set. + // Those have values like undefined, null, 0, false, "" or "inherit". + if ( val && val !== 'inherit' ) { + ret += ' ' + attrs[i].nodeName + '=' + QUnit.jsDump.parse( val, 'attribute' ); + } + } + } + ret += close; + + // Show content of TextNode or CDATASection + if ( node.nodeType === 3 || node.nodeType === 4 ) { + ret += node.nodeValue; + } + + return ret + open + '/' + tag + close; + }, + // function calls it internally, it's the arguments part of the function + 'functionArgs': function( fn ) { + let args; + let l = fn.length; + + if ( !l ) { + return ''; + } + + args = new Array(l); + while ( l-- ) { + // 97 is 'a' + args[l] = String.fromCharCode(97+l); + } + return ' ' + args.join( ', ' ) + ' '; + }, + // object calls it internally, the key part of an item in a map + 'key': quote, + // function calls it internally, it's the content of the function + 'functionCode': '[code]', + // node calls it internally, it's an html attribute value + 'attribute': quote, + 'string': quote, + 'date': quote, + 'regexp': literal, + 'number': literal, + 'boolean': literal, + }, + // if true, entities are escaped ( <, >, \t, space and \n ) + HTML: false, + // indentation unit + indentChar: ' ', + // if true, items in a collection, are separated by a \n, else just a space. + multiline: true, + }; + + return jsDump; + }()); + + /* * Javascript Diff Algorithm * By John Resig (http://ejohn.org/) * Modified by Chu Alan "sprite" @@ -2136,153 +2127,147 @@ QUnit.jsDump = (function() { * * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick brown fox jumped jumps over" */ -QUnit.diff = (function() { - /*jshint eqeqeq:false, eqnull:true */ - function diff( o, n ) { - var i, - ns = {}, - os = {}; - - for ( i = 0; i < n.length; i++ ) { - if ( !hasOwn.call( ns, n[i] ) ) { - ns[ n[i] ] = { - rows: [], - o: null - }; - } - ns[ n[i] ].rows.push( i ); - } - - for ( i = 0; i < o.length; i++ ) { - if ( !hasOwn.call( os, o[i] ) ) { - os[ o[i] ] = { - rows: [], - n: null - }; - } - os[ o[i] ].rows.push( i ); - } - - for ( i in ns ) { - if ( hasOwn.call( ns, i ) ) { - if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { - n[ ns[i].rows[0] ] = { - text: n[ ns[i].rows[0] ], - row: os[i].rows[0] - }; - o[ os[i].rows[0] ] = { - text: o[ os[i].rows[0] ], - row: ns[i].rows[0] - }; - } - } - } - - for ( i = 0; i < n.length - 1; i++ ) { - if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null && - n[ i + 1 ] == o[ n[i].row + 1 ] ) { - - n[ i + 1 ] = { - text: n[ i + 1 ], - row: n[i].row + 1 - }; - o[ n[i].row + 1 ] = { - text: o[ n[i].row + 1 ], - row: i + 1 - }; - } - } - - for ( i = n.length - 1; i > 0; i-- ) { - if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null && - n[ i - 1 ] == o[ n[i].row - 1 ]) { - - n[ i - 1 ] = { - text: n[ i - 1 ], - row: n[i].row - 1 - }; - o[ n[i].row - 1 ] = { - text: o[ n[i].row - 1 ], - row: i - 1 - }; - } - } - - return { - o: o, - n: n - }; - } - - return function( o, n ) { - o = o.replace( /\s+$/, "" ); - n = n.replace( /\s+$/, "" ); - - var i, pre, - str = "", - out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ), - oSpace = o.match(/\s+/g), - nSpace = n.match(/\s+/g); - - if ( oSpace == null ) { - oSpace = [ " " ]; - } - else { - oSpace.push( " " ); - } - - if ( nSpace == null ) { - nSpace = [ " " ]; - } - else { - nSpace.push( " " ); - } - - if ( out.n.length === 0 ) { - for ( i = 0; i < out.o.length; i++ ) { - str += "" + out.o[i] + oSpace[i] + ""; - } - } - else { - if ( out.n[0].text == null ) { - for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { - str += "" + out.o[n] + oSpace[n] + ""; - } - } - - for ( i = 0; i < out.n.length; i++ ) { - if (out.n[i].text == null) { - str += "" + out.n[i] + nSpace[i] + ""; - } - else { - // `pre` initialized at top of scope - pre = ""; - - for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { - pre += "" + out.o[n] + oSpace[n] + ""; - } - str += " " + out.n[i].text + nSpace[i] + pre; - } - } - } - - return str; - }; -}()); - -// For browser, export only select globals -if ( typeof window !== "undefined" ) { - extend( window, QUnit.constructor.prototype ); - window.QUnit = QUnit; -} - -// For CommonJS environments, export everything -if ( typeof module !== "undefined" && module.exports ) { - module.exports = QUnit; -} + QUnit.diff = (function() { + /* jshint eqeqeq:false, eqnull:true */ + function diff( o, n ) { + let i; + const ns = {}; + const os = {}; + + for ( i = 0; i < n.length; i++ ) { + if ( !hasOwn.call( ns, n[i] ) ) { + ns[n[i]] = { + rows: [], + o: null, + }; + } + ns[n[i]].rows.push( i ); + } + + for ( i = 0; i < o.length; i++ ) { + if ( !hasOwn.call( os, o[i] ) ) { + os[o[i]] = { + rows: [], + n: null, + }; + } + os[o[i]].rows.push( i ); + } + + for ( i in ns ) { + if ( hasOwn.call( ns, i ) ) { + if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { + n[ns[i].rows[0]] = { + text: n[ns[i].rows[0]], + row: os[i].rows[0], + }; + o[os[i].rows[0]] = { + text: o[os[i].rows[0]], + row: ns[i].rows[0], + }; + } + } + } + + for ( i = 0; i < n.length - 1; i++ ) { + if ( n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null && + n[i + 1] == o[n[i].row + 1] ) { + n[i + 1] = { + text: n[i + 1], + row: n[i].row + 1, + }; + o[n[i].row + 1] = { + text: o[n[i].row + 1], + row: i + 1, + }; + } + } + + for ( i = n.length - 1; i > 0; i-- ) { + if ( n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null && + n[i - 1] == o[n[i].row - 1]) { + n[i - 1] = { + text: n[i - 1], + row: n[i].row - 1, + }; + o[n[i].row - 1] = { + text: o[n[i].row - 1], + row: i - 1, + }; + } + } + + return { + o: o, + n: n, + }; + } + + return function( o, n ) { + o = o.replace( /\s+$/, '' ); + n = n.replace( /\s+$/, '' ); + + let i; let pre; + let str = ''; + const out = diff( o === '' ? [] : o.split(/\s+/), n === '' ? [] : n.split(/\s+/) ); + let oSpace = o.match(/\s+/g); + let nSpace = n.match(/\s+/g); + + if ( oSpace == null ) { + oSpace = [' ']; + } else { + oSpace.push( ' ' ); + } + + if ( nSpace == null ) { + nSpace = [' ']; + } else { + nSpace.push( ' ' ); + } + + if ( out.n.length === 0 ) { + for ( i = 0; i < out.o.length; i++ ) { + str += '' + out.o[i] + oSpace[i] + ''; + } + } else { + if ( out.n[0].text == null ) { + for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { + str += '' + out.o[n] + oSpace[n] + ''; + } + } + + for ( i = 0; i < out.n.length; i++ ) { + if (out.n[i].text == null) { + str += '' + out.n[i] + nSpace[i] + ''; + } else { + // `pre` initialized at top of scope + pre = ''; + + for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { + pre += '' + out.o[n] + oSpace[n] + ''; + } + str += ' ' + out.n[i].text + nSpace[i] + pre; + } + } + } + + return str; + }; + }()); + + // For browser, export only select globals + if ( typeof window !== 'undefined' ) { + extend( window, QUnit.constructor.prototype ); + window.QUnit = QUnit; + } + + // For CommonJS environments, export everything + if ( typeof module !== 'undefined' && module.exports ) { + module.exports = QUnit; + } // Get a reference to the global object, like window in browsers }( (function() { - return this; + return this; })() )); diff --git a/examples/qunit/tests/test.js b/examples/qunit/tests/test.js index f202988..982aea6 100644 --- a/examples/qunit/tests/test.js +++ b/examples/qunit/tests/test.js @@ -1,9 +1,9 @@ -test("module without setup/teardown (default)", function () { +test('module without setup/teardown (default)', function() { expect(1); ok(true); }); -test("expect in test", 3, function () { +test('expect in test', 3, function() { ok(true); ok(true); ok(true); diff --git a/examples/yui/Gruntfile.js b/examples/yui/Gruntfile.js index 8ea7bcd..ad38143 100644 --- a/examples/yui/Gruntfile.js +++ b/examples/yui/Gruntfile.js @@ -1,56 +1,56 @@ -module.exports = function (grunt) { - var browsers = [{ +module.exports = function(grunt) { + const browsers = [{ browserName: 'firefox', version: '19', - platform: 'XP' + platform: 'XP', }, { browserName: 'googlechrome', - platform: 'XP' + platform: 'XP', }, { browserName: 'googlechrome', - platform: 'linux' + platform: 'linux', }, { browserName: 'internet explorer', platform: 'WIN8', - version: '10' + version: '10', }, { browserName: 'internet explorer', platform: 'VISTA', - version: '9' + version: '9', }]; grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - connect: { + 'pkg': grunt.file.readJSON('package.json'), + 'connect': { server: { options: { base: '', - port: 9999 - } - } + port: 9999, + }, + }, }, 'saucelabs-yui': { all: { options: { urls: [ - 'http://127.0.0.1:9999/index.html' + 'http://127.0.0.1:9999/index.html', ], browsers: browsers, build: process.env.TRAVIS_JOB_ID, testname: 'YUI tests', throttled: 3, sauceConfig: { - 'video-upload-on-pass': false - } - } - } + 'video-upload-on-pass': false, + }, + }, + }, }, - watch: {} + 'watch': {}, }); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-saucelabs'); grunt.registerTask('default', ['connect', 'saucelabs-yui']); -}; \ No newline at end of file +}; diff --git a/examples/yui/spec/tests.js b/examples/yui/spec/tests.js index 00cbfcc..57d75f1 100644 --- a/examples/yui/spec/tests.js +++ b/examples/yui/spec/tests.js @@ -1,100 +1,99 @@ -YUI().add('example-tests', function (Y) { +YUI().add('example-tests', function(Y) { + const dataTestCase = new Y.Test.Case({ - var dataTestCase = new Y.Test.Case({ + // name of the test case - if not provided, one is auto-generated + name: 'Data Tests', - //name of the test case - if not provided, one is auto-generated - name: "Data Tests", - - //--------------------------------------------------------------------- + // --------------------------------------------------------------------- // setUp and tearDown methods - optional - //--------------------------------------------------------------------- + // --------------------------------------------------------------------- /* * Sets up data that is needed by each test. */ - setUp: function () { + setUp: function() { this.data = { - name: "test", + name: 'test', year: 2007, - beta: true + beta: true, }; }, /* * Cleans up everything that was created by setUp(). */ - tearDown: function () { + tearDown: function() { delete this.data; }, - //--------------------------------------------------------------------- + // --------------------------------------------------------------------- // Test methods - names must begin with "test" - //--------------------------------------------------------------------- + // --------------------------------------------------------------------- - testName: function () { - var Assert = Y.Assert; + testName: function() { + const Assert = Y.Assert; Assert.isObject(this.data); Assert.isString(this.data.name); - Assert.areEqual("test", this.data.name); + Assert.areEqual('test', this.data.name); }, - testYear: function () { - var Assert = Y.Assert; + testYear: function() { + const Assert = Y.Assert; Assert.isObject(this.data); Assert.isNumber(this.data.year); Assert.areEqual(2007, this.data.year); }, - testBeta: function () { - var Assert = Y.Assert; + testBeta: function() { + const Assert = Y.Assert; Assert.isObject(this.data); Assert.isBoolean(this.data.beta); Assert.isTrue(this.data.beta); - } + }, }); - var arrayTestCase = new Y.Test.Case({ + const arrayTestCase = new Y.Test.Case({ - //name of the test case - if not provided, one is auto-generated - name: "Array Tests", + // name of the test case - if not provided, one is auto-generated + name: 'Array Tests', - //--------------------------------------------------------------------- + // --------------------------------------------------------------------- // setUp and tearDown methods - optional - //--------------------------------------------------------------------- + // --------------------------------------------------------------------- /* * Sets up data that is needed by each test. */ - setUp: function () { - this.data = [0, 1, 2, 3, 4] + setUp: function() { + this.data = [0, 1, 2, 3, 4]; }, /* * Cleans up everything that was created by setUp(). */ - tearDown: function () { + tearDown: function() { delete this.data; }, - //--------------------------------------------------------------------- + // --------------------------------------------------------------------- // Test methods - names must begin with "test" - //--------------------------------------------------------------------- + // --------------------------------------------------------------------- - testPop: function () { - var Assert = Y.Assert; + testPop: function() { + const Assert = Y.Assert; - var value = this.data.pop(); + const value = this.data.pop(); Assert.areEqual(4, this.data.length); Assert.areEqual(4, value); }, - testPush: function () { - var Assert = Y.Assert; + testPush: function() { + const Assert = Y.Assert; this.data.push(5); @@ -102,23 +101,23 @@ Assert.areEqual(5, this.data[5]); }, - testSplice: function () { - var Assert = Y.Assert; + testSplice: function() { + const Assert = Y.Assert; this.data.splice(2, 1, 6, 7); Assert.areEqual(6, this.data.length); Assert.areEqual(6, this.data[2]); Assert.areEqual(7, this.data[3]); - } + }, }); - var exampleSuite = new Y.Test.Suite("Example Suite"); + const exampleSuite = new Y.Test.Suite('Example Suite'); exampleSuite.add(dataTestCase); exampleSuite.add(arrayTestCase); Y.Test.Runner.add(exampleSuite); }, '0.0.1', { - requires: ['test'] -}); \ No newline at end of file + requires: ['test'], +}); diff --git a/grunt/aliases.js b/grunt/aliases.js index 90fb63b..4809b9b 100644 --- a/grunt/aliases.js +++ b/grunt/aliases.js @@ -1,8 +1,8 @@ 'use strict'; -module.exports = function (grunt) { - var testjobs = ['jscs', 'jshint', 'connect']; - var positiveTests = [ +module.exports = function(grunt) { + let testjobs = ['jscs', 'jshint', 'connect']; + const positiveTests = [ 'saucelabs-qunit:succeeds', 'saucelabs-jasmine:succeeds', 'saucelabs-mocha:succeeds', @@ -10,14 +10,14 @@ module.exports = function (grunt) { 'saucelabs-custom:callback-succeeds', 'saucelabs-custom:callback-async-succeeds', 'saucelabs-custom:throttled', - 'saucelabs-custom:timeout' + 'saucelabs-custom:timeout', ]; - var negativeTests = [ + const negativeTests = [ 'saucelabs-qunit:fails', 'saucelabs-jasmine:fails', 'saucelabs-mocha:fails', 'saucelabs-custom:fails', - 'saucelabs-qunit:error' + 'saucelabs-qunit:error', ]; if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined') { diff --git a/grunt/connect.js b/grunt/connect.js index dd32ae9..fbc0c1b 100644 --- a/grunt/connect.js +++ b/grunt/connect.js @@ -4,7 +4,7 @@ module.exports = { server: { options: { base: 'test', - port: 9999 - } - } -}; \ No newline at end of file + port: 9999, + }, + }, +}; diff --git a/grunt/jscs.js b/grunt/jscs.js index d39d0a4..8a90207 100644 --- a/grunt/jscs.js +++ b/grunt/jscs.js @@ -1,7 +1,7 @@ 'use strict'; -module.exports = function (grunt, options) { +module.exports = function(grunt, options) { return { - src: options.srcFiles + src: options.srcFiles, }; -}; \ No newline at end of file +}; diff --git a/grunt/jshint.js b/grunt/jshint.js index e106511..3cca033 100644 --- a/grunt/jshint.js +++ b/grunt/jshint.js @@ -1,10 +1,10 @@ 'use strict'; -module.exports = function (grunt, options) { +module.exports = function(grunt, options) { return { options: { - jshintrc: true + jshintrc: true, }, - all: options.srcFiles + all: options.srcFiles, }; -}; \ No newline at end of file +}; diff --git a/grunt/sauce_tunnel.js b/grunt/sauce_tunnel.js index 503268e..f44fd65 100644 --- a/grunt/sauce_tunnel.js +++ b/grunt/sauce_tunnel.js @@ -1,12 +1,12 @@ 'use strict'; -module.exports = function (grunt, options) { +module.exports = function(grunt, options) { return { options: { username: process.env.SAUCE_USERNAME, key: process.env.SAUCE_ACCESS_KEY, - identifier: options.tunnelId + identifier: options.tunnelId, }, - server: {} + server: {}, }; -}; \ No newline at end of file +}; diff --git a/grunt/sauce_tunnel_stop.js b/grunt/sauce_tunnel_stop.js index 503268e..f44fd65 100644 --- a/grunt/sauce_tunnel_stop.js +++ b/grunt/sauce_tunnel_stop.js @@ -1,12 +1,12 @@ 'use strict'; -module.exports = function (grunt, options) { +module.exports = function(grunt, options) { return { options: { username: process.env.SAUCE_USERNAME, key: process.env.SAUCE_ACCESS_KEY, - identifier: options.tunnelId + identifier: options.tunnelId, }, - server: {} + server: {}, }; -}; \ No newline at end of file +}; diff --git a/grunt/saucelabs-custom.js b/grunt/saucelabs-custom.js index d339d52..1cbf3e8 100644 --- a/grunt/saucelabs-custom.js +++ b/grunt/saucelabs-custom.js @@ -1,92 +1,95 @@ 'use strict'; -module.exports = function (grunt, options) { - - var Q = require('q'); - var utils = require('../src/utils')(grunt); +module.exports = function(grunt, options) { + const Q = require('q'); + const utils = require('../src/utils')(grunt); /** * Updates a job's attributes. * * @param {String} jobId - Job ID. * @param {Object} attributes - The attributes to update. - * @returns {Object} - A promise which will eventually be resolved after the job is + * @return {Object} - A promise which will eventually be resolved after the job is * updated. */ function updateJob(jobId, attributes) { - var user = process.env.SAUCE_USERNAME; - var pass = process.env.SAUCE_ACCESS_KEY; + const user = process.env.SAUCE_USERNAME; + const pass = process.env.SAUCE_ACCESS_KEY; return utils - .makeRequest({ - method: 'PUT', - url: ['https://saucelabs.com/rest/v1', user, 'jobs', jobId].join('/'), - auth: { user: user, pass: pass }, - json: attributes - }); + .makeRequest({ + method: 'PUT', + url: ['https://saucelabs.com/rest/v1', user, 'jobs', jobId].join('/'), + auth: {user: user, pass: pass}, + json: attributes, + }); } return { - options: options.baseSaucelabsTaskOptions, + 'options': options.baseSaucelabsTaskOptions, 'tunnel-test': { options: { urls: ['http://127.0.0.1:9999/custom/succeeds.html'], testname: 'saucelabs-custom:tunnel-test', - tunneled: true - } + tunneled: true, + }, }, - succeeds: { + 'succeeds': { options: { urls: ['http://127.0.0.1:9999/custom/succeeds.html'], - testname: 'saucelabs-custom:succeeds' - } + testname: 'saucelabs-custom:succeeds', + }, }, - fails: { + 'fails': { options: { urls: ['http://127.0.0.1:9999/custom/fails.html'], testname: 'saucelabs-custom:fails', - onTestComplete: options.negateResult - } + onTestComplete: options.negateResult, + }, }, 'callback-succeeds': { options: { urls: ['http://127.0.0.1:9999/custom/succeeds.html'], testname: 'saucelabs-custom:callback-succeeds', - onTestComplete: function (result, callback) { callback(null, result.passed); } - } + onTestComplete: function(result, callback) { + callback(null, result.passed); + }, + }, }, 'callback-async-succeeds': { options: { urls: ['http://127.0.0.1:9999/custom/succeeds.html'], testname: 'saucelabs-custom:callback-async-succeeds', - onTestComplete: function (result, callback) { return Q.delay(3000).thenResolve(result.passed).nodeify(callback); } - } + onTestComplete: function(result, callback) { + return Q.delay(3000).thenResolve(result.passed).nodeify(callback); + }, + }, }, - throttled: { + 'throttled': { options: { browsers: [ - { browserName: 'firefox', version: '19', platform: 'XP' }, - { browserName: 'googlechrome', platform: 'XP' }, - { browserName: 'googlechrome', platform: 'linux' }, - { browserName: 'internet explorer', platform: 'WIN8', version: '10' }, - { browserName: 'internet explorer', platform: 'VISTA', version: '9' } + {browserName: 'firefox', version: '19', platform: 'XP'}, + {browserName: 'googlechrome', platform: 'XP'}, + {browserName: 'googlechrome', platform: 'linux'}, + {browserName: 'internet explorer', platform: 'WIN8', version: '10'}, + {browserName: 'internet explorer', platform: 'VISTA', version: '9'}, ], urls: [ 'http://127.0.0.1:9999/custom/succeeds.html', 'http://127.0.0.1:9999/custom/succeeds2.html', - 'http://127.0.0.1:9999/custom/succeeds3.html' + 'http://127.0.0.1:9999/custom/succeeds3.html', ], throttled: 3, - testname: 'saucelabs-custom:throttled' - } + testname: 'saucelabs-custom:throttled', + }, }, - timeout: { + 'timeout': { options: { - urls: ['http://127.0.0.1:9999/custom/timeout.html'], - testname: 'saucelabs-custom:timeout', + 'urls': ['http://127.0.0.1:9999/custom/timeout.html'], + 'testname': 'saucelabs-custom:timeout', 'max-duration': 3, - maxRetries: 2, - onTestComplete: function (result, callback) { + 'maxRetries': 2, + 'onTestComplete': function(result, callback) { if (result.passed) { return Q(false).nodeify(callback); } @@ -94,11 +97,11 @@ module.exports = function (grunt, options) { // can't automate this without an ugly hack, it must be done manually grunt.log.writeln('Please check that 2 retrying attempts were logged to the console.'); - return updateJob(result.job_id, { passed: true }) - .thenResolve(true) - .nodeify(callback); - } - } - } + return updateJob(result.job_id, {passed: true}) + .thenResolve(true) + .nodeify(callback); + }, + }, + }, }; }; diff --git a/grunt/saucelabs-jasmine.js b/grunt/saucelabs-jasmine.js index ebd19bd..3a6cf39 100644 --- a/grunt/saucelabs-jasmine.js +++ b/grunt/saucelabs-jasmine.js @@ -1,21 +1,20 @@ 'use strict'; -module.exports = function (grunt, options) { - +module.exports = function(grunt, options) { return { options: options.baseSaucelabsTaskOptions, succeeds: { options: { urls: ['http://127.0.0.1:9999/jasmine/succeeds.html'], - testname: 'saucelabs-jasmine:succeeds' - } + testname: 'saucelabs-jasmine:succeeds', + }, }, fails: { options: { urls: ['http://127.0.0.1:9999/jasmine/fails.html'], testname: 'saucelabs-jasmine:fails', - onTestComplete: options.negateResult - } - } + onTestComplete: options.negateResult, + }, + }, }; }; diff --git a/grunt/saucelabs-mocha.js b/grunt/saucelabs-mocha.js index 166a9d2..568cbe1 100644 --- a/grunt/saucelabs-mocha.js +++ b/grunt/saucelabs-mocha.js @@ -1,21 +1,20 @@ 'use strict'; -module.exports = function (grunt, options) { - +module.exports = function(grunt, options) { return { options: options.baseSaucelabsTaskOptions, succeeds: { options: { urls: ['http://127.0.0.1:9999/mocha/test/browser/index.html'], - testname: 'saucelabs-mocha:succeeds' - } + testname: 'saucelabs-mocha:succeeds', + }, }, fails: { options: { urls: ['http://127.0.0.1:9999/mocha/test/browser/fails.html'], testname: 'saucelabs-mocha:fails', - onTestComplete: options.negateResult - } - } + onTestComplete: options.negateResult, + }, + }, }; }; diff --git a/grunt/saucelabs-qunit.js b/grunt/saucelabs-qunit.js index 656ee81..494ac40 100644 --- a/grunt/saucelabs-qunit.js +++ b/grunt/saucelabs-qunit.js @@ -1,21 +1,20 @@ 'use strict'; -module.exports = function (grunt, options) { - +module.exports = function(grunt, options) { return { options: options.baseSaucelabsTaskOptions, succeeds: { options: { urls: ['http://127.0.0.1:9999/qunit/index.html'], - testname: 'saucelabs-qunit:succeeds' - } + testname: 'saucelabs-qunit:succeeds', + }, }, fails: { options: { urls: ['http://127.0.0.1:9999/qunit/fails.html'], testname: 'saucelabs-qunit:fails', - onTestComplete: options.negateResult - } + onTestComplete: options.negateResult, + }, }, error: { // Tests whether Sauce Labs 'errors' are handled. Sauce Labs errors are those where @@ -24,8 +23,8 @@ module.exports = function (grunt, options) { options: { urls: ['http://127.0.0.1:9999/qunit/error.html'], testname: 'saucelabs-qunit:error', - onTestComplete: options.negateResult - } - } + onTestComplete: options.negateResult, + }, + }, }; }; diff --git a/grunt/watch.js b/grunt/watch.js index 41952db..8b46fbb 100644 --- a/grunt/watch.js +++ b/grunt/watch.js @@ -1,3 +1,3 @@ 'use strict'; -module.exports = {}; \ No newline at end of file +module.exports = {}; diff --git a/package-lock.json b/package-lock.json index 17081bd..29d0b57 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,69 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", + "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, "JSV": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz", @@ -26,10 +89,10 @@ "negotiator": "0.6.2" } }, - "acorn": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", - "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "acorn-jsx": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz", + "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==", "dev": true }, "agent-base": { @@ -51,38 +114,18 @@ "uri-js": "^4.2.2" } }, - "align-text": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", - "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", - "dev": true, - "requires": { - "kind-of": "^3.0.2", - "longest": "^1.0.1", - "repeat-string": "^1.5.2" - } - }, - "alter": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/alter/-/alter-0.2.0.tgz", - "integrity": "sha1-x1iICGF1cgNKrmJICvJrHU0cs80=", - "dev": true, - "requires": { - "stable": "~0.1.3" - } - }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true - }, "ansi": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/ansi/-/ansi-0.3.1.tgz", "integrity": "sha1-DELU+xcWDVqa8eSEus4cZpIsGyE=", "dev": true }, + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "dev": true + }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -104,48 +147,36 @@ } }, "argparse": { - "version": "0.1.16", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz", - "integrity": "sha1-z9AeD7uj1srtBJ+9dY1A9lGW9Xw=", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { - "underscore": "~1.7.0", - "underscore.string": "~2.4.0" - }, - "dependencies": { - "underscore.string": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz", - "integrity": "sha1-jN2PusTi0uoefi6Al8QvRCKA+Fs=", - "dev": true - } + "sprintf-js": "~1.0.2" } }, "array-differ": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", - "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", "dev": true }, - "array-union": { + "array-find-index": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "dev": true, - "requires": { - "array-uniq": "^1.0.1" - } + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true }, "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", "dev": true }, "asn1": { @@ -161,22 +192,16 @@ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, - "ast-traverse": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ast-traverse/-/ast-traverse-0.1.1.tgz", - "integrity": "sha1-ac8rg4bxnc2hux4F1o/jWdiJfeY=", - "dev": true - }, - "ast-types": { - "version": "0.9.6", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.6.tgz", - "integrity": "sha1-ECyenpAF0+fjgpvwxPok7oYu6bk=", + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", "dev": true }, "async": { - "version": "0.1.22", - "resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz", - "integrity": "sha1-D8GqoIig4+8Ovi2IMbqw3PiEUGE=", + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, "asynckit": { @@ -200,210 +225,20 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, - "babel-core": { - "version": "5.8.38", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-5.8.38.tgz", - "integrity": "sha1-H8ruedfmG3ULALjlT238nQr4ZVg=", - "dev": true, - "requires": { - "babel-plugin-constant-folding": "^1.0.1", - "babel-plugin-dead-code-elimination": "^1.0.2", - "babel-plugin-eval": "^1.0.1", - "babel-plugin-inline-environment-variables": "^1.0.1", - "babel-plugin-jscript": "^1.0.4", - "babel-plugin-member-expression-literals": "^1.0.1", - "babel-plugin-property-literals": "^1.0.1", - "babel-plugin-proto-to-assign": "^1.0.3", - "babel-plugin-react-constant-elements": "^1.0.3", - "babel-plugin-react-display-name": "^1.0.3", - "babel-plugin-remove-console": "^1.0.1", - "babel-plugin-remove-debugger": "^1.0.1", - "babel-plugin-runtime": "^1.0.7", - "babel-plugin-undeclared-variables-check": "^1.0.2", - "babel-plugin-undefined-to-void": "^1.1.6", - "babylon": "^5.8.38", - "bluebird": "^2.9.33", - "chalk": "^1.0.0", - "convert-source-map": "^1.1.0", - "core-js": "^1.0.0", - "debug": "^2.1.1", - "detect-indent": "^3.0.0", - "esutils": "^2.0.0", - "fs-readdir-recursive": "^0.1.0", - "globals": "^6.4.0", - "home-or-tmp": "^1.0.0", - "is-integer": "^1.0.4", - "js-tokens": "1.0.1", - "json5": "^0.4.0", - "lodash": "^3.10.0", - "minimatch": "^2.0.3", - "output-file-sync": "^1.1.0", - "path-exists": "^1.0.0", - "path-is-absolute": "^1.0.0", - "private": "^0.1.6", - "regenerator": "0.8.40", - "regexpu": "^1.3.0", - "repeating": "^1.1.2", - "resolve": "^1.1.6", - "shebang-regex": "^1.0.0", - "slash": "^1.0.0", - "source-map": "^0.5.0", - "source-map-support": "^0.2.10", - "to-fast-properties": "^1.0.0", - "trim-right": "^1.0.0", - "try-resolve": "^1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "lodash": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", - "dev": true - }, - "minimatch": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", - "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", - "dev": true, - "requires": { - "brace-expansion": "^1.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "babel-jscs": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/babel-jscs/-/babel-jscs-2.0.5.tgz", - "integrity": "sha1-CjRwRrSBRay8pW6MjtX3NrxU+dA=", - "dev": true, - "requires": { - "babel-core": "~5.8.3", - "lodash.assign": "^3.2.0" - } - }, - "babel-plugin-constant-folding": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-constant-folding/-/babel-plugin-constant-folding-1.0.1.tgz", - "integrity": "sha1-g2HTZMmORJw2kr26Ue/whEKQqo4=", - "dev": true - }, - "babel-plugin-dead-code-elimination": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/babel-plugin-dead-code-elimination/-/babel-plugin-dead-code-elimination-1.0.2.tgz", - "integrity": "sha1-X3xFEnTc18zNv7s+C4XdKBIfD2U=", - "dev": true - }, - "babel-plugin-eval": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-eval/-/babel-plugin-eval-1.0.1.tgz", - "integrity": "sha1-ovrtJc5r5preS/7CY/cBaRlZUNo=", - "dev": true - }, - "babel-plugin-inline-environment-variables": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-inline-environment-variables/-/babel-plugin-inline-environment-variables-1.0.1.tgz", - "integrity": "sha1-H1jOkSB61qgmqL9kX6/mj/X+P/4=", - "dev": true - }, - "babel-plugin-jscript": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/babel-plugin-jscript/-/babel-plugin-jscript-1.0.4.tgz", - "integrity": "sha1-jzQsOCduh6R9X6CovT1etsytj8w=", - "dev": true - }, - "babel-plugin-member-expression-literals": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-member-expression-literals/-/babel-plugin-member-expression-literals-1.0.1.tgz", - "integrity": "sha1-zF7bD6qNyScXDnTW0cAkQAIWJNM=", - "dev": true - }, - "babel-plugin-property-literals": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-property-literals/-/babel-plugin-property-literals-1.0.1.tgz", - "integrity": "sha1-AlIwGQAZKYCxwRjv6kjOk6q4MzY=", - "dev": true - }, - "babel-plugin-proto-to-assign": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/babel-plugin-proto-to-assign/-/babel-plugin-proto-to-assign-1.0.4.tgz", - "integrity": "sha1-xJ56/QL1d7xNoF6i3wAiUM980SM=", + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "dev": true, "requires": { - "lodash": "^3.9.3" - }, - "dependencies": { - "lodash": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", - "dev": true - } + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" } }, - "babel-plugin-react-constant-elements": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/babel-plugin-react-constant-elements/-/babel-plugin-react-constant-elements-1.0.3.tgz", - "integrity": "sha1-lGc26DeEKcvDSdz/YvUcFDs041o=", - "dev": true - }, - "babel-plugin-react-display-name": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/babel-plugin-react-display-name/-/babel-plugin-react-display-name-1.0.3.tgz", - "integrity": "sha1-dU/jiSboQkpOexWrbqYTne4FFPw=", - "dev": true - }, - "babel-plugin-remove-console": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-remove-console/-/babel-plugin-remove-console-1.0.1.tgz", - "integrity": "sha1-2PJFVsOgUAXUKqqv0neH9T/wE6c=", - "dev": true - }, - "babel-plugin-remove-debugger": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-remove-debugger/-/babel-plugin-remove-debugger-1.0.1.tgz", - "integrity": "sha1-/S6jzWGkKK0fO5yJiC/0KT6MFMc=", - "dev": true - }, - "babel-plugin-runtime": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/babel-plugin-runtime/-/babel-plugin-runtime-1.0.7.tgz", - "integrity": "sha1-v3x9lm3Vbs1cF/ocslPJrLflSq8=", - "dev": true - }, - "babel-plugin-undeclared-variables-check": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/babel-plugin-undeclared-variables-check/-/babel-plugin-undeclared-variables-check-1.0.2.tgz", - "integrity": "sha1-XPGqU52BP/ZOmWQSkK9iCWX2Xe4=", - "dev": true, - "requires": { - "leven": "^1.0.2" - } - }, - "babel-plugin-undefined-to-void": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/babel-plugin-undefined-to-void/-/babel-plugin-undefined-to-void-1.1.6.tgz", - "integrity": "sha1-f1eO+LeN+uYAM4XYQXph7aBuL4E=", - "dev": true - }, "babylon": { - "version": "5.8.38", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-5.8.38.tgz", - "integrity": "sha1-7JsSCxG/bM1Bc6GL8hfmC3mFn/0=", + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", "dev": true }, "balanced-match": { @@ -443,11 +278,17 @@ "tweetnacl": "^0.14.3" } }, - "bluebird": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", - "integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE=", - "dev": true + "body": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/body/-/body-5.1.0.tgz", + "integrity": "sha1-5LoM5BCkaTYyM2dgnstOZVMSUGk=", + "dev": true, + "requires": { + "continuable-cache": "^0.3.1", + "error": "^7.0.0", + "raw-body": "~1.1.0", + "safe-json-parse": "~1.0.1" + } }, "boom": { "version": "0.4.2", @@ -476,33 +317,39 @@ "concat-map": "0.0.1" } }, - "breakable": { + "bytes": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/breakable/-/breakable-1.0.0.tgz", - "integrity": "sha1-eEp5eRWjjq0nutRWtVcstLuqeME=", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-1.0.0.tgz", + "integrity": "sha1-NWnt6Lo0MV+rmcPpLLBMciDeH6g=", + "dev": true + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, "camelcase": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", "dev": true }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + } + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, - "center-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", - "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", - "dev": true, - "requires": { - "align-text": "^0.1.3", - "lazy-cache": "^1.0.3" - } - }, "chalk": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", @@ -515,6 +362,12 @@ "supports-color": "^2.0.0" } }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, "cli": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cli/-/cli-1.0.1.tgz", @@ -550,6 +403,15 @@ } } }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, "cli-table": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz", @@ -567,21 +429,31 @@ } } }, - "cliui": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "coffeescript": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-1.10.0.tgz", + "integrity": "sha1-56qDAZF+9iGzXYo580jc3R234z4=", + "dev": true + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "requires": { - "center-align": "^0.1.1", - "right-align": "^0.1.1", - "wordwrap": "0.0.2" + "color-name": "1.1.3" } }, - "coffee-script": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.3.3.tgz", - "integrity": "sha1-FQ1rTLUiiUNp7+1qIQHCC8f0pPQ=", + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, "colors": { @@ -653,80 +525,6 @@ } } }, - "commoner": { - "version": "0.10.8", - "resolved": "https://registry.npmjs.org/commoner/-/commoner-0.10.8.tgz", - "integrity": "sha1-NPw2cs0kOT6LtH5wyqApOBH08sU=", - "dev": true, - "requires": { - "commander": "^2.5.0", - "detective": "^4.3.1", - "glob": "^5.0.15", - "graceful-fs": "^4.1.2", - "iconv-lite": "^0.4.5", - "mkdirp": "^0.5.0", - "private": "^0.1.6", - "q": "^1.1.2", - "recast": "^0.11.17" - }, - "dependencies": { - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - }, - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true, - "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "recast": { - "version": "0.11.23", - "resolved": "https://registry.npmjs.org/recast/-/recast-0.11.23.tgz", - "integrity": "sha1-RR/TAEqx5N+bTktmN2sqIZEkYtM=", - "dev": true, - "requires": { - "ast-types": "0.9.6", - "esprima": "~3.1.0", - "private": "~0.1.5", - "source-map": "~0.5.0" - } - } - } - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -777,22 +575,11 @@ "date-now": "^0.1.4" } }, - "convert-source-map": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", - "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - } - } + "continuable-cache": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/continuable-cache/-/continuable-cache-0.3.1.tgz", + "integrity": "sha1-vXJ6f67XfnH/OYWskzUakSczrQ8=", + "dev": true }, "cookie-jar": { "version": "0.3.0", @@ -801,9 +588,9 @@ "dev": true }, "core-js": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", - "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", + "version": "2.6.10", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.10.tgz", + "integrity": "sha512-I39t74+4t+zau64EN1fE5v2W31Adtc/REhzWN+gWRRXg6WH5qAsZm62DHpQ1+Yhe4047T55jvzz7MUqF/dBBlA==", "dev": true }, "core-util-is": { @@ -811,6 +598,36 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "cryptiles": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-0.2.2.tgz", @@ -821,16 +638,17 @@ } }, "cson": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/cson/-/cson-3.0.2.tgz", - "integrity": "sha1-g+6Qids8JUvsHpjkmNmqzxGtzFQ=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cson/-/cson-5.1.0.tgz", + "integrity": "sha512-hh97pBcNEc24OQn+CBYu1pp9kcEqp3dE0oO52QIoQkDREnZYHUD1YcKcGvHU+k9lgCmIXHslJfGTie58zjhLnA==", "dev": true, "requires": { - "coffee-script": "^1.9.0", - "cson-parser": "^1.0.6", - "extract-opts": "^3.0.1", - "requirefresh": "^2.0.0", - "safefs": "^4.0.0" + "coffee-script": "^1.12.7", + "cson-parser": "^1.3.4", + "editions": "^1.3.3", + "extract-opts": "^3.3.1", + "requirefresh": "^2.1.0", + "safefs": "^4.1.0" }, "dependencies": { "coffee-script": { @@ -858,28 +676,38 @@ } } }, + "cst": { + "version": "0.4.10", + "resolved": "https://registry.npmjs.org/cst/-/cst-0.4.10.tgz", + "integrity": "sha512-U5ETe1IOjq2h56ZcBE3oe9rT7XryCH6IKgPMv0L7sSk6w29yR3p5egCK0T3BDNHHV95OoUBgXsqiVG+3a900Ag==", + "dev": true, + "requires": { + "babel-runtime": "^6.9.2", + "babylon": "^6.8.1", + "source-map-support": "^0.4.0" + } + }, "ctype": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.2.tgz", "integrity": "sha1-/oCR1Gijc6Cwyf+Lv7NCXACXOh0=", "dev": true }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "^1.0.1" + } + }, "cycle": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", "integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI=", "dev": true }, - "d": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", - "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", - "dev": true, - "requires": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" - } - }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -895,10 +723,14 @@ "dev": true }, "dateformat": { - "version": "1.0.2-1.2.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz", - "integrity": "sha1-sCIMAt6YYXQztyhRz0fePfLNvuk=", - "dev": true + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", + "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1", + "meow": "^3.3.0" + } }, "debug": { "version": "3.2.6", @@ -928,6 +760,12 @@ "regexp.prototype.flags": "^1.2.0" } }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -937,38 +775,6 @@ "object-keys": "^1.0.12" } }, - "defined": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", - "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", - "dev": true - }, - "defs": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/defs/-/defs-1.1.1.tgz", - "integrity": "sha1-siYJ8sehG6ej2xFoBcE5scr/qdI=", - "dev": true, - "requires": { - "alter": "~0.2.0", - "ast-traverse": "~0.1.1", - "breakable": "~1.0.0", - "esprima-fb": "~15001.1001.0-dev-harmony-fb", - "simple-fmt": "~0.1.0", - "simple-is": "~0.2.0", - "stringmap": "~0.2.2", - "stringset": "~0.2.1", - "tryor": "~0.1.2", - "yargs": "~3.27.0" - }, - "dependencies": { - "esprima-fb": { - "version": "15001.1001.0-dev-harmony-fb", - "resolved": "https://registry.npmjs.org/esprima-fb/-/esprima-fb-15001.1001.0-dev-harmony-fb.tgz", - "integrity": "sha1-Q761fsJujPI3092LM+QlM1d/Jlk=", - "dev": true - } - } - }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -992,25 +798,13 @@ "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", "dev": true }, - "detect-indent": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-3.0.1.tgz", - "integrity": "sha1-ncXl3bzu+DJXZLlFGwK8bVQIT3U=", - "dev": true, - "requires": { - "get-stdin": "^4.0.1", - "minimist": "^1.1.0", - "repeating": "^1.1.0" - } - }, - "detective": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/detective/-/detective-4.7.1.tgz", - "integrity": "sha512-H6PmeeUcZloWtdt4DAkFyzFL94arpHr3NOwwmVILFiy+9Qd4JTxxXrzfyGk/lmct2qVGBwTSwSXagqu2BxmWig==", + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dev": true, "requires": { - "acorn": "^5.2.1", - "defined": "^1.0.0" + "esutils": "^2.0.2" } }, "dom-serializer": { @@ -1093,6 +887,12 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", "dev": true }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -1126,40 +926,22 @@ } } }, - "es5-ext": { - "version": "0.10.51", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz", - "integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==", - "dev": true, - "requires": { - "es6-iterator": "~2.0.3", - "es6-symbol": "~3.1.1", - "next-tick": "^1.0.0" - } - }, - "es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", + "error": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/error/-/error-7.2.0.tgz", + "integrity": "sha512-M6t3j3Vt3uDicrViMP5fLq2AeADNrCVFD8Oj4Qt2MHsX0mPYG7D5XdnEfSdRpaHQzjAJ19wu+I1mw9rQYMTAPg==", "dev": true, "requires": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" + "string-template": "~0.2.1" } }, - "es6-map": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", - "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "dev": true, "requires": { - "d": "1", - "es5-ext": "~0.10.14", - "es6-iterator": "~2.0.1", - "es6-set": "~0.1.5", - "es6-symbol": "~3.1.1", - "event-emitter": "~0.3.5" + "is-arrayish": "^0.2.1" } }, "es6-promise": { @@ -1175,82 +957,234 @@ "es6-promise": "^4.0.3" } }, - "es6-set": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", - "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "~0.10.14", - "es6-iterator": "~2.0.1", - "es6-symbol": "3.1.1", - "event-emitter": "~0.3.5" + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "eslint": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.5.1.tgz", + "integrity": "sha512-32h99BoLYStT1iq1v2P9uwpyznQ4M2jRiFB6acitKz52Gqn+vPaMDUTB1bYi1WN4Nquj2w+t+bimYUG83DC55A==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.10.0", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^1.4.2", + "eslint-visitor-keys": "^1.1.0", + "espree": "^6.1.1", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^11.7.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "inquirer": "^6.4.1", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.14", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.2", + "progress": "^2.0.0", + "regexpp": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" }, "dependencies": { - "es6-symbol": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", - "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { - "d": "1", - "es5-ext": "~0.10.14" + "color-convert": "^1.9.0" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "strip-json-comments": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" } } } }, - "es6-symbol": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.2.tgz", - "integrity": "sha512-/ZypxQsArlv+KHpGvng52/Iz8by3EQPxhmbuz8yFG89N/caTFBSbcXONDw0aMjy827gQg26XAjP4uXFvnfINmQ==", + "eslint-config-google": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/eslint-config-google/-/eslint-config-google-0.14.0.tgz", + "integrity": "sha512-WsbX4WbjuMvTdeVL6+J3rK1RGhCTqjsFjX7UMSMgZiyxxaNLkoJENbrGExzERFeoTpGw3F3FypTiWAP9ZXzkEw==", + "dev": true + }, + "eslint-scope": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", "dev": true, "requires": { - "d": "^1.0.1", - "es5-ext": "^0.10.51" + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" } }, - "es6-weak-map": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz", - "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", + "eslint-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", "dev": true, "requires": { - "d": "1", - "es5-ext": "^0.10.46", - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.1" + "eslint-visitor-keys": "^1.1.0" } }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "eslint-visitor-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", + "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", "dev": true }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, - "escope": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", - "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", + "espree": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz", + "integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==", "dev": true, "requires": { - "es6-map": "^0.1.3", - "es6-weak-map": "^2.0.1", - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" + "acorn": "^7.1.0", + "acorn-jsx": "^5.1.0", + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "acorn": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", + "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", + "dev": true + } } }, "esprima": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", - "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, + "esquery": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "dev": true, + "requires": { + "estraverse": "^4.0.0" + } + }, "esrecurse": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", @@ -1278,16 +1212,6 @@ "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", "dev": true }, - "event-emitter": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", - "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "~0.10.14" - } - }, "eventemitter2": { "version": "0.4.14", "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", @@ -1305,6 +1229,28 @@ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } + } + }, "extract-opts": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/extract-opts/-/extract-opts-3.3.1.tgz", @@ -1337,26 +1283,37 @@ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, - "faye-websocket": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.4.4.tgz", - "integrity": "sha1-wUxbO/FNdBf/v9mQwKdJXNnzN7w=", + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, - "fg-lodash": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/fg-lodash/-/fg-lodash-0.0.2.tgz", - "integrity": "sha1-mINSU39CfaavIiEpu2OsyknmL6M=", + "faye-websocket": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz", + "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", + "dev": true, "requires": { - "lodash": "^2.4.1", - "underscore.string": "~2.3.3" - }, - "dependencies": { - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" - } + "websocket-driver": ">=0.5.1" + } + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "dev": true, + "requires": { + "flat-cache": "^2.0.1" } }, "finalhandler": { @@ -1399,57 +1356,83 @@ "requires": { "path-exists": "^2.0.0", "pinkie-promise": "^2.0.0" + } + }, + "findup-sync": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz", + "integrity": "sha1-N5MKpdgWt3fANEXhlmzGeQpMCxY=", + "dev": true, + "requires": { + "glob": "~5.0.0" }, "dependencies": { - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", "dev": true, "requires": { - "pinkie-promise": "^2.0.0" + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } } } }, - "findup-sync": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", - "integrity": "sha1-fz56l7gjksZTvwZYm9hRkOk8NoM=", + "flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", "dev": true, "requires": { - "glob": "~3.2.9", - "lodash": "~2.4.1" + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" }, "dependencies": { "glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", - "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz", + "integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "inherits": "2", - "minimatch": "0.3" + "brace-expansion": "^1.1.7" } }, - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", - "dev": true - }, - "minimatch": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", - "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "dev": true, "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" + "glob": "^7.1.3" } } } }, + "flatted": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", + "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", + "dev": true + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -1471,12 +1454,6 @@ "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", "dev": true }, - "fs-readdir-recursive": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-0.1.2.tgz", - "integrity": "sha1-MVtPuMHKW4xH3v7zGdBz2tNWgFk=", - "dev": true - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -1489,6 +1466,12 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "gauge": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/gauge/-/gauge-1.2.7.tgz", @@ -1503,12 +1486,12 @@ } }, "gaze": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz", - "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", + "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", "dev": true, "requires": { - "globule": "~0.1.0" + "globule": "^1.0.0" } }, "get-stdin": { @@ -1532,53 +1515,59 @@ } }, "glob": { - "version": "3.1.21", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", - "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz", + "integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=", "dev": true, "requires": { - "graceful-fs": "~1.2.0", - "inherits": "1", - "minimatch": "~0.2.11" - }, - "dependencies": { - "inherits": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", - "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=", - "dev": true - } + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, - "globals": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/globals/-/globals-6.4.1.tgz", - "integrity": "sha1-hJgDKzttHMge68X3lpDY/in6v08=", - "dev": true + "glob-parent": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", + "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } }, "globule": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", - "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.2.1.tgz", + "integrity": "sha512-g7QtgWF4uYSL5/dn71WxubOrS7JVGCnFPEnoeChJmBnyR9Mw8nGoEwOgJL/RC2Te0WhbsEUCejfH8SZNJ+adYQ==", "dev": true, "requires": { - "glob": "~3.1.21", - "lodash": "~1.0.1", - "minimatch": "~0.2.11" + "glob": "~7.1.1", + "lodash": "~4.17.10", + "minimatch": "~3.0.2" }, "dependencies": { - "lodash": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", - "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", - "dev": true + "glob": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz", + "integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } } } }, "graceful-fs": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", - "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", "dev": true }, "graceful-readlink": { @@ -1588,49 +1577,46 @@ "dev": true }, "grunt": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-0.4.5.tgz", - "integrity": "sha1-VpN81RlDJK3/bSB2MYMqnWuk5/A=", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.4.tgz", + "integrity": "sha512-PYsMOrOC+MsdGEkFVwMaMyc6Ob7pKmq+deg1Sjr+vvMWp35sztfwKE7qoN51V+UEtHsyNuMcGdgMLFkBHvMxHQ==", "dev": true, "requires": { - "async": "~0.1.22", - "coffee-script": "~1.3.3", - "colors": "~0.6.2", - "dateformat": "1.0.2-1.2.3", + "coffeescript": "~1.10.0", + "dateformat": "~1.0.12", "eventemitter2": "~0.4.13", "exit": "~0.1.1", - "findup-sync": "~0.1.2", - "getobject": "~0.1.0", - "glob": "~3.1.21", - "grunt-legacy-log": "~0.1.0", - "grunt-legacy-util": "~0.2.0", - "hooker": "~0.2.3", - "iconv-lite": "~0.2.11", - "js-yaml": "~2.0.5", - "lodash": "~0.9.2", - "minimatch": "~0.2.12", - "nopt": "~1.0.10", - "rimraf": "~2.2.8", - "underscore.string": "~2.2.1", - "which": "~1.0.5" + "findup-sync": "~0.3.0", + "glob": "~7.0.0", + "grunt-cli": "~1.2.0", + "grunt-known-options": "~1.1.0", + "grunt-legacy-log": "~2.0.0", + "grunt-legacy-util": "~1.1.1", + "iconv-lite": "~0.4.13", + "js-yaml": "~3.13.0", + "minimatch": "~3.0.2", + "mkdirp": "~0.5.1", + "nopt": "~3.0.6", + "path-is-absolute": "~1.0.0", + "rimraf": "~2.6.2" }, "dependencies": { - "colors": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", - "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=", - "dev": true - }, - "lodash": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz", - "integrity": "sha1-jzSZxSRdNG1oLlsNO0B2fgnxqSw=", - "dev": true + "grunt-cli": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.2.0.tgz", + "integrity": "sha1-VisRnrsGndtGSs4oRVAb6Xs1tqg=", + "dev": true, + "requires": { + "findup-sync": "~0.3.0", + "grunt-known-options": "~1.1.0", + "nopt": "~3.0.6", + "resolve": "~1.1.0" + } }, - "underscore.string": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz", - "integrity": "sha1-18D6KvXVoaZ/QlPa7pgTLnM/Dxk=", + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", "dev": true } } @@ -1670,39 +1656,36 @@ } }, "grunt-contrib-watch": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/grunt-contrib-watch/-/grunt-contrib-watch-0.6.1.tgz", - "integrity": "sha1-ZP3LolpjX1tNobbOb5DaCutuPxU=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/grunt-contrib-watch/-/grunt-contrib-watch-1.1.0.tgz", + "integrity": "sha512-yGweN+0DW5yM+oo58fRu/XIRrPcn3r4tQx+nL7eMRwjpvk+rQY6R8o94BPK0i2UhTg9FN21hS+m8vR8v9vXfeg==", "dev": true, "requires": { - "async": "~0.2.9", - "gaze": "~0.5.1", - "lodash": "~2.4.1", - "tiny-lr-fork": "0.0.5" + "async": "^2.6.0", + "gaze": "^1.1.0", + "lodash": "^4.17.10", + "tiny-lr": "^1.1.1" }, "dependencies": { "async": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", - "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", - "dev": true - }, - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", - "dev": true + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "requires": { + "lodash": "^4.17.14" + } } } }, "grunt-jscs": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/grunt-jscs/-/grunt-jscs-2.8.0.tgz", - "integrity": "sha1-nc81LFY6Mi2Adl/pIsLNoqRkzto=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/grunt-jscs/-/grunt-jscs-3.0.1.tgz", + "integrity": "sha1-H65Q4+lV3546nZQlrsIqzK4AgJI=", "dev": true, "requires": { "hooker": "~0.2.3", - "jscs": "~2.11.0", + "jscs": "~3.0.5", "lodash": "~4.6.1", "vow": "~0.4.1" }, @@ -1715,85 +1698,78 @@ } } }, + "grunt-known-options": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-1.1.1.tgz", + "integrity": "sha512-cHwsLqoighpu7TuYj5RonnEuxGVFnztcUqTqp5rXFGYL4OuPFofwC4Ycg7n9fYwvK6F5WbYgeVOwph9Crs2fsQ==", + "dev": true + }, "grunt-legacy-log": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-0.1.3.tgz", - "integrity": "sha1-7ClCboAwIa9ZAp+H0vnNczWgVTE=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-2.0.0.tgz", + "integrity": "sha512-1m3+5QvDYfR1ltr8hjiaiNjddxGdQWcH0rw1iKKiQnF0+xtgTazirSTGu68RchPyh1OBng1bBUjLmX8q9NpoCw==", "dev": true, "requires": { - "colors": "~0.6.2", - "grunt-legacy-log-utils": "~0.1.1", + "colors": "~1.1.2", + "grunt-legacy-log-utils": "~2.0.0", "hooker": "~0.2.3", - "lodash": "~2.4.1", - "underscore.string": "~2.3.3" - }, - "dependencies": { - "colors": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", - "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=", - "dev": true - }, - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", - "dev": true - } + "lodash": "~4.17.5" } }, "grunt-legacy-log-utils": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-0.1.1.tgz", - "integrity": "sha1-wHBrndkGThFvNvI/5OawSGcsD34=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-2.0.1.tgz", + "integrity": "sha512-o7uHyO/J+i2tXG8r2bZNlVk20vlIFJ9IEYyHMCQGfWYru8Jv3wTqKZzvV30YW9rWEjq0eP3cflQ1qWojIe9VFA==", "dev": true, "requires": { - "colors": "~0.6.2", - "lodash": "~2.4.1", - "underscore.string": "~2.3.3" + "chalk": "~2.4.1", + "lodash": "~4.17.10" }, "dependencies": { - "colors": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", - "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=", - "dev": true + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } }, - "lodash": { + "chalk": { "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", - "dev": true + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, "grunt-legacy-util": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-0.2.0.tgz", - "integrity": "sha1-kzJIhNv343qf98Am3/RR2UqeVUs=", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-1.1.1.tgz", + "integrity": "sha512-9zyA29w/fBe6BIfjGENndwoe1Uy31BIXxTH3s8mga0Z5Bz2Sp4UCjkeyv2tI449ymkx3x26B+46FV4fXEddl5A==", "dev": true, "requires": { - "async": "~0.1.22", + "async": "~1.5.2", "exit": "~0.1.1", "getobject": "~0.1.0", "hooker": "~0.2.3", - "lodash": "~0.9.2", - "underscore.string": "~2.2.1", - "which": "~1.0.5" - }, - "dependencies": { - "lodash": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz", - "integrity": "sha1-jzSZxSRdNG1oLlsNO0B2fgnxqSw=", - "dev": true - }, - "underscore.string": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz", - "integrity": "sha1-18D6KvXVoaZ/QlPa7pgTLnM/Dxk=", - "dev": true - } + "lodash": "~4.17.10", + "underscore.string": "~3.3.4", + "which": "~1.3.0" } }, "grunt-sauce-tunnel": { @@ -1994,6 +1970,12 @@ "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", "dev": true }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, "has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", @@ -2018,22 +2000,18 @@ "integrity": "sha1-Hp/XcO9+vgJ0rfy1sIBqAlpeTp8=", "dev": true }, - "home-or-tmp": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-1.0.0.tgz", - "integrity": "sha1-S58eQIAMPlDGwn94FnavzOcfOYU=", - "dev": true, - "requires": { - "os-tmpdir": "^1.0.1", - "user-home": "^1.1.1" - } - }, "hooker": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", "integrity": "sha1-uDT3I8xKJCqmWWNFnfbZhMXT2Vk=", "dev": true }, + "hosted-git-info": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz", + "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==", + "dev": true + }, "htmlparser2": { "version": "3.8.3", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", @@ -2067,6 +2045,12 @@ } } }, + "http-parser-js": { + "version": "0.4.10", + "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.10.tgz", + "integrity": "sha1-ksnBN0w1CF912zWexWzCV8u5P6Q=", + "dev": true + }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -2093,11 +2077,45 @@ "dev": true }, "iconv-lite": { - "version": "0.2.11", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz", - "integrity": "sha1-HOYKOleGSiktEyH/RgnKS7llrcg=", + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "import-fresh": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz", + "integrity": "sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -2120,11 +2138,78 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "dev": true + "inquirer": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz", + "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", + "dev": true, + "requires": { + "ansi-escapes": "^3.2.0", + "chalk": "^2.4.2", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^2.0.0", + "lodash": "^4.17.12", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^6.4.0", + "string-width": "^2.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } }, "is-arguments": { "version": "1.0.4", @@ -2132,10 +2217,10 @@ "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==", "dev": true }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, "is-date-object": { @@ -2144,6 +2229,12 @@ "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", "dev": true }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, "is-finite": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", @@ -2153,15 +2244,27 @@ "number-is-nan": "^1.0.0" } }, - "is-integer": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-integer/-/is-integer-1.0.7.tgz", - "integrity": "sha1-a96Bqs3feLZZtmKdYpytxRqIbVw=", + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", "dev": true, "requires": { - "is-finite": "^1.0.0" + "is-extglob": "^2.1.1" } }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, "is-regex": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", @@ -2188,6 +2291,12 @@ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -2199,20 +2308,14 @@ "integrity": "sha1-AIw6f+Hpa9DYTiYOofoXg0V/ecI=", "dev": true }, - "js-tokens": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-1.0.1.tgz", - "integrity": "sha1-zENaXIuUrRWst5gxQPyAGCyJrq4=", - "dev": true - }, "js-yaml": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-2.0.5.tgz", - "integrity": "sha1-olrmUJmZ6X3yeMZxnaEb0Gh3Q6g=", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { - "argparse": "~ 0.1.11", - "esprima": "~ 1.0.2" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } }, "jsbn": { @@ -2221,23 +2324,21 @@ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, "jscs": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/jscs/-/jscs-2.11.0.tgz", - "integrity": "sha1-bhHvDKqgdzH53MKysn2OzuHdvLY=", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/jscs/-/jscs-3.0.7.tgz", + "integrity": "sha1-cUG03/W4bjLQ6Z12S4NnZ8MNIBo=", "dev": true, "requires": { - "babel-jscs": "^2.0.0", "chalk": "~1.1.0", "cli-table": "~0.3.1", "commander": "~2.9.0", - "escope": "^3.2.0", - "esprima": "~2.7.0", + "cst": "^0.4.3", "estraverse": "^4.1.0", "exit": "~0.1.2", "glob": "^5.0.1", "htmlparser2": "3.8.3", "js-yaml": "~3.4.0", - "jscs-jsdoc": "^1.3.1", + "jscs-jsdoc": "^2.0.0", "jscs-preset-wikimedia": "~1.0.0", "jsonlint": "~1.6.2", "lodash": "~3.10.0", @@ -2256,15 +2357,6 @@ "xmlbuilder": "^3.1.0" }, "dependencies": { - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, "esprima": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", @@ -2300,22 +2392,13 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } } } }, "jscs-jsdoc": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/jscs-jsdoc/-/jscs-jsdoc-1.3.2.tgz", - "integrity": "sha1-HyyCtqtLl1JNqVj0a05WLgMF+ac=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/jscs-jsdoc/-/jscs-jsdoc-2.0.0.tgz", + "integrity": "sha1-9T684CmqMSW9iCkLpQ1k1FEKSHE=", "dev": true, "requires": { "comment-parser": "^0.3.1", @@ -2345,12 +2428,6 @@ } } }, - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true - }, "jshint": { "version": "2.9.7", "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.9.7.tgz", @@ -2388,17 +2465,17 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, - "json5": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.4.0.tgz", - "integrity": "sha1-BUNS5MTIDIbAkjh31EneF2pzLI0=", - "dev": true - }, "jsonlint": { "version": "1.6.3", "resolved": "https://registry.npmjs.org/jsonlint/-/jsonlint-1.6.3.tgz", @@ -2417,203 +2494,102 @@ "assert-plus": "1.0.0", "extsprintf": "1.3.0", "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "lazy-cache": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", - "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", - "dev": true + "verror": "1.10.0" + } }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", "dev": true, "requires": { - "invert-kv": "^1.0.0" + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" } }, - "leven": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/leven/-/leven-1.0.2.tgz", - "integrity": "sha1-kUS27ryl8dBoAWnxpncNzqYLdcM=", + "livereload-js": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/livereload-js/-/livereload-js-2.4.0.tgz", + "integrity": "sha512-XPQH8Z2GDP/Hwz2PCDrh2mth4yFejwA1OZ/81Ti3LgKyhDcEjsSsqFWZojHG0va/duGd+WyosY7eXLDoOyqcPw==", "dev": true }, "load-grunt-config": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/load-grunt-config/-/load-grunt-config-0.19.2.tgz", - "integrity": "sha1-UgkNSiDG5j90p2SPJJsZ57f87CQ=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/load-grunt-config/-/load-grunt-config-3.0.1.tgz", + "integrity": "sha512-kFzYN8roBa+owMyGlEKyui6JzWpM1tMH8xn0AejiLgXAT4Kh275cPwin7GjNrKZKul8viWK0Caa6OaUJLXXpkA==", "dev": true, "requires": { - "cson": "~3.0.2", - "glob": "~5.0.15", - "jit-grunt": "~0.10.0", - "js-yaml": "~3.4.3", - "load-grunt-tasks": "~3.3.0", - "lodash": "~3.10.1" + "cson": "5.1.0", + "glob": "7.1.4", + "jit-grunt": "0.10.0", + "js-yaml": "3.13.1", + "load-grunt-tasks": "5.1.0", + "lodash": "4.17.15" }, "dependencies": { - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", "dev": true, "requires": { + "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "2 || 3", + "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } - }, - "js-yaml": { - "version": "3.4.6", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.4.6.tgz", - "integrity": "sha1-a+GyP2JJ9T0pM3D9TRqqY84bTrA=", - "dev": true, - "requires": { - "argparse": "^1.0.2", - "esprima": "^2.6.0", - "inherit": "^2.2.2" - } - }, - "lodash": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } } } }, "load-grunt-tasks": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/load-grunt-tasks/-/load-grunt-tasks-3.3.0.tgz", - "integrity": "sha1-vliSkJRY2T3fdp60vGhRAggMYyE=", - "dev": true, - "requires": { - "arrify": "^1.0.0", - "multimatch": "^2.0.0", - "pkg-up": "^1.0.0" - } - }, - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" - }, - "lodash._baseassign": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/load-grunt-tasks/-/load-grunt-tasks-5.1.0.tgz", + "integrity": "sha512-oNj0Jlka1TsfDe+9He0kcA1cRln+TMoTsEByW7ij6kyktNLxBKJtslCFEvFrLC2Dj0S19IWJh3fOCIjLby2Xrg==", "dev": true, "requires": { - "lodash._basecopy": "^3.0.0", - "lodash.keys": "^3.0.0" + "arrify": "^2.0.1", + "multimatch": "^4.0.0", + "pkg-up": "^3.1.0", + "resolve-pkg": "^2.0.0" } }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "lodash._bindcallback": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz", - "integrity": "sha1-5THCdkTPi1epnhftlbNcdIeJOS4=", - "dev": true - }, - "lodash._createassigner": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz", - "integrity": "sha1-g4pbri/aymOsIt7o4Z+k5taXCxE=", + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { - "lodash._bindcallback": "^3.0.0", - "lodash._isiterateecall": "^3.0.0", - "lodash.restparam": "^3.0.0" + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" } }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, - "lodash.assign": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-3.2.0.tgz", - "integrity": "sha1-POnwI0tLIiPilrj6CsH+6OvKZPo=", + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { - "lodash._baseassign": "^3.0.0", - "lodash._createassigner": "^3.0.0", - "lodash.keys": "^3.0.0" + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "dependencies": { + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } } }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "dev": true, - "requires": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" - } + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, "lodash.pad": { "version": "4.5.1", @@ -2633,23 +2609,39 @@ "integrity": "sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs=", "dev": true }, - "lodash.restparam": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", - "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", - "dev": true + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } }, - "longest": { + "map-obj": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", "dev": true }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", - "dev": true + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + } }, "merge": { "version": "1.2.1", @@ -2676,14 +2668,19 @@ "mime-db": "1.40.0" } }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, "minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -2745,26 +2742,16 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "multimatch": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-2.1.0.tgz", - "integrity": "sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz", + "integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==", "dev": true, "requires": { - "array-differ": "^1.0.0", - "array-union": "^1.0.1", - "arrify": "^1.0.0", - "minimatch": "^3.0.0" - }, - "dependencies": { - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - } + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" } }, "mute-stream": { @@ -2791,10 +2778,10 @@ "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", "dev": true }, - "next-tick": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", - "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, "nomnom": { @@ -2829,41 +2816,35 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", "dev": true - }, - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true } } }, "nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", "dev": true, "requires": { "abbrev": "1" } }, - "noptify": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/noptify/-/noptify-0.0.3.tgz", - "integrity": "sha1-WPZUpz2XU98MUdlobckhBKZ/S7s=", + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, "requires": { - "nopt": "~2.0.0" + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" }, "dependencies": { - "nopt": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-2.0.0.tgz", - "integrity": "sha1-ynQW8gpeP5w7hhgPlilfo9C1Lg0=", - "dev": true, - "requires": { - "abbrev": "1" - } + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true } } }, @@ -4541,19 +4522,41 @@ "wrappy": "1" } }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, "opn": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/opn/-/opn-1.0.2.tgz", "integrity": "sha1-uQlkM0bQChq8l3qLlvPOPFPVz18=", "dev": true }, - "os-locale": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", - "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", "dev": true, "requires": { - "lcid": "^1.0.0" + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" + }, + "dependencies": { + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + } } }, "os-tmpdir": { @@ -4562,23 +4565,46 @@ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, - "output-file-sync": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/output-file-sync/-/output-file-sync-1.1.2.tgz", - "integrity": "sha1-0KM+7+YaIF+suQCS6CZZjVJFznY=", + "p-limit": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", + "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", "dev": true, "requires": { - "graceful-fs": "^4.1.4", - "mkdirp": "^0.5.1", - "object-assign": "^4.1.0" - }, - "dependencies": { - "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - } + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" } }, "parseurl": { @@ -4588,10 +4614,13 @@ "dev": true }, "path-exists": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-1.0.0.tgz", - "integrity": "sha1-1aiZjrce83p0w06w2eum6HjuoIE=", - "dev": true + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } }, "path-is-absolute": { "version": "1.0.1", @@ -4599,12 +4628,29 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, "pathval": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-0.1.1.tgz", @@ -4616,6 +4662,12 @@ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", @@ -4632,12 +4684,23 @@ } }, "pkg-up": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-1.0.0.tgz", - "integrity": "sha1-Pgj7RhUlxEIWJKM7n35tCvWwWiY=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz", + "integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==", "dev": true, "requires": { - "find-up": "^1.0.0" + "find-up": "^3.0.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + } } }, "pkginfo": { @@ -4663,10 +4726,10 @@ } } }, - "private": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", - "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", "dev": true }, "process-nextick-args": { @@ -4675,6 +4738,12 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, "prompt": { "version": "0.2.14", "resolved": "https://registry.npmjs.org/prompt/-/prompt-0.2.14.tgz", @@ -4743,6 +4812,16 @@ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", "dev": true }, + "raw-body": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-1.1.7.tgz", + "integrity": "sha1-HQJ8K/oRasxmI7yo8AAWVyqH1CU=", + "dev": true, + "requires": { + "bytes": "1", + "string_decoder": "0.10" + } + }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", @@ -4752,6 +4831,27 @@ "mute-stream": "~0.0.4" } }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + }, "readable-stream": { "version": "1.1.14", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", @@ -4764,115 +4864,41 @@ "string_decoder": "~0.10.x" } }, - "recast": { - "version": "0.10.33", - "resolved": "https://registry.npmjs.org/recast/-/recast-0.10.33.tgz", - "integrity": "sha1-lCgI96oBbx+nFCxGHX5XBKqo1pc=", + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", "dev": true, "requires": { - "ast-types": "0.8.12", - "esprima-fb": "~15001.1001.0-dev-harmony-fb", - "private": "~0.1.5", - "source-map": "~0.5.0" - }, - "dependencies": { - "ast-types": { - "version": "0.8.12", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.8.12.tgz", - "integrity": "sha1-oNkOQ1G7iHcWyD/WN+v4GK9K38w=", - "dev": true - }, - "esprima-fb": { - "version": "15001.1001.0-dev-harmony-fb", - "resolved": "https://registry.npmjs.org/esprima-fb/-/esprima-fb-15001.1001.0-dev-harmony-fb.tgz", - "integrity": "sha1-Q761fsJujPI3092LM+QlM1d/Jlk=", - "dev": true - } + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" } }, - "regenerate": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", - "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", "dev": true }, - "regenerator": { - "version": "0.8.40", - "resolved": "https://registry.npmjs.org/regenerator/-/regenerator-0.8.40.tgz", - "integrity": "sha1-oORXxY69uuV1yfjNdRJ+k3VkNdg=", - "dev": true, - "requires": { - "commoner": "~0.10.3", - "defs": "~1.1.0", - "esprima-fb": "~15001.1001.0-dev-harmony-fb", - "private": "~0.1.5", - "recast": "0.10.33", - "through": "~2.3.8" - }, - "dependencies": { - "esprima-fb": { - "version": "15001.1001.0-dev-harmony-fb", - "resolved": "https://registry.npmjs.org/esprima-fb/-/esprima-fb-15001.1001.0-dev-harmony-fb.tgz", - "integrity": "sha1-Q761fsJujPI3092LM+QlM1d/Jlk=", - "dev": true - } - } - }, "regexp.prototype.flags": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.2.0.tgz", - "integrity": "sha512-ztaw4M1VqgMwl9HlPpOuiYgItcHlunW0He2fE6eNfT6E/CF2FtYi9ofOYe4mKntstYk0Fyh/rDRBdS3AnxjlrA==", - "dev": true, - "requires": { - "define-properties": "^1.1.2" - } - }, - "regexpu": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/regexpu/-/regexpu-1.3.0.tgz", - "integrity": "sha1-5TTcmRqeWEYFDJjebX3UpVyeoW0=", - "dev": true, - "requires": { - "esprima": "^2.6.0", - "recast": "^0.10.10", - "regenerate": "^1.2.1", - "regjsgen": "^0.2.0", - "regjsparser": "^0.1.4" - }, - "dependencies": { - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - } - } - }, - "regjsgen": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", - "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", - "dev": true - }, - "regjsparser": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", - "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "integrity": "sha512-ztaw4M1VqgMwl9HlPpOuiYgItcHlunW0He2fE6eNfT6E/CF2FtYi9ofOYe4mKntstYk0Fyh/rDRBdS3AnxjlrA==", "dev": true, "requires": { - "jsesc": "~0.5.0" + "define-properties": "^1.1.2" } }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, "repeating": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-1.1.3.tgz", - "integrity": "sha1-PUEUIYh3U3SU+X93+Xhfq4EPpKw=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", "dev": true, "requires": { "is-finite": "^1.0.0" @@ -4906,14 +4932,13 @@ } }, "requestretry": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/requestretry/-/requestretry-1.9.1.tgz", - "integrity": "sha1-CioATq8hGWnEzCz+vz/p5XuSx04=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/requestretry/-/requestretry-4.0.2.tgz", + "integrity": "sha512-ZGdO1ZXUQAeCB9xOS2keSN501y7T1t0zPOD58jTAOwamt6qkcBMaGdRBHEOMQRnDtT5fn7S99F0dwADUqCmYqg==", "requires": { - "extend": "^3.0.0", - "fg-lodash": "0.0.2", - "request": "^2.74.x", - "when": "~3.7.5" + "extend": "^3.0.2", + "lodash": "^4.17.10", + "when": "^3.7.7" } }, "requirefresh": { @@ -4952,32 +4977,99 @@ "path-parse": "^1.0.6" } }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "resolve-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg/-/resolve-pkg-2.0.0.tgz", + "integrity": "sha512-+1lzwXehGCXSeryaISr6WujZzowloigEofRB+dj75y9RRa/obVcYgbHJd53tdYw8pvZj8GojXaaENws8Ktw/hQ==", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, "revalidator": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/revalidator/-/revalidator-0.1.8.tgz", "integrity": "sha1-/s5hv6DBtSoga9axgZgYS91SOjs=", "dev": true }, - "right-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", - "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + }, + "dependencies": { + "glob": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz", + "integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", "dev": true, "requires": { - "align-text": "^0.1.1" + "is-promise": "^2.1.0" } }, - "rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", - "dev": true + "rxjs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz", + "integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } }, "safe-buffer": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" }, + "safe-json-parse": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/safe-json-parse/-/safe-json-parse-1.0.1.tgz", + "integrity": "sha1-PnZyPjjf3aE8mx0poeB//uSzC1c=", + "dev": true + }, "safefs": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/safefs/-/safefs-4.1.0.tgz", @@ -4986,14 +5078,6 @@ "requires": { "editions": "^1.1.1", "graceful-fs": "^4.1.4" - }, - "dependencies": { - "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - } } }, "safer-buffer": { @@ -5140,6 +5224,15 @@ "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", "dev": true }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, "shebang-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", @@ -5152,29 +5245,33 @@ "integrity": "sha1-NZbmMHp4FUT1kfN9phg2DzHbV7E=", "dev": true }, - "sigmund": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", - "dev": true - }, - "simple-fmt": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/simple-fmt/-/simple-fmt-0.1.0.tgz", - "integrity": "sha1-GRv1ZqWeZTBILLJatTtKjchcOms=", - "dev": true - }, - "simple-is": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/simple-is/-/simple-is-0.2.0.tgz", - "integrity": "sha1-Krt1qt453rXMgVzhDmGRFkhQuvA=", + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true + "slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + } + } }, "sntp": { "version": "0.2.4", @@ -5200,25 +5297,46 @@ "dev": true }, "source-map-support": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.2.10.tgz", - "integrity": "sha1-6lo5AKHByyUJagrozFwrSxDe09w=", + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", "dev": true, "requires": { - "source-map": "0.1.32" - }, - "dependencies": { - "source-map": { - "version": "0.1.32", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.32.tgz", - "integrity": "sha1-yLbBZ3l7pHQKjqMyUhYv8IWRsmY=", - "dev": true, - "requires": { - "amdefine": ">=0.0.4" - } - } + "source-map": "^0.5.6" + } + }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" } }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", + "dev": true + }, "split": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", @@ -5249,12 +5367,6 @@ "tweetnacl": "~0.14.0" } }, - "stable": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", - "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", - "dev": true - }, "stack-trace": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", @@ -5267,24 +5379,45 @@ "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", "dev": true }, + "string-template": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/string-template/-/string-template-0.2.1.tgz", + "integrity": "sha1-QpMuWYo1LQH8IuwzZ9nYTuxsmt0=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, - "stringmap": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/stringmap/-/stringmap-0.2.2.tgz", - "integrity": "sha1-VWwTeyWPlCuHdvWy71gqoGnX0bE=", - "dev": true - }, - "stringset": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/stringset/-/stringset-0.2.1.tgz", - "integrity": "sha1-7yWcTjSTRDd/zRyRPdLoSMnAQrU=", - "dev": true - }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", @@ -5302,6 +5435,15 @@ "is-utf8": "^0.2.0" } }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1" + } + }, "strip-json-comments": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz", @@ -5313,49 +5455,86 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" - }, - "tiny-lr-fork": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/tiny-lr-fork/-/tiny-lr-fork-0.0.5.tgz", - "integrity": "sha1-Hpnh4qhGm3NquX2X7vqYxx927Qo=", + "table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", "dev": true, "requires": { - "debug": "~0.7.0", - "faye-websocket": "~0.4.3", - "noptify": "~0.0.3", - "qs": "~0.5.2" + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" }, "dependencies": { - "debug": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz", - "integrity": "sha1-BuHqgILCyxTjmAbiLi9vdX+Srzk=", + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, - "qs": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/qs/-/qs-0.5.6.tgz", - "integrity": "sha1-MbGtBYVnZRxSaSFQa5qHk5EaA4Q=", - "dev": true + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } } } }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "tiny-lr": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tiny-lr/-/tiny-lr-1.1.1.tgz", + "integrity": "sha512-44yhA3tsaRoMOjQQ+5v5mVdqef+kH6Qze9jTpqtVufgYjYt08zyZAwNwwVBj3i1rJMnR52IxOW0LK0vBzgAkuA==", + "dev": true, + "requires": { + "body": "^5.1.0", + "debug": "^3.1.0", + "faye-websocket": "~0.10.0", + "livereload-js": "^2.3.0", + "object-assign": "^4.1.0", + "qs": "^6.4.0" + } + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, "to-double-quotes": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-double-quotes/-/to-double-quotes-2.0.0.tgz", "integrity": "sha1-qvIx1vqUiUn4GTAburRITYWI5Kc=", "dev": true }, - "to-fast-properties": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", - "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", - "dev": true - }, "to-single-quotes": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/to-single-quotes/-/to-single-quotes-2.0.1.tgz", @@ -5384,22 +5563,16 @@ } } }, - "trim-right": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", - "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", - "dev": true - }, - "try-resolve": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/try-resolve/-/try-resolve-1.0.1.tgz", - "integrity": "sha1-z95vq9ctY+V5fPqrhzq76OcA6RI=", + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", "dev": true }, - "tryor": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/tryor/-/tryor-0.1.2.tgz", - "integrity": "sha1-gUXkynyv9ArN48z5Rui4u3W0Fys=", + "tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", "dev": true }, "tunnel-agent": { @@ -5415,11 +5588,14 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" }, - "type": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", - "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==", - "dev": true + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } }, "typechecker": { "version": "4.7.0", @@ -5443,15 +5619,20 @@ } }, "underscore": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", - "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", "dev": true }, "underscore.string": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", - "integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0=" + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.5.tgz", + "integrity": "sha512-g+dpmgn+XBneLmXXo+sGlW5xQEt4ErkS3mgeN2GFbremYeMBSJKr9Wf2KJplQVaiPY/f7FN6atosWYNm9ovrYg==", + "dev": true, + "requires": { + "sprintf-js": "^1.0.3", + "util-deprecate": "^1.0.2" + } }, "unpipe": { "version": "1.0.0", @@ -5467,12 +5648,6 @@ "punycode": "^2.1.0" } }, - "user-home": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", - "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", - "dev": true - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -5512,6 +5687,22 @@ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" }, + "v8-compile-cache": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", + "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -5540,29 +5731,6 @@ "vow-queue": "^0.4.1" }, "dependencies": { - "glob": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz", - "integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, "uuid": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", @@ -5580,22 +5748,36 @@ "vow": "^0.4.17" } }, + "websocket-driver": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.3.tgz", + "integrity": "sha512-bpxWlvbbB459Mlipc5GBzzZwhoZgGEZLuqPaR0INBGnPAY1vdBX6hPnoFXiw+3yWxDuHyQjO2oXTMyS8A5haFg==", + "dev": true, + "requires": { + "http-parser-js": ">=0.4.0 <0.4.11", + "safe-buffer": ">=5.1.0", + "websocket-extensions": ">=0.1.1" + } + }, + "websocket-extensions": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz", + "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==", + "dev": true + }, "when": { "version": "3.7.8", "resolved": "https://registry.npmjs.org/when/-/when-3.7.8.tgz", "integrity": "sha1-xxMLan6gRpPoQs3J56Hyqjmjn4I=" }, "which": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/which/-/which-1.0.9.tgz", - "integrity": "sha1-RgwdoPgQED0DIam2M6+eV15kSG8=", - "dev": true - }, - "window-size": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", - "integrity": "sha1-+OGqHuWlPsW/FR/6CXQqatdpeHY=", - "dev": true + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } }, "winston": { "version": "0.8.3", @@ -5632,18 +5814,21 @@ } } }, - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "requires": { + "mkdirp": "^0.5.1" + } + }, "xmlbuilder": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-3.1.0.tgz", @@ -5660,26 +5845,6 @@ "dev": true } } - }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", - "dev": true - }, - "yargs": { - "version": "3.27.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.27.0.tgz", - "integrity": "sha1-ISBUaTFuk5Ex1Z8toMbX+YIh6kA=", - "dev": true, - "requires": { - "camelcase": "^1.2.1", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", - "os-locale": "^1.4.0", - "window-size": "^0.1.2", - "y18n": "^3.2.0" - } } } } diff --git a/package.json b/package.json index 8614449..3574c82 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "colors": "~1.1.2", "lodash": "^4.17.11", "q": "~1.4.1", - "requestretry": "~1.9.0", + "requestretry": "^4.0.2", "sauce-tunnel": "~2.5.0", "saucelabs": "^1.5.0" }, @@ -35,13 +35,15 @@ "grunt": ">=0.4.1" }, "devDependencies": { - "grunt": "^0.4.5", + "eslint": "^6.5.1", + "eslint-config-google": "^0.14.0", + "grunt": "^1.0.4", "grunt-contrib-connect": "^0.11.2", "grunt-contrib-jshint": "^0.12.0", - "grunt-contrib-watch": "^0.6.1", - "grunt-jscs": "^2.6.0", + "grunt-contrib-watch": "^1.1.0", + "grunt-jscs": "^3.0.1", "grunt-sauce-tunnel": "^0.2.1", - "load-grunt-config": "^0.19.1", + "load-grunt-config": "^3.0.1", "merge": "^1.2.0", "publish": "^0.6.0" }, diff --git a/src/Job.js b/src/Job.js index 2f395ec..93e1f1e 100644 --- a/src/Job.js +++ b/src/Job.js @@ -1,30 +1,30 @@ 'use strict'; -module.exports = function (grunt) { - var Q = require('q'); - var _ = require('lodash'); - var utils = require('./utils')(grunt); - var reJobId = /^[a-z0-9]{32}$/; +module.exports = function(grunt) { + const Q = require('q'); + const _ = require('lodash'); + const utils = require('./utils')(grunt); + const reJobId = /^[a-z0-9]{32}$/; Q.longStackSupport = true; - //these result parsers return true if the tests all passed - var resultParsers = { - jasmine: function (result) { + // these result parsers return true if the tests all passed + const resultParsers = { + 'jasmine': function(result) { return result.passed; }, - qunit: function (result) { + 'qunit': function(result) { return result.passed === result.total && result.total !== undefined; }, - mocha: function (result) { + 'mocha': function(result) { return result.failures === 0; }, - 'YUI Test': function (result) { + 'YUI Test': function(result) { return result.passed === result.total && result.total !== undefined; }, - custom: function (result) { + 'custom': function(result) { return result.failed === 0; - } + }, }; /** @@ -35,7 +35,7 @@ module.exports = function (grunt) { * @param {String} url - The test runner page's URL. * @param {Object} browser - Object describing the platform to run the test on. */ - var Job = function (runner, url, browser) { + const Job = function(runner, url, browser) { this.id = null; this.taskId = null; this.user = runner.user; @@ -46,7 +46,7 @@ module.exports = function (grunt) { this.url = url; this.platform = _.isArray(browser) ? browser : [browser.platform || '', browser.browserName || '', browser.version || '']; this.build = runner.build; - this.public = browser.public || runner.public || "team"; + this.public = browser.public || runner.public || 'team'; this.tags = browser.tags || runner.tags; this.testName = browser.name || runner.testName; this.sauceConfig = runner.sauceConfig; @@ -57,15 +57,15 @@ module.exports = function (grunt) { /** * Starts the job. * - * @returns {Object} - A promise which will eventually be resolved after the job has been + * @return {Object} - A promise which will eventually be resolved after the job has been * started. */ - Job.prototype.start = function () { - var me = this; - var requestParams = { + Job.prototype.start = function() { + const me = this; + const requestParams = { method: 'POST', url: ['https://saucelabs.com/rest/v1', this.user, 'js-tests'].join('/'), - auth: { user: this.user, pass: this.key() }, + auth: {user: this.user, pass: this.key()}, json: { platforms: [this.platform], url: this.url, @@ -73,8 +73,8 @@ module.exports = function (grunt) { build: this.build, public: this.public, tags: this.tags, - name: this.testName - } + name: this.testName, + }, }; _.merge(requestParams.json, this.sauceConfig); @@ -83,120 +83,120 @@ module.exports = function (grunt) { } return utils - .makeRequest(requestParams) - .then(function (body) { - var taskIds = body['js tests']; + .makeRequest(requestParams) + .then(function(body) { + const taskIds = body['js tests']; - if (!taskIds || !taskIds.length) { - throw new Error('Error starting tests through Sauce API.'); - } + if (!taskIds || !taskIds.length) { + throw new Error('Error starting tests through Sauce API.'); + } - me.taskId = taskIds[0]; - } - ); + me.taskId = taskIds[0]; + } + ); }; /** * Returns the job result. * - * @returns {Object} - A promise which will eventually be resolved with the job results. + * @return {Object} - A promise which will eventually be resolved with the job results. */ - Job.prototype.getResult = function () { - var me = this; + Job.prototype.getResult = function() { + const me = this; return this - .complete() - .then(function (result) { - result.testPageUrl = me.url; - if (result.status === 'test error') { + .complete() + .then(function(result) { + result.testPageUrl = me.url; + if (result.status === 'test error') { // A detailed error message should be composed here after the Sauce Labs API is // modified to report errors better, see #102. - throw new Error('Test Error'); - } + throw new Error('Test Error'); + } - return result; - }) - .then(function (result) { + return result; + }) + .then(function(result) { // Sauce Labs sets the result property to null when it encounters an error. // (One way to trigger this is to set a big (~100KB) test result.) - if (!result.result) { - result.passed = false; - } else { - result.passed = resultParsers[me.framework](result.result); - } - return result; - }); + if (!result.result) { + result.passed = false; + } else { + result.passed = resultParsers[me.framework](result.result); + } + return result; + }); }; /** * Waits until the job is completed. * - * @returns {Object} - A promise which will be resolved with the job's result object. + * @return {Object} - A promise which will be resolved with the job's result object. */ - Job.prototype.complete = function () { - var me = this; + Job.prototype.complete = function() { + const me = this; function fetch(attempts) { return utils - .makeRequest({ - method: 'POST', - url: ['https://saucelabs.com/rest/v1', me.user, 'js-tests/status'].join('/'), - auth: { user: me.user, pass: me.key() }, - json: { 'js tests': [me.taskId] } - }) - .then(function (body) { - var result = body['js tests'] && body['js tests'][0]; - var jobId = result.job_id; - - if (!body.completed || !reJobId.test(jobId)) { - var retries = attempts - 1; - if (attempts === 0) { - var errorMessage = "After trying " + me.statusCheckAttempts + - " times with a delay of " + me.pollInterval + - "s, this job never reached 'complete' status."; - throw new Error(errorMessage); - } else { - return Q - .delay(me.pollInterval) - .then(fetch.bind(this, retries)); + .makeRequest({ + method: 'POST', + url: ['https://saucelabs.com/rest/v1', me.user, 'js-tests/status'].join('/'), + auth: {user: me.user, pass: me.key()}, + json: {'js tests': [me.taskId]}, + }) + .then(function(body) { + const result = body['js tests'] && body['js tests'][0]; + const jobId = result.job_id; + + if (!body.completed || !reJobId.test(jobId)) { + const retries = attempts - 1; + if (attempts === 0) { + const errorMessage = 'After trying ' + me.statusCheckAttempts + + ' times with a delay of ' + me.pollInterval + + 's, this job never reached \'complete\' status.'; + throw new Error(errorMessage); + } else { + return Q + .delay(me.pollInterval) + .then(fetch.bind(this, retries)); + } } - } - me.id = jobId; + me.id = jobId; - return result; - }); + return result; + }); } - var initialAttempts = me.statusCheckAttempts || -1; + const initialAttempts = me.statusCheckAttempts || -1; return fetch(initialAttempts); }; /** * Stops the job. * - * @returns {Object} - A promise which will eventually be resolved after the job has been + * @return {Object} - A promise which will eventually be resolved after the job has been * stopped. */ - Job.prototype.stop = function () { + Job.prototype.stop = function() { return utils.makeRequest({ method: 'PUT', url: ['https://saucelabs.com/rest/v1', this.user, 'jobs', this.id, 'stop'].join('/'), - auth: { user: this.user, pass: this.key() } + auth: {user: this.user, pass: this.key()}, }); }; /** * Deletes the job. * - * @returns {Object} - A promise which will eventually be resolved after the job has been + * @return {Object} - A promise which will eventually be resolved after the job has been * deleted. */ - Job.prototype.del = function () { + Job.prototype.del = function() { return utils.makeRequest({ method: 'DELETE', url: ['https://saucelabs.com/rest/v1', this.user, 'jobs', this.id].join('/'), - auth: { user: this.user, pass: this.key() } + auth: {user: this.user, pass: this.key()}, }); }; diff --git a/src/TestRunner.js b/src/TestRunner.js index 8d81d2f..c961b19 100644 --- a/src/TestRunner.js +++ b/src/TestRunner.js @@ -1,11 +1,11 @@ 'use strict'; -module.exports = function (grunt) { - var _ = require('lodash'); - var Q = require('q'); - var utils = require('./utils')(grunt); - var Job = require('./Job')(grunt); - var WrapperError = require('./WrapperError'); +module.exports = function(grunt) { + const _ = require('lodash'); + const Q = require('q'); + const utils = require('./utils')(grunt); + const Job = require('./Job')(grunt); + const WrapperError = require('./WrapperError'); Q.longStackSupport = true; @@ -19,7 +19,7 @@ module.exports = function (grunt) { * 'YUI Test', 'mocha' or 'custom'. * @param {Function} onProgress - Progress handler. */ - var TestRunner = function (properties, framework, onProgress) { + const TestRunner = function(properties, framework, onProgress) { this.user = properties.username; this.key = properties.key; this.pollInterval = properties.pollInterval; @@ -52,7 +52,7 @@ module.exports = function (grunt) { * Reports progress. * @param {Object} progress - Progress data. */ - TestRunner.prototype.reportProgress = function (progress) { + TestRunner.prototype.reportProgress = function(progress) { if (this.onProgress) { this.onProgress(progress); } @@ -61,37 +61,37 @@ module.exports = function (grunt) { /** * Runs the test in all of the browsers-URL combinations. * - * @returns {Object} - A promise which will be eventually resolved with the test results + * @return {Object} - A promise which will be eventually resolved with the test results * (a boolean). Progress is reported after each job is started and completed. */ - TestRunner.prototype.runTests = function () { - var me = this; - var throttledRunTest, promises; + TestRunner.prototype.runTests = function() { + const me = this; + let throttledRunTest; let promises; throttledRunTest = utils.limitConcurrency(this.runTest.bind(this), this.throttled || Number.MAX_VALUE); promises = this.urls - .map(function (url) { - return this.browsers.map(function (browser) { - return throttledRunTest(browser, url); - }); - }, this) - .reduce(function (acc, promisesForUrl) { - return acc.concat(promisesForUrl); - }, []); + .map(function(url) { + return this.browsers.map(function(browser) { + return throttledRunTest(browser, url); + }); + }, this) + .reduce(function(acc, promisesForUrl) { + return acc.concat(promisesForUrl); + }, []); return Q - .all(promises) - .then(function (results) { - var passed = results.indexOf(false) === -1; + .all(promises) + .then(function(results) { + const passed = results.indexOf(false) === -1; - me.reportProgress({ - type: 'testCompleted', - passed: passed - }); + me.reportProgress({ + type: 'testCompleted', + passed: passed, + }); - return passed; - }); + return passed; + }); }; /** @@ -99,86 +99,90 @@ module.exports = function (grunt) { * * @param {Object} browser - The environment to run the test on. * @param {String} url - An URL that will be loaded in the browsers. - * @returns {Object} - A promise which will be eventually resolved with the test results + * @return {Object} - A promise which will be eventually resolved with the test results * (a boolean). Progress is reported after the job is started and completed. */ - TestRunner.prototype.runTest = function (browser, url) { - var me = this; - var retry = 0; + TestRunner.prototype.runTest = function(browser, url) { + const me = this; + let retry = 0; function getResult() { - var job = new Job(me, url, browser); + const job = new Job(me, url, browser); return job - .start() - .then(function () { return job.getResult(); }) - .then(function (result) { + .start() + .then(function() { + return job.getResult(); + }) + .then(function(result) { // when a test times out then the result property is a string - if (result.result && + if (result.result && result.result.indexOf && result.result.indexOf('Test exceeded maximum duration') > -1 && retry < me.maxRetries) { - retry += 1; - - me.reportProgress({ - type: 'retrying', - url: url, - browser: browser - }); - - return job - .stop() - // Try to delete the timed out job in order to prevent the SauceLabs badge to - // indicate failure. The del() function can also fail, in that case swallow the - // exception. - .then(function () { return job.del().fail(_.noop); }) - .then(getResult); - } - return result; - }); + retry += 1; + + me.reportProgress({ + type: 'retrying', + url: url, + browser: browser, + }); + + return job + .stop() + // Try to delete the timed out job in order to prevent the SauceLabs badge to + // indicate failure. The del() function can also fail, in that case swallow the + // exception. + .then(function() { + return job.del().fail(_.noop); + }) + .then(getResult); + } + return result; + }); } return Q - .fcall(function () { - me.startedJobs += 1; - me.reportProgress({ - type: 'jobStarted', - numberOfJobs: me.numberOfJobs, - startedJobs: me.startedJobs - }); - }) - .then(getResult) - .then(function (result) { - if (me.onTestComplete) { - var clone = _.clone(result, true); - return Q - .nfcall(me.onTestComplete, clone) - .then( - function (passed) { - if (passed !== undefined) { - result.passed = !!passed; - } - return result; - }, - function (error) { - throw new WrapperError('onTestComplete raised an error.', error); - } - ); - } - return result; - }) - .then(function (result) { - me.reportProgress({ - type: 'jobCompleted', - url: url, - jobUrl: result.url, - platform: result.platform, - passed: result.passed, - tunnelId: me.tunnelId + .fcall(function() { + me.startedJobs += 1; + me.reportProgress({ + type: 'jobStarted', + numberOfJobs: me.numberOfJobs, + startedJobs: me.startedJobs, + }); + }) + .then(getResult) + .then(function(result) { + if (me.onTestComplete) { + const clone = _.clone(result, true); + return Q + .nfcall(me.onTestComplete, clone) + .then( + function(passed) { + if (passed !== undefined) { + result.passed = !!passed; + } + return result; + }, + function(error) { + throw new WrapperError('onTestComplete raised an error.', error); + } + ); + } + return result; + }) + .then(function(result) { + me.reportProgress({ + type: 'jobCompleted', + url: url, + jobUrl: result.url, + platform: result.platform, + passed: result.passed, + tunnelId: me.tunnelId, + }); + + return result.passed; }); - - return result.passed; - }); }; return TestRunner; diff --git a/src/WrapperError.js b/src/WrapperError.js index 66834ea..a8dfd97 100644 --- a/src/WrapperError.js +++ b/src/WrapperError.js @@ -24,13 +24,13 @@ function WrapperError(message, innerError) { WrapperError.prototype = Object.create(Error.prototype); WrapperError.prototype.constructor = WrapperError; -var origPrepareStackTrace = Error.prototype.prepareStackTrace; +const origPrepareStackTrace = Error.prototype.prepareStackTrace; /** * Prepends 4 spaces to s. * * @param {String} s - The string to modify. - * @returns {String} - The modified string. + * @return {String} - The modified string. */ function padLeft(s) { return ' ' + s; @@ -40,7 +40,7 @@ function padLeft(s) { * Creates and returns a string representation of an error. * * @param {Error} error - The error. - * @returns {String} - A string representation of the error. + * @return {String} - A string representation of the error. */ function formatError(error, stack) { if (origPrepareStackTrace) { @@ -49,11 +49,11 @@ function formatError(error, stack) { return [ error.toString(), stack - .map(function (frame) { - return 'at ' + frame.toString(); - }) - .map(padLeft) - .join('\n') + .map(function(frame) { + return 'at ' + frame.toString(); + }) + .map(padLeft) + .join('\n'), ].join('\n'); } @@ -64,8 +64,8 @@ function formatError(error, stack) { * @param {Error} error - The error. * @param {CallSite[]} stack - Array of stack frames. */ -Error.prepareStackTrace = function (error, stack) { - var result = formatError(error, stack); +Error.prepareStackTrace = function(error, stack) { + let result = formatError(error, stack); if (error instanceof WrapperError && error.innerError !== null && diff --git a/src/utils.js b/src/utils.js index a5e4d34..040f17c 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,9 +1,9 @@ 'use strict'; -module.exports = function (grunt) { - var q = require('q'); - var request = require('requestretry'); - var WrapperError = require('./WrapperError'); +module.exports = function(grunt) { + const q = require('q'); + const request = require('requestretry'); + const WrapperError = require('./WrapperError'); q.longStackSupport = true; @@ -14,11 +14,11 @@ module.exports = function (grunt) { * * @param promiseFactory function that returns promises. * @param limit how many promises are allowed to be running at the same time. - * @returns function that returns a promise that eventually proxies to promiseFactory. + * @return function that returns a promise that eventually proxies to promiseFactory. */ function limitConcurrency(promiseFactory, limit) { - var running = 0; - var semaphore; + let running = 0; + let semaphore; function scheduleNextJob() { if (running < limit) { @@ -31,7 +31,7 @@ module.exports = function (grunt) { } return semaphore.promise - .fin(scheduleNextJob); + .fin(scheduleNextJob); } function processScheduledJobs() { @@ -43,17 +43,17 @@ module.exports = function (grunt) { } } - return function () { - var _this = this; - var args = arguments; + return function() { + const _this = this; + const args = arguments; function runJob() { return promiseFactory.apply(_this, args); } return scheduleNextJob() - .then(runJob) - .fin(processScheduledJobs); + .then(runJob) + .fin(processScheduledJobs); }; } @@ -64,7 +64,7 @@ module.exports = function (grunt) { * @param {Object} response * @return {Boolean} - true if the request should be retried */ - function loggingRetryStrategy(err /*, response*/) { + function loggingRetryStrategy(err /* , response*/) { if (err && err.code === 'ECONNRESET') { grunt.verbose.writeln('Transient network error (' + err.code + ')'); return true; @@ -76,33 +76,33 @@ module.exports = function (grunt) { * Wraps the request call, converts it to a promise. Also formats the errors messages. * * @param {Object} params - request's parameters object. - * @returns {Object} - A promise which will eventually be resolved with the response's + * @return {Object} - A promise which will eventually be resolved with the response's * body. */ function makeRequest(params) { - var QPromiseFactory = function(resolver) { + const QPromiseFactory = function(resolver) { return q.Promise(resolver); }; params.retryStrategy = loggingRetryStrategy; params.promiseFactory = QPromiseFactory; return request(params) - .then(function (response) { - if (response.statusCode !== 200) { - throw new Error('HTTP error (' + response.statusCode + ')'); - } - return response.body; - }) - .fail(function (error) { - throw new WrapperError([ - params.method, - params.url, - 'failed.' - ].join(' '), error); - }); + .then(function(response) { + if (response.statusCode !== 200) { + throw new Error('HTTP error (' + response.statusCode + ')'); + } + return response.body; + }) + .fail(function(error) { + throw new WrapperError([ + params.method, + params.url, + 'failed.', + ].join(' '), error); + }); } return { limitConcurrency: limitConcurrency, - makeRequest: makeRequest + makeRequest: makeRequest, }; }; diff --git a/tasks/saucelabs.js b/tasks/saucelabs.js index 389c03f..f9a5f94 100644 --- a/tasks/saucelabs.js +++ b/tasks/saucelabs.js @@ -1,24 +1,24 @@ 'use strict'; -module.exports = function (grunt) { - var Q = require('q'); - var SauceTunnel = require('sauce-tunnel'); - var TestRunner = require('../src/TestRunner')(grunt); +module.exports = function(grunt) { + const Q = require('q'); + const SauceTunnel = require('sauce-tunnel'); + const TestRunner = require('../src/TestRunner')(grunt); Q.longStackSupport = true; function unsupportedPort(url) { // Not all ports are proxied by Sauce Connect. List of supported ports is // available at https://saucelabs.com/docs/connect#localhost - var portRegExp = /:(\d+)\//; - var matches = portRegExp.exec(url); - var port = matches ? parseInt(matches[1], 10) : null; - var supportedPorts = [ - 80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, 3030, - 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 4567, 5000, 5001, 5050, 5555, 5432, 6000, - 6001, 6060, 6666, 6543, 7000, 7070, 7774, 7777, 8000, 8001, 8003, 8031, 8080, 8081, 8765, - 8888, 9000, 9001, 9080, 9090, 9876, 9877, 9999, 49221, 55001 - ]; + const portRegExp = /:(\d+)\//; + const matches = portRegExp.exec(url); + const port = matches ? parseInt(matches[1], 10) : null; + const supportedPorts = [ + 80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, 3030, + 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 4567, 5000, 5001, 5050, 5555, 5432, 6000, + 6001, 6060, 6666, 6543, 7000, 7070, 7774, 7777, 8000, 8001, 8003, 8031, 8080, 8081, 8765, + 8888, 9000, 9001, 9080, 9090, 9876, 9877, 9999, 49221, 55001, + ]; if (port) { return supportedPorts.indexOf(port) === -1; @@ -29,71 +29,71 @@ module.exports = function (grunt) { function reportProgress(notification) { switch (notification.type) { - case 'tunnelOpen': - grunt.log.writeln('=> Starting Tunnel to Sauce Labs'.inverse.bold); - break; - case 'tunnelOpened': - grunt.log.ok('Connected to Saucelabs'); - break; - case 'tunnelClose': - grunt.log.writeln('=> Stopping Tunnel to Sauce Labs'.inverse.bold); - break; - case 'tunnelEvent': - if (notification.verbose) { - grunt.verbose[notification.method](notification.text); - } else { - grunt.log[notification.method](notification.text); - } - break; - case 'jobStarted': - grunt.log.writeln('\n', notification.startedJobs, '/', notification.numberOfJobs, 'tests started'); - break; - case 'jobCompleted': - grunt.log.subhead('\nTested %s', notification.url); - grunt.log.writeln('Platform: %s', notification.platform); - - if (notification.tunnelId && unsupportedPort(notification.url)) { - grunt.log.writeln('Warning: This url might use a port that is not proxied by Sauce Connect.'.yellow); - } - - grunt.log.writeln('Passed: %s', notification.passed); - grunt.log.writeln('Url %s', notification.jobUrl); - break; - case 'testCompleted': - grunt.log[notification.passed ? 'ok' : 'error']('All tests completed with status %s', notification.passed); - break; - case 'retrying': - grunt.log.writeln('Timed out, retrying URL %s on browser %s', notification.url, JSON.stringify(notification.browser)); - break; - default: - grunt.log.error('Unexpected notification type'); + case 'tunnelOpen': + grunt.log.writeln('=> Starting Tunnel to Sauce Labs'.inverse.bold); + break; + case 'tunnelOpened': + grunt.log.ok('Connected to Saucelabs'); + break; + case 'tunnelClose': + grunt.log.writeln('=> Stopping Tunnel to Sauce Labs'.inverse.bold); + break; + case 'tunnelEvent': + if (notification.verbose) { + grunt.verbose[notification.method](notification.text); + } else { + grunt.log[notification.method](notification.text); + } + break; + case 'jobStarted': + grunt.log.writeln('\n', notification.startedJobs, '/', notification.numberOfJobs, 'tests started'); + break; + case 'jobCompleted': + grunt.log.subhead('\nTested %s', notification.url); + grunt.log.writeln('Platform: %s', notification.platform); + + if (notification.tunnelId && unsupportedPort(notification.url)) { + grunt.log.writeln('Warning: This url might use a port that is not proxied by Sauce Connect.'.yellow); + } + + grunt.log.writeln('Passed: %s', notification.passed); + grunt.log.writeln('Url %s', notification.jobUrl); + break; + case 'testCompleted': + grunt.log[notification.passed ? 'ok' : 'error']('All tests completed with status %s', notification.passed); + break; + case 'retrying': + grunt.log.writeln('Timed out, retrying URL %s on browser %s', notification.url, JSON.stringify(notification.browser)); + break; + default: + grunt.log.error('Unexpected notification type'); } } function createTunnel(arg) { - var tunnel; + let tunnel; reportProgress({ - type: 'tunnelOpen' + type: 'tunnelOpen', }); tunnel = new SauceTunnel(arg.username, arg.key(), arg.identifier, true, ['-P', '0'].concat(arg.tunnelArgs)); - ['write', 'writeln', 'error', 'ok', 'debug'].forEach(function (method) { - tunnel.on('log:' + method, function (text) { + ['write', 'writeln', 'error', 'ok', 'debug'].forEach(function(method) { + tunnel.on('log:' + method, function(text) { reportProgress({ type: 'tunnelEvent', verbose: false, method: method, - text: text + text: text, }); }); - tunnel.on('verbose:' + method, function (text) { + tunnel.on('verbose:' + method, function(text) { reportProgress({ type: 'tunnelEvent', verbose: true, method: method, - text: text + text: text, }); }); }); @@ -102,64 +102,64 @@ module.exports = function (grunt) { } function runTask(arg, framework, callback) { - var tunnel; + let tunnel; Q - .fcall(function () { - var deferred; - - if (arg.tunneled) { - deferred = Q.defer(); - - tunnel = createTunnel(arg); - tunnel.start(function (succeeded) { - if (!succeeded) { - deferred.reject('Could not create tunnel to Sauce Labs'); - } else { - reportProgress({ - type: 'tunnelOpened' - }); - + .fcall(function() { + let deferred; + + if (arg.tunneled) { + deferred = Q.defer(); + + tunnel = createTunnel(arg); + tunnel.start(function(succeeded) { + if (!succeeded) { + deferred.reject('Could not create tunnel to Sauce Labs'); + } else { + reportProgress({ + type: 'tunnelOpened', + }); + + deferred.resolve(); + } + }); + return deferred.promise; + } + }) + .then(function() { + const testRunner = new TestRunner(arg, framework, reportProgress); + return testRunner.runTests(); + }) + .fin(function() { + let deferred; + + if (tunnel) { + deferred = Q.defer(); + + reportProgress({ + type: 'tunnelClose', + }); + + tunnel.stop(function() { deferred.resolve(); + }); + + return deferred.promise; + } + }) + .then( + function(passed) { + callback(passed); + }, + function(error) { + grunt.log.error(error.stack || error.toString()); + callback(false); } - }); - return deferred.promise; - } - }) - .then(function () { - var testRunner = new TestRunner(arg, framework, reportProgress); - return testRunner.runTests(); - }) - .fin(function () { - var deferred; - - if (tunnel) { - deferred = Q.defer(); - - reportProgress({ - type: 'tunnelClose' - }); - - tunnel.stop(function () { - deferred.resolve(); - }); - - return deferred.promise; - } - }) - .then( - function (passed) { - callback(passed); - }, - function (error) { - grunt.log.error(error.stack || error.toString()); - callback(false); - } - ) - .done(); + ) + .done(); } - var defaults = { + const defaults = { username: process.env.SAUCE_USERNAME, tunneled: true, identifier: Math.floor((new Date()).getTime() / 1000 - 1230768000).toString(), @@ -169,7 +169,7 @@ module.exports = function (grunt) { browsers: [{}], tunnelArgs: [], sauceConfig: {}, - maxRetries: 0 + maxRetries: 0, }; // Grunt will print the options hash to console.log when run in verbose @@ -177,53 +177,57 @@ module.exports = function (grunt) { // assignments so it can integrate with Grunt's APIs, but it will always // return the getter as a function so that the 'toString' and 'toJSON' can be // overidden. - var key = process.env.SAUCE_ACCESS_KEY; + let key = process.env.SAUCE_ACCESS_KEY; Object.defineProperty(defaults, 'key', { enumerable: true, configurable: false, writeable: true, - set: function (newKey) { + set: function(newKey) { key = newKey; }, - get: function () { - var get = function () { return key; }; - get.toString = function () { return key ? "[hidden]" : undefined; }; + get: function() { + const get = function() { + return key; + }; + get.toString = function() { + return key ? '[hidden]' : undefined; + }; get.toJSON = get.toString; return get; - } + }, }); - grunt.registerMultiTask('saucelabs-jasmine', 'Run Jasmine test cases using Sauce Labs browsers', function () { - var done = this.async(); - var arg = this.options(defaults); + grunt.registerMultiTask('saucelabs-jasmine', 'Run Jasmine test cases using Sauce Labs browsers', function() { + const done = this.async(); + const arg = this.options(defaults); runTask(arg, 'jasmine', done); }); - grunt.registerMultiTask('saucelabs-qunit', 'Run Qunit test cases using Sauce Labs browsers', function () { - var done = this.async(); - var arg = this.options(defaults); + grunt.registerMultiTask('saucelabs-qunit', 'Run Qunit test cases using Sauce Labs browsers', function() { + const done = this.async(); + const arg = this.options(defaults); runTask(arg, 'qunit', done); }); - grunt.registerMultiTask('saucelabs-yui', 'Run YUI test cases using Sauce Labs browsers', function () { - var done = this.async(); - var arg = this.options(defaults); + grunt.registerMultiTask('saucelabs-yui', 'Run YUI test cases using Sauce Labs browsers', function() { + const done = this.async(); + const arg = this.options(defaults); runTask(arg, 'YUI Test', done); }); - grunt.registerMultiTask('saucelabs-mocha', 'Run Mocha test cases using Sauce Labs browsers', function () { - var done = this.async(); - var arg = this.options(defaults); + grunt.registerMultiTask('saucelabs-mocha', 'Run Mocha test cases using Sauce Labs browsers', function() { + const done = this.async(); + const arg = this.options(defaults); runTask(arg, 'mocha', done); }); - grunt.registerMultiTask('saucelabs-custom', 'Run custom test cases using Sauce Labs browsers', function () { - var done = this.async(); - var arg = this.options(defaults); + grunt.registerMultiTask('saucelabs-custom', 'Run custom test cases using Sauce Labs browsers', function() { + const done = this.async(); + const arg = this.options(defaults); runTask(arg, 'custom', done); }); diff --git a/test/jasmine/lib/jasmine-1.3.1/jasmine-html.js b/test/jasmine/lib/jasmine-1.3.1/jasmine-html.js index 543d569..a53d611 100644 --- a/test/jasmine/lib/jasmine-1.3.1/jasmine-html.js +++ b/test/jasmine/lib/jasmine-1.3.1/jasmine-html.js @@ -1,10 +1,10 @@ jasmine.HtmlReporterHelpers = {}; jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) { - var el = document.createElement(type); + const el = document.createElement(type); - for (var i = 2; i < arguments.length; i++) { - var child = arguments[i]; + for (let i = 2; i < arguments.length; i++) { + const child = arguments[i]; if (typeof child === 'string') { el.appendChild(document.createTextNode(child)); @@ -15,8 +15,8 @@ jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) { } } - for (var attr in attrs) { - if (attr == "className") { + for (const attr in attrs) { + if (attr == 'className') { el[attr] = attrs[attr]; } else { el.setAttribute(attr, attrs[attr]); @@ -27,8 +27,8 @@ jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) { }; jasmine.HtmlReporterHelpers.getSpecStatus = function(child) { - var results = child.results(); - var status = results.passed() ? 'passed' : 'failed'; + const results = child.results(); + let status = results.passed() ? 'passed' : 'failed'; if (results.skipped) { status = 'skipped'; } @@ -37,9 +37,9 @@ jasmine.HtmlReporterHelpers.getSpecStatus = function(child) { }; jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) { - var parentDiv = this.dom.summary; - var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite'; - var parent = child[parentSuite]; + let parentDiv = this.dom.summary; + const parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite'; + const parent = child[parentSuite]; if (parent) { if (typeof this.views.suites[parent.id] == 'undefined') { @@ -53,24 +53,24 @@ jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) { jasmine.HtmlReporterHelpers.addHelpers = function(ctor) { - for(var fn in jasmine.HtmlReporterHelpers) { + for (const fn in jasmine.HtmlReporterHelpers) { ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn]; } }; jasmine.HtmlReporter = function(_doc) { - var self = this; - var doc = _doc || window.document; + const self = this; + const doc = _doc || window.document; - var reporterView; + let reporterView; - var dom = {}; + const dom = {}; // Jasmine Reporter Public Interface self.logRunningSpecs = false; self.reportRunnerStarting = function(runner) { - var specs = runner.specs() || []; + const specs = runner.specs() || []; if (specs.length == 0) { return; @@ -103,7 +103,7 @@ jasmine.HtmlReporter = function(_doc) { }; self.log = function() { - var console = jasmine.getGlobal().console; + const console = jasmine.getGlobal().console; if (console && console.log) { if (console.log.apply) { console.log.apply(console, arguments); @@ -124,18 +124,18 @@ jasmine.HtmlReporter = function(_doc) { return self; function focusedSpecName() { - var specName; + let specName; (function memoizeFocusedSpec() { if (specName) { return; } - var paramMap = []; - var params = jasmine.HtmlReporter.parameters(doc); + const paramMap = []; + const params = jasmine.HtmlReporter.parameters(doc); - for (var i = 0; i < params.length; i++) { - var p = params[i].split('='); + for (let i = 0; i < params.length; i++) { + const p = params[i].split('='); paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); } @@ -146,19 +146,19 @@ jasmine.HtmlReporter = function(_doc) { } function createReporterDom(version) { - dom.reporter = self.createDom('div', { id: 'HTMLReporter', className: 'jasmine_reporter' }, - dom.banner = self.createDom('div', { className: 'banner' }, - self.createDom('span', { className: 'title' }, "Jasmine "), - self.createDom('span', { className: 'version' }, version)), - - dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}), - dom.alert = self.createDom('div', {className: 'alert'}, - self.createDom('span', { className: 'exceptions' }, - self.createDom('label', { className: 'label', 'for': 'no_try_catch' }, 'No try/catch'), - self.createDom('input', { id: 'no_try_catch', type: 'checkbox' }))), - dom.results = self.createDom('div', {className: 'results'}, - dom.summary = self.createDom('div', { className: 'summary' }), - dom.details = self.createDom('div', { id: 'details' })) + dom.reporter = self.createDom('div', {id: 'HTMLReporter', className: 'jasmine_reporter'}, + dom.banner = self.createDom('div', {className: 'banner'}, + self.createDom('span', {className: 'title'}, 'Jasmine '), + self.createDom('span', {className: 'version'}, version)), + + dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}), + dom.alert = self.createDom('div', {className: 'alert'}, + self.createDom('span', {className: 'exceptions'}, + self.createDom('label', {'className': 'label', 'for': 'no_try_catch'}, 'No try/catch'), + self.createDom('input', {id: 'no_try_catch', type: 'checkbox'}))), + dom.results = self.createDom('div', {className: 'results'}, + dom.summary = self.createDom('div', {className: 'summary'}), + dom.details = self.createDom('div', {id: 'details'})) ); } @@ -167,9 +167,9 @@ jasmine.HtmlReporter = function(_doc) { } function searchWithCatch() { - var params = jasmine.HtmlReporter.parameters(window.document); - var removed = false; - var i = 0; + const params = jasmine.HtmlReporter.parameters(window.document); + let removed = false; + let i = 0; while (!removed && i < params.length) { if (params[i].match(/catch=/)) { @@ -179,14 +179,14 @@ jasmine.HtmlReporter = function(_doc) { i++; } if (jasmine.CATCH_EXCEPTIONS) { - params.push("catch=false"); + params.push('catch=false'); } - return params.join("&"); + return params.join('&'); } function setExceptionHandling() { - var chxCatch = document.getElementById('no_try_catch'); + const chxCatch = document.getElementById('no_try_catch'); if (noTryCatch()) { chxCatch.setAttribute('checked', true); @@ -198,26 +198,26 @@ jasmine.HtmlReporter = function(_doc) { } }; jasmine.HtmlReporter.parameters = function(doc) { - var paramStr = doc.location.search.substring(1); - var params = []; + const paramStr = doc.location.search.substring(1); + let params = []; if (paramStr.length > 0) { params = paramStr.split('&'); } return params; -} +}; jasmine.HtmlReporter.sectionLink = function(sectionName) { - var link = '?'; - var params = []; + let link = '?'; + const params = []; if (sectionName) { params.push('spec=' + encodeURIComponent(sectionName)); } if (!jasmine.CATCH_EXCEPTIONS) { - params.push("catch=false"); + params.push('catch=false'); } if (params.length > 0) { - link += params.join("&"); + link += params.join('&'); } return link; @@ -233,9 +233,9 @@ jasmine.HtmlReporter.ReporterView = function(dom) { this.createResultsMenu = function() { this.resultsMenu = this.createDom('span', {className: 'resultsMenu bar'}, - this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: "#"}, '0 specs'), - ' | ', - this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: "#"}, '0 failing')); + this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: '#'}, '0 specs'), + ' | ', + this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: '#'}, '0 failing')); this.summaryMenuItem.onclick = function() { dom.reporter.className = dom.reporter.className.replace(/ showDetails/g, ''); @@ -251,11 +251,11 @@ jasmine.HtmlReporter.ReporterView = function(dom) { this.views = { specs: {}, - suites: {} + suites: {}, }; - for (var i = 0; i < specs.length; i++) { - var spec = specs[i]; + for (let i = 0; i < specs.length; i++) { + const spec = specs[i]; this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom, this.views); if (specFilter(spec)) { this.runningSpecCount++; @@ -270,7 +270,7 @@ jasmine.HtmlReporter.ReporterView = function(dom) { this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom); } - var specView = this.views.specs[spec.id]; + const specView = this.views.specs[spec.id]; switch (specView.status()) { case 'passed': @@ -291,7 +291,7 @@ jasmine.HtmlReporter.ReporterView = function(dom) { }; this.suiteComplete = function(suite) { - var suiteView = this.views.suites[suite.id]; + const suiteView = this.views.suites[suite.id]; if (isUndefined(suiteView)) { return; } @@ -299,24 +299,23 @@ jasmine.HtmlReporter.ReporterView = function(dom) { }; this.refresh = function() { - if (isUndefined(this.resultsMenu)) { this.createResultsMenu(); } // currently running UI if (isUndefined(this.runningAlert)) { - this.runningAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "runningAlert bar" }); + this.runningAlert = this.createDom('a', {href: jasmine.HtmlReporter.sectionLink(), className: 'runningAlert bar'}); dom.alert.appendChild(this.runningAlert); } - this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + specPluralizedFor(this.totalSpecCount); + this.runningAlert.innerHTML = 'Running ' + this.completeSpecCount + ' of ' + specPluralizedFor(this.totalSpecCount); // skipped specs UI if (isUndefined(this.skippedAlert)) { - this.skippedAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "skippedAlert bar" }); + this.skippedAlert = this.createDom('a', {href: jasmine.HtmlReporter.sectionLink(), className: 'skippedAlert bar'}); } - this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all"; + this.skippedAlert.innerHTML = 'Skipping ' + this.skippedCount + ' of ' + specPluralizedFor(this.totalSpecCount) + ' - run all'; if (this.skippedCount === 1 && isDefined(dom.alert)) { dom.alert.appendChild(this.skippedAlert); @@ -324,15 +323,15 @@ jasmine.HtmlReporter.ReporterView = function(dom) { // passing specs UI if (isUndefined(this.passedAlert)) { - this.passedAlert = this.createDom('span', { href: jasmine.HtmlReporter.sectionLink(), className: "passingAlert bar" }); + this.passedAlert = this.createDom('span', {href: jasmine.HtmlReporter.sectionLink(), className: 'passingAlert bar'}); } - this.passedAlert.innerHTML = "Passing " + specPluralizedFor(this.passedCount); + this.passedAlert.innerHTML = 'Passing ' + specPluralizedFor(this.passedCount); // failing specs UI if (isUndefined(this.failedAlert)) { - this.failedAlert = this.createDom('span', {href: "?", className: "failingAlert bar"}); + this.failedAlert = this.createDom('span', {href: '?', className: 'failingAlert bar'}); } - this.failedAlert.innerHTML = "Failing " + specPluralizedFor(this.failedCount); + this.failedAlert.innerHTML = 'Failing ' + specPluralizedFor(this.failedCount); if (this.failedCount === 1 && isDefined(dom.alert)) { dom.alert.appendChild(this.failedAlert); @@ -340,29 +339,29 @@ jasmine.HtmlReporter.ReporterView = function(dom) { } // summary info - this.summaryMenuItem.innerHTML = "" + specPluralizedFor(this.runningSpecCount); - this.detailsMenuItem.innerHTML = "" + this.failedCount + " failing"; + this.summaryMenuItem.innerHTML = '' + specPluralizedFor(this.runningSpecCount); + this.detailsMenuItem.innerHTML = '' + this.failedCount + ' failing'; }; this.complete = function() { dom.alert.removeChild(this.runningAlert); - this.skippedAlert.innerHTML = "Ran " + this.runningSpecCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all"; + this.skippedAlert.innerHTML = 'Ran ' + this.runningSpecCount + ' of ' + specPluralizedFor(this.totalSpecCount) + ' - run all'; if (this.failedCount === 0) { - dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, "Passing " + specPluralizedFor(this.passedCount))); + dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, 'Passing ' + specPluralizedFor(this.passedCount))); } else { showDetails(); } - dom.banner.appendChild(this.createDom('span', {className: 'duration'}, "finished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s")); + dom.banner.appendChild(this.createDom('span', {className: 'duration'}, 'finished in ' + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + 's')); }; return this; function showDetails() { if (dom.reporter.className.search(/showDetails/) === -1) { - dom.reporter.className += " showDetails"; + dom.reporter.className += ' showDetails'; } } @@ -375,13 +374,12 @@ jasmine.HtmlReporter.ReporterView = function(dom) { } function specPluralizedFor(count) { - var str = count + " spec"; + let str = count + ' spec'; if (count > 1) { - str += "s" + str += 's'; } return str; } - }; jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.ReporterView); @@ -392,22 +390,22 @@ jasmine.HtmlReporter.SpecView = function(spec, dom, views) { this.dom = dom; this.views = views; - this.symbol = this.createDom('li', { className: 'pending' }); + this.symbol = this.createDom('li', {className: 'pending'}); this.dom.symbolSummary.appendChild(this.symbol); - this.summary = this.createDom('div', { className: 'specSummary' }, - this.createDom('a', { - className: 'description', - href: jasmine.HtmlReporter.sectionLink(this.spec.getFullName()), - title: this.spec.getFullName() - }, this.spec.description) + this.summary = this.createDom('div', {className: 'specSummary'}, + this.createDom('a', { + className: 'description', + href: jasmine.HtmlReporter.sectionLink(this.spec.getFullName()), + title: this.spec.getFullName(), + }, this.spec.description) ); - this.detail = this.createDom('div', { className: 'specDetail' }, + this.detail = this.createDom('div', {className: 'specDetail'}, this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(this.spec.getFullName()), - title: this.spec.getFullName() + title: this.spec.getFullName(), }, this.spec.getFullName()) ); }; @@ -442,11 +440,11 @@ jasmine.HtmlReporter.SpecView.prototype.appendSummaryToSuiteDiv = function() { jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() { this.detail.className += ' ' + this.status(); - var resultItems = this.spec.results().getItems(); - var messagesDiv = this.createDom('div', { className: 'messages' }); + const resultItems = this.spec.results().getItems(); + const messagesDiv = this.createDom('div', {className: 'messages'}); - for (var i = 0; i < resultItems.length; i++) { - var result = resultItems[i]; + for (let i = 0; i < resultItems.length; i++) { + const result = resultItems[i]; if (result.type == 'log') { messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString())); @@ -465,13 +463,13 @@ jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() { } }; -jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);jasmine.HtmlReporter.SuiteView = function(suite, dom, views) { +jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView); jasmine.HtmlReporter.SuiteView = function(suite, dom, views) { this.suite = suite; this.dom = dom; this.views = views; - this.element = this.createDom('div', { className: 'suite' }, - this.createDom('a', { className: 'description', href: jasmine.HtmlReporter.sectionLink(this.suite.getFullName()) }, this.suite.description) + this.element = this.createDom('div', {className: 'suite'}, + this.createDom('a', {className: 'description', href: jasmine.HtmlReporter.sectionLink(this.suite.getFullName())}, this.suite.description) ); this.appendToSummary(this.suite, this.element); @@ -482,7 +480,7 @@ jasmine.HtmlReporter.SuiteView.prototype.status = function() { }; jasmine.HtmlReporter.SuiteView.prototype.refresh = function() { - this.element.className += " " + this.status(); + this.element.className += ' ' + this.status(); }; jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SuiteView); @@ -496,20 +494,22 @@ jasmine.TrivialReporter = function(doc) { }; jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) { - var el = document.createElement(type); + const el = document.createElement(type); - for (var i = 2; i < arguments.length; i++) { - var child = arguments[i]; + for (let i = 2; i < arguments.length; i++) { + const child = arguments[i]; if (typeof child === 'string') { el.appendChild(document.createTextNode(child)); } else { - if (child) { el.appendChild(child); } + if (child) { + el.appendChild(child); + } } } - for (var attr in attrs) { - if (attr == "className") { + for (const attr in attrs) { + if (attr == 'className') { el[attr] = attrs[attr]; } else { el.setAttribute(attr, attrs[attr]); @@ -520,38 +520,38 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA }; jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { - var showPassed, showSkipped; - - this.outerDiv = this.createDom('div', { id: 'TrivialReporter', className: 'jasmine_reporter' }, - this.createDom('div', { className: 'banner' }, - this.createDom('div', { className: 'logo' }, - this.createDom('span', { className: 'title' }, "Jasmine"), - this.createDom('span', { className: 'version' }, runner.env.versionString())), - this.createDom('div', { className: 'options' }, - "Show ", - showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }), - this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "), - showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }), - this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped") - ) - ), - - this.runnerDiv = this.createDom('div', { className: 'runner running' }, - this.createDom('a', { className: 'run_spec', href: '?' }, "run all"), - this.runnerMessageSpan = this.createDom('span', {}, "Running..."), - this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, "")) - ); + let showPassed; let showSkipped; + + this.outerDiv = this.createDom('div', {id: 'TrivialReporter', className: 'jasmine_reporter'}, + this.createDom('div', {className: 'banner'}, + this.createDom('div', {className: 'logo'}, + this.createDom('span', {className: 'title'}, 'Jasmine'), + this.createDom('span', {className: 'version'}, runner.env.versionString())), + this.createDom('div', {className: 'options'}, + 'Show ', + showPassed = this.createDom('input', {id: '__jasmine_TrivialReporter_showPassed__', type: 'checkbox'}), + this.createDom('label', {'for': '__jasmine_TrivialReporter_showPassed__'}, ' passed '), + showSkipped = this.createDom('input', {id: '__jasmine_TrivialReporter_showSkipped__', type: 'checkbox'}), + this.createDom('label', {'for': '__jasmine_TrivialReporter_showSkipped__'}, ' skipped') + ) + ), + + this.runnerDiv = this.createDom('div', {className: 'runner running'}, + this.createDom('a', {className: 'run_spec', href: '?'}, 'run all'), + this.runnerMessageSpan = this.createDom('span', {}, 'Running...'), + this.finishedAtSpan = this.createDom('span', {className: 'finished-at'}, '')) + ); this.document.body.appendChild(this.outerDiv); - var suites = runner.suites(); - for (var i = 0; i < suites.length; i++) { - var suite = suites[i]; - var suiteDiv = this.createDom('div', { className: 'suite' }, - this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"), - this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description)); + const suites = runner.suites(); + for (let i = 0; i < suites.length; i++) { + const suite = suites[i]; + const suiteDiv = this.createDom('div', {className: 'suite'}, + this.createDom('a', {className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName())}, 'run'), + this.createDom('a', {className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName())}, suite.description)); this.suiteDivs[suite.id] = suiteDiv; - var parentDiv = this.outerDiv; + let parentDiv = this.outerDiv; if (suite.parentSuite) { parentDiv = this.suiteDivs[suite.parentSuite.id]; } @@ -560,7 +560,7 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { this.startedAt = new Date(); - var self = this; + const self = this; showPassed.onclick = function(evt) { if (showPassed.checked) { self.outerDiv.className += ' show-passed'; @@ -579,32 +579,32 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { }; jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { - var results = runner.results(); - var className = (results.failedCount > 0) ? "runner failed" : "runner passed"; - this.runnerDiv.setAttribute("class", className); - //do it twice for IE - this.runnerDiv.setAttribute("className", className); - var specs = runner.specs(); - var specCount = 0; - for (var i = 0; i < specs.length; i++) { + const results = runner.results(); + const className = (results.failedCount > 0) ? 'runner failed' : 'runner passed'; + this.runnerDiv.setAttribute('class', className); + // do it twice for IE + this.runnerDiv.setAttribute('className', className); + const specs = runner.specs(); + let specCount = 0; + for (let i = 0; i < specs.length; i++) { if (this.specFilter(specs[i])) { specCount++; } } - var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); - message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"; - this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild); + let message = '' + specCount + ' spec' + (specCount == 1 ? '' : 's' ) + ', ' + results.failedCount + ' failure' + ((results.failedCount == 1) ? '' : 's'); + message += ' in ' + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + 's'; + this.runnerMessageSpan.replaceChild(this.createDom('a', {className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild); - this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString())); + this.finishedAtSpan.appendChild(document.createTextNode('Finished at ' + new Date().toString())); }; jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { - var results = suite.results(); - var status = results.passed() ? 'passed' : 'failed'; + const results = suite.results(); + let status = results.passed() ? 'passed' : 'failed'; if (results.totalCount === 0) { // todo: change this to check results.skipped status = 'skipped'; } - this.suiteDivs[suite.id].className += " " + status; + this.suiteDivs[suite.id].className += ' ' + status; }; jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) { @@ -614,24 +614,24 @@ jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) { }; jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { - var results = spec.results(); - var status = results.passed() ? 'passed' : 'failed'; + const results = spec.results(); + let status = results.passed() ? 'passed' : 'failed'; if (results.skipped) { status = 'skipped'; } - var specDiv = this.createDom('div', { className: 'spec ' + status }, - this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), + const specDiv = this.createDom('div', {className: 'spec ' + status}, + this.createDom('a', {className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName())}, 'run'), this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(spec.getFullName()), - title: spec.getFullName() + title: spec.getFullName(), }, spec.description)); - var resultItems = results.getItems(); - var messagesDiv = this.createDom('div', { className: 'messages' }); - for (var i = 0; i < resultItems.length; i++) { - var result = resultItems[i]; + const resultItems = results.getItems(); + const messagesDiv = this.createDom('div', {className: 'messages'}); + for (let i = 0; i < resultItems.length; i++) { + const result = resultItems[i]; if (result.type == 'log') { messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString())); @@ -652,7 +652,7 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { }; jasmine.TrivialReporter.prototype.log = function() { - var console = jasmine.getGlobal().console; + const console = jasmine.getGlobal().console; if (console && console.log) { if (console.log.apply) { console.log.apply(console, arguments); @@ -667,10 +667,10 @@ jasmine.TrivialReporter.prototype.getLocation = function() { }; jasmine.TrivialReporter.prototype.specFilter = function(spec) { - var paramMap = {}; - var params = this.getLocation().search.substring(1).split('&'); - for (var i = 0; i < params.length; i++) { - var p = params[i].split('='); + const paramMap = {}; + const params = this.getLocation().search.substring(1).split('&'); + for (let i = 0; i < params.length; i++) { + const p = params[i].split('='); paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); } diff --git a/test/jasmine/lib/jasmine-1.3.1/jasmine.js b/test/jasmine/lib/jasmine-1.3.1/jasmine.js index 6b3459b..df018ca 100644 --- a/test/jasmine/lib/jasmine-1.3.1/jasmine.js +++ b/test/jasmine/lib/jasmine-1.3.1/jasmine.js @@ -1,17 +1,17 @@ -var isCommonJS = typeof window == "undefined" && typeof exports == "object"; +const isCommonJS = typeof window == 'undefined' && typeof exports == 'object'; /** * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework. * * @namespace */ -var jasmine = {}; +const jasmine = {}; if (isCommonJS) exports.jasmine = jasmine; /** * @private */ jasmine.unimplementedMethod_ = function() { - throw new Error("unimplemented method"); + throw new Error('unimplemented method'); }; /** @@ -68,7 +68,7 @@ jasmine.getGlobal = function() { * @param name {Function} function to find */ jasmine.bindOriginal_ = function(base, name) { - var original = base[name]; + const original = base[name]; if (original.apply) { return function() { return original.apply(base, arguments); @@ -91,9 +91,9 @@ jasmine.MessageResult = function(values) { }; jasmine.MessageResult.prototype.toString = function() { - var text = ""; - for (var i = 0; i < this.values.length; i++) { - if (i > 0) text += " "; + let text = ''; + for (let i = 0; i < this.values.length; i++) { + if (i > 0) text += ' '; if (jasmine.isString_(this.values[i])) { text += this.values[i]; } else { @@ -111,15 +111,15 @@ jasmine.ExpectationResult = function(params) { this.actual = params.actual; this.message = this.passed_ ? 'Passed.' : params.message; - var trace = (params.trace || new Error(this.message)); + const trace = (params.trace || new Error(this.message)); this.trace = this.passed_ ? '' : trace; }; -jasmine.ExpectationResult.prototype.toString = function () { +jasmine.ExpectationResult.prototype.toString = function() { return this.message; }; -jasmine.ExpectationResult.prototype.passed = function () { +jasmine.ExpectationResult.prototype.passed = function() { return this.passed_; }; @@ -127,7 +127,7 @@ jasmine.ExpectationResult.prototype.passed = function () { * Getter for the Jasmine environment. Ensures one gets created */ jasmine.getEnv = function() { - var env = jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env(); + const env = jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env(); return env; }; @@ -135,30 +135,30 @@ jasmine.getEnv = function() { * @ignore * @private * @param value - * @returns {Boolean} + * @return {Boolean} */ jasmine.isArray_ = function(value) { - return jasmine.isA_("Array", value); + return jasmine.isA_('Array', value); }; /** * @ignore * @private * @param value - * @returns {Boolean} + * @return {Boolean} */ jasmine.isString_ = function(value) { - return jasmine.isA_("String", value); + return jasmine.isA_('String', value); }; /** * @ignore * @private * @param value - * @returns {Boolean} + * @return {Boolean} */ jasmine.isNumber_ = function(value) { - return jasmine.isA_("Number", value); + return jasmine.isA_('Number', value); }; /** @@ -166,7 +166,7 @@ jasmine.isNumber_ = function(value) { * @private * @param {String} typeName * @param value - * @returns {Boolean} + * @return {Boolean} */ jasmine.isA_ = function(typeName, value) { return Object.prototype.toString.apply(value) === '[object ' + typeName + ']'; @@ -176,10 +176,10 @@ jasmine.isA_ = function(typeName, value) { * Pretty printer for expecations. Takes any object and turns it into a human-readable string. * * @param value {Object} an object to be outputted - * @returns {String} + * @return {String} */ jasmine.pp = function(value) { - var stringPrettyPrinter = new jasmine.StringPrettyPrinter(); + const stringPrettyPrinter = new jasmine.StringPrettyPrinter(); stringPrettyPrinter.format(value); return stringPrettyPrinter.string; }; @@ -188,7 +188,7 @@ jasmine.pp = function(value) { * Returns true if the object is a DOM Node. * * @param {Object} obj object to check - * @returns {Boolean} + * @return {Boolean} */ jasmine.isDomNode = function(obj) { return obj.nodeType > 0; @@ -202,7 +202,7 @@ jasmine.isDomNode = function(obj) { * expect(mySpy).toHaveBeenCalledWith(jasmine.any(Function)); * * @param {Class} clazz - * @returns matchable object of the type clazz + * @return matchable object of the type clazz */ jasmine.any = function(clazz) { return new jasmine.Matchers.Any(clazz); @@ -217,10 +217,10 @@ jasmine.any = function(clazz) { * expect(mySpy).toHaveBeenCalledWith(jasmine.objectContaining({foo: "bar"}); * * @param sample {Object} sample - * @returns matchable object for the sample + * @return matchable object for the sample */ -jasmine.objectContaining = function (sample) { - return new jasmine.Matchers.ObjectContaining(sample); +jasmine.objectContaining = function(sample) { + return new jasmine.Matchers.ObjectContaining(sample); }; /** @@ -401,11 +401,10 @@ jasmine.Spy.prototype.reset = function() { }; jasmine.createSpy = function(name) { - var spyObj = function() { spyObj.wasCalled = true; spyObj.callCount++; - var args = jasmine.util.argsToArray(arguments); + const args = jasmine.util.argsToArray(arguments); spyObj.mostRecentCall.object = this; spyObj.mostRecentCall.args = args; spyObj.argsForCall.push(args); @@ -413,9 +412,9 @@ jasmine.createSpy = function(name) { return spyObj.plan.apply(this, arguments); }; - var spy = new jasmine.Spy(name); + const spy = new jasmine.Spy(name); - for (var prop in spy) { + for (const prop in spy) { spyObj[prop] = spy[prop]; } @@ -428,7 +427,7 @@ jasmine.createSpy = function(name) { * Determines whether an object is a spy. * * @param {jasmine.Spy|Object} putativeSpy - * @returns {Boolean} + * @return {Boolean} */ jasmine.isSpy = function(putativeSpy) { return putativeSpy && putativeSpy.isSpy; @@ -445,8 +444,8 @@ jasmine.createSpyObj = function(baseName, methodNames) { if (!jasmine.isArray_(methodNames) || methodNames.length === 0) { throw new Error('createSpyObj requires a non-empty array of method names to create spies for'); } - var obj = {}; - for (var i = 0; i < methodNames.length; i++) { + const obj = {}; + for (let i = 0; i < methodNames.length; i++) { obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]); } return obj; @@ -458,7 +457,7 @@ jasmine.createSpyObj = function(baseName, methodNames) { * Be careful not to leave calls to jasmine.log in production code. */ jasmine.log = function() { - var spec = jasmine.getEnv().currentSpec; + const spec = jasmine.getEnv().currentSpec; spec.log.apply(spec, arguments); }; @@ -477,7 +476,7 @@ jasmine.log = function() { * @param methodName * @return {jasmine.Spy} a Jasmine spy that can be chained with all spy methods */ -var spyOn = function(obj, methodName) { +const spyOn = function(obj, methodName) { return jasmine.getEnv().currentSpec.spyOn(obj, methodName); }; if (isCommonJS) exports.spyOn = spyOn; @@ -495,7 +494,7 @@ if (isCommonJS) exports.spyOn = spyOn; * @param {String} desc description of this specification * @param {Function} func defines the preconditions and expectations of the spec */ -var it = function(desc, func) { +const it = function(desc, func) { return jasmine.getEnv().it(desc, func); }; if (isCommonJS) exports.it = it; @@ -508,7 +507,7 @@ if (isCommonJS) exports.it = it; * @param {String} desc description of this specification * @param {Function} func defines the preconditions and expectations of the spec */ -var xit = function(desc, func) { +const xit = function(desc, func) { return jasmine.getEnv().xit(desc, func); }; if (isCommonJS) exports.xit = xit; @@ -522,7 +521,7 @@ if (isCommonJS) exports.xit = xit; * @param {Object} actual Actual value to test against and expected value * @return {jasmine.Matchers} */ -var expect = function(actual) { +const expect = function(actual) { return jasmine.getEnv().currentSpec.expect(actual); }; if (isCommonJS) exports.expect = expect; @@ -532,7 +531,7 @@ if (isCommonJS) exports.expect = expect; * * @param {Function} func Function that defines part of a jasmine spec. */ -var runs = function(func) { +const runs = function(func) { jasmine.getEnv().currentSpec.runs(func); }; if (isCommonJS) exports.runs = runs; @@ -543,7 +542,7 @@ if (isCommonJS) exports.runs = runs; * @deprecated Use waitsFor() instead * @param {Number} timeout milliseconds to wait */ -var waits = function(timeout) { +const waits = function(timeout) { jasmine.getEnv().currentSpec.waits(timeout); }; if (isCommonJS) exports.waits = waits; @@ -555,7 +554,7 @@ if (isCommonJS) exports.waits = waits; * @param {String} optional_timeoutMessage * @param {Number} optional_timeout */ -var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { +const waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments); }; if (isCommonJS) exports.waitsFor = waitsFor; @@ -567,7 +566,7 @@ if (isCommonJS) exports.waitsFor = waitsFor; * * @param {Function} beforeEachFunction */ -var beforeEach = function(beforeEachFunction) { +const beforeEach = function(beforeEachFunction) { jasmine.getEnv().beforeEach(beforeEachFunction); }; if (isCommonJS) exports.beforeEach = beforeEach; @@ -579,7 +578,7 @@ if (isCommonJS) exports.beforeEach = beforeEach; * * @param {Function} afterEachFunction */ -var afterEach = function(afterEachFunction) { +const afterEach = function(afterEachFunction) { jasmine.getEnv().afterEach(afterEachFunction); }; if (isCommonJS) exports.afterEach = afterEach; @@ -599,7 +598,7 @@ if (isCommonJS) exports.afterEach = afterEach; * @param {String} description A string, usually the class under test. * @param {Function} specDefinitions function that defines several specs. */ -var describe = function(description, specDefinitions) { +const describe = function(description, specDefinitions) { return jasmine.getEnv().describe(description, specDefinitions); }; if (isCommonJS) exports.describe = describe; @@ -610,36 +609,36 @@ if (isCommonJS) exports.describe = describe; * @param {String} description A string, usually the class under test. * @param {Function} specDefinitions function that defines several specs. */ -var xdescribe = function(description, specDefinitions) { +const xdescribe = function(description, specDefinitions) { return jasmine.getEnv().xdescribe(description, specDefinitions); }; if (isCommonJS) exports.xdescribe = xdescribe; // Provide the XMLHttpRequest class for IE 5.x-6.x: -jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function() { +jasmine.XmlHttpRequest = (typeof XMLHttpRequest == 'undefined') ? function() { function tryIt(f) { try { return f(); - } catch(e) { + } catch (e) { } return null; } - var xhr = tryIt(function() { - return new ActiveXObject("Msxml2.XMLHTTP.6.0"); + const xhr = tryIt(function() { + return new ActiveXObject('Msxml2.XMLHTTP.6.0'); }) || tryIt(function() { - return new ActiveXObject("Msxml2.XMLHTTP.3.0"); + return new ActiveXObject('Msxml2.XMLHTTP.3.0'); }) || tryIt(function() { - return new ActiveXObject("Msxml2.XMLHTTP"); + return new ActiveXObject('Msxml2.XMLHTTP'); }) || tryIt(function() { - return new ActiveXObject("Microsoft.XMLHTTP"); + return new ActiveXObject('Microsoft.XMLHTTP'); }); - if (!xhr) throw new Error("This browser does not support XMLHttpRequest."); + if (!xhr) throw new Error('This browser does not support XMLHttpRequest.'); return xhr; } : XMLHttpRequest; @@ -659,31 +658,29 @@ jasmine.util.inherit = function(childClass, parentClass) { /** * @private */ - var subclass = function() { + const subclass = function() { }; subclass.prototype = parentClass.prototype; childClass.prototype = new subclass(); }; jasmine.util.formatException = function(e) { - var lineNumber; + let lineNumber; if (e.line) { lineNumber = e.line; - } - else if (e.lineNumber) { + } else if (e.lineNumber) { lineNumber = e.lineNumber; } - var file; + let file; if (e.sourceURL) { file = e.sourceURL; - } - else if (e.fileName) { + } else if (e.fileName) { file = e.fileName; } - var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString(); + let message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString(); if (file && lineNumber) { message += ' in ' + file + ' (line ' + lineNumber + ')'; @@ -695,18 +692,18 @@ jasmine.util.formatException = function(e) { jasmine.util.htmlEscape = function(str) { if (!str) return str; return str.replace(/&/g, '&') - .replace(//g, '>'); + .replace(//g, '>'); }; jasmine.util.argsToArray = function(args) { - var arrayOfArgs = []; - for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]); + const arrayOfArgs = []; + for (let i = 0; i < args.length; i++) arrayOfArgs.push(args[i]); return arrayOfArgs; }; jasmine.util.extend = function(destination, source) { - for (var property in source) destination[property] = source[property]; + for (const property in source) destination[property] = source[property]; return destination; }; @@ -749,9 +746,9 @@ jasmine.Env.prototype.setInterval = jasmine.setInterval; jasmine.Env.prototype.clearInterval = jasmine.clearInterval; /** - * @returns an object containing jasmine version build info, if set. + * @return an object containing jasmine version build info, if set. */ -jasmine.Env.prototype.version = function () { +jasmine.Env.prototype.version = function() { if (jasmine.version_) { return jasmine.version_; } else { @@ -760,33 +757,33 @@ jasmine.Env.prototype.version = function () { }; /** - * @returns string containing jasmine version build info, if set. + * @return string containing jasmine version build info, if set. */ jasmine.Env.prototype.versionString = function() { if (!jasmine.version_) { - return "version unknown"; + return 'version unknown'; } - var version = this.version(); - var versionString = version.major + "." + version.minor + "." + version.build; + const version = this.version(); + let versionString = version.major + '.' + version.minor + '.' + version.build; if (version.release_candidate) { - versionString += ".rc" + version.release_candidate; + versionString += '.rc' + version.release_candidate; } - versionString += " revision " + version.revision; + versionString += ' revision ' + version.revision; return versionString; }; /** - * @returns a sequential integer starting at 0 + * @return a sequential integer starting at 0 */ -jasmine.Env.prototype.nextSpecId = function () { +jasmine.Env.prototype.nextSpecId = function() { return this.nextSpecId_++; }; /** - * @returns a sequential integer starting at 0 + * @return a sequential integer starting at 0 */ -jasmine.Env.prototype.nextSuiteId = function () { +jasmine.Env.prototype.nextSuiteId = function() { return this.nextSuiteId_++; }; @@ -803,9 +800,9 @@ jasmine.Env.prototype.execute = function() { }; jasmine.Env.prototype.describe = function(description, specDefinitions) { - var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite); + const suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite); - var parentSuite = this.currentSuite; + const parentSuite = this.currentSuite; if (parentSuite) { parentSuite.add(suite); } else { @@ -814,15 +811,15 @@ jasmine.Env.prototype.describe = function(description, specDefinitions) { this.currentSuite = suite; - var declarationError = null; + let declarationError = null; try { specDefinitions.call(suite); - } catch(e) { + } catch (e) { declarationError = e; } if (declarationError) { - this.it("encountered a declaration exception", function() { + this.it('encountered a declaration exception', function() { throw declarationError; }); } @@ -840,7 +837,7 @@ jasmine.Env.prototype.beforeEach = function(beforeEachFunction) { } }; -jasmine.Env.prototype.currentRunner = function () { +jasmine.Env.prototype.currentRunner = function() { return this.currentRunner_; }; @@ -850,18 +847,17 @@ jasmine.Env.prototype.afterEach = function(afterEachFunction) { } else { this.currentRunner_.afterEach(afterEachFunction); } - }; jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) { return { execute: function() { - } + }, }; }; jasmine.Env.prototype.it = function(description, func) { - var spec = new jasmine.Spec(this, this.currentSuite, description); + const spec = new jasmine.Spec(this, this.currentSuite, description); this.currentSuite.add(spec); this.currentSpec = spec; @@ -876,25 +872,30 @@ jasmine.Env.prototype.xit = function(desc, func) { return { id: this.nextSpecId(), runs: function() { - } + }, }; }; jasmine.Env.prototype.compareRegExps_ = function(a, b, mismatchKeys, mismatchValues) { - if (a.source != b.source) - mismatchValues.push("expected pattern /" + b.source + "/ is not equal to the pattern /" + a.source + "/"); + if (a.source != b.source) { + mismatchValues.push('expected pattern /' + b.source + '/ is not equal to the pattern /' + a.source + '/'); + } - if (a.ignoreCase != b.ignoreCase) - mismatchValues.push("expected modifier i was" + (b.ignoreCase ? " " : " not ") + "set and does not equal the origin modifier"); + if (a.ignoreCase != b.ignoreCase) { + mismatchValues.push('expected modifier i was' + (b.ignoreCase ? ' ' : ' not ') + 'set and does not equal the origin modifier'); + } - if (a.global != b.global) - mismatchValues.push("expected modifier g was" + (b.global ? " " : " not ") + "set and does not equal the origin modifier"); + if (a.global != b.global) { + mismatchValues.push('expected modifier g was' + (b.global ? ' ' : ' not ') + 'set and does not equal the origin modifier'); + } - if (a.multiline != b.multiline) - mismatchValues.push("expected modifier m was" + (b.multiline ? " " : " not ") + "set and does not equal the origin modifier"); + if (a.multiline != b.multiline) { + mismatchValues.push('expected modifier m was' + (b.multiline ? ' ' : ' not ') + 'set and does not equal the origin modifier'); + } - if (a.sticky != b.sticky) - mismatchValues.push("expected modifier y was" + (b.sticky ? " " : " not ") + "set and does not equal the origin modifier"); + if (a.sticky != b.sticky) { + mismatchValues.push('expected modifier y was' + (b.sticky ? ' ' : ' not ') + 'set and does not equal the origin modifier'); + } return (mismatchValues.length === 0); }; @@ -907,29 +908,29 @@ jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchVal a.__Jasmine_been_here_before__ = b; b.__Jasmine_been_here_before__ = a; - var hasKey = function(obj, keyName) { + const hasKey = function(obj, keyName) { return obj !== null && obj[keyName] !== jasmine.undefined; }; for (var property in b) { if (!hasKey(a, property) && hasKey(b, property)) { - mismatchKeys.push("expected has key '" + property + "', but missing from actual."); + mismatchKeys.push('expected has key \'' + property + '\', but missing from actual.'); } } for (property in a) { if (!hasKey(b, property) && hasKey(a, property)) { - mismatchKeys.push("expected missing key '" + property + "', but present in actual."); + mismatchKeys.push('expected missing key \'' + property + '\', but present in actual.'); } } for (property in b) { if (property == '__Jasmine_been_here_before__') continue; if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) { - mismatchValues.push("'" + property + "' was '" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "' in expected, but was '" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "' in actual."); + mismatchValues.push('\'' + property + '\' was \'' + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + '\' in expected, but was \'' + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + '\' in actual.'); } } if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) { - mismatchValues.push("arrays were not the same length"); + mismatchValues.push('arrays were not the same length'); } delete a.__Jasmine_been_here_before__; @@ -941,9 +942,9 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) { mismatchKeys = mismatchKeys || []; mismatchValues = mismatchValues || []; - for (var i = 0; i < this.equalityTesters_.length; i++) { - var equalityTester = this.equalityTesters_[i]; - var result = equalityTester(a, b, this, mismatchKeys, mismatchValues); + for (let i = 0; i < this.equalityTesters_.length; i++) { + const equalityTester = this.equalityTesters_[i]; + const result = equalityTester(a, b, this, mismatchKeys, mismatchValues); if (result !== jasmine.undefined) return result; } @@ -989,17 +990,17 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) { return this.compareRegExps_(a, b, mismatchKeys, mismatchValues); } - if (typeof a === "object" && typeof b === "object") { + if (typeof a === 'object' && typeof b === 'object') { return this.compareObjects_(a, b, mismatchKeys, mismatchValues); } - //Straight check + // Straight check return (a === b); }; jasmine.Env.prototype.contains_ = function(haystack, needle) { if (jasmine.isArray_(haystack)) { - for (var i = 0; i < haystack.length; i++) { + for (let i = 0; i < haystack.length; i++) { if (this.equals_(haystack[i], needle)) return true; } return false; @@ -1017,27 +1018,27 @@ jasmine.Env.prototype.addEqualityTester = function(equalityTester) { jasmine.Reporter = function() { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.Reporter.prototype.reportRunnerStarting = function(runner) { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.Reporter.prototype.reportRunnerResults = function(runner) { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.Reporter.prototype.reportSuiteResults = function(suite) { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.Reporter.prototype.reportSpecStarting = function(spec) { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.Reporter.prototype.reportSpecResults = function(spec) { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.Reporter.prototype.log = function(str) { }; @@ -1058,8 +1059,7 @@ jasmine.Block = function(env, func, spec) { jasmine.Block.prototype.execute = function(onComplete) { if (!jasmine.CATCH_EXCEPTIONS) { this.func.apply(this.spec); - } - else { + } else { try { this.func.apply(this.spec); } catch (e) { @@ -1081,9 +1081,9 @@ jasmine.JsApiReporter = function() { jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) { this.started = true; - var suites = runner.topLevelSuites(); - for (var i = 0; i < suites.length; i++) { - var suite = suites[i]; + const suites = runner.topLevelSuites(); + for (let i = 0; i < suites.length; i++) { + const suite = suites[i]; this.suites_.push(this.summarize_(suite)); } }; @@ -1093,17 +1093,17 @@ jasmine.JsApiReporter.prototype.suites = function() { }; jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) { - var isSuite = suiteOrSpec instanceof jasmine.Suite; - var summary = { + const isSuite = suiteOrSpec instanceof jasmine.Suite; + const summary = { id: suiteOrSpec.id, name: suiteOrSpec.description, type: isSuite ? 'suite' : 'spec', - children: [] + children: [], }; - + if (isSuite) { - var children = suiteOrSpec.children(); - for (var i = 0; i < children.length; i++) { + const children = suiteOrSpec.children(); + for (let i = 0; i < children.length; i++) { summary.children.push(this.summarize_(children[i])); } } @@ -1118,55 +1118,55 @@ jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) { return this.results_[specId]; }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) { this.finished = true; }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) { }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) { this.results_[spec.id] = { messages: spec.results().getItems(), - result: spec.results().failedCount > 0 ? "failed" : "passed" + result: spec.results().failedCount > 0 ? 'failed' : 'passed', }; }; -//noinspection JSUnusedLocalSymbols +// noinspection JSUnusedLocalSymbols jasmine.JsApiReporter.prototype.log = function(str) { }; -jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){ - var results = {}; - for (var i = 0; i < specIds.length; i++) { - var specId = specIds[i]; +jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds) { + const results = {}; + for (let i = 0; i < specIds.length; i++) { + const specId = specIds[i]; results[specId] = this.summarizeResult_(this.results_[specId]); } return results; }; -jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){ - var summaryMessages = []; - var messagesLength = result.messages.length; - for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) { - var resultMessage = result.messages[messageIndex]; +jasmine.JsApiReporter.prototype.summarizeResult_ = function(result) { + const summaryMessages = []; + const messagesLength = result.messages.length; + for (let messageIndex = 0; messageIndex < messagesLength; messageIndex++) { + const resultMessage = result.messages[messageIndex]; summaryMessages.push({ text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined, passed: resultMessage.passed ? resultMessage.passed() : true, type: resultMessage.type, message: resultMessage.message, trace: { - stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined - } + stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined, + }, }); } return { - result : result.result, - messages : summaryMessages + result: result.result, + messages: summaryMessages, }; }; @@ -1186,26 +1186,26 @@ jasmine.Matchers = function(env, actual, spec, opt_isNot) { // todo: @deprecated as of Jasmine 0.11, remove soon [xw] jasmine.Matchers.pp = function(str) { - throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!"); + throw new Error('jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!'); }; // todo: @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. [xw] jasmine.Matchers.prototype.report = function(result, failing_message, details) { - throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs"); + throw new Error('As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs'); }; jasmine.Matchers.wrapInto_ = function(prototype, matchersClass) { - for (var methodName in prototype) { + for (const methodName in prototype) { if (methodName == 'report') continue; - var orig = prototype[methodName]; + const orig = prototype[methodName]; matchersClass.prototype[methodName] = jasmine.Matchers.matcherFn_(methodName, orig); } }; jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) { return function() { - var matcherArgs = jasmine.util.argsToArray(arguments); - var result = matcherFunction.apply(this, arguments); + const matcherArgs = jasmine.util.argsToArray(arguments); + let result = matcherFunction.apply(this, arguments); if (this.isNot) { result = !result; @@ -1213,7 +1213,7 @@ jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) { if (this.reportWasCalled_) return result; - var message; + let message; if (!result) { if (this.message) { message = this.message.apply(this, arguments); @@ -1221,23 +1221,25 @@ jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) { message = message[this.isNot ? 1 : 0]; } } else { - var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); }); - message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate; + const englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { + return ' ' + s.toLowerCase(); + }); + message = 'Expected ' + jasmine.pp(this.actual) + (this.isNot ? ' not ' : ' ') + englishyPredicate; if (matcherArgs.length > 0) { - for (var i = 0; i < matcherArgs.length; i++) { - if (i > 0) message += ","; - message += " " + jasmine.pp(matcherArgs[i]); + for (let i = 0; i < matcherArgs.length; i++) { + if (i > 0) message += ','; + message += ' ' + jasmine.pp(matcherArgs[i]); } } - message += "."; + message += '.'; } } - var expectationResult = new jasmine.ExpectationResult({ + const expectationResult = new jasmine.ExpectationResult({ matcherName: matcherName, passed: result, expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0], actual: this.actual, - message: message + message: message, }); this.spec.addMatcherResult(expectationResult); return jasmine.undefined; @@ -1245,8 +1247,6 @@ jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) { }; - - /** * toBe: compares the actual to the expected using === * @param expected @@ -1326,11 +1326,11 @@ jasmine.Matchers.prototype.toBeNull = function() { * Matcher that compares the actual to NaN. */ jasmine.Matchers.prototype.toBeNaN = function() { - this.message = function() { - return [ "Expected " + jasmine.pp(this.actual) + " to be NaN." ]; - }; + this.message = function() { + return ['Expected ' + jasmine.pp(this.actual) + ' to be NaN.']; + }; - return (this.actual !== this.actual); + return (this.actual !== this.actual); }; /** @@ -1363,8 +1363,8 @@ jasmine.Matchers.prototype.toHaveBeenCalled = function() { this.message = function() { return [ - "Expected spy " + this.actual.identity + " to have been called.", - "Expected spy " + this.actual.identity + " not to have been called." + 'Expected spy ' + this.actual.identity + ' to have been called.', + 'Expected spy ' + this.actual.identity + ' not to have been called.', ]; }; @@ -1390,8 +1390,8 @@ jasmine.Matchers.prototype.wasNotCalled = function() { this.message = function() { return [ - "Expected spy " + this.actual.identity + " to not have been called.", - "Expected spy " + this.actual.identity + " to have been called." + 'Expected spy ' + this.actual.identity + ' to not have been called.', + 'Expected spy ' + this.actual.identity + ' to have been called.', ]; }; @@ -1405,17 +1405,17 @@ jasmine.Matchers.prototype.wasNotCalled = function() { * */ jasmine.Matchers.prototype.toHaveBeenCalledWith = function() { - var expectedArgs = jasmine.util.argsToArray(arguments); + const expectedArgs = jasmine.util.argsToArray(arguments); if (!jasmine.isSpy(this.actual)) { throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); } this.message = function() { - var invertedMessage = "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was."; - var positiveMessage = ""; + const invertedMessage = 'Expected spy ' + this.actual.identity + ' not to have been called with ' + jasmine.pp(expectedArgs) + ' but it was.'; + let positiveMessage = ''; if (this.actual.callCount === 0) { - positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called."; + positiveMessage = 'Expected spy ' + this.actual.identity + ' to have been called with ' + jasmine.pp(expectedArgs) + ' but it was never called.'; } else { - positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but actual calls were " + jasmine.pp(this.actual.argsForCall).replace(/^\[ | \]$/g, '') + positiveMessage = 'Expected spy ' + this.actual.identity + ' to have been called with ' + jasmine.pp(expectedArgs) + ' but actual calls were ' + jasmine.pp(this.actual.argsForCall).replace(/^\[ | \]$/g, ''); } return [positiveMessage, invertedMessage]; }; @@ -1428,15 +1428,15 @@ jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.prototype.toHaveBeen /** @deprecated Use expect(xxx).not.toHaveBeenCalledWith() instead */ jasmine.Matchers.prototype.wasNotCalledWith = function() { - var expectedArgs = jasmine.util.argsToArray(arguments); + const expectedArgs = jasmine.util.argsToArray(arguments); if (!jasmine.isSpy(this.actual)) { throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); } this.message = function() { return [ - "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was", - "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was" + 'Expected spy not to have been called with ' + jasmine.pp(expectedArgs) + ' but it was', + 'Expected spy to have been called with ' + jasmine.pp(expectedArgs) + ' but it was', ]; }; @@ -1490,8 +1490,8 @@ jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) { * @param {String} [expected] */ jasmine.Matchers.prototype.toThrow = function(expected) { - var result = false; - var exception; + let result = false; + let exception; if (typeof this.actual != 'function') { throw new Error('Actual is not a function'); } @@ -1504,13 +1504,13 @@ jasmine.Matchers.prototype.toThrow = function(expected) { result = (expected === jasmine.undefined || this.env.equals_(exception.message || exception, expected.message || expected)); } - var not = this.isNot ? "not " : ""; + const not = this.isNot ? 'not ' : ''; this.message = function() { if (exception && (expected === jasmine.undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) { - return ["Expected function " + not + "to throw", expected ? expected.message || expected : "an exception", ", but it threw", exception.message || exception].join(' '); + return ['Expected function ' + not + 'to throw', expected ? expected.message || expected : 'an exception', ', but it threw', exception.message || exception].join(' '); } else { - return "Expected function to throw an exception."; + return 'Expected function to throw an exception.'; } }; @@ -1545,7 +1545,7 @@ jasmine.Matchers.Any.prototype.jasmineToString = function() { return ''; }; -jasmine.Matchers.ObjectContaining = function (sample) { +jasmine.Matchers.ObjectContaining = function(sample) { this.sample = sample; }; @@ -1553,26 +1553,25 @@ jasmine.Matchers.ObjectContaining.prototype.jasmineMatches = function(other, mis mismatchKeys = mismatchKeys || []; mismatchValues = mismatchValues || []; - var env = jasmine.getEnv(); + const env = jasmine.getEnv(); - var hasKey = function(obj, keyName) { + const hasKey = function(obj, keyName) { return obj != null && obj[keyName] !== jasmine.undefined; }; - for (var property in this.sample) { + for (const property in this.sample) { if (!hasKey(other, property) && hasKey(this.sample, property)) { - mismatchKeys.push("expected has key '" + property + "', but missing from actual."); - } - else if (!env.equals_(this.sample[property], other[property], mismatchKeys, mismatchValues)) { - mismatchValues.push("'" + property + "' was '" + (other[property] ? jasmine.util.htmlEscape(other[property].toString()) : other[property]) + "' in expected, but was '" + (this.sample[property] ? jasmine.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + "' in actual."); + mismatchKeys.push('expected has key \'' + property + '\', but missing from actual.'); + } else if (!env.equals_(this.sample[property], other[property], mismatchKeys, mismatchValues)) { + mismatchValues.push('\'' + property + '\' was \'' + (other[property] ? jasmine.util.htmlEscape(other[property].toString()) : other[property]) + '\' in expected, but was \'' + (this.sample[property] ? jasmine.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + '\' in actual.'); } } return (mismatchKeys.length === 0 && mismatchValues.length === 0); }; -jasmine.Matchers.ObjectContaining.prototype.jasmineToString = function () { - return ""; +jasmine.Matchers.ObjectContaining.prototype.jasmineToString = function() { + return ''; }; // Mock setTimeout, clearTimeout // Contributed by Pivotal Computer Systems, www.pivotalsf.com @@ -1580,7 +1579,7 @@ jasmine.Matchers.ObjectContaining.prototype.jasmineToString = function () { jasmine.FakeTimer = function() { this.reset(); - var self = this; + const self = this; self.setTimeout = function(funcToCall, millis) { self.timeoutsMade++; self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false); @@ -1600,7 +1599,6 @@ jasmine.FakeTimer = function() { self.clearInterval = function(timeoutKey) { self.scheduledFunctions[timeoutKey] = jasmine.undefined; }; - }; jasmine.FakeTimer.prototype.reset = function() { @@ -1610,16 +1608,16 @@ jasmine.FakeTimer.prototype.reset = function() { }; jasmine.FakeTimer.prototype.tick = function(millis) { - var oldMillis = this.nowMillis; - var newMillis = oldMillis + millis; + const oldMillis = this.nowMillis; + const newMillis = oldMillis + millis; this.runFunctionsWithinRange(oldMillis, newMillis); this.nowMillis = newMillis; }; jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) { - var scheduledFunc; - var funcsToRun = []; - for (var timeoutKey in this.scheduledFunctions) { + let scheduledFunc; + const funcsToRun = []; + for (const timeoutKey in this.scheduledFunctions) { scheduledFunc = this.scheduledFunctions[timeoutKey]; if (scheduledFunc != jasmine.undefined && scheduledFunc.runAtMillis >= oldMillis && @@ -1633,9 +1631,9 @@ jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMil funcsToRun.sort(function(a, b) { return a.runAtMillis - b.runAtMillis; }); - for (var i = 0; i < funcsToRun.length; ++i) { + for (let i = 0; i < funcsToRun.length; ++i) { try { - var funcToRun = funcsToRun[i]; + const funcToRun = funcsToRun[i]; this.nowMillis = funcToRun.runAtMillis; funcToRun.funcToCall(); if (funcToRun.recurring) { @@ -1644,7 +1642,7 @@ jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMil funcToRun.millis, true); } - } catch(e) { + } catch (e) { } } this.runFunctionsWithinRange(oldMillis, nowMillis); @@ -1657,7 +1655,7 @@ jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, funcToCall: funcToCall, recurring: recurring, timeoutKey: timeoutKey, - millis: millis + millis: millis, }; }; @@ -1687,7 +1685,7 @@ jasmine.Clock = { useMock: function() { if (!jasmine.Clock.isInstalled()) { - var spec = jasmine.getEnv().currentSpec; + const spec = jasmine.getEnv().currentSpec; spec.after(jasmine.Clock.uninstallMock); jasmine.Clock.installMock(); @@ -1707,12 +1705,12 @@ jasmine.Clock = { setTimeout: jasmine.getGlobal().setTimeout, clearTimeout: jasmine.getGlobal().clearTimeout, setInterval: jasmine.getGlobal().setInterval, - clearInterval: jasmine.getGlobal().clearInterval + clearInterval: jasmine.getGlobal().clearInterval, }, assertInstalled: function() { if (!jasmine.Clock.isInstalled()) { - throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()"); + throw new Error('Mock clock is not installed, use jasmine.Clock.useMock()'); } }, @@ -1720,11 +1718,11 @@ jasmine.Clock = { return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer; }, - installed: null + installed: null, }; jasmine.Clock.installed = jasmine.Clock.real; -//else for IE support +// else for IE support jasmine.getGlobal().setTimeout = function(funcToCall, millis) { if (jasmine.Clock.installed.setTimeout.apply) { return jasmine.Clock.installed.setTimeout.apply(this, arguments); @@ -1770,20 +1768,20 @@ jasmine.MultiReporter.prototype.addReporter = function(reporter) { }; (function() { - var functionNames = [ - "reportRunnerStarting", - "reportRunnerResults", - "reportSuiteResults", - "reportSpecStarting", - "reportSpecResults", - "log" + const functionNames = [ + 'reportRunnerStarting', + 'reportRunnerResults', + 'reportSuiteResults', + 'reportSpecStarting', + 'reportSpecResults', + 'log', ]; - for (var i = 0; i < functionNames.length; i++) { - var functionName = functionNames[i]; + for (let i = 0; i < functionNames.length; i++) { + const functionName = functionNames[i]; jasmine.MultiReporter.prototype[functionName] = (function(functionName) { return function() { - for (var j = 0; j < this.subReporters_.length; j++) { - var subReporter = this.subReporters_[j]; + for (let j = 0; j < this.subReporters_.length; j++) { + const subReporter = this.subReporters_[j]; if (subReporter[functionName]) { subReporter[functionName].apply(subReporter, arguments); } @@ -1867,7 +1865,7 @@ jasmine.NestedResults.prototype.addResult = function(result) { }; /** - * @returns {Boolean} True if everything below passed + * @return {Boolean} True if everything below passed */ jasmine.NestedResults.prototype.passed = function() { return this.passedCount === this.totalCount; @@ -1898,7 +1896,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) { } else if (typeof value === 'string') { this.emitString(value); } else if (jasmine.isSpy(value)) { - this.emitScalar("spy on " + value.identity); + this.emitScalar('spy on ' + value.identity); } else if (value instanceof RegExp) { this.emitScalar(value.toString()); } else if (typeof value === 'function') { @@ -1926,10 +1924,10 @@ jasmine.PrettyPrinter.prototype.format = function(value) { }; jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) { - for (var property in obj) { + for (const property in obj) { if (!obj.hasOwnProperty(property)) continue; if (property == '__Jasmine_been_here_before__') continue; - fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined && + fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined && obj.__lookupGetter__(property) !== null) : false); } }; @@ -1951,17 +1949,17 @@ jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) { }; jasmine.StringPrettyPrinter.prototype.emitString = function(value) { - this.append("'" + value + "'"); + this.append('\'' + value + '\''); }; jasmine.StringPrettyPrinter.prototype.emitArray = function(array) { if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) { - this.append("Array"); + this.append('Array'); return; } this.append('[ '); - for (var i = 0; i < array.length; i++) { + for (let i = 0; i < array.length; i++) { if (i > 0) { this.append(', '); } @@ -1972,13 +1970,13 @@ jasmine.StringPrettyPrinter.prototype.emitArray = function(array) { jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) { if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) { - this.append("Object"); + this.append('Object'); return; } - var self = this; + const self = this; this.append('{ '); - var first = true; + let first = true; this.iterateObject(obj, function(property, isGetter) { if (first) { @@ -2056,17 +2054,17 @@ jasmine.Queue.prototype.isRunning = function() { jasmine.Queue.LOOP_DONT_RECURSE = true; jasmine.Queue.prototype.next_ = function() { - var self = this; - var goAgain = true; + const self = this; + let goAgain = true; while (goAgain) { goAgain = false; - + if (self.index < self.blocks.length && !(this.abort && !this.ensured[self.index])) { var calledSynchronously = true; var completedSynchronously = false; - var onComplete = function () { + const onComplete = function() { if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) { completedSynchronously = true; return; @@ -2079,7 +2077,7 @@ jasmine.Queue.prototype.next_ = function() { self.offset = 0; self.index++; - var now = new Date().getTime(); + const now = new Date().getTime(); if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { self.env.lastUpdate = now; self.env.setTimeout(function() { @@ -2099,7 +2097,6 @@ jasmine.Queue.prototype.next_ = function() { if (completedSynchronously) { onComplete(); } - } else { self.running = false; if (self.onComplete) { @@ -2110,8 +2107,8 @@ jasmine.Queue.prototype.next_ = function() { }; jasmine.Queue.prototype.results = function() { - var results = new jasmine.NestedResults(); - for (var i = 0; i < this.blocks.length; i++) { + const results = new jasmine.NestedResults(); + for (let i = 0; i < this.blocks.length; i++) { if (this.blocks[i].results) { results.addResult(this.blocks[i].results()); } @@ -2127,7 +2124,7 @@ jasmine.Queue.prototype.results = function() { * @param {jasmine.Env} env */ jasmine.Runner = function(env) { - var self = this; + const self = this; self.env = env; self.queue = new jasmine.Queue(env); self.before_ = []; @@ -2136,23 +2133,23 @@ jasmine.Runner = function(env) { }; jasmine.Runner.prototype.execute = function() { - var self = this; + const self = this; if (self.env.reporter.reportRunnerStarting) { self.env.reporter.reportRunnerStarting(this); } - self.queue.start(function () { + self.queue.start(function() { self.finishCallback(); }); }; jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) { beforeEachFunction.typeName = 'beforeEach'; - this.before_.splice(0,0,beforeEachFunction); + this.before_.splice(0, 0, beforeEachFunction); }; jasmine.Runner.prototype.afterEach = function(afterEachFunction) { afterEachFunction.typeName = 'afterEach'; - this.after_.splice(0,0,afterEachFunction); + this.after_.splice(0, 0, afterEachFunction); }; @@ -2171,10 +2168,10 @@ jasmine.Runner.prototype.add = function(block) { this.queue.add(block); }; -jasmine.Runner.prototype.specs = function () { - var suites = this.suites(); - var specs = []; - for (var i = 0; i < suites.length; i++) { +jasmine.Runner.prototype.specs = function() { + const suites = this.suites(); + let specs = []; + for (let i = 0; i < suites.length; i++) { specs = specs.concat(suites[i].specs()); } return specs; @@ -2185,8 +2182,8 @@ jasmine.Runner.prototype.suites = function() { }; jasmine.Runner.prototype.topLevelSuites = function() { - var topLevelSuites = []; - for (var i = 0; i < this.suites_.length; i++) { + const topLevelSuites = []; + for (let i = 0; i < this.suites_.length; i++) { if (!this.suites_[i].parentSuite) { topLevelSuites.push(this.suites_[i]); } @@ -2212,7 +2209,7 @@ jasmine.Spec = function(env, suite, description) { if (!suite) { throw new Error('jasmine.Suite() required'); } - var spec = this; + const spec = this; spec.id = env.nextSpecId ? env.nextSpecId() : null; spec.env = env; spec.suite = suite; @@ -2245,13 +2242,13 @@ jasmine.Spec.prototype.log = function() { return this.results_.log(arguments); }; -jasmine.Spec.prototype.runs = function (func) { - var block = new jasmine.Block(this.env, func, this); +jasmine.Spec.prototype.runs = function(func) { + const block = new jasmine.Block(this.env, func, this); this.addToQueue(block); return this; }; -jasmine.Spec.prototype.addToQueue = function (block) { +jasmine.Spec.prototype.addToQueue = function(block) { if (this.queue.isRunning()) { this.queue.insertNext(block); } else { @@ -2267,7 +2264,7 @@ jasmine.Spec.prototype.addMatcherResult = function(result) { }; jasmine.Spec.prototype.expect = function(actual) { - var positive = new (this.getMatchersClass_())(this.env, actual, this); + const positive = new (this.getMatchersClass_())(this.env, actual, this); positive.not = new (this.getMatchersClass_())(this.env, actual, this, true); return positive; }; @@ -2279,7 +2276,7 @@ jasmine.Spec.prototype.expect = function(actual) { * @param {Number} timeout milliseconds to wait */ jasmine.Spec.prototype.waits = function(timeout) { - var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this); + const waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this); this.addToQueue(waitsFunc); return this; }; @@ -2292,12 +2289,12 @@ jasmine.Spec.prototype.waits = function(timeout) { * @param {Number} optional_timeout */ jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { - var latchFunction_ = null; - var optional_timeoutMessage_ = null; - var optional_timeout_ = null; + let latchFunction_ = null; + let optional_timeoutMessage_ = null; + let optional_timeout_ = null; - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; + for (let i = 0; i < arguments.length; i++) { + const arg = arguments[i]; switch (typeof arg) { case 'function': latchFunction_ = arg; @@ -2311,16 +2308,16 @@ jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessag } } - var waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this); + const waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this); this.addToQueue(waitsForFunc); return this; }; -jasmine.Spec.prototype.fail = function (e) { - var expectationResult = new jasmine.ExpectationResult({ +jasmine.Spec.prototype.fail = function(e) { + const expectationResult = new jasmine.ExpectationResult({ passed: false, message: e ? jasmine.util.formatException(e) : 'Exception', - trace: { stack: e.stack } + trace: {stack: e.stack}, }); this.results_.addResult(expectationResult); }; @@ -2330,8 +2327,8 @@ jasmine.Spec.prototype.getMatchersClass_ = function() { }; jasmine.Spec.prototype.addMatchers = function(matchersPrototype) { - var parent = this.getMatchersClass_(); - var newMatchersClass = function() { + const parent = this.getMatchersClass_(); + const newMatchersClass = function() { parent.apply(this, arguments); }; jasmine.util.inherit(newMatchersClass, parent); @@ -2360,7 +2357,7 @@ jasmine.Spec.prototype.after = function(doAfter) { }; jasmine.Spec.prototype.execute = function(onComplete) { - var spec = this; + const spec = this; if (!spec.env.specFilter(spec)) { spec.results_.skipped = true; spec.finish(onComplete); @@ -2373,14 +2370,14 @@ jasmine.Spec.prototype.execute = function(onComplete) { spec.addBeforesAndAftersToQueue(); - spec.queue.start(function () { + spec.queue.start(function() { spec.finish(onComplete); }); }; jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() { - var runner = this.env.currentRunner(); - var i; + const runner = this.env.currentRunner(); + let i; for (var suite = this.suite; suite; suite = suite.parentSuite) { for (i = 0; i < suite.before_.length; i++) { @@ -2409,7 +2406,7 @@ jasmine.Spec.prototype.explodes = function() { jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) { if (obj == jasmine.undefined) { - throw "spyOn could not find an object to spy upon for " + methodName + "()"; + throw 'spyOn could not find an object to spy upon for ' + methodName + '()'; } if (!ignoreMethodDoesntExist && obj[methodName] === jasmine.undefined) { @@ -2420,7 +2417,7 @@ jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist throw new Error(methodName + ' has already been spied upon'); } - var spyObj = jasmine.createSpy(methodName); + const spyObj = jasmine.createSpy(methodName); this.spies_.push(spyObj); spyObj.baseObj = obj; @@ -2433,8 +2430,8 @@ jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist }; jasmine.Spec.prototype.removeAllSpies = function() { - for (var i = 0; i < this.spies_.length; i++) { - var spy = this.spies_[i]; + for (let i = 0; i < this.spies_.length; i++) { + const spy = this.spies_[i]; spy.baseObj[spy.methodName] = spy.originalValue; } this.spies_ = []; @@ -2450,7 +2447,7 @@ jasmine.Spec.prototype.removeAllSpies = function() { * @param {jasmine.Suite} parentSuite */ jasmine.Suite = function(env, description, specDefinitions, parentSuite) { - var self = this; + const self = this; self.id = env.nextSuiteId ? env.nextSuiteId() : null; self.description = description; self.queue = new jasmine.Queue(env); @@ -2464,8 +2461,8 @@ jasmine.Suite = function(env, description, specDefinitions, parentSuite) { }; jasmine.Suite.prototype.getFullName = function() { - var fullName = this.description; - for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) { + let fullName = this.description; + for (let parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) { fullName = parentSuite.description + ' ' + fullName; } return fullName; @@ -2517,8 +2514,8 @@ jasmine.Suite.prototype.children = function() { }; jasmine.Suite.prototype.execute = function(onComplete) { - var self = this; - this.queue.start(function () { + const self = this; + this.queue.start(function() { self.finish(onComplete); }); }; @@ -2529,11 +2526,11 @@ jasmine.WaitsBlock = function(env, timeout, spec) { jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block); -jasmine.WaitsBlock.prototype.execute = function (onComplete) { +jasmine.WaitsBlock.prototype.execute = function(onComplete) { if (jasmine.VERBOSE) { this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...'); } - this.env.setTimeout(function () { + this.env.setTimeout(function() { onComplete(); }, this.timeout); }; @@ -2563,7 +2560,7 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) { if (jasmine.VERBOSE) { this.env.reporter.log('>> Jasmine waiting for ' + (this.message || 'something to happen')); } - var latchFunctionResult; + let latchFunctionResult; try { latchFunctionResult = this.latchFunction.apply(this.spec); } catch (e) { @@ -2575,17 +2572,17 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) { if (latchFunctionResult) { onComplete(); } else if (this.totalTimeSpentWaitingForLatch >= this.timeout) { - var message = 'timed out after ' + this.timeout + ' msec waiting for ' + (this.message || 'something to happen'); + const message = 'timed out after ' + this.timeout + ' msec waiting for ' + (this.message || 'something to happen'); this.spec.fail({ name: 'timeout', - message: message + message: message, }); this.abort = true; onComplete(); } else { this.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT; - var self = this; + const self = this; this.env.setTimeout(function() { self.execute(onComplete); }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT); @@ -2593,8 +2590,8 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) { }; jasmine.version_= { - "major": 1, - "minor": 3, - "build": 1, - "revision": 1354556913 + 'major': 1, + 'minor': 3, + 'build': 1, + 'revision': 1354556913, }; diff --git a/test/jasmine/lib/jasmine-jsreporter.js b/test/jasmine/lib/jasmine-jsreporter.js index 3d43b2b..1dead7d 100755 --- a/test/jasmine/lib/jasmine-jsreporter.js +++ b/test/jasmine/lib/jasmine-jsreporter.js @@ -27,135 +27,135 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -(function () { - // Ensure that Jasmine library is loaded first - if (!jasmine) { - throw new Exception("[Jasmine JSReporter] 'Jasmine' library not found"); - } +(function() { + // Ensure that Jasmine library is loaded first + if (!jasmine) { + throw new Exception('[Jasmine JSReporter] \'Jasmine\' library not found'); + } - /** + /** * Calculate elapsed time, in Seconds. * @param startMs Start time in Milliseconds * @param finishMs Finish time in Milliseconds * @return Elapsed time in Seconds */ - function elapsedSec (startMs, finishMs) { - return (finishMs - startMs) / 1000; - } + function elapsedSec(startMs, finishMs) { + return (finishMs - startMs) / 1000; + } - /** + /** * Round an amount to the given number of Digits. * If no number of digits is given, than '2' is assumed. * @param amount Amount to round * @param numOfDecDigits Number of Digits to round to. Default value is '2'. * @return Rounded amount */ - function round (amount, numOfDecDigits) { - numOfDecDigits = numOfDecDigits || 2; - return Math.round(amount * Math.pow(10, numOfDecDigits)) / Math.pow(10, numOfDecDigits); - } + function round(amount, numOfDecDigits) { + numOfDecDigits = numOfDecDigits || 2; + return Math.round(amount * Math.pow(10, numOfDecDigits)) / Math.pow(10, numOfDecDigits); + } - /** + /** * Collect information about a Suite, recursively, and return a JSON result. * @param suite The Jasmine Suite to get data from */ - function getSuiteData (suite) { - var suiteData = { - description : suite.description, - durationSec : 0, - specs: [], - suites: [], - passed: true - }, - specs = suite.specs(), - suites = suite.suites(), - i, ilen; - - // Loop over all the Suite's Specs - for (i = 0, ilen = specs.length; i < ilen; ++i) { - suiteData.specs[i] = { - description : specs[i].description, - durationSec : specs[i].durationSec, - passed : specs[i].results().passedCount === specs[i].results().totalCount, - skipped : specs[i].results().skipped, - passedCount : specs[i].results().passedCount, - failedCount : specs[i].results().failedCount, - totalCount : specs[i].results().totalCount - }; - suiteData.passed = !suiteData.specs[i].passed ? false : suiteData.passed; - suiteData.durationSec += suiteData.specs[i].durationSec; - } - - // Loop over all the Suite's sub-Suites - for (i = 0, ilen = suites.length; i < ilen; ++i) { - suiteData.suites[i] = getSuiteData(suites[i]); //< recursive population - suiteData.passed = !suiteData.suites[i].passed ? false : suiteData.passed; - suiteData.durationSec += suiteData.suites[i].durationSec; - } - - // Rounding duration numbers to 3 decimal digits - suiteData.durationSec = round(suiteData.durationSec, 4); - - return suiteData; + function getSuiteData(suite) { + const suiteData = { + description: suite.description, + durationSec: 0, + specs: [], + suites: [], + passed: true, + }; + const specs = suite.specs(); + const suites = suite.suites(); + let i; let ilen; + + // Loop over all the Suite's Specs + for (i = 0, ilen = specs.length; i < ilen; ++i) { + suiteData.specs[i] = { + description: specs[i].description, + durationSec: specs[i].durationSec, + passed: specs[i].results().passedCount === specs[i].results().totalCount, + skipped: specs[i].results().skipped, + passedCount: specs[i].results().passedCount, + failedCount: specs[i].results().failedCount, + totalCount: specs[i].results().totalCount, + }; + suiteData.passed = !suiteData.specs[i].passed ? false : suiteData.passed; + suiteData.durationSec += suiteData.specs[i].durationSec; } - var JSReporter = function () { - }; + // Loop over all the Suite's sub-Suites + for (i = 0, ilen = suites.length; i < ilen; ++i) { + suiteData.suites[i] = getSuiteData(suites[i]); // < recursive population + suiteData.passed = !suiteData.suites[i].passed ? false : suiteData.passed; + suiteData.durationSec += suiteData.suites[i].durationSec; + } - JSReporter.prototype = { - reportRunnerStarting: function (runner) { - // Nothing to do - }, - - reportSpecStarting: function (spec) { - // Start timing this spec - spec.startedAt = new Date(); - }, - - reportSpecResults: function (spec) { - // Finish timing this spec and calculate duration/delta (in sec) - spec.finishedAt = new Date(); - spec.durationSec = elapsedSec(spec.startedAt.getTime(), spec.finishedAt.getTime()); - }, - - reportSuiteResults: function (suite) { - // Nothing to do - }, - - reportRunnerResults: function (runner) { - var suites = runner.suites(), - i, ilen; - - // Attach results to the "jasmine" object to make those results easy to scrap/find - jasmine.runnerResults = { - suites: [], - durationSec : 0, - passed : true - }; - - // Loop over all the Suites - for (i = 0, ilen = suites.length; i < ilen; ++i) { - if (suites[i].parentSuite === null) { - jasmine.runnerResults.suites[i] = getSuiteData(suites[i]); - // If 1 suite fails, the whole runner fails - jasmine.runnerResults.passed = !jasmine.runnerResults.suites[i].passed ? false : jasmine.runnerResults.passed; - // Add up all the durations - jasmine.runnerResults.durationSec += jasmine.runnerResults.suites[i].durationSec; - } - } - - // Decorate the 'jasmine' object with getters - jasmine.getJSReport = function () { - if (jasmine.runnerResults) { - return jasmine.runnerResults; - } - return null; - }; - jasmine.getJSReportAsString = function () { - return JSON.stringify(jasmine.getJSReport()); - }; + // Rounding duration numbers to 3 decimal digits + suiteData.durationSec = round(suiteData.durationSec, 4); + + return suiteData; + } + + const JSReporter = function() { + }; + + JSReporter.prototype = { + reportRunnerStarting: function(runner) { + // Nothing to do + }, + + reportSpecStarting: function(spec) { + // Start timing this spec + spec.startedAt = new Date(); + }, + + reportSpecResults: function(spec) { + // Finish timing this spec and calculate duration/delta (in sec) + spec.finishedAt = new Date(); + spec.durationSec = elapsedSec(spec.startedAt.getTime(), spec.finishedAt.getTime()); + }, + + reportSuiteResults: function(suite) { + // Nothing to do + }, + + reportRunnerResults: function(runner) { + const suites = runner.suites(); + let i; let ilen; + + // Attach results to the "jasmine" object to make those results easy to scrap/find + jasmine.runnerResults = { + suites: [], + durationSec: 0, + passed: true, + }; + + // Loop over all the Suites + for (i = 0, ilen = suites.length; i < ilen; ++i) { + if (suites[i].parentSuite === null) { + jasmine.runnerResults.suites[i] = getSuiteData(suites[i]); + // If 1 suite fails, the whole runner fails + jasmine.runnerResults.passed = !jasmine.runnerResults.suites[i].passed ? false : jasmine.runnerResults.passed; + // Add up all the durations + jasmine.runnerResults.durationSec += jasmine.runnerResults.suites[i].durationSec; } - }; + } - // export public - jasmine.JSReporter = JSReporter; + // Decorate the 'jasmine' object with getters + jasmine.getJSReport = function() { + if (jasmine.runnerResults) { + return jasmine.runnerResults; + } + return null; + }; + jasmine.getJSReportAsString = function() { + return JSON.stringify(jasmine.getJSReport()); + }; + }, + }; + + // export public + jasmine.JSReporter = JSReporter; })(); diff --git a/test/jasmine/spec/PlayerSpec.js b/test/jasmine/spec/PlayerSpec.js index 79f1022..395fe02 100644 --- a/test/jasmine/spec/PlayerSpec.js +++ b/test/jasmine/spec/PlayerSpec.js @@ -1,34 +1,34 @@ -describe("Player", function() { - var player; - var song; +describe('Player', function() { + let player; + let song; beforeEach(function() { player = new Player(); song = new Song(); }); - it("should be able to play a Song", function() { + it('should be able to play a Song', function() { player.play(song); expect(player.currentlyPlayingSong).toEqual(song); - //demonstrates use of custom matcher + // demonstrates use of custom matcher expect(player).toBePlaying(song); }); - describe("when song has been paused", function() { + describe('when song has been paused', function() { beforeEach(function() { player.play(song); player.pause(); }); - it("should indicate that the song is currently paused", function() { + it('should indicate that the song is currently paused', function() { expect(player.isPlaying).toBeFalsy(); // demonstrates use of 'not' with a custom matcher expect(player).not.toBePlaying(song); }); - it("should be possible to resume", function() { + it('should be possible to resume', function() { player.resume(); expect(player.isPlaying).toBeTruthy(); expect(player.currentlyPlayingSong).toEqual(song); @@ -36,7 +36,7 @@ describe("Player", function() { }); // demonstrates use of spies to intercept and test method calls - it("tells the current song if the user has made it a favorite", function() { + it('tells the current song if the user has made it a favorite', function() { spyOn(song, 'persistFavoriteStatus'); player.play(song); @@ -45,14 +45,14 @@ describe("Player", function() { expect(song.persistFavoriteStatus).toHaveBeenCalledWith(true); }); - //demonstrates use of expected exceptions - describe("#resume", function() { - it("should throw an exception if song is already playing", function() { + // demonstrates use of expected exceptions + describe('#resume', function() { + it('should throw an exception if song is already playing', function() { player.play(song); expect(function() { player.resume(); - }).toThrow("song is already playing"); + }).toThrow('song is already playing'); }); }); -}); \ No newline at end of file +}); diff --git a/test/jasmine/spec/SpecHelper.js b/test/jasmine/spec/SpecHelper.js index e9b8284..3db8f01 100644 --- a/test/jasmine/spec/SpecHelper.js +++ b/test/jasmine/spec/SpecHelper.js @@ -1,9 +1,9 @@ beforeEach(function() { this.addMatchers({ toBePlaying: function(expectedSong) { - var player = this.actual; - return player.currentlyPlayingSong === expectedSong && + const player = this.actual; + return player.currentlyPlayingSong === expectedSong && player.isPlaying; - } + }, }); }); diff --git a/test/jasmine/src/Player.js b/test/jasmine/src/Player.js index fcce826..1d973b2 100644 --- a/test/jasmine/src/Player.js +++ b/test/jasmine/src/Player.js @@ -11,7 +11,7 @@ Player.prototype.pause = function() { Player.prototype.resume = function() { if (this.isPlaying) { - throw new Error("song is already playing"); + throw new Error('song is already playing'); } this.isPlaying = true; @@ -19,4 +19,4 @@ Player.prototype.resume = function() { Player.prototype.makeFavorite = function() { this.currentlyPlayingSong.persistFavoriteStatus(true); -}; \ No newline at end of file +}; diff --git a/test/jasmine/src/Song.js b/test/jasmine/src/Song.js index a8a3f2d..2012cb4 100644 --- a/test/jasmine/src/Song.js +++ b/test/jasmine/src/Song.js @@ -3,5 +3,5 @@ function Song() { Song.prototype.persistFavoriteStatus = function(value) { // something complicated - throw new Error("not yet implemented"); -}; \ No newline at end of file + throw new Error('not yet implemented'); +}; diff --git a/test/mocha/index.js b/test/mocha/index.js index 507566f..924a4cf 100644 --- a/test/mocha/index.js +++ b/test/mocha/index.js @@ -1,4 +1,4 @@ -module.exports = process.env.COV - ? require('./lib-cov/mocha') - : require('./lib/mocha'); \ No newline at end of file +module.exports = process.env.COV ? + require('./lib-cov/mocha') : + require('./lib/mocha'); diff --git a/test/mocha/lib/browser/debug.js b/test/mocha/lib/browser/debug.js index 03cf592..1b718a4 100644 --- a/test/mocha/lib/browser/debug.js +++ b/test/mocha/lib/browser/debug.js @@ -1,5 +1,5 @@ -module.exports = function(type){ - return function(){ - } +module.exports = function(type) { + return function() { + }; }; diff --git a/test/mocha/lib/browser/events.js b/test/mocha/lib/browser/events.js index cfbd072..89ea0ff 100644 --- a/test/mocha/lib/browser/events.js +++ b/test/mocha/lib/browser/events.js @@ -19,7 +19,7 @@ function isArray(obj) { * @api public */ -function EventEmitter(){}; +function EventEmitter() {}; /** * Adds a listener. @@ -27,7 +27,7 @@ function EventEmitter(){}; * @api public */ -EventEmitter.prototype.on = function (name, fn) { +EventEmitter.prototype.on = function(name, fn) { if (!this.$events) { this.$events = {}; } @@ -51,10 +51,10 @@ EventEmitter.prototype.addListener = EventEmitter.prototype.on; * @api public */ -EventEmitter.prototype.once = function (name, fn) { - var self = this; +EventEmitter.prototype.once = function(name, fn) { + const self = this; - function on () { + function on() { self.removeListener(name, on); fn.apply(this, arguments); }; @@ -71,14 +71,14 @@ EventEmitter.prototype.once = function (name, fn) { * @api public */ -EventEmitter.prototype.removeListener = function (name, fn) { +EventEmitter.prototype.removeListener = function(name, fn) { if (this.$events && this.$events[name]) { - var list = this.$events[name]; + const list = this.$events[name]; if (isArray(list)) { - var pos = -1; + let pos = -1; - for (var i = 0, l = list.length; i < l; i++) { + for (let i = 0, l = list.length; i < l; i++) { if (list[i] === fn || (list[i].listener && list[i].listener === fn)) { pos = i; break; @@ -108,7 +108,7 @@ EventEmitter.prototype.removeListener = function (name, fn) { * @api public */ -EventEmitter.prototype.removeAllListeners = function (name) { +EventEmitter.prototype.removeAllListeners = function(name) { if (name === undefined) { this.$events = {}; return this; @@ -127,7 +127,7 @@ EventEmitter.prototype.removeAllListeners = function (name) { * @api public */ -EventEmitter.prototype.listeners = function (name) { +EventEmitter.prototype.listeners = function(name) { if (!this.$events) { this.$events = {}; } @@ -149,25 +149,25 @@ EventEmitter.prototype.listeners = function (name) { * @api public */ -EventEmitter.prototype.emit = function (name) { +EventEmitter.prototype.emit = function(name) { if (!this.$events) { return false; } - var handler = this.$events[name]; + const handler = this.$events[name]; if (!handler) { return false; } - var args = [].slice.call(arguments, 1); + const args = [].slice.call(arguments, 1); if ('function' == typeof handler) { handler.apply(this, args); } else if (isArray(handler)) { - var listeners = handler.slice(); + const listeners = handler.slice(); - for (var i = 0, l = listeners.length; i < l; i++) { + for (let i = 0, l = listeners.length; i < l; i++) { listeners[i].apply(this, args); } } else { @@ -175,4 +175,4 @@ EventEmitter.prototype.emit = function (name) { } return true; -}; \ No newline at end of file +}; diff --git a/test/mocha/lib/browser/progress.js b/test/mocha/lib/browser/progress.js index 90526f7..d3c4a88 100644 --- a/test/mocha/lib/browser/progress.js +++ b/test/mocha/lib/browser/progress.js @@ -23,7 +23,7 @@ function Progress() { * @api public */ -Progress.prototype.size = function(n){ +Progress.prototype.size = function(n) { this._size = n; return this; }; @@ -36,7 +36,7 @@ Progress.prototype.size = function(n){ * @api public */ -Progress.prototype.text = function(str){ +Progress.prototype.text = function(str) { this._text = str; return this; }; @@ -49,7 +49,7 @@ Progress.prototype.text = function(str){ * @api public */ -Progress.prototype.fontSize = function(n){ +Progress.prototype.fontSize = function(n) { this._fontSize = n; return this; }; @@ -61,7 +61,7 @@ Progress.prototype.fontSize = function(n){ * @return {Progress} for chaining */ -Progress.prototype.font = function(family){ +Progress.prototype.font = function(family) { this._font = family; return this; }; @@ -73,7 +73,7 @@ Progress.prototype.font = function(family){ * @return {Progress} for chaining */ -Progress.prototype.update = function(n){ +Progress.prototype.update = function(n) { this.percent = n; return this; }; @@ -85,41 +85,41 @@ Progress.prototype.update = function(n){ * @return {Progress} for chaining */ -Progress.prototype.draw = function(ctx){ +Progress.prototype.draw = function(ctx) { try { - var percent = Math.min(this.percent, 100) - , size = this._size - , half = size / 2 - , x = half - , y = half - , rad = half - 1 - , fontSize = this._fontSize; - + const percent = Math.min(this.percent, 100) + ; const size = this._size + ; const half = size / 2 + ; const x = half + ; const y = half + ; const rad = half - 1 + ; const fontSize = this._fontSize; + ctx.font = fontSize + 'px ' + this._font; - - var angle = Math.PI * 2 * (percent / 100); + + const 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) + '%' - , w = ctx.measureText(text).width; - + const text = this._text || (percent | 0) + '%' + ; const w = ctx.measureText(text).width; + ctx.fillText( text - , x - w / 2 + 1 - , y + fontSize / 2 - 1); - } catch (ex) {} //don't fail if we can't render progress + , x - w / 2 + 1 + , y + fontSize / 2 - 1); + } catch (ex) {} // don't fail if we can't render progress return this; }; diff --git a/test/mocha/lib/browser/tty.js b/test/mocha/lib/browser/tty.js index 6f5f079..ca5ece5 100644 --- a/test/mocha/lib/browser/tty.js +++ b/test/mocha/lib/browser/tty.js @@ -1,9 +1,9 @@ -exports.isatty = function(){ +exports.isatty = function() { return true; }; -exports.getWindowSize = function(){ +exports.getWindowSize = function() { if ('innerHeight' in global) { return [global.innerHeight, global.innerWidth]; } else { diff --git a/test/mocha/lib/context.js b/test/mocha/lib/context.js index 6d6422a..fead05f 100644 --- a/test/mocha/lib/context.js +++ b/test/mocha/lib/context.js @@ -11,7 +11,7 @@ module.exports = Context; * @api private */ -function Context(){} +function Context() {} /** * Set or get the context `Runnable` to `runnable`. @@ -21,7 +21,7 @@ function Context(){} * @api private */ -Context.prototype.runnable = function(runnable){ +Context.prototype.runnable = function(runnable) { if (0 == arguments.length) return this._runnable; this.test = this._runnable = runnable; return this; @@ -35,7 +35,7 @@ Context.prototype.runnable = function(runnable){ * @api private */ -Context.prototype.timeout = function(ms){ +Context.prototype.timeout = function(ms) { this.runnable().timeout(ms); return this; }; @@ -48,7 +48,7 @@ Context.prototype.timeout = function(ms){ * @api private */ -Context.prototype.slow = function(ms){ +Context.prototype.slow = function(ms) { this.runnable().slow(ms); return this; }; @@ -60,8 +60,8 @@ Context.prototype.slow = function(ms){ * @api private */ -Context.prototype.inspect = function(){ - return JSON.stringify(this, function(key, val){ +Context.prototype.inspect = function() { + return JSON.stringify(this, function(key, val) { if ('_runnable' == key) return; if ('test' == key) return; return val; diff --git a/test/mocha/lib/hook.js b/test/mocha/lib/hook.js index 814e7b6..bf1b51f 100644 --- a/test/mocha/lib/hook.js +++ b/test/mocha/lib/hook.js @@ -3,7 +3,7 @@ * Module dependencies. */ -var Runnable = require('./runnable'); +const Runnable = require('./runnable'); /** * Expose `Hook`. @@ -38,7 +38,7 @@ Hook.prototype.__proto__ = Runnable.prototype; * @api public */ -Hook.prototype.error = function(err){ +Hook.prototype.error = function(err) { if (0 == arguments.length) { var err = this._error; this._error = null; diff --git a/test/mocha/lib/interfaces/bdd.js b/test/mocha/lib/interfaces/bdd.js index 3a5b1ed..0b1bd08 100644 --- a/test/mocha/lib/interfaces/bdd.js +++ b/test/mocha/lib/interfaces/bdd.js @@ -3,9 +3,9 @@ * Module dependencies. */ -var Suite = require('../suite') - , Test = require('../test') - , utils = require('../utils'); +const Suite = require('../suite') + ; const Test = require('../test') + ; const utils = require('../utils'); /** * BDD-style interface: @@ -24,16 +24,15 @@ var Suite = require('../suite') * */ -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ +module.exports = function(suite) { + const suites = [suite]; + suite.on('pre-require', function(context, file, mocha) { /** * Execute before running tests. */ - context.before = function(fn){ + context.before = function(fn) { suites[0].beforeAll(fn); }; @@ -41,7 +40,7 @@ module.exports = function(suite){ * Execute after running tests. */ - context.after = function(fn){ + context.after = function(fn) { suites[0].afterAll(fn); }; @@ -49,7 +48,7 @@ module.exports = function(suite){ * Execute before each test case. */ - context.beforeEach = function(fn){ + context.beforeEach = function(fn) { suites[0].beforeEach(fn); }; @@ -57,7 +56,7 @@ module.exports = function(suite){ * Execute after each test case. */ - context.afterEach = function(fn){ + context.afterEach = function(fn) { suites[0].afterEach(fn); }; @@ -67,8 +66,8 @@ module.exports = function(suite){ * and/or tests. */ - context.describe = context.context = function(title, fn){ - var suite = Suite.create(suites[0], title); + context.describe = context.context = function(title, fn) { + const suite = Suite.create(suites[0], title); suites.unshift(suite); fn.call(suite); suites.shift(); @@ -81,8 +80,8 @@ module.exports = function(suite){ context.xdescribe = context.xcontext = - context.describe.skip = function(title, fn){ - var suite = Suite.create(suites[0], title); + context.describe.skip = function(title, fn) { + const suite = Suite.create(suites[0], title); suite.pending = true; suites.unshift(suite); fn.call(suite); @@ -93,8 +92,8 @@ module.exports = function(suite){ * Exclusive suite. */ - context.describe.only = function(title, fn){ - var suite = context.describe(title, fn); + context.describe.only = function(title, fn) { + const suite = context.describe(title, fn); mocha.grep(suite.fullTitle()); return suite; }; @@ -105,10 +104,10 @@ module.exports = function(suite){ * acting as a thunk. */ - context.it = context.specify = function(title, fn){ - var suite = suites[0]; + context.it = context.specify = function(title, fn) { + const suite = suites[0]; if (suite.pending) var fn = null; - var test = new Test(title, fn); + const test = new Test(title, fn); suite.addTest(test); return test; }; @@ -117,9 +116,9 @@ module.exports = function(suite){ * Exclusive test-case. */ - context.it.only = function(title, fn){ - var test = context.it(title, fn); - var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; + context.it.only = function(title, fn) { + const test = context.it(title, fn); + const reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; mocha.grep(new RegExp(reString)); return test; }; @@ -130,7 +129,7 @@ module.exports = function(suite){ context.xit = context.xspecify = - context.it.skip = function(title){ + context.it.skip = function(title) { context.it(title); }; }); diff --git a/test/mocha/lib/interfaces/exports.js b/test/mocha/lib/interfaces/exports.js index 6b229c0..8d78612 100644 --- a/test/mocha/lib/interfaces/exports.js +++ b/test/mocha/lib/interfaces/exports.js @@ -3,8 +3,8 @@ * Module dependencies. */ -var Suite = require('../suite') - , Test = require('../test'); +const Suite = require('../suite') + ; const Test = require('../test'); /** * TDD-style interface: @@ -23,16 +23,16 @@ var Suite = require('../suite') * */ -module.exports = function(suite){ - var suites = [suite]; +module.exports = function(suite) { + const suites = [suite]; suite.on('require', visit); function visit(obj) { var suite; - for (var key in obj) { + for (const key in obj) { if ('function' == typeof obj[key]) { - var fn = obj[key]; + const fn = obj[key]; switch (key) { case 'before': suites[0].beforeAll(fn); diff --git a/test/mocha/lib/interfaces/qunit.js b/test/mocha/lib/interfaces/qunit.js index 30f6748..ec32a85 100644 --- a/test/mocha/lib/interfaces/qunit.js +++ b/test/mocha/lib/interfaces/qunit.js @@ -3,9 +3,9 @@ * Module dependencies. */ -var Suite = require('../suite') - , Test = require('../test') - , utils = require('../utils'); +const Suite = require('../suite') + ; const Test = require('../test') + ; const utils = require('../utils'); /** * QUnit-style interface: @@ -32,16 +32,15 @@ var Suite = require('../suite') * */ -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ +module.exports = function(suite) { + const suites = [suite]; + suite.on('pre-require', function(context, file, mocha) { /** * Execute before running tests. */ - context.before = function(fn){ + context.before = function(fn) { suites[0].beforeAll(fn); }; @@ -49,7 +48,7 @@ module.exports = function(suite){ * Execute after running tests. */ - context.after = function(fn){ + context.after = function(fn) { suites[0].afterAll(fn); }; @@ -57,7 +56,7 @@ module.exports = function(suite){ * Execute before each test case. */ - context.beforeEach = function(fn){ + context.beforeEach = function(fn) { suites[0].beforeEach(fn); }; @@ -65,7 +64,7 @@ module.exports = function(suite){ * Execute after each test case. */ - context.afterEach = function(fn){ + context.afterEach = function(fn) { suites[0].afterEach(fn); }; @@ -73,9 +72,9 @@ module.exports = function(suite){ * Describe a "suite" with the given `title`. */ - context.suite = function(title){ + context.suite = function(title) { if (suites.length > 1) suites.shift(); - var suite = Suite.create(suites[0], title); + const suite = Suite.create(suites[0], title); suites.unshift(suite); return suite; }; @@ -84,8 +83,8 @@ module.exports = function(suite){ * Exclusive test-case. */ - context.suite.only = function(title, fn){ - var suite = context.suite(title, fn); + context.suite.only = function(title, fn) { + const suite = context.suite(title, fn); mocha.grep(suite.fullTitle()); }; @@ -95,8 +94,8 @@ module.exports = function(suite){ * acting as a thunk. */ - context.test = function(title, fn){ - var test = new Test(title, fn); + context.test = function(title, fn) { + const test = new Test(title, fn); suites[0].addTest(test); return test; }; @@ -105,9 +104,9 @@ module.exports = function(suite){ * Exclusive test-case. */ - context.test.only = function(title, fn){ - var test = context.test(title, fn); - var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; + context.test.only = function(title, fn) { + const test = context.test(title, fn); + const reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; mocha.grep(new RegExp(reString)); }; @@ -115,7 +114,7 @@ module.exports = function(suite){ * Pending test case. */ - context.test.skip = function(title){ + context.test.skip = function(title) { context.test(title); }; }); diff --git a/test/mocha/lib/interfaces/tdd.js b/test/mocha/lib/interfaces/tdd.js index da5ca2c..4294af5 100644 --- a/test/mocha/lib/interfaces/tdd.js +++ b/test/mocha/lib/interfaces/tdd.js @@ -3,9 +3,9 @@ * Module dependencies. */ -var Suite = require('../suite') - , Test = require('../test') - , utils = require('../utils');; +const Suite = require('../suite') + ; const Test = require('../test') + ; const utils = require('../utils'); ; /** * TDD-style interface: @@ -32,16 +32,15 @@ var Suite = require('../suite') * */ -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ +module.exports = function(suite) { + const suites = [suite]; + suite.on('pre-require', function(context, file, mocha) { /** * Execute before each test case. */ - context.setup = function(fn){ + context.setup = function(fn) { suites[0].beforeEach(fn); }; @@ -49,7 +48,7 @@ module.exports = function(suite){ * Execute after each test case. */ - context.teardown = function(fn){ + context.teardown = function(fn) { suites[0].afterEach(fn); }; @@ -57,7 +56,7 @@ module.exports = function(suite){ * Execute before the suite. */ - context.suiteSetup = function(fn){ + context.suiteSetup = function(fn) { suites[0].beforeAll(fn); }; @@ -65,7 +64,7 @@ module.exports = function(suite){ * Execute after the suite. */ - context.suiteTeardown = function(fn){ + context.suiteTeardown = function(fn) { suites[0].afterAll(fn); }; @@ -75,8 +74,8 @@ module.exports = function(suite){ * and/or tests. */ - context.suite = function(title, fn){ - var suite = Suite.create(suites[0], title); + context.suite = function(title, fn) { + const suite = Suite.create(suites[0], title); suites.unshift(suite); fn.call(suite); suites.shift(); @@ -87,7 +86,7 @@ module.exports = function(suite){ * Pending suite. */ context.suite.skip = function(title, fn) { - var suite = Suite.create(suites[0], title); + const suite = Suite.create(suites[0], title); suite.pending = true; suites.unshift(suite); fn.call(suite); @@ -98,8 +97,8 @@ module.exports = function(suite){ * Exclusive test-case. */ - context.suite.only = function(title, fn){ - var suite = context.suite(title, fn); + context.suite.only = function(title, fn) { + const suite = context.suite(title, fn); mocha.grep(suite.fullTitle()); }; @@ -109,10 +108,10 @@ module.exports = function(suite){ * acting as a thunk. */ - context.test = function(title, fn){ - var suite = suites[0]; + context.test = function(title, fn) { + const suite = suites[0]; if (suite.pending) var fn = null; - var test = new Test(title, fn); + const test = new Test(title, fn); suite.addTest(test); return test; }; @@ -121,9 +120,9 @@ module.exports = function(suite){ * Exclusive test-case. */ - context.test.only = function(title, fn){ - var test = context.test(title, fn); - var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; + context.test.only = function(title, fn) { + const test = context.test(title, fn); + const reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; mocha.grep(new RegExp(reString)); }; @@ -131,7 +130,7 @@ module.exports = function(suite){ * Pending test case. */ - context.test.skip = function(title){ + context.test.skip = function(title) { context.test(title); }; }); diff --git a/test/mocha/lib/mocha.js b/test/mocha/lib/mocha.js index 3bc9bd5..8cb4848 100644 --- a/test/mocha/lib/mocha.js +++ b/test/mocha/lib/mocha.js @@ -1,4 +1,4 @@ -/*! +/* ! * mocha * Copyright(c) 2011 TJ Holowaychuk * MIT Licensed @@ -8,8 +8,8 @@ * Module dependencies. */ -var path = require('path') - , utils = require('./utils'); +const path = require('path') + ; const utils = require('./utils'); /** * Expose `Mocha`. @@ -71,10 +71,10 @@ function Mocha(options) { this.bail(options.bail); this.reporter(options.reporter); if (null != options.timeout) this.timeout(options.timeout); - this.useColors(options.useColors) + this.useColors(options.useColors); if (options.slow) this.slow(options.slow); - this.suite.on('pre-require', function (context) { + 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; @@ -97,7 +97,7 @@ function Mocha(options) { * @api public */ -Mocha.prototype.bail = function(bail){ +Mocha.prototype.bail = function(bail) { if (0 == arguments.length) bail = true; this.suite.bail(bail); return this; @@ -110,7 +110,7 @@ Mocha.prototype.bail = function(bail){ * @api public */ -Mocha.prototype.addFile = function(file){ +Mocha.prototype.addFile = function(file) { this.files.push(file); return this; }; @@ -122,18 +122,25 @@ Mocha.prototype.addFile = function(file){ * @api public */ -Mocha.prototype.reporter = function(reporter){ +Mocha.prototype.reporter = function(reporter) { if ('function' == typeof reporter) { this._reporter = reporter; } else { reporter = reporter || 'dot'; - var _reporter; - try { _reporter = require('./reporters/' + reporter); } catch (err) {}; - if (!_reporter) try { _reporter = require(reporter); } catch (err) {}; - if (!_reporter && reporter === 'teamcity') + let _reporter; + try { + _reporter = require('./reporters/' + reporter); + } catch (err) {}; + if (!_reporter) { + try { + _reporter = require(reporter); + } catch (err) {} + }; + 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; } @@ -147,10 +154,14 @@ Mocha.prototype.reporter = function(reporter){ * @api public */ -Mocha.prototype.ui = function(name){ +Mocha.prototype.ui = function(name) { name = name || 'bdd'; this._ui = exports.interfaces[name]; - if (!this._ui) try { this._ui = require(name); } catch (err) {}; + if (!this._ui) { + try { + this._ui = require(name); + } catch (err) {} + }; if (!this._ui) throw new Error('invalid interface "' + name + '"'); this._ui = this._ui(this.suite); return this; @@ -162,11 +173,11 @@ Mocha.prototype.ui = function(name){ * @api private */ -Mocha.prototype.loadFiles = function(fn){ - var self = this; - var suite = this.suite; - var pending = this.files.length; - this.files.forEach(function(file){ +Mocha.prototype.loadFiles = function(fn) { + const self = this; + const suite = this.suite; + let pending = this.files.length; + this.files.forEach(function(file) { file = path.resolve(file); suite.emit('pre-require', global, file, self); suite.emit('require', require(file), file, self); @@ -182,18 +193,18 @@ Mocha.prototype.loadFiles = function(fn){ */ Mocha.prototype._growl = function(runner, reporter) { - var notify = require('growl'); + const notify = require('growl'); - runner.on('end', function(){ - var stats = reporter.stats; + runner.on('end', function() { + const stats = reporter.stats; if (stats.failures) { - var msg = stats.failures + ' of ' + runner.total + ' tests failed'; - notify(msg, { name: 'mocha', title: 'Failed', image: image('error') }); + const 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') + name: 'mocha', + title: 'Passed', + image: image('ok'), }); } }); @@ -207,10 +218,10 @@ Mocha.prototype._growl = function(runner, reporter) { * @api public */ -Mocha.prototype.grep = function(re){ - this.options.grep = 'string' == typeof re - ? new RegExp(utils.escapeRegexp(re)) - : re; +Mocha.prototype.grep = function(re) { + this.options.grep = 'string' == typeof re ? + new RegExp(utils.escapeRegexp(re)) : + re; return this; }; @@ -221,7 +232,7 @@ Mocha.prototype.grep = function(re){ * @api public */ -Mocha.prototype.invert = function(){ +Mocha.prototype.invert = function() { this.options.invert = true; return this; }; @@ -234,7 +245,7 @@ Mocha.prototype.invert = function(){ * @api public */ -Mocha.prototype.ignoreLeaks = function(ignore){ +Mocha.prototype.ignoreLeaks = function(ignore) { this.options.ignoreLeaks = !!ignore; return this; }; @@ -246,7 +257,7 @@ Mocha.prototype.ignoreLeaks = function(ignore){ * @api public */ -Mocha.prototype.checkLeaks = function(){ +Mocha.prototype.checkLeaks = function() { this.options.ignoreLeaks = false; return this; }; @@ -258,7 +269,7 @@ Mocha.prototype.checkLeaks = function(){ * @api public */ -Mocha.prototype.growl = function(){ +Mocha.prototype.growl = function() { this.options.growl = true; return this; }; @@ -271,7 +282,7 @@ Mocha.prototype.growl = function(){ * @api public */ -Mocha.prototype.globals = function(globals){ +Mocha.prototype.globals = function(globals) { this.options.globals = (this.options.globals || []).concat(globals); return this; }; @@ -284,10 +295,10 @@ Mocha.prototype.globals = function(globals){ * @api public */ -Mocha.prototype.useColors = function(colors){ - this.options.useColors = arguments.length && colors != undefined - ? colors - : true; +Mocha.prototype.useColors = function(colors) { + this.options.useColors = arguments.length && colors != undefined ? + colors : + true; return this; }; @@ -300,9 +311,9 @@ Mocha.prototype.useColors = function(colors){ */ Mocha.prototype.useInlineDiffs = function(inlineDiffs) { - this.options.useInlineDiffs = arguments.length && inlineDiffs != undefined - ? inlineDiffs - : false; + this.options.useInlineDiffs = arguments.length && inlineDiffs != undefined ? + inlineDiffs : + false; return this; }; @@ -314,7 +325,7 @@ Mocha.prototype.useInlineDiffs = function(inlineDiffs) { * @api public */ -Mocha.prototype.timeout = function(timeout){ +Mocha.prototype.timeout = function(timeout) { this.suite.timeout(timeout); return this; }; @@ -327,7 +338,7 @@ Mocha.prototype.timeout = function(timeout){ * @api public */ -Mocha.prototype.slow = function(slow){ +Mocha.prototype.slow = function(slow) { this.suite.slow(slow); return this; }; @@ -339,7 +350,7 @@ Mocha.prototype.slow = function(slow){ * @api public */ -Mocha.prototype.asyncOnly = function(){ +Mocha.prototype.asyncOnly = function() { this.options.asyncOnly = true; return this; }; @@ -352,12 +363,12 @@ Mocha.prototype.asyncOnly = function(){ * @api public */ -Mocha.prototype.run = function(fn){ +Mocha.prototype.run = function(fn) { if (this.files.length) this.loadFiles(); - var suite = this.suite; - var options = this.options; - var runner = new exports.Runner(suite); - var reporter = new this._reporter(runner); + const suite = this.suite; + const options = this.options; + const runner = new exports.Runner(suite); + const reporter = new this._reporter(runner); runner.ignoreLeaks = false !== options.ignoreLeaks; runner.asyncOnly = options.asyncOnly; if (options.grep) runner.grep(options.grep, options.invert); diff --git a/test/mocha/lib/ms.js b/test/mocha/lib/ms.js index 4096637..997de9f 100644 --- a/test/mocha/lib/ms.js +++ b/test/mocha/lib/ms.js @@ -2,11 +2,11 @@ * Helpers. */ -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; +const s = 1000; +const m = s * 60; +const h = m * 60; +const d = h * 24; +const y = d * 365.25; /** * Parse or format the given `val`. @@ -21,7 +21,7 @@ var y = d * 365.25; * @api public */ -module.exports = function(val, options){ +module.exports = function(val, options) { options = options || {}; if ('string' == typeof val) return parse(val); return options.long ? longFormat(val) : shortFormat(val); @@ -36,10 +36,10 @@ module.exports = function(val, options){ */ function parse(str) { - var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str); + const 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(); + const n = parseFloat(match[1]); + const type = (match[2] || 'ms').toLowerCase(); switch (type) { case 'years': case 'year': @@ -91,11 +91,11 @@ function shortFormat(ms) { */ function longFormat(ms) { - return plural(ms, d, 'day') - || plural(ms, h, 'hour') - || plural(ms, m, 'minute') - || plural(ms, s, 'second') - || ms + ' ms'; + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; } /** diff --git a/test/mocha/lib/reporters/base.js b/test/mocha/lib/reporters/base.js index 661126c..7c4105a 100644 --- a/test/mocha/lib/reporters/base.js +++ b/test/mocha/lib/reporters/base.js @@ -3,26 +3,26 @@ * Module dependencies. */ -var tty = require('tty') - , diff = require('diff') - , ms = require('../ms') - , utils = require('../utils'); +const tty = require('tty') + ; const diff = require('diff') + ; const ms = require('../ms') + ; const utils = require('../utils'); /** * Save timer references to avoid Sinon interfering (see GH-237). */ -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; +const Date = global.Date + ; const setTimeout = global.setTimeout + ; const setInterval = global.setInterval + ; const clearTimeout = global.clearTimeout + ; const clearInterval = global.clearInterval; /** * Check if both stdio streams are associated with a tty. */ -var isatty = tty.isatty(1) && tty.isatty(2); +const isatty = tty.isatty(1) && tty.isatty(2); /** * Expose `Base`. @@ -47,25 +47,25 @@ exports.inlineDiffs = false; */ 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': 42 - , 'diff removed': 41 + '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': 42, + 'diff removed': 41, }; /** @@ -75,7 +75,7 @@ exports.colors = { exports.symbols = { ok: '✓', err: '✖', - dot: '․' + dot: '․', }; // With node.js on Windows: use symbols available in terminal default fonts @@ -97,7 +97,7 @@ if ('win32' == process.platform) { * @api private */ -var color = exports.color = function(type, str) { +const color = exports.color = function(type, str) { if (!exports.useColors) return str; return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m'; }; @@ -108,11 +108,11 @@ var color = exports.color = function(type, str) { */ exports.window = { - width: isatty - ? process.stdout.getWindowSize - ? process.stdout.getWindowSize(1)[0] - : tty.getWindowSize()[1] - : 75 + width: isatty ? + process.stdout.getWindowSize ? + process.stdout.getWindowSize(1)[0] : + tty.getWindowSize()[1] : + 75, }; /** @@ -121,30 +121,30 @@ exports.window = { */ exports.cursor = { - hide: function(){ + hide: function() { isatty && process.stdout.write('\u001b[?25l'); }, - show: function(){ + show: function() { isatty && process.stdout.write('\u001b[?25h'); }, - deleteLine: function(){ + deleteLine: function() { isatty && process.stdout.write('\u001b[2K'); }, - beginningOfLine: function(){ + beginningOfLine: function() { isatty && process.stdout.write('\u001b[0G'); }, - CR: function(){ + CR: function() { if (isatty) { exports.cursor.deleteLine(); exports.cursor.beginningOfLine(); } else { process.stdout.write('\r'); } - } + }, }; /** @@ -154,23 +154,23 @@ exports.cursor = { * @api public */ -exports.list = function(failures){ +exports.list = function(failures) { console.error(); - failures.forEach(function(test, i){ + failures.forEach(function(test, i) { // format - var fmt = color('error title', ' %s) %s:\n') - + color('error message', ' %s') - + color('error stack', '\n%s\n'); + let fmt = color('error title', ' %s) %s:\n') + + color('error message', ' %s') + + color('error stack', '\n%s\n'); // msg - var err = test.err - , message = err.message || '' - , stack = err.stack || message - , index = stack.indexOf(message) + message.length - , msg = stack.slice(0, index) - , actual = err.actual - , expected = err.expected - , escape = true; + const err = test.err + ; const message = err.message || '' + ; let stack = err.stack || message + ; const index = stack.indexOf(message) + message.length + ; let msg = stack.slice(0, index) + ; let actual = err.actual + ; let expected = err.expected + ; let escape = true; // uncaught if (err.uncaught) { @@ -187,7 +187,7 @@ exports.list = function(failures){ // actual / expected diff if ('string' == typeof actual && 'string' == typeof expected) { fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n'); - var match = message.match(/^([^:]+): expected/); + const match = message.match(/^([^:]+): expected/); msg = match ? '\n ' + color('error message', match[1]) : ''; if (exports.inlineDiffs) { @@ -199,7 +199,7 @@ exports.list = function(failures){ // indent stack trace without msg stack = stack.slice(index ? index + 1 : index) - .replace(/^/gm, ' '); + .replace(/^/gm, ' '); console.error(fmt, (i + 1), test.fullTitle(), msg, stack); }); @@ -218,55 +218,55 @@ exports.list = function(failures){ */ function Base(runner) { - var self = this - , stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 } - , failures = this.failures = []; + const self = this + ; const stats = this.stats = {suites: 0, tests: 0, passes: 0, pending: 0, failures: 0} + ; const failures = this.failures = []; if (!runner) return; this.runner = runner; runner.stats = stats; - runner.on('start', function(){ + runner.on('start', function() { stats.start = new Date; }); - runner.on('suite', function(suite){ + runner.on('suite', function(suite) { stats.suites = stats.suites || 0; suite.root || stats.suites++; }); - runner.on('test end', function(test){ + runner.on('test end', function(test) { stats.tests = stats.tests || 0; stats.tests++; }); - runner.on('pass', function(test){ + runner.on('pass', function(test) { stats.passes = stats.passes || 0; - var medium = test.slow() / 2; - test.speed = test.duration > test.slow() - ? 'slow' - : test.duration > medium - ? 'medium' - : 'fast'; + const medium = test.slow() / 2; + test.speed = test.duration > test.slow() ? + 'slow' : + test.duration > medium ? + 'medium' : + 'fast'; stats.passes++; }); - runner.on('fail', function(test, err){ + runner.on('fail', function(test, err) { stats.failures = stats.failures || 0; stats.failures++; test.err = err; failures.push(test); }); - runner.on('end', function(){ + runner.on('end', function() { stats.end = new Date; stats.duration = new Date - stats.start; }); - runner.on('pending', function(){ + runner.on('pending', function() { stats.pending++; }); } @@ -278,26 +278,26 @@ function Base(runner) { * @api public */ -Base.prototype.epilogue = function(){ - var stats = this.stats; - var tests; - var fmt; +Base.prototype.epilogue = function() { + const stats = this.stats; + let tests; + let fmt; console.log(); // passes - fmt = color('bright pass', ' ') - + color('green', ' %d passing') - + color('light', ' (%s)'); + fmt = color('bright pass', ' ') + + color('green', ' %d passing') + + color('light', ' (%s)'); console.log(fmt, - stats.passes || 0, - ms(stats.duration)); + stats.passes || 0, + ms(stats.duration)); // pending if (stats.pending) { - fmt = color('pending', ' ') - + color('pending', ' %d pending'); + fmt = color('pending', ' ') + + color('pending', ' %d pending'); console.log(fmt, stats.pending); } @@ -307,7 +307,7 @@ Base.prototype.epilogue = function(){ fmt = color('fail', ' %d failing'); console.error(fmt, - stats.failures); + stats.failures); Base.list(this.failures); console.error(); @@ -340,25 +340,25 @@ function pad(str, len) { */ function inlineDiff(err, escape) { - var msg = errorDiff(err, 'WordsWithSpace', escape); + let msg = errorDiff(err, 'WordsWithSpace', escape); // linenos - var lines = msg.split('\n'); + const lines = msg.split('\n'); if (lines.length > 4) { - var width = String(lines.length).length; - msg = lines.map(function(str, i){ + const 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'; + msg = '\n' + + color('diff removed', 'actual') + + ' ' + + color('diff added', 'expected') + + '\n\n' + + msg + + '\n'; // indent msg = msg.replace(/^/gm, ' '); @@ -374,7 +374,7 @@ function inlineDiff(err, escape) { */ function unifiedDiff(err, escape) { - var indent = ' '; + const indent = ' '; function cleanUp(line) { if (escape) { line = escapeInvisibles(line); @@ -389,12 +389,12 @@ function unifiedDiff(err, escape) { return line != null; } 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'); + const 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'); } /** @@ -406,9 +406,9 @@ function unifiedDiff(err, escape) { */ 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){ + const actual = escape ? escapeInvisibles(err.actual) : err.actual; + const 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; @@ -423,9 +423,9 @@ function errorDiff(err, type, escape) { * @api private */ function escapeInvisibles(line) { - return line.replace(/\t/g, '') - .replace(/\r/g, '') - .replace(/\n/g, '\n'); + return line.replace(/\t/g, '') + .replace(/\r/g, '') + .replace(/\n/g, '\n'); } /** @@ -438,7 +438,7 @@ function escapeInvisibles(line) { */ function colorLines(name, str) { - return str.split('\n').map(function(str){ + return str.split('\n').map(function(str) { return color(name, str); }).join('\n'); } @@ -463,32 +463,32 @@ function stringify(obj) { * @api private */ - function canonicalize(obj, stack) { - stack = stack || []; - - if (utils.indexOf(stack, obj) !== -1) return obj; - - var canonicalizedObj; - - if ('[object Array]' == {}.toString.call(obj)) { - stack.push(obj); - canonicalizedObj = utils.map(obj, function(item) { - return canonicalize(item, stack); - }); - stack.pop(); - } else if (typeof obj === 'object' && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - utils.forEach(utils.keys(obj).sort(), function(key) { - canonicalizedObj[key] = canonicalize(obj[key], stack); - }); - stack.pop(); - } else { - canonicalizedObj = obj; - } - - return canonicalizedObj; - } +function canonicalize(obj, stack) { + stack = stack || []; + + if (utils.indexOf(stack, obj) !== -1) return obj; + + let canonicalizedObj; + + if ('[object Array]' == {}.toString.call(obj)) { + stack.push(obj); + canonicalizedObj = utils.map(obj, function(item) { + return canonicalize(item, stack); + }); + stack.pop(); + } else if (typeof obj === 'object' && obj !== null) { + stack.push(obj); + canonicalizedObj = {}; + utils.forEach(utils.keys(obj).sort(), function(key) { + canonicalizedObj[key] = canonicalize(obj[key], stack); + }); + stack.pop(); + } else { + canonicalizedObj = obj; + } + + return canonicalizedObj; +} /** * Check that a / b have the same type. diff --git a/test/mocha/lib/reporters/doc.js b/test/mocha/lib/reporters/doc.js index 2e5bf57..1c84590 100644 --- a/test/mocha/lib/reporters/doc.js +++ b/test/mocha/lib/reporters/doc.js @@ -3,8 +3,8 @@ * Module dependencies. */ -var Base = require('./base') - , utils = require('../utils'); +const Base = require('./base') + ; const utils = require('../utils'); /** * Expose `Doc`. @@ -22,16 +22,16 @@ exports = module.exports = Doc; function Doc(runner) { Base.call(this, runner); - var self = this - , stats = this.stats - , total = runner.total - , indents = 2; + const self = this + ; const stats = this.stats + ; const total = runner.total + ; let indents = 2; function indent() { return Array(indents).join(' '); } - runner.on('suite', function(suite){ + runner.on('suite', function(suite) { if (suite.root) return; ++indents; console.log('%s
          ', indent()); @@ -40,7 +40,7 @@ function Doc(runner) { console.log('%s
          ', indent()); }); - runner.on('suite end', function(suite){ + runner.on('suite end', function(suite) { if (suite.root) return; console.log('%s
          ', indent()); --indents; @@ -48,9 +48,9 @@ function Doc(runner) { --indents; }); - runner.on('pass', function(test){ + runner.on('pass', function(test) { console.log('%s
          %s
          ', indent(), utils.escape(test.title)); - var code = utils.escape(utils.clean(test.fn.toString())); + const code = utils.escape(utils.clean(test.fn.toString())); console.log('%s
          %s
          ', indent(), code); }); } diff --git a/test/mocha/lib/reporters/dot.js b/test/mocha/lib/reporters/dot.js index 0c298ba..1b6456f 100644 --- a/test/mocha/lib/reporters/dot.js +++ b/test/mocha/lib/reporters/dot.js @@ -3,8 +3,8 @@ * Module dependencies. */ -var Base = require('./base') - , color = Base.color; +const Base = require('./base') + ; const color = Base.color; /** * Expose `Dot`. @@ -22,20 +22,20 @@ exports = module.exports = Dot; function Dot(runner) { Base.call(this, runner); - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , n = 0; + const self = this + ; const stats = this.stats + ; const width = Base.window.width * .75 | 0 + ; let n = 0; - runner.on('start', function(){ + runner.on('start', function() { process.stdout.write('\n '); }); - runner.on('pending', function(test){ + runner.on('pending', function(test) { process.stdout.write(color('pending', Base.symbols.dot)); }); - runner.on('pass', function(test){ + runner.on('pass', function(test) { if (++n % width == 0) process.stdout.write('\n '); if ('slow' == test.speed) { process.stdout.write(color('bright yellow', Base.symbols.dot)); @@ -44,12 +44,12 @@ function Dot(runner) { } }); - runner.on('fail', function(test, err){ + runner.on('fail', function(test, err) { if (++n % width == 0) process.stdout.write('\n '); process.stdout.write(color('fail', Base.symbols.dot)); }); - runner.on('end', function(){ + runner.on('end', function() { console.log(); self.epilogue(); }); @@ -59,4 +59,4 @@ function Dot(runner) { * Inherit from `Base.prototype`. */ -Dot.prototype.__proto__ = Base.prototype; \ No newline at end of file +Dot.prototype.__proto__ = Base.prototype; diff --git a/test/mocha/lib/reporters/html-cov.js b/test/mocha/lib/reporters/html-cov.js index bfb27ff..b67955f 100644 --- a/test/mocha/lib/reporters/html-cov.js +++ b/test/mocha/lib/reporters/html-cov.js @@ -3,8 +3,8 @@ * Module dependencies. */ -var JSONCov = require('./json-cov') - , fs = require('fs'); +const JSONCov = require('./json-cov') + ; const fs = require('fs'); /** * Expose `HTMLCov`. @@ -20,18 +20,18 @@ exports = module.exports = HTMLCov; */ function HTMLCov(runner) { - var jade = require('jade') - , file = __dirname + '/templates/coverage.jade' - , str = fs.readFileSync(file, 'utf8') - , fn = jade.compile(str, { filename: file }) - , self = this; + const jade = require('jade') + ; const file = __dirname + '/templates/coverage.jade' + ; const str = fs.readFileSync(file, 'utf8') + ; const fn = jade.compile(str, {filename: file}) + ; const self = this; JSONCov.call(this, runner, false); - runner.on('end', function(){ + runner.on('end', function() { process.stdout.write(fn({ - cov: self.cov - , coverageClass: coverageClass + cov: self.cov, + coverageClass: coverageClass, })); }); } @@ -48,4 +48,4 @@ function coverageClass(n) { if (n >= 50) return 'medium'; if (n >= 25) return 'low'; return 'terrible'; -} \ No newline at end of file +} diff --git a/test/mocha/lib/reporters/html.js b/test/mocha/lib/reporters/html.js index 873f024..28f2f25 100644 --- a/test/mocha/lib/reporters/html.js +++ b/test/mocha/lib/reporters/html.js @@ -3,20 +3,20 @@ * Module dependencies. */ -var Base = require('./base') - , utils = require('../utils') - , Progress = require('../browser/progress') - , escape = utils.escape; +const Base = require('./base') + ; const utils = require('../utils') + ; const Progress = require('../browser/progress') + ; const escape = utils.escape; /** * Save timer references to avoid Sinon interfering (see GH-237). */ -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; +const Date = global.Date + ; const setTimeout = global.setTimeout + ; const setInterval = global.setInterval + ; const clearTimeout = global.clearTimeout + ; const clearInterval = global.clearInterval; /** * Expose `HTML`. @@ -28,12 +28,12 @@ exports = module.exports = HTML; * Stats template. */ -var statsTemplate = ''; +const statsTemplate = ''; /** * Initialize a new `HTML` reporter. @@ -45,26 +45,26 @@ var statsTemplate = '
            ' function HTML(runner, root) { Base.call(this, runner); - var self = this - , stats = this.stats - , total = runner.total - , stat = fragment(statsTemplate) - , items = stat.getElementsByTagName('li') - , passes = items[1].getElementsByTagName('em')[0] - , passesLink = items[1].getElementsByTagName('a')[0] - , failures = items[2].getElementsByTagName('em')[0] - , failuresLink = items[2].getElementsByTagName('a')[0] - , duration = items[3].getElementsByTagName('em')[0] - , canvas = stat.getElementsByTagName('canvas')[0] - , report = fragment('
              ') - , stack = [report] - , progress - , ctx + const self = this + ; const stats = this.stats + ; const total = runner.total + ; const stat = fragment(statsTemplate) + ; const items = stat.getElementsByTagName('li') + ; const passes = items[1].getElementsByTagName('em')[0] + ; const passesLink = items[1].getElementsByTagName('a')[0] + ; const failures = items[2].getElementsByTagName('em')[0] + ; const failuresLink = items[2].getElementsByTagName('a')[0] + ; const duration = items[3].getElementsByTagName('em')[0] + ; const canvas = stat.getElementsByTagName('canvas')[0] + ; const report = fragment('
                ') + ; const stack = [report] + ; let progress + ; let ctx; root = root || document.getElementById('mocha'); if (canvas.getContext) { - var ratio = window.devicePixelRatio || 1; + const ratio = window.devicePixelRatio || 1; canvas.style.width = canvas.width; canvas.style.height = canvas.height; canvas.width *= ratio; @@ -77,17 +77,17 @@ function HTML(runner, root) { if (!root) return error('#mocha div missing, add it to your document'); // pass toggle - on(passesLink, 'click', function(){ + on(passesLink, 'click', function() { unhide(); - var name = /pass/.test(report.className) ? '' : ' pass'; + const 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(){ + on(failuresLink, 'click', function() { unhide(); - var name = /fail/.test(report.className) ? '' : ' fail'; + const name = /fail/.test(report.className) ? '' : ' fail'; report.className = report.className.replace(/fail|pass/g, '') + name; if (report.className.trim()) hideSuitesWithout('test fail'); }); @@ -97,12 +97,12 @@ function HTML(runner, root) { if (progress) progress.size(40); - runner.on('suite', function(suite){ + runner.on('suite', function(suite) { if (suite.root) return; // suite - var url = self.suiteURL(suite); - var el = fragment('
              • %s

              • ', url, escape(suite.title)); + const url = self.suiteURL(suite); + const el = fragment('
              • %s

              • ', url, escape(suite.title)); // container stack[0].appendChild(el); @@ -110,35 +110,35 @@ function HTML(runner, root) { el.appendChild(stack[0]); }); - runner.on('suite end', function(suite){ + runner.on('suite end', function(suite) { if (suite.root) return; stack.shift(); }); - runner.on('fail', function(test, err){ + runner.on('fail', function(test, err) { if ('hook' == test.type) runner.emit('test end', test); }); - runner.on('test end', function(test){ + runner.on('test end', function(test) { // TODO: add to stats - var percent = stats.tests / this.total * 100 | 0; + const percent = stats.tests / this.total * 100 | 0; if (progress) progress.update(percent).draw(ctx); // update stats - var ms = new Date - stats.start; + const ms = new Date - stats.start; text(passes, stats.passes); text(failures, stats.failures); text(duration, (ms / 1000).toFixed(2)); // test if ('passed' == test.state) { - var url = self.testURL(test); + const url = self.testURL(test); var el = fragment('
              • %e%ems

              • ', test.speed, test.title, test.duration, url); } else if (test.pending) { var el = fragment('
              • %e

              • ', test.title); } else { var el = fragment('
              • %e

              • ', test.title, encodeURIComponent(test.fullTitle())); - var str = test.err.stack || test.err.toString(); + let str = test.err.stack || test.err.toString(); // FF / Opera do not add the message if (!~str.indexOf(test.err.message)) { @@ -151,7 +151,7 @@ function HTML(runner, root) { // Safari doesn't give you a stack. Let's at least provide a source line. if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) { - str += "\n(" + test.err.sourceURL + ":" + test.err.line + ")"; + str += '\n(' + test.err.sourceURL + ':' + test.err.line + ')'; } el.appendChild(fragment('
                %e
                ', str)); @@ -160,12 +160,12 @@ function HTML(runner, root) { // toggle code // TODO: defer if (!test.pending) { - var h2 = el.getElementsByTagName('h2')[0]; + const h2 = el.getElementsByTagName('h2')[0]; - on(h2, 'click', function(){ - pre.style.display = 'none' == pre.style.display - ? 'block' - : 'none'; + on(h2, 'click', function() { + pre.style.display = 'none' == pre.style.display ? + 'block' : + 'none'; }); var pre = fragment('
                %e
                ', utils.clean(test.fn.toString())); @@ -184,7 +184,7 @@ function HTML(runner, root) { * @param {Object} [suite] */ -HTML.prototype.suiteURL = function(suite){ +HTML.prototype.suiteURL = function(suite) { return '?grep=' + encodeURIComponent(suite.fullTitle()); }; @@ -194,7 +194,7 @@ HTML.prototype.suiteURL = function(suite){ * @param {Object} [test] */ -HTML.prototype.testURL = function(test){ +HTML.prototype.testURL = function(test) { return '?grep=' + encodeURIComponent(test.fullTitle()); }; @@ -211,11 +211,11 @@ function error(msg) { */ function fragment(html) { - var args = arguments - , div = document.createElement('div') - , i = 1; + const args = arguments + ; const div = document.createElement('div') + ; let i = 1; - div.innerHTML = html.replace(/%([se])/g, function(_, type){ + div.innerHTML = html.replace(/%([se])/g, function(_, type) { switch (type) { case 's': return String(args[i++]); case 'e': return escape(args[i++]); @@ -231,9 +231,9 @@ function fragment(html) { */ function hideSuitesWithout(classname) { - var suites = document.getElementsByClassName('suite'); - for (var i = 0; i < suites.length; i++) { - var els = suites[i].getElementsByClassName(classname); + const suites = document.getElementsByClassName('suite'); + for (let i = 0; i < suites.length; i++) { + const els = suites[i].getElementsByClassName(classname); if (0 == els.length) suites[i].className += ' hidden'; } } @@ -243,8 +243,8 @@ function hideSuitesWithout(classname) { */ function unhide() { - var els = document.getElementsByClassName('suite hidden'); - for (var i = 0; i < els.length; ++i) { + const els = document.getElementsByClassName('suite hidden'); + for (let i = 0; i < els.length; ++i) { els[i].className = els[i].className.replace('suite hidden', 'suite'); } } diff --git a/test/mocha/lib/reporters/json-cov.js b/test/mocha/lib/reporters/json-cov.js index 73d0009..4c88df7 100644 --- a/test/mocha/lib/reporters/json-cov.js +++ b/test/mocha/lib/reporters/json-cov.js @@ -3,7 +3,7 @@ * Module dependencies. */ -var Base = require('./base'); +const Base = require('./base'); /** * Expose `JSONCov`. @@ -20,30 +20,30 @@ exports = module.exports = JSONCov; */ function JSONCov(runner, output) { - var self = this - , output = 1 == arguments.length ? true : output; + const self = this + ; var output = 1 == arguments.length ? true : output; Base.call(this, runner); - var tests = [] - , failures = [] - , passes = []; + const tests = [] + ; const failures = [] + ; const passes = []; - runner.on('test end', function(test){ + runner.on('test end', function(test) { tests.push(test); }); - runner.on('pass', function(test){ + runner.on('pass', function(test) { passes.push(test); }); - runner.on('fail', function(test){ + runner.on('fail', function(test) { failures.push(test); }); - runner.on('end', function(){ - var cov = global._$jscoverage || {}; - var result = self.cov = map(cov); + runner.on('end', function() { + const cov = global._$jscoverage || {}; + const result = self.cov = map(cov); result.stats = self.stats; result.tests = tests.map(clean); result.failures = failures.map(clean); @@ -63,17 +63,17 @@ function JSONCov(runner, output) { */ function map(cov) { - var ret = { - instrumentation: 'node-jscoverage' - , sloc: 0 - , hits: 0 - , misses: 0 - , coverage: 0 - , files: [] + const ret = { + instrumentation: 'node-jscoverage', + sloc: 0, + hits: 0, + misses: 0, + coverage: 0, + files: [], }; - for (var filename in cov) { - var data = coverage(filename, cov[filename]); + for (const filename in cov) { + const data = coverage(filename, cov[filename]); ret.files.push(data); ret.hits += data.hits; ret.misses += data.misses; @@ -102,16 +102,16 @@ function map(cov) { */ function coverage(filename, data) { - var ret = { + const ret = { filename: filename, coverage: 0, hits: 0, misses: 0, sloc: 0, - source: {} + source: {}, }; - data.source.forEach(function(line, num){ + data.source.forEach(function(line, num) { num++; if (data[num] === 0) { @@ -123,10 +123,10 @@ function coverage(filename, data) { } ret.source[num] = { - source: line - , coverage: data[num] === undefined - ? '' - : data[num] + source: line, + coverage: data[num] === undefined ? + '' : + data[num], }; }); @@ -146,8 +146,8 @@ function coverage(filename, data) { function clean(test) { return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } + title: test.title, + fullTitle: test.fullTitle(), + duration: test.duration, + }; } diff --git a/test/mocha/lib/reporters/json-stream.js b/test/mocha/lib/reporters/json-stream.js index 7cb8fbe..0d5dffc 100644 --- a/test/mocha/lib/reporters/json-stream.js +++ b/test/mocha/lib/reporters/json-stream.js @@ -3,8 +3,8 @@ * Module dependencies. */ -var Base = require('./base') - , color = Base.color; +const Base = require('./base') + ; const color = Base.color; /** * Expose `List`. @@ -22,23 +22,23 @@ exports = module.exports = List; function List(runner) { Base.call(this, runner); - var self = this - , stats = this.stats - , total = runner.total; + const self = this + ; const stats = this.stats + ; const total = runner.total; - runner.on('start', function(){ - console.log(JSON.stringify(['start', { total: total }])); + runner.on('start', function() { + console.log(JSON.stringify(['start', {total: total}])); }); - runner.on('pass', function(test){ + runner.on('pass', function(test) { console.log(JSON.stringify(['pass', clean(test)])); }); - runner.on('fail', function(test, err){ + runner.on('fail', function(test, err) { console.log(JSON.stringify(['fail', clean(test)])); }); - runner.on('end', function(){ + runner.on('end', function() { process.stdout.write(JSON.stringify(['end', self.stats])); }); } @@ -54,8 +54,8 @@ function List(runner) { function clean(test) { return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} \ No newline at end of file + title: test.title, + fullTitle: test.fullTitle(), + duration: test.duration, + }; +} diff --git a/test/mocha/lib/reporters/json.js b/test/mocha/lib/reporters/json.js index a699f50..7df0557 100644 --- a/test/mocha/lib/reporters/json.js +++ b/test/mocha/lib/reporters/json.js @@ -3,9 +3,9 @@ * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; +const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; /** * Expose `JSON`. @@ -21,31 +21,31 @@ exports = module.exports = JSONReporter; */ function JSONReporter(runner) { - var self = this; + const self = this; Base.call(this, runner); - var tests = [] - , failures = [] - , passes = []; + const tests = [] + ; const failures = [] + ; const passes = []; - runner.on('test end', function(test){ + runner.on('test end', function(test) { tests.push(test); }); - runner.on('pass', function(test){ + runner.on('pass', function(test) { passes.push(test); }); - runner.on('fail', function(test){ + runner.on('fail', function(test) { failures.push(test); }); - runner.on('end', function(){ - var obj = { - stats: self.stats - , tests: tests.map(clean) - , failures: failures.map(clean) - , passes: passes.map(clean) + runner.on('end', function() { + const obj = { + stats: self.stats, + tests: tests.map(clean), + failures: failures.map(clean), + passes: passes.map(clean), }; process.stdout.write(JSON.stringify(obj, null, 2)); @@ -63,8 +63,8 @@ function JSONReporter(runner) { function clean(test) { return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} \ No newline at end of file + title: test.title, + fullTitle: test.fullTitle(), + duration: test.duration, + }; +} diff --git a/test/mocha/lib/reporters/landing.js b/test/mocha/lib/reporters/landing.js index bf064f6..91b431d 100644 --- a/test/mocha/lib/reporters/landing.js +++ b/test/mocha/lib/reporters/landing.js @@ -3,9 +3,9 @@ * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; +const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; /** * Expose `Landing`. @@ -41,30 +41,30 @@ Base.colors.runway = 90; function Landing(runner) { Base.call(this, runner); - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , total = runner.total - , stream = process.stdout - , plane = color('plane', '✈') - , crashed = -1 - , n = 0; + const self = this + ; const stats = this.stats + ; const width = Base.window.width * .75 | 0 + ; const total = runner.total + ; const stream = process.stdout + ; let plane = color('plane', '✈') + ; let crashed = -1 + ; let n = 0; function runway() { - var buf = Array(width).join('-'); + const buf = Array(width).join('-'); return ' ' + color('runway', buf); } - runner.on('start', function(){ + runner.on('start', function() { stream.write('\n '); cursor.hide(); }); - runner.on('test end', function(test){ + runner.on('test end', function(test) { // check if the plane crashed - var col = -1 == crashed - ? width * ++n / total | 0 - : crashed; + const col = -1 == crashed ? + width * ++n / total | 0 : + crashed; // show the crash if ('failed' == test.state) { @@ -77,13 +77,13 @@ function Landing(runner) { stream.write(runway()); stream.write('\n '); stream.write(color('runway', Array(col).join('⋅'))); - stream.write(plane) + stream.write(plane); stream.write(color('runway', Array(width - col).join('⋅') + '\n')); stream.write(runway()); stream.write('\u001b[0m'); }); - runner.on('end', function(){ + runner.on('end', function() { cursor.show(); console.log(); self.epilogue(); @@ -94,4 +94,4 @@ function Landing(runner) { * Inherit from `Base.prototype`. */ -Landing.prototype.__proto__ = Base.prototype; \ No newline at end of file +Landing.prototype.__proto__ = Base.prototype; diff --git a/test/mocha/lib/reporters/list.js b/test/mocha/lib/reporters/list.js index 3328e15..9221cf6 100644 --- a/test/mocha/lib/reporters/list.js +++ b/test/mocha/lib/reporters/list.js @@ -3,9 +3,9 @@ * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; +const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; /** * Expose `List`. @@ -23,33 +23,33 @@ exports = module.exports = List; function List(runner) { Base.call(this, runner); - var self = this - , stats = this.stats - , n = 0; + const self = this + ; const stats = this.stats + ; let n = 0; - runner.on('start', function(){ + runner.on('start', function() { console.log(); }); - runner.on('test', function(test){ + runner.on('test', function(test) { process.stdout.write(color('pass', ' ' + test.fullTitle() + ': ')); }); - runner.on('pending', function(test){ - var fmt = color('checkmark', ' -') - + color('pending', ' %s'); + runner.on('pending', function(test) { + const 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'); + runner.on('pass', function(test) { + const 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, err){ + runner.on('fail', function(test, err) { cursor.CR(); console.log(color('fail', ' %d) %s'), ++n, test.fullTitle()); }); diff --git a/test/mocha/lib/reporters/markdown.js b/test/mocha/lib/reporters/markdown.js index 6383a64..9a8b5c1 100644 --- a/test/mocha/lib/reporters/markdown.js +++ b/test/mocha/lib/reporters/markdown.js @@ -2,8 +2,8 @@ * Module dependencies. */ -var Base = require('./base') - , utils = require('../utils'); +const Base = require('./base') + ; const utils = require('../utils'); /** * Expose `Markdown`. @@ -21,10 +21,10 @@ exports = module.exports = Markdown; function Markdown(runner) { Base.call(this, runner); - var self = this - , stats = this.stats - , level = 0 - , buf = ''; + const self = this + ; const stats = this.stats + ; let level = 0 + ; let buf = ''; function title(str) { return Array(level).join('#') + ' ' + str; @@ -35,9 +35,9 @@ function Markdown(runner) { } function mapTOC(suite, obj) { - var ret = obj; - obj = obj[suite.title] = obj[suite.title] || { suite: suite }; - suite.suites.forEach(function(suite){ + const ret = obj; + obj = obj[suite.title] = obj[suite.title] || {suite: suite}; + suite.suites.forEach(function(suite) { mapTOC(suite, obj); }); return ret; @@ -45,9 +45,9 @@ function Markdown(runner) { function stringifyTOC(obj, level) { ++level; - var buf = ''; - var link; - for (var key in obj) { + let buf = ''; + let link; + for (const key in obj) { if ('suite' == key) continue; if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n'; if (key) buf += Array(level).join(' ') + link; @@ -58,34 +58,34 @@ function Markdown(runner) { } function generateTOC(suite) { - var obj = mapTOC(suite, {}); + const obj = mapTOC(suite, {}); return stringifyTOC(obj, 0); } generateTOC(runner.suite); - runner.on('suite', function(suite){ + runner.on('suite', function(suite) { ++level; - var slug = utils.slug(suite.fullTitle()); + const slug = utils.slug(suite.fullTitle()); buf += '' + '\n'; buf += title(suite.title) + '\n'; }); - runner.on('suite end', function(suite){ + runner.on('suite end', function(suite) { --level; }); - runner.on('pass', function(test){ - var code = utils.clean(test.fn.toString()); + runner.on('pass', function(test) { + const code = utils.clean(test.fn.toString()); buf += test.title + '.\n'; buf += '\n```js\n'; buf += code + '\n'; buf += '```\n\n'; }); - runner.on('end', function(){ + runner.on('end', function() { process.stdout.write('# TOC\n'); process.stdout.write(generateTOC(runner.suite)); process.stdout.write(buf); }); -} \ No newline at end of file +} diff --git a/test/mocha/lib/reporters/min.js b/test/mocha/lib/reporters/min.js index 1b6117d..cc84680 100644 --- a/test/mocha/lib/reporters/min.js +++ b/test/mocha/lib/reporters/min.js @@ -3,7 +3,7 @@ * Module dependencies. */ -var Base = require('./base'); +const Base = require('./base'); /** * Expose `Min`. @@ -21,7 +21,7 @@ exports = module.exports = Min; function Min(runner) { Base.call(this, runner); - runner.on('start', function(){ + runner.on('start', function() { // clear screen process.stdout.write('\u001b[2J'); // set cursor position diff --git a/test/mocha/lib/reporters/nyan.js b/test/mocha/lib/reporters/nyan.js index 4501f6b..e32f4e9 100644 --- a/test/mocha/lib/reporters/nyan.js +++ b/test/mocha/lib/reporters/nyan.js @@ -2,8 +2,8 @@ * Module dependencies. */ -var Base = require('./base') - , color = Base.color; +const Base = require('./base') + ; const color = Base.color; /** * Expose `Dot`. @@ -20,39 +20,39 @@ exports = module.exports = NyanCat; function NyanCat(runner) { Base.call(this, runner); - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , rainbowColors = this.rainbowColors = self.generateColors() - , colorIndex = this.colorIndex = 0 - , numerOfLines = this.numberOfLines = 4 - , trajectories = this.trajectories = [[], [], [], []] - , nyanCatWidth = this.nyanCatWidth = 11 - , trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth) - , scoreboardWidth = this.scoreboardWidth = 5 - , tick = this.tick = 0 - , n = 0; - - runner.on('start', function(){ + const self = this + ; const stats = this.stats + ; const width = Base.window.width * .75 | 0 + ; const rainbowColors = this.rainbowColors = self.generateColors() + ; const colorIndex = this.colorIndex = 0 + ; const numerOfLines = this.numberOfLines = 4 + ; const trajectories = this.trajectories = [[], [], [], []] + ; const nyanCatWidth = this.nyanCatWidth = 11 + ; const trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth) + ; const scoreboardWidth = this.scoreboardWidth = 5 + ; const tick = this.tick = 0 + ; const n = 0; + + runner.on('start', function() { Base.cursor.hide(); self.draw(); }); - runner.on('pending', function(test){ + runner.on('pending', function(test) { self.draw(); }); - runner.on('pass', function(test){ + runner.on('pass', function(test) { self.draw(); }); - runner.on('fail', function(test, err){ + runner.on('fail', function(test, err) { self.draw(); }); - runner.on('end', function(){ + runner.on('end', function() { Base.cursor.show(); - for (var i = 0; i < self.numberOfLines; i++) write('\n'); + for (let i = 0; i < self.numberOfLines; i++) write('\n'); self.epilogue(); }); } @@ -63,7 +63,7 @@ function NyanCat(runner) { * @api private */ -NyanCat.prototype.draw = function(){ +NyanCat.prototype.draw = function() { this.appendRainbow(); this.drawScoreboard(); this.drawRainbow(); @@ -78,9 +78,9 @@ NyanCat.prototype.draw = function(){ * @api private */ -NyanCat.prototype.drawScoreboard = function(){ - var stats = this.stats; - var colors = Base.colors; +NyanCat.prototype.drawScoreboard = function() { + const stats = this.stats; + const colors = Base.colors; function draw(color, n) { write(' '); @@ -102,12 +102,12 @@ NyanCat.prototype.drawScoreboard = function(){ * @api private */ -NyanCat.prototype.appendRainbow = function(){ - var segment = this.tick ? '_' : '-'; - var rainbowified = this.rainbowify(segment); +NyanCat.prototype.appendRainbow = function() { + const segment = this.tick ? '_' : '-'; + const rainbowified = this.rainbowify(segment); - for (var index = 0; index < this.numberOfLines; index++) { - var trajectory = this.trajectories[index]; + for (let index = 0; index < this.numberOfLines; index++) { + const trajectory = this.trajectories[index]; if (trajectory.length >= this.trajectoryWidthMax) trajectory.shift(); trajectory.push(rainbowified); } @@ -119,8 +119,8 @@ NyanCat.prototype.appendRainbow = function(){ * @api private */ -NyanCat.prototype.drawRainbow = function(){ - var self = this; +NyanCat.prototype.drawRainbow = function() { + const self = this; this.trajectories.forEach(function(line, index) { write('\u001b[' + self.scoreboardWidth + 'C'); @@ -138,10 +138,10 @@ NyanCat.prototype.drawRainbow = function(){ */ NyanCat.prototype.drawNyanCat = function() { - var self = this; - var startWidth = this.scoreboardWidth + this.trajectories[0].length; - var color = '\u001b[' + startWidth + 'C'; - var padding = ''; + const self = this; + const startWidth = this.scoreboardWidth + this.trajectories[0].length; + const color = '\u001b[' + startWidth + 'C'; + let padding = ''; write(color); write('_,------,'); @@ -154,8 +154,8 @@ NyanCat.prototype.drawNyanCat = function() { write(color); padding = self.tick ? '_' : '__'; - var tail = self.tick ? '~' : '^'; - var face; + const tail = self.tick ? '~' : '^'; + let face; write(tail + '|' + padding + this.face() + ' '); write('\n'); @@ -175,17 +175,17 @@ NyanCat.prototype.drawNyanCat = function() { */ NyanCat.prototype.face = function() { - var stats = this.stats; + const stats = this.stats; if (stats.failures) { return '( x .x)'; } else if (stats.pending) { return '( o .o)'; - } else if(stats.passes) { + } else if (stats.passes) { return '( ^ .^)'; } else { return '( - .-)'; } -} +}; /** * Move cursor up `n`. @@ -216,15 +216,15 @@ NyanCat.prototype.cursorDown = function(n) { * @api private */ -NyanCat.prototype.generateColors = function(){ - var colors = []; +NyanCat.prototype.generateColors = function() { + const 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); + for (let i = 0; i < (6 * 7); i++) { + const pi3 = Math.floor(Math.PI / 3); + const n = (i * (1.0 / 6)); + const r = Math.floor(3 * Math.sin(n) + 3); + const g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3); + const b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3); colors.push(36 * r + 6 * g + b + 16); } @@ -239,8 +239,8 @@ NyanCat.prototype.generateColors = function(){ * @api private */ -NyanCat.prototype.rainbowify = function(str){ - var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length]; +NyanCat.prototype.rainbowify = function(str) { + const color = this.rainbowColors[this.colorIndex % this.rainbowColors.length]; this.colorIndex += 1; return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m'; }; diff --git a/test/mocha/lib/reporters/progress.js b/test/mocha/lib/reporters/progress.js index 5953638..c6ae406 100644 --- a/test/mocha/lib/reporters/progress.js +++ b/test/mocha/lib/reporters/progress.js @@ -3,9 +3,9 @@ * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; +const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; /** * Expose `Progress`. @@ -30,13 +30,13 @@ Base.colors.progress = 90; function Progress(runner, options) { Base.call(this, runner); - var self = this - , options = options || {} - , stats = this.stats - , width = Base.window.width * .50 | 0 - , total = runner.total - , complete = 0 - , max = Math.max; + const self = this + ; var options = options || {} + ; const stats = this.stats + ; const width = Base.window.width * .50 | 0 + ; const total = runner.total + ; let complete = 0 + ; const max = Math.max; // default chars options.open = options.open || '['; @@ -46,18 +46,18 @@ function Progress(runner, options) { options.verbose = false; // tests started - runner.on('start', function(){ + runner.on('start', function() { console.log(); cursor.hide(); }); // tests complete - runner.on('test end', function(){ + runner.on('test end', function() { complete++; - var incomplete = total - complete - , percent = complete / total - , n = width * percent | 0 - , i = width - n; + const incomplete = total - complete + ; const percent = complete / total + ; const n = width * percent | 0 + ; const i = width - n; cursor.CR(); process.stdout.write('\u001b[J'); @@ -72,7 +72,7 @@ function Progress(runner, options) { // tests are complete, output some stats // and the failures if any - runner.on('end', function(){ + runner.on('end', function() { cursor.show(); console.log(); self.epilogue(); diff --git a/test/mocha/lib/reporters/spec.js b/test/mocha/lib/reporters/spec.js index ada25c3..fa22a00 100644 --- a/test/mocha/lib/reporters/spec.js +++ b/test/mocha/lib/reporters/spec.js @@ -3,9 +3,9 @@ * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; +const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; /** * Expose `Spec`. @@ -23,52 +23,52 @@ exports = module.exports = Spec; function Spec(runner) { Base.call(this, runner); - var self = this - , stats = this.stats - , indents = 0 - , n = 0; + const self = this + ; const stats = this.stats + ; let indents = 0 + ; let n = 0; function indent() { - return Array(indents).join(' ') + return Array(indents).join(' '); } - runner.on('start', function(){ + runner.on('start', function() { console.log(); }); - runner.on('suite', function(suite){ + runner.on('suite', function(suite) { ++indents; console.log(color('suite', '%s%s'), indent(), suite.title); }); - runner.on('suite end', function(suite){ + runner.on('suite end', function(suite) { --indents; if (1 == indents) console.log(); }); - runner.on('pending', function(test){ - var fmt = indent() + color('pending', ' - %s'); + runner.on('pending', function(test) { + const fmt = indent() + color('pending', ' - %s'); console.log(fmt, test.title); }); - runner.on('pass', function(test){ + runner.on('pass', function(test) { if ('fast' == test.speed) { - var fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s '); + var fmt = indent() + + color('checkmark', ' ' + Base.symbols.ok) + + color('pass', ' %s '); cursor.CR(); console.log(fmt, test.title); } else { - var fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s ') - + color(test.speed, '(%dms)'); + var fmt = indent() + + color('checkmark', ' ' + Base.symbols.ok) + + color('pass', ' %s ') + + color(test.speed, '(%dms)'); cursor.CR(); console.log(fmt, test.title, test.duration); } }); - runner.on('fail', function(test, err){ + runner.on('fail', function(test, err) { cursor.CR(); console.log(indent() + color('fail', ' %d) %s'), ++n, test.title); }); diff --git a/test/mocha/lib/reporters/tap.js b/test/mocha/lib/reporters/tap.js index 2bcd995..10a668f 100644 --- a/test/mocha/lib/reporters/tap.js +++ b/test/mocha/lib/reporters/tap.js @@ -3,9 +3,9 @@ * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; +const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; /** * Expose `TAP`. @@ -23,37 +23,37 @@ exports = module.exports = TAP; function TAP(runner) { Base.call(this, runner); - var self = this - , stats = this.stats - , n = 1 - , passes = 0 - , failures = 0; + const self = this + ; const stats = this.stats + ; let n = 1 + ; let passes = 0 + ; let failures = 0; - runner.on('start', function(){ - var total = runner.grepTotal(runner.suite); + runner.on('start', function() { + const total = runner.grepTotal(runner.suite); console.log('%d..%d', 1, total); }); - runner.on('test end', function(){ + runner.on('test end', function() { ++n; }); - runner.on('pending', function(test){ + runner.on('pending', function(test) { console.log('ok %d %s # SKIP -', n, title(test)); }); - runner.on('pass', function(test){ + runner.on('pass', function(test) { passes++; console.log('ok %d %s', n, title(test)); }); - runner.on('fail', function(test, err){ + 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(){ + runner.on('end', function() { console.log('# tests ' + (passes + failures)); console.log('# pass ' + passes); console.log('# fail ' + failures); diff --git a/test/mocha/lib/reporters/xunit.js b/test/mocha/lib/reporters/xunit.js index e956380..6a40ed9 100644 --- a/test/mocha/lib/reporters/xunit.js +++ b/test/mocha/lib/reporters/xunit.js @@ -3,19 +3,19 @@ * Module dependencies. */ -var Base = require('./base') - , utils = require('../utils') - , escape = utils.escape; +const Base = require('./base') + ; const utils = require('../utils') + ; const escape = utils.escape; /** * Save timer references to avoid Sinon interfering (see GH-237). */ -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; +const Date = global.Date + ; const setTimeout = global.setTimeout + ; const setInterval = global.setInterval + ; const clearTimeout = global.clearTimeout + ; const clearInterval = global.clearInterval; /** * Expose `XUnit`. @@ -32,31 +32,31 @@ exports = module.exports = XUnit; function XUnit(runner) { Base.call(this, runner); - var stats = this.stats - , tests = [] - , self = this; + const stats = this.stats + ; const tests = [] + ; const self = this; - runner.on('pending', function(test){ + runner.on('pending', function(test) { tests.push(test); }); - runner.on('pass', function(test){ + runner.on('pass', function(test) { tests.push(test); }); - runner.on('fail', function(test){ + runner.on('fail', function(test) { tests.push(test); }); - runner.on('end', function(){ + runner.on('end', function() { console.log(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 + 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(test); @@ -75,14 +75,14 @@ XUnit.prototype.__proto__ = Base.prototype; */ function test(test) { - var attrs = { - classname: test.parent.fullTitle() - , name: test.title - , time: (test.duration / 1000) || 0 + const attrs = { + classname: test.parent.fullTitle(), + name: test.title, + time: (test.duration / 1000) || 0, }; if ('failed' == test.state) { - var err = test.err; + const err = test.err; attrs.message = escape(err.message); console.log(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(err.stack)))); } else if (test.pending) { @@ -97,11 +97,11 @@ function test(test) { */ function tag(name, attrs, close, content) { - var end = close ? '/>' : '>' - , pairs = [] - , tag; + const end = close ? '/>' : '>' + ; const pairs = [] + ; let tag; - for (var key in attrs) { + for (const key in attrs) { pairs.push(key + '="' + escape(attrs[key]) + '"'); } diff --git a/test/mocha/lib/runnable.js b/test/mocha/lib/runnable.js index 03b8792..5892035 100644 --- a/test/mocha/lib/runnable.js +++ b/test/mocha/lib/runnable.js @@ -3,25 +3,25 @@ * Module dependencies. */ -var EventEmitter = require('events').EventEmitter - , debug = require('debug')('mocha:runnable') - , milliseconds = require('./ms'); +const EventEmitter = require('events').EventEmitter + ; const debug = require('debug')('mocha:runnable') + ; const milliseconds = require('./ms'); /** * Save timer references to avoid Sinon interfering (see GH-237). */ -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; +const Date = global.Date + ; const setTimeout = global.setTimeout + ; const setInterval = global.setInterval + ; const clearTimeout = global.clearTimeout + ; const clearInterval = global.clearInterval; /** * Object#toString(). */ -var toString = Object.prototype.toString; +const toString = Object.prototype.toString; /** * Expose `Runnable`. @@ -61,7 +61,7 @@ Runnable.prototype.__proto__ = EventEmitter.prototype; * @api private */ -Runnable.prototype.timeout = function(ms){ +Runnable.prototype.timeout = function(ms) { if (0 == arguments.length) return this._timeout; if ('string' == typeof ms) ms = milliseconds(ms); debug('timeout %d', ms); @@ -78,7 +78,7 @@ Runnable.prototype.timeout = function(ms){ * @api private */ -Runnable.prototype.slow = function(ms){ +Runnable.prototype.slow = function(ms) { if (0 === arguments.length) return this._slow; if ('string' == typeof ms) ms = milliseconds(ms); debug('timeout %d', ms); @@ -94,7 +94,7 @@ Runnable.prototype.slow = function(ms){ * @api public */ -Runnable.prototype.fullTitle = function(){ +Runnable.prototype.fullTitle = function() { return this.parent.fullTitle() + ' ' + this.title; }; @@ -104,7 +104,7 @@ Runnable.prototype.fullTitle = function(){ * @api private */ -Runnable.prototype.clearTimeout = function(){ +Runnable.prototype.clearTimeout = function() { clearTimeout(this.timer); }; @@ -115,8 +115,8 @@ Runnable.prototype.clearTimeout = function(){ * @api private */ -Runnable.prototype.inspect = function(){ - return JSON.stringify(this, function(key, val){ +Runnable.prototype.inspect = function() { + return JSON.stringify(this, function(key, val) { if ('_' == key[0]) return; if ('parent' == key) return '#'; if ('ctx' == key) return '#'; @@ -130,12 +130,12 @@ Runnable.prototype.inspect = function(){ * @api private */ -Runnable.prototype.resetTimeout = function(){ - var self = this; - var ms = this.timeout() || 1e9; +Runnable.prototype.resetTimeout = function() { + const self = this; + const ms = this.timeout() || 1e9; this.clearTimeout(); - this.timer = setTimeout(function(){ + this.timer = setTimeout(function() { self.callback(new Error('timeout of ' + ms + 'ms exceeded')); self.timedOut = true; }, ms); @@ -146,8 +146,8 @@ Runnable.prototype.resetTimeout = function(){ * * @api private */ -Runnable.prototype.globals = function(arr){ - var self = this; +Runnable.prototype.globals = function(arr) { + const self = this; this._allowedGlobals = arr; }; @@ -158,20 +158,20 @@ Runnable.prototype.globals = function(arr){ * @api private */ -Runnable.prototype.run = function(fn){ - var self = this - , ms = this.timeout() - , start = new Date - , ctx = this.ctx - , finished - , emitted; +Runnable.prototype.run = function(fn) { + const self = this + ; const ms = this.timeout() + ; const start = new Date + ; const ctx = this.ctx + ; let finished + ; let emitted; if (ctx) ctx.runnable(this); // timeout if (this.async) { if (ms) { - this.timer = setTimeout(function(){ + this.timer = setTimeout(function() { done(new Error('timeout of ' + ms + 'ms exceeded')); self.timedOut = true; }, ms); @@ -201,8 +201,8 @@ Runnable.prototype.run = function(fn){ // async if (this.async) { try { - this.fn.call(ctx, function(err){ - if (err instanceof Error || toString.call(err) === "[object Error]") return done(err); + this.fn.call(ctx, function(err) { + if (err instanceof Error || toString.call(err) === '[object Error]') return done(err); if (null != err) return done(new Error('done() invoked with non-Error: ' + err)); done(); }); diff --git a/test/mocha/lib/runner.js b/test/mocha/lib/runner.js index f2420f2..1ade214 100644 --- a/test/mocha/lib/runner.js +++ b/test/mocha/lib/runner.js @@ -2,24 +2,24 @@ * Module dependencies. */ -var EventEmitter = require('events').EventEmitter - , debug = require('debug')('mocha:runner') - , Test = require('./test') - , utils = require('./utils') - , filter = utils.filter - , keys = utils.keys; +const EventEmitter = require('events').EventEmitter + ; const debug = require('debug')('mocha:runner') + ; const Test = require('./test') + ; const utils = require('./utils') + ; const filter = utils.filter + ; const keys = utils.keys; /** * Non-enumerable globals. */ -var globals = [ +const globals = [ 'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval', 'XMLHttpRequest', - 'Date' + 'Date', ]; /** @@ -49,14 +49,18 @@ module.exports = Runner; */ function Runner(suite) { - var self = this; + const self = this; this._globals = []; this._abort = false; this.suite = suite; 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.on('test end', function(test) { + self.checkGlobals(test); + }); + this.on('hook end', function(hook) { + self.checkGlobals(hook); + }); this.grep(/.*/); this.globals(this.globalProps().concat(['errno'])); } @@ -86,7 +90,7 @@ Runner.prototype.__proto__ = EventEmitter.prototype; * @api public */ -Runner.prototype.grep = function(re, invert){ +Runner.prototype.grep = function(re, invert) { debug('grep %s', re); this._grep = re; this._invert = invert; @@ -104,11 +108,11 @@ Runner.prototype.grep = function(re, invert){ */ Runner.prototype.grepTotal = function(suite) { - var self = this; - var total = 0; + const self = this; + let total = 0; - suite.eachTest(function(test){ - var match = self._grep.test(test.fullTitle()); + suite.eachTest(function(test) { + let match = self._grep.test(test.fullTitle()); if (self._invert) match = !match; if (match) total++; }); @@ -124,10 +128,10 @@ Runner.prototype.grepTotal = function(suite) { */ Runner.prototype.globalProps = function() { - var props = utils.keys(global); + const props = utils.keys(global); // non-enumerables - for (var i = 0; i < globals.length; ++i) { + for (let i = 0; i < globals.length; ++i) { if (~utils.indexOf(props, globals[i])) continue; props.push(globals[i]); } @@ -143,7 +147,7 @@ Runner.prototype.globalProps = function() { * @api public */ -Runner.prototype.globals = function(arr){ +Runner.prototype.globals = function(arr) { if (0 == arguments.length) return this._globals; debug('globals %j', arr); this._globals = this._globals.concat(arr); @@ -156,13 +160,13 @@ Runner.prototype.globals = function(arr){ * @api private */ -Runner.prototype.checkGlobals = function(test){ +Runner.prototype.checkGlobals = function(test) { if (this.ignoreLeaks) return; - var ok = this._globals; + let ok = this._globals; - var globals = this.globalProps(); - var isNode = process.kill; - var leaks; + const globals = this.globalProps(); + const isNode = process.kill; + let leaks; if (test) { ok = ok.concat(test._allowedGlobals || []); @@ -172,7 +176,7 @@ Runner.prototype.checkGlobals = function(test){ if (isNode && 1 == ok.length - globals.length) return; else if (2 == ok.length - globals.length) return; - if(this.prevGlobalsLength == globals.length) return; + if (this.prevGlobalsLength == globals.length) return; this.prevGlobalsLength = globals.length; leaks = filterLeaks(ok, globals); @@ -193,7 +197,7 @@ Runner.prototype.checkGlobals = function(test){ * @api private */ -Runner.prototype.fail = function(test, err){ +Runner.prototype.fail = function(test, err) { ++this.failures; test.state = 'failed'; @@ -225,7 +229,7 @@ Runner.prototype.fail = function(test, err){ * @api private */ -Runner.prototype.failHook = function(hook, err){ +Runner.prototype.failHook = function(hook, err) { this.fail(hook, err); if (this.suite.bail()) { this.emit('end'); @@ -240,14 +244,14 @@ Runner.prototype.failHook = function(hook, err){ * @api private */ -Runner.prototype.hook = function(name, fn){ - var suite = this.suite - , hooks = suite['_' + name] - , self = this - , timer; +Runner.prototype.hook = function(name, fn) { + const suite = this.suite + ; const hooks = suite['_' + name] + ; const self = this + ; let timer; function next(i) { - var hook = hooks[i]; + const hook = hooks[i]; if (!hook) return fn(); if (self.failures && suite.bail()) return fn(); self.currentRunnable = hook; @@ -256,13 +260,13 @@ Runner.prototype.hook = function(name, fn){ self.emit('hook', hook); - hook.on('error', function(err){ + hook.on('error', function(err) { self.failHook(hook, err); }); - hook.run(function(err){ + hook.run(function(err) { hook.removeAllListeners('error'); - var testError = hook.error(); + const testError = hook.error(); if (testError) self.fail(self.test, testError); if (err) { self.failHook(hook, err); @@ -276,7 +280,7 @@ Runner.prototype.hook = function(name, fn){ }); } - Runner.immediately(function(){ + Runner.immediately(function() { next(0); }); }; @@ -291,9 +295,9 @@ Runner.prototype.hook = function(name, fn){ * @api private */ -Runner.prototype.hooks = function(name, suites, fn){ - var self = this - , orig = this.suite; +Runner.prototype.hooks = function(name, suites, fn) { + const self = this + ; const orig = this.suite; function next(suite) { self.suite = suite; @@ -303,9 +307,9 @@ Runner.prototype.hooks = function(name, suites, fn){ return fn(); } - self.hook(name, function(err){ + self.hook(name, function(err) { if (err) { - var errSuite = self.suite; + const errSuite = self.suite; self.suite = orig; return fn(err, errSuite); } @@ -325,8 +329,8 @@ Runner.prototype.hooks = function(name, suites, fn){ * @api private */ -Runner.prototype.hookUp = function(name, fn){ - var suites = [this.suite].concat(this.parents()).reverse(); +Runner.prototype.hookUp = function(name, fn) { + const suites = [this.suite].concat(this.parents()).reverse(); this.hooks(name, suites, fn); }; @@ -338,8 +342,8 @@ Runner.prototype.hookUp = function(name, fn){ * @api private */ -Runner.prototype.hookDown = function(name, fn){ - var suites = [this.suite].concat(this.parents()); +Runner.prototype.hookDown = function(name, fn) { + const suites = [this.suite].concat(this.parents()); this.hooks(name, suites, fn); }; @@ -351,9 +355,9 @@ Runner.prototype.hookDown = function(name, fn){ * @api private */ -Runner.prototype.parents = function(){ - var suite = this.suite - , suites = []; +Runner.prototype.parents = function() { + let suite = this.suite + ; const suites = []; while (suite = suite.parent) suites.push(suite); return suites; }; @@ -365,14 +369,14 @@ Runner.prototype.parents = function(){ * @api private */ -Runner.prototype.runTest = function(fn){ - var test = this.test - , self = this; +Runner.prototype.runTest = function(fn) { + const test = this.test + ; const self = this; if (this.asyncOnly) test.asyncOnly = true; try { - test.on('error', function(err){ + test.on('error', function(err) { self.fail(test, err); }); test.run(fn); @@ -390,15 +394,15 @@ Runner.prototype.runTest = function(fn){ * @api private */ -Runner.prototype.runTests = function(suite, fn){ - var self = this - , tests = suite.tests.slice() - , test; +Runner.prototype.runTests = function(suite, fn) { + const self = this + ; const tests = suite.tests.slice() + ; let test; function hookErr(err, errSuite, after) { // before/after Each hook for errSuite failed: - var orig = self.suite; + const orig = self.suite; // for failed 'after each' hook start from errSuite parent, // otherwise start from errSuite itself @@ -435,7 +439,7 @@ Runner.prototype.runTests = function(suite, fn){ if (!test) return fn(); // grep - var match = self._grep.test(test.fullTitle()); + let match = self._grep.test(test.fullTitle()); if (self._invert) match = !match; if (!match) return next(); @@ -448,12 +452,11 @@ Runner.prototype.runTests = function(suite, fn){ // execute test and hook(s) self.emit('test', self.test = test); - self.hookDown('beforeEach', function(err, errSuite){ - + self.hookDown('beforeEach', function(err, errSuite) { if (err) return hookErr(err, errSuite, false); self.currentRunnable = self.test; - self.runTest(function(err){ + self.runTest(function(err) { test = self.test; if (err) { @@ -483,10 +486,10 @@ Runner.prototype.runTests = function(suite, fn){ * @api private */ -Runner.prototype.runSuite = function(suite, fn){ - var total = this.grepTotal(suite) - , self = this - , i = 0; +Runner.prototype.runSuite = function(suite, fn) { + const total = this.grepTotal(suite) + ; const self = this + ; let i = 0; debug('run suite %s', suite.fullTitle()); @@ -510,20 +513,20 @@ Runner.prototype.runSuite = function(suite, fn){ if (self._abort) return done(); - var curr = suite.suites[i++]; + const curr = suite.suites[i++]; if (!curr) return done(); self.runSuite(curr, next); } function done(errSuite) { self.suite = suite; - self.hook('afterAll', function(){ + self.hook('afterAll', function() { self.emit('suite end', suite); fn(errSuite); }); } - this.hook('beforeAll', function(err){ + this.hook('beforeAll', function(err) { if (err) return done(); self.runTests(suite, next); }); @@ -536,9 +539,9 @@ Runner.prototype.runSuite = function(suite, fn){ * @api private */ -Runner.prototype.uncaught = function(err){ +Runner.prototype.uncaught = function(err) { debug('uncaught exception %s', err.message); - var runnable = this.currentRunnable; + const runnable = this.currentRunnable; if (!runnable || 'failed' == runnable.state) return; runnable.clearTimeout(); err.uncaught = true; @@ -564,18 +567,18 @@ Runner.prototype.uncaught = function(err){ * @api public */ -Runner.prototype.run = function(fn){ - var self = this - , fn = fn || function(){}; +Runner.prototype.run = function(fn) { + const self = this + ; var fn = fn || function() {}; - function uncaught(err){ + function uncaught(err) { self.uncaught(err); } debug('start'); // callback - this.on('end', function(){ + this.on('end', function() { debug('end'); process.removeListener('uncaughtException', uncaught); fn(self.failures); @@ -583,7 +586,7 @@ Runner.prototype.run = function(fn){ // run suites this.emit('start'); - this.runSuite(this.suite, function(){ + this.runSuite(this.suite, function() { debug('finished running'); self.emit('end'); }); @@ -600,10 +603,10 @@ Runner.prototype.run = function(fn){ * @return {Runner} for chaining * @api public */ -Runner.prototype.abort = function(){ +Runner.prototype.abort = function() { debug('aborting'); this._abort = true; -} +}; /** * Filter leaks with the given globals flagged as `ok`. @@ -615,7 +618,7 @@ Runner.prototype.abort = function(){ */ function filterLeaks(ok, globals) { - return filter(globals, function(key){ + return filter(globals, function(key) { // Firefox and Chrome exposes iframes as index inside the window object if (/^d+/.test(key)) return false; @@ -631,7 +634,7 @@ function filterLeaks(ok, globals) { // Opera and IE expose global variables for HTML element IDs (issue #243) if (/^mocha-/.test(key)) return false; - var matched = filter(ok, function(ok){ + const matched = filter(ok, function(ok) { if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]); return key == ok; }); diff --git a/test/mocha/lib/suite.js b/test/mocha/lib/suite.js index 869bb88..976c73f 100644 --- a/test/mocha/lib/suite.js +++ b/test/mocha/lib/suite.js @@ -3,11 +3,11 @@ * Module dependencies. */ -var EventEmitter = require('events').EventEmitter - , debug = require('debug')('mocha:suite') - , milliseconds = require('./ms') - , utils = require('./utils') - , Hook = require('./hook'); +const EventEmitter = require('events').EventEmitter + ; const debug = require('debug')('mocha:suite') + ; const milliseconds = require('./ms') + ; const utils = require('./utils') + ; const Hook = require('./hook'); /** * Expose `Suite`. @@ -28,8 +28,8 @@ exports = module.exports = Suite; * @api public */ -exports.create = function(parent, title){ - var suite = new Suite(title, parent.ctx); +exports.create = function(parent, title) { + const suite = new Suite(title, parent.ctx); suite.parent = parent; if (parent.pending) suite.pending = true; title = suite.fullTitle(); @@ -75,8 +75,8 @@ Suite.prototype.__proto__ = EventEmitter.prototype; * @api private */ -Suite.prototype.clone = function(){ - var suite = new Suite(this.title); +Suite.prototype.clone = function() { + const suite = new Suite(this.title); debug('clone'); suite.ctx = this.ctx; suite.timeout(this.timeout()); @@ -93,7 +93,7 @@ Suite.prototype.clone = function(){ * @api private */ -Suite.prototype.timeout = function(ms){ +Suite.prototype.timeout = function(ms) { if (0 == arguments.length) return this._timeout; if ('string' == typeof ms) ms = milliseconds(ms); debug('timeout %d', ms); @@ -109,7 +109,7 @@ Suite.prototype.timeout = function(ms){ * @api private */ -Suite.prototype.slow = function(ms){ +Suite.prototype.slow = function(ms) { if (0 === arguments.length) return this._slow; if ('string' == typeof ms) ms = milliseconds(ms); debug('slow %d', ms); @@ -125,7 +125,7 @@ Suite.prototype.slow = function(ms){ * @api private */ -Suite.prototype.bail = function(bail){ +Suite.prototype.bail = function(bail) { if (0 == arguments.length) return this._bail; debug('bail %s', bail); this._bail = bail; @@ -140,9 +140,9 @@ Suite.prototype.bail = function(bail){ * @api private */ -Suite.prototype.beforeAll = function(fn){ +Suite.prototype.beforeAll = function(fn) { if (this.pending) return this; - var hook = new Hook('"before all" hook', fn); + const hook = new Hook('"before all" hook', fn); hook.parent = this; hook.timeout(this.timeout()); hook.slow(this.slow()); @@ -160,9 +160,9 @@ Suite.prototype.beforeAll = function(fn){ * @api private */ -Suite.prototype.afterAll = function(fn){ +Suite.prototype.afterAll = function(fn) { if (this.pending) return this; - var hook = new Hook('"after all" hook', fn); + const hook = new Hook('"after all" hook', fn); hook.parent = this; hook.timeout(this.timeout()); hook.slow(this.slow()); @@ -180,9 +180,9 @@ Suite.prototype.afterAll = function(fn){ * @api private */ -Suite.prototype.beforeEach = function(fn){ +Suite.prototype.beforeEach = function(fn) { if (this.pending) return this; - var hook = new Hook('"before each" hook', fn); + const hook = new Hook('"before each" hook', fn); hook.parent = this; hook.timeout(this.timeout()); hook.slow(this.slow()); @@ -200,9 +200,9 @@ Suite.prototype.beforeEach = function(fn){ * @api private */ -Suite.prototype.afterEach = function(fn){ +Suite.prototype.afterEach = function(fn) { if (this.pending) return this; - var hook = new Hook('"after each" hook', fn); + const hook = new Hook('"after each" hook', fn); hook.parent = this; hook.timeout(this.timeout()); hook.slow(this.slow()); @@ -220,7 +220,7 @@ Suite.prototype.afterEach = function(fn){ * @api private */ -Suite.prototype.addSuite = function(suite){ +Suite.prototype.addSuite = function(suite) { suite.parent = this; suite.timeout(this.timeout()); suite.slow(this.slow()); @@ -238,7 +238,7 @@ Suite.prototype.addSuite = function(suite){ * @api private */ -Suite.prototype.addTest = function(test){ +Suite.prototype.addTest = function(test) { test.parent = this; test.timeout(this.timeout()); test.slow(this.slow()); @@ -256,9 +256,9 @@ Suite.prototype.addTest = function(test){ * @api public */ -Suite.prototype.fullTitle = function(){ +Suite.prototype.fullTitle = function() { if (this.parent) { - var full = this.parent.fullTitle(); + const full = this.parent.fullTitle(); if (full) return full + ' ' + this.title; } return this.title; @@ -271,8 +271,8 @@ Suite.prototype.fullTitle = function(){ * @api public */ -Suite.prototype.total = function(){ - return utils.reduce(this.suites, function(sum, suite){ +Suite.prototype.total = function() { + return utils.reduce(this.suites, function(sum, suite) { return sum + suite.total(); }, 0) + this.tests.length; }; @@ -287,9 +287,9 @@ Suite.prototype.total = function(){ * @api private */ -Suite.prototype.eachTest = function(fn){ +Suite.prototype.eachTest = function(fn) { utils.forEach(this.tests, fn); - utils.forEach(this.suites, function(suite){ + utils.forEach(this.suites, function(suite) { suite.eachTest(fn); }); return this; diff --git a/test/mocha/lib/test.js b/test/mocha/lib/test.js index 11773e0..0087b06 100644 --- a/test/mocha/lib/test.js +++ b/test/mocha/lib/test.js @@ -3,7 +3,7 @@ * Module dependencies. */ -var Runnable = require('./runnable'); +const Runnable = require('./runnable'); /** * Expose `Test`. diff --git a/test/mocha/lib/utils.js b/test/mocha/lib/utils.js index 37fd5d7..1ac042f 100644 --- a/test/mocha/lib/utils.js +++ b/test/mocha/lib/utils.js @@ -2,16 +2,16 @@ * Module dependencies. */ -var fs = require('fs') - , path = require('path') - , join = path.join - , debug = require('debug')('mocha:watch'); +const fs = require('fs') + ; const path = require('path') + ; const join = path.join + ; const debug = require('debug')('mocha:watch'); /** * Ignored directories. */ -var ignore = ['node_modules', '.git']; +const ignore = ['node_modules', '.git']; /** * Escape special characters in the given string of html. @@ -21,12 +21,12 @@ var ignore = ['node_modules', '.git']; * @api private */ -exports.escape = function(html){ +exports.escape = function(html) { return String(html) - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(//g, '>'); + .replace(/&/g, '&') + .replace(/"/g, '"') + .replace(//g, '>'); }; /** @@ -38,9 +38,10 @@ exports.escape = function(html){ * @api private */ -exports.forEach = function(arr, fn, scope){ - for (var i = 0, l = arr.length; i < l; i++) +exports.forEach = function(arr, fn, scope) { + for (let i = 0, l = arr.length; i < l; i++) { fn.call(scope, arr[i], i); + } }; /** @@ -52,10 +53,11 @@ exports.forEach = function(arr, fn, scope){ * @api private */ -exports.map = function(arr, fn, scope){ - var result = []; - for (var i = 0, l = arr.length; i < l; i++) +exports.map = function(arr, fn, scope) { + const result = []; + for (let i = 0, l = arr.length; i < l; i++) { result.push(fn.call(scope, arr[i], i)); + } return result; }; @@ -68,10 +70,11 @@ exports.map = function(arr, fn, scope){ * @api private */ -exports.indexOf = function(arr, obj, start){ - for (var i = start || 0, l = arr.length; i < l; i++) { - if (arr[i] === obj) +exports.indexOf = function(arr, obj, start) { + for (let i = start || 0, l = arr.length; i < l; i++) { + if (arr[i] === obj) { return i; + } } return -1; }; @@ -85,10 +88,10 @@ exports.indexOf = function(arr, obj, start){ * @api private */ -exports.reduce = function(arr, fn, val){ - var rval = val; +exports.reduce = function(arr, fn, val) { + let rval = val; - for (var i = 0, l = arr.length; i < l; i++) { + for (let i = 0, l = arr.length; i < l; i++) { rval = fn(rval, arr[i], i, arr); } @@ -103,11 +106,11 @@ exports.reduce = function(arr, fn, val){ * @api private */ -exports.filter = function(arr, fn){ - var ret = []; +exports.filter = function(arr, fn) { + const ret = []; - for (var i = 0, l = arr.length; i < l; i++) { - var val = arr[i]; + for (let i = 0, l = arr.length; i < l; i++) { + const val = arr[i]; if (fn(val, i, arr)) ret.push(val); } @@ -123,10 +126,10 @@ exports.filter = function(arr, fn){ */ exports.keys = Object.keys || function(obj) { - var keys = [] - , has = Object.prototype.hasOwnProperty // for `window` on <=IE8 + const keys = [] + ; const has = Object.prototype.hasOwnProperty; // for `window` on <=IE8 - for (var key in obj) { + for (const key in obj) { if (has.call(obj, key)) { keys.push(key); } @@ -144,11 +147,11 @@ exports.keys = Object.keys || function(obj) { * @api private */ -exports.watch = function(files, fn){ - var options = { interval: 100 }; - files.forEach(function(file){ +exports.watch = function(files, fn) { + const options = {interval: 100}; + files.forEach(function(file) { debug('file %s', file); - fs.watchFile(file, options, function(curr, prev){ + fs.watchFile(file, options, function(curr, prev) { if (prev.mtime < curr.mtime) fn(file); }); }); @@ -158,7 +161,7 @@ exports.watch = function(files, fn){ * Ignored files. */ -function ignored(path){ +function ignored(path) { return !~ignore.indexOf(path); } @@ -169,19 +172,19 @@ function ignored(path){ * @api private */ -exports.files = function(dir, ret){ +exports.files = function(dir, ret) { ret = ret || []; fs.readdirSync(dir) - .filter(ignored) - .forEach(function(path){ - path = join(dir, path); - if (fs.statSync(path).isDirectory()) { - exports.files(path, ret); - } else if (path.match(/\.(js|coffee|litcoffee|coffee.md)$/)) { - ret.push(path); - } - }); + .filter(ignored) + .forEach(function(path) { + path = join(dir, path); + if (fs.statSync(path).isDirectory()) { + exports.files(path, ret); + } else if (path.match(/\.(js|coffee|litcoffee|coffee.md)$/)) { + ret.push(path); + } + }); return ret; }; @@ -194,11 +197,11 @@ exports.files = function(dir, ret){ * @api private */ -exports.slug = function(str){ +exports.slug = function(str) { return str - .toLowerCase() - .replace(/ +/g, '-') - .replace(/[^-\w]/g, ''); + .toLowerCase() + .replace(/ +/g, '-') + .replace(/[^-\w]/g, ''); }; /** @@ -208,13 +211,13 @@ exports.slug = function(str){ exports.clean = function(str) { str = str - .replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, '') - .replace(/^function *\(.*\) *{/, '') - .replace(/\s+\}$/, ''); + .replace(/\r\n?|[\n\u2028\u2029]/g, '\n').replace(/^\uFEFF/, '') + .replace(/^function *\(.*\) *{/, '') + .replace(/\s+\}$/, ''); - var spaces = str.match(/^\n?( *)/)[1].length - , tabs = str.match(/^\n?(\t*)/)[1].length - , re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm'); + const spaces = str.match(/^\n?( *)/)[1].length + ; const tabs = str.match(/^\n?(\t*)/)[1].length + ; const re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm'); str = str.replace(re, ''); @@ -229,8 +232,8 @@ exports.clean = function(str) { * @api private */ -exports.escapeRegexp = function(str){ - return str.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); +exports.escapeRegexp = function(str) { + return str.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); }; /** @@ -241,7 +244,7 @@ exports.escapeRegexp = function(str){ * @api private */ -exports.trim = function(str){ +exports.trim = function(str) { return str.replace(/^\s+|\s+$/g, ''); }; @@ -253,11 +256,11 @@ exports.trim = function(str){ * @api private */ -exports.parseQuery = function(qs){ - return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){ - var i = pair.indexOf('=') - , key = pair.slice(0, i) - , val = pair.slice(++i); +exports.parseQuery = function(qs) { + return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair) { + let i = pair.indexOf('=') + ; const key = pair.slice(0, i) + ; const val = pair.slice(++i); obj[key] = decodeURIComponent(val); return obj; @@ -274,14 +277,14 @@ exports.parseQuery = function(qs){ function highlight(js) { return js - .replace(//g, '>') - .replace(/\/\/(.*)/gm, '//$1') - .replace(/('.*?')/gm, '$1') - .replace(/(\d+\.\d+)/gm, '$1') - .replace(/(\d+)/gm, '$1') - .replace(/\bnew *(\w+)/gm, 'new $1') - .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '$1') + .replace(//g, '>') + .replace(/\/\/(.*)/gm, '//$1') + .replace(/('.*?')/gm, '$1') + .replace(/(\d+\.\d+)/gm, '$1') + .replace(/(\d+)/gm, '$1') + .replace(/\bnew *(\w+)/gm, 'new $1') + .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '$1'); } /** @@ -292,8 +295,8 @@ function highlight(js) { */ exports.highlightTags = function(name) { - var code = document.getElementsByTagName(name); - for (var i = 0, len = code.length; i < len; ++i) { + const code = document.getElementsByTagName(name); + for (let i = 0, len = code.length; i < len; ++i) { code[i].innerHTML = highlight(code[i].innerHTML); } }; diff --git a/test/mocha/mocha.js b/test/mocha/mocha.js index e4f8e6b..825821e 100644 --- a/test/mocha/mocha.js +++ b/test/mocha/mocha.js @@ -1,10 +1,9 @@ -;(function(){ +;(function() { + // CommonJS require() -// CommonJS require() - -function require(p){ - var path = require.resolve(p) - , mod = require.modules[path]; + function require(p) { + const path = require.resolve(p) + ; const mod = require.modules[path]; if (!mod) throw new Error('failed to require "' + p + '"'); if (!mod.exports) { mod.exports = {}; @@ -13,31 +12,31 @@ function require(p){ return mod.exports; } -require.modules = {}; + require.modules = {}; -require.resolve = function (path){ - var orig = path - , reg = path + '.js' - , index = path + '/index.js'; - return require.modules[reg] && reg - || require.modules[index] && index - || orig; + require.resolve = function(path) { + const orig = path + ; const reg = path + '.js' + ; const index = path + '/index.js'; + return require.modules[reg] && reg || + require.modules[index] && index || + orig; }; -require.register = function (path, fn){ + require.register = function(path, fn) { require.modules[path] = fn; }; -require.relative = function (parent) { - return function(p){ + require.relative = function(parent) { + return function(p) { if ('.' != p.charAt(0)) return require(p); - var path = parent.split('/') - , segs = p.split('/'); + const path = parent.split('/') + ; const segs = p.split('/'); path.pop(); - for (var i = 0; i < segs.length; i++) { - var seg = segs[i]; + for (let i = 0; i < segs.length; i++) { + const seg = segs[i]; if ('..' == seg) path.pop(); else if ('.' != seg) path.push(seg); } @@ -47,19 +46,17 @@ require.relative = function (parent) { }; -require.register("browser/debug.js", function(module, exports, require){ - -module.exports = function(type){ - return function(){ - } -}; - -}); // module: browser/debug.js + require.register('browser/debug.js', function(module, exports, require) { + module.exports = function(type) { + return function() { + }; + }; + }); // module: browser/debug.js -require.register("browser/diff.js", function(module, exports, require){ -/* See LICENSE file for terms of use */ + require.register('browser/diff.js', function(module, exports, require) { + /* See LICENSE file for terms of use */ -/* + /* * Text diff implementation. * * This library supports the following APIS: @@ -73,555 +70,567 @@ require.register("browser/diff.js", function(module, exports, require){ * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986). * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 */ -var JsDiff = (function() { - /*jshint maxparams: 5*/ - 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]); + const JsDiff = (function() { + /* jshint maxparams: 5*/ + function clonePath(path) { + return {newPos: path.newPos, components: path.components.slice(0)}; + } + function removeEmpty(array) { + const ret = []; + for (let i = 0; i < array.length; i++) { + if (array[i]) { + ret.push(array[i]); + } + } + return ret; + } + function escapeHTML(s) { + let n = s; + n = n.replace(/&/g, '&'); + n = n.replace(//g, '>'); + n = n.replace(/"/g, '"'); + + return n; } - } - return ret; - } - function escapeHTML(s) { - var n = s; - n = n.replace(/&/g, '&'); - n = n.replace(//g, '>'); - n = n.replace(/"/g, '"'); - - return n; - } - var Diff = function(ignoreWhitespace) { - this.ignoreWhitespace = ignoreWhitespace; - }; - Diff.prototype = { - diff: function(oldString, newString) { + const Diff = function(ignoreWhitespace) { + this.ignoreWhitespace = ignoreWhitespace; + }; + Diff.prototype = { + diff: function(oldString, newString) { // Handle the identity case (this is due to unrolling editLength == 0 - if (newString === oldString) { - return [{ value: newString }]; - } - if (!newString) { - return [{ value: oldString, removed: true }]; - } - if (!oldString) { - return [{ value: newString, added: true }]; - } + if (newString === oldString) { + return [{value: newString}]; + } + if (!newString) { + return [{value: oldString, removed: true}]; + } + if (!oldString) { + return [{value: newString, added: true}]; + } - newString = this.tokenize(newString); - oldString = this.tokenize(oldString); + newString = this.tokenize(newString); + oldString = this.tokenize(oldString); - var newLen = newString.length, oldLen = oldString.length; - var maxEditLength = newLen + oldLen; - var bestPath = [{ newPos: -1, components: [] }]; + const newLen = newString.length; const oldLen = oldString.length; + const maxEditLength = newLen + oldLen; + const bestPath = [{newPos: -1, components: []}]; - // Seed editLength = 0 - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); - if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) { - return bestPath[0].components; - } + // Seed editLength = 0 + var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); + if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) { + return bestPath[0].components; + } - for (var editLength = 1; editLength <= maxEditLength; editLength++) { - 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) { + for (let editLength = 1; editLength <= maxEditLength; editLength++) { + for (let diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) { + var basePath; + const addPath = bestPath[diagonalPath-1]; + const 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; - } + bestPath[diagonalPath-1] = undefined; + } - var canAdd = addPath && addPath.newPos+1 < newLen; - var canRemove = removePath && 0 <= oldPos && oldPos < oldLen; - if (!canAdd && !canRemove) { - bestPath[diagonalPath] = undefined; - continue; - } + const canAdd = addPath && addPath.newPos+1 < newLen; + const canRemove = removePath && 0 <= oldPos && oldPos < oldLen; + if (!canAdd && !canRemove) { + 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); - this.pushComponent(basePath.components, oldString[oldPos], undefined, true); - } else { - basePath = clonePath(addPath); - basePath.newPos++; - this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined); - } + // 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); + this.pushComponent(basePath.components, oldString[oldPos], undefined, true); + } else { + basePath = clonePath(addPath); + basePath.newPos++; + this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined); + } - var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath); + var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath); - if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) { - return basePath.components; - } else { - bestPath[diagonalPath] = basePath; + if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) { + return basePath.components; + } else { + bestPath[diagonalPath] = basePath; + } } } - } - }, + }, - pushComponent: function(components, value, added, removed) { - var last = components[components.length-1]; - if (last && last.added === added && last.removed === removed) { + pushComponent: function(components, value, added, removed) { + const 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] = - {value: this.join(last.value, value), added: added, removed: removed }; - } else { - components.push({value: value, added: added, removed: removed }); - } - }, - extractCommon: function(basePath, newString, oldString, diagonalPath) { - var newLen = newString.length, - oldLen = oldString.length, - newPos = basePath.newPos, - oldPos = newPos - diagonalPath; - while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) { - newPos++; - oldPos++; - - this.pushComponent(basePath.components, newString[newPos], undefined, undefined); - } - basePath.newPos = newPos; - return oldPos; - }, - - equals: function(left, right) { - var reWhitespace = /\S/; - if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) { - return true; - } else { - return left === right; - } - }, - join: function(left, right) { - return left + right; - }, - tokenize: function(value) { - return value; - } - }; - - 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(); - LineDiff.tokenize = function(value) { - return value.split(/^/m); - }; - - return { - Diff: Diff, - - diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); }, - diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); }, - diffWordsWithSpace: function(oldStr, newStr) { return WordWithSpaceDiff.diff(oldStr, newStr); }, - diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); }, - - diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); }, - - createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) { - var ret = []; - - ret.push('Index: ' + fileName); - ret.push('==================================================================='); - ret.push('--- ' + fileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader)); - ret.push('+++ ' + fileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader)); - - var diff = LineDiff.diff(oldStr, newStr); - if (!diff[diff.length-1].value) { - diff.pop(); // Remove trailing newline add - } - diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier - - function contextLines(lines) { - return lines.map(function(entry) { return ' ' + entry; }); - } - 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 || current.removed !== last.removed); - - // 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'); - } - } + components[components.length-1] = + {value: this.join(last.value, value), added: added, removed: removed}; + } else { + components.push({value: value, added: added, removed: removed}); + } + }, + extractCommon: function(basePath, newString, oldString, diagonalPath) { + const newLen = newString.length; + const oldLen = oldString.length; + let newPos = basePath.newPos; + let oldPos = newPos - diagonalPath; + while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) { + newPos++; + oldPos++; + + this.pushComponent(basePath.components, newString[newPos], undefined, undefined); + } + basePath.newPos = newPos; + return oldPos; + }, + + equals: function(left, right) { + const reWhitespace = /\S/; + if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) { + return true; + } else { + return left === right; + } + }, + join: function(left, right) { + return left + right; + }, + tokenize: function(value) { + return value; + }, + }; + + const CharDiff = new Diff(); + + const WordDiff = new Diff(true); + const WordWithSpaceDiff = new Diff(); + WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) { + return removeEmpty(value.split(/(\s+|\b)/)); + }; + + const CssDiff = new Diff(true); + CssDiff.tokenize = function(value) { + return removeEmpty(value.split(/([{}:;,]|\s+)/)); + }; + + const LineDiff = new Diff(); + LineDiff.tokenize = function(value) { + return value.split(/^/m); + }; + + return { + Diff: Diff, + + diffChars: function(oldStr, newStr) { + return CharDiff.diff(oldStr, newStr); + }, + diffWords: function(oldStr, newStr) { + return WordDiff.diff(oldStr, newStr); + }, + diffWordsWithSpace: function(oldStr, newStr) { + return WordWithSpaceDiff.diff(oldStr, newStr); + }, + diffLines: function(oldStr, newStr) { + return LineDiff.diff(oldStr, newStr); + }, + + diffCss: function(oldStr, newStr) { + return CssDiff.diff(oldStr, newStr); + }, + + createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) { + const ret = []; + + ret.push('Index: ' + fileName); + ret.push('==================================================================='); + ret.push('--- ' + fileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader)); + ret.push('+++ ' + fileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader)); + + const diff = LineDiff.diff(oldStr, newStr); + if (!diff[diff.length-1].value) { + diff.pop(); // Remove trailing newline add + } + diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier - 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 (!oldRangeStart) { - var prev = diff[i-1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = contextLines(prev.lines.slice(-4)); - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; + function contextLines(lines) { + return lines.map(function(entry) { + return ' ' + entry; + }); + } + function eofNL(curRange, i, current) { + const last = diff[diff.length-2]; + const isLast = i === diff.length-2; + const isLastOfType = i === diff.length-3 && (current.added !== last.added || current.removed !== last.removed); + + // 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'); } } - curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?'+':'-') + entry; })); - eofNL(curRange, i, current); - if (current.added) { - newLine += lines.length; - } else { - oldLine += lines.length; - } - } else { - 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)); + let oldRangeStart = 0; let newRangeStart = 0; let curRange = []; + let oldLine = 1; let newLine = 1; + for (let i = 0; i < diff.length; i++) { + var current = diff[i]; + const lines = current.lines || current.value.replace(/\n$/, '').split('\n'); + current.lines = lines; + + if (current.added || current.removed) { + if (!oldRangeStart) { + const prev = diff[i-1]; + oldRangeStart = oldLine; + newRangeStart = newLine; + + if (prev) { + curRange = contextLines(prev.lines.slice(-4)); + oldRangeStart -= curRange.length; + newRangeStart -= curRange.length; + } + } + curRange.push.apply(curRange, lines.map(function(entry) { + return (current.added?'+':'-') + entry; + })); + eofNL(curRange, i, current); + + if (current.added) { + newLine += lines.length; + } else { + oldLine += lines.length; + } } 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); + 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 + const 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; + } + } - oldRangeStart = 0; newRangeStart = 0; curRange = []; + return ret.join('\n') + '\n'; + }, + + applyPatch: function(oldStr, uniDiff) { + const diffstr = uniDiff.split('\n'); + const diff = []; + let remEOFNL = false; + let addEOFNL = false; + + for (var i = (diffstr[0][0]==='I'?4:0); i < diffstr.length; i++) { + if (diffstr[i][0] === '@') { + const meh = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/); + diff.unshift({ + start: meh[3], + oldlength: meh[2], + oldlines: [], + newlength: meh[4], + newlines: [], + }); + } else if (diffstr[i][0] === '+') { + diff[0].newlines.push(diffstr[i].substr(1)); + } else if (diffstr[i][0] === '-') { + diff[0].oldlines.push(diffstr[i].substr(1)); + } else if (diffstr[i][0] === ' ') { + diff[0].newlines.push(diffstr[i].substr(1)); + diff[0].oldlines.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; + } } } - oldLine += lines.length; - newLine += lines.length; - } - } - return ret.join('\n') + '\n'; - }, - - applyPatch: function(oldStr, uniDiff) { - var diffstr = uniDiff.split('\n'); - var diff = []; - var remEOFNL = false, - addEOFNL = false; - - for (var i = (diffstr[0][0]==='I'?4:0); i < diffstr.length; i++) { - if(diffstr[i][0] === '@') { - var meh = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/); - diff.unshift({ - start:meh[3], - oldlength:meh[2], - oldlines:[], - newlength:meh[4], - newlines:[] - }); - } else if(diffstr[i][0] === '+') { - diff[0].newlines.push(diffstr[i].substr(1)); - } else if(diffstr[i][0] === '-') { - diff[0].oldlines.push(diffstr[i].substr(1)); - } else if(diffstr[i][0] === ' ') { - diff[0].newlines.push(diffstr[i].substr(1)); - diff[0].oldlines.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; + const str = oldStr.split('\n'); + for (var i = diff.length - 1; i >= 0; i--) { + const d = diff[i]; + for (let j = 0; j < d.oldlength; j++) { + if (str[d.start-1+j] !== d.oldlines[j]) { + return false; + } + } + Array.prototype.splice.apply(str, [d.start-1, +d.oldlength].concat(d.newlines)); } - } - } - var str = oldStr.split('\n'); - for (var i = diff.length - 1; i >= 0; i--) { - var d = diff[i]; - for (var j = 0; j < d.oldlength; j++) { - if(str[d.start-1+j] !== d.oldlines[j]) { - return false; + if (remEOFNL) { + while (!str[str.length-1]) { + str.pop(); + } + } else if (addEOFNL) { + str.push(''); } - } - Array.prototype.splice.apply(str,[d.start-1,+d.oldlength].concat(d.newlines)); - } + return str.join('\n'); + }, + + convertChangesToXML: function(changes) { + const ret = []; + for ( let i = 0; i < changes.length; i++) { + const change = changes[i]; + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } - if (remEOFNL) { - while (!str[str.length-1]) { - str.pop(); - } - } else if (addEOFNL) { - str.push(''); - } - return str.join('\n'); - }, - - convertChangesToXML: function(changes){ - var ret = []; - for ( var i = 0; i < changes.length; i++) { - var change = changes[i]; - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } + ret.push(escapeHTML(change.value)); - ret.push(escapeHTML(change.value)); + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + } + return ret.join(''); + }, + + // See: http://code.google.com/p/google-diff-match-patch/wiki/API + convertChangesToDMP: function(changes) { + const ret = []; let change; + for ( let i = 0; i < changes.length; i++) { + change = changes[i]; + ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]); + } + return ret; + }, + }; + })(); - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - } - return ret.join(''); - }, - - // See: http://code.google.com/p/google-diff-match-patch/wiki/API - convertChangesToDMP: function(changes){ - var ret = [], change; - for ( var i = 0; i < changes.length; i++) { - change = changes[i]; - ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]); - } - return ret; + if (typeof module !== 'undefined') { + module.exports = JsDiff; } - }; -})(); - -if (typeof module !== 'undefined') { - module.exports = JsDiff; -} - -}); // module: browser/diff.js - -require.register("browser/events.js", function(module, exports, require){ + }); // module: browser/diff.js -/** + require.register('browser/events.js', function(module, exports, require) { + /** * Module exports. */ -exports.EventEmitter = EventEmitter; + exports.EventEmitter = EventEmitter; -/** + /** * Check if `obj` is an array. */ -function isArray(obj) { - return '[object Array]' == {}.toString.call(obj); -} + function isArray(obj) { + return '[object Array]' == {}.toString.call(obj); + } -/** + /** * Event emitter constructor. * * @api public */ -function EventEmitter(){}; + function EventEmitter() {}; -/** + /** * Adds a listener. * * @api public */ -EventEmitter.prototype.on = function (name, fn) { - if (!this.$events) { - this.$events = {}; - } + 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]; - } + 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; -}; + return this; + }; -EventEmitter.prototype.addListener = EventEmitter.prototype.on; + EventEmitter.prototype.addListener = EventEmitter.prototype.on; -/** + /** * Adds a volatile listener. * * @api public */ -EventEmitter.prototype.once = function (name, fn) { - var self = this; + EventEmitter.prototype.once = function(name, fn) { + const self = this; - function on () { - self.removeListener(name, on); - fn.apply(this, arguments); - }; + function on() { + self.removeListener(name, on); + fn.apply(this, arguments); + }; - on.listener = fn; - this.on(name, on); + on.listener = fn; + this.on(name, on); - return this; -}; + return this; + }; -/** + /** * Removes a listener. * * @api public */ -EventEmitter.prototype.removeListener = function (name, fn) { - if (this.$events && this.$events[name]) { - var list = this.$events[name]; + EventEmitter.prototype.removeListener = function(name, fn) { + if (this.$events && this.$events[name]) { + const list = this.$events[name]; - if (isArray(list)) { - var pos = -1; + if (isArray(list)) { + let 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; - } - } + for (let 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; - } + if (pos < 0) { + return this; + } - list.splice(pos, 1); + list.splice(pos, 1); - if (!list.length) { - delete this.$events[name]; + if (!list.length) { + delete this.$events[name]; + } + } else if (list === fn || (list.listener && list.listener === fn)) { + delete this.$events[name]; + } } - } else if (list === fn || (list.listener && list.listener === fn)) { - delete this.$events[name]; - } - } - return this; -}; + return this; + }; -/** + /** * Removes all listeners for an event. * * @api public */ -EventEmitter.prototype.removeAllListeners = function (name) { - if (name === undefined) { - this.$events = {}; - return this; - } + EventEmitter.prototype.removeAllListeners = function(name) { + if (name === undefined) { + this.$events = {}; + return this; + } - if (this.$events && this.$events[name]) { - this.$events[name] = null; - } + if (this.$events && this.$events[name]) { + this.$events[name] = null; + } - return this; -}; + return this; + }; -/** + /** * Gets all listeners for a certain event. * * @api public */ -EventEmitter.prototype.listeners = function (name) { - if (!this.$events) { - this.$events = {}; - } + EventEmitter.prototype.listeners = function(name) { + if (!this.$events) { + this.$events = {}; + } - if (!this.$events[name]) { - this.$events[name] = []; - } + if (!this.$events[name]) { + this.$events[name] = []; + } - if (!isArray(this.$events[name])) { - this.$events[name] = [this.$events[name]]; - } + if (!isArray(this.$events[name])) { + this.$events[name] = [this.$events[name]]; + } - return this.$events[name]; -}; + return this.$events[name]; + }; -/** + /** * Emits an event. * * @api public */ -EventEmitter.prototype.emit = function (name) { - if (!this.$events) { - return false; - } + EventEmitter.prototype.emit = function(name) { + if (!this.$events) { + return false; + } - var handler = this.$events[name]; + const handler = this.$events[name]; - if (!handler) { - return false; - } + if (!handler) { + return false; + } - var args = [].slice.call(arguments, 1); + const args = [].slice.call(arguments, 1); - if ('function' == typeof handler) { - handler.apply(this, args); - } else if (isArray(handler)) { - var listeners = handler.slice(); + if ('function' == typeof handler) { + handler.apply(this, args); + } else if (isArray(handler)) { + const listeners = handler.slice(); - for (var i = 0, l = listeners.length; i < l; i++) { - listeners[i].apply(this, args); - } - } else { - return false; - } + for (let i = 0, l = listeners.length; i < l; i++) { + listeners[i].apply(this, args); + } + } else { + return false; + } - return true; -}; -}); // module: browser/events.js + return true; + }; + }); // module: browser/events.js -require.register("browser/fs.js", function(module, exports, require){ + require.register('browser/fs.js', function(module, exports, require) { -}); // module: browser/fs.js + }); // module: browser/fs.js -require.register("browser/path.js", function(module, exports, require){ + require.register('browser/path.js', function(module, exports, require) { -}); // module: browser/path.js + }); // module: browser/path.js -require.register("browser/progress.js", function(module, exports, require){ -/** + require.register('browser/progress.js', function(module, exports, require) { + /** * Expose `Progress`. */ -module.exports = 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'); -} + function Progress() { + this.percent = 0; + this.size(0); + this.fontSize(11); + this.font('helvetica, arial, sans-serif'); + } -/** + /** * Set progress size to `n`. * * @param {Number} n @@ -629,12 +638,12 @@ function Progress() { * @api public */ -Progress.prototype.size = function(n){ - this._size = n; - return this; -}; + Progress.prototype.size = function(n) { + this._size = n; + return this; + }; -/** + /** * Set text to `str`. * * @param {String} str @@ -642,12 +651,12 @@ Progress.prototype.size = function(n){ * @api public */ -Progress.prototype.text = function(str){ - this._text = str; - return this; -}; + Progress.prototype.text = function(str) { + this._text = str; + return this; + }; -/** + /** * Set font size to `n`. * * @param {Number} n @@ -655,117 +664,113 @@ Progress.prototype.text = function(str){ * @api public */ -Progress.prototype.fontSize = function(n){ - this._fontSize = n; - return this; -}; + Progress.prototype.fontSize = function(n) { + this._fontSize = n; + return this; + }; -/** + /** * Set font `family`. * * @param {String} family * @return {Progress} for chaining */ -Progress.prototype.font = function(family){ - this._font = family; - return this; -}; + Progress.prototype.font = function(family) { + this._font = family; + return this; + }; -/** + /** * Update percentage to `n`. * * @param {Number} n * @return {Progress} for chaining */ -Progress.prototype.update = function(n){ - this.percent = n; - return this; -}; + Progress.prototype.update = function(n) { + this.percent = n; + return this; + }; -/** + /** * Draw on `ctx`. * * @param {CanvasRenderingContext2d} ctx * @return {Progress} for chaining */ -Progress.prototype.draw = function(ctx){ - try { - var percent = Math.min(this.percent, 100) - , size = this._size - , half = size / 2 - , x = half - , y = half - , rad = half - 1 - , 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) + '%' - , w = ctx.measureText(text).width; - - ctx.fillText( - text - , x - w / 2 + 1 - , y + fontSize / 2 - 1); - } catch (ex) {} //don't fail if we can't render progress - return this; -}; - -}); // module: browser/progress.js - -require.register("browser/tty.js", function(module, exports, require){ - -exports.isatty = function(){ - return true; -}; - -exports.getWindowSize = function(){ - if ('innerHeight' in global) { - return [global.innerHeight, global.innerWidth]; - } else { - // In a Web Worker, the DOM Window is not available. - return [640, 480]; - } -}; + Progress.prototype.draw = function(ctx) { + try { + const percent = Math.min(this.percent, 100) + ; const size = this._size + ; const half = size / 2 + ; const x = half + ; const y = half + ; const rad = half - 1 + ; const fontSize = this._fontSize; + + ctx.font = fontSize + 'px ' + this._font; + + const 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 + const text = this._text || (percent | 0) + '%' + ; const w = ctx.measureText(text).width; + + ctx.fillText( + text + , x - w / 2 + 1 + , y + fontSize / 2 - 1); + } catch (ex) {} // don't fail if we can't render progress + return this; + }; + }); // module: browser/progress.js -}); // module: browser/tty.js + require.register('browser/tty.js', function(module, exports, require) { + exports.isatty = function() { + return true; + }; -require.register("context.js", function(module, exports, require){ + exports.getWindowSize = function() { + if ('innerHeight' in global) { + return [global.innerHeight, global.innerWidth]; + } else { + // In a Web Worker, the DOM Window is not available. + return [640, 480]; + } + }; + }); // module: browser/tty.js -/** + require.register('context.js', function(module, exports, require) { + /** * Expose `Context`. */ -module.exports = Context; + module.exports = Context; -/** + /** * Initialize a new `Context`. * * @api private */ -function Context(){} + function Context() {} -/** + /** * Set or get the context `Runnable` to `runnable`. * * @param {Runnable} runnable @@ -773,13 +778,13 @@ function Context(){} * @api private */ -Context.prototype.runnable = function(runnable){ - if (0 == arguments.length) return this._runnable; - this.test = this._runnable = runnable; - return this; -}; + Context.prototype.runnable = function(runnable) { + if (0 == arguments.length) return this._runnable; + this.test = this._runnable = runnable; + return this; + }; -/** + /** * Set test timeout `ms`. * * @param {Number} ms @@ -787,12 +792,12 @@ Context.prototype.runnable = function(runnable){ * @api private */ -Context.prototype.timeout = function(ms){ - this.runnable().timeout(ms); - return this; -}; + Context.prototype.timeout = function(ms) { + this.runnable().timeout(ms); + return this; + }; -/** + /** * Set test slowness threshold `ms`. * * @param {Number} ms @@ -800,43 +805,41 @@ Context.prototype.timeout = function(ms){ * @api private */ -Context.prototype.slow = function(ms){ - this.runnable().slow(ms); - return this; -}; + Context.prototype.slow = function(ms) { + this.runnable().slow(ms); + return this; + }; -/** + /** * Inspect the context void of `._runnable`. * * @return {String} * @api private */ -Context.prototype.inspect = function(){ - return JSON.stringify(this, function(key, val){ - if ('_runnable' == key) return; - if ('test' == key) return; - return val; - }, 2); -}; - -}); // module: context.js - -require.register("hook.js", function(module, exports, require){ + Context.prototype.inspect = function() { + return JSON.stringify(this, function(key, val) { + if ('_runnable' == key) return; + if ('test' == key) return; + return val; + }, 2); + }; + }); // module: context.js -/** + require.register('hook.js', function(module, exports, require) { + /** * Module dependencies. */ -var Runnable = require('./runnable'); + const Runnable = require('./runnable'); -/** + /** * Expose `Hook`. */ -module.exports = Hook; + module.exports = Hook; -/** + /** * Initialize a new `Hook` with the given `title` and callback `fn`. * * @param {String} title @@ -844,22 +847,22 @@ module.exports = Hook; * @api private */ -function Hook(title, fn) { - Runnable.call(this, title, fn); - this.type = 'hook'; -} + function Hook(title, fn) { + Runnable.call(this, title, fn); + this.type = 'hook'; + } -/** + /** * Inherit from `Runnable.prototype`. */ -function F(){}; -F.prototype = Runnable.prototype; -Hook.prototype = new F; -Hook.prototype.constructor = Hook; + function F() {}; + F.prototype = Runnable.prototype; + Hook.prototype = new F; + Hook.prototype.constructor = Hook; -/** + /** * Get or set the test `err`. * * @param {Error} err @@ -867,29 +870,27 @@ Hook.prototype.constructor = Hook; * @api public */ -Hook.prototype.error = function(err){ - if (0 == arguments.length) { - var err = this._error; - this._error = null; - return err; - } - - this._error = err; -}; - -}); // module: hook.js + Hook.prototype.error = function(err) { + if (0 == arguments.length) { + var err = this._error; + this._error = null; + return err; + } -require.register("interfaces/bdd.js", function(module, exports, require){ + this._error = err; + }; + }); // module: hook.js -/** + require.register('interfaces/bdd.js', function(module, exports, require) { + /** * Module dependencies. */ -var Suite = require('../suite') - , Test = require('../test') - , utils = require('../utils'); + const Suite = require('../suite') + ; const Test = require('../test') + ; const utils = require('../utils'); -/** + /** * BDD-style interface: * * describe('Array', function(){ @@ -906,130 +907,127 @@ var Suite = require('../suite') * */ -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ + module.exports = function(suite) { + const suites = [suite]; - /** + suite.on('pre-require', function(context, file, mocha) { + /** * Execute before running tests. */ - context.before = function(fn){ - suites[0].beforeAll(fn); - }; + context.before = function(fn) { + suites[0].beforeAll(fn); + }; - /** + /** * Execute after running tests. */ - context.after = function(fn){ - suites[0].afterAll(fn); - }; + context.after = function(fn) { + suites[0].afterAll(fn); + }; - /** + /** * Execute before each test case. */ - context.beforeEach = function(fn){ - suites[0].beforeEach(fn); - }; + context.beforeEach = function(fn) { + suites[0].beforeEach(fn); + }; - /** + /** * Execute after each test case. */ - context.afterEach = function(fn){ - suites[0].afterEach(fn); - }; + context.afterEach = function(fn) { + suites[0].afterEach(fn); + }; - /** + /** * Describe a "suite" with the given `title` * and callback `fn` containing nested suites * and/or tests. */ - context.describe = context.context = function(title, fn){ - var suite = Suite.create(suites[0], title); - suites.unshift(suite); - fn.call(suite); - suites.shift(); - return suite; - }; + context.describe = context.context = function(title, fn) { + const suite = Suite.create(suites[0], title); + suites.unshift(suite); + fn.call(suite); + suites.shift(); + return suite; + }; - /** + /** * Pending describe. */ - context.xdescribe = + context.xdescribe = context.xcontext = - context.describe.skip = function(title, fn){ - var suite = Suite.create(suites[0], title); + context.describe.skip = function(title, fn) { + const suite = Suite.create(suites[0], title); suite.pending = true; suites.unshift(suite); fn.call(suite); suites.shift(); }; - /** + /** * Exclusive suite. */ - context.describe.only = function(title, fn){ - var suite = context.describe(title, fn); - mocha.grep(suite.fullTitle()); - return suite; - }; + context.describe.only = function(title, fn) { + const suite = context.describe(title, fn); + mocha.grep(suite.fullTitle()); + return suite; + }; - /** + /** * 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.pending) var fn = null; - var test = new Test(title, fn); - suite.addTest(test); - return test; - }; + context.it = context.specify = function(title, fn) { + const suite = suites[0]; + if (suite.pending) var fn = null; + const test = new Test(title, fn); + suite.addTest(test); + return test; + }; - /** + /** * Exclusive test-case. */ - context.it.only = function(title, fn){ - var test = context.it(title, fn); - var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - return test; - }; + context.it.only = function(title, fn) { + const test = context.it(title, fn); + const reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; + mocha.grep(new RegExp(reString)); + return test; + }; - /** + /** * Pending test case. */ - context.xit = + context.xit = context.xspecify = - context.it.skip = function(title){ + context.it.skip = function(title) { context.it(title); }; - }); -}; - -}); // module: interfaces/bdd.js - -require.register("interfaces/exports.js", function(module, exports, require){ + }); + }; + }); // module: interfaces/bdd.js -/** + require.register('interfaces/exports.js', function(module, exports, require) { + /** * Module dependencies. */ -var Suite = require('../suite') - , Test = require('../test'); + const Suite = require('../suite') + ; const Test = require('../test'); -/** + /** * TDD-style interface: * * exports.Array = { @@ -1046,64 +1044,60 @@ var Suite = require('../suite') * */ -module.exports = function(suite){ - var suites = [suite]; - - suite.on('require', visit); - - function visit(obj) { - var suite; - for (var key in obj) { - if ('function' == typeof obj[key]) { - 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: - suites[0].addTest(new Test(key, fn)); + module.exports = function(suite) { + const suites = [suite]; + + suite.on('require', visit); + + function visit(obj) { + var suite; + for (const key in obj) { + if ('function' == typeof obj[key]) { + const 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: + suites[0].addTest(new Test(key, fn)); + } + } else { + var suite = Suite.create(suites[0], key); + suites.unshift(suite); + visit(obj[key]); + suites.shift(); + } } - } else { - var suite = Suite.create(suites[0], key); - suites.unshift(suite); - visit(obj[key]); - suites.shift(); } - } - } -}; - -}); // module: interfaces/exports.js - -require.register("interfaces/index.js", function(module, exports, require){ - -exports.bdd = require('./bdd'); -exports.tdd = require('./tdd'); -exports.qunit = require('./qunit'); -exports.exports = require('./exports'); - -}); // module: interfaces/index.js + }; + }); // module: interfaces/exports.js -require.register("interfaces/qunit.js", function(module, exports, require){ + require.register('interfaces/index.js', function(module, exports, require) { + exports.bdd = require('./bdd'); + exports.tdd = require('./tdd'); + exports.qunit = require('./qunit'); + exports.exports = require('./exports'); + }); // module: interfaces/index.js -/** + require.register('interfaces/qunit.js', function(module, exports, require) { + /** * Module dependencies. */ -var Suite = require('../suite') - , Test = require('../test') - , utils = require('../utils'); + const Suite = require('../suite') + ; const Test = require('../test') + ; const utils = require('../utils'); -/** + /** * QUnit-style interface: * * suite('Array'); @@ -1128,108 +1122,105 @@ var Suite = require('../suite') * */ -module.exports = function(suite){ - var suites = [suite]; + module.exports = function(suite) { + const suites = [suite]; - suite.on('pre-require', function(context, file, mocha){ - - /** + suite.on('pre-require', function(context, file, mocha) { + /** * Execute before running tests. */ - context.before = function(fn){ - suites[0].beforeAll(fn); - }; + context.before = function(fn) { + suites[0].beforeAll(fn); + }; - /** + /** * Execute after running tests. */ - context.after = function(fn){ - suites[0].afterAll(fn); - }; + context.after = function(fn) { + suites[0].afterAll(fn); + }; - /** + /** * Execute before each test case. */ - context.beforeEach = function(fn){ - suites[0].beforeEach(fn); - }; + context.beforeEach = function(fn) { + suites[0].beforeEach(fn); + }; - /** + /** * Execute after each test case. */ - context.afterEach = function(fn){ - suites[0].afterEach(fn); - }; + context.afterEach = function(fn) { + suites[0].afterEach(fn); + }; - /** + /** * Describe a "suite" with the given `title`. */ - context.suite = function(title){ - if (suites.length > 1) suites.shift(); - var suite = Suite.create(suites[0], title); - suites.unshift(suite); - return suite; - }; + context.suite = function(title) { + if (suites.length > 1) suites.shift(); + const suite = Suite.create(suites[0], title); + suites.unshift(suite); + return suite; + }; - /** + /** * Exclusive test-case. */ - context.suite.only = function(title, fn){ - var suite = context.suite(title, fn); - mocha.grep(suite.fullTitle()); - }; + context.suite.only = function(title, fn) { + const suite = context.suite(title, fn); + mocha.grep(suite.fullTitle()); + }; - /** + /** * 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); - suites[0].addTest(test); - return test; - }; + context.test = function(title, fn) { + const test = new Test(title, fn); + suites[0].addTest(test); + return test; + }; - /** + /** * Exclusive test-case. */ - context.test.only = function(title, fn){ - var test = context.test(title, fn); - var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - }; + context.test.only = function(title, fn) { + const test = context.test(title, fn); + const reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; + mocha.grep(new RegExp(reString)); + }; - /** + /** * Pending test case. */ - context.test.skip = function(title){ - context.test(title); + context.test.skip = function(title) { + context.test(title); + }; + }); }; - }); -}; - -}); // module: interfaces/qunit.js - -require.register("interfaces/tdd.js", function(module, exports, require){ + }); // module: interfaces/qunit.js -/** + require.register('interfaces/tdd.js', function(module, exports, require) { + /** * Module dependencies. */ -var Suite = require('../suite') - , Test = require('../test') - , utils = require('../utils');; + const Suite = require('../suite') + ; const Test = require('../test') + ; const utils = require('../utils'); ; -/** + /** * TDD-style interface: * * suite('Array', function(){ @@ -1254,148 +1245,146 @@ var Suite = require('../suite') * */ -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ + module.exports = function(suite) { + const suites = [suite]; - /** + suite.on('pre-require', function(context, file, mocha) { + /** * Execute before each test case. */ - context.setup = function(fn){ - suites[0].beforeEach(fn); - }; + context.setup = function(fn) { + suites[0].beforeEach(fn); + }; - /** + /** * Execute after each test case. */ - context.teardown = function(fn){ - suites[0].afterEach(fn); - }; + context.teardown = function(fn) { + suites[0].afterEach(fn); + }; - /** + /** * Execute before the suite. */ - context.suiteSetup = function(fn){ - suites[0].beforeAll(fn); - }; + context.suiteSetup = function(fn) { + suites[0].beforeAll(fn); + }; - /** + /** * Execute after the suite. */ - context.suiteTeardown = function(fn){ - suites[0].afterAll(fn); - }; + context.suiteTeardown = function(fn) { + suites[0].afterAll(fn); + }; - /** + /** * Describe a "suite" with the given `title` * and callback `fn` containing nested suites * and/or tests. */ - context.suite = function(title, fn){ - var suite = Suite.create(suites[0], title); - suites.unshift(suite); - fn.call(suite); - suites.shift(); - return suite; - }; + context.suite = function(title, fn) { + const suite = Suite.create(suites[0], title); + suites.unshift(suite); + fn.call(suite); + suites.shift(); + return suite; + }; - /** + /** * Pending suite. */ - context.suite.skip = function(title, fn) { - var suite = Suite.create(suites[0], title); - suite.pending = true; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - }; - - /** + context.suite.skip = function(title, fn) { + const suite = Suite.create(suites[0], title); + suite.pending = true; + suites.unshift(suite); + fn.call(suite); + suites.shift(); + }; + + /** * Exclusive test-case. */ - context.suite.only = function(title, fn){ - var suite = context.suite(title, fn); - mocha.grep(suite.fullTitle()); - }; + context.suite.only = function(title, fn) { + const suite = context.suite(title, fn); + mocha.grep(suite.fullTitle()); + }; - /** + /** * 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.pending) var fn = null; - var test = new Test(title, fn); - suite.addTest(test); - return test; - }; + context.test = function(title, fn) { + const suite = suites[0]; + if (suite.pending) var fn = null; + const test = new Test(title, fn); + suite.addTest(test); + return test; + }; - /** + /** * Exclusive test-case. */ - context.test.only = function(title, fn){ - var test = context.test(title, fn); - var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - }; + context.test.only = function(title, fn) { + const test = context.test(title, fn); + const reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$'; + mocha.grep(new RegExp(reString)); + }; - /** + /** * Pending test case. */ - context.test.skip = function(title){ - context.test(title); + context.test.skip = function(title) { + context.test(title); + }; + }); }; - }); -}; + }); // module: interfaces/tdd.js -}); // module: interfaces/tdd.js - -require.register("mocha.js", function(module, exports, require){ -/*! + require.register('mocha.js', function(module, exports, require) { + /* ! * mocha * Copyright(c) 2011 TJ Holowaychuk * MIT Licensed */ -/** + /** * Module dependencies. */ -var path = require('browser/path') - , utils = require('./utils'); + const path = require('browser/path') + ; const utils = require('./utils'); -/** + /** * Expose `Mocha`. */ -exports = module.exports = Mocha; + exports = module.exports = Mocha; -/** + /** * Expose internals. */ -exports.utils = utils; -exports.interfaces = require('./interfaces'); -exports.reporters = require('./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'); + exports.utils = utils; + exports.interfaces = require('./interfaces'); + exports.reporters = require('./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. * * @param {String} name @@ -1403,11 +1392,11 @@ exports.Test = require('./test'); * @api private */ -function image(name) { - return __dirname + '/../images/' + name + '.png'; -} + function image(name) { + return __dirname + '/../images/' + name + '.png'; + } -/** + /** * Setup mocha with `options`. * * Options: @@ -1425,145 +1414,156 @@ function image(name) { * @api public */ -function Mocha(options) { - options = options || {}; - this.files = []; - this.options = options; - this.grep(options.grep); - this.suite = new exports.Suite('', new exports.Context); - this.ui(options.ui); - this.bail(options.bail); - this.reporter(options.reporter); - if (null != options.timeout) this.timeout(options.timeout); - this.useColors(options.useColors) - if (options.slow) this.slow(options.slow); - - 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; - }); -} - -/** + function Mocha(options) { + options = options || {}; + this.files = []; + this.options = options; + this.grep(options.grep); + this.suite = new exports.Suite('', new exports.Context); + this.ui(options.ui); + this.bail(options.bail); + this.reporter(options.reporter); + if (null != options.timeout) this.timeout(options.timeout); + this.useColors(options.useColors); + if (options.slow) this.slow(options.slow); + + 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; + }); + } + + /** * Enable or disable bailing on the first failure. * * @param {Boolean} [bail] * @api public */ -Mocha.prototype.bail = function(bail){ - if (0 == arguments.length) bail = true; - this.suite.bail(bail); - return this; -}; + Mocha.prototype.bail = function(bail) { + if (0 == arguments.length) bail = true; + this.suite.bail(bail); + return this; + }; -/** + /** * Add test `file`. * * @param {String} file * @api public */ -Mocha.prototype.addFile = function(file){ - this.files.push(file); - return this; -}; + Mocha.prototype.addFile = function(file) { + this.files.push(file); + return this; + }; -/** + /** * Set reporter to `reporter`, defaults to "dot". * * @param {String|Function} reporter name or constructor * @api public */ -Mocha.prototype.reporter = function(reporter){ - if ('function' == typeof reporter) { - this._reporter = reporter; - } else { - reporter = reporter || 'dot'; - var _reporter; - try { _reporter = require('./reporters/' + reporter); } catch (err) {}; - if (!_reporter) try { _reporter = require(reporter); } catch (err) {}; - if (!_reporter && reporter === 'teamcity') - console.warn('The Teamcity reporter was moved to a package named ' + + Mocha.prototype.reporter = function(reporter) { + if ('function' == typeof reporter) { + this._reporter = reporter; + } else { + reporter = reporter || 'dot'; + let _reporter; + try { + _reporter = require('./reporters/' + reporter); + } catch (err) {}; + if (!_reporter) { + try { + _reporter = require(reporter); + } catch (err) {} + }; + 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; - } - return this; -}; + } + if (!_reporter) throw new Error('invalid reporter "' + reporter + '"'); + this._reporter = _reporter; + } + return this; + }; -/** + /** * Set test UI `name`, defaults to "bdd". * * @param {String} bdd * @api public */ -Mocha.prototype.ui = function(name){ - name = name || 'bdd'; - this._ui = exports.interfaces[name]; - if (!this._ui) try { this._ui = require(name); } catch (err) {}; - if (!this._ui) throw new Error('invalid interface "' + name + '"'); - this._ui = this._ui(this.suite); - return this; -}; + Mocha.prototype.ui = function(name) { + name = name || 'bdd'; + this._ui = exports.interfaces[name]; + if (!this._ui) { + try { + this._ui = require(name); + } catch (err) {} + }; + if (!this._ui) throw new Error('invalid interface "' + name + '"'); + this._ui = this._ui(this.suite); + return this; + }; -/** + /** * Load registered files. * * @api private */ -Mocha.prototype.loadFiles = function(fn){ - var self = this; - var suite = this.suite; - var pending = this.files.length; - 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); - --pending || (fn && fn()); - }); -}; - -/** + Mocha.prototype.loadFiles = function(fn) { + const self = this; + const suite = this.suite; + let pending = this.files.length; + 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); + --pending || (fn && fn()); + }); + }; + + /** * Enable growl support. * * @api private */ -Mocha.prototype._growl = function(runner, reporter) { - var notify = require('growl'); + Mocha.prototype._growl = function(runner, reporter) { + const 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') + runner.on('end', function() { + const stats = reporter.stats; + if (stats.failures) { + const 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'), + }); + } }); - } - }); -}; + }; -/** + /** * Add regexp to grep, if `re` is a string it is escaped. * * @param {RegExp|String} re @@ -1571,26 +1571,26 @@ Mocha.prototype._growl = function(runner, reporter) { * @api public */ -Mocha.prototype.grep = function(re){ - this.options.grep = 'string' == typeof re - ? new RegExp(utils.escapeRegexp(re)) - : re; - return this; -}; + Mocha.prototype.grep = function(re) { + this.options.grep = 'string' == typeof re ? + new RegExp(utils.escapeRegexp(re)) : + re; + return this; + }; -/** + /** * Invert `.grep()` matches. * * @return {Mocha} * @api public */ -Mocha.prototype.invert = function(){ - this.options.invert = true; - return this; -}; + Mocha.prototype.invert = function() { + this.options.invert = true; + return this; + }; -/** + /** * Ignore global leaks. * * @param {Boolean} ignore @@ -1598,36 +1598,36 @@ Mocha.prototype.invert = function(){ * @api public */ -Mocha.prototype.ignoreLeaks = function(ignore){ - this.options.ignoreLeaks = !!ignore; - return this; -}; + Mocha.prototype.ignoreLeaks = function(ignore) { + this.options.ignoreLeaks = !!ignore; + return this; + }; -/** + /** * Enable global leak checking. * * @return {Mocha} * @api public */ -Mocha.prototype.checkLeaks = function(){ - this.options.ignoreLeaks = false; - return this; -}; + Mocha.prototype.checkLeaks = function() { + this.options.ignoreLeaks = false; + return this; + }; -/** + /** * Enable growl support. * * @return {Mocha} * @api public */ -Mocha.prototype.growl = function(){ - this.options.growl = true; - return this; -}; + Mocha.prototype.growl = function() { + this.options.growl = true; + return this; + }; -/** + /** * Ignore `globals` array or string. * * @param {Array|String} globals @@ -1635,12 +1635,12 @@ Mocha.prototype.growl = function(){ * @api public */ -Mocha.prototype.globals = function(globals){ - this.options.globals = (this.options.globals || []).concat(globals); - return this; -}; + Mocha.prototype.globals = function(globals) { + this.options.globals = (this.options.globals || []).concat(globals); + return this; + }; -/** + /** * Emit color output. * * @param {Boolean} colors @@ -1648,14 +1648,14 @@ Mocha.prototype.globals = function(globals){ * @api public */ -Mocha.prototype.useColors = function(colors){ - this.options.useColors = arguments.length && colors != undefined - ? colors - : true; - return this; -}; + Mocha.prototype.useColors = function(colors) { + this.options.useColors = arguments.length && colors != undefined ? + colors : + true; + return this; + }; -/** + /** * Use inline diffs rather than +/-. * * @param {Boolean} inlineDiffs @@ -1663,14 +1663,14 @@ Mocha.prototype.useColors = function(colors){ * @api public */ -Mocha.prototype.useInlineDiffs = function(inlineDiffs) { - this.options.useInlineDiffs = arguments.length && inlineDiffs != undefined - ? inlineDiffs - : false; - return this; -}; + Mocha.prototype.useInlineDiffs = function(inlineDiffs) { + this.options.useInlineDiffs = arguments.length && inlineDiffs != undefined ? + inlineDiffs : + false; + return this; + }; -/** + /** * Set the timeout in milliseconds. * * @param {Number} timeout @@ -1678,12 +1678,12 @@ Mocha.prototype.useInlineDiffs = function(inlineDiffs) { * @api public */ -Mocha.prototype.timeout = function(timeout){ - this.suite.timeout(timeout); - return this; -}; + Mocha.prototype.timeout = function(timeout) { + this.suite.timeout(timeout); + return this; + }; -/** + /** * Set slowness threshold in milliseconds. * * @param {Number} slow @@ -1691,24 +1691,24 @@ Mocha.prototype.timeout = function(timeout){ * @api public */ -Mocha.prototype.slow = function(slow){ - this.suite.slow(slow); - return this; -}; + Mocha.prototype.slow = function(slow) { + this.suite.slow(slow); + return this; + }; -/** + /** * Makes all tests async (accepting a callback) * * @return {Mocha} * @api public */ -Mocha.prototype.asyncOnly = function(){ - this.options.asyncOnly = true; - return this; -}; + Mocha.prototype.asyncOnly = function() { + this.options.asyncOnly = true; + return this; + }; -/** + /** * Run tests and invoke `fn()` when complete. * * @param {Function} fn @@ -1716,36 +1716,35 @@ Mocha.prototype.asyncOnly = function(){ * @api public */ -Mocha.prototype.run = function(fn){ - if (this.files.length) this.loadFiles(); - var suite = this.suite; - var options = this.options; - var runner = new exports.Runner(suite); - var reporter = new this._reporter(runner); - runner.ignoreLeaks = false !== options.ignoreLeaks; - runner.asyncOnly = options.asyncOnly; - if (options.grep) runner.grep(options.grep, options.invert); - if (options.globals) runner.globals(options.globals); - if (options.growl) this._growl(runner, reporter); - exports.reporters.Base.useColors = options.useColors; - exports.reporters.Base.inlineDiffs = options.useInlineDiffs; - return runner.run(fn); -}; - -}); // module: mocha.js - -require.register("ms.js", function(module, exports, require){ -/** + Mocha.prototype.run = function(fn) { + if (this.files.length) this.loadFiles(); + const suite = this.suite; + const options = this.options; + const runner = new exports.Runner(suite); + const reporter = new this._reporter(runner); + runner.ignoreLeaks = false !== options.ignoreLeaks; + runner.asyncOnly = options.asyncOnly; + if (options.grep) runner.grep(options.grep, options.invert); + if (options.globals) runner.globals(options.globals); + if (options.growl) this._growl(runner, reporter); + exports.reporters.Base.useColors = options.useColors; + exports.reporters.Base.inlineDiffs = options.useInlineDiffs; + return runner.run(fn); + }; + }); // module: mocha.js + + require.register('ms.js', function(module, exports, require) { + /** * Helpers. */ -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; + const s = 1000; + const m = s * 60; + const h = m * 60; + const d = h * 24; + const y = d * 365.25; -/** + /** * Parse or format the given `val`. * * Options: @@ -1758,13 +1757,13 @@ var y = d * 365.25; * @api public */ -module.exports = function(val, options){ - options = options || {}; - if ('string' == typeof val) return parse(val); - return options.long ? longFormat(val) : shortFormat(val); -}; + module.exports = function(val, options) { + options = options || {}; + if ('string' == typeof val) return parse(val); + return options.long ? longFormat(val) : shortFormat(val); + }; -/** + /** * Parse the given `str` and return milliseconds. * * @param {String} str @@ -1772,38 +1771,38 @@ module.exports = function(val, options){ * @api private */ -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; - } -} + function parse(str) { + const match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str); + if (!match) return; + const n = parseFloat(match[1]); + const 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; + } + } -/** + /** * Short format for `ms`. * * @param {Number} ms @@ -1811,15 +1810,15 @@ function parse(str) { * @api private */ -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'; -} + 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`. * * @param {Number} ms @@ -1827,115 +1826,113 @@ function shortFormat(ms) { * @api private */ -function longFormat(ms) { - return plural(ms, d, 'day') - || plural(ms, h, 'hour') - || plural(ms, m, 'minute') - || plural(ms, s, 'second') - || ms + ' ms'; -} + function longFormat(ms) { + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; + } -/** + /** * Pluralization helper. */ -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'; -} - -}); // module: ms.js - -require.register("reporters/base.js", function(module, exports, require){ + 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'; + } + }); // module: ms.js -/** + require.register('reporters/base.js', function(module, exports, require) { + /** * Module dependencies. */ -var tty = require('browser/tty') - , diff = require('browser/diff') - , ms = require('../ms') - , utils = require('../utils'); + const tty = require('browser/tty') + ; const diff = require('browser/diff') + ; const ms = require('../ms') + ; const utils = require('../utils'); -/** + /** * Save timer references to avoid Sinon interfering (see GH-237). */ -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; + const Date = global.Date + ; const setTimeout = global.setTimeout + ; const setInterval = global.setInterval + ; const clearTimeout = global.clearTimeout + ; const clearInterval = global.clearInterval; -/** + /** * Check if both stdio streams are associated with a tty. */ -var isatty = tty.isatty(1) && tty.isatty(2); + const isatty = tty.isatty(1) && tty.isatty(2); -/** + /** * Expose `Base`. */ -exports = module.exports = Base; + exports = module.exports = Base; -/** + /** * Enable coloring by default. */ -exports.useColors = isatty || (process.env.MOCHA_COLORS !== undefined); + exports.useColors = isatty || (process.env.MOCHA_COLORS !== undefined); -/** + /** * Inline diffs instead of +/- */ -exports.inlineDiffs = false; + 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': 42 - , 'diff removed': 41 -}; - -/** + 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': 42, + 'diff removed': 41, + }; + + /** * Default symbol map. */ -exports.symbols = { - ok: '✓', - err: '✖', - dot: '․' -}; + exports.symbols = { + ok: '✓', + err: '✖', + dot: '․', + }; -// With node.js on Windows: use symbols available in terminal default fonts -if ('win32' == process.platform) { - exports.symbols.ok = '\u221A'; - exports.symbols.err = '\u00D7'; - exports.symbols.dot = '.'; -} + // With node.js on Windows: use symbols available in terminal default fonts + if ('win32' == process.platform) { + 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 @@ -1947,115 +1944,115 @@ if ('win32' == process.platform) { * @api private */ -var color = exports.color = function(type, str) { - if (!exports.useColors) return str; - return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m'; -}; + const color = exports.color = function(type, str) { + if (!exports.useColors) return 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: isatty - ? process.stdout.getWindowSize - ? process.stdout.getWindowSize(1)[0] - : tty.getWindowSize()[1] - : 75 -}; + exports.window = { + width: isatty ? + process.stdout.getWindowSize ? + process.stdout.getWindowSize(1)[0] : + tty.getWindowSize()[1] : + 75, + }; -/** + /** * Expose some basic cursor interactions * that are common among reporters. */ -exports.cursor = { - hide: function(){ - isatty && process.stdout.write('\u001b[?25l'); - }, + exports.cursor = { + hide: function() { + isatty && process.stdout.write('\u001b[?25l'); + }, - show: function(){ - isatty && process.stdout.write('\u001b[?25h'); - }, + show: function() { + isatty && process.stdout.write('\u001b[?25h'); + }, - deleteLine: function(){ - isatty && process.stdout.write('\u001b[2K'); - }, + deleteLine: function() { + isatty && process.stdout.write('\u001b[2K'); + }, - beginningOfLine: function(){ - isatty && process.stdout.write('\u001b[0G'); - }, + beginningOfLine: function() { + isatty && process.stdout.write('\u001b[0G'); + }, - CR: function(){ - if (isatty) { - exports.cursor.deleteLine(); - exports.cursor.beginningOfLine(); - } else { - process.stdout.write('\r'); - } - } -}; + 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.error(); - 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 err = test.err - , message = err.message || '' - , stack = err.stack || message - , index = stack.indexOf(message) + message.length - , msg = stack.slice(0, index) - , actual = err.actual - , expected = err.expected - , escape = true; - - // uncaught - if (err.uncaught) { - msg = 'Uncaught ' + msg; - } + exports.list = function(failures) { + console.error(); + failures.forEach(function(test, i) { + // format + let fmt = color('error title', ' %s) %s:\n') + + color('error message', ' %s') + + color('error stack', '\n%s\n'); + + // msg + const err = test.err + ; const message = err.message || '' + ; let stack = err.stack || message + ; const index = stack.indexOf(message) + message.length + ; let msg = stack.slice(0, index) + ; let actual = err.actual + ; let expected = err.expected + ; let escape = true; + + // uncaught + if (err.uncaught) { + msg = 'Uncaught ' + msg; + } - // explicitly show diff - if (err.showDiff && sameType(actual, expected)) { - escape = false; - err.actual = actual = stringify(canonicalize(actual)); - err.expected = expected = stringify(canonicalize(expected)); - } + // explicitly show diff + if (err.showDiff && sameType(actual, expected)) { + escape = false; + err.actual = actual = stringify(canonicalize(actual)); + err.expected = expected = stringify(canonicalize(expected)); + } - // actual / expected diff - if ('string' == typeof actual && 'string' == typeof expected) { - fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n'); - var match = message.match(/^([^:]+): expected/); - msg = match ? '\n ' + color('error message', match[1]) : ''; + // actual / expected diff + if ('string' == typeof actual && 'string' == typeof expected) { + fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n'); + const match = message.match(/^([^:]+): expected/); + msg = match ? '\n ' + color('error message', match[1]) : ''; - if (exports.inlineDiffs) { - msg += inlineDiff(err, escape); - } else { - msg += unifiedDiff(err, escape); - } - } + if (exports.inlineDiffs) { + msg += inlineDiff(err, escape); + } else { + msg += unifiedDiff(err, escape); + } + } - // indent stack trace without msg - stack = stack.slice(index ? index + 1 : index) - .replace(/^/gm, ' '); + // indent stack trace without msg + stack = stack.slice(index ? index + 1 : index) + .replace(/^/gm, ' '); - console.error(fmt, (i + 1), test.fullTitle(), msg, stack); - }); -}; + console.error(fmt, (i + 1), test.fullTitle(), msg, stack); + }); + }; -/** + /** * Initialize a new `Base` reporter. * * All other reporters generally @@ -2067,106 +2064,106 @@ exports.list = function(failures){ * @api public */ -function Base(runner) { - var self = this - , stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 } - , failures = this.failures = []; + function Base(runner) { + const self = this + ; const stats = this.stats = {suites: 0, tests: 0, passes: 0, pending: 0, failures: 0} + ; const failures = this.failures = []; - if (!runner) return; - this.runner = runner; + if (!runner) return; + this.runner = runner; - runner.stats = stats; + runner.stats = stats; - runner.on('start', function(){ - stats.start = new Date; - }); + runner.on('start', function() { + stats.start = new Date; + }); - runner.on('suite', function(suite){ - stats.suites = stats.suites || 0; - suite.root || stats.suites++; - }); + runner.on('suite', function(suite) { + stats.suites = stats.suites || 0; + suite.root || stats.suites++; + }); - runner.on('test end', function(test){ - stats.tests = stats.tests || 0; - stats.tests++; - }); + runner.on('test end', function(test) { + stats.tests = stats.tests || 0; + stats.tests++; + }); - runner.on('pass', function(test){ - stats.passes = stats.passes || 0; + runner.on('pass', function(test) { + stats.passes = stats.passes || 0; - var medium = test.slow() / 2; - test.speed = test.duration > test.slow() - ? 'slow' - : test.duration > medium - ? 'medium' - : 'fast'; + const medium = test.slow() / 2; + test.speed = test.duration > test.slow() ? + 'slow' : + test.duration > medium ? + 'medium' : + 'fast'; - stats.passes++; - }); + stats.passes++; + }); - runner.on('fail', function(test, err){ - stats.failures = stats.failures || 0; - stats.failures++; - test.err = err; - failures.push(test); - }); + 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('end', function() { + stats.end = new Date; + stats.duration = new Date - stats.start; + }); - runner.on('pending', function(){ - stats.pending++; - }); -} + 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 tests; - var fmt; + Base.prototype.epilogue = function() { + const stats = this.stats; + let tests; + let fmt; - console.log(); + console.log(); - // passes - fmt = color('bright pass', ' ') - + color('green', ' %d passing') - + color('light', ' (%s)'); + // passes + fmt = color('bright pass', ' ') + + color('green', ' %d passing') + + color('light', ' (%s)'); - console.log(fmt, - stats.passes || 0, - ms(stats.duration)); + console.log(fmt, + stats.passes || 0, + ms(stats.duration)); - // pending - if (stats.pending) { - fmt = color('pending', ' ') - + color('pending', ' %d pending'); + // pending + if (stats.pending) { + fmt = color('pending', ' ') + + color('pending', ' %d pending'); - console.log(fmt, stats.pending); - } + console.log(fmt, stats.pending); + } - // failures - if (stats.failures) { - fmt = color('fail', ' %d failing'); + // failures + if (stats.failures) { + fmt = color('fail', ' %d failing'); - console.error(fmt, - stats.failures); + console.error(fmt, + stats.failures); - Base.list(this.failures); - console.error(); - } + Base.list(this.failures); + console.error(); + } - console.log(); -}; + console.log(); + }; -/** + /** * Pad the given `str` to `len`. * * @param {String} str @@ -2175,13 +2172,13 @@ Base.prototype.epilogue = function(){ * @api private */ -function pad(str, len) { - str = String(str); - return Array(len - str.length + 1).join(' ') + str; -} + 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 * * @param {Error} Error with actual/expected @@ -2189,33 +2186,33 @@ function pad(str, len) { * @api private */ -function inlineDiff(err, escape) { - var msg = errorDiff(err, 'WordsWithSpace', escape); + function inlineDiff(err, escape) { + let 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'); - } + // linenos + const lines = msg.split('\n'); + if (lines.length > 4) { + const 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; + } - // 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 2 strings * * @param {Error} Error with actual/expected @@ -2223,31 +2220,31 @@ function inlineDiff(err, escape) { * @api private */ -function unifiedDiff(err, escape) { - var indent = ' '; - function cleanUp(line) { - if (escape) { - line = escapeInvisibles(line); + function unifiedDiff(err, escape) { + const 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; + else return indent + line; + } + function notBlank(line) { + return line != null; + } + msg = diff.createPatch('string', err.actual, err.expected); + const 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'); } - 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; - else return indent + line; - } - function notBlank(line) { - return line != null; - } - 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`. * * @param {Error} err @@ -2255,30 +2252,30 @@ function unifiedDiff(err, escape) { * @api private */ -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(''); -} + function errorDiff(err, type, escape) { + const actual = escape ? escapeInvisibles(err.actual) : err.actual; + const 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 * * @param {String} line * @return {String} * @api private */ -function escapeInvisibles(line) { - return line.replace(/\t/g, '') - .replace(/\r/g, '') - .replace(/\n/g, '\n'); -} + function escapeInvisibles(line) { + return line.replace(/\t/g, '') + .replace(/\r/g, '') + .replace(/\n/g, '\n'); + } -/** + /** * Color lines for `str`, using the color `name`. * * @param {String} name @@ -2287,13 +2284,13 @@ function escapeInvisibles(line) { * @api private */ -function colorLines(name, str) { - return str.split('\n').map(function(str){ - return color(name, str); - }).join('\n'); -} + function colorLines(name, str) { + return str.split('\n').map(function(str) { + return color(name, str); + }).join('\n'); + } -/** + /** * Stringify `obj`. * * @param {Object} obj @@ -2301,46 +2298,46 @@ function colorLines(name, str) { * @api private */ -function stringify(obj) { - if (obj instanceof RegExp) return obj.toString(); - return JSON.stringify(obj, null, 2); -} + function stringify(obj) { + if (obj instanceof RegExp) return obj.toString(); + return JSON.stringify(obj, null, 2); + } -/** + /** * Return a new object that has the keys in sorted order. * @param {Object} obj * @return {Object} * @api private */ - function canonicalize(obj, stack) { - stack = stack || []; + function canonicalize(obj, stack) { + stack = stack || []; - if (utils.indexOf(stack, obj) !== -1) return obj; + if (utils.indexOf(stack, obj) !== -1) return obj; - var canonicalizedObj; + let canonicalizedObj; - if ('[object Array]' == {}.toString.call(obj)) { - stack.push(obj); - canonicalizedObj = utils.map(obj, function(item) { - return canonicalize(item, stack); - }); - stack.pop(); - } else if (typeof obj === 'object' && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - utils.forEach(utils.keys(obj).sort(), function(key) { - canonicalizedObj[key] = canonicalize(obj[key], stack); - }); - stack.pop(); - } else { - canonicalizedObj = obj; - } + if ('[object Array]' == {}.toString.call(obj)) { + stack.push(obj); + canonicalizedObj = utils.map(obj, function(item) { + return canonicalize(item, stack); + }); + stack.pop(); + } else if (typeof obj === 'object' && obj !== null) { + stack.push(obj); + canonicalizedObj = {}; + utils.forEach(utils.keys(obj).sort(), function(key) { + canonicalizedObj[key] = canonicalize(obj[key], stack); + }); + stack.pop(); + } else { + canonicalizedObj = obj; + } - return canonicalizedObj; - } + return canonicalizedObj; + } -/** + /** * Check that a / b have the same type. * * @param {Object} a @@ -2349,513 +2346,501 @@ function stringify(obj) { * @api private */ -function sameType(a, b) { - a = Object.prototype.toString.call(a); - b = Object.prototype.toString.call(b); - return a == b; -} - - -}); // module: reporters/base.js - -require.register("reporters/doc.js", function(module, exports, require){ + function sameType(a, b) { + a = Object.prototype.toString.call(a); + b = Object.prototype.toString.call(b); + return a == b; + } + }); // module: reporters/base.js -/** + require.register('reporters/doc.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , utils = require('../utils'); + const Base = require('./base') + ; const utils = require('../utils'); -/** + /** * Expose `Doc`. */ -exports = module.exports = Doc; + exports = module.exports = Doc; -/** + /** * Initialize a new `Doc` reporter. * * @param {Runner} runner * @api public */ -function Doc(runner) { - Base.call(this, runner); + function Doc(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , total = runner.total - , indents = 2; + const self = this + ; const stats = this.stats + ; const total = runner.total + ; let indents = 2; - function indent() { - return Array(indents).join(' '); - } + function indent() { + return Array(indents).join(' '); + } + + runner.on('suite', function(suite) { + if (suite.root) return; + ++indents; + console.log('%s
                ', indent()); + ++indents; + console.log('%s

                %s

                ', indent(), utils.escape(suite.title)); + console.log('%s
                ', indent()); + }); + + runner.on('suite end', function(suite) { + if (suite.root) return; + console.log('%s
                ', indent()); + --indents; + console.log('%s
                ', indent()); + --indents; + }); + + runner.on('pass', function(test) { + console.log('%s
                %s
                ', indent(), utils.escape(test.title)); + const code = utils.escape(utils.clean(test.fn.toString())); + console.log('%s
                %s
                ', indent(), code); + }); + } + }); // module: reporters/doc.js - runner.on('suite', function(suite){ - if (suite.root) return; - ++indents; - console.log('%s
                ', indent()); - ++indents; - console.log('%s

                %s

                ', indent(), utils.escape(suite.title)); - console.log('%s
                ', indent()); - }); - - runner.on('suite end', function(suite){ - if (suite.root) return; - console.log('%s
                ', indent()); - --indents; - console.log('%s
                ', indent()); - --indents; - }); - - runner.on('pass', function(test){ - console.log('%s
                %s
                ', indent(), utils.escape(test.title)); - var code = utils.escape(utils.clean(test.fn.toString())); - console.log('%s
                %s
                ', indent(), code); - }); -} - -}); // module: reporters/doc.js - -require.register("reporters/dot.js", function(module, exports, require){ - -/** + require.register('reporters/dot.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , color = Base.color; + const Base = require('./base') + ; const color = Base.color; -/** + /** * Expose `Dot`. */ -exports = module.exports = Dot; + exports = module.exports = Dot; -/** + /** * Initialize a new `Dot` matrix test reporter. * * @param {Runner} runner * @api public */ -function Dot(runner) { - Base.call(this, runner); + function Dot(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , n = 0; + const self = this + ; const stats = this.stats + ; const width = Base.window.width * .75 | 0 + ; let n = 0; - runner.on('start', function(){ - process.stdout.write('\n '); - }); + runner.on('start', function() { + process.stdout.write('\n '); + }); - runner.on('pending', function(test){ - process.stdout.write(color('pending', Base.symbols.dot)); - }); + runner.on('pending', function(test) { + process.stdout.write(color('pending', Base.symbols.dot)); + }); - runner.on('pass', function(test){ - if (++n % width == 0) process.stdout.write('\n '); - if ('slow' == test.speed) { - process.stdout.write(color('bright yellow', Base.symbols.dot)); - } else { - process.stdout.write(color(test.speed, Base.symbols.dot)); - } - }); + runner.on('pass', function(test) { + if (++n % width == 0) process.stdout.write('\n '); + if ('slow' == test.speed) { + process.stdout.write(color('bright yellow', Base.symbols.dot)); + } else { + process.stdout.write(color(test.speed, Base.symbols.dot)); + } + }); - runner.on('fail', function(test, err){ - if (++n % width == 0) process.stdout.write('\n '); - process.stdout.write(color('fail', Base.symbols.dot)); - }); + runner.on('fail', function(test, err) { + if (++n % width == 0) process.stdout.write('\n '); + process.stdout.write(color('fail', Base.symbols.dot)); + }); - runner.on('end', function(){ - console.log(); - self.epilogue(); - }); -} + runner.on('end', function() { + console.log(); + self.epilogue(); + }); + } -/** + /** * Inherit from `Base.prototype`. */ -function F(){}; -F.prototype = Base.prototype; -Dot.prototype = new F; -Dot.prototype.constructor = Dot; - -}); // module: reporters/dot.js + function F() {}; + F.prototype = Base.prototype; + Dot.prototype = new F; + Dot.prototype.constructor = Dot; + }); // module: reporters/dot.js -require.register("reporters/html-cov.js", function(module, exports, require){ - -/** + require.register('reporters/html-cov.js', function(module, exports, require) { + /** * Module dependencies. */ -var JSONCov = require('./json-cov') - , fs = require('browser/fs'); + const JSONCov = require('./json-cov') + ; const fs = require('browser/fs'); -/** + /** * Expose `HTMLCov`. */ -exports = module.exports = HTMLCov; + exports = module.exports = HTMLCov; -/** + /** * Initialize a new `JsCoverage` reporter. * * @param {Runner} runner * @api public */ -function HTMLCov(runner) { - var jade = require('jade') - , file = __dirname + '/templates/coverage.jade' - , str = fs.readFileSync(file, 'utf8') - , fn = jade.compile(str, { filename: file }) - , self = this; + function HTMLCov(runner) { + const jade = require('jade') + ; const file = __dirname + '/templates/coverage.jade' + ; const str = fs.readFileSync(file, 'utf8') + ; const fn = jade.compile(str, {filename: file}) + ; const self = this; - JSONCov.call(this, runner, false); + JSONCov.call(this, runner, false); - runner.on('end', function(){ - process.stdout.write(fn({ - cov: self.cov - , coverageClass: coverageClass - })); - }); -} + runner.on('end', function() { + process.stdout.write(fn({ + cov: self.cov, + coverageClass: coverageClass, + })); + }); + } -/** + /** * Return coverage class for `n`. * * @return {String} * @api private */ -function coverageClass(n) { - if (n >= 75) return 'high'; - if (n >= 50) return 'medium'; - if (n >= 25) return 'low'; - return 'terrible'; -} -}); // module: reporters/html-cov.js - -require.register("reporters/html.js", function(module, exports, require){ + function coverageClass(n) { + if (n >= 75) return 'high'; + if (n >= 50) return 'medium'; + if (n >= 25) return 'low'; + return 'terrible'; + } + }); // module: reporters/html-cov.js -/** + require.register('reporters/html.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , utils = require('../utils') - , Progress = require('../browser/progress') - , escape = utils.escape; + const Base = require('./base') + ; const utils = require('../utils') + ; const Progress = require('../browser/progress') + ; const escape = utils.escape; -/** + /** * Save timer references to avoid Sinon interfering (see GH-237). */ -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; + const Date = global.Date + ; const setTimeout = global.setTimeout + ; const setInterval = global.setInterval + ; const clearTimeout = global.clearTimeout + ; const clearInterval = global.clearInterval; -/** + /** * Expose `HTML`. */ -exports = module.exports = HTML; + exports = module.exports = HTML; -/** + /** * Stats template. */ -var statsTemplate = ''; + const statsTemplate = ''; -/** + /** * Initialize a new `HTML` reporter. * * @param {Runner} runner * @api public */ -function HTML(runner, root) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , total = runner.total - , stat = fragment(statsTemplate) - , items = stat.getElementsByTagName('li') - , passes = items[1].getElementsByTagName('em')[0] - , passesLink = items[1].getElementsByTagName('a')[0] - , failures = items[2].getElementsByTagName('em')[0] - , failuresLink = items[2].getElementsByTagName('a')[0] - , duration = items[3].getElementsByTagName('em')[0] - , canvas = stat.getElementsByTagName('canvas')[0] - , report = fragment('
                  ') - , stack = [report] - , progress - , ctx - - root = 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; - } + function HTML(runner, root) { + Base.call(this, runner); + + const self = this + ; const stats = this.stats + ; const total = runner.total + ; const stat = fragment(statsTemplate) + ; const items = stat.getElementsByTagName('li') + ; const passes = items[1].getElementsByTagName('em')[0] + ; const passesLink = items[1].getElementsByTagName('a')[0] + ; const failures = items[2].getElementsByTagName('em')[0] + ; const failuresLink = items[2].getElementsByTagName('a')[0] + ; const duration = items[3].getElementsByTagName('em')[0] + ; const canvas = stat.getElementsByTagName('canvas')[0] + ; const report = fragment('
                    ') + ; const stack = [report] + ; let progress + ; let ctx; + + root = root || document.getElementById('mocha'); + + if (canvas.getContext) { + const 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(){ - 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(){ - 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('
                  • %s

                  • ', 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) return; - stack.shift(); - }); - - runner.on('fail', function(test, err){ - if ('hook' == test.type) runner.emit('test end', test); - }); - - runner.on('test end', function(test){ - // TODO: add to stats - var percent = stats.tests / this.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)); - - // test - if ('passed' == test.state) { - var url = self.testURL(test); - var el = fragment('
                  • %e%ems

                  • ', test.speed, test.title, test.duration, url); - } else if (test.pending) { - var el = fragment('
                  • %e

                  • ', test.title); - } else { - var el = fragment('
                  • %e

                  • ', test.title, encodeURIComponent(test.fullTitle())); - var str = test.err.stack || test.err.toString(); + if (!root) return error('#mocha div missing, add it to your document'); - // FF / Opera do not add the message - if (!~str.indexOf(test.err.message)) { - str = test.err.message + '\n' + str; - } + // pass toggle + on(passesLink, 'click', function() { + unhide(); + const 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() { + unhide(); + const name = /fail/.test(report.className) ? '' : ' fail'; + report.className = report.className.replace(/fail|pass/g, '') + name; + if (report.className.trim()) hideSuitesWithout('test fail'); + }); - // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we - // check for the result of the stringifying. - if ('[object Error]' == str) str = test.err.message; + root.appendChild(stat); + root.appendChild(report); - // Safari doesn't give you a stack. Let's at least provide a source line. - if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) { - str += "\n(" + test.err.sourceURL + ":" + test.err.line + ")"; - } + if (progress) progress.size(40); - el.appendChild(fragment('
                    %e
                    ', str)); - } + runner.on('suite', function(suite) { + if (suite.root) return; - // toggle code - // TODO: defer - if (!test.pending) { - var h2 = el.getElementsByTagName('h2')[0]; + // suite + const url = self.suiteURL(suite); + const el = fragment('
                  • %s

                  • ', url, escape(suite.title)); - on(h2, 'click', function(){ - pre.style.display = 'none' == pre.style.display - ? 'block' - : 'none'; + // container + stack[0].appendChild(el); + stack.unshift(document.createElement('ul')); + el.appendChild(stack[0]); }); - var pre = fragment('
                    %e
                    ', utils.clean(test.fn.toString())); - el.appendChild(pre); - pre.style.display = 'none'; - } + runner.on('suite end', function(suite) { + if (suite.root) return; + stack.shift(); + }); + + runner.on('fail', function(test, err) { + if ('hook' == test.type) runner.emit('test end', test); + }); + + runner.on('test end', function(test) { + // TODO: add to stats + const percent = stats.tests / this.total * 100 | 0; + if (progress) progress.update(percent).draw(ctx); + + // update stats + const ms = new Date - stats.start; + text(passes, stats.passes); + text(failures, stats.failures); + text(duration, (ms / 1000).toFixed(2)); + + // test + if ('passed' == test.state) { + const url = self.testURL(test); + var el = fragment('
                  • %e%ems

                  • ', test.speed, test.title, test.duration, url); + } else if (test.pending) { + var el = fragment('
                  • %e

                  • ', test.title); + } else { + var el = fragment('
                  • %e

                  • ', test.title, encodeURIComponent(test.fullTitle())); + let str = test.err.stack || test.err.toString(); + + // FF / Opera do not add the message + if (!~str.indexOf(test.err.message)) { + str = test.err.message + '\n' + str; + } + + // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we + // check for the result of the stringifying. + if ('[object Error]' == str) str = test.err.message; - // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack. - if (stack[0]) stack[0].appendChild(el); - }); -} + // Safari doesn't give you a stack. Let's at least provide a source line. + if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) { + str += '\n(' + test.err.sourceURL + ':' + test.err.line + ')'; + } + + el.appendChild(fragment('
                    %e
                    ', str)); + } + + // toggle code + // TODO: defer + if (!test.pending) { + const h2 = el.getElementsByTagName('h2')[0]; + + on(h2, 'click', function() { + pre.style.display = 'none' == pre.style.display ? + 'block' : + 'none'; + }); + + var pre = fragment('
                    %e
                    ', utils.clean(test.fn.toString())); + el.appendChild(pre); + pre.style.display = 'none'; + } -/** + // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack. + if (stack[0]) stack[0].appendChild(el); + }); + } + + /** * Provide suite URL * * @param {Object} [suite] */ -HTML.prototype.suiteURL = function(suite){ - return '?grep=' + encodeURIComponent(suite.fullTitle()); -}; + HTML.prototype.suiteURL = function(suite) { + return '?grep=' + encodeURIComponent(suite.fullTitle()); + }; -/** + /** * Provide test URL * * @param {Object} [test] */ -HTML.prototype.testURL = function(test){ - return '?grep=' + encodeURIComponent(test.fullTitle()); -}; + HTML.prototype.testURL = function(test) { + return '?grep=' + encodeURIComponent(test.fullTitle()); + }; -/** + /** * Display error `msg`. */ -function error(msg) { - document.body.appendChild(fragment('
                    %s
                    ', msg)); -} + function error(msg) { + document.body.appendChild(fragment('
                    %s
                    ', msg)); + } -/** + /** * Return a DOM fragment from `html`. */ -function fragment(html) { - var args = arguments - , div = document.createElement('div') - , i = 1; + function fragment(html) { + const args = arguments + ; const div = document.createElement('div') + ; let i = 1; - div.innerHTML = html.replace(/%([se])/g, function(_, type){ - switch (type) { - case 's': return String(args[i++]); - case 'e': return escape(args[i++]); - } - }); + div.innerHTML = html.replace(/%([se])/g, function(_, type) { + switch (type) { + case 's': return String(args[i++]); + case 'e': return escape(args[i++]); + } + }); - return div.firstChild; -} + return div.firstChild; + } -/** + /** * Check for suites that do not have elements * with `classname`, and hide them. */ -function hideSuitesWithout(classname) { - var suites = document.getElementsByClassName('suite'); - for (var i = 0; i < suites.length; i++) { - var els = suites[i].getElementsByClassName(classname); - if (0 == els.length) suites[i].className += ' hidden'; - } -} + function hideSuitesWithout(classname) { + const suites = document.getElementsByClassName('suite'); + for (let i = 0; i < suites.length; i++) { + const els = suites[i].getElementsByClassName(classname); + if (0 == 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'); - } -} + function unhide() { + const els = document.getElementsByClassName('suite hidden'); + for (let i = 0; i < els.length; ++i) { + els[i].className = els[i].className.replace('suite hidden', 'suite'); + } + } -/** + /** * Set `el` text to `str`. */ -function text(el, str) { - if (el.textContent) { - el.textContent = str; - } else { - el.innerText = str; - } -} + function text(el, str) { + if (el.textContent) { + el.textContent = str; + } else { + el.innerText = str; + } + } -/** + /** * 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); - } -} - -}); // module: reporters/html.js - -require.register("reporters/index.js", function(module, exports, require){ - -exports.Base = require('./base'); -exports.Dot = require('./dot'); -exports.Doc = require('./doc'); -exports.TAP = require('./tap'); -exports.JSON = require('./json'); -exports.HTML = require('./html'); -exports.List = require('./list'); -exports.Min = require('./min'); -exports.Spec = require('./spec'); -exports.Nyan = require('./nyan'); -exports.XUnit = require('./xunit'); -exports.Markdown = require('./markdown'); -exports.Progress = require('./progress'); -exports.Landing = require('./landing'); -exports.JSONCov = require('./json-cov'); -exports.HTMLCov = require('./html-cov'); -exports.JSONStream = require('./json-stream'); - -}); // module: reporters/index.js - -require.register("reporters/json-cov.js", function(module, exports, require){ - -/** + function on(el, event, fn) { + if (el.addEventListener) { + el.addEventListener(event, fn, false); + } else { + el.attachEvent('on' + event, fn); + } + } + }); // module: reporters/html.js + + require.register('reporters/index.js', function(module, exports, require) { + exports.Base = require('./base'); + exports.Dot = require('./dot'); + exports.Doc = require('./doc'); + exports.TAP = require('./tap'); + exports.JSON = require('./json'); + exports.HTML = require('./html'); + exports.List = require('./list'); + exports.Min = require('./min'); + exports.Spec = require('./spec'); + exports.Nyan = require('./nyan'); + exports.XUnit = require('./xunit'); + exports.Markdown = require('./markdown'); + exports.Progress = require('./progress'); + exports.Landing = require('./landing'); + exports.JSONCov = require('./json-cov'); + exports.HTMLCov = require('./html-cov'); + exports.JSONStream = require('./json-stream'); + }); // module: reporters/index.js + + require.register('reporters/json-cov.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base'); + const Base = require('./base'); -/** + /** * Expose `JSONCov`. */ -exports = module.exports = JSONCov; + exports = module.exports = JSONCov; -/** + /** * Initialize a new `JsCoverage` reporter. * * @param {Runner} runner @@ -2863,41 +2848,41 @@ exports = module.exports = JSONCov; * @api public */ -function JSONCov(runner, output) { - var self = this - , output = 1 == arguments.length ? true : output; + function JSONCov(runner, output) { + const self = this + ; var output = 1 == arguments.length ? true : output; - Base.call(this, runner); + Base.call(this, runner); - var tests = [] - , failures = [] - , passes = []; + const tests = [] + ; const failures = [] + ; const passes = []; - runner.on('test end', function(test){ - tests.push(test); - }); + runner.on('test end', function(test) { + tests.push(test); + }); - runner.on('pass', function(test){ - passes.push(test); - }); + runner.on('pass', function(test) { + passes.push(test); + }); - runner.on('fail', function(test){ - failures.push(test); - }); + runner.on('fail', function(test) { + failures.push(test); + }); - runner.on('end', function(){ - var cov = global._$jscoverage || {}; - var result = self.cov = map(cov); - result.stats = self.stats; - result.tests = tests.map(clean); - result.failures = failures.map(clean); - result.passes = passes.map(clean); - if (!output) return; - process.stdout.write(JSON.stringify(result, null, 2 )); - }); -} + runner.on('end', function() { + const cov = global._$jscoverage || {}; + const result = self.cov = map(cov); + result.stats = self.stats; + result.tests = tests.map(clean); + result.failures = failures.map(clean); + result.passes = passes.map(clean); + if (!output) return; + process.stdout.write(JSON.stringify(result, null, 2 )); + }); + } -/** + /** * Map jscoverage data to a JSON structure * suitable for reporting. * @@ -2906,36 +2891,36 @@ function JSONCov(runner, output) { * @api private */ -function map(cov) { - var ret = { - instrumentation: 'node-jscoverage' - , sloc: 0 - , hits: 0 - , misses: 0 - , coverage: 0 - , files: [] - }; - - for (var filename in cov) { - var data = coverage(filename, cov[filename]); - ret.files.push(data); - ret.hits += data.hits; - ret.misses += data.misses; - ret.sloc += data.sloc; - } + function map(cov) { + const ret = { + instrumentation: 'node-jscoverage', + sloc: 0, + hits: 0, + misses: 0, + coverage: 0, + files: [], + }; + + for (const filename in cov) { + const data = coverage(filename, cov[filename]); + ret.files.push(data); + ret.hits += data.hits; + ret.misses += data.misses; + ret.sloc += data.sloc; + } - ret.files.sort(function(a, b) { - return a.filename.localeCompare(b.filename); - }); + ret.files.sort(function(a, b) { + return a.filename.localeCompare(b.filename); + }); - if (ret.sloc > 0) { - ret.coverage = (ret.hits / ret.sloc) * 100; - } + if (ret.sloc > 0) { + ret.coverage = (ret.hits / ret.sloc) * 100; + } - return ret; -}; + return ret; + }; -/** + /** * Map jscoverage data for a single source file * to a JSON structure suitable for reporting. * @@ -2945,41 +2930,41 @@ function map(cov) { * @api private */ -function coverage(filename, data) { - var ret = { - filename: filename, - coverage: 0, - hits: 0, - misses: 0, - sloc: 0, - source: {} - }; - - data.source.forEach(function(line, num){ - num++; - - if (data[num] === 0) { - ret.misses++; - ret.sloc++; - } else if (data[num] !== undefined) { - ret.hits++; - ret.sloc++; - } + function coverage(filename, data) { + const ret = { + filename: filename, + coverage: 0, + hits: 0, + misses: 0, + sloc: 0, + source: {}, + }; + + data.source.forEach(function(line, num) { + num++; + + if (data[num] === 0) { + ret.misses++; + ret.sloc++; + } else if (data[num] !== undefined) { + ret.hits++; + ret.sloc++; + } - ret.source[num] = { - source: line - , coverage: data[num] === undefined - ? '' - : data[num] - }; - }); + ret.source[num] = { + source: line, + coverage: data[num] === undefined ? + '' : + data[num], + }; + }); - ret.coverage = ret.hits / ret.sloc * 100; + ret.coverage = ret.hits / ret.sloc * 100; - return ret; -} + return ret; + } -/** + /** * Return a plain-object representation of `test` * free of cyclic properties etc. * @@ -2988,63 +2973,61 @@ function coverage(filename, data) { * @api private */ -function clean(test) { - return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} - -}); // module: reporters/json-cov.js - -require.register("reporters/json-stream.js", function(module, exports, require){ + function clean(test) { + return { + title: test.title, + fullTitle: test.fullTitle(), + duration: test.duration, + }; + } + }); // module: reporters/json-cov.js -/** + require.register('reporters/json-stream.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , color = Base.color; + const Base = require('./base') + ; const color = Base.color; -/** + /** * Expose `List`. */ -exports = module.exports = List; + exports = module.exports = List; -/** + /** * Initialize a new `List` test reporter. * * @param {Runner} runner * @api public */ -function List(runner) { - Base.call(this, runner); + function List(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , total = runner.total; + const self = this + ; const stats = this.stats + ; const total = runner.total; - runner.on('start', function(){ - console.log(JSON.stringify(['start', { total: 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('pass', function(test) { + console.log(JSON.stringify(['pass', clean(test)])); + }); - runner.on('fail', function(test, err){ - console.log(JSON.stringify(['fail', clean(test)])); - }); + runner.on('fail', function(test, err) { + console.log(JSON.stringify(['fail', clean(test)])); + }); - runner.on('end', function(){ - process.stdout.write(JSON.stringify(['end', self.stats])); - }); -} + runner.on('end', function() { + process.stdout.write(JSON.stringify(['end', self.stats])); + }); + } -/** + /** * Return a plain-object representation of `test` * free of cyclic properties etc. * @@ -3053,71 +3036,70 @@ function List(runner) { * @api private */ -function clean(test) { - return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} -}); // module: reporters/json-stream.js - -require.register("reporters/json.js", function(module, exports, require){ + function clean(test) { + return { + title: test.title, + fullTitle: test.fullTitle(), + duration: test.duration, + }; + } + }); // module: reporters/json-stream.js -/** + require.register('reporters/json.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; + const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; -/** + /** * Expose `JSON`. */ -exports = module.exports = JSONReporter; + exports = module.exports = JSONReporter; -/** + /** * Initialize a new `JSON` reporter. * * @param {Runner} runner * @api public */ -function JSONReporter(runner) { - var self = this; - Base.call(this, runner); + function JSONReporter(runner) { + const self = this; + Base.call(this, runner); - var tests = [] - , failures = [] - , passes = []; + const tests = [] + ; const failures = [] + ; const passes = []; - runner.on('test end', function(test){ - tests.push(test); - }); + runner.on('test end', function(test) { + tests.push(test); + }); - runner.on('pass', function(test){ - passes.push(test); - }); + runner.on('pass', function(test) { + passes.push(test); + }); - runner.on('fail', function(test){ - failures.push(test); - }); + runner.on('fail', function(test) { + failures.push(test); + }); - runner.on('end', function(){ - var obj = { - stats: self.stats - , tests: tests.map(clean) - , failures: failures.map(clean) - , passes: passes.map(clean) - }; + runner.on('end', function() { + const obj = { + stats: self.stats, + tests: tests.map(clean), + failures: failures.map(clean), + passes: passes.map(clean), + }; - process.stdout.write(JSON.stringify(obj, null, 2)); - }); -} + process.stdout.write(JSON.stringify(obj, null, 2)); + }); + } -/** + /** * Return a plain-object representation of `test` * free of cyclic properties etc. * @@ -3126,566 +3108,558 @@ function JSONReporter(runner) { * @api private */ -function clean(test) { - return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} -}); // module: reporters/json.js - -require.register("reporters/landing.js", function(module, exports, require){ + function clean(test) { + return { + title: test.title, + fullTitle: test.fullTitle(), + duration: test.duration, + }; + } + }); // module: reporters/json.js -/** + require.register('reporters/landing.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; + const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; -/** + /** * Expose `Landing`. */ -exports = module.exports = Landing; + exports = module.exports = Landing; -/** + /** * Airplane color. */ -Base.colors.plane = 0; + Base.colors.plane = 0; -/** + /** * Airplane crash color. */ -Base.colors['plane crash'] = 31; + Base.colors['plane crash'] = 31; -/** + /** * Runway color. */ -Base.colors.runway = 90; + Base.colors.runway = 90; -/** + /** * Initialize a new `Landing` reporter. * * @param {Runner} runner * @api public */ -function Landing(runner) { - Base.call(this, runner); + function Landing(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , total = runner.total - , stream = process.stdout - , plane = color('plane', '✈') - , crashed = -1 - , n = 0; + const self = this + ; const stats = this.stats + ; const width = Base.window.width * .75 | 0 + ; const total = runner.total + ; const stream = process.stdout + ; let plane = color('plane', '✈') + ; let crashed = -1 + ; let n = 0; - function runway() { - var buf = Array(width).join('-'); - return ' ' + color('runway', buf); - } + function runway() { + const buf = Array(width).join('-'); + return ' ' + color('runway', buf); + } + + runner.on('start', function() { + stream.write('\n '); + cursor.hide(); + }); + + runner.on('test end', function(test) { + // check if the plane crashed + const col = -1 == crashed ? + width * ++n / total | 0 : + crashed; + + // show the crash + if ('failed' == test.state) { + plane = color('plane crash', '✈'); + crashed = col; + } + + // render landing strip + stream.write('\u001b[4F\n\n'); + 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('start', function(){ - stream.write('\n '); - cursor.hide(); - }); - - runner.on('test end', function(test){ - // check if the plane crashed - var col = -1 == crashed - ? width * ++n / total | 0 - : crashed; - - // show the crash - if ('failed' == test.state) { - plane = color('plane crash', '✈'); - crashed = col; + runner.on('end', function() { + cursor.show(); + console.log(); + self.epilogue(); + }); } - // render landing strip - stream.write('\u001b[4F\n\n'); - 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`. */ -function F(){}; -F.prototype = Base.prototype; -Landing.prototype = new F; -Landing.prototype.constructor = Landing; - -}); // module: reporters/landing.js + function F() {}; + F.prototype = Base.prototype; + Landing.prototype = new F; + Landing.prototype.constructor = Landing; + }); // module: reporters/landing.js -require.register("reporters/list.js", function(module, exports, require){ - -/** + require.register('reporters/list.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; + const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; -/** + /** * Expose `List`. */ -exports = module.exports = List; + exports = module.exports = List; -/** + /** * Initialize a new `List` test reporter. * * @param {Runner} runner * @api public */ -function List(runner) { - Base.call(this, runner); + function List(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , n = 0; + const self = this + ; const stats = this.stats + ; let n = 0; - runner.on('start', function(){ - console.log(); - }); + runner.on('start', function() { + console.log(); + }); - runner.on('test', function(test){ - process.stdout.write(color('pass', ' ' + test.fullTitle() + ': ')); - }); + 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('pending', function(test) { + const 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('pass', function(test) { + const 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, err){ - cursor.CR(); - console.log(color('fail', ' %d) %s'), ++n, test.fullTitle()); - }); + runner.on('fail', function(test, err) { + cursor.CR(); + console.log(color('fail', ' %d) %s'), ++n, test.fullTitle()); + }); - runner.on('end', self.epilogue.bind(self)); -} + runner.on('end', self.epilogue.bind(self)); + } -/** + /** * Inherit from `Base.prototype`. */ -function F(){}; -F.prototype = Base.prototype; -List.prototype = new F; -List.prototype.constructor = List; - + function F() {}; + F.prototype = Base.prototype; + List.prototype = new F; + List.prototype.constructor = List; + }); // module: reporters/list.js -}); // module: reporters/list.js - -require.register("reporters/markdown.js", function(module, exports, require){ -/** + require.register('reporters/markdown.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , utils = require('../utils'); + const Base = require('./base') + ; const utils = require('../utils'); -/** + /** * Expose `Markdown`. */ -exports = module.exports = Markdown; + exports = module.exports = Markdown; -/** + /** * Initialize a new `Markdown` reporter. * * @param {Runner} runner * @api public */ -function Markdown(runner) { - Base.call(this, runner); + function Markdown(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , level = 0 - , buf = ''; + const self = this + ; const stats = this.stats + ; let level = 0 + ; let buf = ''; - function title(str) { - return Array(level).join('#') + ' ' + str; - } + function title(str) { + return Array(level).join('#') + ' ' + str; + } - function indent() { - return Array(level).join(' '); - } + function indent() { + return Array(level).join(' '); + } - function mapTOC(suite, obj) { - var ret = obj; - obj = obj[suite.title] = obj[suite.title] || { suite: suite }; - suite.suites.forEach(function(suite){ - mapTOC(suite, obj); - }); - return ret; - } + function mapTOC(suite, obj) { + const ret = obj; + obj = obj[suite.title] = obj[suite.title] || {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 ('suite' == key) continue; - if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n'; - if (key) buf += Array(level).join(' ') + link; - buf += stringifyTOC(obj[key], level); - } - --level; - return buf; - } + function stringifyTOC(obj, level) { + ++level; + let buf = ''; + let link; + for (const key in obj) { + if ('suite' == key) continue; + if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n'; + if (key) buf += Array(level).join(' ') + link; + buf += stringifyTOC(obj[key], level); + } + --level; + return buf; + } - function generateTOC(suite) { - var obj = mapTOC(suite, {}); - return stringifyTOC(obj, 0); - } + function generateTOC(suite) { + const obj = mapTOC(suite, {}); + return stringifyTOC(obj, 0); + } + + generateTOC(runner.suite); + + runner.on('suite', function(suite) { + ++level; + const slug = utils.slug(suite.fullTitle()); + buf += '' + '\n'; + buf += title(suite.title) + '\n'; + }); + + runner.on('suite end', function(suite) { + --level; + }); + + runner.on('pass', function(test) { + const code = utils.clean(test.fn.toString()); + buf += test.title + '.\n'; + buf += '\n```js\n'; + buf += code + '\n'; + buf += '```\n\n'; + }); - generateTOC(runner.suite); - - runner.on('suite', function(suite){ - ++level; - var slug = utils.slug(suite.fullTitle()); - buf += '' + '\n'; - buf += title(suite.title) + '\n'; - }); - - runner.on('suite end', function(suite){ - --level; - }); - - runner.on('pass', function(test){ - var code = utils.clean(test.fn.toString()); - 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); - }); -} -}); // module: reporters/markdown.js - -require.register("reporters/min.js", function(module, exports, require){ - -/** + runner.on('end', function() { + process.stdout.write('# TOC\n'); + process.stdout.write(generateTOC(runner.suite)); + process.stdout.write(buf); + }); + } + }); // module: reporters/markdown.js + + require.register('reporters/min.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base'); + const Base = require('./base'); -/** + /** * Expose `Min`. */ -exports = module.exports = Min; + exports = module.exports = Min; -/** + /** * Initialize a new `Min` minimal test reporter (best used with --watch). * * @param {Runner} runner * @api public */ -function Min(runner) { - Base.call(this, 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('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)); -} + runner.on('end', this.epilogue.bind(this)); + } -/** + /** * Inherit from `Base.prototype`. */ -function F(){}; -F.prototype = Base.prototype; -Min.prototype = new F; -Min.prototype.constructor = Min; - + function F() {}; + F.prototype = Base.prototype; + Min.prototype = new F; + Min.prototype.constructor = Min; + }); // module: reporters/min.js -}); // module: reporters/min.js - -require.register("reporters/nyan.js", function(module, exports, require){ -/** + require.register('reporters/nyan.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , color = Base.color; + const Base = require('./base') + ; const color = Base.color; -/** + /** * Expose `Dot`. */ -exports = module.exports = NyanCat; + 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 - , stats = this.stats - , width = Base.window.width * .75 | 0 - , rainbowColors = this.rainbowColors = self.generateColors() - , colorIndex = this.colorIndex = 0 - , numerOfLines = this.numberOfLines = 4 - , trajectories = this.trajectories = [[], [], [], []] - , nyanCatWidth = this.nyanCatWidth = 11 - , trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth) - , scoreboardWidth = this.scoreboardWidth = 5 - , tick = this.tick = 0 - , n = 0; - - runner.on('start', function(){ - Base.cursor.hide(); - self.draw(); - }); - - runner.on('pending', function(test){ - self.draw(); - }); - - runner.on('pass', function(test){ - self.draw(); - }); - - runner.on('fail', function(test, err){ - self.draw(); - }); - - runner.on('end', function(){ - Base.cursor.show(); - for (var i = 0; i < self.numberOfLines; i++) write('\n'); - self.epilogue(); - }); -} - -/** + function NyanCat(runner) { + Base.call(this, runner); + const self = this + ; const stats = this.stats + ; const width = Base.window.width * .75 | 0 + ; const rainbowColors = this.rainbowColors = self.generateColors() + ; const colorIndex = this.colorIndex = 0 + ; const numerOfLines = this.numberOfLines = 4 + ; const trajectories = this.trajectories = [[], [], [], []] + ; const nyanCatWidth = this.nyanCatWidth = 11 + ; const trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth) + ; const scoreboardWidth = this.scoreboardWidth = 5 + ; const tick = this.tick = 0 + ; const n = 0; + + runner.on('start', function() { + Base.cursor.hide(); + self.draw(); + }); + + runner.on('pending', function(test) { + self.draw(); + }); + + runner.on('pass', function(test) { + self.draw(); + }); + + runner.on('fail', function(test, err) { + self.draw(); + }); + + runner.on('end', function() { + Base.cursor.show(); + for (let i = 0; i < self.numberOfLines; i++) write('\n'); + self.epilogue(); + }); + } + + /** * Draw the nyan cat * * @api private */ -NyanCat.prototype.draw = function(){ - this.appendRainbow(); - this.drawScoreboard(); - this.drawRainbow(); - this.drawNyanCat(); - this.tick = !this.tick; -}; + 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; - var colors = Base.colors; + NyanCat.prototype.drawScoreboard = function() { + const stats = this.stats; + const colors = Base.colors; - function draw(color, n) { - write(' '); - write('\u001b[' + color + 'm' + n + '\u001b[0m'); - write('\n'); - } + function draw(color, n) { + write(' '); + write('\u001b[' + color + 'm' + n + '\u001b[0m'); + write('\n'); + } - draw(colors.green, stats.passes); - draw(colors.fail, stats.failures); - draw(colors.pending, stats.pending); - write('\n'); + draw(colors.green, stats.passes); + draw(colors.fail, stats.failures); + draw(colors.pending, stats.pending); + write('\n'); - this.cursorUp(this.numberOfLines); -}; + this.cursorUp(this.numberOfLines); + }; -/** + /** * Append the rainbow. * * @api private */ -NyanCat.prototype.appendRainbow = function(){ - var segment = this.tick ? '_' : '-'; - var rainbowified = this.rainbowify(segment); + NyanCat.prototype.appendRainbow = function() { + const segment = this.tick ? '_' : '-'; + const 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); - } -}; + for (let index = 0; index < this.numberOfLines; index++) { + const 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; + NyanCat.prototype.drawRainbow = function() { + const self = this; - this.trajectories.forEach(function(line, index) { - write('\u001b[' + self.scoreboardWidth + 'C'); - write(line.join('')); - write('\n'); - }); + this.trajectories.forEach(function(line, index) { + write('\u001b[' + self.scoreboardWidth + 'C'); + write(line.join('')); + write('\n'); + }); - this.cursorUp(this.numberOfLines); -}; + 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 color = '\u001b[' + startWidth + 'C'; - var padding = ''; + NyanCat.prototype.drawNyanCat = function() { + const self = this; + const startWidth = this.scoreboardWidth + this.trajectories[0].length; + const color = '\u001b[' + startWidth + 'C'; + let padding = ''; - write(color); - write('_,------,'); - write('\n'); + write(color); + write('_,------,'); + write('\n'); - write(color); - padding = self.tick ? ' ' : ' '; - write('_|' + padding + '/\\_/\\ '); - write('\n'); + write(color); + padding = self.tick ? ' ' : ' '; + write('_|' + padding + '/\\_/\\ '); + write('\n'); - write(color); - padding = self.tick ? '_' : '__'; - var tail = self.tick ? '~' : '^'; - var face; - write(tail + '|' + padding + this.face() + ' '); - write('\n'); + write(color); + padding = self.tick ? '_' : '__'; + const tail = self.tick ? '~' : '^'; + let face; + write(tail + '|' + padding + this.face() + ' '); + write('\n'); - write(color); - padding = self.tick ? ' ' : ' '; - write(padding + '"" "" '); - write('\n'); + write(color); + padding = self.tick ? ' ' : ' '; + write(padding + '"" "" '); + write('\n'); - this.cursorUp(this.numberOfLines); -}; + this.cursorUp(this.numberOfLines); + }; -/** + /** * Draw nyan cat face. * * @return {String} * @api private */ -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 '( ^ .^)'; - } else { - return '( - .-)'; - } -} + NyanCat.prototype.face = function() { + const stats = this.stats; + if (stats.failures) { + return '( x .x)'; + } else if (stats.pending) { + return '( o .o)'; + } else if (stats.passes) { + return '( ^ .^)'; + } else { + return '( - .-)'; + } + }; -/** + /** * Move cursor up `n`. * * @param {Number} n * @api private */ -NyanCat.prototype.cursorUp = function(n) { - write('\u001b[' + n + 'A'); -}; + NyanCat.prototype.cursorUp = function(n) { + write('\u001b[' + n + 'A'); + }; -/** + /** * Move cursor down `n`. * * @param {Number} n * @api private */ -NyanCat.prototype.cursorDown = function(n) { - write('\u001b[' + n + 'B'); -}; + NyanCat.prototype.cursorDown = function(n) { + write('\u001b[' + n + 'B'); + }; -/** + /** * Generate rainbow colors. * * @return {Array} * @api private */ -NyanCat.prototype.generateColors = function(){ - var colors = []; + NyanCat.prototype.generateColors = function() { + const 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); - } + for (let i = 0; i < (6 * 7); i++) { + const pi3 = Math.floor(Math.PI / 3); + const n = (i * (1.0 / 6)); + const r = Math.floor(3 * Math.sin(n) + 3); + const g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3); + const b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3); + colors.push(36 * r + 6 * g + b + 16); + } - return colors; -}; + return colors; + }; -/** + /** * Apply rainbow to the given `str`. * * @param {String} str @@ -3693,55 +3667,52 @@ NyanCat.prototype.generateColors = function(){ * @api private */ -NyanCat.prototype.rainbowify = function(str){ - var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length]; - this.colorIndex += 1; - return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m'; -}; + NyanCat.prototype.rainbowify = function(str) { + const color = this.rainbowColors[this.colorIndex % this.rainbowColors.length]; + this.colorIndex += 1; + return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m'; + }; -/** + /** * Stdout helper. */ -function write(string) { - process.stdout.write(string); -} + function write(string) { + process.stdout.write(string); + } -/** + /** * Inherit from `Base.prototype`. */ -function F(){}; -F.prototype = Base.prototype; -NyanCat.prototype = new F; -NyanCat.prototype.constructor = NyanCat; - - -}); // module: reporters/nyan.js + function F() {}; + F.prototype = Base.prototype; + NyanCat.prototype = new F; + NyanCat.prototype.constructor = NyanCat; + }); // module: reporters/nyan.js -require.register("reporters/progress.js", function(module, exports, require){ - -/** + require.register('reporters/progress.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; + const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; -/** + /** * Expose `Progress`. */ -exports = module.exports = Progress; + exports = module.exports = Progress; -/** + /** * General progress bar color. */ -Base.colors.progress = 90; + Base.colors.progress = 90; -/** + /** * Initialize a new `Progress` bar test reporter. * * @param {Runner} runner @@ -3749,225 +3720,219 @@ Base.colors.progress = 90; * @api public */ -function Progress(runner, options) { - Base.call(this, runner); - - var self = this - , options = options || {} - , stats = this.stats - , width = Base.window.width * .50 | 0 - , total = runner.total - , complete = 0 - , max = Math.max; - - // default chars - 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 incomplete = total - complete - , percent = complete / total - , n = width * percent | 0 - , i = width - 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`. - */ + function Progress(runner, options) { + Base.call(this, runner); + + const self = this + ; var options = options || {} + ; const stats = this.stats + ; const width = Base.window.width * .50 | 0 + ; const total = runner.total + ; let complete = 0 + ; const max = Math.max; + + // default chars + 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(); + }); -function F(){}; -F.prototype = Base.prototype; -Progress.prototype = new F; -Progress.prototype.constructor = Progress; + // tests complete + runner.on('test end', function() { + complete++; + const incomplete = total - complete + ; const percent = complete / total + ; const n = width * percent | 0 + ; const i = width - 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(); + }); + } -}); // module: reporters/progress.js + /** + * Inherit from `Base.prototype`. + */ -require.register("reporters/spec.js", function(module, exports, require){ + function F() {}; + F.prototype = Base.prototype; + Progress.prototype = new F; + Progress.prototype.constructor = Progress; + }); // module: reporters/progress.js -/** + require.register('reporters/spec.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; + const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; -/** + /** * Expose `Spec`. */ -exports = module.exports = Spec; + exports = module.exports = Spec; -/** + /** * Initialize a new `Spec` test reporter. * * @param {Runner} runner * @api public */ -function Spec(runner) { - Base.call(this, runner); + function Spec(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , indents = 0 - , n = 0; + const self = this + ; const stats = this.stats + ; let indents = 0 + ; let n = 0; - function indent() { - return Array(indents).join(' ') - } + 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(suite){ - --indents; - if (1 == indents) console.log(); - }); - - runner.on('pending', function(test){ - var fmt = indent() + color('pending', ' - %s'); - console.log(fmt, test.title); - }); - - runner.on('pass', function(test){ - if ('fast' == test.speed) { - var fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s '); - cursor.CR(); - console.log(fmt, test.title); - } else { - var fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s ') - + color(test.speed, '(%dms)'); - cursor.CR(); - console.log(fmt, test.title, test.duration); - } - }); + runner.on('start', function() { + console.log(); + }); - runner.on('fail', function(test, err){ - cursor.CR(); - console.log(indent() + color('fail', ' %d) %s'), ++n, test.title); - }); + runner.on('suite', function(suite) { + ++indents; + console.log(color('suite', '%s%s'), indent(), suite.title); + }); - runner.on('end', self.epilogue.bind(self)); -} + runner.on('suite end', function(suite) { + --indents; + if (1 == indents) console.log(); + }); -/** - * Inherit from `Base.prototype`. - */ + runner.on('pending', function(test) { + const fmt = indent() + color('pending', ' - %s'); + console.log(fmt, test.title); + }); + + runner.on('pass', function(test) { + if ('fast' == test.speed) { + var fmt = indent() + + color('checkmark', ' ' + Base.symbols.ok) + + color('pass', ' %s '); + cursor.CR(); + console.log(fmt, test.title); + } else { + var fmt = indent() + + color('checkmark', ' ' + Base.symbols.ok) + + color('pass', ' %s ') + + color(test.speed, '(%dms)'); + cursor.CR(); + console.log(fmt, test.title, test.duration); + } + }); -function F(){}; -F.prototype = Base.prototype; -Spec.prototype = new F; -Spec.prototype.constructor = Spec; + runner.on('fail', function(test, err) { + cursor.CR(); + console.log(indent() + color('fail', ' %d) %s'), ++n, test.title); + }); + runner.on('end', self.epilogue.bind(self)); + } -}); // module: reporters/spec.js + /** + * Inherit from `Base.prototype`. + */ -require.register("reporters/tap.js", function(module, exports, require){ + function F() {}; + F.prototype = Base.prototype; + Spec.prototype = new F; + Spec.prototype.constructor = Spec; + }); // module: reporters/spec.js -/** + require.register('reporters/tap.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; + const Base = require('./base') + ; const cursor = Base.cursor + ; const color = Base.color; -/** + /** * Expose `TAP`. */ -exports = module.exports = TAP; + exports = module.exports = TAP; -/** + /** * Initialize a new `TAP` reporter. * * @param {Runner} runner * @api public */ -function TAP(runner) { - Base.call(this, runner); + function TAP(runner) { + Base.call(this, runner); - var self = this - , stats = this.stats - , n = 1 - , passes = 0 - , failures = 0; + const self = this + ; const stats = this.stats + ; let n = 1 + ; let passes = 0 + ; let failures = 0; - runner.on('start', function(){ - var total = runner.grepTotal(runner.suite); - console.log('%d..%d', 1, total); - }); + runner.on('start', function() { + const total = runner.grepTotal(runner.suite); + console.log('%d..%d', 1, total); + }); - runner.on('test end', function(){ - ++n; - }); + runner.on('test end', function() { + ++n; + }); - runner.on('pending', function(test){ - console.log('ok %d %s # SKIP -', n, title(test)); - }); + 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('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('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); - }); -} + runner.on('end', function() { + console.log('# tests ' + (passes + failures)); + console.log('# pass ' + passes); + console.log('# fail ' + failures); + }); + } -/** + /** * Return a TAP-safe title of `test` * * @param {Object} test @@ -3975,172 +3940,168 @@ function TAP(runner) { * @api private */ -function title(test) { - return test.fullTitle().replace(/#/g, ''); -} - -}); // module: reporters/tap.js - -require.register("reporters/xunit.js", function(module, exports, require){ + function title(test) { + return test.fullTitle().replace(/#/g, ''); + } + }); // module: reporters/tap.js -/** + require.register('reporters/xunit.js', function(module, exports, require) { + /** * Module dependencies. */ -var Base = require('./base') - , utils = require('../utils') - , escape = utils.escape; + const Base = require('./base') + ; const utils = require('../utils') + ; const escape = utils.escape; -/** + /** * Save timer references to avoid Sinon interfering (see GH-237). */ -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; + const Date = global.Date + ; const setTimeout = global.setTimeout + ; const setInterval = global.setInterval + ; const clearTimeout = global.clearTimeout + ; const clearInterval = global.clearInterval; -/** + /** * Expose `XUnit`. */ -exports = module.exports = XUnit; + exports = module.exports = XUnit; -/** + /** * Initialize a new `XUnit` reporter. * * @param {Runner} runner * @api public */ -function XUnit(runner) { - Base.call(this, runner); - var stats = this.stats - , tests = [] - , self = this; - - 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(){ - console.log(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(test); - console.log(''); - }); -} - -/** + function XUnit(runner) { + Base.call(this, runner); + const stats = this.stats + ; const tests = [] + ; const self = this; + + 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() { + console.log(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(test); + console.log(''); + }); + } + + /** * Inherit from `Base.prototype`. */ -function F(){}; -F.prototype = Base.prototype; -XUnit.prototype = new F; -XUnit.prototype.constructor = XUnit; + function F() {}; + F.prototype = Base.prototype; + XUnit.prototype = new F; + XUnit.prototype.constructor = XUnit; -/** + /** * Output tag for the given `test.` */ -function test(test) { - var attrs = { - classname: test.parent.fullTitle() - , name: test.title - , time: (test.duration / 1000) || 0 - }; + function test(test) { + const attrs = { + classname: test.parent.fullTitle(), + name: test.title, + time: (test.duration / 1000) || 0, + }; - if ('failed' == test.state) { - var err = test.err; - attrs.message = escape(err.message); - console.log(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(err.stack)))); - } else if (test.pending) { - console.log(tag('testcase', attrs, false, tag('skipped', {}, true))); - } else { - console.log(tag('testcase', attrs, true) ); - } -} + if ('failed' == test.state) { + const err = test.err; + attrs.message = escape(err.message); + console.log(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(err.stack)))); + } else if (test.pending) { + console.log(tag('testcase', attrs, false, tag('skipped', {}, true))); + } else { + console.log(tag('testcase', attrs, true) ); + } + } -/** + /** * HTML tag helper. */ -function tag(name, attrs, close, content) { - var end = close ? '/>' : '>' - , pairs = [] - , tag; + function tag(name, attrs, close, content) { + const end = close ? '/>' : '>' + ; const pairs = [] + ; let tag; - for (var key in attrs) { - pairs.push(key + '="' + escape(attrs[key]) + '"'); - } + for (const key in attrs) { + pairs.push(key + '="' + escape(attrs[key]) + '"'); + } - tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end; - if (content) tag += content + ''; -} - -}); // module: reporters/xunit.js - -require.register("runnable.js", function(module, exports, require){ + function cdata(str) { + return ''; + } + }); // module: reporters/xunit.js -/** + require.register('runnable.js', function(module, exports, require) { + /** * Module dependencies. */ -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:runnable') - , milliseconds = require('./ms'); + const EventEmitter = require('browser/events').EventEmitter + ; const debug = require('browser/debug')('mocha:runnable') + ; const milliseconds = require('./ms'); -/** + /** * Save timer references to avoid Sinon interfering (see GH-237). */ -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; + const Date = global.Date + ; const setTimeout = global.setTimeout + ; const setInterval = global.setInterval + ; const clearTimeout = global.clearTimeout + ; const clearInterval = global.clearInterval; -/** + /** * Object#toString(). */ -var toString = Object.prototype.toString; + const toString = Object.prototype.toString; -/** + /** * Expose `Runnable`. */ -module.exports = Runnable; + module.exports = Runnable; -/** + /** * Initialize a new `Runnable` with the given `title` and callback `fn`. * * @param {String} title @@ -4148,27 +4109,27 @@ module.exports = Runnable; * @api private */ -function Runnable(title, fn) { - this.title = title; - this.fn = fn; - this.async = fn && fn.length; - this.sync = ! this.async; - this._timeout = 2000; - this._slow = 75; - this.timedOut = false; -} + function Runnable(title, fn) { + this.title = title; + this.fn = fn; + this.async = fn && fn.length; + this.sync = ! this.async; + this._timeout = 2000; + this._slow = 75; + this.timedOut = false; + } -/** + /** * Inherit from `EventEmitter.prototype`. */ -function F(){}; -F.prototype = EventEmitter.prototype; -Runnable.prototype = new F; -Runnable.prototype.constructor = Runnable; + function F() {}; + F.prototype = EventEmitter.prototype; + Runnable.prototype = new F; + Runnable.prototype.constructor = Runnable; -/** + /** * Set & get timeout `ms`. * * @param {Number|String} ms @@ -4176,16 +4137,16 @@ Runnable.prototype.constructor = Runnable; * @api private */ -Runnable.prototype.timeout = function(ms){ - if (0 == arguments.length) return this._timeout; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('timeout %d', ms); - this._timeout = ms; - if (this.timer) this.resetTimeout(); - return this; -}; + Runnable.prototype.timeout = function(ms) { + if (0 == arguments.length) return this._timeout; + if ('string' == typeof ms) ms = milliseconds(ms); + debug('timeout %d', ms); + this._timeout = ms; + if (this.timer) this.resetTimeout(); + return this; + }; -/** + /** * Set & get slow `ms`. * * @param {Number|String} ms @@ -4193,15 +4154,15 @@ Runnable.prototype.timeout = function(ms){ * @api private */ -Runnable.prototype.slow = function(ms){ - if (0 === arguments.length) return this._slow; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('timeout %d', ms); - this._slow = ms; - return this; -}; + Runnable.prototype.slow = function(ms) { + if (0 === arguments.length) return this._slow; + if ('string' == typeof ms) ms = milliseconds(ms); + debug('timeout %d', ms); + this._slow = ms; + return this; + }; -/** + /** * Return the full title generated by recursively * concatenating the parent's full title. * @@ -4209,172 +4170,171 @@ Runnable.prototype.slow = function(ms){ * @api public */ -Runnable.prototype.fullTitle = function(){ - return this.parent.fullTitle() + ' ' + this.title; -}; + Runnable.prototype.fullTitle = function() { + return this.parent.fullTitle() + ' ' + this.title; + }; -/** + /** * Clear the timeout. * * @api private */ -Runnable.prototype.clearTimeout = function(){ - clearTimeout(this.timer); -}; + Runnable.prototype.clearTimeout = function() { + clearTimeout(this.timer); + }; -/** + /** * Inspect the runnable void of private properties. * * @return {String} * @api private */ -Runnable.prototype.inspect = function(){ - return JSON.stringify(this, function(key, val){ - if ('_' == key[0]) return; - if ('parent' == key) return '#'; - if ('ctx' == key) return '#'; - return val; - }, 2); -}; + Runnable.prototype.inspect = function() { + return JSON.stringify(this, function(key, val) { + if ('_' == key[0]) return; + if ('parent' == key) return '#'; + if ('ctx' == key) return '#'; + return val; + }, 2); + }; -/** + /** * Reset the timeout. * * @api private */ -Runnable.prototype.resetTimeout = function(){ - var self = this; - var ms = this.timeout() || 1e9; + Runnable.prototype.resetTimeout = function() { + const self = this; + const ms = this.timeout() || 1e9; - this.clearTimeout(); - this.timer = setTimeout(function(){ - self.callback(new Error('timeout of ' + ms + 'ms exceeded')); - self.timedOut = true; - }, ms); -}; + this.clearTimeout(); + this.timer = setTimeout(function() { + self.callback(new Error('timeout of ' + ms + 'ms exceeded')); + self.timedOut = true; + }, ms); + }; -/** + /** * Whitelist these globals for this test run * * @api private */ -Runnable.prototype.globals = function(arr){ - var self = this; - this._allowedGlobals = arr; -}; + Runnable.prototype.globals = function(arr) { + const self = this; + this._allowedGlobals = arr; + }; -/** + /** * Run the test and invoke `fn(err)`. * * @param {Function} fn * @api private */ -Runnable.prototype.run = function(fn){ - var self = this - , ms = this.timeout() - , start = new Date - , ctx = this.ctx - , finished - , emitted; - - if (ctx) ctx.runnable(this); + Runnable.prototype.run = function(fn) { + const self = this + ; const ms = this.timeout() + ; const start = new Date + ; const ctx = this.ctx + ; let finished + ; let emitted; - // timeout - if (this.async) { - if (ms) { - this.timer = setTimeout(function(){ - done(new Error('timeout of ' + ms + 'ms exceeded')); - self.timedOut = true; - }, ms); - } - } + if (ctx) ctx.runnable(this); - // called multiple times - function multiple(err) { - if (emitted) return; - emitted = true; - self.emit('error', err || new Error('done() called multiple times')); - } + // timeout + if (this.async) { + if (ms) { + this.timer = setTimeout(function() { + done(new Error('timeout of ' + ms + 'ms exceeded')); + self.timedOut = true; + }, ms); + } + } - // finished - function done(err) { - if (self.timedOut) return; - if (finished) return multiple(err); - self.clearTimeout(); - self.duration = new Date - start; - finished = true; - fn(err); - } + // called multiple times + function multiple(err) { + if (emitted) return; + emitted = true; + self.emit('error', err || new Error('done() called multiple times')); + } - // for .resetTimeout() - this.callback = done; + // finished + function done(err) { + if (self.timedOut) return; + if (finished) return multiple(err); + self.clearTimeout(); + self.duration = new Date - start; + finished = true; + fn(err); + } - // async - if (this.async) { - try { - this.fn.call(ctx, function(err){ - if (err instanceof Error || toString.call(err) === "[object Error]") return done(err); - if (null != err) return done(new Error('done() invoked with non-Error: ' + err)); - done(); - }); - } catch (err) { - done(err); - } - return; - } + // for .resetTimeout() + this.callback = done; - if (this.asyncOnly) { - return done(new Error('--async-only option in use without declaring `done()`')); - } + // async + if (this.async) { + try { + this.fn.call(ctx, function(err) { + if (err instanceof Error || toString.call(err) === '[object Error]') return done(err); + if (null != err) return done(new Error('done() invoked with non-Error: ' + err)); + done(); + }); + } catch (err) { + done(err); + } + return; + } - // sync - try { - if (!this.pending) this.fn.call(ctx); - this.duration = new Date - start; - fn(); - } catch (err) { - fn(err); - } -}; + if (this.asyncOnly) { + return done(new Error('--async-only option in use without declaring `done()`')); + } -}); // module: runnable.js + // sync + try { + if (!this.pending) this.fn.call(ctx); + this.duration = new Date - start; + fn(); + } catch (err) { + fn(err); + } + }; + }); // module: runnable.js -require.register("runner.js", function(module, exports, require){ -/** + require.register('runner.js', function(module, exports, require) { + /** * Module dependencies. */ -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:runner') - , Test = require('./test') - , utils = require('./utils') - , filter = utils.filter - , keys = utils.keys; + const EventEmitter = require('browser/events').EventEmitter + ; const debug = require('browser/debug')('mocha:runner') + ; const Test = require('./test') + ; const utils = require('./utils') + ; const filter = utils.filter + ; const keys = utils.keys; -/** + /** * Non-enumerable globals. */ -var globals = [ - 'setTimeout', - 'clearTimeout', - 'setInterval', - 'clearInterval', - 'XMLHttpRequest', - 'Date' -]; + const globals = [ + 'setTimeout', + 'clearTimeout', + 'setInterval', + 'clearInterval', + 'XMLHttpRequest', + 'Date', + ]; -/** + /** * Expose `Runner`. */ -module.exports = Runner; + module.exports = Runner; -/** + /** * Initialize a `Runner` for the given `suite`. * * Events: @@ -4394,39 +4354,43 @@ module.exports = Runner; * @api public */ -function Runner(suite) { - var self = this; - this._globals = []; - this._abort = false; - this.suite = suite; - 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.grep(/.*/); - this.globals(this.globalProps().concat(['errno'])); -} - -/** + function Runner(suite) { + const self = this; + this._globals = []; + this._abort = false; + this.suite = suite; + 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.grep(/.*/); + this.globals(this.globalProps().concat(['errno'])); + } + + /** * Wrapper for setImmediate, process.nextTick, or browser polyfill. * * @param {Function} fn * @api private */ -Runner.immediately = global.setImmediate || process.nextTick; + Runner.immediately = global.setImmediate || process.nextTick; -/** + /** * Inherit from `EventEmitter.prototype`. */ -function F(){}; -F.prototype = EventEmitter.prototype; -Runner.prototype = new F; -Runner.prototype.constructor = Runner; + function F() {}; + F.prototype = EventEmitter.prototype; + Runner.prototype = new F; + Runner.prototype.constructor = Runner; -/** + /** * Run tests with full titles matching `re`. Updates runner.total * with number of tests matched. * @@ -4436,15 +4400,15 @@ Runner.prototype.constructor = Runner; * @api public */ -Runner.prototype.grep = function(re, invert){ - debug('grep %s', re); - this._grep = re; - this._invert = invert; - this.total = this.grepTotal(this.suite); - return this; -}; + 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. * @@ -4453,39 +4417,39 @@ Runner.prototype.grep = function(re, invert){ * @api public */ -Runner.prototype.grepTotal = function(suite) { - var self = this; - var total = 0; + Runner.prototype.grepTotal = function(suite) { + const self = this; + let total = 0; - suite.eachTest(function(test){ - var match = self._grep.test(test.fullTitle()); - if (self._invert) match = !match; - if (match) total++; - }); + suite.eachTest(function(test) { + let match = self._grep.test(test.fullTitle()); + if (self._invert) match = !match; + if (match) total++; + }); - return total; -}; + return total; + }; -/** + /** * Return a list of global properties. * * @return {Array} * @api private */ -Runner.prototype.globalProps = function() { - var props = utils.keys(global); + Runner.prototype.globalProps = function() { + const props = utils.keys(global); - // non-enumerables - for (var i = 0; i < globals.length; ++i) { - if (~utils.indexOf(props, globals[i])) continue; - props.push(globals[i]); - } + // non-enumerables + for (let i = 0; i < globals.length; ++i) { + if (~utils.indexOf(props, globals[i])) continue; + props.push(globals[i]); + } - return props; -}; + return props; + }; -/** + /** * Allow the given `arr` of globals. * * @param {Array} arr @@ -4493,49 +4457,49 @@ Runner.prototype.globalProps = function() { * @api public */ -Runner.prototype.globals = function(arr){ - if (0 == arguments.length) return this._globals; - debug('globals %j', arr); - this._globals = this._globals.concat(arr); - return this; -}; + Runner.prototype.globals = function(arr) { + if (0 == 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; + Runner.prototype.checkGlobals = function(test) { + if (this.ignoreLeaks) return; + let ok = this._globals; - var globals = this.globalProps(); - var isNode = process.kill; - var leaks; + const globals = this.globalProps(); + const isNode = process.kill; + let leaks; - if (test) { - ok = ok.concat(test._allowedGlobals || []); - } + if (test) { + ok = ok.concat(test._allowedGlobals || []); + } - // check length - 2 ('errno' and 'location' globals) - if (isNode && 1 == ok.length - globals.length) return; - else if (2 == ok.length - globals.length) return; + // check length - 2 ('errno' and 'location' globals) + if (isNode && 1 == ok.length - globals.length) return; + else if (2 == ok.length - globals.length) return; - if(this.prevGlobalsLength == globals.length) return; - this.prevGlobalsLength = globals.length; + if (this.prevGlobalsLength == globals.length) return; + this.prevGlobalsLength = globals.length; - leaks = filterLeaks(ok, globals); - this._globals = this._globals.concat(leaks); + 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])); - } -}; + 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`. * * @param {Test} test @@ -4543,18 +4507,18 @@ Runner.prototype.checkGlobals = function(test){ * @api private */ -Runner.prototype.fail = function(test, err){ - ++this.failures; - test.state = 'failed'; + Runner.prototype.fail = function(test, err) { + ++this.failures; + test.state = 'failed'; - if ('string' == typeof err) { - err = new Error('the string "' + err + '" was thrown, throw an Error :)'); - } + if ('string' == typeof err) { + err = new Error('the string "' + err + '" was thrown, throw an Error :)'); + } - this.emit('fail', test, err); -}; + this.emit('fail', test, err); + }; -/** + /** * Fail the given `hook` with `err`. * * Hook failures work in the following pattern: @@ -4575,14 +4539,14 @@ Runner.prototype.fail = function(test, err){ * @api private */ -Runner.prototype.failHook = function(hook, err){ - this.fail(hook, err); - if (this.suite.bail()) { - this.emit('end'); - } -}; + Runner.prototype.failHook = function(hook, err) { + this.fail(hook, err); + if (this.suite.bail()) { + this.emit('end'); + } + }; -/** + /** * Run hook `name` callbacks and then invoke `fn()`. * * @param {String} name @@ -4590,48 +4554,48 @@ Runner.prototype.failHook = function(hook, err){ * @api private */ -Runner.prototype.hook = function(name, fn){ - var suite = this.suite - , hooks = suite['_' + name] - , self = this - , timer; + Runner.prototype.hook = function(name, fn) { + const suite = this.suite + ; const hooks = suite['_' + name] + ; const self = this + ; let timer; - function next(i) { - var hook = hooks[i]; - if (!hook) return fn(); - if (self.failures && suite.bail()) return fn(); - self.currentRunnable = hook; + function next(i) { + const hook = hooks[i]; + if (!hook) return fn(); + if (self.failures && suite.bail()) return fn(); + self.currentRunnable = hook; - hook.ctx.currentTest = self.test; + hook.ctx.currentTest = self.test; - self.emit('hook', hook); + self.emit('hook', hook); - hook.on('error', function(err){ - self.failHook(hook, err); - }); + hook.on('error', function(err) { + self.failHook(hook, err); + }); - hook.run(function(err){ - hook.removeAllListeners('error'); - var testError = hook.error(); - if (testError) self.fail(self.test, testError); - if (err) { - self.failHook(hook, err); + hook.run(function(err) { + hook.removeAllListeners('error'); + const testError = hook.error(); + if (testError) self.fail(self.test, testError); + if (err) { + self.failHook(hook, err); - // stop executing hooks, notify callee of hook err - return fn(err); + // stop executing hooks, notify callee of hook err + return fn(err); + } + self.emit('hook end', hook); + delete hook.ctx.currentTest; + next(++i); + }); } - self.emit('hook end', hook); - delete hook.ctx.currentTest; - next(++i); - }); - } - Runner.immediately(function(){ - next(0); - }); -}; + Runner.immediately(function() { + next(0); + }); + }; -/** + /** * Run hook `name` for the given array of `suites` * in order, and callback `fn(err, errSuite)`. * @@ -4641,33 +4605,33 @@ Runner.prototype.hook = function(name, fn){ * @api private */ -Runner.prototype.hooks = function(name, suites, fn){ - var self = this - , orig = this.suite; + Runner.prototype.hooks = function(name, suites, fn) { + const self = this + ; const orig = this.suite; - function next(suite) { - self.suite = suite; + function next(suite) { + self.suite = suite; - if (!suite) { - self.suite = orig; - return fn(); - } + 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); + self.hook(name, function(err) { + if (err) { + const errSuite = self.suite; + self.suite = orig; + return fn(err, errSuite); + } + + next(suites.pop()); + }); } next(suites.pop()); - }); - } - - next(suites.pop()); -}; + }; -/** + /** * Run hooks from the top level down. * * @param {String} name @@ -4675,12 +4639,12 @@ Runner.prototype.hooks = function(name, suites, fn){ * @api private */ -Runner.prototype.hookUp = function(name, fn){ - var suites = [this.suite].concat(this.parents()).reverse(); - this.hooks(name, suites, fn); -}; + Runner.prototype.hookUp = function(name, fn) { + const suites = [this.suite].concat(this.parents()).reverse(); + this.hooks(name, suites, fn); + }; -/** + /** * Run hooks from the bottom up. * * @param {String} name @@ -4688,12 +4652,12 @@ Runner.prototype.hookUp = function(name, fn){ * @api private */ -Runner.prototype.hookDown = function(name, fn){ - var suites = [this.suite].concat(this.parents()); - this.hooks(name, suites, fn); -}; + Runner.prototype.hookDown = function(name, fn) { + const suites = [this.suite].concat(this.parents()); + this.hooks(name, suites, fn); + }; -/** + /** * Return an array of parent Suites from * closest to furthest. * @@ -4701,37 +4665,37 @@ Runner.prototype.hookDown = function(name, fn){ * @api private */ -Runner.prototype.parents = function(){ - var suite = this.suite - , suites = []; - while (suite = suite.parent) suites.push(suite); - return suites; -}; + Runner.prototype.parents = function() { + let suite = this.suite + ; const suites = []; + while (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 test = this.test - , self = this; + Runner.prototype.runTest = function(fn) { + const test = this.test + ; const self = this; - if (this.asyncOnly) test.asyncOnly = true; + if (this.asyncOnly) test.asyncOnly = true; - try { - test.on('error', function(err){ - self.fail(test, err); - }); - test.run(fn); - } catch (err) { - fn(err); - } -}; + 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. * @@ -4740,91 +4704,90 @@ Runner.prototype.runTest = function(fn){ * @api private */ -Runner.prototype.runTests = function(suite, fn){ - var self = this - , tests = suite.tests.slice() - , test; - + Runner.prototype.runTests = function(suite, fn) { + const self = this + ; const tests = suite.tests.slice() + ; let test; - function hookErr(err, 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; + function hookErr(err, errSuite, after) { + // before/after Each hook for errSuite failed: + const orig = self.suite; - 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); - } - } + // for failed 'after each' hook start from errSuite parent, + // otherwise start from errSuite itself + self.suite = after ? errSuite.parent : errSuite; - function next(err, errSuite) { - // if we bail after first err - if (self.failures && suite._bail) return fn(); + 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); + } + } - if (self._abort) return fn(); + function next(err, errSuite) { + // if we bail after first err + if (self.failures && suite._bail) return fn(); - if (err) return hookErr(err, errSuite, true); + if (self._abort) return fn(); - // next test - test = tests.shift(); + if (err) return hookErr(err, errSuite, true); - // all done - if (!test) return fn(); + // next test + test = tests.shift(); - // grep - var match = self._grep.test(test.fullTitle()); - if (self._invert) match = !match; - if (!match) return next(); + // all done + if (!test) return fn(); - // pending - if (test.pending) { - self.emit('pending', test); - self.emit('test end', test); - return next(); - } + // grep + let match = self._grep.test(test.fullTitle()); + if (self._invert) match = !match; + if (!match) return next(); - // execute test and hook(s) - self.emit('test', self.test = test); - self.hookDown('beforeEach', function(err, errSuite){ + // pending + if (test.pending) { + self.emit('pending', test); + self.emit('test end', test); + return next(); + } - if (err) return hookErr(err, errSuite, false); + // execute test and hook(s) + self.emit('test', self.test = test); + self.hookDown('beforeEach', function(err, errSuite) { + if (err) return hookErr(err, errSuite, false); - self.currentRunnable = self.test; - self.runTest(function(err){ - test = self.test; + self.currentRunnable = self.test; + self.runTest(function(err) { + test = self.test; - if (err) { - self.fail(test, err); - self.emit('test end', test); - return self.hookUp('afterEach', next); - } + if (err) { + self.fail(test, err); + self.emit('test end', test); + return self.hookUp('afterEach', next); + } - test.state = 'passed'; - self.emit('pass', test); - self.emit('test end', test); - self.hookUp('afterEach', next); - }); - }); - } + test.state = 'passed'; + self.emit('pass', test); + self.emit('test end', test); + self.hookUp('afterEach', next); + }); + }); + } - this.next = next; - next(); -}; + this.next = next; + next(); + }; -/** + /** * Run the given `suite` and invoke the * callback `fn()` when complete. * @@ -4833,79 +4796,79 @@ Runner.prototype.runTests = function(suite, fn){ * @api private */ -Runner.prototype.runSuite = function(suite, fn){ - var total = this.grepTotal(suite) - , self = this - , i = 0; + Runner.prototype.runSuite = function(suite, fn) { + const total = this.grepTotal(suite) + ; const self = this + ; let i = 0; - debug('run suite %s', suite.fullTitle()); + debug('run suite %s', suite.fullTitle()); - if (!total) return fn(); + if (!total) return fn(); - this.emit('suite', this.suite = suite); + 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(); - } else { - // errSuite is among the parents of current suite - // stop execution of errSuite and all sub-suites - return done(errSuite); - } - } + 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(); + } else { + // errSuite is among the parents of current suite + // stop execution of errSuite and all sub-suites + return done(errSuite); + } + } - if (self._abort) return done(); + if (self._abort) return done(); - var curr = suite.suites[i++]; - if (!curr) return done(); - self.runSuite(curr, next); - } + const curr = suite.suites[i++]; + if (!curr) return done(); + self.runSuite(curr, next); + } - function done(errSuite) { - self.suite = suite; - self.hook('afterAll', function(){ - self.emit('suite end', suite); - fn(errSuite); - }); - } + function done(errSuite) { + self.suite = suite; + self.hook('afterAll', function() { + self.emit('suite end', suite); + fn(errSuite); + }); + } - this.hook('beforeAll', function(err){ - if (err) return done(); - self.runTests(suite, 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){ - debug('uncaught exception %s', err.message); - var runnable = this.currentRunnable; - if (!runnable || 'failed' == runnable.state) return; - runnable.clearTimeout(); - err.uncaught = true; - this.fail(runnable, err); + Runner.prototype.uncaught = function(err) { + debug('uncaught exception %s', err.message); + const runnable = this.currentRunnable; + if (!runnable || 'failed' == runnable.state) return; + runnable.clearTimeout(); + err.uncaught = true; + this.fail(runnable, err); - // recover from test - if ('test' == runnable.type) { - this.emit('test end', runnable); - this.hookUp('afterEach', this.next); - return; - } + // recover from test + if ('test' == runnable.type) { + this.emit('test end', runnable); + this.hookUp('afterEach', this.next); + return; + } - // bail on hooks - this.emit('end'); -}; + // bail on hooks + this.emit('end'); + }; -/** + /** * Run the root suite and invoke `fn(failures)` * on completion. * @@ -4914,48 +4877,48 @@ Runner.prototype.uncaught = function(err){ * @api public */ -Runner.prototype.run = function(fn){ - var self = this - , fn = fn || function(){}; + Runner.prototype.run = function(fn) { + const self = this + ; var fn = fn || function() {}; - function uncaught(err){ - self.uncaught(err); - } + function uncaught(err) { + self.uncaught(err); + } - debug('start'); + debug('start'); - // callback - this.on('end', function(){ - debug('end'); - process.removeListener('uncaughtException', uncaught); - fn(self.failures); - }); + // callback + this.on('end', function() { + debug('end'); + process.removeListener('uncaughtException', uncaught); + fn(self.failures); + }); - // run suites - this.emit('start'); - this.runSuite(this.suite, function(){ - debug('finished running'); - self.emit('end'); - }); + // run suites + this.emit('start'); + this.runSuite(this.suite, function() { + debug('finished running'); + self.emit('end'); + }); - // uncaught exception - process.on('uncaughtException', uncaught); + // uncaught exception + process.on('uncaughtException', uncaught); - return this; -}; + return this; + }; -/** + /** * Cleanly abort execution * * @return {Runner} for chaining * @api public */ -Runner.prototype.abort = function(){ - debug('aborting'); - this._abort = true; -} + Runner.prototype.abort = function() { + debug('aborting'); + this._abort = true; + }; -/** + /** * Filter leaks with the given globals flagged as `ok`. * * @param {Array} ok @@ -4964,52 +4927,50 @@ Runner.prototype.abort = function(){ * @api private */ -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; + 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; + // 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; + // 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; + // 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 0 == key.indexOf(ok.split('*')[0]); - return key == ok; - }); - return matched.length == 0 && (!global.navigator || 'onerror' !== key); - }); -} - -}); // module: runner.js - -require.register("suite.js", function(module, exports, require){ + const matched = filter(ok, function(ok) { + if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]); + return key == ok; + }); + return matched.length == 0 && (!global.navigator || 'onerror' !== key); + }); + } + }); // module: runner.js -/** + require.register('suite.js', function(module, exports, require) { + /** * Module dependencies. */ -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:suite') - , milliseconds = require('./ms') - , utils = require('./utils') - , Hook = require('./hook'); + const EventEmitter = require('browser/events').EventEmitter + ; const debug = require('browser/debug')('mocha:suite') + ; const milliseconds = require('./ms') + ; const utils = require('./utils') + ; const Hook = require('./hook'); -/** + /** * Expose `Suite`. */ -exports = module.exports = 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 @@ -5022,16 +4983,16 @@ exports = module.exports = Suite; * @api public */ -exports.create = function(parent, title){ - var suite = new Suite(title, parent.ctx); - suite.parent = parent; - if (parent.pending) suite.pending = true; - title = suite.fullTitle(); - parent.addSuite(suite); - return suite; -}; + exports.create = function(parent, title) { + const suite = new Suite(title, parent.ctx); + suite.parent = parent; + if (parent.pending) suite.pending = true; + title = suite.fullTitle(); + parent.addSuite(suite); + return suite; + }; -/** + /** * Initialize a new `Suite` with the given * `title` and `ctx`. * @@ -5040,50 +5001,50 @@ exports.create = function(parent, title){ * @api private */ -function Suite(title, ctx) { - this.title = title; - this.ctx = ctx; - this.suites = []; - this.tests = []; - this.pending = false; - this._beforeEach = []; - this._beforeAll = []; - this._afterEach = []; - this._afterAll = []; - this.root = !title; - this._timeout = 2000; - this._slow = 75; - this._bail = false; -} - -/** + function Suite(title, ctx) { + this.title = title; + this.ctx = ctx; + this.suites = []; + this.tests = []; + this.pending = false; + this._beforeEach = []; + this._beforeAll = []; + this._afterEach = []; + this._afterAll = []; + this.root = !title; + this._timeout = 2000; + this._slow = 75; + this._bail = false; + } + + /** * Inherit from `EventEmitter.prototype`. */ -function F(){}; -F.prototype = EventEmitter.prototype; -Suite.prototype = new F; -Suite.prototype.constructor = Suite; + function F() {}; + F.prototype = EventEmitter.prototype; + Suite.prototype = new F; + Suite.prototype.constructor = Suite; -/** + /** * Return a clone of this `Suite`. * * @return {Suite} * @api private */ -Suite.prototype.clone = function(){ - var suite = new Suite(this.title); - debug('clone'); - suite.ctx = this.ctx; - suite.timeout(this.timeout()); - suite.slow(this.slow()); - suite.bail(this.bail()); - return suite; -}; + Suite.prototype.clone = function() { + const suite = new Suite(this.title); + debug('clone'); + suite.ctx = this.ctx; + suite.timeout(this.timeout()); + suite.slow(this.slow()); + suite.bail(this.bail()); + return suite; + }; -/** + /** * Set timeout `ms` or short-hand such as "2s". * * @param {Number|String} ms @@ -5091,15 +5052,15 @@ Suite.prototype.clone = function(){ * @api private */ -Suite.prototype.timeout = function(ms){ - if (0 == arguments.length) return this._timeout; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('timeout %d', ms); - this._timeout = parseInt(ms, 10); - return this; -}; + Suite.prototype.timeout = function(ms) { + if (0 == arguments.length) return this._timeout; + if ('string' == typeof ms) ms = milliseconds(ms); + debug('timeout %d', ms); + this._timeout = parseInt(ms, 10); + return this; + }; -/** + /** * Set slow `ms` or short-hand such as "2s". * * @param {Number|String} ms @@ -5107,15 +5068,15 @@ Suite.prototype.timeout = function(ms){ * @api private */ -Suite.prototype.slow = function(ms){ - if (0 === arguments.length) return this._slow; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('slow %d', ms); - this._slow = ms; - return this; -}; + Suite.prototype.slow = function(ms) { + if (0 === arguments.length) return this._slow; + if ('string' == typeof ms) ms = milliseconds(ms); + debug('slow %d', ms); + this._slow = ms; + return this; + }; -/** + /** * Sets whether to bail after first error. * * @parma {Boolean} bail @@ -5123,14 +5084,14 @@ Suite.prototype.slow = function(ms){ * @api private */ -Suite.prototype.bail = function(bail){ - if (0 == arguments.length) return this._bail; - debug('bail %s', bail); - this._bail = bail; - return this; -}; + Suite.prototype.bail = function(bail) { + if (0 == arguments.length) return this._bail; + debug('bail %s', bail); + this._bail = bail; + return this; + }; -/** + /** * Run `fn(test[, done])` before running tests. * * @param {Function} fn @@ -5138,19 +5099,19 @@ Suite.prototype.bail = function(bail){ * @api private */ -Suite.prototype.beforeAll = function(fn){ - if (this.pending) return this; - var hook = new Hook('"before all" hook', fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeAll.push(hook); - this.emit('beforeAll', hook); - return this; -}; + Suite.prototype.beforeAll = function(fn) { + if (this.pending) return this; + const hook = new Hook('"before all" hook', fn); + hook.parent = this; + hook.timeout(this.timeout()); + 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. * * @param {Function} fn @@ -5158,19 +5119,19 @@ Suite.prototype.beforeAll = function(fn){ * @api private */ -Suite.prototype.afterAll = function(fn){ - if (this.pending) return this; - var hook = new Hook('"after all" hook', fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._afterAll.push(hook); - this.emit('afterAll', hook); - return this; -}; + Suite.prototype.afterAll = function(fn) { + if (this.pending) return this; + const hook = new Hook('"after all" hook', fn); + hook.parent = this; + hook.timeout(this.timeout()); + 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. * * @param {Function} fn @@ -5178,19 +5139,19 @@ Suite.prototype.afterAll = function(fn){ * @api private */ -Suite.prototype.beforeEach = function(fn){ - if (this.pending) return this; - var hook = new Hook('"before each" hook', fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeEach.push(hook); - this.emit('beforeEach', hook); - return this; -}; + Suite.prototype.beforeEach = function(fn) { + if (this.pending) return this; + const hook = new Hook('"before each" hook', fn); + hook.parent = this; + hook.timeout(this.timeout()); + 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. * * @param {Function} fn @@ -5198,19 +5159,19 @@ Suite.prototype.beforeEach = function(fn){ * @api private */ -Suite.prototype.afterEach = function(fn){ - if (this.pending) return this; - var hook = new Hook('"after each" hook', fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._afterEach.push(hook); - this.emit('afterEach', hook); - return this; -}; + Suite.prototype.afterEach = function(fn) { + if (this.pending) return this; + const hook = new Hook('"after each" hook', fn); + hook.parent = this; + hook.timeout(this.timeout()); + hook.slow(this.slow()); + hook.ctx = this.ctx; + this._afterEach.push(hook); + this.emit('afterEach', hook); + return this; + }; -/** + /** * Add a test `suite`. * * @param {Suite} suite @@ -5218,17 +5179,17 @@ Suite.prototype.afterEach = function(fn){ * @api private */ -Suite.prototype.addSuite = function(suite){ - suite.parent = this; - suite.timeout(this.timeout()); - suite.slow(this.slow()); - suite.bail(this.bail()); - this.suites.push(suite); - this.emit('suite', suite); - return this; -}; + Suite.prototype.addSuite = function(suite) { + suite.parent = this; + suite.timeout(this.timeout()); + suite.slow(this.slow()); + suite.bail(this.bail()); + this.suites.push(suite); + this.emit('suite', suite); + return this; + }; -/** + /** * Add a `test` to this suite. * * @param {Test} test @@ -5236,17 +5197,17 @@ Suite.prototype.addSuite = function(suite){ * @api private */ -Suite.prototype.addTest = function(test){ - test.parent = this; - test.timeout(this.timeout()); - test.slow(this.slow()); - test.ctx = this.ctx; - this.tests.push(test); - this.emit('test', test); - return this; -}; + Suite.prototype.addTest = function(test) { + test.parent = this; + test.timeout(this.timeout()); + 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. * @@ -5254,28 +5215,28 @@ Suite.prototype.addTest = function(test){ * @api public */ -Suite.prototype.fullTitle = function(){ - if (this.parent) { - var full = this.parent.fullTitle(); - if (full) return full + ' ' + this.title; - } - return this.title; -}; + Suite.prototype.fullTitle = function() { + if (this.parent) { + const full = this.parent.fullTitle(); + if (full) return full + ' ' + this.title; + } + return this.title; + }; -/** + /** * Return the total number of tests. * * @return {Number} * @api public */ -Suite.prototype.total = function(){ - return utils.reduce(this.suites, function(sum, suite){ - return sum + suite.total(); - }, 0) + this.tests.length; -}; + 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)`. @@ -5285,31 +5246,29 @@ Suite.prototype.total = function(){ * @api private */ -Suite.prototype.eachTest = function(fn){ - utils.forEach(this.tests, fn); - utils.forEach(this.suites, function(suite){ - suite.eachTest(fn); - }); - return this; -}; - -}); // module: suite.js - -require.register("test.js", function(module, exports, require){ + Suite.prototype.eachTest = function(fn) { + utils.forEach(this.tests, fn); + utils.forEach(this.suites, function(suite) { + suite.eachTest(fn); + }); + return this; + }; + }); // module: suite.js -/** + require.register('test.js', function(module, exports, require) { + /** * Module dependencies. */ -var Runnable = require('./runnable'); + const Runnable = require('./runnable'); -/** + /** * Expose `Test`. */ -module.exports = Test; + module.exports = Test; -/** + /** * Initialize a new `Test` with the given `title` and callback `fn`. * * @param {String} title @@ -5317,41 +5276,39 @@ module.exports = Test; * @api private */ -function Test(title, fn) { - Runnable.call(this, title, fn); - this.pending = !fn; - this.type = 'test'; -} + function Test(title, fn) { + Runnable.call(this, title, fn); + this.pending = !fn; + this.type = 'test'; + } -/** + /** * Inherit from `Runnable.prototype`. */ -function F(){}; -F.prototype = Runnable.prototype; -Test.prototype = new F; -Test.prototype.constructor = Test; - + function F() {}; + F.prototype = Runnable.prototype; + Test.prototype = new F; + Test.prototype.constructor = Test; + }); // module: test.js -}); // module: test.js - -require.register("utils.js", function(module, exports, require){ -/** + require.register('utils.js', function(module, exports, require) { + /** * Module dependencies. */ -var fs = require('browser/fs') - , path = require('browser/path') - , join = path.join - , debug = require('browser/debug')('mocha:watch'); + const fs = require('browser/fs') + ; const path = require('browser/path') + ; const join = path.join + ; const debug = require('browser/debug')('mocha:watch'); -/** + /** * Ignored directories. */ -var ignore = ['node_modules', '.git']; + const ignore = ['node_modules', '.git']; -/** + /** * Escape special characters in the given string of html. * * @param {String} html @@ -5359,15 +5316,15 @@ var ignore = ['node_modules', '.git']; * @api private */ -exports.escape = function(html){ - return String(html) - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(//g, '>'); -}; + exports.escape = function(html) { + return String(html) + .replace(/&/g, '&') + .replace(/"/g, '"') + .replace(//g, '>'); + }; -/** + /** * Array#forEach (<=IE8) * * @param {Array} array @@ -5376,12 +5333,13 @@ exports.escape = function(html){ * @api private */ -exports.forEach = function(arr, fn, scope){ - for (var i = 0, l = arr.length; i < l; i++) - fn.call(scope, arr[i], i); -}; + exports.forEach = function(arr, fn, scope) { + for (let i = 0, l = arr.length; i < l; i++) { + fn.call(scope, arr[i], i); + } + }; -/** + /** * Array#map (<=IE8) * * @param {Array} array @@ -5390,14 +5348,15 @@ exports.forEach = function(arr, fn, scope){ * @api private */ -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)); - return result; -}; + exports.map = function(arr, fn, scope) { + const result = []; + for (let i = 0, l = arr.length; i < l; i++) { + result.push(fn.call(scope, arr[i], i)); + } + return result; + }; -/** + /** * Array#indexOf (<=IE8) * * @parma {Array} arr @@ -5406,15 +5365,16 @@ exports.map = function(arr, fn, scope){ * @api private */ -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; -}; + exports.indexOf = function(arr, obj, start) { + for (let i = start || 0, l = arr.length; i < l; i++) { + if (arr[i] === obj) { + return i; + } + } + return -1; + }; -/** + /** * Array#reduce (<=IE8) * * @param {Array} array @@ -5423,17 +5383,17 @@ exports.indexOf = function(arr, obj, start){ * @api private */ -exports.reduce = function(arr, fn, val){ - var rval = val; + exports.reduce = function(arr, fn, val) { + let rval = val; - for (var i = 0, l = arr.length; i < l; i++) { - rval = fn(rval, arr[i], i, arr); - } + for (let i = 0, l = arr.length; i < l; i++) { + rval = fn(rval, arr[i], i, arr); + } - return rval; -}; + return rval; + }; -/** + /** * Array#filter (<=IE8) * * @param {Array} array @@ -5441,18 +5401,18 @@ exports.reduce = function(arr, fn, val){ * @api private */ -exports.filter = function(arr, fn){ - var ret = []; + exports.filter = function(arr, fn) { + const ret = []; - for (var i = 0, l = arr.length; i < l; i++) { - var val = arr[i]; - if (fn(val, i, arr)) ret.push(val); - } + for (let i = 0, l = arr.length; i < l; i++) { + const val = arr[i]; + if (fn(val, i, arr)) ret.push(val); + } - return ret; -}; + return ret; + }; -/** + /** * Object.keys (<=IE8) * * @param {Object} obj @@ -5460,20 +5420,20 @@ exports.filter = function(arr, fn){ * @api private */ -exports.keys = Object.keys || function(obj) { - var keys = [] - , has = Object.prototype.hasOwnProperty // for `window` on <=IE8 + exports.keys = Object.keys || function(obj) { + const keys = [] + ; const has = Object.prototype.hasOwnProperty; // for `window` on <=IE8 - for (var key in obj) { - if (has.call(obj, key)) { - keys.push(key); - } - } + for (const key in obj) { + if (has.call(obj, key)) { + keys.push(key); + } + } - return keys; -}; + return keys; + }; -/** + /** * Watch the given `files` for changes * and invoke `fn(file)` on modification. * @@ -5482,49 +5442,49 @@ exports.keys = Object.keys || function(obj) { * @api private */ -exports.watch = function(files, fn){ - var options = { interval: 100 }; - files.forEach(function(file){ - debug('file %s', file); - fs.watchFile(file, options, function(curr, prev){ - if (prev.mtime < curr.mtime) fn(file); - }); - }); -}; + exports.watch = function(files, fn) { + const options = {interval: 100}; + files.forEach(function(file) { + debug('file %s', file); + fs.watchFile(file, options, function(curr, prev) { + if (prev.mtime < curr.mtime) fn(file); + }); + }); + }; -/** + /** * Ignored files. */ -function ignored(path){ - return !~ignore.indexOf(path); -} + function ignored(path) { + return !~ignore.indexOf(path); + } -/** + /** * Lookup files in the given `dir`. * * @return {Array} * @api private */ -exports.files = function(dir, ret){ - ret = ret || []; + exports.files = function(dir, ret) { + ret = ret || []; - fs.readdirSync(dir) - .filter(ignored) - .forEach(function(path){ - path = join(dir, path); - if (fs.statSync(path).isDirectory()) { - exports.files(path, ret); - } else if (path.match(/\.(js|coffee|litcoffee|coffee.md)$/)) { - ret.push(path); - } - }); + fs.readdirSync(dir) + .filter(ignored) + .forEach(function(path) { + path = join(dir, path); + if (fs.statSync(path).isDirectory()) { + exports.files(path, ret); + } else if (path.match(/\.(js|coffee|litcoffee|coffee.md)$/)) { + ret.push(path); + } + }); - return ret; -}; + return ret; + }; -/** + /** * Compute a slug from the given `str`. * * @param {String} str @@ -5532,34 +5492,34 @@ exports.files = function(dir, ret){ * @api private */ -exports.slug = function(str){ - return str - .toLowerCase() - .replace(/ +/g, '-') - .replace(/[^-\w]/g, ''); -}; + exports.slug = function(str) { + return str + .toLowerCase() + .replace(/ +/g, '-') + .replace(/[^-\w]/g, ''); + }; -/** + /** * Strip the function definition from `str`, * and re-indent for pre whitespace. */ -exports.clean = function(str) { - str = str - .replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, '') - .replace(/^function *\(.*\) *{/, '') - .replace(/\s+\}$/, ''); + exports.clean = function(str) { + str = str + .replace(/\r\n?|[\n\u2028\u2029]/g, '\n').replace(/^\uFEFF/, '') + .replace(/^function *\(.*\) *{/, '') + .replace(/\s+\}$/, ''); - var spaces = str.match(/^\n?( *)/)[1].length - , tabs = str.match(/^\n?(\t*)/)[1].length - , re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm'); + const spaces = str.match(/^\n?( *)/)[1].length + ; const tabs = str.match(/^\n?(\t*)/)[1].length + ; const re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm'); - str = str.replace(re, ''); + str = str.replace(re, ''); - return exports.trim(str); -}; + return exports.trim(str); + }; -/** + /** * Escape regular expression characters in `str`. * * @param {String} str @@ -5567,11 +5527,11 @@ exports.clean = function(str) { * @api private */ -exports.escapeRegexp = function(str){ - return str.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); -}; + exports.escapeRegexp = function(str) { + return str.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); + }; -/** + /** * Trim the given `str`. * * @param {String} str @@ -5579,11 +5539,11 @@ exports.escapeRegexp = function(str){ * @api private */ -exports.trim = function(str){ - return str.replace(/^\s+|\s+$/g, ''); -}; + exports.trim = function(str) { + return str.replace(/^\s+|\s+$/g, ''); + }; -/** + /** * Parse the given `qs`. * * @param {String} qs @@ -5591,18 +5551,18 @@ exports.trim = function(str){ * @api private */ -exports.parseQuery = function(qs){ - return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){ - var i = pair.indexOf('=') - , key = pair.slice(0, i) - , val = pair.slice(++i); + exports.parseQuery = function(qs) { + return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair) { + let i = pair.indexOf('=') + ; const key = pair.slice(0, i) + ; const val = pair.slice(++i); - obj[key] = decodeURIComponent(val); - return obj; - }, {}); -}; + obj[key] = decodeURIComponent(val); + return obj; + }, {}); + }; -/** + /** * Highlight the given string of `js`. * * @param {String} js @@ -5610,47 +5570,48 @@ exports.parseQuery = function(qs){ * @api private */ -function highlight(js) { - return js - .replace(//g, '>') - .replace(/\/\/(.*)/gm, '//$1') - .replace(/('.*?')/gm, '$1') - .replace(/(\d+\.\d+)/gm, '$1') - .replace(/(\d+)/gm, '$1') - .replace(/\bnew *(\w+)/gm, 'new $1') - .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '$1') -} + function highlight(js) { + return js + .replace(//g, '>') + .replace(/\/\/(.*)/gm, '//$1') + .replace(/('.*?')/gm, '$1') + .replace(/(\d+\.\d+)/gm, '$1') + .replace(/(\d+)/gm, '$1') + .replace(/\bnew *(\w+)/gm, 'new $1') + .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '$1'); + } -/** + /** * Highlight the contents of tag `name`. * * @param {String} name * @api private */ -exports.highlightTags = function(name) { - var code = document.getElementsByTagName(name); - for (var i = 0, len = code.length; i < len; ++i) { - code[i].innerHTML = highlight(code[i].innerHTML); - } -}; - -}); // module: utils.js -// The global object is "self" in Web Workers. -global = (function() { return this; })(); + exports.highlightTags = function(name) { + const code = document.getElementsByTagName(name); + for (let i = 0, len = code.length; i < len; ++i) { + code[i].innerHTML = highlight(code[i].innerHTML); + } + }; + }); // module: utils.js + // The global object is "self" in Web Workers. + global = (function() { + return this; + })(); -/** + /** * 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; + const Date = global.Date; + const setTimeout = global.setTimeout; + const setInterval = global.setInterval; + const clearTimeout = global.clearTimeout; + const clearInterval = global.clearInterval; -/** + /** * Node shims. * * These are meant only to allow @@ -5659,133 +5620,135 @@ var clearInterval = global.clearInterval; * the browser. */ -var process = {}; -process.exit = function(status){}; -process.stdout = {}; + var process = {}; + process.exit = function(status) {}; + process.stdout = {}; -var uncaughtExceptionHandlers = []; + const uncaughtExceptionHandlers = []; -/** + /** * Remove uncaughtException listener. */ -process.removeListener = function(e, fn){ - if ('uncaughtException' == e) { - global.onerror = function() {}; - var i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn); - if (i != -1) { uncaughtExceptionHandlers.splice(i, 1); } - } -}; + process.removeListener = function(e, fn) { + if ('uncaughtException' == e) { + global.onerror = function() {}; + const i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn); + if (i != -1) { + uncaughtExceptionHandlers.splice(i, 1); + } + } + }; -/** + /** * Implements uncaughtException listener. */ -process.on = function(e, fn){ - if ('uncaughtException' == e) { - global.onerror = function(err, url, line){ - fn(new Error(err + ' (' + url + ':' + line + ')')); - return true; - }; - uncaughtExceptionHandlers.push(fn); - } -}; + process.on = function(e, fn) { + if ('uncaughtException' == e) { + global.onerror = function(err, url, line) { + fn(new Error(err + ' (' + url + ':' + line + ')')); + return true; + }; + uncaughtExceptionHandlers.push(fn); + } + }; -/** + /** * Expose mocha. */ -var Mocha = global.Mocha = require('mocha'), - mocha = global.mocha = new Mocha({ reporter: 'html' }); + var Mocha = global.Mocha = require('mocha'); + const mocha = global.mocha = new Mocha({reporter: 'html'}); -// 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'); + // 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 = [] - , immediateTimeout; + const immediateQueue = [] + ; let 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; + function timeslice() { + const 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); - } -}; + 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; -}; + 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; -}; + 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 ('string' == typeof opts) opts = { ui: opts }; - for (var opt in opts) this[opt](opts[opt]); - return this; -}; + mocha.setup = function(opts) { + if ('string' == typeof opts) opts = {ui: opts}; + for (const opt in opts) this[opt](opts[opt]); + return this; + }; -/** + /** * Run mocha, returning the Runner. */ -mocha.run = function(fn){ - var options = mocha.options; - mocha.globals('location'); + mocha.run = function(fn) { + const options = mocha.options; + mocha.globals('location'); - var query = Mocha.utils.parseQuery(global.location.search || ''); - if (query.grep) mocha.grep(query.grep); - if (query.invert) mocha.invert(); + const query = Mocha.utils.parseQuery(global.location.search || ''); + if (query.grep) mocha.grep(query.grep); + if (query.invert) mocha.invert(); - return Mocha.prototype.run.call(mocha, function(){ + return Mocha.prototype.run.call(mocha, function() { // The DOM Document is not available in Web Workers. - if (global.document) { - Mocha.utils.highlightTags('code'); - } - if (fn) fn(); - }); -}; + if (global.document) { + Mocha.utils.highlightTags('code'); + } + if (fn) fn(); + }); + }; -/** + /** * Expose the process shim. */ -Mocha.process = process; -})(); \ No newline at end of file + Mocha.process = process; +})(); diff --git a/test/mocha/support/compile.js b/test/mocha/support/compile.js index 39a5322..e7518a5 100644 --- a/test/mocha/support/compile.js +++ b/test/mocha/support/compile.js @@ -3,28 +3,28 @@ * Module dependencies. */ -var fs = require('fs'); +const fs = require('fs'); /** * Arguments. */ -var args = process.argv.slice(2) - , pending = args.length - , files = {}; +const args = process.argv.slice(2) + ; let pending = args.length + ; const files = {}; console.log(''); // parse arguments -args.forEach(function(file){ - var mod = file.replace('lib/', ''); - fs.readFile(file, 'utf8', function(err, js){ +args.forEach(function(file) { + const mod = file.replace('lib/', ''); + fs.readFile(file, 'utf8', function(err, js) { if (err) throw err; console.log(' \u001b[90mcompile : \u001b[0m\u001b[36m%s\u001b[0m', file); - files[file] = ~js.indexOf('require: off') - ? js - : parse(js); + files[file] = ~js.indexOf('require: off') ? + js : + parse(js); --pending || compile(); }); }); @@ -43,12 +43,12 @@ function parse(js) { function parseRequires(js) { return js - .replace(/require\('events'\)/g, "require('browser/events')") - .replace(/require\('debug'\)/g, "require('browser/debug')") - .replace(/require\('path'\)/g, "require('browser/path')") - .replace(/require\('diff'\)/g, "require('browser/diff')") - .replace(/require\('tty'\)/g, "require('browser/tty')") - .replace(/require\('fs'\)/g, "require('browser/fs')") + .replace(/require\('events'\)/g, 'require(\'browser/events\')') + .replace(/require\('debug'\)/g, 'require(\'browser/debug\')') + .replace(/require\('path'\)/g, 'require(\'browser/path\')') + .replace(/require\('diff'\)/g, 'require(\'browser/diff\')') + .replace(/require\('tty'\)/g, 'require(\'browser/tty\')') + .replace(/require\('fs'\)/g, 'require(\'browser/fs\')'); } /** @@ -57,12 +57,12 @@ function parseRequires(js) { function parseInheritance(js) { return js - .replace(/^ *(\w+)\.prototype\.__proto__ * = *(\w+)\.prototype *;?/gm, function(_, child, parent){ - return 'function F(){};\n' - + 'F.prototype = ' + parent + '.prototype;\n' - + child + '.prototype = new F;\n' - + child + '.prototype.constructor = '+ child + ';\n'; - }); + .replace(/^ *(\w+)\.prototype\.__proto__ * = *(\w+)\.prototype *;?/gm, function(_, child, parent) { + return 'function F(){};\n' + + 'F.prototype = ' + parent + '.prototype;\n' + + child + '.prototype = new F;\n' + + child + '.prototype.constructor = '+ child + ';\n'; + }); } /** @@ -70,21 +70,21 @@ function parseInheritance(js) { */ function compile() { - var buf = ''; + let buf = ''; buf += '\n// CommonJS require()\n\n'; buf += browser.require + '\n\n'; buf += 'require.modules = {};\n\n'; buf += 'require.resolve = ' + browser.resolve + ';\n\n'; buf += 'require.register = ' + browser.register + ';\n\n'; buf += 'require.relative = ' + browser.relative + ';\n\n'; - args.forEach(function(file){ - var js = files[file]; + args.forEach(function(file) { + const js = files[file]; file = file.replace('lib/', ''); buf += '\nrequire.register("' + file + '", function(module, exports, require){\n'; buf += js; buf += '\n}); // module: ' + file + '\n'; }); - fs.writeFile('_mocha.js', buf, function(err){ + fs.writeFile('_mocha.js', buf, function(err) { if (err) throw err; console.log(' \u001b[90m create : \u001b[0m\u001b[36m%s\u001b[0m', 'mocha.js'); console.log(); @@ -100,9 +100,9 @@ var browser = { * Require a module. */ - require: function require(p){ - var path = require.resolve(p) - , mod = require.modules[path]; + require: function require(p) { + const path = require.resolve(p) + ; const mod = require.modules[path]; if (!mod) throw new Error('failed to require "' + p + '"'); if (!mod.exports) { mod.exports = {}; @@ -115,13 +115,13 @@ var browser = { * Resolve module path. */ - resolve: function(path){ - var orig = path - , reg = path + '.js' - , index = path + '/index.js'; - return require.modules[reg] && reg - || require.modules[index] && index - || orig; + resolve: function(path) { + const orig = path + ; const reg = path + '.js' + ; const index = path + '/index.js'; + return require.modules[reg] && reg || + require.modules[index] && index || + orig; }, /** @@ -129,15 +129,15 @@ var browser = { */ relative: function(parent) { - return function(p){ + return function(p) { if ('.' != p.charAt(0)) return require(p); - var path = parent.split('/') - , segs = p.split('/'); + const path = parent.split('/') + ; const segs = p.split('/'); path.pop(); - for (var i = 0; i < segs.length; i++) { - var seg = segs[i]; + for (let i = 0; i < segs.length; i++) { + const seg = segs[i]; if ('..' == seg) path.pop(); else if ('.' != seg) path.push(seg); } @@ -150,7 +150,7 @@ var browser = { * Register a module. */ - register: function(path, fn){ + register: function(path, fn) { require.modules[path] = fn; - } + }, }; diff --git a/test/mocha/support/tail.js b/test/mocha/support/tail.js index 018add8..146c454 100644 --- a/test/mocha/support/tail.js +++ b/test/mocha/support/tail.js @@ -1,15 +1,17 @@ // The global object is "self" in Web Workers. -global = (function() { return this; })(); +global = (function() { + return this; +})(); /** * 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; +const Date = global.Date; +const setTimeout = global.setTimeout; +const setInterval = global.setInterval; +const clearTimeout = global.clearTimeout; +const clearInterval = global.clearInterval; /** * Node shims. @@ -20,21 +22,23 @@ var clearInterval = global.clearInterval; * the browser. */ -var process = {}; -process.exit = function(status){}; +const process = {}; +process.exit = function(status) {}; process.stdout = {}; -var uncaughtExceptionHandlers = []; +const uncaughtExceptionHandlers = []; /** * Remove uncaughtException listener. */ -process.removeListener = function(e, fn){ +process.removeListener = function(e, fn) { if ('uncaughtException' == e) { global.onerror = function() {}; - var i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn); - if (i != -1) { uncaughtExceptionHandlers.splice(i, 1); } + const i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn); + if (i != -1) { + uncaughtExceptionHandlers.splice(i, 1); + } } }; @@ -42,9 +46,9 @@ process.removeListener = function(e, fn){ * Implements uncaughtException listener. */ -process.on = function(e, fn){ +process.on = function(e, fn) { if ('uncaughtException' == e) { - global.onerror = function(err, url, line){ + global.onerror = function(err, url, line) { fn(new Error(err + ' (' + url + ':' + line + ')')); return true; }; @@ -56,19 +60,19 @@ process.on = function(e, fn){ * Expose mocha. */ -var Mocha = global.Mocha = require('mocha'), - mocha = global.mocha = new Mocha({ reporter: 'html' }); +var Mocha = global.Mocha = require('mocha'); +const mocha = global.mocha = new Mocha({reporter: 'html'}); // 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 = [] - , immediateTimeout; +const immediateQueue = [] + ; let immediateTimeout; function timeslice() { - var immediateStart = new Date().getTime(); + const immediateStart = new Date().getTime(); while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) { immediateQueue.shift()(); } @@ -96,7 +100,7 @@ Mocha.Runner.immediately = function(callback) { * only receive the 'message' attribute of the Error. */ mocha.throwError = function(err) { - Mocha.utils.forEach(uncaughtExceptionHandlers, function (fn) { + Mocha.utils.forEach(uncaughtExceptionHandlers, function(fn) { fn(err); }); throw err; @@ -107,7 +111,7 @@ mocha.throwError = function(err) { * Normally this would happen in Mocha.prototype.loadFiles. */ -mocha.ui = function(ui){ +mocha.ui = function(ui) { Mocha.prototype.ui.call(this, ui); this.suite.emit('pre-require', global, null, this); return this; @@ -117,9 +121,9 @@ mocha.ui = function(ui){ * Setup mocha with the given setting options. */ -mocha.setup = function(opts){ - if ('string' == typeof opts) opts = { ui: opts }; - for (var opt in opts) this[opt](opts[opt]); +mocha.setup = function(opts) { + if ('string' == typeof opts) opts = {ui: opts}; + for (const opt in opts) this[opt](opts[opt]); return this; }; @@ -127,15 +131,15 @@ mocha.setup = function(opts){ * Run mocha, returning the Runner. */ -mocha.run = function(fn){ - var options = mocha.options; +mocha.run = function(fn) { + const options = mocha.options; mocha.globals('location'); - var query = Mocha.utils.parseQuery(global.location.search || ''); + const query = Mocha.utils.parseQuery(global.location.search || ''); if (query.grep) mocha.grep(query.grep); if (query.invert) mocha.invert(); - return Mocha.prototype.run.call(mocha, function(){ + return Mocha.prototype.run.call(mocha, function() { // The DOM Document is not available in Web Workers. if (global.document) { Mocha.utils.highlightTags('code'); diff --git a/test/mocha/test/acceptance/context.js b/test/mocha/test/acceptance/context.js index e2af9d5..c86aabc 100644 --- a/test/mocha/test/acceptance/context.js +++ b/test/mocha/test/acceptance/context.js @@ -1,26 +1,26 @@ -describe('Context', function(){ - beforeEach(function(){ +describe('Context', function() { + beforeEach(function() { this.calls = ['before']; - }) + }); - describe('nested', function(){ - beforeEach(function(){ + describe('nested', function() { + beforeEach(function() { this.calls.push('before two'); - }) + }); - it('should work', function(){ + it('should work', function() { this.calls.should.eql(['before', 'before two']); this.calls.push('test'); - }) + }); - after(function(){ + after(function() { this.calls.should.eql(['before', 'before two', 'test']); this.calls.push('after two'); - }) - }) + }); + }); - after(function(){ + after(function() { this.calls.should.eql(['before', 'before two', 'test', 'after two']); - }) -}) \ No newline at end of file + }); +}); diff --git a/test/mocha/test/acceptance/diffs.js b/test/mocha/test/acceptance/diffs.js index 17c3dfa..27efa57 100644 --- a/test/mocha/test/acceptance/diffs.js +++ b/test/mocha/test/acceptance/diffs.js @@ -1,78 +1,78 @@ -var fs = require('fs') - , cssin = fs.readFileSync('test/acceptance/fixtures/css.in', 'ascii') - , cssout = fs.readFileSync('test/acceptance/fixtures/css.out', 'ascii'); +const fs = require('fs') + ; const cssin = fs.readFileSync('test/acceptance/fixtures/css.in', 'ascii') + ; const cssout = fs.readFileSync('test/acceptance/fixtures/css.out', 'ascii'); -describe('diffs', function(){ +describe('diffs', function() { // uncomment the assertions, and run with different params to check the output // ex: --color, --no-color, --unified-diff - it('should display a diff for small strings', function(){ - var expected = 'foo bar baz' - , actual = 'foo rar baz'; + it('should display a diff for small strings', function() { + const expected = 'foo bar baz' + ; const actual = 'foo rar baz'; // expected.should.eql(actual); }); - it('should display a diff of canonicalized objects', function(){ - var actual = { name: 'travis j', age: 23 } - , expected = { age: 23, name: 'travis' }; + it('should display a diff of canonicalized objects', function() { + const actual = {name: 'travis j', age: 23} + ; const expected = {age: 23, name: 'travis'}; - // actual.should.eql(expected); + // actual.should.eql(expected); }); - it('should display a diff for medium strings', function(){ - var expected = 'foo bar baz\nfoo bar baz\nfoo bar baz' - , actual = 'foo bar baz\nfoo rar baz\nfoo bar raz'; + it('should display a diff for medium strings', function() { + const expected = 'foo bar baz\nfoo bar baz\nfoo bar baz' + ; const actual = 'foo bar baz\nfoo rar baz\nfoo bar raz'; // expected.should.eql(actual); }); - it('should display a diff for entire object dumps', function(){ - var expected = { name: 'joe', age: 30, address: {city: 'new york', country: 'us' }} - , actual = { name: 'joel', age: 30, address: {city: 'new york', country: 'usa' }}; + it('should display a diff for entire object dumps', function() { + const expected = {name: 'joe', age: 30, address: {city: 'new york', country: 'us'}} + ; const actual = {name: 'joel', age: 30, address: {city: 'new york', country: 'usa'}}; - // actual.should.eql(expected); + // actual.should.eql(expected); }); - it('should display a diff for multi-line strings', function(){ - var expected = 'one two three\nfour five six\nseven eight nine'; - var actual = 'one two three\nfour zzzz six\nseven eight nine'; + it('should display a diff for multi-line strings', function() { + const expected = 'one two three\nfour five six\nseven eight nine'; + const actual = 'one two three\nfour zzzz six\nseven eight nine'; // actual.should.eql(expected); }); - it('should display a diff for entire object dumps', function(){ - var expected = { name: 'joe', age: 30, address: {city: 'new york', country: 'us' }} - var actual = { name: 'joel', age: 30, address: {city: 'new york', country: 'usa' }}; + it('should display a diff for entire object dumps', function() { + const expected = {name: 'joe', age: 30, address: {city: 'new york', country: 'us'}}; + const actual = {name: 'joel', age: 30, address: {city: 'new york', country: 'usa'}}; // actual.should.eql(expected); }); - it('should display a full-comparison with escaped special characters', function(){ - var expected = 'one\ttab\ntwo\t\ttabs'; - var actual = 'one\ttab\ntwo\t\t\ttabs'; + it('should display a full-comparison with escaped special characters', function() { + const expected = 'one\ttab\ntwo\t\ttabs'; + const actual = 'one\ttab\ntwo\t\t\ttabs'; - //actual.should.equal(expected); + // actual.should.equal(expected); }); - it('should display a word diff for large strings', function(){ + it('should display a word diff for large strings', function() { // cssin.should.equal(cssout); }); - it('should work with objects', function(){ - var tobi = { + it('should work with objects', function() { + const tobi = { name: 'tobi', species: 'ferret', color: 'white', - age: 2 + age: 2, }; - var loki = { + const loki = { name: 'loki', species: 'ferret', color: 'brown', - age: 2 + age: 2, }; // tobi.should.eql(loki); diff --git a/test/mocha/test/acceptance/duration.js b/test/mocha/test/acceptance/duration.js index 1f4c5c8..d95a27a 100644 --- a/test/mocha/test/acceptance/duration.js +++ b/test/mocha/test/acceptance/duration.js @@ -1,26 +1,26 @@ -describe('durations', function(){ - describe('when slow', function(){ - it('should highlight in red', function(done){ - setTimeout(function(){ +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(){ + 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(){ + describe('when fast', function() { + it('should highlight in green', function(done) { + setTimeout(function() { done(); }, 10); - }) - }) -}) + }); + }); +}); diff --git a/test/mocha/test/acceptance/fs.js b/test/mocha/test/acceptance/fs.js index 102b8e1..0b07a1d 100644 --- a/test/mocha/test/acceptance/fs.js +++ b/test/mocha/test/acceptance/fs.js @@ -1,18 +1,18 @@ -var fs = require('fs'); +const fs = require('fs'); -describe('fs.readFile()', function(){ - describe('when the file exists', function(){ - it('should succeed', function(done){ - fs.writeFile('/tmp/mocha', 'wahoo', done) - }) - }) +describe('fs.readFile()', function() { + describe('when the file exists', function() { + it('should succeed', function(done) { + fs.writeFile('/tmp/mocha', 'wahoo', done); + }); + }); - describe('when the file does not exist', function(){ - it('should fail', function(done){ + describe('when the file does not exist', function() { + it('should fail', function(done) { // uncomment // fs.readFile('/tmp/does-not-exist', done); done(); - }) - }) -}) + }); + }); +}); diff --git a/test/mocha/test/acceptance/glob/glob.js b/test/mocha/test/acceptance/glob/glob.js index b1127a2..1a60102 100644 --- a/test/mocha/test/acceptance/glob/glob.js +++ b/test/mocha/test/acceptance/glob/glob.js @@ -1,6 +1,6 @@ -describe('globbing test', function(){ - it('should find this test', function(){ +describe('globbing test', function() { + it('should find this test', function() { // see glob.sh for details - }) + }); }); diff --git a/test/mocha/test/acceptance/globals.js b/test/mocha/test/acceptance/globals.js index 815eaee..c673141 100644 --- a/test/mocha/test/acceptance/globals.js +++ b/test/mocha/test/acceptance/globals.js @@ -1,41 +1,41 @@ -describe('global leaks', function(){ - before(function(){ +describe('global leaks', function() { + before(function() { // uncomment to test // foo = 'hey'; // bar = 'hey'; - }) + }); - beforeEach(function(){ + beforeEach(function() { // uncomment to test // foo = 'bar' }); - it('should cause tests to fail', function(){ + it('should cause tests to fail', function() { // uncomment to test // foo = 'bar'; // bar = 'baz'; // baz = 'raz'; }); - it('should pass when accepted', function(){ + it('should pass when accepted', function() { global.okGlobalA = 1; global.okGlobalB = 1; global.okGlobalC = 1; - }) + }); - it('should pass with wildcard', function(){ + it('should pass with wildcard', function() { global.callback123 = 'foo'; global.callback345 = 'bar'; }); - it('should pass when prefixed "mocha-"', function(){ + 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 }; + global['mocha-example'] = {nodeType: 1}; }); - afterEach(function(){ + afterEach(function() { // uncomment to test // foo = 'bar' }); diff --git a/test/mocha/test/acceptance/http.js b/test/mocha/test/acceptance/http.js index 750d108..7be0af9 100644 --- a/test/mocha/test/acceptance/http.js +++ b/test/mocha/test/acceptance/http.js @@ -1,17 +1,17 @@ -var http = require('http'); +const http = require('http'); -var server = http.createServer(function(req, res){ +const 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){ +describe('http', function() { + it('should provide an example', function(done) { + http.get({path: '/', port: 8888}, function(res) { res.should.have.status(200); done(); - }) - }) -}) \ No newline at end of file + }); + }); +}); diff --git a/test/mocha/test/acceptance/interfaces/bdd.js b/test/mocha/test/acceptance/interfaces/bdd.js index f536aa0..5e453a5 100644 --- a/test/mocha/test/acceptance/interfaces/bdd.js +++ b/test/mocha/test/acceptance/interfaces/bdd.js @@ -1,35 +1,35 @@ -describe('Array', function(){ - describe('#indexOf()', function(){ - it('should return -1 when the value is not present', function(){ - [1,2,3].indexOf(5).should.equal(-1); - [1,2,3].indexOf(0).should.equal(-1); - }) +describe('Array', function() { + describe('#indexOf()', function() { + it('should return -1 when the value is not present', function() { + [1, 2, 3].indexOf(5).should.equal(-1); + [1, 2, 3].indexOf(0).should.equal(-1); + }); - it('should return the correct index when the value is present', function(){ - [1,2,3].indexOf(1).should.equal(0); - [1,2,3].indexOf(2).should.equal(1); - [1,2,3].indexOf(3).should.equal(2); - }) - }) -}) + it('should return the correct index when the value is present', function() { + [1, 2, 3].indexOf(1).should.equal(0); + [1, 2, 3].indexOf(2).should.equal(1); + [1, 2, 3].indexOf(3).should.equal(2); + }); + }); +}); -describe('Array', function(){ - describe('#pop()', function(){ - it('should remove and return the last value', function(){ - var arr = [1,2,3]; +describe('Array', function() { + describe('#pop()', function() { + it('should remove and return the last value', function() { + const arr = [1, 2, 3]; arr.pop().should.equal(3); - arr.should.eql([1,2]); - }) - }) -}) + arr.should.eql([1, 2]); + }); + }); +}); -context('Array', function(){ - beforeEach(function(){ - this.arr = [1,2,3]; - }) +context('Array', function() { + beforeEach(function() { + this.arr = [1, 2, 3]; + }); - specify('has a length property', function(){ + specify('has a length property', function() { this.arr.length.should.equal(3); - }) -}) + }); +}); diff --git a/test/mocha/test/acceptance/interfaces/exports.js b/test/mocha/test/acceptance/interfaces/exports.js index c93bf28..78f17c0 100644 --- a/test/mocha/test/acceptance/interfaces/exports.js +++ b/test/mocha/test/acceptance/interfaces/exports.js @@ -1,44 +1,44 @@ -var calls = []; +const calls = []; exports.Array = { - before: function(){ + 'before': function() { calls.push('before'); }, - after: function(){ + 'after': function() { calls.push('after'); calls.should.eql([ - 'before' - , 'before each' - , 'one' - , 'after each' - , 'before each' - , 'two' - , 'after each' - , 'after']); + 'before', + 'before each', + 'one', + 'after each', + 'before each', + 'two', + 'after each', + 'after']); }, '#indexOf()': { - beforeEach: function(){ + 'beforeEach': function() { calls.push('before each'); }, - afterEach: function(){ + 'afterEach': function() { calls.push('after each'); }, - 'should return -1 when the value is not present': function(){ + 'should return -1 when the value is not present': function() { calls.push('one'); - [1,2,3].indexOf(5).should.equal(-1); - [1,2,3].indexOf(0).should.equal(-1); + [1, 2, 3].indexOf(5).should.equal(-1); + [1, 2, 3].indexOf(0).should.equal(-1); }, - 'should return the correct index when the value is present': function(){ + 'should return the correct index when the value is present': function() { calls.push('two'); - [1,2,3].indexOf(1).should.equal(0); - [1,2,3].indexOf(2).should.equal(1); - [1,2,3].indexOf(3).should.equal(2); - } - } + [1, 2, 3].indexOf(1).should.equal(0); + [1, 2, 3].indexOf(2).should.equal(1); + [1, 2, 3].indexOf(3).should.equal(2); + }, + }, }; diff --git a/test/mocha/test/acceptance/interfaces/qunit.js b/test/mocha/test/acceptance/interfaces/qunit.js index dbdc5bb..e749a3c 100644 --- a/test/mocha/test/acceptance/interfaces/qunit.js +++ b/test/mocha/test/acceptance/interfaces/qunit.js @@ -5,13 +5,13 @@ function ok(expr, msg) { suite('Array'); -test('#length', function(){ - var arr = [1,2,3]; +test('#length', function() { + const arr = [1, 2, 3]; ok(arr.length == 3); }); -test('#indexOf()', function(){ - var arr = [1,2,3]; +test('#indexOf()', function() { + const arr = [1, 2, 3]; ok(arr.indexOf(1) == 0); ok(arr.indexOf(2) == 1); ok(arr.indexOf(3) == 2); @@ -19,6 +19,6 @@ test('#indexOf()', function(){ suite('String'); -test('#length', function(){ +test('#length', function() { ok('foo'.length == 3); -}); \ No newline at end of file +}); diff --git a/test/mocha/test/acceptance/interfaces/tdd.js b/test/mocha/test/acceptance/interfaces/tdd.js index 33311dd..e4ff6b9 100644 --- a/test/mocha/test/acceptance/interfaces/tdd.js +++ b/test/mocha/test/acceptance/interfaces/tdd.js @@ -1,40 +1,40 @@ -suite('Array', function(){ - suite('#indexOf()', function(){ - var initialValue = 32; +suite('Array', function() { + suite('#indexOf()', function() { + let initialValue = 32; - suiteSetup(function(done){ + suiteSetup(function(done) { initialValue.should.eql(32); initialValue = 42; done(); }); - test('should return -1 when the value is not present', function(){ + test('should return -1 when the value is not present', function() { initialValue.should.eql(42); - [1,2,3].indexOf(5).should.equal(-1); - [1,2,3].indexOf(0).should.equal(-1); + [1, 2, 3].indexOf(5).should.equal(-1); + [1, 2, 3].indexOf(0).should.equal(-1); }); - test('should return the correct index when the value is present', function(){ + test('should return the correct index when the value is present', function() { initialValue.should.eql(42); - [1,2,3].indexOf(1).should.equal(0); - [1,2,3].indexOf(2).should.equal(1); - [1,2,3].indexOf(3).should.equal(2); + [1, 2, 3].indexOf(1).should.equal(0); + [1, 2, 3].indexOf(2).should.equal(1); + [1, 2, 3].indexOf(3).should.equal(2); }); - test.skip('should skip this test', function(){ - var zero = 0; + test.skip('should skip this test', function() { + const zero = 0; zero.should.equal(1, 'this test should have been skipped'); }); - suite.skip('should skip this suite', function(){ - test('should skip this test', function(){ - var zero = 0; + suite.skip('should skip this suite', function() { + test('should skip this test', function() { + const zero = 0; zero.should.equal(1, 'this test should have been skipped'); }); }); - suiteTeardown(function(done){ + suiteTeardown(function(done) { initialValue.should.eql(42); done(); }); diff --git a/test/mocha/test/acceptance/misc/asyncOnly.js b/test/mocha/test/acceptance/misc/asyncOnly.js index e03251f..191033a 100644 --- a/test/mocha/test/acceptance/misc/asyncOnly.js +++ b/test/mocha/test/acceptance/misc/asyncOnly.js @@ -1,10 +1,10 @@ -describe('asyncOnly', function(){ - it('should display an error', function(){ +describe('asyncOnly', function() { + it('should display an error', function() { - }) + }); - it('should pass', function(done){ + it('should pass', function(done) { done(); - }) -}) + }); +}); diff --git a/test/mocha/test/acceptance/misc/bail.js b/test/mocha/test/acceptance/misc/bail.js index 0628b2f..0ef05ae 100644 --- a/test/mocha/test/acceptance/misc/bail.js +++ b/test/mocha/test/acceptance/misc/bail.js @@ -1,21 +1,20 @@ -describe('bail', function(){ - it('should only display this error', function(done){ +describe('bail', function() { + it('should only display this error', function(done) { throw new Error('this should be displayed'); - }) + }); - it('should not display this error', function(done){ + it('should not display this error', function(done) { throw new Error('this should not be displayed'); - }) -}) + }); +}); -describe('bail-2', function(){ - - before(function(done){ +describe('bail-2', function() { + before(function(done) { throw new Error('this hook should not be displayed'); - }) + }); - it('should not display this error', function(done){ + it('should not display this error', function(done) { throw new Error('this should not be displayed'); - }) -}) + }); +}); diff --git a/test/mocha/test/acceptance/misc/cascade.js b/test/mocha/test/acceptance/misc/cascade.js index 0f884a0..0fc5f0a 100644 --- a/test/mocha/test/acceptance/misc/cascade.js +++ b/test/mocha/test/acceptance/misc/cascade.js @@ -1,58 +1,58 @@ -describe('one', function(){ - before(function(){ +describe('one', function() { + before(function() { console.log('before one'); - }) + }); - after(function(){ + after(function() { console.log('after one'); - }) + }); - beforeEach(function(){ + beforeEach(function() { console.log(' before each one'); - }) + }); - afterEach(function(){ + afterEach(function() { console.log(' after each one'); - }) + }); - describe('two', function(){ - before(function(){ + describe('two', function() { + before(function() { console.log(' before two'); - }) + }); - after(function(){ + after(function() { console.log(' after two'); - }) + }); - beforeEach(function(){ + beforeEach(function() { console.log(' before each two'); - }) + }); - afterEach(function(){ + afterEach(function() { console.log(' after each two'); - }) + }); - describe('three', function(){ - before(function(){ + describe('three', function() { + before(function() { console.log(' before three'); - }) + }); - after(function(){ + after(function() { console.log(' after three'); - }) + }); - beforeEach(function(){ + beforeEach(function() { console.log(' before each three'); - }) + }); - afterEach(function(){ + afterEach(function() { console.log(' after each three'); - }) + }); - it('should three', function(){ + it('should three', function() { console.log(' TEST three'); - }) - }) - }) -}) + }); + }); + }); +}); diff --git a/test/mocha/test/acceptance/misc/exit.js b/test/mocha/test/acceptance/misc/exit.js index 4cace0b..e6683a5 100644 --- a/test/mocha/test/acceptance/misc/exit.js +++ b/test/mocha/test/acceptance/misc/exit.js @@ -1,13 +1,13 @@ -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){ +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){ + it('should take a long time to exit if called with --no-exit', function(done) { done(); setTimeout(function() { console.log('all done'); - }, 2500) - }) -}) + }, 2500); + }); +}); diff --git a/test/mocha/test/acceptance/misc/grep.js b/test/mocha/test/acceptance/misc/grep.js index 9bfe0c5..e4a5045 100644 --- a/test/mocha/test/acceptance/misc/grep.js +++ b/test/mocha/test/acceptance/misc/grep.js @@ -1,22 +1,22 @@ -describe('grep', function(){ - describe('fast', function(){ - it('should run fast', function(){ +describe('grep', function() { + describe('fast', function() { + it('should run fast', function() { - }) + }); - it('should run fast again', function(){ + it('should run fast again', function() { - }) - }) + }); + }); - describe('slow', function(){ - it('should run slow', function(done){ + describe('slow', function() { + it('should run slow', function(done) { setTimeout(done, 1000); - }) + }); - it('should run slow again', function(done){ + it('should run slow again', function(done) { setTimeout(done, 1000); - }) - }) -}) + }); + }); +}); diff --git a/test/mocha/test/acceptance/misc/many.js b/test/mocha/test/acceptance/misc/many.js index c479ae4..4fe9fd9 100644 --- a/test/mocha/test/acceptance/misc/many.js +++ b/test/mocha/test/acceptance/misc/many.js @@ -1,27 +1,26 @@ // 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(){ +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); + const iterations = (process.env.big_number || 1e7); function work() { - var a = 0; - for(var i=0; i= 1', function(){ - it('should be .async', function(){ - var run = new Runnable('foo', function(done){}); + describe('when arity >= 1', function() { + it('should be .async', function() { + const 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(){}); + describe('when arity == 0', function() { + it('should be .sync', function() { + const 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(){}); + describe('#globals', function() { + it('should allow for whitelisting globals', function(done) { + const test = new Runnable('foo', function() {}); test.async.should.be.equal(0); test.sync.should.be.true; test.globals(['foobar']); test.run(done); - }) - }) + }); + }); - describe('.run(fn)', function(){ - describe('when .pending', function(){ - it('should not invoke the callback', function(done){ - var test = new Runnable('foo', function(){ + describe('.run(fn)', function() { + describe('when .pending', function() { + it('should not invoke the callback', function(done) { + const 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(){ + }); + }); + + describe('when sync', function() { + describe('without error', function() { + it('should invoke the callback', function(done) { + let calls = 0; + const test = new Runnable('foo', function() { ++calls; }); - test.run(function(err){ + 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(){ + }); + }); + }); + + describe('when an exception is thrown', function() { + it('should invoke the callback', function(done) { + let calls = 0; + const test = new Runnable('foo', function() { ++calls; throw new Error('fail'); }); - test.run(function(err){ + test.run(function(err) { calls.should.equal(1); err.message.should.equal('fail'); 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){ + }); + }); + }); + }); + + describe('when async', function() { + describe('without error', function() { + it('should invoke the callback', function(done) { + const calls = 0; + const 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; + describe('when the callback is invoked several times', function() { + describe('without an error', function() { + it('should emit a single "error" event', function(done) { + let calls = 0; + let errCalls = 0; - var test = new Runnable('foo', function(done){ + const test = new Runnable('foo', function(done) { process.nextTick(done); process.nextTick(done); process.nextTick(done); process.nextTick(done); }); - test.on('error', function(err){ + test.on('error', function(err) { ++errCalls; err.message.should.equal('done() called multiple times'); calls.should.equal(1); @@ -159,18 +159,18 @@ describe('Runnable(title, fn)', function(){ done(); }); - test.run(function(){ + test.run(function() { ++calls; }); - }) - }) + }); + }); - describe('with an error', function(){ - it('should emit a single "error" event', function(done){ - var calls = 0; - var errCalls = 0; + describe('with an error', function() { + it('should emit a single "error" event', function(done) { + let calls = 0; + let errCalls = 0; - var test = new Runnable('foo', function(done){ + const test = new Runnable('foo', function(done) { done(new Error('fail')); process.nextTick(done); done(new Error('fail')); @@ -178,7 +178,7 @@ describe('Runnable(title, fn)', function(){ process.nextTick(done); }); - test.on('error', function(err){ + test.on('error', function(err) { ++errCalls; err.message.should.equal('fail'); calls.should.equal(1); @@ -186,61 +186,60 @@ describe('Runnable(title, fn)', function(){ done(); }); - test.run(function(){ + 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){ + }); + }); + }); + + describe('when an exception is thrown', function() { + it('should invoke the callback', function(done) { + const calls = 0; + const test = new Runnable('foo', function(done) { throw new Error('fail'); process.nextTick(done); }); - test.run(function(err){ + test.run(function(err) { err.message.should.equal('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){ + describe('when an error is passed', function() { + it('should invoke the callback', function(done) { + const calls = 0; + const test = new Runnable('foo', function(done) { done(new Error('fail')); }); - test.run(function(err){ + test.run(function(err) { err.message.should.equal('fail'); done(); }); - }) - }) + }); + }); - it('should allow updating the timeout', function(done){ - var callCount = 0; - var increment = function() { + it('should allow updating the timeout', function(done) { + let callCount = 0; + const increment = function() { callCount++; }; - var test = new Runnable('foo', function(done){ + const test = new Runnable('foo', function(done) { setTimeout(increment, 1); setTimeout(increment, 100); }); test.timeout(10); - test.run(function(err){ + test.run(function(err) { err.should.be.ok; callCount.should.equal(1); done(); }); - }) - - it('should allow a timeout of 0') - }) + }); - }) -}) + it('should allow a timeout of 0'); + }); + }); +}); diff --git a/test/mocha/test/runner.js b/test/mocha/test/runner.js index 0d6d202..4af2095 100644 --- a/test/mocha/test/runner.js +++ b/test/mocha/test/runner.js @@ -1,58 +1,58 @@ -var mocha = require('../') - , Suite = mocha.Suite - , Runner = mocha.Runner - , Test = mocha.Test; +const mocha = require('../') + ; const Suite = mocha.Suite + ; const Runner = mocha.Runner + ; const Test = mocha.Test; -describe('Runner', function(){ - var suite, runner; +describe('Runner', function() { + let suite; let runner; - beforeEach(function(){ + beforeEach(function() { suite = new Suite(null, 'root'); runner = new Runner(suite); - }) + }); - describe('.grep()', function(){ - it('should update the runner.total with number of matched tests', function(){ + describe('.grep()', function() { + it('should update the runner.total with number of matched tests', function() { suite.addTest(new Test('im a test about lions')); suite.addTest(new Test('im another test about lions')); suite.addTest(new Test('im a test about bears')); - var newRunner = new Runner(suite); + const 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(){ + it('should update the runner.total with number of matched tests when inverted', function() { suite.addTest(new Test('im a test about lions')); suite.addTest(new Test('im another test about lions')); suite.addTest(new Test('im a test about bears')); - var newRunner = new Runner(suite); + const 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(){ + describe('.grepTotal()', function() { + it('should return the total number of matched tests', function() { suite.addTest(new Test('im a test about lions')); suite.addTest(new Test('im another test about lions')); suite.addTest(new Test('im a test about bears')); runner.grep(/lions/); runner.grepTotal(suite).should.equal(2); - }) + }); - it('should return the total number of matched tests when inverted', function(){ + it('should return the total number of matched tests when inverted', function() { suite.addTest(new Test('im a test about lions')); suite.addTest(new Test('im another test about lions')); suite.addTest(new Test('im a test about bears')); runner.grep(/lions/, true); runner.grepTotal(suite).should.equal(1); - }) - }) + }); + }); - describe('.globalProps()', function(){ + describe('.globalProps()', function() { it('should include common non enumerable globals', function() { - var props = runner.globalProps(); + const props = runner.globalProps(); props.should.include('setTimeout'); props.should.include('clearTimeout'); props.should.include('setInterval'); @@ -62,19 +62,19 @@ describe('Runner', function(){ }); }); - describe('.globals()', function(){ - it('should default to the known globals', function(){ + describe('.globals()', function() { + it('should default to the known globals', function() { runner.globals().length.should.be.above(16); - }) + }); - it('should white-list globals', function(){ + it('should white-list globals', function() { runner.globals(['foo', 'bar']); runner.globals().should.include('foo'); runner.globals().should.include('bar'); - }) - }) + }); + }); - describe('.checkGlobals(test)', function(){ + describe('.checkGlobals(test)', function() { it('should allow variables that match a wildcard', function(done) { runner.globals(['foo*', 'giz*']); global.foo = 'baz'; @@ -82,30 +82,30 @@ describe('Runner', function(){ runner.checkGlobals(); delete global.foo; delete global.gizmo; - done() - }) + done(); + }); - it('should emit "fail" when a new global is introduced', function(done){ + it('should emit "fail" when a new global is introduced', function(done) { runner.checkGlobals(); global.foo = 'bar'; - runner.on('fail', function(test, err){ + runner.on('fail', function(test, err) { test.should.equal('im a test'); err.message.should.equal('global leak detected: foo'); delete global.foo; done(); }); runner.checkGlobals('im a test'); - }) + }); - it ('should not fail when a new common global is introduced', function(){ + 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'); + const test = new Test('im a test about bears'); suite.addTest(test); - var newRunner = new Runner(suite); + const newRunner = new Runner(suite); // make the prop enumerable again. global.XMLHttpRequest = function() {}; @@ -119,11 +119,11 @@ describe('Runner', function(){ delete global.XMLHttpRequest; }); - it('should pluralize the error message when several are introduced', function(done){ + it('should pluralize the error message when several are introduced', function(done) { runner.checkGlobals(); global.foo = 'bar'; global.bar = 'baz'; - runner.on('fail', function(test, err){ + runner.on('fail', function(test, err) { test.should.equal('im a test'); err.message.should.equal('global leaks detected: foo, bar'); delete global.foo; @@ -131,14 +131,14 @@ describe('Runner', function(){ done(); }); runner.checkGlobals('im a test'); - }) + }); it('should respect per test whitelisted globals', function() { - var test = new Test('im a test about lions'); + const test = new Test('im a test about lions'); test.globals(['foo']); suite.addTest(test); - var runner = new Runner(suite); + const runner = new Runner(suite); global.foo = 'bar'; @@ -147,84 +147,86 @@ describe('Runner', function(){ 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'); + const test = new Test('im a test about lions'); test.globals(['foo']); suite.addTest(test); global.foo = 'bar'; global.bar = 'baz'; - runner.on('fail', function(test, err){ + runner.on('fail', function(test, err) { test.title.should.equal('im a test about lions'); err.message.should.equal('global leak detected: bar'); delete global.foo; done(); }); runner.checkGlobals(test); - }) - }) + }); + }); - describe('.fail(test, err)', function(){ - it('should increment .failures', function(){ + describe('.fail(test, err)', function() { + it('should increment .failures', function() { runner.failures.should.equal(0); runner.fail({}, {}); runner.failures.should.equal(1); runner.fail({}, {}); runner.failures.should.equal(2); - }) + }); - it('should set test.state to "failed"', function(){ - var test = {}; + it('should set test.state to "failed"', function() { + const test = {}; runner.fail(test, 'some error'); test.state.should.equal('failed'); - }) + }); - it('should emit "fail"', function(done){ - var test = {}, err = {}; - runner.on('fail', function(test, err){ + it('should emit "fail"', function(done) { + const test = {}; const err = {}; + runner.on('fail', function(test, err) { test.should.equal(test); err.should.equal(err); done(); }); runner.fail(test, err); - }) - }) + }); + }); - describe('.failHook(hook, err)', function(){ - it('should increment .failures', function(){ + describe('.failHook(hook, err)', function() { + it('should increment .failures', function() { runner.failures.should.equal(0); runner.failHook({}, {}); runner.failures.should.equal(1); runner.failHook({}, {}); runner.failures.should.equal(2); - }) + }); - it('should emit "fail"', function(done){ - var hook = {}, err = {}; - runner.on('fail', function(hook, err){ + it('should emit "fail"', function(done) { + const hook = {}; const err = {}; + runner.on('fail', function(hook, err) { hook.should.equal(hook); err.should.equal(err); done(); }); runner.failHook(hook, err); - }) + }); - it('should emit "end" if suite bail is true', function(done){ - var hook = {}, err = {}; + it('should emit "end" if suite bail is true', function(done) { + const hook = {}; const err = {}; suite.bail(true); runner.on('end', done); runner.failHook(hook, err); - }) + }); - it('should not emit "end" if suite bail is not true', function(done){ - var hook = {}, err = {}; + it('should not emit "end" if suite bail is not true', function(done) { + const hook = {}; const err = {}; suite.bail(false); - runner.on('end', function() { throw new Error('"end" was emit, but the bail is false'); }); + runner.on('end', function() { + throw new Error('"end" was emit, but the bail is false'); + }); runner.failHook(hook, err); done(); - }) - }) -}) + }); + }); +}); diff --git a/test/mocha/test/suite.js b/test/mocha/test/suite.js index 8cacff8..945c076 100644 --- a/test/mocha/test/suite.js +++ b/test/mocha/test/suite.js @@ -1,12 +1,12 @@ -var mocha = require('../') - , Context = mocha.Context - , Suite = mocha.Suite - , Test = mocha.Test; - -describe('Suite', function(){ - describe('.clone()', function(){ - beforeEach(function(){ +const mocha = require('../') + ; const Context = mocha.Context + ; const Suite = mocha.Suite + ; const 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; @@ -19,186 +19,186 @@ describe('Suite', function(){ this.suite._afterAll.push(5); }); - it('should copy the title', function(){ + it('should copy the title', function() { this.suite.clone().title.should.equal('To be cloned'); }); - it('should copy the timeout value', function(){ + it('should copy the timeout value', function() { this.suite.clone().timeout().should.equal(3043); }); - it('should copy the slow value', function(){ + it('should copy the slow value', function() { this.suite.clone().slow().should.equal(101); }); - it('should copy the bail value', function(){ + 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(){ + 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(){ + 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(){ + 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(){ + 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(){ + 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(){ + it('should not copy the values from the _afterAll array', function() { this.suite.clone()._afterAll.should.be.empty; }); }); - describe('.timeout()', function(){ - beforeEach(function(){ + 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(){ + 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); + describe('when argument is passed', function() { + it('should return the Suite object', function() { + const newSuite = this.suite.timeout(5000); newSuite.timeout().should.equal(5000); }); }); }); - describe('.slow()', function(){ - beforeEach(function(){ + describe('.slow()', function() { + beforeEach(function() { this.suite = new Suite('A Suite'); }); - describe('when given a string', function(){ - it('should parse it', function(){ + 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(){ + 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); + describe('when argument is passed', function() { + it('should return the Suite object', function() { + const newSuite = this.suite.slow(5000); newSuite.slow().should.equal(5000); }); }); }); - describe('.bail()', function(){ - beforeEach(function(){ + describe('.bail()', function() { + beforeEach(function() { this.suite = new Suite('A Suite'); - this.suite._bail = true + this.suite._bail = true; }); - describe('when no argument is passed', function(){ - it('should return the bail value', function(){ + 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); + describe('when argument is passed', function() { + it('should return the Suite object', function() { + const newSuite = this.suite.bail(false); newSuite.bail().should.be.false; }); }); }); - describe('.beforeAll()', function(){ - beforeEach(function(){ + 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(){ - function fn(){} + describe('wraps the passed in function in a Hook', function() { + it('adds it to _beforeAll', function() { + function fn() {} this.suite.beforeAll(fn); this.suite._beforeAll.should.have.length(1); - var beforeAllItem = this.suite._beforeAll[0]; + const beforeAllItem = this.suite._beforeAll[0]; beforeAllItem.title.should.equal('"before all" hook'); beforeAllItem.fn.should.equal(fn); }); }); }); - describe('.afterAll()', function(){ - beforeEach(function(){ + 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(){ - function fn(){} + describe('wraps the passed in function in a Hook', function() { + it('adds it to _afterAll', function() { + function fn() {} this.suite.afterAll(fn); this.suite._afterAll.should.have.length(1); - var afterAllItem = this.suite._afterAll[0]; + const afterAllItem = this.suite._afterAll[0]; afterAllItem.title.should.equal('"after all" hook'); afterAllItem.fn.should.equal(fn); }); }); }); - describe('.beforeEach()', function(){ - beforeEach(function(){ + 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(){ - function fn(){} + describe('wraps the passed in function in a Hook', function() { + it('adds it to _beforeEach', function() { + function fn() {} this.suite.beforeEach(fn); this.suite._beforeEach.should.have.length(1); - var beforeEachItem = this.suite._beforeEach[0]; + const beforeEachItem = this.suite._beforeEach[0]; beforeEachItem.title.should.equal('"before each" hook'); beforeEachItem.fn.should.equal(fn); }); }); }); - describe('.afterEach()', function(){ - beforeEach(function(){ + 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(){ - function fn(){} + describe('wraps the passed in function in a Hook', function() { + it('adds it to _afterEach', function() { + function fn() {} this.suite.afterEach(fn); this.suite._afterEach.should.have.length(1); - var afterEachItem = this.suite._afterEach[0]; + const afterEachItem = this.suite._afterEach[0]; afterEachItem.title.should.equal('"after each" hook'); afterEachItem.fn.should.equal(fn); }); }); }); - describe('.addSuite()', function(){ - beforeEach(function(){ + describe('.addSuite()', function() { + beforeEach(function() { this.first = new Suite('First suite'); this.first.timeout(4002); this.first.slow(200); @@ -206,19 +206,19 @@ describe('Suite', function(){ this.first.addSuite(this.second); }); - it('sets the parent on the added Suite', function(){ + it('sets the parent on the added Suite', function() { this.second.parent.should.equal(this.first); }); - it('copies the timeout value', function(){ + it('copies the timeout value', function() { this.second.timeout().should.equal(4002); }); - it('copies the slow value', function(){ + it('copies the slow value', function() { this.second.slow().should.equal(200); }); - it('adds the suite to the suites collection', function(){ + it('adds the suite to the suites collection', function() { this.first.suites.should.have.length(1); this.first.suites[0].should.equal(this.second); }); @@ -246,39 +246,39 @@ describe('Suite', function(){ // }); // }); - describe('.fullTitle()', function(){ - beforeEach(function(){ + describe('.fullTitle()', function() { + beforeEach(function() { this.suite = new Suite('A Suite'); }); - describe('when there is no parent', function(){ - it('returns the suite title', function(){ + 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'); + describe('when there is a parent', function() { + it('returns the combination of parent\'s and suite\'s title', function() { + const 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(){ + 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(){ + 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(){ + 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); @@ -286,45 +286,50 @@ describe('Suite', function(){ }); }); - describe('.eachTest(fn)', function(){ - beforeEach(function(){ + 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++; } + describe('when there are no nested suites or tests', function() { + it('should return 0', function() { + let 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(){ + 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++; } + let 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(){ + 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'); + const 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++; } + let n = 0; + function fn() { + n++; + } this.suite.eachTest(fn); n.should.equal(2); }); }); - }); }); diff --git a/test/mocha/test/utils.js b/test/mocha/test/utils.js index f5ea9dc..6c4d5d3 100644 --- a/test/mocha/test/utils.js +++ b/test/mocha/test/utils.js @@ -1,20 +1,20 @@ -var mocha = require('..'); -var utils = mocha.utils; -var clean = utils.clean; +const mocha = require('..'); +const utils = mocha.utils; +const clean = utils.clean; -describe('utils', function(){ - describe('.clean()', function(){ - it('should remove the wrapping function declaration', function(){ +describe('utils', function() { + describe('.clean()', function() { + it('should remove the wrapping function declaration', function() { clean('function (one, two, three) {\n//code\n}').should.equal('//code'); - }) + }); - it('should remove space character indentation from the function body', function(){ + 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(){ + it('should remove tab character indentation from the function body', function() { clean('\t//line1\n\t\t//line2').should.equal('//line1\n\t//line2'); - }) - }) -}) + }); + }); +}); diff --git a/test/qunit/async.js b/test/qunit/async.js index 7187d74..7c68bb8 100644 --- a/test/qunit/async.js +++ b/test/qunit/async.js @@ -1,6 +1,6 @@ QUnit.start(); -test("just a test", function() { - expect(1); - ok(true); +test('just a test', function() { + expect(1); + ok(true); }); diff --git a/test/qunit/deepEqual.js b/test/qunit/deepEqual.js index 3de7dc0..89c6ec7 100644 --- a/test/qunit/deepEqual.js +++ b/test/qunit/deepEqual.js @@ -1,1464 +1,1464 @@ -module("equiv"); - - -test("Primitive types and constants", function () { - equal(QUnit.equiv(null, null), true, "null"); - equal(QUnit.equiv(null, {}), false, "null"); - equal(QUnit.equiv(null, undefined), false, "null"); - equal(QUnit.equiv(null, 0), false, "null"); - equal(QUnit.equiv(null, false), false, "null"); - equal(QUnit.equiv(null, ''), false, "null"); - equal(QUnit.equiv(null, []), false, "null"); - - equal(QUnit.equiv(undefined, undefined), true, "undefined"); - equal(QUnit.equiv(undefined, null), false, "undefined"); - equal(QUnit.equiv(undefined, 0), false, "undefined"); - equal(QUnit.equiv(undefined, false), false, "undefined"); - equal(QUnit.equiv(undefined, {}), false, "undefined"); - equal(QUnit.equiv(undefined, []), false, "undefined"); - equal(QUnit.equiv(undefined, ""), false, "undefined"); - - // Nan usually doest not equal to Nan using the '==' operator. - // Only isNaN() is able to do it. - equal(QUnit.equiv(0/0, 0/0), true, "NaN"); // NaN VS NaN - equal(QUnit.equiv(1/0, 2/0), true, "Infinity"); // Infinity VS Infinity - equal(QUnit.equiv(-1/0, 2/0), false, "-Infinity, Infinity"); // -Infinity VS Infinity - equal(QUnit.equiv(-1/0, -2/0), true, "-Infinity, -Infinity"); // -Infinity VS -Infinity - equal(QUnit.equiv(0/0, 1/0), false, "NaN, Infinity"); // Nan VS Infinity - equal(QUnit.equiv(1/0, 0/0), false, "NaN, Infinity"); // Nan VS Infinity - equal(QUnit.equiv(0/0, null), false, "NaN"); - equal(QUnit.equiv(0/0, undefined), false, "NaN"); - equal(QUnit.equiv(0/0, 0), false, "NaN"); - equal(QUnit.equiv(0/0, false), false, "NaN"); - equal(QUnit.equiv(0/0, function () {}), false, "NaN"); - equal(QUnit.equiv(1/0, null), false, "NaN, Infinity"); - equal(QUnit.equiv(1/0, undefined), false, "NaN, Infinity"); - equal(QUnit.equiv(1/0, 0), false, "NaN, Infinity"); - equal(QUnit.equiv(1/0, 1), false, "NaN, Infinity"); - equal(QUnit.equiv(1/0, false), false, "NaN, Infinity"); - equal(QUnit.equiv(1/0, true), false, "NaN, Infinity"); - equal(QUnit.equiv(1/0, function () {}), false, "NaN, Infinity"); - - equal(QUnit.equiv(0, 0), true, "number"); - equal(QUnit.equiv(0, 1), false, "number"); - equal(QUnit.equiv(1, 0), false, "number"); - equal(QUnit.equiv(1, 1), true, "number"); - equal(QUnit.equiv(1.1, 1.1), true, "number"); - equal(QUnit.equiv(0.0000005, 0.0000005), true, "number"); - equal(QUnit.equiv(0, ''), false, "number"); - equal(QUnit.equiv(0, '0'), false, "number"); - equal(QUnit.equiv(1, '1'), false, "number"); - equal(QUnit.equiv(0, false), false, "number"); - equal(QUnit.equiv(1, true), false, "number"); - - equal(QUnit.equiv(true, true), true, "boolean"); - equal(QUnit.equiv(true, false), false, "boolean"); - equal(QUnit.equiv(false, true), false, "boolean"); - equal(QUnit.equiv(false, 0), false, "boolean"); - equal(QUnit.equiv(false, null), false, "boolean"); - equal(QUnit.equiv(false, undefined), false, "boolean"); - equal(QUnit.equiv(true, 1), false, "boolean"); - equal(QUnit.equiv(true, null), false, "boolean"); - equal(QUnit.equiv(true, undefined), false, "boolean"); - - equal(QUnit.equiv('', ''), true, "string"); - equal(QUnit.equiv('a', 'a'), true, "string"); - equal(QUnit.equiv("foobar", "foobar"), true, "string"); - equal(QUnit.equiv("foobar", "foo"), false, "string"); - equal(QUnit.equiv('', 0), false, "string"); - equal(QUnit.equiv('', false), false, "string"); - equal(QUnit.equiv('', null), false, "string"); - equal(QUnit.equiv('', undefined), false, "string"); - - // Rename for lint validation. - // We know this is bad, we are asserting whether we can coop with bad code like this. - var SafeNumber = Number, SafeString = String, SafeBoolean = Boolean, SafeObject = Object; - - // primitives vs. objects - - equal(QUnit.equiv(0, new SafeNumber()), true, "primitives vs. objects"); - equal(QUnit.equiv(new SafeNumber(), 0), true, "primitives vs. objects"); - equal(QUnit.equiv(1, new SafeNumber(1)), true, "primitives vs. objects"); - equal(QUnit.equiv(new SafeNumber(1), 1), true, "primitives vs. objects"); - equal(QUnit.equiv(new SafeNumber(0), 1), false, "primitives vs. objects"); - equal(QUnit.equiv(0, new SafeNumber(1)), false, "primitives vs. objects"); - - equal(QUnit.equiv(new SafeString(), ""), true, "primitives vs. objects"); - equal(QUnit.equiv("", new SafeString()), true, "primitives vs. objects"); - equal(QUnit.equiv(new SafeString("My String"), "My String"), true, "primitives vs. objects"); - equal(QUnit.equiv("My String", new SafeString("My String")), true, "primitives vs. objects"); - equal(QUnit.equiv("Bad String", new SafeString("My String")), false, "primitives vs. objects"); - equal(QUnit.equiv(new SafeString("Bad String"), "My String"), false, "primitives vs. objects"); - - equal(QUnit.equiv(false, new SafeBoolean()), true, "primitives vs. objects"); - equal(QUnit.equiv(new SafeBoolean(), false), true, "primitives vs. objects"); - equal(QUnit.equiv(true, new SafeBoolean(true)), true, "primitives vs. objects"); - equal(QUnit.equiv(new SafeBoolean(true), true), true, "primitives vs. objects"); - equal(QUnit.equiv(true, new SafeBoolean(1)), true, "primitives vs. objects"); - equal(QUnit.equiv(false, new SafeBoolean(false)), true, "primitives vs. objects"); - equal(QUnit.equiv(new SafeBoolean(false), false), true, "primitives vs. objects"); - equal(QUnit.equiv(false, new SafeBoolean(0)), true, "primitives vs. objects"); - equal(QUnit.equiv(true, new SafeBoolean(false)), false, "primitives vs. objects"); - equal(QUnit.equiv(new SafeBoolean(false), true), false, "primitives vs. objects"); - - equal(QUnit.equiv(new SafeObject(), {}), true, "object literal vs. instantiation"); - equal(QUnit.equiv({}, new SafeObject()), true, "object literal vs. instantiation"); - equal(QUnit.equiv(new SafeObject(), {a:1}), false, "object literal vs. instantiation"); - equal(QUnit.equiv({a:1}, new SafeObject()), false, "object literal vs. instantiation"); - equal(QUnit.equiv({a:undefined}, new SafeObject()), false, "object literal vs. instantiation"); - equal(QUnit.equiv(new SafeObject(), {a:undefined}), false, "object literal vs. instantiation"); +module('equiv'); + + +test('Primitive types and constants', function() { + equal(QUnit.equiv(null, null), true, 'null'); + equal(QUnit.equiv(null, {}), false, 'null'); + equal(QUnit.equiv(null, undefined), false, 'null'); + equal(QUnit.equiv(null, 0), false, 'null'); + equal(QUnit.equiv(null, false), false, 'null'); + equal(QUnit.equiv(null, ''), false, 'null'); + equal(QUnit.equiv(null, []), false, 'null'); + + equal(QUnit.equiv(undefined, undefined), true, 'undefined'); + equal(QUnit.equiv(undefined, null), false, 'undefined'); + equal(QUnit.equiv(undefined, 0), false, 'undefined'); + equal(QUnit.equiv(undefined, false), false, 'undefined'); + equal(QUnit.equiv(undefined, {}), false, 'undefined'); + equal(QUnit.equiv(undefined, []), false, 'undefined'); + equal(QUnit.equiv(undefined, ''), false, 'undefined'); + + // Nan usually doest not equal to Nan using the '==' operator. + // Only isNaN() is able to do it. + equal(QUnit.equiv(0/0, 0/0), true, 'NaN'); // NaN VS NaN + equal(QUnit.equiv(1/0, 2/0), true, 'Infinity'); // Infinity VS Infinity + equal(QUnit.equiv(-1/0, 2/0), false, '-Infinity, Infinity'); // -Infinity VS Infinity + equal(QUnit.equiv(-1/0, -2/0), true, '-Infinity, -Infinity'); // -Infinity VS -Infinity + equal(QUnit.equiv(0/0, 1/0), false, 'NaN, Infinity'); // Nan VS Infinity + equal(QUnit.equiv(1/0, 0/0), false, 'NaN, Infinity'); // Nan VS Infinity + equal(QUnit.equiv(0/0, null), false, 'NaN'); + equal(QUnit.equiv(0/0, undefined), false, 'NaN'); + equal(QUnit.equiv(0/0, 0), false, 'NaN'); + equal(QUnit.equiv(0/0, false), false, 'NaN'); + equal(QUnit.equiv(0/0, function() {}), false, 'NaN'); + equal(QUnit.equiv(1/0, null), false, 'NaN, Infinity'); + equal(QUnit.equiv(1/0, undefined), false, 'NaN, Infinity'); + equal(QUnit.equiv(1/0, 0), false, 'NaN, Infinity'); + equal(QUnit.equiv(1/0, 1), false, 'NaN, Infinity'); + equal(QUnit.equiv(1/0, false), false, 'NaN, Infinity'); + equal(QUnit.equiv(1/0, true), false, 'NaN, Infinity'); + equal(QUnit.equiv(1/0, function() {}), false, 'NaN, Infinity'); + + equal(QUnit.equiv(0, 0), true, 'number'); + equal(QUnit.equiv(0, 1), false, 'number'); + equal(QUnit.equiv(1, 0), false, 'number'); + equal(QUnit.equiv(1, 1), true, 'number'); + equal(QUnit.equiv(1.1, 1.1), true, 'number'); + equal(QUnit.equiv(0.0000005, 0.0000005), true, 'number'); + equal(QUnit.equiv(0, ''), false, 'number'); + equal(QUnit.equiv(0, '0'), false, 'number'); + equal(QUnit.equiv(1, '1'), false, 'number'); + equal(QUnit.equiv(0, false), false, 'number'); + equal(QUnit.equiv(1, true), false, 'number'); + + equal(QUnit.equiv(true, true), true, 'boolean'); + equal(QUnit.equiv(true, false), false, 'boolean'); + equal(QUnit.equiv(false, true), false, 'boolean'); + equal(QUnit.equiv(false, 0), false, 'boolean'); + equal(QUnit.equiv(false, null), false, 'boolean'); + equal(QUnit.equiv(false, undefined), false, 'boolean'); + equal(QUnit.equiv(true, 1), false, 'boolean'); + equal(QUnit.equiv(true, null), false, 'boolean'); + equal(QUnit.equiv(true, undefined), false, 'boolean'); + + equal(QUnit.equiv('', ''), true, 'string'); + equal(QUnit.equiv('a', 'a'), true, 'string'); + equal(QUnit.equiv('foobar', 'foobar'), true, 'string'); + equal(QUnit.equiv('foobar', 'foo'), false, 'string'); + equal(QUnit.equiv('', 0), false, 'string'); + equal(QUnit.equiv('', false), false, 'string'); + equal(QUnit.equiv('', null), false, 'string'); + equal(QUnit.equiv('', undefined), false, 'string'); + + // Rename for lint validation. + // We know this is bad, we are asserting whether we can coop with bad code like this. + const SafeNumber = Number; const SafeString = String; const SafeBoolean = Boolean; const SafeObject = Object; + + // primitives vs. objects + + equal(QUnit.equiv(0, new SafeNumber()), true, 'primitives vs. objects'); + equal(QUnit.equiv(new SafeNumber(), 0), true, 'primitives vs. objects'); + equal(QUnit.equiv(1, new SafeNumber(1)), true, 'primitives vs. objects'); + equal(QUnit.equiv(new SafeNumber(1), 1), true, 'primitives vs. objects'); + equal(QUnit.equiv(new SafeNumber(0), 1), false, 'primitives vs. objects'); + equal(QUnit.equiv(0, new SafeNumber(1)), false, 'primitives vs. objects'); + + equal(QUnit.equiv(new SafeString(), ''), true, 'primitives vs. objects'); + equal(QUnit.equiv('', new SafeString()), true, 'primitives vs. objects'); + equal(QUnit.equiv(new SafeString('My String'), 'My String'), true, 'primitives vs. objects'); + equal(QUnit.equiv('My String', new SafeString('My String')), true, 'primitives vs. objects'); + equal(QUnit.equiv('Bad String', new SafeString('My String')), false, 'primitives vs. objects'); + equal(QUnit.equiv(new SafeString('Bad String'), 'My String'), false, 'primitives vs. objects'); + + equal(QUnit.equiv(false, new SafeBoolean()), true, 'primitives vs. objects'); + equal(QUnit.equiv(new SafeBoolean(), false), true, 'primitives vs. objects'); + equal(QUnit.equiv(true, new SafeBoolean(true)), true, 'primitives vs. objects'); + equal(QUnit.equiv(new SafeBoolean(true), true), true, 'primitives vs. objects'); + equal(QUnit.equiv(true, new SafeBoolean(1)), true, 'primitives vs. objects'); + equal(QUnit.equiv(false, new SafeBoolean(false)), true, 'primitives vs. objects'); + equal(QUnit.equiv(new SafeBoolean(false), false), true, 'primitives vs. objects'); + equal(QUnit.equiv(false, new SafeBoolean(0)), true, 'primitives vs. objects'); + equal(QUnit.equiv(true, new SafeBoolean(false)), false, 'primitives vs. objects'); + equal(QUnit.equiv(new SafeBoolean(false), true), false, 'primitives vs. objects'); + + equal(QUnit.equiv(new SafeObject(), {}), true, 'object literal vs. instantiation'); + equal(QUnit.equiv({}, new SafeObject()), true, 'object literal vs. instantiation'); + equal(QUnit.equiv(new SafeObject(), {a: 1}), false, 'object literal vs. instantiation'); + equal(QUnit.equiv({a: 1}, new SafeObject()), false, 'object literal vs. instantiation'); + equal(QUnit.equiv({a: undefined}, new SafeObject()), false, 'object literal vs. instantiation'); + equal(QUnit.equiv(new SafeObject(), {a: undefined}), false, 'object literal vs. instantiation'); }); -test("Objects Basics.", function() { - equal(QUnit.equiv({}, {}), true); - equal(QUnit.equiv({}, null), false); - equal(QUnit.equiv({}, undefined), false); - equal(QUnit.equiv({}, 0), false); - equal(QUnit.equiv({}, false), false); - - // This test is a hard one, it is very important - // REASONS: - // 1) They are of the same type "object" - // 2) [] instanceof Object is true - // 3) Their properties are the same (doesn't exists) - equal(QUnit.equiv({}, []), false); - - equal(QUnit.equiv({a:1}, {a:1}), true); - equal(QUnit.equiv({a:1}, {a:"1"}), false); - equal(QUnit.equiv({a:[]}, {a:[]}), true); - equal(QUnit.equiv({a:{}}, {a:null}), false); - equal(QUnit.equiv({a:1}, {}), false); - equal(QUnit.equiv({}, {a:1}), false); - - // Hard ones - equal(QUnit.equiv({a:undefined}, {}), false); - equal(QUnit.equiv({}, {a:undefined}), false); - equal(QUnit.equiv( - { - a: [{ bar: undefined }] - }, - { - a: [{ bat: undefined }] - } - ), false); - - // Objects with no prototype, created via Object.create(null), are used e.g. as dictionaries. - // Being able to test equivalence against object literals is quite useful. - if (typeof Object.create === 'function') { - equal(QUnit.equiv(Object.create(null), {}), true, "empty object without prototype VS empty object"); - - var nonEmptyWithNoProto = Object.create(null); - nonEmptyWithNoProto.foo = "bar"; - - equal(QUnit.equiv(nonEmptyWithNoProto, { foo: "bar" }), true, "object without prototype VS object"); - } +test('Objects Basics.', function() { + equal(QUnit.equiv({}, {}), true); + equal(QUnit.equiv({}, null), false); + equal(QUnit.equiv({}, undefined), false); + equal(QUnit.equiv({}, 0), false); + equal(QUnit.equiv({}, false), false); + + // This test is a hard one, it is very important + // REASONS: + // 1) They are of the same type "object" + // 2) [] instanceof Object is true + // 3) Their properties are the same (doesn't exists) + equal(QUnit.equiv({}, []), false); + + equal(QUnit.equiv({a: 1}, {a: 1}), true); + equal(QUnit.equiv({a: 1}, {a: '1'}), false); + equal(QUnit.equiv({a: []}, {a: []}), true); + equal(QUnit.equiv({a: {}}, {a: null}), false); + equal(QUnit.equiv({a: 1}, {}), false); + equal(QUnit.equiv({}, {a: 1}), false); + + // Hard ones + equal(QUnit.equiv({a: undefined}, {}), false); + equal(QUnit.equiv({}, {a: undefined}), false); + equal(QUnit.equiv( + { + a: [{bar: undefined}], + }, + { + a: [{bat: undefined}], + } + ), false); + + // Objects with no prototype, created via Object.create(null), are used e.g. as dictionaries. + // Being able to test equivalence against object literals is quite useful. + if (typeof Object.create === 'function') { + equal(QUnit.equiv(Object.create(null), {}), true, 'empty object without prototype VS empty object'); + + const nonEmptyWithNoProto = Object.create(null); + nonEmptyWithNoProto.foo = 'bar'; + + equal(QUnit.equiv(nonEmptyWithNoProto, {foo: 'bar'}), true, 'object without prototype VS object'); + } }); -test("Arrays Basics.", function() { - - equal(QUnit.equiv([], []), true); - - // May be a hard one, can invoke a crash at execution. - // because their types are both "object" but null isn't - // like a true object, it doesn't have any property at all. - equal(QUnit.equiv([], null), false); - - equal(QUnit.equiv([], undefined), false); - equal(QUnit.equiv([], false), false); - equal(QUnit.equiv([], 0), false); - equal(QUnit.equiv([], ""), false); - - // May be a hard one, but less hard - // than {} with [] (note the order) - equal(QUnit.equiv([], {}), false); - - equal(QUnit.equiv([null],[]), false); - equal(QUnit.equiv([undefined],[]), false); - equal(QUnit.equiv([],[null]), false); - equal(QUnit.equiv([],[undefined]), false); - equal(QUnit.equiv([null],[undefined]), false); - equal(QUnit.equiv([[]],[[]]), true); - equal(QUnit.equiv([[],[],[]],[[],[],[]]), true); - equal(QUnit.equiv( - [[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]], - [[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]), - true); - equal(QUnit.equiv( - [[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]], - [[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]), // shorter - false); - equal(QUnit.equiv( - [[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[{}]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]], - [[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]), // deepest element not an array - false); - - // same multidimensional - equal(QUnit.equiv( - [1,2,3,4,5,6,7,8,9, [ - 1,2,3,4,5,6,7,8,9, [ - 1,2,3,4,5,[ - [6,7,8,9, [ - [ - 1,2,3,4,[ - 2,3,4,[ - 1,2,[ - 1,2,3,4,[ - 1,2,3,4,5,6,7,8,9,[ - 0 - ],1,2,3,4,5,6,7,8,9 - ],5,6,7,8,9 - ],4,5,6,7,8,9 - ],5,6,7,8,9 - ],5,6,7 - ] - ] - ] - ] - ]]], - [1,2,3,4,5,6,7,8,9, [ - 1,2,3,4,5,6,7,8,9, [ - 1,2,3,4,5,[ - [6,7,8,9, [ - [ - 1,2,3,4,[ - 2,3,4,[ - 1,2,[ - 1,2,3,4,[ - 1,2,3,4,5,6,7,8,9,[ - 0 - ],1,2,3,4,5,6,7,8,9 - ],5,6,7,8,9 - ],4,5,6,7,8,9 - ],5,6,7,8,9 - ],5,6,7 - ] - ] - ] - ] - ]]]), - true, "Multidimensional"); - - // different multidimensional - equal(QUnit.equiv( - [1,2,3,4,5,6,7,8,9, [ - 1,2,3,4,5,6,7,8,9, [ - 1,2,3,4,5,[ - [6,7,8,9, [ - [ - 1,2,3,4,[ - 2,3,4,[ - 1,2,[ - 1,2,3,4,[ - 1,2,3,4,5,6,7,8,9,[ - 0 - ],1,2,3,4,5,6,7,8,9 - ],5,6,7,8,9 - ],4,5,6,7,8,9 - ],5,6,7,8,9 - ],5,6,7 - ] - ] - ] - ] - ]]], - [1,2,3,4,5,6,7,8,9, [ - 1,2,3,4,5,6,7,8,9, [ - 1,2,3,4,5,[ - [6,7,8,9, [ - [ - 1,2,3,4,[ - 2,3,4,[ - 1,2,[ - '1',2,3,4,[ // string instead of number - 1,2,3,4,5,6,7,8,9,[ - 0 - ],1,2,3,4,5,6,7,8,9 - ],5,6,7,8,9 - ],4,5,6,7,8,9 - ],5,6,7,8,9 - ],5,6,7 - ] - ] - ] - ] - ]]]), - false, "Multidimensional"); - - // different multidimensional - equal(QUnit.equiv( - [1,2,3,4,5,6,7,8,9, [ - 1,2,3,4,5,6,7,8,9, [ - 1,2,3,4,5,[ - [6,7,8,9, [ - [ - 1,2,3,4,[ - 2,3,4,[ - 1,2,[ - 1,2,3,4,[ - 1,2,3,4,5,6,7,8,9,[ - 0 - ],1,2,3,4,5,6,7,8,9 - ],5,6,7,8,9 - ],4,5,6,7,8,9 - ],5,6,7,8,9 - ],5,6,7 - ] - ] - ] - ] - ]]], - [1,2,3,4,5,6,7,8,9, [ - 1,2,3,4,5,6,7,8,9, [ - 1,2,3,4,5,[ - [6,7,8,9, [ - [ - 1,2,3,4,[ - 2,3,[ // missing an element (4) - 1,2,[ - 1,2,3,4,[ - 1,2,3,4,5,6,7,8,9,[ - 0 - ],1,2,3,4,5,6,7,8,9 - ],5,6,7,8,9 - ],4,5,6,7,8,9 - ],5,6,7,8,9 - ],5,6,7 - ] - ] - ] - ] - ]]]), - false, "Multidimensional"); +test('Arrays Basics.', function() { + equal(QUnit.equiv([], []), true); + + // May be a hard one, can invoke a crash at execution. + // because their types are both "object" but null isn't + // like a true object, it doesn't have any property at all. + equal(QUnit.equiv([], null), false); + + equal(QUnit.equiv([], undefined), false); + equal(QUnit.equiv([], false), false); + equal(QUnit.equiv([], 0), false); + equal(QUnit.equiv([], ''), false); + + // May be a hard one, but less hard + // than {} with [] (note the order) + equal(QUnit.equiv([], {}), false); + + equal(QUnit.equiv([null], []), false); + equal(QUnit.equiv([undefined], []), false); + equal(QUnit.equiv([], [null]), false); + equal(QUnit.equiv([], [undefined]), false); + equal(QUnit.equiv([null], [undefined]), false); + equal(QUnit.equiv([[]], [[]]), true); + equal(QUnit.equiv([[], [], []], [[], [], []]), true); + equal(QUnit.equiv( + [[], [], [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]], + [[], [], [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]), + true); + equal(QUnit.equiv( + [[], [], [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]], + [[], [], [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]), // shorter + false); + equal(QUnit.equiv( + [[], [], [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[{}]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]], + [[], [], [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]), // deepest element not an array + false); + + // same multidimensional + equal(QUnit.equiv( + [1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 1, 2, 3, 4, 5, [ + [6, 7, 8, 9, [ + [ + 1, 2, 3, 4, [ + 2, 3, 4, [ + 1, 2, [ + 1, 2, 3, 4, [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 0, + ], 1, 2, 3, 4, 5, 6, 7, 8, 9, + ], 5, 6, 7, 8, 9, + ], 4, 5, 6, 7, 8, 9, + ], 5, 6, 7, 8, 9, + ], 5, 6, 7, + ], + ], + ], + ], + ]]], + [1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 1, 2, 3, 4, 5, [ + [6, 7, 8, 9, [ + [ + 1, 2, 3, 4, [ + 2, 3, 4, [ + 1, 2, [ + 1, 2, 3, 4, [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 0, + ], 1, 2, 3, 4, 5, 6, 7, 8, 9, + ], 5, 6, 7, 8, 9, + ], 4, 5, 6, 7, 8, 9, + ], 5, 6, 7, 8, 9, + ], 5, 6, 7, + ], + ], + ], + ], + ]]]), + true, 'Multidimensional'); + + // different multidimensional + equal(QUnit.equiv( + [1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 1, 2, 3, 4, 5, [ + [6, 7, 8, 9, [ + [ + 1, 2, 3, 4, [ + 2, 3, 4, [ + 1, 2, [ + 1, 2, 3, 4, [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 0, + ], 1, 2, 3, 4, 5, 6, 7, 8, 9, + ], 5, 6, 7, 8, 9, + ], 4, 5, 6, 7, 8, 9, + ], 5, 6, 7, 8, 9, + ], 5, 6, 7, + ], + ], + ], + ], + ]]], + [1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 1, 2, 3, 4, 5, [ + [6, 7, 8, 9, [ + [ + 1, 2, 3, 4, [ + 2, 3, 4, [ + 1, 2, [ + '1', 2, 3, 4, [ // string instead of number + 1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 0, + ], 1, 2, 3, 4, 5, 6, 7, 8, 9, + ], 5, 6, 7, 8, 9, + ], 4, 5, 6, 7, 8, 9, + ], 5, 6, 7, 8, 9, + ], 5, 6, 7, + ], + ], + ], + ], + ]]]), + false, 'Multidimensional'); + + // different multidimensional + equal(QUnit.equiv( + [1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 1, 2, 3, 4, 5, [ + [6, 7, 8, 9, [ + [ + 1, 2, 3, 4, [ + 2, 3, 4, [ + 1, 2, [ + 1, 2, 3, 4, [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 0, + ], 1, 2, 3, 4, 5, 6, 7, 8, 9, + ], 5, 6, 7, 8, 9, + ], 4, 5, 6, 7, 8, 9, + ], 5, 6, 7, 8, 9, + ], 5, 6, 7, + ], + ], + ], + ], + ]]], + [1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 1, 2, 3, 4, 5, [ + [6, 7, 8, 9, [ + [ + 1, 2, 3, 4, [ + 2, 3, [ // missing an element (4) + 1, 2, [ + 1, 2, 3, 4, [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, [ + 0, + ], 1, 2, 3, 4, 5, 6, 7, 8, 9, + ], 5, 6, 7, 8, 9, + ], 4, 5, 6, 7, 8, 9, + ], 5, 6, 7, 8, 9, + ], 5, 6, 7, + ], + ], + ], + ], + ]]]), + false, 'Multidimensional'); }); -test("Functions.", function() { - var f0 = function () {}; - var f1 = function () {}; - - // f2 and f3 have the same code, formatted differently - var f2 = function () {var i = 0;}; - var f3 = function () { - /*jshint asi:true */ - var i = 0 // this comment and no semicoma as difference - }; - - equal(QUnit.equiv(function() {}, function() {}), false, "Anonymous functions"); // exact source code - equal(QUnit.equiv(function() {}, function() {return true;}), false, "Anonymous functions"); - - equal(QUnit.equiv(f0, f0), true, "Function references"); // same references - equal(QUnit.equiv(f0, f1), false, "Function references"); // exact source code, different references - equal(QUnit.equiv(f2, f3), false, "Function references"); // equivalent source code, different references - equal(QUnit.equiv(f1, f2), false, "Function references"); // different source code, different references - equal(QUnit.equiv(function() {}, true), false); - equal(QUnit.equiv(function() {}, undefined), false); - equal(QUnit.equiv(function() {}, null), false); - equal(QUnit.equiv(function() {}, {}), false); +test('Functions.', function() { + const f0 = function() {}; + const f1 = function() {}; + + // f2 and f3 have the same code, formatted differently + const f2 = function() { + const i = 0; + }; + const f3 = function() { + /* jshint asi:true */ + const i = 0; // this comment and no semicoma as difference + }; + + equal(QUnit.equiv(function() {}, function() {}), false, 'Anonymous functions'); // exact source code + equal(QUnit.equiv(function() {}, function() { + return true; + }), false, 'Anonymous functions'); + + equal(QUnit.equiv(f0, f0), true, 'Function references'); // same references + equal(QUnit.equiv(f0, f1), false, 'Function references'); // exact source code, different references + equal(QUnit.equiv(f2, f3), false, 'Function references'); // equivalent source code, different references + equal(QUnit.equiv(f1, f2), false, 'Function references'); // different source code, different references + equal(QUnit.equiv(function() {}, true), false); + equal(QUnit.equiv(function() {}, undefined), false); + equal(QUnit.equiv(function() {}, null), false); + equal(QUnit.equiv(function() {}, {}), false); }); -test("Date instances.", function() { - // Date, we don't need to test Date.parse() because it returns a number. - // Only test the Date instances by setting them a fix date. - // The date use is midnight January 1, 1970 +test('Date instances.', function() { + // Date, we don't need to test Date.parse() because it returns a number. + // Only test the Date instances by setting them a fix date. + // The date use is midnight January 1, 1970 - var d1 = new Date(); - d1.setTime(0); // fix the date + const d1 = new Date(); + d1.setTime(0); // fix the date - var d2 = new Date(); - d2.setTime(0); // fix the date + const d2 = new Date(); + d2.setTime(0); // fix the date - var d3 = new Date(); // The very now + const d3 = new Date(); // The very now - // Anyway their types differs, just in case the code fails in the order in which it deals with date - equal(QUnit.equiv(d1, 0), false); // d1.valueOf() returns 0, but d1 and 0 are different - // test same values date and different instances equality - equal(QUnit.equiv(d1, d2), true); - // test different date and different instances difference - equal(QUnit.equiv(d1, d3), false); + // Anyway their types differs, just in case the code fails in the order in which it deals with date + equal(QUnit.equiv(d1, 0), false); // d1.valueOf() returns 0, but d1 and 0 are different + // test same values date and different instances equality + equal(QUnit.equiv(d1, d2), true); + // test different date and different instances difference + equal(QUnit.equiv(d1, d3), false); }); -test("RegExp.", function() { - // Must test cases that imply those traps: - // var a = /./; - // a instanceof Object; // Oops - // a instanceof RegExp; // Oops - // typeof a === "function"; // Oops, false in IE and Opera, true in FF and Safari ("object") - - // Tests same regex with same modifiers in different order - var r = /foo/; - var r5 = /foo/gim; - var r6 = /foo/gmi; - var r7 = /foo/igm; - var r8 = /foo/img; - var r9 = /foo/mig; - var r10 = /foo/mgi; - var ri1 = /foo/i; - var ri2 = /foo/i; - var rm1 = /foo/m; - var rm2 = /foo/m; - var rg1 = /foo/g; - var rg2 = /foo/g; - - equal(QUnit.equiv(r5, r6), true, "Modifier order"); - equal(QUnit.equiv(r5, r7), true, "Modifier order"); - equal(QUnit.equiv(r5, r8), true, "Modifier order"); - equal(QUnit.equiv(r5, r9), true, "Modifier order"); - equal(QUnit.equiv(r5, r10), true, "Modifier order"); - equal(QUnit.equiv(r, r5), false, "Modifier"); - - equal(QUnit.equiv(ri1, ri2), true, "Modifier"); - equal(QUnit.equiv(r, ri1), false, "Modifier"); - equal(QUnit.equiv(ri1, rm1), false, "Modifier"); - equal(QUnit.equiv(r, rm1), false, "Modifier"); - equal(QUnit.equiv(rm1, ri1), false, "Modifier"); - equal(QUnit.equiv(rm1, rm2), true, "Modifier"); - equal(QUnit.equiv(rg1, rm1), false, "Modifier"); - equal(QUnit.equiv(rm1, rg1), false, "Modifier"); - equal(QUnit.equiv(rg1, rg2), true, "Modifier"); - - // Different regex, same modifiers - var r11 = /[a-z]/gi; - var r13 = /[0-9]/gi; // oops! different - equal(QUnit.equiv(r11, r13), false, "Regex pattern"); - - var r14 = /0/ig; - var r15 = /"0"/ig; // oops! different - equal(QUnit.equiv(r14, r15), false, "Regex pattern"); - - var r1 = /[\n\r\u2028\u2029]/g; - var r2 = /[\n\r\u2028\u2029]/g; - var r3 = /[\n\r\u2028\u2028]/g; // differs from r1 - var r4 = /[\n\r\u2028\u2029]/; // differs from r1 - - equal(QUnit.equiv(r1, r2), true, "Regex pattern"); - equal(QUnit.equiv(r1, r3), false, "Regex pattern"); - equal(QUnit.equiv(r1, r4), false, "Regex pattern"); - - // More complex regex - var regex1 = "^[-_.a-z0-9]+@([-_a-z0-9]+\\.)+([A-Za-z][A-Za-z]|[A-Za-z][A-Za-z][A-Za-z])|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$"; - var regex2 = "^[-_.a-z0-9]+@([-_a-z0-9]+\\.)+([A-Za-z][A-Za-z]|[A-Za-z][A-Za-z][A-Za-z])|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$"; - // regex 3 is different: '.' not escaped - var regex3 = "^[-_.a-z0-9]+@([-_a-z0-9]+.)+([A-Za-z][A-Za-z]|[A-Za-z][A-Za-z][A-Za-z])|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$"; - - var r21 = new RegExp(regex1); - var r22 = new RegExp(regex2); - var r23 = new RegExp(regex3); // diff from r21, not same pattern - var r23a = new RegExp(regex3, "gi"); // diff from r23, not same modifier - var r24a = new RegExp(regex3, "ig"); // same as r23a - - equal(QUnit.equiv(r21, r22), true, "Complex Regex"); - equal(QUnit.equiv(r21, r23), false, "Complex Regex"); - equal(QUnit.equiv(r23, r23a), false, "Complex Regex"); - equal(QUnit.equiv(r23a, r24a), true, "Complex Regex"); - - // typeof r1 is "function" in some browsers and "object" in others so we must cover this test - var re = / /; - equal(QUnit.equiv(re, function () {}), false, "Regex internal"); - equal(QUnit.equiv(re, {}), false, "Regex internal"); +test('RegExp.', function() { + // Must test cases that imply those traps: + // var a = /./; + // a instanceof Object; // Oops + // a instanceof RegExp; // Oops + // typeof a === "function"; // Oops, false in IE and Opera, true in FF and Safari ("object") + + // Tests same regex with same modifiers in different order + const r = /foo/; + const r5 = /foo/gim; + const r6 = /foo/gmi; + const r7 = /foo/igm; + const r8 = /foo/img; + const r9 = /foo/mig; + const r10 = /foo/mgi; + const ri1 = /foo/i; + const ri2 = /foo/i; + const rm1 = /foo/m; + const rm2 = /foo/m; + const rg1 = /foo/g; + const rg2 = /foo/g; + + equal(QUnit.equiv(r5, r6), true, 'Modifier order'); + equal(QUnit.equiv(r5, r7), true, 'Modifier order'); + equal(QUnit.equiv(r5, r8), true, 'Modifier order'); + equal(QUnit.equiv(r5, r9), true, 'Modifier order'); + equal(QUnit.equiv(r5, r10), true, 'Modifier order'); + equal(QUnit.equiv(r, r5), false, 'Modifier'); + + equal(QUnit.equiv(ri1, ri2), true, 'Modifier'); + equal(QUnit.equiv(r, ri1), false, 'Modifier'); + equal(QUnit.equiv(ri1, rm1), false, 'Modifier'); + equal(QUnit.equiv(r, rm1), false, 'Modifier'); + equal(QUnit.equiv(rm1, ri1), false, 'Modifier'); + equal(QUnit.equiv(rm1, rm2), true, 'Modifier'); + equal(QUnit.equiv(rg1, rm1), false, 'Modifier'); + equal(QUnit.equiv(rm1, rg1), false, 'Modifier'); + equal(QUnit.equiv(rg1, rg2), true, 'Modifier'); + + // Different regex, same modifiers + const r11 = /[a-z]/gi; + const r13 = /[0-9]/gi; // oops! different + equal(QUnit.equiv(r11, r13), false, 'Regex pattern'); + + const r14 = /0/ig; + const r15 = /"0"/ig; // oops! different + equal(QUnit.equiv(r14, r15), false, 'Regex pattern'); + + const r1 = /[\n\r\u2028\u2029]/g; + const r2 = /[\n\r\u2028\u2029]/g; + const r3 = /[\n\r\u2028\u2028]/g; // differs from r1 + const r4 = /[\n\r\u2028\u2029]/; // differs from r1 + + equal(QUnit.equiv(r1, r2), true, 'Regex pattern'); + equal(QUnit.equiv(r1, r3), false, 'Regex pattern'); + equal(QUnit.equiv(r1, r4), false, 'Regex pattern'); + + // More complex regex + const regex1 = '^[-_.a-z0-9]+@([-_a-z0-9]+\\.)+([A-Za-z][A-Za-z]|[A-Za-z][A-Za-z][A-Za-z])|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$'; + const regex2 = '^[-_.a-z0-9]+@([-_a-z0-9]+\\.)+([A-Za-z][A-Za-z]|[A-Za-z][A-Za-z][A-Za-z])|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$'; + // regex 3 is different: '.' not escaped + const regex3 = '^[-_.a-z0-9]+@([-_a-z0-9]+.)+([A-Za-z][A-Za-z]|[A-Za-z][A-Za-z][A-Za-z])|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$'; + + const r21 = new RegExp(regex1); + const r22 = new RegExp(regex2); + const r23 = new RegExp(regex3); // diff from r21, not same pattern + const r23a = new RegExp(regex3, 'gi'); // diff from r23, not same modifier + const r24a = new RegExp(regex3, 'ig'); // same as r23a + + equal(QUnit.equiv(r21, r22), true, 'Complex Regex'); + equal(QUnit.equiv(r21, r23), false, 'Complex Regex'); + equal(QUnit.equiv(r23, r23a), false, 'Complex Regex'); + equal(QUnit.equiv(r23a, r24a), true, 'Complex Regex'); + + // typeof r1 is "function" in some browsers and "object" in others so we must cover this test + const re = / /; + equal(QUnit.equiv(re, function() {}), false, 'Regex internal'); + equal(QUnit.equiv(re, {}), false, 'Regex internal'); }); -test("Complex Objects.", function() { - - function fn1() { - return "fn1"; - } - function fn2() { - return "fn2"; - } - - // Try to invert the order of some properties to make sure it is covered. - // It can failed when properties are compared between unsorted arrays. - equal(QUnit.equiv( - { - a: 1, - b: null, - c: [{}], - d: { - a: 3.14159, - b: false, - c: { - e: fn1, - f: [[[]]], - g: { - j: { - k: { - n: { - r: "r", - s: [1,2,3], - t: undefined, - u: 0, - v: { - w: { - x: { - y: "Yahoo!", - z: null - } - } - } - }, - q: [], - p: 1/0, - o: 99 - }, - l: undefined, - m: null - } - }, - d: 0, - i: true, - h: "false" - } - }, - e: undefined, - g: "", - h: "h", - f: {}, - i: [] - }, - { - a: 1, - b: null, - c: [{}], - d: { - b: false, - a: 3.14159, - c: { - d: 0, - e: fn1, - f: [[[]]], - g: { - j: { - k: { - n: { - r: "r", - t: undefined, - u: 0, - s: [1,2,3], - v: { - w: { - x: { - z: null, - y: "Yahoo!" - } - } - } - }, - o: 99, - p: 1/0, - q: [] - }, - l: undefined, - m: null - } - }, - i: true, - h: "false" - } - }, - e: undefined, - g: "", - f: {}, - h: "h", - i: [] - } - ), true); - - equal(QUnit.equiv( - { - a: 1, - b: null, - c: [{}], - d: { - a: 3.14159, - b: false, - c: { - d: 0, - e: fn1, - f: [[[]]], - g: { - j: { - k: { - n: { - //r: "r", // different: missing a property - s: [1,2,3], - t: undefined, - u: 0, - v: { - w: { - x: { - y: "Yahoo!", - z: null - } - } - } - }, - o: 99, - p: 1/0, - q: [] - }, - l: undefined, - m: null - } - }, - h: "false", - i: true - } - }, - e: undefined, - f: {}, - g: "", - h: "h", - i: [] - }, - { - a: 1, - b: null, - c: [{}], - d: { - a: 3.14159, - b: false, - c: { - d: 0, - e: fn1, - f: [[[]]], - g: { - j: { - k: { - n: { - r: "r", - s: [1,2,3], - t: undefined, - u: 0, - v: { - w: { - x: { - y: "Yahoo!", - z: null - } - } - } - }, - o: 99, - p: 1/0, - q: [] - }, - l: undefined, - m: null - } - }, - h: "false", - i: true - } - }, - e: undefined, - f: {}, - g: "", - h: "h", - i: [] - } - ), false); - - equal(QUnit.equiv( - { - a: 1, - b: null, - c: [{}], - d: { - a: 3.14159, - b: false, - c: { - d: 0, - e: fn1, - f: [[[]]], - g: { - j: { - k: { - n: { - r: "r", - s: [1,2,3], - t: undefined, - u: 0, - v: { - w: { - x: { - y: "Yahoo!", - z: null - } - } - } - }, - o: 99, - p: 1/0, - q: [] - }, - l: undefined, - m: null - } - }, - h: "false", - i: true - } - }, - e: undefined, - f: {}, - g: "", - h: "h", - i: [] - }, - { - a: 1, - b: null, - c: [{}], - d: { - a: 3.14159, - b: false, - c: { - d: 0, - e: fn1, - f: [[[]]], - g: { - j: { - k: { - n: { - r: "r", - s: [1,2,3], - //t: undefined, // different: missing a property with an undefined value - u: 0, - v: { - w: { - x: { - y: "Yahoo!", - z: null - } - } - } - }, - o: 99, - p: 1/0, - q: [] - }, - l: undefined, - m: null - } - }, - h: "false", - i: true - } - }, - e: undefined, - f: {}, - g: "", - h: "h", - i: [] - } - ), false); - - equal(QUnit.equiv( - { - a: 1, - b: null, - c: [{}], - d: { - a: 3.14159, - b: false, - c: { - d: 0, - e: fn1, - f: [[[]]], - g: { - j: { - k: { - n: { - r: "r", - s: [1,2,3], - t: undefined, - u: 0, - v: { - w: { - x: { - y: "Yahoo!", - z: null - } - } - } - }, - o: 99, - p: 1/0, - q: [] - }, - l: undefined, - m: null - } - }, - h: "false", - i: true - } - }, - e: undefined, - f: {}, - g: "", - h: "h", - i: [] - }, - { - a: 1, - b: null, - c: [{}], - d: { - a: 3.14159, - b: false, - c: { - d: 0, - e: fn1, - f: [[[]]], - g: { - j: { - k: { - n: { - r: "r", - s: [1,2,3], - t: undefined, - u: 0, - v: { - w: { - x: { - y: "Yahoo!", - z: null - } - } - } - }, - o: 99, - p: 1/0, - q: {} // different was [] - }, - l: undefined, - m: null - } - }, - h: "false", - i: true - } - }, - e: undefined, - f: {}, - g: "", - h: "h", - i: [] - } - ), false); - - var same1 = { - a: [ - "string", null, 0, "1", 1, { - prop: null, - foo: [1,2,null,{}, [], [1,2,3]], - bar: undefined - }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας" - ], - unicode: "è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争", - b: "b", - c: fn1 - }; - - var same2 = { - a: [ - "string", null, 0, "1", 1, { - prop: null, - foo: [1,2,null,{}, [], [1,2,3]], - bar: undefined - }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας" - ], - unicode: "è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争", - b: "b", - c: fn1 - }; - - var diff1 = { - a: [ - "string", null, 0, "1", 1, { - prop: null, - foo: [1,2,null,{}, [], [1,2,3,4]], // different: 4 was add to the array - bar: undefined - }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας" - ], - unicode: "è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争", - b: "b", - c: fn1 - }; - - var diff2 = { - a: [ - "string", null, 0, "1", 1, { - prop: null, - foo: [1,2,null,{}, [], [1,2,3]], - newprop: undefined, // different: newprop was added - bar: undefined - }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας" - ], - unicode: "è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争", - b: "b", - c: fn1 - }; - - var diff3 = { - a: [ - "string", null, 0, "1", 1, { - prop: null, - foo: [1,2,null,{}, [], [1,2,3]], - bar: undefined - }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ α" // different: missing last char - ], - unicode: "è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争", - b: "b", - c: fn1 - }; - - var diff4 = { - a: [ - "string", null, 0, "1", 1, { - prop: null, - foo: [1,2,undefined,{}, [], [1,2,3]], // different: undefined instead of null - bar: undefined - }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας" - ], - unicode: "è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争", - b: "b", - c: fn1 - }; - - var diff5 = { - a: [ - "string", null, 0, "1", 1, { - prop: null, - foo: [1,2,null,{}, [], [1,2,3]], - bat: undefined // different: property name not "bar" - }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας" - ], - unicode: "è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争", - b: "b", - c: fn1 - }; - - equal(QUnit.equiv(same1, same2), true); - equal(QUnit.equiv(same2, same1), true); - equal(QUnit.equiv(same2, diff1), false); - equal(QUnit.equiv(diff1, same2), false); - - equal(QUnit.equiv(same1, diff1), false); - equal(QUnit.equiv(same1, diff2), false); - equal(QUnit.equiv(same1, diff3), false); - equal(QUnit.equiv(same1, diff3), false); - equal(QUnit.equiv(same1, diff4), false); - equal(QUnit.equiv(same1, diff5), false); - equal(QUnit.equiv(diff5, diff1), false); +test('Complex Objects.', function() { + function fn1() { + return 'fn1'; + } + function fn2() { + return 'fn2'; + } + + // Try to invert the order of some properties to make sure it is covered. + // It can failed when properties are compared between unsorted arrays. + equal(QUnit.equiv( + { + a: 1, + b: null, + c: [{}], + d: { + a: 3.14159, + b: false, + c: { + e: fn1, + f: [[[]]], + g: { + j: { + k: { + n: { + r: 'r', + s: [1, 2, 3], + t: undefined, + u: 0, + v: { + w: { + x: { + y: 'Yahoo!', + z: null, + }, + }, + }, + }, + q: [], + p: 1/0, + o: 99, + }, + l: undefined, + m: null, + }, + }, + d: 0, + i: true, + h: 'false', + }, + }, + e: undefined, + g: '', + h: 'h', + f: {}, + i: [], + }, + { + a: 1, + b: null, + c: [{}], + d: { + b: false, + a: 3.14159, + c: { + d: 0, + e: fn1, + f: [[[]]], + g: { + j: { + k: { + n: { + r: 'r', + t: undefined, + u: 0, + s: [1, 2, 3], + v: { + w: { + x: { + z: null, + y: 'Yahoo!', + }, + }, + }, + }, + o: 99, + p: 1/0, + q: [], + }, + l: undefined, + m: null, + }, + }, + i: true, + h: 'false', + }, + }, + e: undefined, + g: '', + f: {}, + h: 'h', + i: [], + } + ), true); + + equal(QUnit.equiv( + { + a: 1, + b: null, + c: [{}], + d: { + a: 3.14159, + b: false, + c: { + d: 0, + e: fn1, + f: [[[]]], + g: { + j: { + k: { + n: { + // r: "r", // different: missing a property + s: [1, 2, 3], + t: undefined, + u: 0, + v: { + w: { + x: { + y: 'Yahoo!', + z: null, + }, + }, + }, + }, + o: 99, + p: 1/0, + q: [], + }, + l: undefined, + m: null, + }, + }, + h: 'false', + i: true, + }, + }, + e: undefined, + f: {}, + g: '', + h: 'h', + i: [], + }, + { + a: 1, + b: null, + c: [{}], + d: { + a: 3.14159, + b: false, + c: { + d: 0, + e: fn1, + f: [[[]]], + g: { + j: { + k: { + n: { + r: 'r', + s: [1, 2, 3], + t: undefined, + u: 0, + v: { + w: { + x: { + y: 'Yahoo!', + z: null, + }, + }, + }, + }, + o: 99, + p: 1/0, + q: [], + }, + l: undefined, + m: null, + }, + }, + h: 'false', + i: true, + }, + }, + e: undefined, + f: {}, + g: '', + h: 'h', + i: [], + } + ), false); + + equal(QUnit.equiv( + { + a: 1, + b: null, + c: [{}], + d: { + a: 3.14159, + b: false, + c: { + d: 0, + e: fn1, + f: [[[]]], + g: { + j: { + k: { + n: { + r: 'r', + s: [1, 2, 3], + t: undefined, + u: 0, + v: { + w: { + x: { + y: 'Yahoo!', + z: null, + }, + }, + }, + }, + o: 99, + p: 1/0, + q: [], + }, + l: undefined, + m: null, + }, + }, + h: 'false', + i: true, + }, + }, + e: undefined, + f: {}, + g: '', + h: 'h', + i: [], + }, + { + a: 1, + b: null, + c: [{}], + d: { + a: 3.14159, + b: false, + c: { + d: 0, + e: fn1, + f: [[[]]], + g: { + j: { + k: { + n: { + r: 'r', + s: [1, 2, 3], + // t: undefined, // different: missing a property with an undefined value + u: 0, + v: { + w: { + x: { + y: 'Yahoo!', + z: null, + }, + }, + }, + }, + o: 99, + p: 1/0, + q: [], + }, + l: undefined, + m: null, + }, + }, + h: 'false', + i: true, + }, + }, + e: undefined, + f: {}, + g: '', + h: 'h', + i: [], + } + ), false); + + equal(QUnit.equiv( + { + a: 1, + b: null, + c: [{}], + d: { + a: 3.14159, + b: false, + c: { + d: 0, + e: fn1, + f: [[[]]], + g: { + j: { + k: { + n: { + r: 'r', + s: [1, 2, 3], + t: undefined, + u: 0, + v: { + w: { + x: { + y: 'Yahoo!', + z: null, + }, + }, + }, + }, + o: 99, + p: 1/0, + q: [], + }, + l: undefined, + m: null, + }, + }, + h: 'false', + i: true, + }, + }, + e: undefined, + f: {}, + g: '', + h: 'h', + i: [], + }, + { + a: 1, + b: null, + c: [{}], + d: { + a: 3.14159, + b: false, + c: { + d: 0, + e: fn1, + f: [[[]]], + g: { + j: { + k: { + n: { + r: 'r', + s: [1, 2, 3], + t: undefined, + u: 0, + v: { + w: { + x: { + y: 'Yahoo!', + z: null, + }, + }, + }, + }, + o: 99, + p: 1/0, + q: {}, // different was [] + }, + l: undefined, + m: null, + }, + }, + h: 'false', + i: true, + }, + }, + e: undefined, + f: {}, + g: '', + h: 'h', + i: [], + } + ), false); + + const same1 = { + a: [ + 'string', null, 0, '1', 1, { + prop: null, + foo: [1, 2, null, {}, [], [1, 2, 3]], + bar: undefined, + }, 3, 'Hey!', 'Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας', + ], + unicode: 'è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争', + b: 'b', + c: fn1, + }; + + const same2 = { + a: [ + 'string', null, 0, '1', 1, { + prop: null, + foo: [1, 2, null, {}, [], [1, 2, 3]], + bar: undefined, + }, 3, 'Hey!', 'Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας', + ], + unicode: 'è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争', + b: 'b', + c: fn1, + }; + + const diff1 = { + a: [ + 'string', null, 0, '1', 1, { + prop: null, + foo: [1, 2, null, {}, [], [1, 2, 3, 4]], // different: 4 was add to the array + bar: undefined, + }, 3, 'Hey!', 'Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας', + ], + unicode: 'è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争', + b: 'b', + c: fn1, + }; + + const diff2 = { + a: [ + 'string', null, 0, '1', 1, { + prop: null, + foo: [1, 2, null, {}, [], [1, 2, 3]], + newprop: undefined, // different: newprop was added + bar: undefined, + }, 3, 'Hey!', 'Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας', + ], + unicode: 'è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争', + b: 'b', + c: fn1, + }; + + const diff3 = { + a: [ + 'string', null, 0, '1', 1, { + prop: null, + foo: [1, 2, null, {}, [], [1, 2, 3]], + bar: undefined, + }, 3, 'Hey!', 'Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ α', // different: missing last char + ], + unicode: 'è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争', + b: 'b', + c: fn1, + }; + + const diff4 = { + a: [ + 'string', null, 0, '1', 1, { + prop: null, + foo: [1, 2, undefined, {}, [], [1, 2, 3]], // different: undefined instead of null + bar: undefined, + }, 3, 'Hey!', 'Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας', + ], + unicode: 'è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争', + b: 'b', + c: fn1, + }; + + const diff5 = { + a: [ + 'string', null, 0, '1', 1, { + prop: null, + foo: [1, 2, null, {}, [], [1, 2, 3]], + bat: undefined, // different: property name not "bar" + }, 3, 'Hey!', 'Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας', + ], + unicode: 'è€ æ±‰è¯ä¸å˜åœ¨ 港澳和海外的åŽäººåœˆä¸ 贵州 我去了书店 现在尚有争', + b: 'b', + c: fn1, + }; + + equal(QUnit.equiv(same1, same2), true); + equal(QUnit.equiv(same2, same1), true); + equal(QUnit.equiv(same2, diff1), false); + equal(QUnit.equiv(diff1, same2), false); + + equal(QUnit.equiv(same1, diff1), false); + equal(QUnit.equiv(same1, diff2), false); + equal(QUnit.equiv(same1, diff3), false); + equal(QUnit.equiv(same1, diff3), false); + equal(QUnit.equiv(same1, diff4), false); + equal(QUnit.equiv(same1, diff5), false); + equal(QUnit.equiv(diff5, diff1), false); }); -test("Complex Arrays.", function() { - - function fn() { - } - - equal(QUnit.equiv( - [1, 2, 3, true, {}, null, [ - { - a: ["", '1', 0] - }, - 5, 6, 7 - ], "foo"], - [1, 2, 3, true, {}, null, [ - { - a: ["", '1', 0] - }, - 5, 6, 7 - ], "foo"]), - true); - - equal(QUnit.equiv( - [1, 2, 3, true, {}, null, [ - { - a: ["", '1', 0] - }, - 5, 6, 7 - ], "foo"], - [1, 2, 3, true, {}, null, [ - { - b: ["", '1', 0] // not same property name - }, - 5, 6, 7 - ], "foo"]), - false); - - var a = [{ - b: fn, - c: false, - "do": "reserved word", - "for": { - ar: [3,5,9,"hey!", [], { - ar: [1,[ - 3,4,6,9, null, [], [] - ]], - e: fn, - f: undefined - }] - }, - e: 0.43445 - }, 5, "string", 0, fn, false, null, undefined, 0, [ - 4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0 - ], [], [[[], "foo", null, { - n: 1/0, - z: { - a: [3,4,5,6,"yep!", undefined, undefined], - b: {} - } - }, {}]]]; - - equal(QUnit.equiv(a, - [{ - b: fn, - c: false, - "do": "reserved word", - "for": { - ar: [3,5,9,"hey!", [], { - ar: [1,[ - 3,4,6,9, null, [], [] - ]], - e: fn, - f: undefined - }] - }, - e: 0.43445 - }, 5, "string", 0, fn, false, null, undefined, 0, [ - 4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0 - ], [], [[[], "foo", null, { - n: 1/0, - z: { - a: [3,4,5,6,"yep!", undefined, undefined], - b: {} - } - }, {}]]]), true); - - equal(QUnit.equiv(a, - [{ - b: fn, - c: false, - "do": "reserved word", - "for": { - ar: [3,5,9,"hey!", [], { - ar: [1,[ - 3,4,6,9, null, [], [] - ]], - e: fn, - f: undefined - }] - }, - e: 0.43445 - }, 5, "string", 0, fn, false, null, undefined, 0, [ - 4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[2]]]], "3"], {}, 1/0 // different: [[[[[2]]]]] instead of [[[[[3]]]]] - ], [], [[[], "foo", null, { - n: 1/0, - z: { - a: [3,4,5,6,"yep!", undefined, undefined], - b: {} - } - }, {}]]]), false); - - equal(QUnit.equiv(a, - [{ - b: fn, - c: false, - "do": "reserved word", - "for": { - ar: [3,5,9,"hey!", [], { - ar: [1,[ - 3,4,6,9, null, [], [] - ]], - e: fn, - f: undefined - }] - }, - e: 0.43445 - }, 5, "string", 0, fn, false, null, undefined, 0, [ - 4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0 - ], [], [[[], "foo", null, { - n: -1/0, // different, -Infinity instead of Infinity - z: { - a: [3,4,5,6,"yep!", undefined, undefined], - b: {} - } - }, {}]]]), false); - - equal(QUnit.equiv(a, - [{ - b: fn, - c: false, - "do": "reserved word", - "for": { - ar: [3,5,9,"hey!", [], { - ar: [1,[ - 3,4,6,9, null, [], [] - ]], - e: fn, - f: undefined - }] - }, - e: 0.43445 - }, 5, "string", 0, fn, false, null, undefined, 0, [ - 4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0 - ], [], [[[], "foo", { // different: null is missing - n: 1/0, - z: { - a: [3,4,5,6,"yep!", undefined, undefined], - b: {} - } - }, {}]]]), false); - - equal(QUnit.equiv(a, - [{ - b: fn, - c: false, - "do": "reserved word", - "for": { - ar: [3,5,9,"hey!", [], { - ar: [1,[ - 3,4,6,9, null, [], [] - ]], - e: fn - // different: missing property f: undefined - }] - }, - e: 0.43445 - }, 5, "string", 0, fn, false, null, undefined, 0, [ - 4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0 - ], [], [[[], "foo", null, { - n: 1/0, - z: { - a: [3,4,5,6,"yep!", undefined, undefined], - b: {} - } - }, {}]]]), false); +test('Complex Arrays.', function() { + function fn() { + } + + equal(QUnit.equiv( + [1, 2, 3, true, {}, null, [ + { + a: ['', '1', 0], + }, + 5, 6, 7, + ], 'foo'], + [1, 2, 3, true, {}, null, [ + { + a: ['', '1', 0], + }, + 5, 6, 7, + ], 'foo']), + true); + + equal(QUnit.equiv( + [1, 2, 3, true, {}, null, [ + { + a: ['', '1', 0], + }, + 5, 6, 7, + ], 'foo'], + [1, 2, 3, true, {}, null, [ + { + b: ['', '1', 0], // not same property name + }, + 5, 6, 7, + ], 'foo']), + false); + + const a = [{ + 'b': fn, + 'c': false, + 'do': 'reserved word', + 'for': { + ar: [3, 5, 9, 'hey!', [], { + ar: [1, [ + 3, 4, 6, 9, null, [], [], + ]], + e: fn, + f: undefined, + }], + }, + 'e': 0.43445, + }, 5, 'string', 0, fn, false, null, undefined, 0, [ + 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, '66', null, [], [[[[[3]]]], '3'], {}, 1/0, + ], [], [[[], 'foo', null, { + n: 1/0, + z: { + a: [3, 4, 5, 6, 'yep!', undefined, undefined], + b: {}, + }, + }, {}]]]; + + equal(QUnit.equiv(a, + [{ + 'b': fn, + 'c': false, + 'do': 'reserved word', + 'for': { + ar: [3, 5, 9, 'hey!', [], { + ar: [1, [ + 3, 4, 6, 9, null, [], [], + ]], + e: fn, + f: undefined, + }], + }, + 'e': 0.43445, + }, 5, 'string', 0, fn, false, null, undefined, 0, [ + 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, '66', null, [], [[[[[3]]]], '3'], {}, 1/0, + ], [], [[[], 'foo', null, { + n: 1/0, + z: { + a: [3, 4, 5, 6, 'yep!', undefined, undefined], + b: {}, + }, + }, {}]]]), true); + + equal(QUnit.equiv(a, + [{ + 'b': fn, + 'c': false, + 'do': 'reserved word', + 'for': { + ar: [3, 5, 9, 'hey!', [], { + ar: [1, [ + 3, 4, 6, 9, null, [], [], + ]], + e: fn, + f: undefined, + }], + }, + 'e': 0.43445, + }, 5, 'string', 0, fn, false, null, undefined, 0, [ + 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, '66', null, [], [[[[[2]]]], '3'], {}, 1/0, // different: [[[[[2]]]]] instead of [[[[[3]]]]] + ], [], [[[], 'foo', null, { + n: 1/0, + z: { + a: [3, 4, 5, 6, 'yep!', undefined, undefined], + b: {}, + }, + }, {}]]]), false); + + equal(QUnit.equiv(a, + [{ + 'b': fn, + 'c': false, + 'do': 'reserved word', + 'for': { + ar: [3, 5, 9, 'hey!', [], { + ar: [1, [ + 3, 4, 6, 9, null, [], [], + ]], + e: fn, + f: undefined, + }], + }, + 'e': 0.43445, + }, 5, 'string', 0, fn, false, null, undefined, 0, [ + 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, '66', null, [], [[[[[3]]]], '3'], {}, 1/0, + ], [], [[[], 'foo', null, { + n: -1/0, // different, -Infinity instead of Infinity + z: { + a: [3, 4, 5, 6, 'yep!', undefined, undefined], + b: {}, + }, + }, {}]]]), false); + + equal(QUnit.equiv(a, + [{ + 'b': fn, + 'c': false, + 'do': 'reserved word', + 'for': { + ar: [3, 5, 9, 'hey!', [], { + ar: [1, [ + 3, 4, 6, 9, null, [], [], + ]], + e: fn, + f: undefined, + }], + }, + 'e': 0.43445, + }, 5, 'string', 0, fn, false, null, undefined, 0, [ + 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, '66', null, [], [[[[[3]]]], '3'], {}, 1/0, + ], [], [[[], 'foo', { // different: null is missing + n: 1/0, + z: { + a: [3, 4, 5, 6, 'yep!', undefined, undefined], + b: {}, + }, + }, {}]]]), false); + + equal(QUnit.equiv(a, + [{ + 'b': fn, + 'c': false, + 'do': 'reserved word', + 'for': { + ar: [3, 5, 9, 'hey!', [], { + ar: [1, [ + 3, 4, 6, 9, null, [], [], + ]], + e: fn, + // different: missing property f: undefined + }], + }, + 'e': 0.43445, + }, 5, 'string', 0, fn, false, null, undefined, 0, [ + 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, '66', null, [], [[[[[3]]]], '3'], {}, 1/0, + ], [], [[[], 'foo', null, { + n: 1/0, + z: { + a: [3, 4, 5, 6, 'yep!', undefined, undefined], + b: {}, + }, + }, {}]]]), false); }); -test("Prototypal inheritance", function() { - function Gizmo(id) { - this.id = id; - } +test('Prototypal inheritance', function() { + function Gizmo(id) { + this.id = id; + } - function Hoozit(id) { - this.id = id; - } - Hoozit.prototype = new Gizmo(); + function Hoozit(id) { + this.id = id; + } + Hoozit.prototype = new Gizmo(); - var gizmo = new Gizmo("ok"); - var hoozit = new Hoozit("ok"); + const gizmo = new Gizmo('ok'); + const hoozit = new Hoozit('ok'); - // Try this test many times after test on instances that hold function - // to make sure that our code does not mess with last object constructor memoization. - equal(QUnit.equiv(function () {}, function () {}), false); + // Try this test many times after test on instances that hold function + // to make sure that our code does not mess with last object constructor memoization. + equal(QUnit.equiv(function() {}, function() {}), false); - // Hoozit inherit from Gizmo - // hoozit instanceof Hoozit; // true - // hoozit instanceof Gizmo; // true - equal(QUnit.equiv(hoozit, gizmo), true); + // Hoozit inherit from Gizmo + // hoozit instanceof Hoozit; // true + // hoozit instanceof Gizmo; // true + equal(QUnit.equiv(hoozit, gizmo), true); - Gizmo.prototype.bar = true; // not a function just in case we skip them + Gizmo.prototype.bar = true; // not a function just in case we skip them - // Hoozit inherit from Gizmo - // They are equivalent - equal(QUnit.equiv(hoozit, gizmo), true); + // Hoozit inherit from Gizmo + // They are equivalent + equal(QUnit.equiv(hoozit, gizmo), true); - // Make sure this is still true !important - // The reason for this is that I forgot to reset the last - // caller to where it were called from. - equal(QUnit.equiv(function () {}, function () {}), false); + // Make sure this is still true !important + // The reason for this is that I forgot to reset the last + // caller to where it were called from. + equal(QUnit.equiv(function() {}, function() {}), false); - // Make sure this is still true !important - equal(QUnit.equiv(hoozit, gizmo), true); + // Make sure this is still true !important + equal(QUnit.equiv(hoozit, gizmo), true); - Hoozit.prototype.foo = true; // not a function just in case we skip them + Hoozit.prototype.foo = true; // not a function just in case we skip them - // Gizmo does not inherit from Hoozit - // gizmo instanceof Gizmo; // true - // gizmo instanceof Hoozit; // false - // They are not equivalent - equal(QUnit.equiv(hoozit, gizmo), false); + // Gizmo does not inherit from Hoozit + // gizmo instanceof Gizmo; // true + // gizmo instanceof Hoozit; // false + // They are not equivalent + equal(QUnit.equiv(hoozit, gizmo), false); - // Make sure this is still true !important - equal(QUnit.equiv(function () {}, function () {}), false); + // Make sure this is still true !important + equal(QUnit.equiv(function() {}, function() {}), false); }); -test("Instances", function() { - function A() {} - var a1 = new A(); - var a2 = new A(); - - function B() { - this.fn = function () {}; - } - var b1 = new B(); - var b2 = new B(); - - equal(QUnit.equiv(a1, a2), true, "Same property, same constructor"); - - // b1.fn and b2.fn are functions but they are different references - // But we decided to skip function for instances. - equal(QUnit.equiv(b1, b2), true, "Same property, same constructor"); - equal(QUnit.equiv(a1, b1), false, "Same properties but different constructor"); // failed - - function Car(year) { - var privateVar = 0; - this.year = year; - this.isOld = function() { - return year > 10; - }; - } - - function Human(year) { - var privateVar = 1; - this.year = year; - this.isOld = function() { - return year > 80; - }; - } - - var car = new Car(30); - var carSame = new Car(30); - var carDiff = new Car(10); - var human = new Human(30); - - var diff = { - year: 30 - }; - - var same = { - year: 30, - isOld: function () {} - }; - - equal(QUnit.equiv(car, car), true); - equal(QUnit.equiv(car, carDiff), false); - equal(QUnit.equiv(car, carSame), true); - equal(QUnit.equiv(car, human), false); +test('Instances', function() { + function A() {} + const a1 = new A(); + const a2 = new A(); + + function B() { + this.fn = function() {}; + } + const b1 = new B(); + const b2 = new B(); + + equal(QUnit.equiv(a1, a2), true, 'Same property, same constructor'); + + // b1.fn and b2.fn are functions but they are different references + // But we decided to skip function for instances. + equal(QUnit.equiv(b1, b2), true, 'Same property, same constructor'); + equal(QUnit.equiv(a1, b1), false, 'Same properties but different constructor'); // failed + + function Car(year) { + const privateVar = 0; + this.year = year; + this.isOld = function() { + return year > 10; + }; + } + + function Human(year) { + const privateVar = 1; + this.year = year; + this.isOld = function() { + return year > 80; + }; + } + + const car = new Car(30); + const carSame = new Car(30); + const carDiff = new Car(10); + const human = new Human(30); + + const diff = { + year: 30, + }; + + const same = { + year: 30, + isOld: function() {}, + }; + + equal(QUnit.equiv(car, car), true); + equal(QUnit.equiv(car, carDiff), false); + equal(QUnit.equiv(car, carSame), true); + equal(QUnit.equiv(car, human), false); }); -test("Complex Instances Nesting (with function value in literals and/or in nested instances)", function() { - function A(fn) { - this.a = {}; - this.fn = fn; - this.b = {a: []}; - this.o = {}; - this.fn1 = fn; - } - function B(fn) { - this.fn = fn; - this.fn1 = function () {}; - this.a = new A(function () {}); - } - - function fnOutside() { - } - - function C(fn) { - function fnInside() { - } - this.x = 10; - this.fn = fn; - this.fn1 = function () {}; - this.fn2 = fnInside; - this.fn3 = { - a: true, - b: fnOutside // ok make reference to a function in all instances scope - }; - this.o1 = {}; - - // This function will be ignored. - // Even if it is not visible for all instances (e.g. locked in a closures), - // it is from a property that makes part of an instance (e.g. from the C constructor) - this.b1 = new B(function () {}); - this.b2 = new B({ - x: { - b2: new B(function() {}) - } - }); - } - - function D(fn) { - function fnInside() { - } - this.x = 10; - this.fn = fn; - this.fn1 = function () {}; - this.fn2 = fnInside; - this.fn3 = { - a: true, - b: fnOutside, // ok make reference to a function in all instances scope - - // This function won't be ingored. - // It isn't visible for all C insances - // and it is not in a property of an instance. (in an Object instances e.g. the object literal) - c: fnInside - }; - this.o1 = {}; - - // This function will be ignored. - // Even if it is not visible for all instances (e.g. locked in a closures), - // it is from a property that makes part of an instance (e.g. from the C constructor) - this.b1 = new B(function () {}); - this.b2 = new B({ - x: { - b2: new B(function() {}) - } - }); - } - - function E(fn) { - function fnInside() { - } - this.x = 10; - this.fn = fn; - this.fn1 = function () {}; - this.fn2 = fnInside; - this.fn3 = { - a: true, - b: fnOutside // ok make reference to a function in all instances scope - }; - this.o1 = {}; - - // This function will be ignored. - // Even if it is not visible for all instances (e.g. locked in a closures), - // it is from a property that makes part of an instance (e.g. from the C constructor) - this.b1 = new B(function () {}); - this.b2 = new B({ - x: { - b1: new B({a: function() {}}), - b2: new B(function() {}) - } - }); - } - - - var a1 = new A(function () {}); - var a2 = new A(function () {}); - equal(QUnit.equiv(a1, a2), true); - - equal(QUnit.equiv(a1, a2), true); // different instances - - var b1 = new B(function () {}); - var b2 = new B(function () {}); - equal(QUnit.equiv(b1, b2), true); - - var c1 = new C(function () {}); - var c2 = new C(function () {}); - equal(QUnit.equiv(c1, c2), true); - - var d1 = new D(function () {}); - var d2 = new D(function () {}); - equal(QUnit.equiv(d1, d2), false); - - var e1 = new E(function () {}); - var e2 = new E(function () {}); - equal(QUnit.equiv(e1, e2), false); - +test('Complex Instances Nesting (with function value in literals and/or in nested instances)', function() { + function A(fn) { + this.a = {}; + this.fn = fn; + this.b = {a: []}; + this.o = {}; + this.fn1 = fn; + } + function B(fn) { + this.fn = fn; + this.fn1 = function() {}; + this.a = new A(function() {}); + } + + function fnOutside() { + } + + function C(fn) { + function fnInside() { + } + this.x = 10; + this.fn = fn; + this.fn1 = function() {}; + this.fn2 = fnInside; + this.fn3 = { + a: true, + b: fnOutside, // ok make reference to a function in all instances scope + }; + this.o1 = {}; + + // This function will be ignored. + // Even if it is not visible for all instances (e.g. locked in a closures), + // it is from a property that makes part of an instance (e.g. from the C constructor) + this.b1 = new B(function() {}); + this.b2 = new B({ + x: { + b2: new B(function() {}), + }, + }); + } + + function D(fn) { + function fnInside() { + } + this.x = 10; + this.fn = fn; + this.fn1 = function() {}; + this.fn2 = fnInside; + this.fn3 = { + a: true, + b: fnOutside, // ok make reference to a function in all instances scope + + // This function won't be ingored. + // It isn't visible for all C insances + // and it is not in a property of an instance. (in an Object instances e.g. the object literal) + c: fnInside, + }; + this.o1 = {}; + + // This function will be ignored. + // Even if it is not visible for all instances (e.g. locked in a closures), + // it is from a property that makes part of an instance (e.g. from the C constructor) + this.b1 = new B(function() {}); + this.b2 = new B({ + x: { + b2: new B(function() {}), + }, + }); + } + + function E(fn) { + function fnInside() { + } + this.x = 10; + this.fn = fn; + this.fn1 = function() {}; + this.fn2 = fnInside; + this.fn3 = { + a: true, + b: fnOutside, // ok make reference to a function in all instances scope + }; + this.o1 = {}; + + // This function will be ignored. + // Even if it is not visible for all instances (e.g. locked in a closures), + // it is from a property that makes part of an instance (e.g. from the C constructor) + this.b1 = new B(function() {}); + this.b2 = new B({ + x: { + b1: new B({a: function() {}}), + b2: new B(function() {}), + }, + }); + } + + + const a1 = new A(function() {}); + const a2 = new A(function() {}); + equal(QUnit.equiv(a1, a2), true); + + equal(QUnit.equiv(a1, a2), true); // different instances + + const b1 = new B(function() {}); + const b2 = new B(function() {}); + equal(QUnit.equiv(b1, b2), true); + + const c1 = new C(function() {}); + const c2 = new C(function() {}); + equal(QUnit.equiv(c1, c2), true); + + const d1 = new D(function() {}); + const d2 = new D(function() {}); + equal(QUnit.equiv(d1, d2), false); + + const e1 = new E(function() {}); + const e2 = new E(function() {}); + equal(QUnit.equiv(e1, e2), false); }); test('object with references to self wont loop', function() { - var circularA = { - abc:null - }, circularB = { - abc:null - }; - circularA.abc = circularA; - circularB.abc = circularB; - equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object (ambigous test)"); - - circularA.def = 1; - circularB.def = 1; - equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object (ambigous test)"); - - circularA.def = 1; - circularB.def = 0; - equal(QUnit.equiv(circularA, circularB), false, "Should not repeat test on object (unambigous test)"); + const circularA = { + abc: null, + }; const circularB = { + abc: null, + }; + circularA.abc = circularA; + circularB.abc = circularB; + equal(QUnit.equiv(circularA, circularB), true, 'Should not repeat test on object (ambigous test)'); + + circularA.def = 1; + circularB.def = 1; + equal(QUnit.equiv(circularA, circularB), true, 'Should not repeat test on object (ambigous test)'); + + circularA.def = 1; + circularB.def = 0; + equal(QUnit.equiv(circularA, circularB), false, 'Should not repeat test on object (unambigous test)'); }); test('array with references to self wont loop', function() { - var circularA = [], - circularB = []; - circularA.push(circularA); - circularB.push(circularB); - equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on array (ambigous test)"); - - circularA.push( 'abc' ); - circularB.push( 'abc' ); - equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on array (ambigous test)"); - - circularA.push( 'hello' ); - circularB.push( 'goodbye' ); - equal(QUnit.equiv(circularA, circularB), false, "Should not repeat test on array (unambigous test)"); + const circularA = []; + const circularB = []; + circularA.push(circularA); + circularB.push(circularB); + equal(QUnit.equiv(circularA, circularB), true, 'Should not repeat test on array (ambigous test)'); + + circularA.push( 'abc' ); + circularB.push( 'abc' ); + equal(QUnit.equiv(circularA, circularB), true, 'Should not repeat test on array (ambigous test)'); + + circularA.push( 'hello' ); + circularB.push( 'goodbye' ); + equal(QUnit.equiv(circularA, circularB), false, 'Should not repeat test on array (unambigous test)'); }); test('mixed object/array with references to self wont loop', function() { - var circularA = [{abc:null}], - circularB = [{abc:null}]; - circularA[0].abc = circularA; - circularB[0].abc = circularB; - - circularA.push(circularA); - circularB.push(circularB); - equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object/array (ambigous test)"); - - circularA[0].def = 1; - circularB[0].def = 1; - equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object/array (ambigous test)"); - - circularA[0].def = 1; - circularB[0].def = 0; - equal(QUnit.equiv(circularA, circularB), false, "Should not repeat test on object/array (unambigous test)"); + const circularA = [{abc: null}]; + const circularB = [{abc: null}]; + circularA[0].abc = circularA; + circularB[0].abc = circularB; + + circularA.push(circularA); + circularB.push(circularB); + equal(QUnit.equiv(circularA, circularB), true, 'Should not repeat test on object/array (ambigous test)'); + + circularA[0].def = 1; + circularB[0].def = 1; + equal(QUnit.equiv(circularA, circularB), true, 'Should not repeat test on object/array (ambigous test)'); + + circularA[0].def = 1; + circularB[0].def = 0; + equal(QUnit.equiv(circularA, circularB), false, 'Should not repeat test on object/array (unambigous test)'); }); -test('compare self-referent to tree', function () { - var temp, - circularA = [0], - treeA = [0, null], - circularO = {}, - treeO = { - o: null - }; - - circularA[1] = circularA; - circularO.o = circularO; - - equal(QUnit.equiv(circularA, treeA), false, "Array: Should not consider circular equal to tree"); - equal(QUnit.equiv(circularO, treeO), false, "Object: Should not consider circular equal to tree"); - - temp = [ 0, circularA ]; - equal(QUnit.equiv(circularA, temp), true, "Array: Reference is circular for one, but equal on other"); - equal(QUnit.equiv(temp, circularA), true, "Array: Reference is circular for one, but equal on other"); - - temp = { - o: circularO - }; - equal(QUnit.equiv(circularO, temp), true, "Object: Reference is circular for one, but equal on other"); - equal(QUnit.equiv(temp, circularO), true, "Object: Reference is circular for one, but equal on other"); +test('compare self-referent to tree', function() { + let temp; + const circularA = [0]; + const treeA = [0, null]; + const circularO = {}; + const treeO = { + o: null, + }; + + circularA[1] = circularA; + circularO.o = circularO; + + equal(QUnit.equiv(circularA, treeA), false, 'Array: Should not consider circular equal to tree'); + equal(QUnit.equiv(circularO, treeO), false, 'Object: Should not consider circular equal to tree'); + + temp = [0, circularA]; + equal(QUnit.equiv(circularA, temp), true, 'Array: Reference is circular for one, but equal on other'); + equal(QUnit.equiv(temp, circularA), true, 'Array: Reference is circular for one, but equal on other'); + + temp = { + o: circularO, + }; + equal(QUnit.equiv(circularO, temp), true, 'Object: Reference is circular for one, but equal on other'); + equal(QUnit.equiv(temp, circularO), true, 'Object: Reference is circular for one, but equal on other'); }); -test("Test that must be done at the end because they extend some primitive's prototype", function() { - // Try that a function looks like our regular expression. - // This tests if we check that a and b are really both instance of RegExp - Function.prototype.global = true; - Function.prototype.multiline = true; - Function.prototype.ignoreCase = false; - Function.prototype.source = "my regex"; - var re = /my regex/gm; - equal(QUnit.equiv(re, function () {}), false, "A function that looks that a regex isn't a regex"); - // This test will ensures it works in both ways, and ALSO especially that we can make differences - // between RegExp and Function constructor because typeof on a RegExpt instance is "function" - equal(QUnit.equiv(function () {}, re), false, "Same conversely, but ensures that function and regexp are distinct because their constructor are different"); +test('Test that must be done at the end because they extend some primitive\'s prototype', function() { + // Try that a function looks like our regular expression. + // This tests if we check that a and b are really both instance of RegExp + Function.prototype.global = true; + Function.prototype.multiline = true; + Function.prototype.ignoreCase = false; + Function.prototype.source = 'my regex'; + const re = /my regex/gm; + equal(QUnit.equiv(re, function() {}), false, 'A function that looks that a regex isn\'t a regex'); + // This test will ensures it works in both ways, and ALSO especially that we can make differences + // between RegExp and Function constructor because typeof on a RegExpt instance is "function" + equal(QUnit.equiv(function() {}, re), false, 'Same conversely, but ensures that function and regexp are distinct because their constructor are different'); }); diff --git a/test/qunit/logs.js b/test/qunit/logs.js index 70d04dd..39945f6 100644 --- a/test/qunit/logs.js +++ b/test/qunit/logs.js @@ -1,185 +1,184 @@ // TODO disable reordering for this suite! -var begin = 0, - moduleStart = 0, - moduleDone = 0, - testStart = 0, - testDone = 0, - log = 0, - moduleContext, - moduleDoneContext, - testContext, - testDoneContext, - logContext; +let begin = 0; +let moduleStart = 0; +let moduleDone = 0; +let testStart = 0; +let testDone = 0; +let log = 0; +let moduleContext; +let moduleDoneContext; +let testContext; +let testDoneContext; +let logContext; QUnit.begin(function() { - begin++; + begin++; }); QUnit.done(function() { }); QUnit.moduleStart(function(context) { - moduleStart++; - moduleContext = context; + moduleStart++; + moduleContext = context; }); QUnit.moduleDone(function(context) { - moduleDone++; - moduleDoneContext = context; + moduleDone++; + moduleDoneContext = context; }); QUnit.testStart(function(context) { - testStart++; - testContext = context; + testStart++; + testContext = context; }); QUnit.testDone(function(context) { - testDone++; - testDoneContext = context; + testDone++; + testDoneContext = context; }); QUnit.log(function(context) { - log++; - logContext = context; + log++; + logContext = context; }); -module("logs1"); - -test("test1", 15, function() { - equal( begin, 1, "QUnit.begin calls" ); - equal( moduleStart, 1, "QUnit.moduleStart calls" ); - equal( testStart, 1, "QUnit.testStart calls" ); - equal( testDone, 0, "QUnit.testDone calls" ); - equal( moduleDone, 0, "QUnit.moduleDone calls" ); - deepEqual( logContext, { - name: "test1", - module: "logs1", - result: true, - message: "QUnit.moduleDone calls", - actual: 0, - expected: 0 - }, "log context after equal(actual, expected, message)" ); - - equal( "foo", "foo" ); - deepEqual(logContext, { - name: "test1", - module: "logs1", - result: true, - message: undefined, - actual: "foo", - expected: "foo" - }, "log context after equal(actual, expected)" ); - - ok( true, "ok(true, message)" ); - deepEqual( logContext, { - module: "logs1", - name: "test1", - result: true, - message: "ok(true, message)" - }, "log context after ok(true, message)" ); - - strictEqual( testDoneContext, undefined, "testDone context" ); - deepEqual( testContext, { - module: "logs1", - name: "test1" - }, "test context" ); - strictEqual( moduleDoneContext, undefined, "moduleDone context" ); - deepEqual( moduleContext, { - name: "logs1" - }, "module context" ); - - equal( log, 14, "QUnit.log calls" ); +module('logs1'); + +test('test1', 15, function() { + equal( begin, 1, 'QUnit.begin calls' ); + equal( moduleStart, 1, 'QUnit.moduleStart calls' ); + equal( testStart, 1, 'QUnit.testStart calls' ); + equal( testDone, 0, 'QUnit.testDone calls' ); + equal( moduleDone, 0, 'QUnit.moduleDone calls' ); + deepEqual( logContext, { + name: 'test1', + module: 'logs1', + result: true, + message: 'QUnit.moduleDone calls', + actual: 0, + expected: 0, + }, 'log context after equal(actual, expected, message)' ); + + equal( 'foo', 'foo' ); + deepEqual(logContext, { + name: 'test1', + module: 'logs1', + result: true, + message: undefined, + actual: 'foo', + expected: 'foo', + }, 'log context after equal(actual, expected)' ); + + ok( true, 'ok(true, message)' ); + deepEqual( logContext, { + module: 'logs1', + name: 'test1', + result: true, + message: 'ok(true, message)', + }, 'log context after ok(true, message)' ); + + strictEqual( testDoneContext, undefined, 'testDone context' ); + deepEqual( testContext, { + module: 'logs1', + name: 'test1', + }, 'test context' ); + strictEqual( moduleDoneContext, undefined, 'moduleDone context' ); + deepEqual( moduleContext, { + name: 'logs1', + }, 'module context' ); + + equal( log, 14, 'QUnit.log calls' ); }); -test("test2", 11, function() { - equal( begin, 1, "QUnit.begin calls" ); - equal( moduleStart, 1, "QUnit.moduleStart calls" ); - equal( testStart, 2, "QUnit.testStart calls" ); - equal( testDone, 1, "QUnit.testDone calls" ); - equal( moduleDone, 0, "QUnit.moduleDone calls" ); - - ok( typeof testDoneContext.duration === "number" , "testDone context: duration" ); - delete testDoneContext.duration; - deepEqual( testDoneContext, { - module: "logs1", - name: "test1", - failed: 0, - passed: 15, - total: 15 - }, "testDone context" ); - deepEqual( testContext, { - module: "logs1", - name: "test2" - }, "test context" ); - strictEqual( moduleDoneContext, undefined, "moduleDone context" ); - deepEqual( moduleContext, { - name: "logs1" - }, "module context" ); - - equal( log, 25, "QUnit.log calls" ); +test('test2', 11, function() { + equal( begin, 1, 'QUnit.begin calls' ); + equal( moduleStart, 1, 'QUnit.moduleStart calls' ); + equal( testStart, 2, 'QUnit.testStart calls' ); + equal( testDone, 1, 'QUnit.testDone calls' ); + equal( moduleDone, 0, 'QUnit.moduleDone calls' ); + + ok( typeof testDoneContext.duration === 'number', 'testDone context: duration' ); + delete testDoneContext.duration; + deepEqual( testDoneContext, { + module: 'logs1', + name: 'test1', + failed: 0, + passed: 15, + total: 15, + }, 'testDone context' ); + deepEqual( testContext, { + module: 'logs1', + name: 'test2', + }, 'test context' ); + strictEqual( moduleDoneContext, undefined, 'moduleDone context' ); + deepEqual( moduleContext, { + name: 'logs1', + }, 'module context' ); + + equal( log, 25, 'QUnit.log calls' ); }); -module("logs2"); - -test( "test1", 9, function() { - equal( begin, 1, "QUnit.begin calls" ); - equal( moduleStart, 2, "QUnit.moduleStart calls" ); - equal( testStart, 3, "QUnit.testStart calls" ); - equal( testDone, 2, "QUnit.testDone calls" ); - equal( moduleDone, 1, "QUnit.moduleDone calls" ); - - deepEqual( testContext, { - module: "logs2", - name: "test1" - }, "test context" ); - deepEqual( moduleDoneContext, { - name: "logs1", - failed: 0, - passed: 26, - total: 26 - }, "moduleDone context" ); - deepEqual( moduleContext, { - name: "logs2" - }, "module context" ); - - equal( log, 34, "QUnit.log calls" ); +module('logs2'); + +test( 'test1', 9, function() { + equal( begin, 1, 'QUnit.begin calls' ); + equal( moduleStart, 2, 'QUnit.moduleStart calls' ); + equal( testStart, 3, 'QUnit.testStart calls' ); + equal( testDone, 2, 'QUnit.testDone calls' ); + equal( moduleDone, 1, 'QUnit.moduleDone calls' ); + + deepEqual( testContext, { + module: 'logs2', + name: 'test1', + }, 'test context' ); + deepEqual( moduleDoneContext, { + name: 'logs1', + failed: 0, + passed: 26, + total: 26, + }, 'moduleDone context' ); + deepEqual( moduleContext, { + name: 'logs2', + }, 'module context' ); + + equal( log, 34, 'QUnit.log calls' ); }); -test( "test2", 8, function() { - equal( begin, 1, "QUnit.begin calls" ); - equal( moduleStart, 2, "QUnit.moduleStart calls" ); - equal( testStart, 4, "QUnit.testStart calls" ); - equal( testDone, 3, "QUnit.testDone calls" ); - equal( moduleDone, 1, "QUnit.moduleDone calls" ); - - deepEqual( testContext, { - module: "logs2", - name: "test2" - }, "test context" ); - deepEqual( moduleContext, { - name: "logs2" - }, "module context" ); - - equal( log, 42, "QUnit.log calls" ); +test( 'test2', 8, function() { + equal( begin, 1, 'QUnit.begin calls' ); + equal( moduleStart, 2, 'QUnit.moduleStart calls' ); + equal( testStart, 4, 'QUnit.testStart calls' ); + equal( testDone, 3, 'QUnit.testDone calls' ); + equal( moduleDone, 1, 'QUnit.moduleDone calls' ); + + deepEqual( testContext, { + module: 'logs2', + name: 'test2', + }, 'test context' ); + deepEqual( moduleContext, { + name: 'logs2', + }, 'module context' ); + + equal( log, 42, 'QUnit.log calls' ); }); -var testAutorun = true; +let testAutorun = true; QUnit.done(function() { + if (!testAutorun) { + return; + } - if (!testAutorun) { - return; - } + testAutorun = false; - testAutorun = false; + module('autorun'); - module("autorun"); + test('reset', 0, function() {}); - test("reset", 0, function() {}); + moduleStart = moduleDone = 0; - moduleStart = moduleDone = 0; + test('first', function() { + equal(moduleStart, 1, 'test started'); + equal(moduleDone, 0, 'test in progress'); + }); - test("first", function() { - equal(moduleStart, 1, "test started"); - equal(moduleDone, 0, "test in progress"); - }); - - test("second", function() { - equal(moduleStart, 2, "test started"); - equal(moduleDone, 1, "test in progress"); - }); + test('second', function() { + equal(moduleStart, 2, 'test started'); + equal(moduleDone, 1, 'test in progress'); + }); }); QUnit.done = function(res) { diff --git a/test/qunit/narwhal-test.js b/test/qunit/narwhal-test.js index 8ff3ae9..677adfb 100644 --- a/test/qunit/narwhal-test.js +++ b/test/qunit/narwhal-test.js @@ -1,22 +1,22 @@ // Run with: $ narwhal test/narwhal-test.js -var QUnit = require("../qunit/qunit"); +const QUnit = require('../qunit/qunit'); QUnit.log(function(details) { - if (!details.result) { - var output = "FAILED: " + (details.message ? details.message + ", " : ""); - if (details.actual) { - output += "expected: " + details.expected + ", actual: " + details.actual; - } - if (details.source) { - output += ", " + details.source; - } - print(output); - } + if (!details.result) { + let output = 'FAILED: ' + (details.message ? details.message + ', ' : ''); + if (details.actual) { + output += 'expected: ' + details.expected + ', actual: ' + details.actual; + } + if (details.source) { + output += ', ' + details.source; + } + print(output); + } }); -QUnit.test("fail twice with stacktrace", function(assert) { - /*jshint expr:true */ - assert.equal(true, false); - assert.equal(true, false, "gotta fail"); - x.y.z; // Throws ReferenceError +QUnit.test('fail twice with stacktrace', function(assert) { + /* jshint expr:true */ + assert.equal(true, false); + assert.equal(true, false, 'gotta fail'); + x.y.z; // Throws ReferenceError }); diff --git a/test/qunit/node-test.js b/test/qunit/node-test.js index fc4939b..e921853 100644 --- a/test/qunit/node-test.js +++ b/test/qunit/node-test.js @@ -1,22 +1,22 @@ // Run with: $ node test/node-test.js -var QUnit = require("../qunit/qunit"); +const QUnit = require('../qunit/qunit'); QUnit.log(function(details) { - if (!details.result) { - var output = "FAILED: " + (details.message ? details.message + ", " : ""); - if (details.actual) { - output += "expected: " + details.expected + ", actual: " + details.actual; - } - if (details.source) { - output += ", " + details.source; - } - console.log(output); - } + if (!details.result) { + let output = 'FAILED: ' + (details.message ? details.message + ', ' : ''); + if (details.actual) { + output += 'expected: ' + details.expected + ', actual: ' + details.actual; + } + if (details.source) { + output += ', ' + details.source; + } + console.log(output); + } }); -QUnit.test("fail twice with stacktrace", function(assert) { - /*jshint expr:true */ - assert.equal(true, false); - assert.equal(true, false, "gotta fail"); - x.y.z; // Throws ReferenceError +QUnit.test('fail twice with stacktrace', function(assert) { + /* jshint expr:true */ + assert.equal(true, false); + assert.equal(true, false, 'gotta fail'); + x.y.z; // Throws ReferenceError }); diff --git a/test/qunit/qunit.js b/test/qunit/qunit.js index 1dc38d3..c117132 100644 --- a/test/qunit/qunit.js +++ b/test/qunit/qunit.js @@ -9,31 +9,30 @@ */ (function( window ) { - -var QUnit, - assert, - config, - onErrorFnPrev, - testId = 0, - fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""), - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - // Keep a local reference to Date (GH-283) - Date = window.Date, - defined = { - setTimeout: typeof window.setTimeout !== "undefined", - sessionStorage: (function() { - var x = "qunit-test-string"; - try { - sessionStorage.setItem( x, x ); - sessionStorage.removeItem( x ); - return true; - } catch( e ) { - return false; - } - }()) - }, - /** + let QUnit; + let assert; + let config; + let onErrorFnPrev; + let testId = 0; + const fileName = (sourceFromStacktrace( 0 ) || '' ).replace(/(:\d+)+\)?/, '').replace(/.+\//, ''); + const toString = Object.prototype.toString; + const hasOwn = Object.prototype.hasOwnProperty; + // Keep a local reference to Date (GH-283) + const Date = window.Date; + const defined = { + setTimeout: typeof window.setTimeout !== 'undefined', + sessionStorage: (function() { + const x = 'qunit-test-string'; + try { + sessionStorage.setItem( x, x ); + sessionStorage.removeItem( x ); + return true; + } catch ( e ) { + return false; + } + }()), + }; + /** * Provides a normalized error string, correcting an issue * with IE 7 (and prior) where Error.prototype.toString is * not properly implemented @@ -43,1593 +42,1590 @@ var QUnit, * @param {String|Error} error * @return {String} error message */ - errorString = function( error ) { - var name, message, - errorString = error.toString(); - if ( errorString.substring( 0, 7 ) === "[object" ) { - name = error.name ? error.name.toString() : "Error"; - message = error.message ? error.message.toString() : ""; - if ( name && message ) { - return name + ": " + message; - } else if ( name ) { - return name; - } else if ( message ) { - return message; - } else { - return "Error"; - } - } else { - return errorString; - } - }, - /** + const errorString = function( error ) { + let name; let message; + const errorString = error.toString(); + if ( errorString.substring( 0, 7 ) === '[object' ) { + name = error.name ? error.name.toString() : 'Error'; + message = error.message ? error.message.toString() : ''; + if ( name && message ) { + return name + ': ' + message; + } else if ( name ) { + return name; + } else if ( message ) { + return message; + } else { + return 'Error'; + } + } else { + return errorString; + } + }; + /** * Makes a clone of an object using only Array or Object as base, * and copies over the own enumerable properties. * * @param {Object} obj * @return {Object} New object with only the own properties (recursively). */ - objectValues = function( obj ) { - // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392. - /*jshint newcap: false */ - var key, val, - vals = QUnit.is( "array", obj ) ? [] : {}; - for ( key in obj ) { - if ( hasOwn.call( obj, key ) ) { - val = obj[key]; - vals[key] = val === Object(val) ? objectValues(val) : val; - } - } - return vals; - }; - -function Test( settings ) { - extend( this, settings ); - this.assertions = []; - this.testNumber = ++Test.count; -} - -Test.count = 0; - -Test.prototype = { - init: function() { - var a, b, li, - tests = id( "qunit-tests" ); - - if ( tests ) { - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml; - - // `a` initialized at top of scope - a = document.createElement( "a" ); - a.innerHTML = "Rerun"; - a.href = QUnit.url({ testNumber: this.testNumber }); - - li = document.createElement( "li" ); - li.appendChild( b ); - li.appendChild( a ); - li.className = "running"; - li.id = this.id = "qunit-test-output" + testId++; - - tests.appendChild( li ); - } - }, - setup: function() { - if ( this.module !== config.previousModule ) { - if ( config.previousModule ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.previousModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - config.previousModule = this.module; - config.moduleStats = { all: 0, bad: 0 }; - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); - } else if ( config.autorun ) { - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); - } - - config.current = this; - - this.testEnvironment = extend({ - setup: function() {}, - teardown: function() {} - }, this.moduleTestEnvironment ); - - this.started = +new Date(); - runLoggingCallbacks( "testStart", QUnit, { - name: this.testName, - module: this.module - }); - - // allow utility functions to access the current test environment - // TODO why?? - QUnit.current_testEnvironment = this.testEnvironment; - - if ( !config.pollution ) { - saveGlobal(); - } - if ( config.notrycatch ) { - this.testEnvironment.setup.call( this.testEnvironment ); - return; - } - try { - this.testEnvironment.setup.call( this.testEnvironment ); - } catch( e ) { - QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - }, - run: function() { - config.current = this; - - var running = id( "qunit-testresult" ); - - if ( running ) { - running.innerHTML = "Running:
                    " + this.nameHtml; - } - - if ( this.async ) { - QUnit.stop(); - } - - this.callbackStarted = +new Date(); - - if ( config.notrycatch ) { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - return; - } - - try { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - } catch( e ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - - QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) ); - // else next test will carry the responsibility - saveGlobal(); - - // Restart the tests if they're blocking - if ( config.blocking ) { - QUnit.start(); - } - } - }, - teardown: function() { - config.current = this; - if ( config.notrycatch ) { - if ( typeof this.callbackRuntime === "undefined" ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - } - this.testEnvironment.teardown.call( this.testEnvironment ); - return; - } else { - try { - this.testEnvironment.teardown.call( this.testEnvironment ); - } catch( e ) { - QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - } - checkPollution(); - }, - finish: function() { - config.current = this; - if ( config.requireExpects && this.expected === null ) { - QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack ); - } else if ( this.expected !== null && this.expected !== this.assertions.length ) { - QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack ); - } else if ( this.expected === null && !this.assertions.length ) { - QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack ); - } - - var i, assertion, a, b, time, li, ol, - test = this, - good = 0, - bad = 0, - tests = id( "qunit-tests" ); - - this.runtime = +new Date() - this.started; - config.stats.all += this.assertions.length; - config.moduleStats.all += this.assertions.length; - - if ( tests ) { - ol = document.createElement( "ol" ); - ol.className = "qunit-assert-list"; - - for ( i = 0; i < this.assertions.length; i++ ) { - assertion = this.assertions[i]; - - li = document.createElement( "li" ); - li.className = assertion.result ? "pass" : "fail"; - li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" ); - ol.appendChild( li ); - - if ( assertion.result ) { - good++; - } else { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - - // store result when possible - if ( QUnit.config.reorder && defined.sessionStorage ) { - if ( bad ) { - sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad ); - } else { - sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName ); - } - } - - if ( bad === 0 ) { - addClass( ol, "qunit-collapsed" ); - } - - // `b` initialized at top of scope - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml + " (" + bad + ", " + good + ", " + this.assertions.length + ")"; - - addEvent(b, "click", function() { - var next = b.parentNode.lastChild, - collapsed = hasClass( next, "qunit-collapsed" ); - ( collapsed ? removeClass : addClass )( next, "qunit-collapsed" ); - }); - - addEvent(b, "dblclick", function( e ) { - var target = e && e.target ? e.target : window.event.srcElement; - if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) { - target = target.parentNode; - } - if ( window.location && target.nodeName.toLowerCase() === "strong" ) { - window.location = QUnit.url({ testNumber: test.testNumber }); - } - }); - - // `time` initialized at top of scope - time = document.createElement( "span" ); - time.className = "runtime"; - time.innerHTML = this.runtime + " ms"; - - // `li` initialized at top of scope - li = id( this.id ); - li.className = bad ? "fail" : "pass"; - li.removeChild( li.firstChild ); - a = li.firstChild; - li.appendChild( b ); - li.appendChild( a ); - li.appendChild( time ); - li.appendChild( ol ); - - } else { - for ( i = 0; i < this.assertions.length; i++ ) { - if ( !this.assertions[i].result ) { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - } - - runLoggingCallbacks( "testDone", QUnit, { - name: this.testName, - module: this.module, - failed: bad, - passed: this.assertions.length - bad, - total: this.assertions.length, - duration: this.runtime - }); - - QUnit.reset(); - - config.current = undefined; - }, - - queue: function() { - var bad, - test = this; - - synchronize(function() { - test.init(); - }); - function run() { - // each of these can by async - synchronize(function() { - test.setup(); - }); - synchronize(function() { - test.run(); - }); - synchronize(function() { - test.teardown(); - }); - synchronize(function() { - test.finish(); - }); - } - - // `bad` initialized at top of scope - // defer when previous test run passed, if storage is available - bad = QUnit.config.reorder && defined.sessionStorage && - +sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName ); - - if ( bad ) { - run(); - } else { - synchronize( run, true ); - } - } -}; - -// Root QUnit object. -// `QUnit` initialized at top of scope -QUnit = { - - // call on start of module test to prepend name to all tests - module: function( name, testEnvironment ) { - config.currentModule = name; - config.currentModuleTestEnvironment = testEnvironment; - config.modules[name] = true; - }, - - asyncTest: function( testName, expected, callback ) { - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - QUnit.test( testName, expected, callback, true ); - }, - - test: function( testName, expected, callback, async ) { - var test, - nameHtml = "" + escapeText( testName ) + ""; - - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - if ( config.currentModule ) { - nameHtml = "" + escapeText( config.currentModule ) + ": " + nameHtml; - } - - test = new Test({ - nameHtml: nameHtml, - testName: testName, - expected: expected, - async: async, - callback: callback, - module: config.currentModule, - moduleTestEnvironment: config.currentModuleTestEnvironment, - stack: sourceFromStacktrace( 2 ) - }); - - if ( !validTest( test ) ) { - return; - } - - test.queue(); - }, - - // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. - expect: function( asserts ) { - if (arguments.length === 1) { - config.current.expected = asserts; - } else { - return config.current.expected; - } - }, - - start: function( count ) { - // QUnit hasn't been initialized yet. - // Note: RequireJS (et al) may delay onLoad - if ( config.semaphore === undefined ) { - QUnit.begin(function() { - // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first - setTimeout(function() { - QUnit.start( count ); - }); - }); - return; - } - - config.semaphore -= count || 1; - // don't start until equal number of stop-calls - if ( config.semaphore > 0 ) { - return; - } - // ignore if start is called more often then stop - if ( config.semaphore < 0 ) { - config.semaphore = 0; - QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)", null, sourceFromStacktrace(2) ); - return; - } - // A slight delay, to avoid any current callbacks - if ( defined.setTimeout ) { - window.setTimeout(function() { - if ( config.semaphore > 0 ) { - return; - } - if ( config.timeout ) { - clearTimeout( config.timeout ); - } - - config.blocking = false; - process( true ); - }, 13); - } else { - config.blocking = false; - process( true ); - } - }, - - stop: function( count ) { - config.semaphore += count || 1; - config.blocking = true; - - if ( config.testTimeout && defined.setTimeout ) { - clearTimeout( config.timeout ); - config.timeout = window.setTimeout(function() { - QUnit.ok( false, "Test timed out" ); - config.semaphore = 1; - QUnit.start(); - }, config.testTimeout ); - } - } -}; - -// `assert` initialized at top of scope -// Asssert helpers -// All of these must either call QUnit.push() or manually do: -// - runLoggingCallbacks( "log", .. ); -// - config.current.assertions.push({ .. }); -// We attach it to the QUnit object *after* we expose the public API, -// otherwise `assert` will become a global variable in browsers (#341). -assert = { - /** + var objectValues = function( obj ) { + // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392. + /* jshint newcap: false */ + let key; let val; + const vals = QUnit.is( 'array', obj ) ? [] : {}; + for ( key in obj ) { + if ( hasOwn.call( obj, key ) ) { + val = obj[key]; + vals[key] = val === Object(val) ? objectValues(val) : val; + } + } + return vals; + }; + + function Test( settings ) { + extend( this, settings ); + this.assertions = []; + this.testNumber = ++Test.count; + } + + Test.count = 0; + + Test.prototype = { + init: function() { + let a; let b; let li; + const tests = id( 'qunit-tests' ); + + if ( tests ) { + b = document.createElement( 'strong' ); + b.innerHTML = this.nameHtml; + + // `a` initialized at top of scope + a = document.createElement( 'a' ); + a.innerHTML = 'Rerun'; + a.href = QUnit.url({testNumber: this.testNumber}); + + li = document.createElement( 'li' ); + li.appendChild( b ); + li.appendChild( a ); + li.className = 'running'; + li.id = this.id = 'qunit-test-output' + testId++; + + tests.appendChild( li ); + } + }, + setup: function() { + if ( this.module !== config.previousModule ) { + if ( config.previousModule ) { + runLoggingCallbacks( 'moduleDone', QUnit, { + name: config.previousModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all, + }); + } + config.previousModule = this.module; + config.moduleStats = {all: 0, bad: 0}; + runLoggingCallbacks( 'moduleStart', QUnit, { + name: this.module, + }); + } else if ( config.autorun ) { + runLoggingCallbacks( 'moduleStart', QUnit, { + name: this.module, + }); + } + + config.current = this; + + this.testEnvironment = extend({ + setup: function() {}, + teardown: function() {}, + }, this.moduleTestEnvironment ); + + this.started = +new Date(); + runLoggingCallbacks( 'testStart', QUnit, { + name: this.testName, + module: this.module, + }); + + // allow utility functions to access the current test environment + // TODO why?? + QUnit.current_testEnvironment = this.testEnvironment; + + if ( !config.pollution ) { + saveGlobal(); + } + if ( config.notrycatch ) { + this.testEnvironment.setup.call( this.testEnvironment ); + return; + } + try { + this.testEnvironment.setup.call( this.testEnvironment ); + } catch ( e ) { + QUnit.pushFailure( 'Setup failed on ' + this.testName + ': ' + ( e.message || e ), extractStacktrace( e, 1 ) ); + } + }, + run: function() { + config.current = this; + + const running = id( 'qunit-testresult' ); + + if ( running ) { + running.innerHTML = 'Running:
                    ' + this.nameHtml; + } + + if ( this.async ) { + QUnit.stop(); + } + + this.callbackStarted = +new Date(); + + if ( config.notrycatch ) { + this.callback.call( this.testEnvironment, QUnit.assert ); + this.callbackRuntime = +new Date() - this.callbackStarted; + return; + } + + try { + this.callback.call( this.testEnvironment, QUnit.assert ); + this.callbackRuntime = +new Date() - this.callbackStarted; + } catch ( e ) { + this.callbackRuntime = +new Date() - this.callbackStarted; + + QUnit.pushFailure( 'Died on test #' + (this.assertions.length + 1) + ' ' + this.stack + ': ' + ( e.message || e ), extractStacktrace( e, 0 ) ); + // else next test will carry the responsibility + saveGlobal(); + + // Restart the tests if they're blocking + if ( config.blocking ) { + QUnit.start(); + } + } + }, + teardown: function() { + config.current = this; + if ( config.notrycatch ) { + if ( typeof this.callbackRuntime === 'undefined' ) { + this.callbackRuntime = +new Date() - this.callbackStarted; + } + this.testEnvironment.teardown.call( this.testEnvironment ); + return; + } else { + try { + this.testEnvironment.teardown.call( this.testEnvironment ); + } catch ( e ) { + QUnit.pushFailure( 'Teardown failed on ' + this.testName + ': ' + ( e.message || e ), extractStacktrace( e, 1 ) ); + } + } + checkPollution(); + }, + finish: function() { + config.current = this; + if ( config.requireExpects && this.expected === null ) { + QUnit.pushFailure( 'Expected number of assertions to be defined, but expect() was not called.', this.stack ); + } else if ( this.expected !== null && this.expected !== this.assertions.length ) { + QUnit.pushFailure( 'Expected ' + this.expected + ' assertions, but ' + this.assertions.length + ' were run', this.stack ); + } else if ( this.expected === null && !this.assertions.length ) { + QUnit.pushFailure( 'Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.', this.stack ); + } + + let i; let assertion; let a; let b; let time; let li; let ol; + const test = this; + let good = 0; + let bad = 0; + const tests = id( 'qunit-tests' ); + + this.runtime = +new Date() - this.started; + config.stats.all += this.assertions.length; + config.moduleStats.all += this.assertions.length; + + if ( tests ) { + ol = document.createElement( 'ol' ); + ol.className = 'qunit-assert-list'; + + for ( i = 0; i < this.assertions.length; i++ ) { + assertion = this.assertions[i]; + + li = document.createElement( 'li' ); + li.className = assertion.result ? 'pass' : 'fail'; + li.innerHTML = assertion.message || ( assertion.result ? 'okay' : 'failed' ); + ol.appendChild( li ); + + if ( assertion.result ) { + good++; + } else { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + + // store result when possible + if ( QUnit.config.reorder && defined.sessionStorage ) { + if ( bad ) { + sessionStorage.setItem( 'qunit-test-' + this.module + '-' + this.testName, bad ); + } else { + sessionStorage.removeItem( 'qunit-test-' + this.module + '-' + this.testName ); + } + } + + if ( bad === 0 ) { + addClass( ol, 'qunit-collapsed' ); + } + + // `b` initialized at top of scope + b = document.createElement( 'strong' ); + b.innerHTML = this.nameHtml + ' (' + bad + ', ' + good + ', ' + this.assertions.length + ')'; + + addEvent(b, 'click', function() { + const next = b.parentNode.lastChild; + const collapsed = hasClass( next, 'qunit-collapsed' ); + ( collapsed ? removeClass : addClass )( next, 'qunit-collapsed' ); + }); + + addEvent(b, 'dblclick', function( e ) { + let target = e && e.target ? e.target : window.event.srcElement; + if ( target.nodeName.toLowerCase() === 'span' || target.nodeName.toLowerCase() === 'b' ) { + target = target.parentNode; + } + if ( window.location && target.nodeName.toLowerCase() === 'strong' ) { + window.location = QUnit.url({testNumber: test.testNumber}); + } + }); + + // `time` initialized at top of scope + time = document.createElement( 'span' ); + time.className = 'runtime'; + time.innerHTML = this.runtime + ' ms'; + + // `li` initialized at top of scope + li = id( this.id ); + li.className = bad ? 'fail' : 'pass'; + li.removeChild( li.firstChild ); + a = li.firstChild; + li.appendChild( b ); + li.appendChild( a ); + li.appendChild( time ); + li.appendChild( ol ); + } else { + for ( i = 0; i < this.assertions.length; i++ ) { + if ( !this.assertions[i].result ) { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + } + + runLoggingCallbacks( 'testDone', QUnit, { + name: this.testName, + module: this.module, + failed: bad, + passed: this.assertions.length - bad, + total: this.assertions.length, + duration: this.runtime, + }); + + QUnit.reset(); + + config.current = undefined; + }, + + queue: function() { + let bad; + const test = this; + + synchronize(function() { + test.init(); + }); + function run() { + // each of these can by async + synchronize(function() { + test.setup(); + }); + synchronize(function() { + test.run(); + }); + synchronize(function() { + test.teardown(); + }); + synchronize(function() { + test.finish(); + }); + } + + // `bad` initialized at top of scope + // defer when previous test run passed, if storage is available + bad = QUnit.config.reorder && defined.sessionStorage && + +sessionStorage.getItem( 'qunit-test-' + this.module + '-' + this.testName ); + + if ( bad ) { + run(); + } else { + synchronize( run, true ); + } + }, + }; + + // Root QUnit object. + // `QUnit` initialized at top of scope + QUnit = { + + // call on start of module test to prepend name to all tests + module: function( name, testEnvironment ) { + config.currentModule = name; + config.currentModuleTestEnvironment = testEnvironment; + config.modules[name] = true; + }, + + asyncTest: function( testName, expected, callback ) { + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + QUnit.test( testName, expected, callback, true ); + }, + + test: function( testName, expected, callback, async ) { + let test; + let nameHtml = '' + escapeText( testName ) + ''; + + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + if ( config.currentModule ) { + nameHtml = '' + escapeText( config.currentModule ) + ': ' + nameHtml; + } + + test = new Test({ + nameHtml: nameHtml, + testName: testName, + expected: expected, + async: async, + callback: callback, + module: config.currentModule, + moduleTestEnvironment: config.currentModuleTestEnvironment, + stack: sourceFromStacktrace( 2 ), + }); + + if ( !validTest( test ) ) { + return; + } + + test.queue(); + }, + + // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. + expect: function( asserts ) { + if (arguments.length === 1) { + config.current.expected = asserts; + } else { + return config.current.expected; + } + }, + + start: function( count ) { + // QUnit hasn't been initialized yet. + // Note: RequireJS (et al) may delay onLoad + if ( config.semaphore === undefined ) { + QUnit.begin(function() { + // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first + setTimeout(function() { + QUnit.start( count ); + }); + }); + return; + } + + config.semaphore -= count || 1; + // don't start until equal number of stop-calls + if ( config.semaphore > 0 ) { + return; + } + // ignore if start is called more often then stop + if ( config.semaphore < 0 ) { + config.semaphore = 0; + QUnit.pushFailure( 'Called start() while already started (QUnit.config.semaphore was 0 already)', null, sourceFromStacktrace(2) ); + return; + } + // A slight delay, to avoid any current callbacks + if ( defined.setTimeout ) { + window.setTimeout(function() { + if ( config.semaphore > 0 ) { + return; + } + if ( config.timeout ) { + clearTimeout( config.timeout ); + } + + config.blocking = false; + process( true ); + }, 13); + } else { + config.blocking = false; + process( true ); + } + }, + + stop: function( count ) { + config.semaphore += count || 1; + config.blocking = true; + + if ( config.testTimeout && defined.setTimeout ) { + clearTimeout( config.timeout ); + config.timeout = window.setTimeout(function() { + QUnit.ok( false, 'Test timed out' ); + config.semaphore = 1; + QUnit.start(); + }, config.testTimeout ); + } + }, + }; + + // `assert` initialized at top of scope + // Asssert helpers + // All of these must either call QUnit.push() or manually do: + // - runLoggingCallbacks( "log", .. ); + // - config.current.assertions.push({ .. }); + // We attach it to the QUnit object *after* we expose the public API, + // otherwise `assert` will become a global variable in browsers (#341). + assert = { + /** * Asserts rough true-ish result. * @name ok * @function * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); */ - ok: function( result, msg ) { - if ( !config.current ) { - throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - result = !!result; - - var source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: msg - }; - - msg = escapeText( msg || (result ? "okay" : "failed" ) ); - msg = "" + msg + ""; - - if ( !result ) { - source = sourceFromStacktrace( 2 ); - if ( source ) { - details.source = source; - msg += "
                    Source:
                    " + escapeText( source ) + "
                    "; - } - } - runLoggingCallbacks( "log", QUnit, details ); - config.current.assertions.push({ - result: result, - message: msg - }); - }, - - /** + 'ok': function( result, msg ) { + if ( !config.current ) { + throw new Error( 'ok() assertion outside test context, was ' + sourceFromStacktrace(2) ); + } + result = !!result; + + let source; + const details = { + module: config.current.module, + name: config.current.testName, + result: result, + message: msg, + }; + + msg = escapeText( msg || (result ? 'okay' : 'failed' ) ); + msg = '' + msg + ''; + + if ( !result ) { + source = sourceFromStacktrace( 2 ); + if ( source ) { + details.source = source; + msg += '
                    Source:
                    ' + escapeText( source ) + '
                    '; + } + } + runLoggingCallbacks( 'log', QUnit, details ); + config.current.assertions.push({ + result: result, + message: msg, + }); + }, + + /** * Assert that the first two arguments are equal, with an optional message. * Prints out both actual and expected values. * @name equal * @function * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" ); */ - equal: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected == actual, actual, expected, message ); - }, + 'equal': function( actual, expected, message ) { + /* jshint eqeqeq:false */ + QUnit.push( expected == actual, actual, expected, message ); + }, - /** + /** * @name notEqual * @function */ - notEqual: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected != actual, actual, expected, message ); - }, + 'notEqual': function( actual, expected, message ) { + /* jshint eqeqeq:false */ + QUnit.push( expected != actual, actual, expected, message ); + }, - /** + /** * @name propEqual * @function */ - propEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, + 'propEqual': function( actual, expected, message ) { + actual = objectValues(actual); + expected = objectValues(expected); + QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); + }, - /** + /** * @name notPropEqual * @function */ - notPropEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, + 'notPropEqual': function( actual, expected, message ) { + actual = objectValues(actual); + expected = objectValues(expected); + QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); + }, - /** + /** * @name deepEqual * @function */ - deepEqual: function( actual, expected, message ) { - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, + 'deepEqual': function( actual, expected, message ) { + QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); + }, - /** + /** * @name notDeepEqual * @function */ - notDeepEqual: function( actual, expected, message ) { - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, + 'notDeepEqual': function( actual, expected, message ) { + QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); + }, - /** + /** * @name strictEqual * @function */ - strictEqual: function( actual, expected, message ) { - QUnit.push( expected === actual, actual, expected, message ); - }, + 'strictEqual': function( actual, expected, message ) { + QUnit.push( expected === actual, actual, expected, message ); + }, - /** + /** * @name notStrictEqual * @function */ - notStrictEqual: function( actual, expected, message ) { - QUnit.push( expected !== actual, actual, expected, message ); - }, - - "throws": function( block, expected, message ) { - var actual, - expectedOutput = expected, - ok = false; - - // 'expected' is optional - if ( typeof expected === "string" ) { - message = expected; - expected = null; - } - - config.current.ignoreGlobalErrors = true; - try { - block.call( config.current.testEnvironment ); - } catch (e) { - actual = e; - } - config.current.ignoreGlobalErrors = false; - - if ( actual ) { - // we don't want to validate thrown error - if ( !expected ) { - ok = true; - expectedOutput = null; - // expected is a regexp - } else if ( QUnit.objectType( expected ) === "regexp" ) { - ok = expected.test( errorString( actual ) ); - // expected is a constructor - } else if ( actual instanceof expected ) { - ok = true; - // expected is a validation function which returns true is validation passed - } else if ( expected.call( {}, actual ) === true ) { - expectedOutput = null; - ok = true; - } - - QUnit.push( ok, actual, expectedOutput, message ); - } else { - QUnit.pushFailure( message, null, 'No exception was thrown.' ); - } - } -}; - -/** + 'notStrictEqual': function( actual, expected, message ) { + QUnit.push( expected !== actual, actual, expected, message ); + }, + + 'throws': function( block, expected, message ) { + let actual; + let expectedOutput = expected; + let ok = false; + + // 'expected' is optional + if ( typeof expected === 'string' ) { + message = expected; + expected = null; + } + + config.current.ignoreGlobalErrors = true; + try { + block.call( config.current.testEnvironment ); + } catch (e) { + actual = e; + } + config.current.ignoreGlobalErrors = false; + + if ( actual ) { + // we don't want to validate thrown error + if ( !expected ) { + ok = true; + expectedOutput = null; + // expected is a regexp + } else if ( QUnit.objectType( expected ) === 'regexp' ) { + ok = expected.test( errorString( actual ) ); + // expected is a constructor + } else if ( actual instanceof expected ) { + ok = true; + // expected is a validation function which returns true is validation passed + } else if ( expected.call( {}, actual ) === true ) { + expectedOutput = null; + ok = true; + } + + QUnit.push( ok, actual, expectedOutput, message ); + } else { + QUnit.pushFailure( message, null, 'No exception was thrown.' ); + } + }, + }; + + /** * @deprecate since 1.8.0 * Kept assertion helpers in root for backwards compatibility. */ -extend( QUnit, assert ); + extend( QUnit, assert ); -/** + /** * @deprecated since 1.9.0 * Kept root "raises()" for backwards compatibility. * (Note that we don't introduce assert.raises). */ -QUnit.raises = assert[ "throws" ]; + QUnit.raises = assert['throws']; -/** + /** * @deprecated since 1.0.0, replaced with error pushes since 1.3.0 * Kept to avoid TypeErrors for undefined methods. */ -QUnit.equals = function() { - QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" ); -}; -QUnit.same = function() { - QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" ); -}; - -// We want access to the constructor's prototype -(function() { - function F() {} - F.prototype = QUnit; - QUnit = new F(); - // Make F QUnit's constructor so that we can add to the prototype later - QUnit.constructor = F; -}()); - -/** + QUnit.equals = function() { + QUnit.push( false, false, false, 'QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead' ); + }; + QUnit.same = function() { + QUnit.push( false, false, false, 'QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead' ); + }; + + // We want access to the constructor's prototype + (function() { + function F() {} + F.prototype = QUnit; + QUnit = new F(); + // Make F QUnit's constructor so that we can add to the prototype later + QUnit.constructor = F; + }()); + + /** * Config object: Maintain internal state * Later exposed as QUnit.config * `config` initialized at top of scope */ -config = { - // The queue of tests to run - queue: [], - - // block until document ready - blocking: true, - - // when enabled, show only failing tests - // gets persisted through sessionStorage and can be changed in UI via checkbox - hidepassed: false, - - // by default, run previously failed tests first - // very useful in combination with "Hide passed tests" checked - reorder: true, - - // by default, modify document.title when suite is done - altertitle: true, - - // when enabled, all tests must call expect() - requireExpects: false, - - // add checkboxes that are persisted in the query-string - // when enabled, the id is set to `true` as a `QUnit.config` property - urlConfig: [ - { - id: "noglobals", - label: "Check for Globals", - tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings." - }, - { - id: "notrycatch", - label: "No try-catch", - tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings." - } - ], - - // Set of all modules. - modules: {}, - - // logging callback queues - begin: [], - done: [], - log: [], - testStart: [], - testDone: [], - moduleStart: [], - moduleDone: [] -}; - -// Export global variables, unless an 'exports' object exists, -// in that case we assume we're in CommonJS (dealt with on the bottom of the script) -if ( typeof exports === "undefined" ) { - extend( window, QUnit ); - - // Expose QUnit object - window.QUnit = QUnit; -} - -// Initialize more QUnit.config and QUnit.urlParams -(function() { - var i, - location = window.location || { search: "", protocol: "file:" }, - params = location.search.slice( 1 ).split( "&" ), - length = params.length, - urlParams = {}, - current; - - if ( params[ 0 ] ) { - for ( i = 0; i < length; i++ ) { - current = params[ i ].split( "=" ); - current[ 0 ] = decodeURIComponent( current[ 0 ] ); - // allow just a key to turn on a flag, e.g., test.html?noglobals - current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; - urlParams[ current[ 0 ] ] = current[ 1 ]; - } - } - - QUnit.urlParams = urlParams; - - // String search anywhere in moduleName+testName - config.filter = urlParams.filter; - - // Exact match of the module name - config.module = urlParams.module; - - config.testNumber = parseInt( urlParams.testNumber, 10 ) || null; - - // Figure out if we're running the tests from a server or not - QUnit.isLocal = location.protocol === "file:"; -}()); - -// Extend QUnit object, -// these after set here because they should not be exposed as global functions -extend( QUnit, { - assert: assert, - - config: config, - - // Initialize the configuration options - init: function() { - extend( config, { - stats: { all: 0, bad: 0 }, - moduleStats: { all: 0, bad: 0 }, - started: +new Date(), - updateRate: 1000, - blocking: false, - autostart: true, - autorun: false, - filter: "", - queue: [], - semaphore: 1 - }); - - var tests, banner, result, - qunit = id( "qunit" ); - - if ( qunit ) { - qunit.innerHTML = - "

                    " + escapeText( document.title ) + "

                    " + - "

                    " + - "
                    " + - "

                    " + - "
                      "; - } - - tests = id( "qunit-tests" ); - banner = id( "qunit-banner" ); - result = id( "qunit-testresult" ); - - if ( tests ) { - tests.innerHTML = ""; - } - - if ( banner ) { - banner.className = ""; - } - - if ( result ) { - result.parentNode.removeChild( result ); - } - - if ( tests ) { - result = document.createElement( "p" ); - result.id = "qunit-testresult"; - result.className = "result"; - tests.parentNode.insertBefore( result, tests ); - result.innerHTML = "Running...
                       "; - } - }, - - // Resets the test setup. Useful for tests that modify the DOM. - reset: function() { - var fixture = id( "qunit-fixture" ); - if ( fixture ) { - fixture.innerHTML = config.fixture; - } - }, - - // Trigger an event on an element. - // @example triggerEvent( document.body, "click" ); - triggerEvent: function( elem, type, event ) { - if ( document.createEvent ) { - event = document.createEvent( "MouseEvents" ); - event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, - 0, 0, 0, 0, 0, false, false, false, false, 0, null); - - elem.dispatchEvent( event ); - } else if ( elem.fireEvent ) { - elem.fireEvent( "on" + type ); - } - }, - - // Safe object type checking - is: function( type, obj ) { - return QUnit.objectType( obj ) === type; - }, - - objectType: function( obj ) { - if ( typeof obj === "undefined" ) { - return "undefined"; - // consider: typeof null === object - } - if ( obj === null ) { - return "null"; - } - - var match = toString.call( obj ).match(/^\[object\s(.*)\]$/), - type = match && match[1] || ""; - - switch ( type ) { - case "Number": - if ( isNaN(obj) ) { - return "nan"; - } - return "number"; - case "String": - case "Boolean": - case "Array": - case "Date": - case "RegExp": - case "Function": - return type.toLowerCase(); - } - if ( typeof obj === "object" ) { - return "object"; - } - return undefined; - }, - - push: function( result, actual, expected, message ) { - if ( !config.current ) { - throw new Error( "assertion outside test context, was " + sourceFromStacktrace() ); - } - - var output, source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: message, - actual: actual, - expected: expected - }; - - message = escapeText( message ) || ( result ? "okay" : "failed" ); - message = "" + message + ""; - output = message; - - if ( !result ) { - expected = escapeText( QUnit.jsDump.parse(expected) ); - actual = escapeText( QUnit.jsDump.parse(actual) ); - output += ""; - - if ( actual !== expected ) { - output += ""; - output += ""; - } - - source = sourceFromStacktrace(); - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
                      Expected:
                      " + expected + "
                      Result:
                      " + actual + "
                      Diff:
                      " + QUnit.diff( expected, actual ) + "
                      Source:
                      " + escapeText( source ) + "
                      "; - } - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: !!result, - message: output - }); - }, - - pushFailure: function( message, source, actual ) { - if ( !config.current ) { - throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - - var output, - details = { - module: config.current.module, - name: config.current.testName, - result: false, - message: message - }; - - message = escapeText( message ) || "error"; - message = "" + message + ""; - output = message; - - output += ""; - - if ( actual ) { - output += ""; - } - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
                      Result:
                      " + escapeText( actual ) + "
                      Source:
                      " + escapeText( source ) + "
                      "; - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: false, - message: output - }); - }, - - url: function( params ) { - params = extend( extend( {}, QUnit.urlParams ), params ); - var key, - querystring = "?"; - - for ( key in params ) { - if ( !hasOwn.call( params, key ) ) { - continue; - } - querystring += encodeURIComponent( key ) + "=" + - encodeURIComponent( params[ key ] ) + "&"; - } - return window.location.protocol + "//" + window.location.host + + config = { + // The queue of tests to run + queue: [], + + // block until document ready + blocking: true, + + // when enabled, show only failing tests + // gets persisted through sessionStorage and can be changed in UI via checkbox + hidepassed: false, + + // by default, run previously failed tests first + // very useful in combination with "Hide passed tests" checked + reorder: true, + + // by default, modify document.title when suite is done + altertitle: true, + + // when enabled, all tests must call expect() + requireExpects: false, + + // add checkboxes that are persisted in the query-string + // when enabled, the id is set to `true` as a `QUnit.config` property + urlConfig: [ + { + id: 'noglobals', + label: 'Check for Globals', + tooltip: 'Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings.', + }, + { + id: 'notrycatch', + label: 'No try-catch', + tooltip: 'Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings.', + }, + ], + + // Set of all modules. + modules: {}, + + // logging callback queues + begin: [], + done: [], + log: [], + testStart: [], + testDone: [], + moduleStart: [], + moduleDone: [], + }; + + // Export global variables, unless an 'exports' object exists, + // in that case we assume we're in CommonJS (dealt with on the bottom of the script) + if ( typeof exports === 'undefined' ) { + extend( window, QUnit ); + + // Expose QUnit object + window.QUnit = QUnit; + } + + // Initialize more QUnit.config and QUnit.urlParams + (function() { + let i; + const location = window.location || {search: '', protocol: 'file:'}; + const params = location.search.slice( 1 ).split( '&' ); + const length = params.length; + const urlParams = {}; + let current; + + if ( params[0] ) { + for ( i = 0; i < length; i++ ) { + current = params[i].split( '=' ); + current[0] = decodeURIComponent( current[0] ); + // allow just a key to turn on a flag, e.g., test.html?noglobals + current[1] = current[1] ? decodeURIComponent( current[1] ) : true; + urlParams[current[0]] = current[1]; + } + } + + QUnit.urlParams = urlParams; + + // String search anywhere in moduleName+testName + config.filter = urlParams.filter; + + // Exact match of the module name + config.module = urlParams.module; + + config.testNumber = parseInt( urlParams.testNumber, 10 ) || null; + + // Figure out if we're running the tests from a server or not + QUnit.isLocal = location.protocol === 'file:'; + }()); + + // Extend QUnit object, + // these after set here because they should not be exposed as global functions + extend( QUnit, { + assert: assert, + + config: config, + + // Initialize the configuration options + init: function() { + extend( config, { + stats: {all: 0, bad: 0}, + moduleStats: {all: 0, bad: 0}, + started: +new Date(), + updateRate: 1000, + blocking: false, + autostart: true, + autorun: false, + filter: '', + queue: [], + semaphore: 1, + }); + + let tests; let banner; let result; + const qunit = id( 'qunit' ); + + if ( qunit ) { + qunit.innerHTML = + '

                      ' + escapeText( document.title ) + '

                      ' + + '

                      ' + + '
                      ' + + '

                      ' + + '
                        '; + } + + tests = id( 'qunit-tests' ); + banner = id( 'qunit-banner' ); + result = id( 'qunit-testresult' ); + + if ( tests ) { + tests.innerHTML = ''; + } + + if ( banner ) { + banner.className = ''; + } + + if ( result ) { + result.parentNode.removeChild( result ); + } + + if ( tests ) { + result = document.createElement( 'p' ); + result.id = 'qunit-testresult'; + result.className = 'result'; + tests.parentNode.insertBefore( result, tests ); + result.innerHTML = 'Running...
                         '; + } + }, + + // Resets the test setup. Useful for tests that modify the DOM. + reset: function() { + const fixture = id( 'qunit-fixture' ); + if ( fixture ) { + fixture.innerHTML = config.fixture; + } + }, + + // Trigger an event on an element. + // @example triggerEvent( document.body, "click" ); + triggerEvent: function( elem, type, event ) { + if ( document.createEvent ) { + event = document.createEvent( 'MouseEvents' ); + event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, + 0, 0, 0, 0, 0, false, false, false, false, 0, null); + + elem.dispatchEvent( event ); + } else if ( elem.fireEvent ) { + elem.fireEvent( 'on' + type ); + } + }, + + // Safe object type checking + is: function( type, obj ) { + return QUnit.objectType( obj ) === type; + }, + + objectType: function( obj ) { + if ( typeof obj === 'undefined' ) { + return 'undefined'; + // consider: typeof null === object + } + if ( obj === null ) { + return 'null'; + } + + const match = toString.call( obj ).match(/^\[object\s(.*)\]$/); + const type = match && match[1] || ''; + + switch ( type ) { + case 'Number': + if ( isNaN(obj) ) { + return 'nan'; + } + return 'number'; + case 'String': + case 'Boolean': + case 'Array': + case 'Date': + case 'RegExp': + case 'Function': + return type.toLowerCase(); + } + if ( typeof obj === 'object' ) { + return 'object'; + } + return undefined; + }, + + push: function( result, actual, expected, message ) { + if ( !config.current ) { + throw new Error( 'assertion outside test context, was ' + sourceFromStacktrace() ); + } + + let output; let source; + const details = { + module: config.current.module, + name: config.current.testName, + result: result, + message: message, + actual: actual, + expected: expected, + }; + + message = escapeText( message ) || ( result ? 'okay' : 'failed' ); + message = '' + message + ''; + output = message; + + if ( !result ) { + expected = escapeText( QUnit.jsDump.parse(expected) ); + actual = escapeText( QUnit.jsDump.parse(actual) ); + output += ''; + + if ( actual !== expected ) { + output += ''; + output += ''; + } + + source = sourceFromStacktrace(); + + if ( source ) { + details.source = source; + output += ''; + } + + output += '
                        Expected:
                        ' + expected + '
                        Result:
                        ' + actual + '
                        Diff:
                        ' + QUnit.diff( expected, actual ) + '
                        Source:
                        ' + escapeText( source ) + '
                        '; + } + + runLoggingCallbacks( 'log', QUnit, details ); + + config.current.assertions.push({ + result: !!result, + message: output, + }); + }, + + pushFailure: function( message, source, actual ) { + if ( !config.current ) { + throw new Error( 'pushFailure() assertion outside test context, was ' + sourceFromStacktrace(2) ); + } + + let output; + const details = { + module: config.current.module, + name: config.current.testName, + result: false, + message: message, + }; + + message = escapeText( message ) || 'error'; + message = '' + message + ''; + output = message; + + output += ''; + + if ( actual ) { + output += ''; + } + + if ( source ) { + details.source = source; + output += ''; + } + + output += '
                        Result:
                        ' + escapeText( actual ) + '
                        Source:
                        ' + escapeText( source ) + '
                        '; + + runLoggingCallbacks( 'log', QUnit, details ); + + config.current.assertions.push({ + result: false, + message: output, + }); + }, + + url: function( params ) { + params = extend( extend( {}, QUnit.urlParams ), params ); + let key; + let querystring = '?'; + + for ( key in params ) { + if ( !hasOwn.call( params, key ) ) { + continue; + } + querystring += encodeURIComponent( key ) + '=' + + encodeURIComponent( params[key] ) + '&'; + } + return window.location.protocol + '//' + window.location.host + window.location.pathname + querystring.slice( 0, -1 ); - }, + }, - extend: extend, - id: id, - addEvent: addEvent - // load, equiv, jsDump, diff: Attached later -}); + extend: extend, + id: id, + addEvent: addEvent, + // load, equiv, jsDump, diff: Attached later + }); -/** + /** * @deprecated: Created for backwards compatibility with test runner that set the hook function * into QUnit.{hook}, instead of invoking it and passing the hook function. * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here. * Doing this allows us to tell if the following methods have been overwritten on the actual * QUnit object. */ -extend( QUnit.constructor.prototype, { - - // Logging callbacks; all receive a single argument with the listed properties - // run test/logs.html for any related changes - begin: registerLoggingCallback( "begin" ), - - // done: { failed, passed, total, runtime } - done: registerLoggingCallback( "done" ), - - // log: { result, actual, expected, message } - log: registerLoggingCallback( "log" ), - - // testStart: { name } - testStart: registerLoggingCallback( "testStart" ), - - // testDone: { name, failed, passed, total, duration } - testDone: registerLoggingCallback( "testDone" ), - - // moduleStart: { name } - moduleStart: registerLoggingCallback( "moduleStart" ), - - // moduleDone: { name, failed, passed, total } - moduleDone: registerLoggingCallback( "moduleDone" ) -}); - -if ( typeof document === "undefined" || document.readyState === "complete" ) { - config.autorun = true; -} - -QUnit.load = function() { - runLoggingCallbacks( "begin", QUnit, {} ); - - // Initialize the config, saving the execution queue - var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, - urlConfigCheckboxesContainer, urlConfigCheckboxes, moduleFilter, - numModules = 0, - moduleNames = [], - moduleFilterHtml = "", - urlConfigHtml = "", - oldconfig = extend( {}, config ); - - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - len = config.urlConfig.length; - - for ( i = 0; i < len; i++ ) { - val = config.urlConfig[i]; - if ( typeof val === "string" ) { - val = { - id: val, - label: val, - tooltip: "[no tooltip available]" - }; - } - config[ val.id ] = QUnit.urlParams[ val.id ]; - urlConfigHtml += ""; - } - for ( i in config.modules ) { - if ( config.modules.hasOwnProperty( i ) ) { - moduleNames.push(i); - } - } - numModules = moduleNames.length; - moduleNames.sort( function( a, b ) { - return a.localeCompare( b ); - }); - moduleFilterHtml += ""; - - // `userAgent` initialized at top of scope - userAgent = id( "qunit-userAgent" ); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - - // `banner` initialized at top of scope - banner = id( "qunit-header" ); - if ( banner ) { - banner.innerHTML = "" + banner.innerHTML + " "; - } - - // `toolbar` initialized at top of scope - toolbar = id( "qunit-testrunner-toolbar" ); - if ( toolbar ) { - // `filter` initialized at top of scope - filter = document.createElement( "input" ); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - - addEvent( filter, "click", function() { - var tmp, - ol = document.getElementById( "qunit-tests" ); - - if ( filter.checked ) { - ol.className = ol.className + " hidepass"; - } else { - tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; - ol.className = tmp.replace( / hidepass /, " " ); - } - if ( defined.sessionStorage ) { - if (filter.checked) { - sessionStorage.setItem( "qunit-filter-passed-tests", "true" ); - } else { - sessionStorage.removeItem( "qunit-filter-passed-tests" ); - } - } - }); - - if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) { - filter.checked = true; - // `ol` initialized at top of scope - ol = document.getElementById( "qunit-tests" ); - ol.className = ol.className + " hidepass"; - } - toolbar.appendChild( filter ); - - // `label` initialized at top of scope - label = document.createElement( "label" ); - label.setAttribute( "for", "qunit-filter-pass" ); - label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." ); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - - urlConfigCheckboxesContainer = document.createElement("span"); - urlConfigCheckboxesContainer.innerHTML = urlConfigHtml; - urlConfigCheckboxes = urlConfigCheckboxesContainer.getElementsByTagName("input"); - // For oldIE support: - // * Add handlers to the individual elements instead of the container - // * Use "click" instead of "change" - // * Fallback from event.target to event.srcElement - addEvents( urlConfigCheckboxes, "click", function( event ) { - var params = {}, - target = event.target || event.srcElement; - params[ target.name ] = target.checked ? true : undefined; - window.location = QUnit.url( params ); - }); - toolbar.appendChild( urlConfigCheckboxesContainer ); - - if (numModules > 1) { - moduleFilter = document.createElement( 'span' ); - moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' ); - moduleFilter.innerHTML = moduleFilterHtml; - addEvent( moduleFilter.lastChild, "change", function() { - var selectBox = moduleFilter.getElementsByTagName("select")[0], - selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); - - window.location = QUnit.url( { module: ( selectedModule === "" ) ? undefined : selectedModule } ); - }); - toolbar.appendChild(moduleFilter); - } - } - - // `main` initialized at top of scope - main = id( "qunit-fixture" ); - if ( main ) { - config.fixture = main.innerHTML; - } - - if ( config.autostart ) { - QUnit.start(); - } -}; - -addEvent( window, "load", QUnit.load ); - -// `onErrorFnPrev` initialized at top of scope -// Preserve other handlers -onErrorFnPrev = window.onerror; - -// Cover uncaught exceptions -// Returning true will surpress the default browser handler, -// returning false will let it run. -window.onerror = function ( error, filePath, linerNr ) { - var ret = false; - if ( onErrorFnPrev ) { - ret = onErrorFnPrev( error, filePath, linerNr ); - } - - // Treat return value as window.onerror itself does, - // Only do our handling if not surpressed. - if ( ret !== true ) { - if ( QUnit.config.current ) { - if ( QUnit.config.current.ignoreGlobalErrors ) { - return true; - } - QUnit.pushFailure( error, filePath + ":" + linerNr ); - } else { - QUnit.test( "global failure", extend( function() { - QUnit.pushFailure( error, filePath + ":" + linerNr ); - }, { validTest: validTest } ) ); - } - return false; - } - - return ret; -}; - -function done() { - config.autorun = true; - - // Log the last module results - if ( config.currentModule ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.currentModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - - var i, key, - banner = id( "qunit-banner" ), - tests = id( "qunit-tests" ), - runtime = +new Date() - config.started, - passed = config.stats.all - config.stats.bad, - html = [ - "Tests completed in ", - runtime, - " milliseconds.
                        ", - "", - passed, - " assertions of ", - config.stats.all, - " passed, ", - config.stats.bad, - " failed." - ].join( "" ); - - if ( banner ) { - banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" ); - } - - if ( tests ) { - id( "qunit-testresult" ).innerHTML = html; - } - - if ( config.altertitle && typeof document !== "undefined" && document.title ) { - // show ✖ for good, ✔ for bad suite result in title - // use escape sequences in case file gets loaded with non-utf-8-charset - document.title = [ - ( config.stats.bad ? "\u2716" : "\u2714" ), - document.title.replace( /^[\u2714\u2716] /i, "" ) - ].join( " " ); - } - - // clear own sessionStorage items if all tests passed - if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { - // `key` & `i` initialized at top of scope - for ( i = 0; i < sessionStorage.length; i++ ) { - key = sessionStorage.key( i++ ); - if ( key.indexOf( "qunit-test-" ) === 0 ) { - sessionStorage.removeItem( key ); - } - } - } - - // scroll back to top to show results - if ( window.scrollTo ) { - window.scrollTo(0, 0); - } - - runLoggingCallbacks( "done", QUnit, { - failed: config.stats.bad, - passed: passed, - total: config.stats.all, - runtime: runtime - }); -} - -/** @return Boolean: true if this test should be ran */ -function validTest( test ) { - var include, - filter = config.filter && config.filter.toLowerCase(), - module = config.module && config.module.toLowerCase(), - fullName = (test.module + ": " + test.testName).toLowerCase(); - - // Internally-generated tests are always valid - if ( test.callback && test.callback.validTest === validTest ) { - delete test.callback.validTest; - return true; - } - - if ( config.testNumber ) { - return test.testNumber === config.testNumber; - } - - if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { - return false; - } - - if ( !filter ) { - return true; - } - - include = filter.charAt( 0 ) !== "!"; - if ( !include ) { - filter = filter.slice( 1 ); - } - - // If the filter matches, we need to honour include - if ( fullName.indexOf( filter ) !== -1 ) { - return include; - } - - // Otherwise, do the opposite - return !include; -} - -// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) -// Later Safari and IE10 are supposed to support error.stack as well -// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack -function extractStacktrace( e, offset ) { - offset = offset === undefined ? 3 : offset; - - var stack, include, i; - - if ( e.stacktrace ) { - // Opera - return e.stacktrace.split( "\n" )[ offset + 3 ]; - } else if ( e.stack ) { - // Firefox, Chrome - stack = e.stack.split( "\n" ); - if (/^error$/i.test( stack[0] ) ) { - stack.shift(); - } - if ( fileName ) { - include = []; - for ( i = offset; i < stack.length; i++ ) { - if ( stack[ i ].indexOf( fileName ) !== -1 ) { - break; - } - include.push( stack[ i ] ); - } - if ( include.length ) { - return include.join( "\n" ); - } - } - return stack[ offset ]; - } else if ( e.sourceURL ) { - // Safari, PhantomJS - // hopefully one day Safari provides actual stacktraces - // exclude useless self-reference for generated Error objects - if ( /qunit.js$/.test( e.sourceURL ) ) { - return; - } - // for actual exceptions, this is useful - return e.sourceURL + ":" + e.line; - } -} -function sourceFromStacktrace( offset ) { - try { - throw new Error(); - } catch ( e ) { - return extractStacktrace( e, offset ); - } -} - -/** + extend( QUnit.constructor.prototype, { + + // Logging callbacks; all receive a single argument with the listed properties + // run test/logs.html for any related changes + begin: registerLoggingCallback( 'begin' ), + + // done: { failed, passed, total, runtime } + done: registerLoggingCallback( 'done' ), + + // log: { result, actual, expected, message } + log: registerLoggingCallback( 'log' ), + + // testStart: { name } + testStart: registerLoggingCallback( 'testStart' ), + + // testDone: { name, failed, passed, total, duration } + testDone: registerLoggingCallback( 'testDone' ), + + // moduleStart: { name } + moduleStart: registerLoggingCallback( 'moduleStart' ), + + // moduleDone: { name, failed, passed, total } + moduleDone: registerLoggingCallback( 'moduleDone' ), + }); + + if ( typeof document === 'undefined' || document.readyState === 'complete' ) { + config.autorun = true; + } + + QUnit.load = function() { + runLoggingCallbacks( 'begin', QUnit, {} ); + + // Initialize the config, saving the execution queue + let banner; let filter; let i; let label; let len; let main; let ol; let toolbar; let userAgent; let val; + let urlConfigCheckboxesContainer; let urlConfigCheckboxes; let moduleFilter; + let numModules = 0; + const moduleNames = []; + let moduleFilterHtml = ''; + let urlConfigHtml = ''; + const oldconfig = extend( {}, config ); + + QUnit.init(); + extend(config, oldconfig); + + config.blocking = false; + + len = config.urlConfig.length; + + for ( i = 0; i < len; i++ ) { + val = config.urlConfig[i]; + if ( typeof val === 'string' ) { + val = { + id: val, + label: val, + tooltip: '[no tooltip available]', + }; + } + config[val.id] = QUnit.urlParams[val.id]; + urlConfigHtml += ''; + } + for ( i in config.modules ) { + if ( config.modules.hasOwnProperty( i ) ) { + moduleNames.push(i); + } + } + numModules = moduleNames.length; + moduleNames.sort( function( a, b ) { + return a.localeCompare( b ); + }); + moduleFilterHtml += ''; + + // `userAgent` initialized at top of scope + userAgent = id( 'qunit-userAgent' ); + if ( userAgent ) { + userAgent.innerHTML = navigator.userAgent; + } + + // `banner` initialized at top of scope + banner = id( 'qunit-header' ); + if ( banner ) { + banner.innerHTML = '' + banner.innerHTML + ' '; + } + + // `toolbar` initialized at top of scope + toolbar = id( 'qunit-testrunner-toolbar' ); + if ( toolbar ) { + // `filter` initialized at top of scope + filter = document.createElement( 'input' ); + filter.type = 'checkbox'; + filter.id = 'qunit-filter-pass'; + + addEvent( filter, 'click', function() { + let tmp; + const ol = document.getElementById( 'qunit-tests' ); + + if ( filter.checked ) { + ol.className = ol.className + ' hidepass'; + } else { + tmp = ' ' + ol.className.replace( /[\n\t\r]/g, ' ' ) + ' '; + ol.className = tmp.replace( / hidepass /, ' ' ); + } + if ( defined.sessionStorage ) { + if (filter.checked) { + sessionStorage.setItem( 'qunit-filter-passed-tests', 'true' ); + } else { + sessionStorage.removeItem( 'qunit-filter-passed-tests' ); + } + } + }); + + if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( 'qunit-filter-passed-tests' ) ) { + filter.checked = true; + // `ol` initialized at top of scope + ol = document.getElementById( 'qunit-tests' ); + ol.className = ol.className + ' hidepass'; + } + toolbar.appendChild( filter ); + + // `label` initialized at top of scope + label = document.createElement( 'label' ); + label.setAttribute( 'for', 'qunit-filter-pass' ); + label.setAttribute( 'title', 'Only show tests and assertons that fail. Stored in sessionStorage.' ); + label.innerHTML = 'Hide passed tests'; + toolbar.appendChild( label ); + + urlConfigCheckboxesContainer = document.createElement('span'); + urlConfigCheckboxesContainer.innerHTML = urlConfigHtml; + urlConfigCheckboxes = urlConfigCheckboxesContainer.getElementsByTagName('input'); + // For oldIE support: + // * Add handlers to the individual elements instead of the container + // * Use "click" instead of "change" + // * Fallback from event.target to event.srcElement + addEvents( urlConfigCheckboxes, 'click', function( event ) { + const params = {}; + const target = event.target || event.srcElement; + params[target.name] = target.checked ? true : undefined; + window.location = QUnit.url( params ); + }); + toolbar.appendChild( urlConfigCheckboxesContainer ); + + if (numModules > 1) { + moduleFilter = document.createElement( 'span' ); + moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' ); + moduleFilter.innerHTML = moduleFilterHtml; + addEvent( moduleFilter.lastChild, 'change', function() { + const selectBox = moduleFilter.getElementsByTagName('select')[0]; + const selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); + + window.location = QUnit.url( {module: ( selectedModule === '' ) ? undefined : selectedModule} ); + }); + toolbar.appendChild(moduleFilter); + } + } + + // `main` initialized at top of scope + main = id( 'qunit-fixture' ); + if ( main ) { + config.fixture = main.innerHTML; + } + + if ( config.autostart ) { + QUnit.start(); + } + }; + + addEvent( window, 'load', QUnit.load ); + + // `onErrorFnPrev` initialized at top of scope + // Preserve other handlers + onErrorFnPrev = window.onerror; + + // Cover uncaught exceptions + // Returning true will surpress the default browser handler, + // returning false will let it run. + window.onerror = function( error, filePath, linerNr ) { + let ret = false; + if ( onErrorFnPrev ) { + ret = onErrorFnPrev( error, filePath, linerNr ); + } + + // Treat return value as window.onerror itself does, + // Only do our handling if not surpressed. + if ( ret !== true ) { + if ( QUnit.config.current ) { + if ( QUnit.config.current.ignoreGlobalErrors ) { + return true; + } + QUnit.pushFailure( error, filePath + ':' + linerNr ); + } else { + QUnit.test( 'global failure', extend( function() { + QUnit.pushFailure( error, filePath + ':' + linerNr ); + }, {validTest: validTest} ) ); + } + return false; + } + + return ret; + }; + + function done() { + config.autorun = true; + + // Log the last module results + if ( config.currentModule ) { + runLoggingCallbacks( 'moduleDone', QUnit, { + name: config.currentModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all, + }); + } + + let i; let key; + const banner = id( 'qunit-banner' ); + const tests = id( 'qunit-tests' ); + const runtime = +new Date() - config.started; + const passed = config.stats.all - config.stats.bad; + const html = [ + 'Tests completed in ', + runtime, + ' milliseconds.
                        ', + '', + passed, + ' assertions of ', + config.stats.all, + ' passed, ', + config.stats.bad, + ' failed.', + ].join( '' ); + + if ( banner ) { + banner.className = ( config.stats.bad ? 'qunit-fail' : 'qunit-pass' ); + } + + if ( tests ) { + id( 'qunit-testresult' ).innerHTML = html; + } + + if ( config.altertitle && typeof document !== 'undefined' && document.title ) { + // show ✖ for good, ✔ for bad suite result in title + // use escape sequences in case file gets loaded with non-utf-8-charset + document.title = [ + ( config.stats.bad ? '\u2716' : '\u2714' ), + document.title.replace( /^[\u2714\u2716] /i, '' ), + ].join( ' ' ); + } + + // clear own sessionStorage items if all tests passed + if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { + // `key` & `i` initialized at top of scope + for ( i = 0; i < sessionStorage.length; i++ ) { + key = sessionStorage.key( i++ ); + if ( key.indexOf( 'qunit-test-' ) === 0 ) { + sessionStorage.removeItem( key ); + } + } + } + + // scroll back to top to show results + if ( window.scrollTo ) { + window.scrollTo(0, 0); + } + + runLoggingCallbacks( 'done', QUnit, { + failed: config.stats.bad, + passed: passed, + total: config.stats.all, + runtime: runtime, + }); + } + + /** @return Boolean: true if this test should be ran */ + function validTest( test ) { + let include; + let filter = config.filter && config.filter.toLowerCase(); + const module = config.module && config.module.toLowerCase(); + const fullName = (test.module + ': ' + test.testName).toLowerCase(); + + // Internally-generated tests are always valid + if ( test.callback && test.callback.validTest === validTest ) { + delete test.callback.validTest; + return true; + } + + if ( config.testNumber ) { + return test.testNumber === config.testNumber; + } + + if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { + return false; + } + + if ( !filter ) { + return true; + } + + include = filter.charAt( 0 ) !== '!'; + if ( !include ) { + filter = filter.slice( 1 ); + } + + // If the filter matches, we need to honour include + if ( fullName.indexOf( filter ) !== -1 ) { + return include; + } + + // Otherwise, do the opposite + return !include; + } + + // so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) + // Later Safari and IE10 are supposed to support error.stack as well + // See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack + function extractStacktrace( e, offset ) { + offset = offset === undefined ? 3 : offset; + + let stack; let include; let i; + + if ( e.stacktrace ) { + // Opera + return e.stacktrace.split( '\n' )[offset + 3]; + } else if ( e.stack ) { + // Firefox, Chrome + stack = e.stack.split( '\n' ); + if (/^error$/i.test( stack[0] ) ) { + stack.shift(); + } + if ( fileName ) { + include = []; + for ( i = offset; i < stack.length; i++ ) { + if ( stack[i].indexOf( fileName ) !== -1 ) { + break; + } + include.push( stack[i] ); + } + if ( include.length ) { + return include.join( '\n' ); + } + } + return stack[offset]; + } else if ( e.sourceURL ) { + // Safari, PhantomJS + // hopefully one day Safari provides actual stacktraces + // exclude useless self-reference for generated Error objects + if ( /qunit.js$/.test( e.sourceURL ) ) { + return; + } + // for actual exceptions, this is useful + return e.sourceURL + ':' + e.line; + } + } + function sourceFromStacktrace( offset ) { + try { + throw new Error(); + } catch ( e ) { + return extractStacktrace( e, offset ); + } + } + + /** * Escape text for attribute or text content. */ -function escapeText( s ) { - if ( !s ) { - return ""; - } - s = s + ""; - // Both single quotes and double quotes (for attributes) - return s.replace( /['"<>&]/g, function( s ) { - switch( s ) { - case '\'': - return '''; - case '"': - return '"'; - case '<': - return '<'; - case '>': - return '>'; - case '&': - return '&'; - } - }); -} - -function synchronize( callback, last ) { - config.queue.push( callback ); - - if ( config.autorun && !config.blocking ) { - process( last ); - } -} - -function process( last ) { - function next() { - process( last ); - } - var start = new Date().getTime(); - config.depth = config.depth ? config.depth + 1 : 1; - - while ( config.queue.length && !config.blocking ) { - if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { - config.queue.shift()(); - } else { - window.setTimeout( next, 13 ); - break; - } - } - config.depth--; - if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { - done(); - } -} - -function saveGlobal() { - config.pollution = []; - - if ( config.noglobals ) { - for ( var key in window ) { - // in Opera sometimes DOM element ids show up here, ignore them - if ( !hasOwn.call( window, key ) || /^qunit-test-output/.test( key ) ) { - continue; - } - config.pollution.push( key ); - } - } -} - -function checkPollution() { - var newGlobals, - deletedGlobals, - old = config.pollution; - - saveGlobal(); - - newGlobals = diff( config.pollution, old ); - if ( newGlobals.length > 0 ) { - QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") ); - } - - deletedGlobals = diff( old, config.pollution ); - if ( deletedGlobals.length > 0 ) { - QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") ); - } -} - -// returns a new Array with the elements that are in a but not in b -function diff( a, b ) { - var i, j, - result = a.slice(); - - for ( i = 0; i < result.length; i++ ) { - for ( j = 0; j < b.length; j++ ) { - if ( result[i] === b[j] ) { - result.splice( i, 1 ); - i--; - break; - } - } - } - return result; -} - -function extend( a, b ) { - for ( var prop in b ) { - if ( b[ prop ] === undefined ) { - delete a[ prop ]; - - // Avoid "Member not found" error in IE8 caused by setting window.constructor - } else if ( prop !== "constructor" || a !== window ) { - a[ prop ] = b[ prop ]; - } - } - - return a; -} - -/** + function escapeText( s ) { + if ( !s ) { + return ''; + } + s = s + ''; + // Both single quotes and double quotes (for attributes) + return s.replace( /['"<>&]/g, function( s ) { + switch ( s ) { + case '\'': + return '''; + case '"': + return '"'; + case '<': + return '<'; + case '>': + return '>'; + case '&': + return '&'; + } + }); + } + + function synchronize( callback, last ) { + config.queue.push( callback ); + + if ( config.autorun && !config.blocking ) { + process( last ); + } + } + + function process( last ) { + function next() { + process( last ); + } + const start = new Date().getTime(); + config.depth = config.depth ? config.depth + 1 : 1; + + while ( config.queue.length && !config.blocking ) { + if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { + config.queue.shift()(); + } else { + window.setTimeout( next, 13 ); + break; + } + } + config.depth--; + if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { + done(); + } + } + + function saveGlobal() { + config.pollution = []; + + if ( config.noglobals ) { + for ( const key in window ) { + // in Opera sometimes DOM element ids show up here, ignore them + if ( !hasOwn.call( window, key ) || /^qunit-test-output/.test( key ) ) { + continue; + } + config.pollution.push( key ); + } + } + } + + function checkPollution() { + let newGlobals; + let deletedGlobals; + const old = config.pollution; + + saveGlobal(); + + newGlobals = diff( config.pollution, old ); + if ( newGlobals.length > 0 ) { + QUnit.pushFailure( 'Introduced global variable(s): ' + newGlobals.join(', ') ); + } + + deletedGlobals = diff( old, config.pollution ); + if ( deletedGlobals.length > 0 ) { + QUnit.pushFailure( 'Deleted global variable(s): ' + deletedGlobals.join(', ') ); + } + } + + // returns a new Array with the elements that are in a but not in b + function diff( a, b ) { + let i; let j; + const result = a.slice(); + + for ( i = 0; i < result.length; i++ ) { + for ( j = 0; j < b.length; j++ ) { + if ( result[i] === b[j] ) { + result.splice( i, 1 ); + i--; + break; + } + } + } + return result; + } + + function extend( a, b ) { + for ( const prop in b ) { + if ( b[prop] === undefined ) { + delete a[prop]; + + // Avoid "Member not found" error in IE8 caused by setting window.constructor + } else if ( prop !== 'constructor' || a !== window ) { + a[prop] = b[prop]; + } + } + + return a; + } + + /** * @param {HTMLElement} elem * @param {string} type * @param {Function} fn */ -function addEvent( elem, type, fn ) { - // Standards-based browsers - if ( elem.addEventListener ) { - elem.addEventListener( type, fn, false ); - // IE - } else { - elem.attachEvent( "on" + type, fn ); - } -} - -/** + function addEvent( elem, type, fn ) { + // Standards-based browsers + if ( elem.addEventListener ) { + elem.addEventListener( type, fn, false ); + // IE + } else { + elem.attachEvent( 'on' + type, fn ); + } + } + + /** * @param {Array|NodeList} elems * @param {string} type * @param {Function} fn */ -function addEvents( elems, type, fn ) { - var i = elems.length; - while ( i-- ) { - addEvent( elems[i], type, fn ); - } -} - -function hasClass( elem, name ) { - return (" " + elem.className + " ").indexOf(" " + name + " ") > -1; -} - -function addClass( elem, name ) { - if ( !hasClass( elem, name ) ) { - elem.className += (elem.className ? " " : "") + name; - } -} - -function removeClass( elem, name ) { - var set = " " + elem.className + " "; - // Class name may appear multiple times - while ( set.indexOf(" " + name + " ") > -1 ) { - set = set.replace(" " + name + " " , " "); - } - // If possible, trim it for prettiness, but not neccecarily - elem.className = window.jQuery ? jQuery.trim( set ) : ( set.trim ? set.trim() : set ); -} - -function id( name ) { - return !!( typeof document !== "undefined" && document && document.getElementById ) && + function addEvents( elems, type, fn ) { + let i = elems.length; + while ( i-- ) { + addEvent( elems[i], type, fn ); + } + } + + function hasClass( elem, name ) { + return (' ' + elem.className + ' ').indexOf(' ' + name + ' ') > -1; + } + + function addClass( elem, name ) { + if ( !hasClass( elem, name ) ) { + elem.className += (elem.className ? ' ' : '') + name; + } + } + + function removeClass( elem, name ) { + let set = ' ' + elem.className + ' '; + // Class name may appear multiple times + while ( set.indexOf(' ' + name + ' ') > -1 ) { + set = set.replace(' ' + name + ' ', ' '); + } + // If possible, trim it for prettiness, but not neccecarily + elem.className = window.jQuery ? jQuery.trim( set ) : ( set.trim ? set.trim() : set ); + } + + function id( name ) { + return !!( typeof document !== 'undefined' && document && document.getElementById ) && document.getElementById( name ); -} - -function registerLoggingCallback( key ) { - return function( callback ) { - config[key].push( callback ); - }; -} - -// Supports deprecated method of completely overwriting logging callbacks -function runLoggingCallbacks( key, scope, args ) { - var i, callbacks; - if ( QUnit.hasOwnProperty( key ) ) { - QUnit[ key ].call(scope, args ); - } else { - callbacks = config[ key ]; - for ( i = 0; i < callbacks.length; i++ ) { - callbacks[ i ].call( scope, args ); - } - } -} - -// Test for equality any JavaScript type. -// Author: Philippe Rathé -QUnit.equiv = (function() { - - // Call the o related callback with the given arguments. - function bindCallbacks( o, callbacks, args ) { - var prop = QUnit.objectType( o ); - if ( prop ) { - if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) { - return callbacks[ prop ].apply( callbacks, args ); - } else { - return callbacks[ prop ]; // or undefined - } - } - } - - // the real equiv function - var innerEquiv, - // stack to decide between skip/abort functions - callers = [], - // stack to avoiding loops from circular referencing - parents = [], - parentsB = [], - - getProto = Object.getPrototypeOf || function ( obj ) { - return obj.__proto__; - }, - callbacks = (function () { - - // for string, boolean, number and null - function useStrictEquality( b, a ) { - /*jshint eqeqeq:false */ - if ( b instanceof a.constructor || a instanceof b.constructor ) { - // to catch short annotaion VS 'new' annotation of a - // declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function( b ) { - return isNaN( b ); - }, - - "date": function( b, a ) { - return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function( b, a ) { - return QUnit.objectType( b ) === "regexp" && + } + + function registerLoggingCallback( key ) { + return function( callback ) { + config[key].push( callback ); + }; + } + + // Supports deprecated method of completely overwriting logging callbacks + function runLoggingCallbacks( key, scope, args ) { + let i; let callbacks; + if ( QUnit.hasOwnProperty( key ) ) { + QUnit[key].call(scope, args ); + } else { + callbacks = config[key]; + for ( i = 0; i < callbacks.length; i++ ) { + callbacks[i].call( scope, args ); + } + } + } + + // Test for equality any JavaScript type. + // Author: Philippe Rathé + QUnit.equiv = (function() { + // Call the o related callback with the given arguments. + function bindCallbacks( o, callbacks, args ) { + const prop = QUnit.objectType( o ); + if ( prop ) { + if ( QUnit.objectType( callbacks[prop] ) === 'function' ) { + return callbacks[prop].apply( callbacks, args ); + } else { + return callbacks[prop]; // or undefined + } + } + } + + // the real equiv function + let innerEquiv; + // stack to decide between skip/abort functions + const callers = []; + // stack to avoiding loops from circular referencing + const parents = []; + const parentsB = []; + + const getProto = Object.getPrototypeOf || function( obj ) { + return obj.__proto__; + }; + const callbacks = (function() { + // for string, boolean, number and null + function useStrictEquality( b, a ) { + /* jshint eqeqeq:false */ + if ( b instanceof a.constructor || a instanceof b.constructor ) { + // to catch short annotaion VS 'new' annotation of a + // declaration + // e.g. var i = 1; + // var j = new Number(1); + return a == b; + } else { + return a === b; + } + } + + return { + 'string': useStrictEquality, + 'boolean': useStrictEquality, + 'number': useStrictEquality, + 'null': useStrictEquality, + 'undefined': useStrictEquality, + + 'nan': function( b ) { + return isNaN( b ); + }, + + 'date': function( b, a ) { + return QUnit.objectType( b ) === 'date' && a.valueOf() === b.valueOf(); + }, + + 'regexp': function( b, a ) { + return QUnit.objectType( b ) === 'regexp' && // the regex itself a.source === b.source && // and its modifers @@ -1638,145 +1634,145 @@ QUnit.equiv = (function() { a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function() { - var caller = callers[callers.length - 1]; - return caller !== Object && typeof caller !== "undefined"; - }, - - "array": function( b, a ) { - var i, j, len, loop, aCircular, bCircular; - - // b could be an object literal here - if ( QUnit.objectType( b ) !== "array" ) { - return false; - } - - len = a.length; - if ( len !== b.length ) { - // safe and faster - return false; - } - - // track reference to avoid circular references - parents.push( a ); - parentsB.push( b ); - for ( i = 0; i < len; i++ ) { - loop = false; - for ( j = 0; j < parents.length; j++ ) { - aCircular = parents[j] === a[i]; - bCircular = parentsB[j] === b[i]; - if ( aCircular || bCircular ) { - if ( a[i] === b[i] || aCircular && bCircular ) { - loop = true; - } else { - parents.pop(); - parentsB.pop(); - return false; - } - } - } - if ( !loop && !innerEquiv(a[i], b[i]) ) { - parents.pop(); - parentsB.pop(); - return false; - } - } - parents.pop(); - parentsB.pop(); - return true; - }, - - "object": function( b, a ) { - var i, j, loop, aCircular, bCircular, - // Default to true - eq = true, - aProperties = [], - bProperties = []; - - // comparing constructors is more strict than using - // instanceof - if ( a.constructor !== b.constructor ) { - // Allow objects with no prototype to be equivalent to - // objects with Object as their constructor. - if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || + }, + + // - skip when the property is a method of an instance (OOP) + // - abort otherwise, + // initial === would have catch identical references anyway + 'function': function() { + const caller = callers[callers.length - 1]; + return caller !== Object && typeof caller !== 'undefined'; + }, + + 'array': function( b, a ) { + let i; let j; let len; let loop; let aCircular; let bCircular; + + // b could be an object literal here + if ( QUnit.objectType( b ) !== 'array' ) { + return false; + } + + len = a.length; + if ( len !== b.length ) { + // safe and faster + return false; + } + + // track reference to avoid circular references + parents.push( a ); + parentsB.push( b ); + for ( i = 0; i < len; i++ ) { + loop = false; + for ( j = 0; j < parents.length; j++ ) { + aCircular = parents[j] === a[i]; + bCircular = parentsB[j] === b[i]; + if ( aCircular || bCircular ) { + if ( a[i] === b[i] || aCircular && bCircular ) { + loop = true; + } else { + parents.pop(); + parentsB.pop(); + return false; + } + } + } + if ( !loop && !innerEquiv(a[i], b[i]) ) { + parents.pop(); + parentsB.pop(); + return false; + } + } + parents.pop(); + parentsB.pop(); + return true; + }, + + 'object': function( b, a ) { + let i; let j; let loop; let aCircular; let bCircular; + // Default to true + let eq = true; + const aProperties = []; + const bProperties = []; + + // comparing constructors is more strict than using + // instanceof + if ( a.constructor !== b.constructor ) { + // Allow objects with no prototype to be equivalent to + // objects with Object as their constructor. + if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || ( getProto(b) === null && getProto(a) === Object.prototype ) ) ) { - return false; - } - } - - // stack constructor before traversing properties - callers.push( a.constructor ); - - // track reference to avoid circular references - parents.push( a ); - parentsB.push( b ); - - // be strict: don't ensures hasOwnProperty and go deep - for ( i in a ) { - loop = false; - for ( j = 0; j < parents.length; j++ ) { - aCircular = parents[j] === a[i]; - bCircular = parentsB[j] === b[i]; - if ( aCircular || bCircular ) { - if ( a[i] === b[i] || aCircular && bCircular ) { - loop = true; - } else { - eq = false; - break; - } - } - } - aProperties.push(i); - if ( !loop && !innerEquiv(a[i], b[i]) ) { - eq = false; - break; - } - } - - parents.pop(); - parentsB.pop(); - callers.pop(); // unstack, we are done - - for ( i in b ) { - bProperties.push( i ); // collect b's properties - } - - // Ensures identical properties name - return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); - } - }; - }()); - - innerEquiv = function() { // can take multiple arguments - var args = [].slice.apply( arguments ); - if ( args.length < 2 ) { - return true; // end transition - } - - return (function( a, b ) { - if ( a === b ) { - return true; // catch the most you can - } else if ( a === null || b === null || typeof a === "undefined" || - typeof b === "undefined" || + return false; + } + } + + // stack constructor before traversing properties + callers.push( a.constructor ); + + // track reference to avoid circular references + parents.push( a ); + parentsB.push( b ); + + // be strict: don't ensures hasOwnProperty and go deep + for ( i in a ) { + loop = false; + for ( j = 0; j < parents.length; j++ ) { + aCircular = parents[j] === a[i]; + bCircular = parentsB[j] === b[i]; + if ( aCircular || bCircular ) { + if ( a[i] === b[i] || aCircular && bCircular ) { + loop = true; + } else { + eq = false; + break; + } + } + } + aProperties.push(i); + if ( !loop && !innerEquiv(a[i], b[i]) ) { + eq = false; + break; + } + } + + parents.pop(); + parentsB.pop(); + callers.pop(); // unstack, we are done + + for ( i in b ) { + bProperties.push( i ); // collect b's properties + } + + // Ensures identical properties name + return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); + }, + }; + }()); + + innerEquiv = function() { // can take multiple arguments + const args = [].slice.apply( arguments ); + if ( args.length < 2 ) { + return true; // end transition + } + + return (function( a, b ) { + if ( a === b ) { + return true; // catch the most you can + } else if ( a === null || b === null || typeof a === 'undefined' || + typeof b === 'undefined' || QUnit.objectType(a) !== QUnit.objectType(b) ) { - return false; // don't lose time with error prone cases - } else { - return bindCallbacks(a, callbacks, [ b, a ]); - } + return false; // don't lose time with error prone cases + } else { + return bindCallbacks(a, callbacks, [b, a]); + } - // apply transition with (1..n) arguments - }( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) ); - }; + // apply transition with (1..n) arguments + }( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) ); + }; - return innerEquiv; -}()); + return innerEquiv; + }()); -/** + /** * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | * http://flesler.blogspot.com Licensed under BSD * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 @@ -1786,242 +1782,242 @@ QUnit.equiv = (function() { * @author Ariel Flesler * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} */ -QUnit.jsDump = (function() { - function quote( str ) { - return '"' + str.toString().replace( /"/g, '\\"' ) + '"'; - } - function literal( o ) { - return o + ""; - } - function join( pre, arr, post ) { - var s = jsDump.separator(), - base = jsDump.indent(), - inner = jsDump.indent(1); - if ( arr.join ) { - arr = arr.join( "," + s + inner ); - } - if ( !arr ) { - return pre + post; - } - return [ pre, inner + arr, base + post ].join(s); - } - function array( arr, stack ) { - var i = arr.length, ret = new Array(i); - this.up(); - while ( i-- ) { - ret[i] = this.parse( arr[i] , undefined , stack); - } - this.down(); - return join( "[", ret, "]" ); - } - - var reName = /^function (\w+)/, - jsDump = { - // type is used mostly internally, you can fix a (custom)type in advance - parse: function( obj, type, stack ) { - stack = stack || [ ]; - var inStack, res, - parser = this.parsers[ type || this.typeOf(obj) ]; - - type = typeof parser; - inStack = inArray( obj, stack ); - - if ( inStack !== -1 ) { - return "recursion(" + (inStack - stack.length) + ")"; - } - if ( type === "function" ) { - stack.push( obj ); - res = parser.call( this, obj, stack ); - stack.pop(); - return res; - } - return ( type === "string" ) ? parser : this.parsers.error; - }, - typeOf: function( obj ) { - var type; - if ( obj === null ) { - type = "null"; - } else if ( typeof obj === "undefined" ) { - type = "undefined"; - } else if ( QUnit.is( "regexp", obj) ) { - type = "regexp"; - } else if ( QUnit.is( "date", obj) ) { - type = "date"; - } else if ( QUnit.is( "function", obj) ) { - type = "function"; - } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) { - type = "window"; - } else if ( obj.nodeType === 9 ) { - type = "document"; - } else if ( obj.nodeType ) { - type = "node"; - } else if ( - // native arrays - toString.call( obj ) === "[object Array]" || + QUnit.jsDump = (function() { + function quote( str ) { + return '"' + str.toString().replace( /"/g, '\\"' ) + '"'; + } + function literal( o ) { + return o + ''; + } + function join( pre, arr, post ) { + const s = jsDump.separator(); + const base = jsDump.indent(); + const inner = jsDump.indent(1); + if ( arr.join ) { + arr = arr.join( ',' + s + inner ); + } + if ( !arr ) { + return pre + post; + } + return [pre, inner + arr, base + post].join(s); + } + function array( arr, stack ) { + let i = arr.length; const ret = new Array(i); + this.up(); + while ( i-- ) { + ret[i] = this.parse( arr[i], undefined, stack); + } + this.down(); + return join( '[', ret, ']' ); + } + + const reName = /^function (\w+)/; + var jsDump = { + // type is used mostly internally, you can fix a (custom)type in advance + parse: function( obj, type, stack ) { + stack = stack || []; + let inStack; let res; + const parser = this.parsers[type || this.typeOf(obj)]; + + type = typeof parser; + inStack = inArray( obj, stack ); + + if ( inStack !== -1 ) { + return 'recursion(' + (inStack - stack.length) + ')'; + } + if ( type === 'function' ) { + stack.push( obj ); + res = parser.call( this, obj, stack ); + stack.pop(); + return res; + } + return ( type === 'string' ) ? parser : this.parsers.error; + }, + typeOf: function( obj ) { + let type; + if ( obj === null ) { + type = 'null'; + } else if ( typeof obj === 'undefined' ) { + type = 'undefined'; + } else if ( QUnit.is( 'regexp', obj) ) { + type = 'regexp'; + } else if ( QUnit.is( 'date', obj) ) { + type = 'date'; + } else if ( QUnit.is( 'function', obj) ) { + type = 'function'; + } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== 'undefined' && typeof obj.nodeType === 'undefined' ) { + type = 'window'; + } else if ( obj.nodeType === 9 ) { + type = 'document'; + } else if ( obj.nodeType ) { + type = 'node'; + } else if ( + // native arrays + toString.call( obj ) === '[object Array]' || // NodeList objects - ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) - ) { - type = "array"; - } else if ( obj.constructor === Error.prototype.constructor ) { - type = "error"; - } else { - type = typeof obj; - } - return type; - }, - separator: function() { - return this.multiline ? this.HTML ? "
                        " : "\n" : this.HTML ? " " : " "; - }, - // extra can be a number, shortcut for increasing-calling-decreasing - indent: function( extra ) { - if ( !this.multiline ) { - return ""; - } - var chr = this.indentChar; - if ( this.HTML ) { - chr = chr.replace( /\t/g, " " ).replace( / /g, " " ); - } - return new Array( this._depth_ + (extra||0) ).join(chr); - }, - up: function( a ) { - this._depth_ += a || 1; - }, - down: function( a ) { - this._depth_ -= a || 1; - }, - setParser: function( name, parser ) { - this.parsers[name] = parser; - }, - // The next 3 are exposed so you can use them - quote: quote, - literal: literal, - join: join, - // - _depth_: 1, - // This is the list of parsers, to modify them, use jsDump.setParser - parsers: { - window: "[Window]", - document: "[Document]", - error: function(error) { - return "Error(\"" + error.message + "\")"; - }, - unknown: "[Unknown]", - "null": "null", - "undefined": "undefined", - "function": function( fn ) { - var ret = "function", - // functions never have name in IE - name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1]; - - if ( name ) { - ret += " " + name; - } - ret += "( "; - - ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" ); - return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" ); - }, - array: array, - nodelist: array, - "arguments": array, - object: function( map, stack ) { - var ret = [ ], keys, key, val, i; - QUnit.jsDump.up(); - keys = []; - for ( key in map ) { - keys.push( key ); - } - keys.sort(); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - val = map[ key ]; - ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) ); - } - QUnit.jsDump.down(); - return join( "{", ret, "}" ); - }, - node: function( node ) { - var len, i, val, - open = QUnit.jsDump.HTML ? "<" : "<", - close = QUnit.jsDump.HTML ? ">" : ">", - tag = node.nodeName.toLowerCase(), - ret = open + tag, - attrs = node.attributes; - - if ( attrs ) { - for ( i = 0, len = attrs.length; i < len; i++ ) { - val = attrs[i].nodeValue; - // IE6 includes all attributes in .attributes, even ones not explicitly set. - // Those have values like undefined, null, 0, false, "" or "inherit". - if ( val && val !== "inherit" ) { - ret += " " + attrs[i].nodeName + "=" + QUnit.jsDump.parse( val, "attribute" ); - } - } - } - ret += close; - - // Show content of TextNode or CDATASection - if ( node.nodeType === 3 || node.nodeType === 4 ) { - ret += node.nodeValue; - } - - return ret + open + "/" + tag + close; - }, - // function calls it internally, it's the arguments part of the function - functionArgs: function( fn ) { - var args, - l = fn.length; - - if ( !l ) { - return ""; - } - - args = new Array(l); - while ( l-- ) { - // 97 is 'a' - args[l] = String.fromCharCode(97+l); - } - return " " + args.join( ", " ) + " "; - }, - // object calls it internally, the key part of an item in a map - key: quote, - // function calls it internally, it's the content of the function - functionCode: "[code]", - // node calls it internally, it's an html attribute value - attribute: quote, - string: quote, - date: quote, - regexp: literal, - number: literal, - "boolean": literal - }, - // if true, entities are escaped ( <, >, \t, space and \n ) - HTML: false, - // indentation unit - indentChar: " ", - // if true, items in a collection, are separated by a \n, else just a space. - multiline: true - }; - - return jsDump; -}()); - -// from jquery.js -function inArray( elem, array ) { - if ( array.indexOf ) { - return array.indexOf( elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; -} - -/* + ( typeof obj.length === 'number' && typeof obj.item !== 'undefined' && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === 'undefined' ) ) ) + ) { + type = 'array'; + } else if ( obj.constructor === Error.prototype.constructor ) { + type = 'error'; + } else { + type = typeof obj; + } + return type; + }, + separator: function() { + return this.multiline ? this.HTML ? '
                        ' : '\n' : this.HTML ? ' ' : ' '; + }, + // extra can be a number, shortcut for increasing-calling-decreasing + indent: function( extra ) { + if ( !this.multiline ) { + return ''; + } + let chr = this.indentChar; + if ( this.HTML ) { + chr = chr.replace( /\t/g, ' ' ).replace( / /g, ' ' ); + } + return new Array( this._depth_ + (extra||0) ).join(chr); + }, + up: function( a ) { + this._depth_ += a || 1; + }, + down: function( a ) { + this._depth_ -= a || 1; + }, + setParser: function( name, parser ) { + this.parsers[name] = parser; + }, + // The next 3 are exposed so you can use them + quote: quote, + literal: literal, + join: join, + // + _depth_: 1, + // This is the list of parsers, to modify them, use jsDump.setParser + parsers: { + 'window': '[Window]', + 'document': '[Document]', + 'error': function(error) { + return 'Error("' + error.message + '")'; + }, + 'unknown': '[Unknown]', + 'null': 'null', + 'undefined': 'undefined', + 'function': function( fn ) { + let ret = 'function'; + // functions never have name in IE + const name = 'name' in fn ? fn.name : (reName.exec(fn) || [])[1]; + + if ( name ) { + ret += ' ' + name; + } + ret += '( '; + + ret = [ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join( '' ); + return join( ret, QUnit.jsDump.parse(fn, 'functionCode' ), '}' ); + }, + 'array': array, + 'nodelist': array, + 'arguments': array, + 'object': function( map, stack ) { + const ret = []; let keys; let key; let val; let i; + QUnit.jsDump.up(); + keys = []; + for ( key in map ) { + keys.push( key ); + } + keys.sort(); + for ( i = 0; i < keys.length; i++ ) { + key = keys[i]; + val = map[key]; + ret.push( QUnit.jsDump.parse( key, 'key' ) + ': ' + QUnit.jsDump.parse( val, undefined, stack ) ); + } + QUnit.jsDump.down(); + return join( '{', ret, '}' ); + }, + 'node': function( node ) { + let len; let i; let val; + const open = QUnit.jsDump.HTML ? '<' : '<'; + const close = QUnit.jsDump.HTML ? '>' : '>'; + const tag = node.nodeName.toLowerCase(); + let ret = open + tag; + const attrs = node.attributes; + + if ( attrs ) { + for ( i = 0, len = attrs.length; i < len; i++ ) { + val = attrs[i].nodeValue; + // IE6 includes all attributes in .attributes, even ones not explicitly set. + // Those have values like undefined, null, 0, false, "" or "inherit". + if ( val && val !== 'inherit' ) { + ret += ' ' + attrs[i].nodeName + '=' + QUnit.jsDump.parse( val, 'attribute' ); + } + } + } + ret += close; + + // Show content of TextNode or CDATASection + if ( node.nodeType === 3 || node.nodeType === 4 ) { + ret += node.nodeValue; + } + + return ret + open + '/' + tag + close; + }, + // function calls it internally, it's the arguments part of the function + 'functionArgs': function( fn ) { + let args; + let l = fn.length; + + if ( !l ) { + return ''; + } + + args = new Array(l); + while ( l-- ) { + // 97 is 'a' + args[l] = String.fromCharCode(97+l); + } + return ' ' + args.join( ', ' ) + ' '; + }, + // object calls it internally, the key part of an item in a map + 'key': quote, + // function calls it internally, it's the content of the function + 'functionCode': '[code]', + // node calls it internally, it's an html attribute value + 'attribute': quote, + 'string': quote, + 'date': quote, + 'regexp': literal, + 'number': literal, + 'boolean': literal, + }, + // if true, entities are escaped ( <, >, \t, space and \n ) + HTML: false, + // indentation unit + indentChar: ' ', + // if true, items in a collection, are separated by a \n, else just a space. + multiline: true, + }; + + return jsDump; + }()); + + // from jquery.js + function inArray( elem, array ) { + if ( array.indexOf ) { + return array.indexOf( elem ); + } + + for ( let i = 0, length = array.length; i < length; i++ ) { + if ( array[i] === elem ) { + return i; + } + } + + return -1; + } + + /* * Javascript Diff Algorithm * By John Resig (http://ejohn.org/) * Modified by Chu Alan "sprite" @@ -2035,145 +2031,141 @@ function inArray( elem, array ) { * * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick brown fox jumped jumps over" */ -QUnit.diff = (function() { - /*jshint eqeqeq:false, eqnull:true */ - function diff( o, n ) { - var i, - ns = {}, - os = {}; - - for ( i = 0; i < n.length; i++ ) { - if ( !hasOwn.call( ns, n[i] ) ) { - ns[ n[i] ] = { - rows: [], - o: null - }; - } - ns[ n[i] ].rows.push( i ); - } - - for ( i = 0; i < o.length; i++ ) { - if ( !hasOwn.call( os, o[i] ) ) { - os[ o[i] ] = { - rows: [], - n: null - }; - } - os[ o[i] ].rows.push( i ); - } - - for ( i in ns ) { - if ( !hasOwn.call( ns, i ) ) { - continue; - } - if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { - n[ ns[i].rows[0] ] = { - text: n[ ns[i].rows[0] ], - row: os[i].rows[0] - }; - o[ os[i].rows[0] ] = { - text: o[ os[i].rows[0] ], - row: ns[i].rows[0] - }; - } - } - - for ( i = 0; i < n.length - 1; i++ ) { - if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null && - n[ i + 1 ] == o[ n[i].row + 1 ] ) { - - n[ i + 1 ] = { - text: n[ i + 1 ], - row: n[i].row + 1 - }; - o[ n[i].row + 1 ] = { - text: o[ n[i].row + 1 ], - row: i + 1 - }; - } - } - - for ( i = n.length - 1; i > 0; i-- ) { - if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null && - n[ i - 1 ] == o[ n[i].row - 1 ]) { - - n[ i - 1 ] = { - text: n[ i - 1 ], - row: n[i].row - 1 - }; - o[ n[i].row - 1 ] = { - text: o[ n[i].row - 1 ], - row: i - 1 - }; - } - } - - return { - o: o, - n: n - }; - } - - return function( o, n ) { - o = o.replace( /\s+$/, "" ); - n = n.replace( /\s+$/, "" ); - - var i, pre, - str = "", - out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ), - oSpace = o.match(/\s+/g), - nSpace = n.match(/\s+/g); - - if ( oSpace == null ) { - oSpace = [ " " ]; - } - else { - oSpace.push( " " ); - } - - if ( nSpace == null ) { - nSpace = [ " " ]; - } - else { - nSpace.push( " " ); - } - - if ( out.n.length === 0 ) { - for ( i = 0; i < out.o.length; i++ ) { - str += "" + out.o[i] + oSpace[i] + ""; - } - } - else { - if ( out.n[0].text == null ) { - for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { - str += "" + out.o[n] + oSpace[n] + ""; - } - } - - for ( i = 0; i < out.n.length; i++ ) { - if (out.n[i].text == null) { - str += "" + out.n[i] + nSpace[i] + ""; - } - else { - // `pre` initialized at top of scope - pre = ""; - - for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { - pre += "" + out.o[n] + oSpace[n] + ""; - } - str += " " + out.n[i].text + nSpace[i] + pre; - } - } - } - - return str; - }; -}()); - -// for CommonJS enviroments, export everything -if ( typeof exports !== "undefined" ) { - extend( exports, QUnit ); -} + QUnit.diff = (function() { + /* jshint eqeqeq:false, eqnull:true */ + function diff( o, n ) { + let i; + const ns = {}; + const os = {}; + + for ( i = 0; i < n.length; i++ ) { + if ( !hasOwn.call( ns, n[i] ) ) { + ns[n[i]] = { + rows: [], + o: null, + }; + } + ns[n[i]].rows.push( i ); + } + + for ( i = 0; i < o.length; i++ ) { + if ( !hasOwn.call( os, o[i] ) ) { + os[o[i]] = { + rows: [], + n: null, + }; + } + os[o[i]].rows.push( i ); + } + + for ( i in ns ) { + if ( !hasOwn.call( ns, i ) ) { + continue; + } + if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { + n[ns[i].rows[0]] = { + text: n[ns[i].rows[0]], + row: os[i].rows[0], + }; + o[os[i].rows[0]] = { + text: o[os[i].rows[0]], + row: ns[i].rows[0], + }; + } + } + + for ( i = 0; i < n.length - 1; i++ ) { + if ( n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null && + n[i + 1] == o[n[i].row + 1] ) { + n[i + 1] = { + text: n[i + 1], + row: n[i].row + 1, + }; + o[n[i].row + 1] = { + text: o[n[i].row + 1], + row: i + 1, + }; + } + } + + for ( i = n.length - 1; i > 0; i-- ) { + if ( n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null && + n[i - 1] == o[n[i].row - 1]) { + n[i - 1] = { + text: n[i - 1], + row: n[i].row - 1, + }; + o[n[i].row - 1] = { + text: o[n[i].row - 1], + row: i - 1, + }; + } + } + + return { + o: o, + n: n, + }; + } + + return function( o, n ) { + o = o.replace( /\s+$/, '' ); + n = n.replace( /\s+$/, '' ); + + let i; let pre; + let str = ''; + const out = diff( o === '' ? [] : o.split(/\s+/), n === '' ? [] : n.split(/\s+/) ); + let oSpace = o.match(/\s+/g); + let nSpace = n.match(/\s+/g); + + if ( oSpace == null ) { + oSpace = [' ']; + } else { + oSpace.push( ' ' ); + } + + if ( nSpace == null ) { + nSpace = [' ']; + } else { + nSpace.push( ' ' ); + } + + if ( out.n.length === 0 ) { + for ( i = 0; i < out.o.length; i++ ) { + str += '' + out.o[i] + oSpace[i] + ''; + } + } else { + if ( out.n[0].text == null ) { + for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { + str += '' + out.o[n] + oSpace[n] + ''; + } + } + + for ( i = 0; i < out.n.length; i++ ) { + if (out.n[i].text == null) { + str += '' + out.n[i] + nSpace[i] + ''; + } else { + // `pre` initialized at top of scope + pre = ''; + + for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { + pre += '' + out.o[n] + oSpace[n] + ''; + } + str += ' ' + out.n[i].text + nSpace[i] + pre; + } + } + } + + return str; + }; + }()); + + // for CommonJS enviroments, export everything + if ( typeof exports !== 'undefined' ) { + extend( exports, QUnit ); + } // get at whatever the global object is, like window in browsers -}( (function() {return this;}.call()) )); +}( (function() { + return this; +}.call()) )); diff --git a/test/qunit/swarminject.js b/test/qunit/swarminject.js index 9ba55aa..93db7ad 100644 --- a/test/qunit/swarminject.js +++ b/test/qunit/swarminject.js @@ -1,10 +1,10 @@ // load testswarm agent (function() { - var url = window.location.search; - url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) ); - if ( !url || url.indexOf("http") !== 0 ) { - return; - } - /*jshint evil:true */ - document.write(""); + let url = window.location.search; + url = decodeURIComponent( url.slice( url.indexOf('swarmURL=') + 9 ) ); + if ( !url || url.indexOf('http') !== 0 ) { + return; + } + /* jshint evil:true */ + document.write(''); })(); diff --git a/test/qunit/test.js b/test/qunit/test.js index 630cc81..ee1d9d9 100644 --- a/test/qunit/test.js +++ b/test/qunit/test.js @@ -1,747 +1,747 @@ function getPreviousTests( rTestName, rModuleName ) { - var testSpan, moduleSpan, - matches = [], - i = 0, - rModule = /(^| )module-name( |$)/, - testNames = typeof document.getElementsByClassName !== "undefined" ? - document.getElementsByClassName("test-name") : + let testSpan; let moduleSpan; + const matches = []; + let i = 0; + const rModule = /(^| )module-name( |$)/; + const testNames = typeof document.getElementsByClassName !== 'undefined' ? + document.getElementsByClassName('test-name') : (function( spans ) { - var span, - tests = [], - i = 0, - rTest = /(^| )test-name( |$)/; - for ( ; (span = spans[i]); i++ ) { - if ( rTest.test( span.className ) ) { - tests.push( span ); - } - } - return tests; - })( document.getElementsByTagName("span") ); - - for ( ; (testSpan = testNames[i]); i++ ) { - moduleSpan = testSpan; - while ( (moduleSpan = moduleSpan.previousSibling) ) { - if ( rModule.test( moduleSpan.className ) ) { - break; - } - } - if ( (!rTestName || rTestName.test( testSpan.innerHTML )) && + let span; + const tests = []; + let i = 0; + const rTest = /(^| )test-name( |$)/; + for ( ; (span = spans[i]); i++ ) { + if ( rTest.test( span.className ) ) { + tests.push( span ); + } + } + return tests; + })( document.getElementsByTagName('span') ); + + for ( ; (testSpan = testNames[i]); i++ ) { + moduleSpan = testSpan; + while ( (moduleSpan = moduleSpan.previousSibling) ) { + if ( rModule.test( moduleSpan.className ) ) { + break; + } + } + if ( (!rTestName || rTestName.test( testSpan.innerHTML )) && (!rModuleName || moduleSpan && rModuleName.test( moduleSpan.innerHTML )) ) { - - while ( (testSpan = testSpan.parentNode) ) { - if ( testSpan.nodeName.toLowerCase() === "li" ) { - matches.push( testSpan ); - } - } - } - } - return matches; + while ( (testSpan = testSpan.parentNode) ) { + if ( testSpan.nodeName.toLowerCase() === 'li' ) { + matches.push( testSpan ); + } + } + } + } + return matches; } -test("module without setup/teardown (default)", function() { - expect(1); - ok(true); +test('module without setup/teardown (default)', function() { + expect(1); + ok(true); }); -test("expect in test", 3, function() { - ok(true); - ok(true); - ok(true); +test('expect in test', 3, function() { + ok(true); + ok(true); + ok(true); }); -test("expect in test", 1, function() { - ok(true); +test('expect in test', 1, function() { + ok(true); }); -test("expect query and multiple issue", function() { - expect(2); - ok(true); - var expected = expect(); - equal(expected, 2); - expect(expected + 1); - ok(true); +test('expect query and multiple issue', function() { + expect(2); + ok(true); + const expected = expect(); + equal(expected, 2); + expect(expected + 1); + ok(true); }); -QUnit.module("assertion helpers"); +QUnit.module('assertion helpers'); -QUnit.test( "QUnit.assert compatibility", 5, function( assert ) { - assert.ok( true, "Calling method on `assert` argument to test() callback" ); +QUnit.test( 'QUnit.assert compatibility', 5, function( assert ) { + assert.ok( true, 'Calling method on `assert` argument to test() callback' ); - // Should also work, although discouraged and not documented - QUnit.assert.ok( true, "Calling method on QUnit.assert object" ); + // Should also work, although discouraged and not documented + QUnit.assert.ok( true, 'Calling method on QUnit.assert object' ); - // Test compatibility aliases - QUnit.ok( true, "Calling aliased method in QUnit root object" ); - ok( true, "Calling aliased function in global namespace" ); + // Test compatibility aliases + QUnit.ok( true, 'Calling aliased method in QUnit root object' ); + ok( true, 'Calling aliased function in global namespace' ); - // Regression fix for #341 - // The assert-context way of testing discouraged global variables, - // it doesn't make sense of it itself to be a global variable. - // Only allows for mistakes (e.g. forgetting to list 'assert' as parameter) - assert.notStrictEqual( window.assert, QUnit.assert, "Assert does not get exposed as a global variable" ); + // Regression fix for #341 + // The assert-context way of testing discouraged global variables, + // it doesn't make sense of it itself to be a global variable. + // Only allows for mistakes (e.g. forgetting to list 'assert' as parameter) + assert.notStrictEqual( window.assert, QUnit.assert, 'Assert does not get exposed as a global variable' ); }); -module("setup test", { - setup: function() { - ok(true); - } +module('setup test', { + setup: function() { + ok(true); + }, }); -test("module with setup", function() { - expect(2); - ok(true); +test('module with setup', function() { + expect(2); + ok(true); }); -test("module with setup, expect in test call", 2, function() { - ok(true); +test('module with setup, expect in test call', 2, function() { + ok(true); }); -module("", { - setup: function() { - }, - teardown: function() { - // We can't use ok(false) inside script tags since some browsers - // don't evaluate script tags inserted through innerHTML after domready. - // Counting them before/after doesn't cover everything either as qunit-modulefilter - // is created before any test is ran. So use ids instead. - if (document.getElementById('qunit-unescaped-module')) { - // This can either be from in #qunit-modulefilter or #qunit-testresult - ok(false, 'Unscaped module name'); - } - if (document.getElementById('qunit-unescaped-test')) { - ok(false, 'Unscaped test name'); - } - if (document.getElementById('qunit-unescaped-assertion')) { - ok(false, 'Unscaped test name'); - } - } +module('', { + setup: function() { + }, + teardown: function() { + // We can't use ok(false) inside script tags since some browsers + // don't evaluate script tags inserted through innerHTML after domready. + // Counting them before/after doesn't cover everything either as qunit-modulefilter + // is created before any test is ran. So use ids instead. + if (document.getElementById('qunit-unescaped-module')) { + // This can either be from in #qunit-modulefilter or #qunit-testresult + ok(false, 'Unscaped module name'); + } + if (document.getElementById('qunit-unescaped-test')) { + ok(false, 'Unscaped test name'); + } + if (document.getElementById('qunit-unescaped-assertion')) { + ok(false, 'Unscaped test name'); + } + }, }); -test("", 1, function() { - ok(true, ""); +test('', 1, function() { + ok(true, ''); }); -var state; +let state; -module("setup/teardown test", { - setup: function() { - state = true; - ok(true); - // Assert that we can introduce and delete globals in setup/teardown - // without noglobals sounding any alarm. +module('setup/teardown test', { + setup: function() { + state = true; + ok(true); + // Assert that we can introduce and delete globals in setup/teardown + // without noglobals sounding any alarm. - // Using an implied global variable instead of explicit window property - // because there is no way to delete a window.property in IE6-8 - // `delete x` only works for `x = 1, and `delete window.x` throws exception. - // No one-code fits all solution possible afaic. Resort to @cc. + // Using an implied global variable instead of explicit window property + // because there is no way to delete a window.property in IE6-8 + // `delete x` only works for `x = 1, and `delete window.x` throws exception. + // No one-code fits all solution possible afaic. Resort to @cc. - /*@cc_on + /* @cc_on @if (@_jscript_version < 9) x = 1; @else @*/ - window.x = 1; - /*@end + window.x = 1; + /* @end @*/ - }, - teardown: function() { - ok(true); + }, + teardown: function() { + ok(true); - /*@cc_on + /* @cc_on @if (@_jscript_version < 9) delete x; @else @*/ - delete window.x; - /*@end + delete window.x; + /* @end @*/ - } + }, }); -test("module with setup/teardown", function() { - expect(3); - ok(true); +test('module with setup/teardown', function() { + expect(3); + ok(true); }); -module("setup/teardown test 2"); +module('setup/teardown test 2'); -test("module without setup/teardown", function() { - expect(1); - ok(true); +test('module without setup/teardown', function() { + expect(1); + ok(true); }); -var orgDate; +let orgDate; -module("Date test", { - setup: function() { - orgDate = Date; - window.Date = function () { - ok( false, 'QUnit should internally be independant from Date-related manipulation and testing' ); - return new orgDate(); - }; - }, - teardown: function() { - window.Date = orgDate; - } +module('Date test', { + setup: function() { + orgDate = Date; + window.Date = function() { + ok( false, 'QUnit should internally be independant from Date-related manipulation and testing' ); + return new orgDate(); + }; + }, + teardown: function() { + window.Date = orgDate; + }, }); -test("sample test for Date test", function () { - expect(1); - ok(true); +test('sample test for Date test', function() { + expect(1); + ok(true); }); if (typeof setTimeout !== 'undefined') { -state = 'fail'; - -module("teardown and stop", { - teardown: function() { - equal(state, "done", "Test teardown."); - } -}); - -test("teardown must be called after test ended", function() { - expect(1); - stop(); - setTimeout(function() { - state = "done"; - start(); - }, 13); -}); - -test("parameter passed to stop increments semaphore n times", function() { - expect(1); - stop(3); - setTimeout(function() { - state = "not enough starts"; - start(); - start(); - }, 13); - setTimeout(function() { - state = "done"; - start(); - }, 15); -}); - -test("parameter passed to start decrements semaphore n times", function() { - expect(1); - stop(); - stop(); - stop(); - setTimeout(function() { - state = "done"; - start(3); - }, 18); -}); - -module("async setup test", { - setup: function() { - stop(); - setTimeout(function() { - ok(true); - start(); - }, 500); - } -}); - -asyncTest("module with async setup", function() { - expect(2); - ok(true); - start(); -}); - -module("async teardown test", { - teardown: function() { - stop(); - setTimeout(function() { - ok(true); - start(); - }, 500); - } -}); - -asyncTest("module with async teardown", function() { - expect(2); - ok(true); - start(); -}); - -module("asyncTest"); - -asyncTest("asyncTest", function() { - expect(2); - ok(true); - setTimeout(function() { - state = "done"; - ok(true); - start(); - }, 13); -}); - -asyncTest("asyncTest", 2, function() { - ok(true); - setTimeout(function() { - state = "done"; - ok(true); - start(); - }, 13); -}); - -test("sync", 2, function() { - stop(); - setTimeout(function() { - ok(true); - start(); - }, 13); - stop(); - setTimeout(function() { - ok(true); - start(); - }, 125); -}); - -test("test synchronous calls to stop", 2, function() { - stop(); - setTimeout(function() { - ok(true, 'first'); - start(); - stop(); - setTimeout(function() { - ok(true, 'second'); - start(); - }, 150); - }, 150); -}); + state = 'fail'; + + module('teardown and stop', { + teardown: function() { + equal(state, 'done', 'Test teardown.'); + }, + }); + + test('teardown must be called after test ended', function() { + expect(1); + stop(); + setTimeout(function() { + state = 'done'; + start(); + }, 13); + }); + + test('parameter passed to stop increments semaphore n times', function() { + expect(1); + stop(3); + setTimeout(function() { + state = 'not enough starts'; + start(); + start(); + }, 13); + setTimeout(function() { + state = 'done'; + start(); + }, 15); + }); + + test('parameter passed to start decrements semaphore n times', function() { + expect(1); + stop(); + stop(); + stop(); + setTimeout(function() { + state = 'done'; + start(3); + }, 18); + }); + + module('async setup test', { + setup: function() { + stop(); + setTimeout(function() { + ok(true); + start(); + }, 500); + }, + }); + + asyncTest('module with async setup', function() { + expect(2); + ok(true); + start(); + }); + + module('async teardown test', { + teardown: function() { + stop(); + setTimeout(function() { + ok(true); + start(); + }, 500); + }, + }); + + asyncTest('module with async teardown', function() { + expect(2); + ok(true); + start(); + }); + + module('asyncTest'); + + asyncTest('asyncTest', function() { + expect(2); + ok(true); + setTimeout(function() { + state = 'done'; + ok(true); + start(); + }, 13); + }); + + asyncTest('asyncTest', 2, function() { + ok(true); + setTimeout(function() { + state = 'done'; + ok(true); + start(); + }, 13); + }); + + test('sync', 2, function() { + stop(); + setTimeout(function() { + ok(true); + start(); + }, 13); + stop(); + setTimeout(function() { + ok(true); + start(); + }, 125); + }); + + test('test synchronous calls to stop', 2, function() { + stop(); + setTimeout(function() { + ok(true, 'first'); + start(); + stop(); + setTimeout(function() { + ok(true, 'second'); + start(); + }, 150); + }, 150); + }); } -module("save scope", { - setup: function() { - this.foo = "bar"; - }, - teardown: function() { - deepEqual(this.foo, "bar"); - } +module('save scope', { + setup: function() { + this.foo = 'bar'; + }, + teardown: function() { + deepEqual(this.foo, 'bar'); + }, }); -test("scope check", function() { - expect(2); - deepEqual(this.foo, "bar"); +test('scope check', function() { + expect(2); + deepEqual(this.foo, 'bar'); }); -module("simple testEnvironment setup", { - foo: "bar", - // example of meta-data - bugid: "#5311" +module('simple testEnvironment setup', { + foo: 'bar', + // example of meta-data + bugid: '#5311', }); -test("scope check", function() { - deepEqual(this.foo, "bar"); +test('scope check', function() { + deepEqual(this.foo, 'bar'); }); -test("modify testEnvironment",function() { - expect(0); - this.foo="hamster"; +test('modify testEnvironment', function() { + expect(0); + this.foo='hamster'; }); -test("testEnvironment reset for next test",function() { - deepEqual(this.foo, "bar"); +test('testEnvironment reset for next test', function() { + deepEqual(this.foo, 'bar'); }); -module("testEnvironment with object", { - options:{ - recipe:"soup", - ingredients:["hamster","onions"] - } +module('testEnvironment with object', { + options: { + recipe: 'soup', + ingredients: ['hamster', 'onions'], + }, }); -test("scope check", function() { - deepEqual(this.options, {recipe:"soup",ingredients:["hamster","onions"]}) ; +test('scope check', function() { + deepEqual(this.options, {recipe: 'soup', ingredients: ['hamster', 'onions']}); }); -test("modify testEnvironment",function() { - expect(0); - // since we do a shallow copy, the testEnvironment can be modified - this.options.ingredients.push("carrots"); +test('modify testEnvironment', function() { + expect(0); + // since we do a shallow copy, the testEnvironment can be modified + this.options.ingredients.push('carrots'); }); -test("testEnvironment reset for next test",function() { - deepEqual(this.options, {recipe:"soup",ingredients:["hamster","onions","carrots"]}, "Is this a bug or a feature? Could do a deep copy") ; +test('testEnvironment reset for next test', function() { + deepEqual(this.options, {recipe: 'soup', ingredients: ['hamster', 'onions', 'carrots']}, 'Is this a bug or a feature? Could do a deep copy'); }); -module("testEnvironment tests"); +module('testEnvironment tests'); function makeurl() { - var testEnv = QUnit.current_testEnvironment; - var url = testEnv.url || 'http://example.com/search'; - var q = testEnv.q || 'a search test'; - return url + '?q='+encodeURIComponent(q); + const testEnv = QUnit.current_testEnvironment; + const url = testEnv.url || 'http://example.com/search'; + const q = testEnv.q || 'a search test'; + return url + '?q='+encodeURIComponent(q); } -test("makeurl working",function() { - equal( QUnit.current_testEnvironment, this, 'The current testEnvironment is global'); - equal( makeurl(), 'http://example.com/search?q=a%20search%20test', 'makeurl returns a default url if nothing specified in the testEnvironment'); -}); - -module("testEnvironment with makeurl settings", { - url: 'http://google.com/', - q: 'another_search_test' -}); -test("makeurl working with settings from testEnvironment", function() { - equal( makeurl(), 'http://google.com/?q=another_search_test', 'rather than passing arguments, we use test metadata to from the url'); -}); - -module("jsDump"); -test("jsDump output", function() { - equal( QUnit.jsDump.parse([1, 2]), "[\n 1,\n 2\n]" ); - equal( QUnit.jsDump.parse({top: 5, left: 0}), "{\n \"left\": 0,\n \"top\": 5\n}" ); - if (typeof document !== 'undefined' && document.getElementById("qunit-header")) { - equal( QUnit.jsDump.parse(document.getElementById("qunit-header")), "

                        " ); - equal( QUnit.jsDump.parse(document.getElementsByTagName("h1")), "[\n

                        \n]" ); - } -}); - -module("assertions"); - -test("propEqual", 5, function( assert ) { - var objectCreate = Object.create || function ( origin ) { - function O() {} - O.prototype = origin; - var r = new O(); - return r; - }; - - function Foo( x, y, z ) { - this.x = x; - this.y = y; - this.z = z; - } - Foo.prototype.doA = function () {}; - Foo.prototype.doB = function () {}; - Foo.prototype.bar = 'prototype'; - - function Bar() { - } - Bar.prototype = objectCreate( Foo.prototype ); - Bar.prototype.constructor = Bar; - - assert.propEqual( - new Foo( 1, '2', [] ), - { - x: 1, - y: '2', - z: [] - } - ); - - assert.notPropEqual( - new Foo( '1', 2, 3 ), - { - x: 1, - y: '2', - z: 3 - }, - 'Primitive values are strictly compared' - ); - - assert.notPropEqual( - new Foo( 1, '2', [] ), - { - x: 1, - y: '2', - z: {} - }, - 'Array type is preserved' - ); - - assert.notPropEqual( - new Foo( 1, '2', {} ), - { - x: 1, - y: '2', - z: [] - }, - 'Empty array is not the same as empty object' - ); - - assert.propEqual( - new Foo( 1, '2', new Foo( [ 3 ], new Bar(), null ) ), - { - x: 1, - y: '2', - z: { - x: [ 3 ], - y: {}, - z: null - } - }, - 'Complex nesting of different types, inheritance and constructors' - ); -}); - -test("raises", 9, function() { - function CustomError( message ) { - this.message = message; - } - - CustomError.prototype.toString = function() { - return this.message; - }; - - throws( - function() { - throw "my error"; - } - ); - - throws( - function() { - throw "my error"; - }, - "simple string throw, no 'expected' value given" - ); - - // This test is for IE 7 and prior which does not properly - // implement Error.prototype.toString - throws( - function() { - throw new Error("error message"); - }, - /error message/, - "use regexp against instance of Error" - ); - - throws( - function() { - throw new CustomError(); - }, - CustomError, - 'thrown error is an instance of CustomError' - ); - - throws( - function() { - throw new CustomError("some error description"); - }, - /description/, - "use a regex to match against the stringified error" - ); - - throws( - function() { - throw new CustomError("some error description"); - }, - function( err ) { - if ( (err instanceof CustomError) && /description/.test(err) ) { - return true; - } - }, - "custom validation function" - ); - - throws( - function() { - /*jshint evil:true */ - ( window.execScript || function( data ) { - window["eval"].call( window, data ); - })( "throw 'error';" ); - }, - 'globally-executed errors caught' - ); - - this.CustomError = CustomError; - - throws( - function() { - throw new this.CustomError("some error description"); - }, - /description/, - "throw error from property of 'this' context" - ); - - raises( - function() { - throw "error"; +test('makeurl working', function() { + equal( QUnit.current_testEnvironment, this, 'The current testEnvironment is global'); + equal( makeurl(), 'http://example.com/search?q=a%20search%20test', 'makeurl returns a default url if nothing specified in the testEnvironment'); +}); + +module('testEnvironment with makeurl settings', { + url: 'http://google.com/', + q: 'another_search_test', +}); +test('makeurl working with settings from testEnvironment', function() { + equal( makeurl(), 'http://google.com/?q=another_search_test', 'rather than passing arguments, we use test metadata to from the url'); +}); + +module('jsDump'); +test('jsDump output', function() { + equal( QUnit.jsDump.parse([1, 2]), '[\n 1,\n 2\n]' ); + equal( QUnit.jsDump.parse({top: 5, left: 0}), '{\n "left": 0,\n "top": 5\n}' ); + if (typeof document !== 'undefined' && document.getElementById('qunit-header')) { + equal( QUnit.jsDump.parse(document.getElementById('qunit-header')), '

                        ' ); + equal( QUnit.jsDump.parse(document.getElementsByTagName('h1')), '[\n

                        \n]' ); + } +}); + +module('assertions'); + +test('propEqual', 5, function( assert ) { + const objectCreate = Object.create || function( origin ) { + function O() {} + O.prototype = origin; + const r = new O(); + return r; + }; + + function Foo( x, y, z ) { + this.x = x; + this.y = y; + this.z = z; + } + Foo.prototype.doA = function() {}; + Foo.prototype.doB = function() {}; + Foo.prototype.bar = 'prototype'; + + function Bar() { + } + Bar.prototype = objectCreate( Foo.prototype ); + Bar.prototype.constructor = Bar; + + assert.propEqual( + new Foo( 1, '2', [] ), + { + x: 1, + y: '2', + z: [], + } + ); + + assert.notPropEqual( + new Foo( '1', 2, 3 ), + { + x: 1, + y: '2', + z: 3, + }, + 'Primitive values are strictly compared' + ); + + assert.notPropEqual( + new Foo( 1, '2', [] ), + { + x: 1, + y: '2', + z: {}, + }, + 'Array type is preserved' + ); + + assert.notPropEqual( + new Foo( 1, '2', {} ), + { + x: 1, + y: '2', + z: [], + }, + 'Empty array is not the same as empty object' + ); + + assert.propEqual( + new Foo( 1, '2', new Foo( [3], new Bar(), null ) ), + { + x: 1, + y: '2', + z: { + x: [3], + y: {}, + z: null, }, - "simple throw, asserting with deprecated raises() function" - ); - -}); - -if (typeof document !== "undefined") { - -module("fixture"); -test("setup", function() { - expect(0); - document.getElementById("qunit-fixture").innerHTML = "foobar"; -}); - -test("basics", function() { - equal( document.getElementById("qunit-fixture").innerHTML, "test markup", "automatically reset" ); -}); - -test("running test name displayed", function() { - expect(2); - - var displaying = document.getElementById("qunit-testresult"); - - ok( /running test name displayed/.test(displaying.innerHTML), "Expect test name to be found in displayed text" ); - ok( /fixture/.test(displaying.innerHTML), "Expect module name to be found in displayed text" ); -}); - -(function() { - var delayNextSetup, - sleep = function( n ) { - stop(); - setTimeout( function() { start(); }, n ); - }; - - module("timing", { - setup: function() { - if ( delayNextSetup ) { - delayNextSetup = false; - sleep( 250 ); - } - } - }); - - test("setup", 0, function() { - delayNextSetup = true; - }); - - test("basics", 2, function() { - var previous = getPreviousTests(/^setup$/, /^timing$/)[0], - runtime = previous.lastChild.previousSibling; - ok( /(^| )runtime( |$)/.test( runtime.className ), "Runtime element exists" ); - ok( /^\d+ ms$/.test( runtime.innerHTML ), "Runtime reported in ms" ); - }); - - test("values", 2, function() { - var basics = getPreviousTests(/^setup$/, /^timing$/)[0], - slow = getPreviousTests(/^basics$/, /^timing$/)[0]; - ok( parseInt( basics.lastChild.previousSibling.innerHTML, 10 ) < 50, "Fast runtime for trivial test" ); - ok( parseInt( slow.lastChild.previousSibling.innerHTML, 10 ) > 250, "Runtime includes setup" ); - }); -})(); - + }, + 'Complex nesting of different types, inheritance and constructors' + ); +}); + +test('raises', 9, function() { + function CustomError( message ) { + this.message = message; + } + + CustomError.prototype.toString = function() { + return this.message; + }; + + throws( + function() { + throw 'my error'; + } + ); + + throws( + function() { + throw 'my error'; + }, + 'simple string throw, no \'expected\' value given' + ); + + // This test is for IE 7 and prior which does not properly + // implement Error.prototype.toString + throws( + function() { + throw new Error('error message'); + }, + /error message/, + 'use regexp against instance of Error' + ); + + throws( + function() { + throw new CustomError(); + }, + CustomError, + 'thrown error is an instance of CustomError' + ); + + throws( + function() { + throw new CustomError('some error description'); + }, + /description/, + 'use a regex to match against the stringified error' + ); + + throws( + function() { + throw new CustomError('some error description'); + }, + function( err ) { + if ( (err instanceof CustomError) && /description/.test(err) ) { + return true; + } + }, + 'custom validation function' + ); + + throws( + function() { + /* jshint evil:true */ + ( window.execScript || function( data ) { + window['eval'].call( window, data ); + })( 'throw \'error\';' ); + }, + 'globally-executed errors caught' + ); + + this.CustomError = CustomError; + + throws( + function() { + throw new this.CustomError('some error description'); + }, + /description/, + 'throw error from property of \'this\' context' + ); + + raises( + function() { + throw 'error'; + }, + 'simple throw, asserting with deprecated raises() function' + ); +}); + +if (typeof document !== 'undefined') { + module('fixture'); + test('setup', function() { + expect(0); + document.getElementById('qunit-fixture').innerHTML = 'foobar'; + }); + + test('basics', function() { + equal( document.getElementById('qunit-fixture').innerHTML, 'test markup', 'automatically reset' ); + }); + + test('running test name displayed', function() { + expect(2); + + const displaying = document.getElementById('qunit-testresult'); + + ok( /running test name displayed/.test(displaying.innerHTML), 'Expect test name to be found in displayed text' ); + ok( /fixture/.test(displaying.innerHTML), 'Expect module name to be found in displayed text' ); + }); + + (function() { + let delayNextSetup; + const sleep = function( n ) { + stop(); + setTimeout( function() { + start(); + }, n ); + }; + + module('timing', { + setup: function() { + if ( delayNextSetup ) { + delayNextSetup = false; + sleep( 250 ); + } + }, + }); + + test('setup', 0, function() { + delayNextSetup = true; + }); + + test('basics', 2, function() { + const previous = getPreviousTests(/^setup$/, /^timing$/)[0]; + const runtime = previous.lastChild.previousSibling; + ok( /(^| )runtime( |$)/.test( runtime.className ), 'Runtime element exists' ); + ok( /^\d+ ms$/.test( runtime.innerHTML ), 'Runtime reported in ms' ); + }); + + test('values', 2, function() { + const basics = getPreviousTests(/^setup$/, /^timing$/)[0]; + const slow = getPreviousTests(/^basics$/, /^timing$/)[0]; + ok( parseInt( basics.lastChild.previousSibling.innerHTML, 10 ) < 50, 'Fast runtime for trivial test' ); + ok( parseInt( slow.lastChild.previousSibling.innerHTML, 10 ) > 250, 'Runtime includes setup' ); + }); + })(); } -module("custom assertions"); +module('custom assertions'); (function() { - function mod2(value, expected, message) { - var actual = value % 2; - QUnit.push(actual == expected, actual, expected, message); - } - test("mod2", function() { - mod2(2, 0, "2 % 2 == 0"); - mod2(3, 1, "3 % 2 == 1"); - }); + function mod2(value, expected, message) { + const actual = value % 2; + QUnit.push(actual == expected, actual, expected, message); + } + test('mod2', function() { + mod2(2, 0, '2 % 2 == 0'); + mod2(3, 1, '3 % 2 == 1'); + }); })(); -module("recursions"); +module('recursions'); function Wrap(x) { - this.wrap = x; - if (x === undefined) { - this.first = true; - } + this.wrap = x; + if (x === undefined) { + this.first = true; + } } function chainwrap(depth, first, prev) { - depth = depth || 0; - var last = prev || new Wrap(); - first = first || last; - - if (depth == 1) { - first.wrap = last; - } - if (depth > 1) { - last = chainwrap(depth-1, first, new Wrap(last)); - } - - return last; + depth = depth || 0; + let last = prev || new Wrap(); + first = first || last; + + if (depth == 1) { + first.wrap = last; + } + if (depth > 1) { + last = chainwrap(depth-1, first, new Wrap(last)); + } + + return last; } -test("check jsDump recursion", function() { - expect(4); +test('check jsDump recursion', function() { + expect(4); - var noref = chainwrap(0); - var nodump = QUnit.jsDump.parse(noref); - equal(nodump, '{\n "first": true,\n "wrap": undefined\n}'); + const noref = chainwrap(0); + const nodump = QUnit.jsDump.parse(noref); + equal(nodump, '{\n "first": true,\n "wrap": undefined\n}'); - var selfref = chainwrap(1); - var selfdump = QUnit.jsDump.parse(selfref); - equal(selfdump, '{\n "first": true,\n "wrap": recursion(-1)\n}'); + const selfref = chainwrap(1); + const selfdump = QUnit.jsDump.parse(selfref); + equal(selfdump, '{\n "first": true,\n "wrap": recursion(-1)\n}'); - var parentref = chainwrap(2); - var parentdump = QUnit.jsDump.parse(parentref); - equal(parentdump, '{\n "wrap": {\n "first": true,\n "wrap": recursion(-2)\n }\n}'); + const parentref = chainwrap(2); + const parentdump = QUnit.jsDump.parse(parentref); + equal(parentdump, '{\n "wrap": {\n "first": true,\n "wrap": recursion(-2)\n }\n}'); - var circref = chainwrap(10); - var circdump = QUnit.jsDump.parse(circref); - ok(new RegExp("recursion\\(-10\\)").test(circdump), "(" +circdump + ") should show -10 recursion level"); + const circref = chainwrap(10); + const circdump = QUnit.jsDump.parse(circref); + ok(new RegExp('recursion\\(-10\\)').test(circdump), '(' +circdump + ') should show -10 recursion level'); }); -test("check (deep-)equal recursion", function() { - var noRecursion = chainwrap(0); - equal(noRecursion, noRecursion, "I should be equal to me."); - deepEqual(noRecursion, noRecursion, "... and so in depth."); +test('check (deep-)equal recursion', function() { + const noRecursion = chainwrap(0); + equal(noRecursion, noRecursion, 'I should be equal to me.'); + deepEqual(noRecursion, noRecursion, '... and so in depth.'); - var selfref = chainwrap(1); - equal(selfref, selfref, "Even so if I nest myself."); - deepEqual(selfref, selfref, "... into the depth."); + const selfref = chainwrap(1); + equal(selfref, selfref, 'Even so if I nest myself.'); + deepEqual(selfref, selfref, '... into the depth.'); - var circref = chainwrap(10); - equal(circref, circref, "Or hide that through some levels of indirection."); - deepEqual(circref, circref, "... and checked on all levels!"); + const circref = chainwrap(10); + equal(circref, circref, 'Or hide that through some levels of indirection.'); + deepEqual(circref, circref, '... and checked on all levels!'); }); test('Circular reference with arrays', function() { + // pure array self-ref + const arr = []; + arr.push(arr); - // pure array self-ref - var arr = []; - arr.push(arr); + const arrdump = QUnit.jsDump.parse(arr); - var arrdump = QUnit.jsDump.parse(arr); + equal(arrdump, '[\n recursion(-1)\n]'); + equal(arr, arr[0], 'no endless stack when trying to dump arrays with circular ref'); - equal(arrdump, '[\n recursion(-1)\n]'); - equal(arr, arr[0], 'no endless stack when trying to dump arrays with circular ref'); + // mix obj-arr circular ref + const obj = {}; + const childarr = [obj]; + obj.childarr = childarr; - // mix obj-arr circular ref - var obj = {}; - var childarr = [obj]; - obj.childarr = childarr; + const objdump = QUnit.jsDump.parse(obj); + const childarrdump = QUnit.jsDump.parse(childarr); - var objdump = QUnit.jsDump.parse(obj); - var childarrdump = QUnit.jsDump.parse(childarr); - - equal(objdump, '{\n "childarr": [\n recursion(-2)\n ]\n}'); - equal(childarrdump, '[\n {\n "childarr": recursion(-2)\n }\n]'); - - equal(obj.childarr, childarr, 'no endless stack when trying to dump array/object mix with circular ref'); - equal(childarr[0], obj, 'no endless stack when trying to dump array/object mix with circular ref'); + equal(objdump, '{\n "childarr": [\n recursion(-2)\n ]\n}'); + equal(childarrdump, '[\n {\n "childarr": recursion(-2)\n }\n]'); + equal(obj.childarr, childarr, 'no endless stack when trying to dump array/object mix with circular ref'); + equal(childarr[0], obj, 'no endless stack when trying to dump array/object mix with circular ref'); }); test('Circular reference - test reported by soniciq in #105', function() { - var MyObject = function() {}; - MyObject.prototype.parent = function(obj) { - if (obj === undefined) { return this._parent; } - this._parent = obj; - }; - MyObject.prototype.children = function(obj) { - if (obj === undefined) { return this._children; } - this._children = obj; - }; - - var a = new MyObject(), - b = new MyObject(); - - var barr = [b]; - a.children(barr); - b.parent(a); - - equal(a.children(), barr); - deepEqual(a.children(), [b]); -}); - -//This test erroneously calls the Qunit.log function, when it really shouldn't. -//as a result, our simple reporter reports a failing test where there isn't one. -//see https://github.com/jquery/qunit/issues/435 + const MyObject = function() {}; + MyObject.prototype.parent = function(obj) { + if (obj === undefined) { + return this._parent; + } + this._parent = obj; + }; + MyObject.prototype.children = function(obj) { + if (obj === undefined) { + return this._children; + } + this._children = obj; + }; + + const a = new MyObject(); + const b = new MyObject(); + + const barr = [b]; + a.children(barr); + b.parent(a); + + equal(a.children(), barr); + deepEqual(a.children(), [b]); +}); + +// This test erroneously calls the Qunit.log function, when it really shouldn't. +// as a result, our simple reporter reports a failing test where there isn't one. +// see https://github.com/jquery/qunit/issues/435 /* (function() { var reset = QUnit.reset; @@ -762,76 +762,74 @@ test('Circular reference - test reported by soniciq in #105', function() { */ function testAfterDone() { - var testName = "ensure has correct number of assertions"; - - function secondAfterDoneTest() { - QUnit.config.done = []; - // Because when this does happen, the assertion count parameter doesn't actually - // work we use this test to check the assertion count. - module("check previous test's assertion counts"); - test('count previous two test\'s assertions', function () { - var tests = getPreviousTests(/^ensure has correct number of assertions/, /^Synchronous test after load of page$/); - - equal(tests[0].firstChild.lastChild.getElementsByTagName("b")[1].innerHTML, "99"); - equal(tests[1].firstChild.lastChild.getElementsByTagName("b")[1].innerHTML, "99"); - }); - } - QUnit.config.done = []; - QUnit.done(secondAfterDoneTest); - - module("Synchronous test after load of page"); - - asyncTest('Async test', function() { - start(); - for (var i = 1; i < 100; i++) { - ok(i); - } - }); - - test(testName, 99, function() { - for (var i = 1; i < 100; i++) { - ok(i); - } - }); - - // We need two of these types of tests in order to ensure that assertions - // don't move between tests. - test(testName + ' 2', 99, function() { - for (var i = 1; i < 100; i++) { - ok(i); - } - }); - - + const testName = 'ensure has correct number of assertions'; + + function secondAfterDoneTest() { + QUnit.config.done = []; + // Because when this does happen, the assertion count parameter doesn't actually + // work we use this test to check the assertion count. + module('check previous test\'s assertion counts'); + test('count previous two test\'s assertions', function() { + const tests = getPreviousTests(/^ensure has correct number of assertions/, /^Synchronous test after load of page$/); + + equal(tests[0].firstChild.lastChild.getElementsByTagName('b')[1].innerHTML, '99'); + equal(tests[1].firstChild.lastChild.getElementsByTagName('b')[1].innerHTML, '99'); + }); + } + QUnit.config.done = []; + QUnit.done(secondAfterDoneTest); + + module('Synchronous test after load of page'); + + asyncTest('Async test', function() { + start(); + for (let i = 1; i < 100; i++) { + ok(i); + } + }); + + test(testName, 99, function() { + for (let i = 1; i < 100; i++) { + ok(i); + } + }); + + // We need two of these types of tests in order to ensure that assertions + // don't move between tests. + test(testName + ' 2', 99, function() { + for (let i = 1; i < 100; i++) { + ok(i); + } + }); } if (typeof setTimeout !== 'undefined') { - QUnit.done(testAfterDone); + QUnit.done(testAfterDone); } -var log = []; -var testName; -QUnit.done(function (test_results) { - var tests = []; - for(var i = 0, len = log.length; i < len; i++) { - var details = log[i]; - tests.push({ - name: details.name, - result: details.result, - expected: details.expected, - actual: details.actual, - source: details.source - }); - } - test_results.tests = tests; - - window.global_test_results = test_results; -}); -QUnit.testStart(function(testDetails){ - QUnit.log = function(details){ - if (!details.result) { - details.name = testDetails.name; - log.push(details); - } - }; +const log = []; +let testName; +QUnit.done(function(test_results) { + const tests = []; + for (let i = 0, len = log.length; i < len; i++) { + const details = log[i]; + tests.push({ + name: details.name, + result: details.result, + expected: details.expected, + actual: details.actual, + source: details.source, + }); + } + test_results.tests = tests; + + window.global_test_results = test_results; +}); +QUnit.testStart(function(testDetails) { + QUnit.log = function(details) { + if (!details.result) { + details.name = testDetails.name; + log.push(details); + } + }; }); diff --git a/test/yui/resources/qunit.js b/test/yui/resources/qunit.js index 302545f..0433f4b 100644 --- a/test/yui/resources/qunit.js +++ b/test/yui/resources/qunit.js @@ -9,31 +9,30 @@ */ (function( window ) { - -var QUnit, - assert, - config, - onErrorFnPrev, - testId = 0, - fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""), - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - // Keep a local reference to Date (GH-283) - Date = window.Date, - defined = { - setTimeout: typeof window.setTimeout !== "undefined", - sessionStorage: (function() { - var x = "qunit-test-string"; - try { - sessionStorage.setItem( x, x ); - sessionStorage.removeItem( x ); - return true; - } catch( e ) { - return false; - } - }()) - }, - /** + let QUnit; + let assert; + let config; + let onErrorFnPrev; + let testId = 0; + const fileName = (sourceFromStacktrace( 0 ) || '' ).replace(/(:\d+)+\)?/, '').replace(/.+\//, ''); + const toString = Object.prototype.toString; + const hasOwn = Object.prototype.hasOwnProperty; + // Keep a local reference to Date (GH-283) + const Date = window.Date; + const defined = { + setTimeout: typeof window.setTimeout !== 'undefined', + sessionStorage: (function() { + const x = 'qunit-test-string'; + try { + sessionStorage.setItem( x, x ); + sessionStorage.removeItem( x ); + return true; + } catch ( e ) { + return false; + } + }()), + }; + /** * Provides a normalized error string, correcting an issue * with IE 7 (and prior) where Error.prototype.toString is * not properly implemented @@ -43,1585 +42,1582 @@ var QUnit, * @param {String|Error} error * @return {String} error message */ - errorString = function( error ) { - var name, message, - errorString = error.toString(); - if ( errorString.substring( 0, 7 ) === "[object" ) { - name = error.name ? error.name.toString() : "Error"; - message = error.message ? error.message.toString() : ""; - if ( name && message ) { - return name + ": " + message; - } else if ( name ) { - return name; - } else if ( message ) { - return message; - } else { - return "Error"; - } - } else { - return errorString; - } - }, - /** + const errorString = function( error ) { + let name; let message; + const errorString = error.toString(); + if ( errorString.substring( 0, 7 ) === '[object' ) { + name = error.name ? error.name.toString() : 'Error'; + message = error.message ? error.message.toString() : ''; + if ( name && message ) { + return name + ': ' + message; + } else if ( name ) { + return name; + } else if ( message ) { + return message; + } else { + return 'Error'; + } + } else { + return errorString; + } + }; + /** * Makes a clone of an object using only Array or Object as base, * and copies over the own enumerable properties. * * @param {Object} obj * @return {Object} New object with only the own properties (recursively). */ - objectValues = function( obj ) { - // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392. - /*jshint newcap: false */ - var key, val, - vals = QUnit.is( "array", obj ) ? [] : {}; - for ( key in obj ) { - if ( hasOwn.call( obj, key ) ) { - val = obj[key]; - vals[key] = val === Object(val) ? objectValues(val) : val; - } - } - return vals; - }; - -function Test( settings ) { - extend( this, settings ); - this.assertions = []; - this.testNumber = ++Test.count; -} - -Test.count = 0; - -Test.prototype = { - init: function() { - var a, b, li, - tests = id( "qunit-tests" ); - - if ( tests ) { - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml; - - // `a` initialized at top of scope - a = document.createElement( "a" ); - a.innerHTML = "Rerun"; - a.href = QUnit.url({ testNumber: this.testNumber }); - - li = document.createElement( "li" ); - li.appendChild( b ); - li.appendChild( a ); - li.className = "running"; - li.id = this.id = "qunit-test-output" + testId++; - - tests.appendChild( li ); - } - }, - setup: function() { - if ( this.module !== config.previousModule ) { - if ( config.previousModule ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.previousModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - config.previousModule = this.module; - config.moduleStats = { all: 0, bad: 0 }; - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); - } else if ( config.autorun ) { - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); - } - - config.current = this; - - this.testEnvironment = extend({ - setup: function() {}, - teardown: function() {} - }, this.moduleTestEnvironment ); - - this.started = +new Date(); - runLoggingCallbacks( "testStart", QUnit, { - name: this.testName, - module: this.module - }); - - // allow utility functions to access the current test environment - // TODO why?? - QUnit.current_testEnvironment = this.testEnvironment; - - if ( !config.pollution ) { - saveGlobal(); - } - if ( config.notrycatch ) { - this.testEnvironment.setup.call( this.testEnvironment ); - return; - } - try { - this.testEnvironment.setup.call( this.testEnvironment ); - } catch( e ) { - QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - }, - run: function() { - config.current = this; - - var running = id( "qunit-testresult" ); - - if ( running ) { - running.innerHTML = "Running:
                        " + this.nameHtml; - } - - if ( this.async ) { - QUnit.stop(); - } - - this.callbackStarted = +new Date(); - - if ( config.notrycatch ) { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - return; - } - - try { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - } catch( e ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - - QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) ); - // else next test will carry the responsibility - saveGlobal(); - - // Restart the tests if they're blocking - if ( config.blocking ) { - QUnit.start(); - } - } - }, - teardown: function() { - config.current = this; - if ( config.notrycatch ) { - if ( typeof this.callbackRuntime === "undefined" ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - } - this.testEnvironment.teardown.call( this.testEnvironment ); - return; - } else { - try { - this.testEnvironment.teardown.call( this.testEnvironment ); - } catch( e ) { - QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - } - checkPollution(); - }, - finish: function() { - config.current = this; - if ( config.requireExpects && this.expected === null ) { - QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack ); - } else if ( this.expected !== null && this.expected !== this.assertions.length ) { - QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack ); - } else if ( this.expected === null && !this.assertions.length ) { - QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack ); - } - - var i, assertion, a, b, time, li, ol, - test = this, - good = 0, - bad = 0, - tests = id( "qunit-tests" ); - - this.runtime = +new Date() - this.started; - config.stats.all += this.assertions.length; - config.moduleStats.all += this.assertions.length; - - if ( tests ) { - ol = document.createElement( "ol" ); - ol.className = "qunit-assert-list"; - - for ( i = 0; i < this.assertions.length; i++ ) { - assertion = this.assertions[i]; - - li = document.createElement( "li" ); - li.className = assertion.result ? "pass" : "fail"; - li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" ); - ol.appendChild( li ); - - if ( assertion.result ) { - good++; - } else { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - - // store result when possible - if ( QUnit.config.reorder && defined.sessionStorage ) { - if ( bad ) { - sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad ); - } else { - sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName ); - } - } - - if ( bad === 0 ) { - addClass( ol, "qunit-collapsed" ); - } - - // `b` initialized at top of scope - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml + " (" + bad + ", " + good + ", " + this.assertions.length + ")"; - - addEvent(b, "click", function() { - var next = b.parentNode.lastChild, - collapsed = hasClass( next, "qunit-collapsed" ); - ( collapsed ? removeClass : addClass )( next, "qunit-collapsed" ); - }); - - addEvent(b, "dblclick", function( e ) { - var target = e && e.target ? e.target : window.event.srcElement; - if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) { - target = target.parentNode; - } - if ( window.location && target.nodeName.toLowerCase() === "strong" ) { - window.location = QUnit.url({ testNumber: test.testNumber }); - } - }); - - // `time` initialized at top of scope - time = document.createElement( "span" ); - time.className = "runtime"; - time.innerHTML = this.runtime + " ms"; - - // `li` initialized at top of scope - li = id( this.id ); - li.className = bad ? "fail" : "pass"; - li.removeChild( li.firstChild ); - a = li.firstChild; - li.appendChild( b ); - li.appendChild( a ); - li.appendChild( time ); - li.appendChild( ol ); - - } else { - for ( i = 0; i < this.assertions.length; i++ ) { - if ( !this.assertions[i].result ) { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - } - - runLoggingCallbacks( "testDone", QUnit, { - name: this.testName, - module: this.module, - failed: bad, - passed: this.assertions.length - bad, - total: this.assertions.length, - duration: this.runtime - }); - - QUnit.reset(); - - config.current = undefined; - }, - - queue: function() { - var bad, - test = this; - - synchronize(function() { - test.init(); - }); - function run() { - // each of these can by async - synchronize(function() { - test.setup(); - }); - synchronize(function() { - test.run(); - }); - synchronize(function() { - test.teardown(); - }); - synchronize(function() { - test.finish(); - }); - } - - // `bad` initialized at top of scope - // defer when previous test run passed, if storage is available - bad = QUnit.config.reorder && defined.sessionStorage && - +sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName ); - - if ( bad ) { - run(); - } else { - synchronize( run, true ); - } - } -}; - -// Root QUnit object. -// `QUnit` initialized at top of scope -QUnit = { - - // call on start of module test to prepend name to all tests - module: function( name, testEnvironment ) { - config.currentModule = name; - config.currentModuleTestEnvironment = testEnvironment; - config.modules[name] = true; - }, - - asyncTest: function( testName, expected, callback ) { - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - QUnit.test( testName, expected, callback, true ); - }, - - test: function( testName, expected, callback, async ) { - var test, - nameHtml = "" + escapeText( testName ) + ""; - - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - if ( config.currentModule ) { - nameHtml = "" + escapeText( config.currentModule ) + ": " + nameHtml; - } - - test = new Test({ - nameHtml: nameHtml, - testName: testName, - expected: expected, - async: async, - callback: callback, - module: config.currentModule, - moduleTestEnvironment: config.currentModuleTestEnvironment, - stack: sourceFromStacktrace( 2 ) - }); - - if ( !validTest( test ) ) { - return; - } - - test.queue(); - }, - - // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. - expect: function( asserts ) { - if (arguments.length === 1) { - config.current.expected = asserts; - } else { - return config.current.expected; - } - }, - - start: function( count ) { - // QUnit hasn't been initialized yet. - // Note: RequireJS (et al) may delay onLoad - if ( config.semaphore === undefined ) { - QUnit.begin(function() { - // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first - setTimeout(function() { - QUnit.start( count ); - }); - }); - return; - } - - config.semaphore -= count || 1; - // don't start until equal number of stop-calls - if ( config.semaphore > 0 ) { - return; - } - // ignore if start is called more often then stop - if ( config.semaphore < 0 ) { - config.semaphore = 0; - QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)", null, sourceFromStacktrace(2) ); - return; - } - // A slight delay, to avoid any current callbacks - if ( defined.setTimeout ) { - window.setTimeout(function() { - if ( config.semaphore > 0 ) { - return; - } - if ( config.timeout ) { - clearTimeout( config.timeout ); - } - - config.blocking = false; - process( true ); - }, 13); - } else { - config.blocking = false; - process( true ); - } - }, - - stop: function( count ) { - config.semaphore += count || 1; - config.blocking = true; - - if ( config.testTimeout && defined.setTimeout ) { - clearTimeout( config.timeout ); - config.timeout = window.setTimeout(function() { - QUnit.ok( false, "Test timed out" ); - config.semaphore = 1; - QUnit.start(); - }, config.testTimeout ); - } - } -}; - -// `assert` initialized at top of scope -// Asssert helpers -// All of these must either call QUnit.push() or manually do: -// - runLoggingCallbacks( "log", .. ); -// - config.current.assertions.push({ .. }); -// We attach it to the QUnit object *after* we expose the public API, -// otherwise `assert` will become a global variable in browsers (#341). -assert = { - /** + var objectValues = function( obj ) { + // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392. + /* jshint newcap: false */ + let key; let val; + const vals = QUnit.is( 'array', obj ) ? [] : {}; + for ( key in obj ) { + if ( hasOwn.call( obj, key ) ) { + val = obj[key]; + vals[key] = val === Object(val) ? objectValues(val) : val; + } + } + return vals; + }; + + function Test( settings ) { + extend( this, settings ); + this.assertions = []; + this.testNumber = ++Test.count; + } + + Test.count = 0; + + Test.prototype = { + init: function() { + let a; let b; let li; + const tests = id( 'qunit-tests' ); + + if ( tests ) { + b = document.createElement( 'strong' ); + b.innerHTML = this.nameHtml; + + // `a` initialized at top of scope + a = document.createElement( 'a' ); + a.innerHTML = 'Rerun'; + a.href = QUnit.url({testNumber: this.testNumber}); + + li = document.createElement( 'li' ); + li.appendChild( b ); + li.appendChild( a ); + li.className = 'running'; + li.id = this.id = 'qunit-test-output' + testId++; + + tests.appendChild( li ); + } + }, + setup: function() { + if ( this.module !== config.previousModule ) { + if ( config.previousModule ) { + runLoggingCallbacks( 'moduleDone', QUnit, { + name: config.previousModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all, + }); + } + config.previousModule = this.module; + config.moduleStats = {all: 0, bad: 0}; + runLoggingCallbacks( 'moduleStart', QUnit, { + name: this.module, + }); + } else if ( config.autorun ) { + runLoggingCallbacks( 'moduleStart', QUnit, { + name: this.module, + }); + } + + config.current = this; + + this.testEnvironment = extend({ + setup: function() {}, + teardown: function() {}, + }, this.moduleTestEnvironment ); + + this.started = +new Date(); + runLoggingCallbacks( 'testStart', QUnit, { + name: this.testName, + module: this.module, + }); + + // allow utility functions to access the current test environment + // TODO why?? + QUnit.current_testEnvironment = this.testEnvironment; + + if ( !config.pollution ) { + saveGlobal(); + } + if ( config.notrycatch ) { + this.testEnvironment.setup.call( this.testEnvironment ); + return; + } + try { + this.testEnvironment.setup.call( this.testEnvironment ); + } catch ( e ) { + QUnit.pushFailure( 'Setup failed on ' + this.testName + ': ' + ( e.message || e ), extractStacktrace( e, 1 ) ); + } + }, + run: function() { + config.current = this; + + const running = id( 'qunit-testresult' ); + + if ( running ) { + running.innerHTML = 'Running:
                        ' + this.nameHtml; + } + + if ( this.async ) { + QUnit.stop(); + } + + this.callbackStarted = +new Date(); + + if ( config.notrycatch ) { + this.callback.call( this.testEnvironment, QUnit.assert ); + this.callbackRuntime = +new Date() - this.callbackStarted; + return; + } + + try { + this.callback.call( this.testEnvironment, QUnit.assert ); + this.callbackRuntime = +new Date() - this.callbackStarted; + } catch ( e ) { + this.callbackRuntime = +new Date() - this.callbackStarted; + + QUnit.pushFailure( 'Died on test #' + (this.assertions.length + 1) + ' ' + this.stack + ': ' + ( e.message || e ), extractStacktrace( e, 0 ) ); + // else next test will carry the responsibility + saveGlobal(); + + // Restart the tests if they're blocking + if ( config.blocking ) { + QUnit.start(); + } + } + }, + teardown: function() { + config.current = this; + if ( config.notrycatch ) { + if ( typeof this.callbackRuntime === 'undefined' ) { + this.callbackRuntime = +new Date() - this.callbackStarted; + } + this.testEnvironment.teardown.call( this.testEnvironment ); + return; + } else { + try { + this.testEnvironment.teardown.call( this.testEnvironment ); + } catch ( e ) { + QUnit.pushFailure( 'Teardown failed on ' + this.testName + ': ' + ( e.message || e ), extractStacktrace( e, 1 ) ); + } + } + checkPollution(); + }, + finish: function() { + config.current = this; + if ( config.requireExpects && this.expected === null ) { + QUnit.pushFailure( 'Expected number of assertions to be defined, but expect() was not called.', this.stack ); + } else if ( this.expected !== null && this.expected !== this.assertions.length ) { + QUnit.pushFailure( 'Expected ' + this.expected + ' assertions, but ' + this.assertions.length + ' were run', this.stack ); + } else if ( this.expected === null && !this.assertions.length ) { + QUnit.pushFailure( 'Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.', this.stack ); + } + + let i; let assertion; let a; let b; let time; let li; let ol; + const test = this; + let good = 0; + let bad = 0; + const tests = id( 'qunit-tests' ); + + this.runtime = +new Date() - this.started; + config.stats.all += this.assertions.length; + config.moduleStats.all += this.assertions.length; + + if ( tests ) { + ol = document.createElement( 'ol' ); + ol.className = 'qunit-assert-list'; + + for ( i = 0; i < this.assertions.length; i++ ) { + assertion = this.assertions[i]; + + li = document.createElement( 'li' ); + li.className = assertion.result ? 'pass' : 'fail'; + li.innerHTML = assertion.message || ( assertion.result ? 'okay' : 'failed' ); + ol.appendChild( li ); + + if ( assertion.result ) { + good++; + } else { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + + // store result when possible + if ( QUnit.config.reorder && defined.sessionStorage ) { + if ( bad ) { + sessionStorage.setItem( 'qunit-test-' + this.module + '-' + this.testName, bad ); + } else { + sessionStorage.removeItem( 'qunit-test-' + this.module + '-' + this.testName ); + } + } + + if ( bad === 0 ) { + addClass( ol, 'qunit-collapsed' ); + } + + // `b` initialized at top of scope + b = document.createElement( 'strong' ); + b.innerHTML = this.nameHtml + ' (' + bad + ', ' + good + ', ' + this.assertions.length + ')'; + + addEvent(b, 'click', function() { + const next = b.parentNode.lastChild; + const collapsed = hasClass( next, 'qunit-collapsed' ); + ( collapsed ? removeClass : addClass )( next, 'qunit-collapsed' ); + }); + + addEvent(b, 'dblclick', function( e ) { + let target = e && e.target ? e.target : window.event.srcElement; + if ( target.nodeName.toLowerCase() === 'span' || target.nodeName.toLowerCase() === 'b' ) { + target = target.parentNode; + } + if ( window.location && target.nodeName.toLowerCase() === 'strong' ) { + window.location = QUnit.url({testNumber: test.testNumber}); + } + }); + + // `time` initialized at top of scope + time = document.createElement( 'span' ); + time.className = 'runtime'; + time.innerHTML = this.runtime + ' ms'; + + // `li` initialized at top of scope + li = id( this.id ); + li.className = bad ? 'fail' : 'pass'; + li.removeChild( li.firstChild ); + a = li.firstChild; + li.appendChild( b ); + li.appendChild( a ); + li.appendChild( time ); + li.appendChild( ol ); + } else { + for ( i = 0; i < this.assertions.length; i++ ) { + if ( !this.assertions[i].result ) { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + } + + runLoggingCallbacks( 'testDone', QUnit, { + name: this.testName, + module: this.module, + failed: bad, + passed: this.assertions.length - bad, + total: this.assertions.length, + duration: this.runtime, + }); + + QUnit.reset(); + + config.current = undefined; + }, + + queue: function() { + let bad; + const test = this; + + synchronize(function() { + test.init(); + }); + function run() { + // each of these can by async + synchronize(function() { + test.setup(); + }); + synchronize(function() { + test.run(); + }); + synchronize(function() { + test.teardown(); + }); + synchronize(function() { + test.finish(); + }); + } + + // `bad` initialized at top of scope + // defer when previous test run passed, if storage is available + bad = QUnit.config.reorder && defined.sessionStorage && + +sessionStorage.getItem( 'qunit-test-' + this.module + '-' + this.testName ); + + if ( bad ) { + run(); + } else { + synchronize( run, true ); + } + }, + }; + + // Root QUnit object. + // `QUnit` initialized at top of scope + QUnit = { + + // call on start of module test to prepend name to all tests + module: function( name, testEnvironment ) { + config.currentModule = name; + config.currentModuleTestEnvironment = testEnvironment; + config.modules[name] = true; + }, + + asyncTest: function( testName, expected, callback ) { + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + QUnit.test( testName, expected, callback, true ); + }, + + test: function( testName, expected, callback, async ) { + let test; + let nameHtml = '' + escapeText( testName ) + ''; + + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + if ( config.currentModule ) { + nameHtml = '' + escapeText( config.currentModule ) + ': ' + nameHtml; + } + + test = new Test({ + nameHtml: nameHtml, + testName: testName, + expected: expected, + async: async, + callback: callback, + module: config.currentModule, + moduleTestEnvironment: config.currentModuleTestEnvironment, + stack: sourceFromStacktrace( 2 ), + }); + + if ( !validTest( test ) ) { + return; + } + + test.queue(); + }, + + // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. + expect: function( asserts ) { + if (arguments.length === 1) { + config.current.expected = asserts; + } else { + return config.current.expected; + } + }, + + start: function( count ) { + // QUnit hasn't been initialized yet. + // Note: RequireJS (et al) may delay onLoad + if ( config.semaphore === undefined ) { + QUnit.begin(function() { + // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first + setTimeout(function() { + QUnit.start( count ); + }); + }); + return; + } + + config.semaphore -= count || 1; + // don't start until equal number of stop-calls + if ( config.semaphore > 0 ) { + return; + } + // ignore if start is called more often then stop + if ( config.semaphore < 0 ) { + config.semaphore = 0; + QUnit.pushFailure( 'Called start() while already started (QUnit.config.semaphore was 0 already)', null, sourceFromStacktrace(2) ); + return; + } + // A slight delay, to avoid any current callbacks + if ( defined.setTimeout ) { + window.setTimeout(function() { + if ( config.semaphore > 0 ) { + return; + } + if ( config.timeout ) { + clearTimeout( config.timeout ); + } + + config.blocking = false; + process( true ); + }, 13); + } else { + config.blocking = false; + process( true ); + } + }, + + stop: function( count ) { + config.semaphore += count || 1; + config.blocking = true; + + if ( config.testTimeout && defined.setTimeout ) { + clearTimeout( config.timeout ); + config.timeout = window.setTimeout(function() { + QUnit.ok( false, 'Test timed out' ); + config.semaphore = 1; + QUnit.start(); + }, config.testTimeout ); + } + }, + }; + + // `assert` initialized at top of scope + // Asssert helpers + // All of these must either call QUnit.push() or manually do: + // - runLoggingCallbacks( "log", .. ); + // - config.current.assertions.push({ .. }); + // We attach it to the QUnit object *after* we expose the public API, + // otherwise `assert` will become a global variable in browsers (#341). + assert = { + /** * Asserts rough true-ish result. * @name ok * @function * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); */ - ok: function( result, msg ) { - if ( !config.current ) { - throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - result = !!result; - - var source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: msg - }; - - msg = escapeText( msg || (result ? "okay" : "failed" ) ); - msg = "" + msg + ""; - - if ( !result ) { - source = sourceFromStacktrace( 2 ); - if ( source ) { - details.source = source; - msg += "
                        Source:
                        " + escapeText( source ) + "
                        "; - } - } - runLoggingCallbacks( "log", QUnit, details ); - config.current.assertions.push({ - result: result, - message: msg - }); - }, - - /** + 'ok': function( result, msg ) { + if ( !config.current ) { + throw new Error( 'ok() assertion outside test context, was ' + sourceFromStacktrace(2) ); + } + result = !!result; + + let source; + const details = { + module: config.current.module, + name: config.current.testName, + result: result, + message: msg, + }; + + msg = escapeText( msg || (result ? 'okay' : 'failed' ) ); + msg = '' + msg + ''; + + if ( !result ) { + source = sourceFromStacktrace( 2 ); + if ( source ) { + details.source = source; + msg += '
                        Source:
                        ' + escapeText( source ) + '
                        '; + } + } + runLoggingCallbacks( 'log', QUnit, details ); + config.current.assertions.push({ + result: result, + message: msg, + }); + }, + + /** * Assert that the first two arguments are equal, with an optional message. * Prints out both actual and expected values. * @name equal * @function * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" ); */ - equal: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected == actual, actual, expected, message ); - }, + 'equal': function( actual, expected, message ) { + /* jshint eqeqeq:false */ + QUnit.push( expected == actual, actual, expected, message ); + }, - /** + /** * @name notEqual * @function */ - notEqual: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected != actual, actual, expected, message ); - }, + 'notEqual': function( actual, expected, message ) { + /* jshint eqeqeq:false */ + QUnit.push( expected != actual, actual, expected, message ); + }, - /** + /** * @name propEqual * @function */ - propEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, + 'propEqual': function( actual, expected, message ) { + actual = objectValues(actual); + expected = objectValues(expected); + QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); + }, - /** + /** * @name notPropEqual * @function */ - notPropEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, + 'notPropEqual': function( actual, expected, message ) { + actual = objectValues(actual); + expected = objectValues(expected); + QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); + }, - /** + /** * @name deepEqual * @function */ - deepEqual: function( actual, expected, message ) { - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, + 'deepEqual': function( actual, expected, message ) { + QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); + }, - /** + /** * @name notDeepEqual * @function */ - notDeepEqual: function( actual, expected, message ) { - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, + 'notDeepEqual': function( actual, expected, message ) { + QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); + }, - /** + /** * @name strictEqual * @function */ - strictEqual: function( actual, expected, message ) { - QUnit.push( expected === actual, actual, expected, message ); - }, + 'strictEqual': function( actual, expected, message ) { + QUnit.push( expected === actual, actual, expected, message ); + }, - /** + /** * @name notStrictEqual * @function */ - notStrictEqual: function( actual, expected, message ) { - QUnit.push( expected !== actual, actual, expected, message ); - }, - - "throws": function( block, expected, message ) { - var actual, - expectedOutput = expected, - ok = false; - - // 'expected' is optional - if ( typeof expected === "string" ) { - message = expected; - expected = null; - } - - config.current.ignoreGlobalErrors = true; - try { - block.call( config.current.testEnvironment ); - } catch (e) { - actual = e; - } - config.current.ignoreGlobalErrors = false; - - if ( actual ) { - // we don't want to validate thrown error - if ( !expected ) { - ok = true; - expectedOutput = null; - // expected is a regexp - } else if ( QUnit.objectType( expected ) === "regexp" ) { - ok = expected.test( errorString( actual ) ); - // expected is a constructor - } else if ( actual instanceof expected ) { - ok = true; - // expected is a validation function which returns true is validation passed - } else if ( expected.call( {}, actual ) === true ) { - expectedOutput = null; - ok = true; - } - - QUnit.push( ok, actual, expectedOutput, message ); - } else { - QUnit.pushFailure( message, null, 'No exception was thrown.' ); - } - } -}; - -/** + 'notStrictEqual': function( actual, expected, message ) { + QUnit.push( expected !== actual, actual, expected, message ); + }, + + 'throws': function( block, expected, message ) { + let actual; + let expectedOutput = expected; + let ok = false; + + // 'expected' is optional + if ( typeof expected === 'string' ) { + message = expected; + expected = null; + } + + config.current.ignoreGlobalErrors = true; + try { + block.call( config.current.testEnvironment ); + } catch (e) { + actual = e; + } + config.current.ignoreGlobalErrors = false; + + if ( actual ) { + // we don't want to validate thrown error + if ( !expected ) { + ok = true; + expectedOutput = null; + // expected is a regexp + } else if ( QUnit.objectType( expected ) === 'regexp' ) { + ok = expected.test( errorString( actual ) ); + // expected is a constructor + } else if ( actual instanceof expected ) { + ok = true; + // expected is a validation function which returns true is validation passed + } else if ( expected.call( {}, actual ) === true ) { + expectedOutput = null; + ok = true; + } + + QUnit.push( ok, actual, expectedOutput, message ); + } else { + QUnit.pushFailure( message, null, 'No exception was thrown.' ); + } + }, + }; + + /** * @deprecate since 1.8.0 * Kept assertion helpers in root for backwards compatibility. */ -extend( QUnit, assert ); + extend( QUnit, assert ); -/** + /** * @deprecated since 1.9.0 * Kept root "raises()" for backwards compatibility. * (Note that we don't introduce assert.raises). */ -QUnit.raises = assert[ "throws" ]; + QUnit.raises = assert['throws']; -/** + /** * @deprecated since 1.0.0, replaced with error pushes since 1.3.0 * Kept to avoid TypeErrors for undefined methods. */ -QUnit.equals = function() { - QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" ); -}; -QUnit.same = function() { - QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" ); -}; - -// We want access to the constructor's prototype -(function() { - function F() {} - F.prototype = QUnit; - QUnit = new F(); - // Make F QUnit's constructor so that we can add to the prototype later - QUnit.constructor = F; -}()); - -/** + QUnit.equals = function() { + QUnit.push( false, false, false, 'QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead' ); + }; + QUnit.same = function() { + QUnit.push( false, false, false, 'QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead' ); + }; + + // We want access to the constructor's prototype + (function() { + function F() {} + F.prototype = QUnit; + QUnit = new F(); + // Make F QUnit's constructor so that we can add to the prototype later + QUnit.constructor = F; + }()); + + /** * Config object: Maintain internal state * Later exposed as QUnit.config * `config` initialized at top of scope */ -config = { - // The queue of tests to run - queue: [], - - // block until document ready - blocking: true, - - // when enabled, show only failing tests - // gets persisted through sessionStorage and can be changed in UI via checkbox - hidepassed: false, - - // by default, run previously failed tests first - // very useful in combination with "Hide passed tests" checked - reorder: true, - - // by default, modify document.title when suite is done - altertitle: true, - - // when enabled, all tests must call expect() - requireExpects: false, - - // add checkboxes that are persisted in the query-string - // when enabled, the id is set to `true` as a `QUnit.config` property - urlConfig: [ - { - id: "noglobals", - label: "Check for Globals", - tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings." - }, - { - id: "notrycatch", - label: "No try-catch", - tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings." - } - ], - - // Set of all modules. - modules: {}, - - // logging callback queues - begin: [], - done: [], - log: [], - testStart: [], - testDone: [], - moduleStart: [], - moduleDone: [] -}; - -// Export global variables, unless an 'exports' object exists, -// in that case we assume we're in CommonJS (dealt with on the bottom of the script) -if ( typeof exports === "undefined" ) { - extend( window, QUnit ); - - // Expose QUnit object - window.QUnit = QUnit; -} - -// Initialize more QUnit.config and QUnit.urlParams -(function() { - var i, - location = window.location || { search: "", protocol: "file:" }, - params = location.search.slice( 1 ).split( "&" ), - length = params.length, - urlParams = {}, - current; - - if ( params[ 0 ] ) { - for ( i = 0; i < length; i++ ) { - current = params[ i ].split( "=" ); - current[ 0 ] = decodeURIComponent( current[ 0 ] ); - // allow just a key to turn on a flag, e.g., test.html?noglobals - current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; - urlParams[ current[ 0 ] ] = current[ 1 ]; - } - } - - QUnit.urlParams = urlParams; - - // String search anywhere in moduleName+testName - config.filter = urlParams.filter; - - // Exact match of the module name - config.module = urlParams.module; - - config.testNumber = parseInt( urlParams.testNumber, 10 ) || null; - - // Figure out if we're running the tests from a server or not - QUnit.isLocal = location.protocol === "file:"; -}()); - -// Extend QUnit object, -// these after set here because they should not be exposed as global functions -extend( QUnit, { - assert: assert, - - config: config, - - // Initialize the configuration options - init: function() { - extend( config, { - stats: { all: 0, bad: 0 }, - moduleStats: { all: 0, bad: 0 }, - started: +new Date(), - updateRate: 1000, - blocking: false, - autostart: true, - autorun: false, - filter: "", - queue: [], - semaphore: 1 - }); - - var tests, banner, result, - qunit = id( "qunit" ); - - if ( qunit ) { - qunit.innerHTML = - "

                        " + escapeText( document.title ) + "

                        " + - "

                        " + - "
                        " + - "

                        " + - "
                          "; - } - - tests = id( "qunit-tests" ); - banner = id( "qunit-banner" ); - result = id( "qunit-testresult" ); - - if ( tests ) { - tests.innerHTML = ""; - } - - if ( banner ) { - banner.className = ""; - } - - if ( result ) { - result.parentNode.removeChild( result ); - } - - if ( tests ) { - result = document.createElement( "p" ); - result.id = "qunit-testresult"; - result.className = "result"; - tests.parentNode.insertBefore( result, tests ); - result.innerHTML = "Running...
                           "; - } - }, - - // Resets the test setup. Useful for tests that modify the DOM. - reset: function() { - var fixture = id( "qunit-fixture" ); - if ( fixture ) { - fixture.innerHTML = config.fixture; - } - }, - - // Trigger an event on an element. - // @example triggerEvent( document.body, "click" ); - triggerEvent: function( elem, type, event ) { - if ( document.createEvent ) { - event = document.createEvent( "MouseEvents" ); - event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, - 0, 0, 0, 0, 0, false, false, false, false, 0, null); - - elem.dispatchEvent( event ); - } else if ( elem.fireEvent ) { - elem.fireEvent( "on" + type ); - } - }, - - // Safe object type checking - is: function( type, obj ) { - return QUnit.objectType( obj ) === type; - }, - - objectType: function( obj ) { - if ( typeof obj === "undefined" ) { - return "undefined"; - // consider: typeof null === object - } - if ( obj === null ) { - return "null"; - } - - var match = toString.call( obj ).match(/^\[object\s(.*)\]$/), - type = match && match[1] || ""; - - switch ( type ) { - case "Number": - if ( isNaN(obj) ) { - return "nan"; - } - return "number"; - case "String": - case "Boolean": - case "Array": - case "Date": - case "RegExp": - case "Function": - return type.toLowerCase(); - } - if ( typeof obj === "object" ) { - return "object"; - } - return undefined; - }, - - push: function( result, actual, expected, message ) { - if ( !config.current ) { - throw new Error( "assertion outside test context, was " + sourceFromStacktrace() ); - } - - var output, source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: message, - actual: actual, - expected: expected - }; - - message = escapeText( message ) || ( result ? "okay" : "failed" ); - message = "" + message + ""; - output = message; - - if ( !result ) { - expected = escapeText( QUnit.jsDump.parse(expected) ); - actual = escapeText( QUnit.jsDump.parse(actual) ); - output += ""; - - if ( actual !== expected ) { - output += ""; - output += ""; - } - - source = sourceFromStacktrace(); - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
                          Expected:
                          " + expected + "
                          Result:
                          " + actual + "
                          Diff:
                          " + QUnit.diff( expected, actual ) + "
                          Source:
                          " + escapeText( source ) + "
                          "; - } - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: !!result, - message: output - }); - }, - - pushFailure: function( message, source, actual ) { - if ( !config.current ) { - throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - - var output, - details = { - module: config.current.module, - name: config.current.testName, - result: false, - message: message - }; - - message = escapeText( message ) || "error"; - message = "" + message + ""; - output = message; - - output += ""; - - if ( actual ) { - output += ""; - } - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
                          Result:
                          " + escapeText( actual ) + "
                          Source:
                          " + escapeText( source ) + "
                          "; - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: false, - message: output - }); - }, - - url: function( params ) { - params = extend( extend( {}, QUnit.urlParams ), params ); - var key, - querystring = "?"; - - for ( key in params ) { - if ( !hasOwn.call( params, key ) ) { - continue; - } - querystring += encodeURIComponent( key ) + "=" + - encodeURIComponent( params[ key ] ) + "&"; - } - return window.location.protocol + "//" + window.location.host + + config = { + // The queue of tests to run + queue: [], + + // block until document ready + blocking: true, + + // when enabled, show only failing tests + // gets persisted through sessionStorage and can be changed in UI via checkbox + hidepassed: false, + + // by default, run previously failed tests first + // very useful in combination with "Hide passed tests" checked + reorder: true, + + // by default, modify document.title when suite is done + altertitle: true, + + // when enabled, all tests must call expect() + requireExpects: false, + + // add checkboxes that are persisted in the query-string + // when enabled, the id is set to `true` as a `QUnit.config` property + urlConfig: [ + { + id: 'noglobals', + label: 'Check for Globals', + tooltip: 'Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings.', + }, + { + id: 'notrycatch', + label: 'No try-catch', + tooltip: 'Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings.', + }, + ], + + // Set of all modules. + modules: {}, + + // logging callback queues + begin: [], + done: [], + log: [], + testStart: [], + testDone: [], + moduleStart: [], + moduleDone: [], + }; + + // Export global variables, unless an 'exports' object exists, + // in that case we assume we're in CommonJS (dealt with on the bottom of the script) + if ( typeof exports === 'undefined' ) { + extend( window, QUnit ); + + // Expose QUnit object + window.QUnit = QUnit; + } + + // Initialize more QUnit.config and QUnit.urlParams + (function() { + let i; + const location = window.location || {search: '', protocol: 'file:'}; + const params = location.search.slice( 1 ).split( '&' ); + const length = params.length; + const urlParams = {}; + let current; + + if ( params[0] ) { + for ( i = 0; i < length; i++ ) { + current = params[i].split( '=' ); + current[0] = decodeURIComponent( current[0] ); + // allow just a key to turn on a flag, e.g., test.html?noglobals + current[1] = current[1] ? decodeURIComponent( current[1] ) : true; + urlParams[current[0]] = current[1]; + } + } + + QUnit.urlParams = urlParams; + + // String search anywhere in moduleName+testName + config.filter = urlParams.filter; + + // Exact match of the module name + config.module = urlParams.module; + + config.testNumber = parseInt( urlParams.testNumber, 10 ) || null; + + // Figure out if we're running the tests from a server or not + QUnit.isLocal = location.protocol === 'file:'; + }()); + + // Extend QUnit object, + // these after set here because they should not be exposed as global functions + extend( QUnit, { + assert: assert, + + config: config, + + // Initialize the configuration options + init: function() { + extend( config, { + stats: {all: 0, bad: 0}, + moduleStats: {all: 0, bad: 0}, + started: +new Date(), + updateRate: 1000, + blocking: false, + autostart: true, + autorun: false, + filter: '', + queue: [], + semaphore: 1, + }); + + let tests; let banner; let result; + const qunit = id( 'qunit' ); + + if ( qunit ) { + qunit.innerHTML = + '

                          ' + escapeText( document.title ) + '

                          ' + + '

                          ' + + '
                          ' + + '

                          ' + + '
                            '; + } + + tests = id( 'qunit-tests' ); + banner = id( 'qunit-banner' ); + result = id( 'qunit-testresult' ); + + if ( tests ) { + tests.innerHTML = ''; + } + + if ( banner ) { + banner.className = ''; + } + + if ( result ) { + result.parentNode.removeChild( result ); + } + + if ( tests ) { + result = document.createElement( 'p' ); + result.id = 'qunit-testresult'; + result.className = 'result'; + tests.parentNode.insertBefore( result, tests ); + result.innerHTML = 'Running...
                             '; + } + }, + + // Resets the test setup. Useful for tests that modify the DOM. + reset: function() { + const fixture = id( 'qunit-fixture' ); + if ( fixture ) { + fixture.innerHTML = config.fixture; + } + }, + + // Trigger an event on an element. + // @example triggerEvent( document.body, "click" ); + triggerEvent: function( elem, type, event ) { + if ( document.createEvent ) { + event = document.createEvent( 'MouseEvents' ); + event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, + 0, 0, 0, 0, 0, false, false, false, false, 0, null); + + elem.dispatchEvent( event ); + } else if ( elem.fireEvent ) { + elem.fireEvent( 'on' + type ); + } + }, + + // Safe object type checking + is: function( type, obj ) { + return QUnit.objectType( obj ) === type; + }, + + objectType: function( obj ) { + if ( typeof obj === 'undefined' ) { + return 'undefined'; + // consider: typeof null === object + } + if ( obj === null ) { + return 'null'; + } + + const match = toString.call( obj ).match(/^\[object\s(.*)\]$/); + const type = match && match[1] || ''; + + switch ( type ) { + case 'Number': + if ( isNaN(obj) ) { + return 'nan'; + } + return 'number'; + case 'String': + case 'Boolean': + case 'Array': + case 'Date': + case 'RegExp': + case 'Function': + return type.toLowerCase(); + } + if ( typeof obj === 'object' ) { + return 'object'; + } + return undefined; + }, + + push: function( result, actual, expected, message ) { + if ( !config.current ) { + throw new Error( 'assertion outside test context, was ' + sourceFromStacktrace() ); + } + + let output; let source; + const details = { + module: config.current.module, + name: config.current.testName, + result: result, + message: message, + actual: actual, + expected: expected, + }; + + message = escapeText( message ) || ( result ? 'okay' : 'failed' ); + message = '' + message + ''; + output = message; + + if ( !result ) { + expected = escapeText( QUnit.jsDump.parse(expected) ); + actual = escapeText( QUnit.jsDump.parse(actual) ); + output += ''; + + if ( actual !== expected ) { + output += ''; + output += ''; + } + + source = sourceFromStacktrace(); + + if ( source ) { + details.source = source; + output += ''; + } + + output += '
                            Expected:
                            ' + expected + '
                            Result:
                            ' + actual + '
                            Diff:
                            ' + QUnit.diff( expected, actual ) + '
                            Source:
                            ' + escapeText( source ) + '
                            '; + } + + runLoggingCallbacks( 'log', QUnit, details ); + + config.current.assertions.push({ + result: !!result, + message: output, + }); + }, + + pushFailure: function( message, source, actual ) { + if ( !config.current ) { + throw new Error( 'pushFailure() assertion outside test context, was ' + sourceFromStacktrace(2) ); + } + + let output; + const details = { + module: config.current.module, + name: config.current.testName, + result: false, + message: message, + }; + + message = escapeText( message ) || 'error'; + message = '' + message + ''; + output = message; + + output += ''; + + if ( actual ) { + output += ''; + } + + if ( source ) { + details.source = source; + output += ''; + } + + output += '
                            Result:
                            ' + escapeText( actual ) + '
                            Source:
                            ' + escapeText( source ) + '
                            '; + + runLoggingCallbacks( 'log', QUnit, details ); + + config.current.assertions.push({ + result: false, + message: output, + }); + }, + + url: function( params ) { + params = extend( extend( {}, QUnit.urlParams ), params ); + let key; + let querystring = '?'; + + for ( key in params ) { + if ( !hasOwn.call( params, key ) ) { + continue; + } + querystring += encodeURIComponent( key ) + '=' + + encodeURIComponent( params[key] ) + '&'; + } + return window.location.protocol + '//' + window.location.host + window.location.pathname + querystring.slice( 0, -1 ); - }, + }, - extend: extend, - id: id, - addEvent: addEvent - // load, equiv, jsDump, diff: Attached later -}); + extend: extend, + id: id, + addEvent: addEvent, + // load, equiv, jsDump, diff: Attached later + }); -/** + /** * @deprecated: Created for backwards compatibility with test runner that set the hook function * into QUnit.{hook}, instead of invoking it and passing the hook function. * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here. * Doing this allows us to tell if the following methods have been overwritten on the actual * QUnit object. */ -extend( QUnit.constructor.prototype, { - - // Logging callbacks; all receive a single argument with the listed properties - // run test/logs.html for any related changes - begin: registerLoggingCallback( "begin" ), - - // done: { failed, passed, total, runtime } - done: registerLoggingCallback( "done" ), - - // log: { result, actual, expected, message } - log: registerLoggingCallback( "log" ), - - // testStart: { name } - testStart: registerLoggingCallback( "testStart" ), - - // testDone: { name, failed, passed, total, duration } - testDone: registerLoggingCallback( "testDone" ), - - // moduleStart: { name } - moduleStart: registerLoggingCallback( "moduleStart" ), - - // moduleDone: { name, failed, passed, total } - moduleDone: registerLoggingCallback( "moduleDone" ) -}); - -if ( typeof document === "undefined" || document.readyState === "complete" ) { - config.autorun = true; -} - -QUnit.load = function() { - runLoggingCallbacks( "begin", QUnit, {} ); - - // Initialize the config, saving the execution queue - var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, - urlConfigCheckboxesContainer, urlConfigCheckboxes, moduleFilter, - numModules = 0, - moduleFilterHtml = "", - urlConfigHtml = "", - oldconfig = extend( {}, config ); - - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - len = config.urlConfig.length; - - for ( i = 0; i < len; i++ ) { - val = config.urlConfig[i]; - if ( typeof val === "string" ) { - val = { - id: val, - label: val, - tooltip: "[no tooltip available]" - }; - } - config[ val.id ] = QUnit.urlParams[ val.id ]; - urlConfigHtml += ""; - } - - moduleFilterHtml += ""; - - // `userAgent` initialized at top of scope - userAgent = id( "qunit-userAgent" ); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - - // `banner` initialized at top of scope - banner = id( "qunit-header" ); - if ( banner ) { - banner.innerHTML = "" + banner.innerHTML + " "; - } - - // `toolbar` initialized at top of scope - toolbar = id( "qunit-testrunner-toolbar" ); - if ( toolbar ) { - // `filter` initialized at top of scope - filter = document.createElement( "input" ); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - - addEvent( filter, "click", function() { - var tmp, - ol = document.getElementById( "qunit-tests" ); - - if ( filter.checked ) { - ol.className = ol.className + " hidepass"; - } else { - tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; - ol.className = tmp.replace( / hidepass /, " " ); - } - if ( defined.sessionStorage ) { - if (filter.checked) { - sessionStorage.setItem( "qunit-filter-passed-tests", "true" ); - } else { - sessionStorage.removeItem( "qunit-filter-passed-tests" ); - } - } - }); - - if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) { - filter.checked = true; - // `ol` initialized at top of scope - ol = document.getElementById( "qunit-tests" ); - ol.className = ol.className + " hidepass"; - } - toolbar.appendChild( filter ); - - // `label` initialized at top of scope - label = document.createElement( "label" ); - label.setAttribute( "for", "qunit-filter-pass" ); - label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." ); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - - urlConfigCheckboxesContainer = document.createElement("span"); - urlConfigCheckboxesContainer.innerHTML = urlConfigHtml; - urlConfigCheckboxes = urlConfigCheckboxesContainer.getElementsByTagName("input"); - // For oldIE support: - // * Add handlers to the individual elements instead of the container - // * Use "click" instead of "change" - // * Fallback from event.target to event.srcElement - addEvents( urlConfigCheckboxes, "click", function( event ) { - var params = {}, - target = event.target || event.srcElement; - params[ target.name ] = target.checked ? true : undefined; - window.location = QUnit.url( params ); - }); - toolbar.appendChild( urlConfigCheckboxesContainer ); - - if (numModules > 1) { - moduleFilter = document.createElement( 'span' ); - moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' ); - moduleFilter.innerHTML = moduleFilterHtml; - addEvent( moduleFilter.lastChild, "change", function() { - var selectBox = moduleFilter.getElementsByTagName("select")[0], - selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); - - window.location = QUnit.url( { module: ( selectedModule === "" ) ? undefined : selectedModule } ); - }); - toolbar.appendChild(moduleFilter); - } - } - - // `main` initialized at top of scope - main = id( "qunit-fixture" ); - if ( main ) { - config.fixture = main.innerHTML; - } - - if ( config.autostart ) { - QUnit.start(); - } -}; - -addEvent( window, "load", QUnit.load ); - -// `onErrorFnPrev` initialized at top of scope -// Preserve other handlers -onErrorFnPrev = window.onerror; - -// Cover uncaught exceptions -// Returning true will surpress the default browser handler, -// returning false will let it run. -window.onerror = function ( error, filePath, linerNr ) { - var ret = false; - if ( onErrorFnPrev ) { - ret = onErrorFnPrev( error, filePath, linerNr ); - } - - // Treat return value as window.onerror itself does, - // Only do our handling if not surpressed. - if ( ret !== true ) { - if ( QUnit.config.current ) { - if ( QUnit.config.current.ignoreGlobalErrors ) { - return true; - } - QUnit.pushFailure( error, filePath + ":" + linerNr ); - } else { - QUnit.test( "global failure", extend( function() { - QUnit.pushFailure( error, filePath + ":" + linerNr ); - }, { validTest: validTest } ) ); - } - return false; - } - - return ret; -}; - -function done() { - config.autorun = true; - - // Log the last module results - if ( config.currentModule ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.currentModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - - var i, key, - banner = id( "qunit-banner" ), - tests = id( "qunit-tests" ), - runtime = +new Date() - config.started, - passed = config.stats.all - config.stats.bad, - html = [ - "Tests completed in ", - runtime, - " milliseconds.
                            ", - "", - passed, - " assertions of ", - config.stats.all, - " passed, ", - config.stats.bad, - " failed." - ].join( "" ); - - if ( banner ) { - banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" ); - } - - if ( tests ) { - id( "qunit-testresult" ).innerHTML = html; - } - - if ( config.altertitle && typeof document !== "undefined" && document.title ) { - // show ✖ for good, ✔ for bad suite result in title - // use escape sequences in case file gets loaded with non-utf-8-charset - document.title = [ - ( config.stats.bad ? "\u2716" : "\u2714" ), - document.title.replace( /^[\u2714\u2716] /i, "" ) - ].join( " " ); - } - - // clear own sessionStorage items if all tests passed - if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { - // `key` & `i` initialized at top of scope - for ( i = 0; i < sessionStorage.length; i++ ) { - key = sessionStorage.key( i++ ); - if ( key.indexOf( "qunit-test-" ) === 0 ) { - sessionStorage.removeItem( key ); - } - } - } - - // scroll back to top to show results - if ( window.scrollTo ) { - window.scrollTo(0, 0); - } - - runLoggingCallbacks( "done", QUnit, { - failed: config.stats.bad, - passed: passed, - total: config.stats.all, - runtime: runtime - }); -} - -/** @return Boolean: true if this test should be ran */ -function validTest( test ) { - var include, - filter = config.filter && config.filter.toLowerCase(), - module = config.module && config.module.toLowerCase(), - fullName = (test.module + ": " + test.testName).toLowerCase(); - - // Internally-generated tests are always valid - if ( test.callback && test.callback.validTest === validTest ) { - delete test.callback.validTest; - return true; - } - - if ( config.testNumber ) { - return test.testNumber === config.testNumber; - } - - if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { - return false; - } - - if ( !filter ) { - return true; - } - - include = filter.charAt( 0 ) !== "!"; - if ( !include ) { - filter = filter.slice( 1 ); - } - - // If the filter matches, we need to honour include - if ( fullName.indexOf( filter ) !== -1 ) { - return include; - } - - // Otherwise, do the opposite - return !include; -} - -// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) -// Later Safari and IE10 are supposed to support error.stack as well -// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack -function extractStacktrace( e, offset ) { - offset = offset === undefined ? 3 : offset; - - var stack, include, i; - - if ( e.stacktrace ) { - // Opera - return e.stacktrace.split( "\n" )[ offset + 3 ]; - } else if ( e.stack ) { - // Firefox, Chrome - stack = e.stack.split( "\n" ); - if (/^error$/i.test( stack[0] ) ) { - stack.shift(); - } - if ( fileName ) { - include = []; - for ( i = offset; i < stack.length; i++ ) { - if ( stack[ i ].indexOf( fileName ) !== -1 ) { - break; - } - include.push( stack[ i ] ); - } - if ( include.length ) { - return include.join( "\n" ); - } - } - return stack[ offset ]; - } else if ( e.sourceURL ) { - // Safari, PhantomJS - // hopefully one day Safari provides actual stacktraces - // exclude useless self-reference for generated Error objects - if ( /qunit.js$/.test( e.sourceURL ) ) { - return; - } - // for actual exceptions, this is useful - return e.sourceURL + ":" + e.line; - } -} -function sourceFromStacktrace( offset ) { - try { - throw new Error(); - } catch ( e ) { - return extractStacktrace( e, offset ); - } -} - -/** + extend( QUnit.constructor.prototype, { + + // Logging callbacks; all receive a single argument with the listed properties + // run test/logs.html for any related changes + begin: registerLoggingCallback( 'begin' ), + + // done: { failed, passed, total, runtime } + done: registerLoggingCallback( 'done' ), + + // log: { result, actual, expected, message } + log: registerLoggingCallback( 'log' ), + + // testStart: { name } + testStart: registerLoggingCallback( 'testStart' ), + + // testDone: { name, failed, passed, total, duration } + testDone: registerLoggingCallback( 'testDone' ), + + // moduleStart: { name } + moduleStart: registerLoggingCallback( 'moduleStart' ), + + // moduleDone: { name, failed, passed, total } + moduleDone: registerLoggingCallback( 'moduleDone' ), + }); + + if ( typeof document === 'undefined' || document.readyState === 'complete' ) { + config.autorun = true; + } + + QUnit.load = function() { + runLoggingCallbacks( 'begin', QUnit, {} ); + + // Initialize the config, saving the execution queue + let banner; let filter; let i; let label; let len; let main; let ol; let toolbar; let userAgent; let val; + let urlConfigCheckboxesContainer; let urlConfigCheckboxes; let moduleFilter; + let numModules = 0; + let moduleFilterHtml = ''; + let urlConfigHtml = ''; + const oldconfig = extend( {}, config ); + + QUnit.init(); + extend(config, oldconfig); + + config.blocking = false; + + len = config.urlConfig.length; + + for ( i = 0; i < len; i++ ) { + val = config.urlConfig[i]; + if ( typeof val === 'string' ) { + val = { + id: val, + label: val, + tooltip: '[no tooltip available]', + }; + } + config[val.id] = QUnit.urlParams[val.id]; + urlConfigHtml += ''; + } + + moduleFilterHtml += ''; + + // `userAgent` initialized at top of scope + userAgent = id( 'qunit-userAgent' ); + if ( userAgent ) { + userAgent.innerHTML = navigator.userAgent; + } + + // `banner` initialized at top of scope + banner = id( 'qunit-header' ); + if ( banner ) { + banner.innerHTML = '' + banner.innerHTML + ' '; + } + + // `toolbar` initialized at top of scope + toolbar = id( 'qunit-testrunner-toolbar' ); + if ( toolbar ) { + // `filter` initialized at top of scope + filter = document.createElement( 'input' ); + filter.type = 'checkbox'; + filter.id = 'qunit-filter-pass'; + + addEvent( filter, 'click', function() { + let tmp; + const ol = document.getElementById( 'qunit-tests' ); + + if ( filter.checked ) { + ol.className = ol.className + ' hidepass'; + } else { + tmp = ' ' + ol.className.replace( /[\n\t\r]/g, ' ' ) + ' '; + ol.className = tmp.replace( / hidepass /, ' ' ); + } + if ( defined.sessionStorage ) { + if (filter.checked) { + sessionStorage.setItem( 'qunit-filter-passed-tests', 'true' ); + } else { + sessionStorage.removeItem( 'qunit-filter-passed-tests' ); + } + } + }); + + if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( 'qunit-filter-passed-tests' ) ) { + filter.checked = true; + // `ol` initialized at top of scope + ol = document.getElementById( 'qunit-tests' ); + ol.className = ol.className + ' hidepass'; + } + toolbar.appendChild( filter ); + + // `label` initialized at top of scope + label = document.createElement( 'label' ); + label.setAttribute( 'for', 'qunit-filter-pass' ); + label.setAttribute( 'title', 'Only show tests and assertons that fail. Stored in sessionStorage.' ); + label.innerHTML = 'Hide passed tests'; + toolbar.appendChild( label ); + + urlConfigCheckboxesContainer = document.createElement('span'); + urlConfigCheckboxesContainer.innerHTML = urlConfigHtml; + urlConfigCheckboxes = urlConfigCheckboxesContainer.getElementsByTagName('input'); + // For oldIE support: + // * Add handlers to the individual elements instead of the container + // * Use "click" instead of "change" + // * Fallback from event.target to event.srcElement + addEvents( urlConfigCheckboxes, 'click', function( event ) { + const params = {}; + const target = event.target || event.srcElement; + params[target.name] = target.checked ? true : undefined; + window.location = QUnit.url( params ); + }); + toolbar.appendChild( urlConfigCheckboxesContainer ); + + if (numModules > 1) { + moduleFilter = document.createElement( 'span' ); + moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' ); + moduleFilter.innerHTML = moduleFilterHtml; + addEvent( moduleFilter.lastChild, 'change', function() { + const selectBox = moduleFilter.getElementsByTagName('select')[0]; + const selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); + + window.location = QUnit.url( {module: ( selectedModule === '' ) ? undefined : selectedModule} ); + }); + toolbar.appendChild(moduleFilter); + } + } + + // `main` initialized at top of scope + main = id( 'qunit-fixture' ); + if ( main ) { + config.fixture = main.innerHTML; + } + + if ( config.autostart ) { + QUnit.start(); + } + }; + + addEvent( window, 'load', QUnit.load ); + + // `onErrorFnPrev` initialized at top of scope + // Preserve other handlers + onErrorFnPrev = window.onerror; + + // Cover uncaught exceptions + // Returning true will surpress the default browser handler, + // returning false will let it run. + window.onerror = function( error, filePath, linerNr ) { + let ret = false; + if ( onErrorFnPrev ) { + ret = onErrorFnPrev( error, filePath, linerNr ); + } + + // Treat return value as window.onerror itself does, + // Only do our handling if not surpressed. + if ( ret !== true ) { + if ( QUnit.config.current ) { + if ( QUnit.config.current.ignoreGlobalErrors ) { + return true; + } + QUnit.pushFailure( error, filePath + ':' + linerNr ); + } else { + QUnit.test( 'global failure', extend( function() { + QUnit.pushFailure( error, filePath + ':' + linerNr ); + }, {validTest: validTest} ) ); + } + return false; + } + + return ret; + }; + + function done() { + config.autorun = true; + + // Log the last module results + if ( config.currentModule ) { + runLoggingCallbacks( 'moduleDone', QUnit, { + name: config.currentModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all, + }); + } + + let i; let key; + const banner = id( 'qunit-banner' ); + const tests = id( 'qunit-tests' ); + const runtime = +new Date() - config.started; + const passed = config.stats.all - config.stats.bad; + const html = [ + 'Tests completed in ', + runtime, + ' milliseconds.
                            ', + '', + passed, + ' assertions of ', + config.stats.all, + ' passed, ', + config.stats.bad, + ' failed.', + ].join( '' ); + + if ( banner ) { + banner.className = ( config.stats.bad ? 'qunit-fail' : 'qunit-pass' ); + } + + if ( tests ) { + id( 'qunit-testresult' ).innerHTML = html; + } + + if ( config.altertitle && typeof document !== 'undefined' && document.title ) { + // show ✖ for good, ✔ for bad suite result in title + // use escape sequences in case file gets loaded with non-utf-8-charset + document.title = [ + ( config.stats.bad ? '\u2716' : '\u2714' ), + document.title.replace( /^[\u2714\u2716] /i, '' ), + ].join( ' ' ); + } + + // clear own sessionStorage items if all tests passed + if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { + // `key` & `i` initialized at top of scope + for ( i = 0; i < sessionStorage.length; i++ ) { + key = sessionStorage.key( i++ ); + if ( key.indexOf( 'qunit-test-' ) === 0 ) { + sessionStorage.removeItem( key ); + } + } + } + + // scroll back to top to show results + if ( window.scrollTo ) { + window.scrollTo(0, 0); + } + + runLoggingCallbacks( 'done', QUnit, { + failed: config.stats.bad, + passed: passed, + total: config.stats.all, + runtime: runtime, + }); + } + + /** @return Boolean: true if this test should be ran */ + function validTest( test ) { + let include; + let filter = config.filter && config.filter.toLowerCase(); + const module = config.module && config.module.toLowerCase(); + const fullName = (test.module + ': ' + test.testName).toLowerCase(); + + // Internally-generated tests are always valid + if ( test.callback && test.callback.validTest === validTest ) { + delete test.callback.validTest; + return true; + } + + if ( config.testNumber ) { + return test.testNumber === config.testNumber; + } + + if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { + return false; + } + + if ( !filter ) { + return true; + } + + include = filter.charAt( 0 ) !== '!'; + if ( !include ) { + filter = filter.slice( 1 ); + } + + // If the filter matches, we need to honour include + if ( fullName.indexOf( filter ) !== -1 ) { + return include; + } + + // Otherwise, do the opposite + return !include; + } + + // so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) + // Later Safari and IE10 are supposed to support error.stack as well + // See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack + function extractStacktrace( e, offset ) { + offset = offset === undefined ? 3 : offset; + + let stack; let include; let i; + + if ( e.stacktrace ) { + // Opera + return e.stacktrace.split( '\n' )[offset + 3]; + } else if ( e.stack ) { + // Firefox, Chrome + stack = e.stack.split( '\n' ); + if (/^error$/i.test( stack[0] ) ) { + stack.shift(); + } + if ( fileName ) { + include = []; + for ( i = offset; i < stack.length; i++ ) { + if ( stack[i].indexOf( fileName ) !== -1 ) { + break; + } + include.push( stack[i] ); + } + if ( include.length ) { + return include.join( '\n' ); + } + } + return stack[offset]; + } else if ( e.sourceURL ) { + // Safari, PhantomJS + // hopefully one day Safari provides actual stacktraces + // exclude useless self-reference for generated Error objects + if ( /qunit.js$/.test( e.sourceURL ) ) { + return; + } + // for actual exceptions, this is useful + return e.sourceURL + ':' + e.line; + } + } + function sourceFromStacktrace( offset ) { + try { + throw new Error(); + } catch ( e ) { + return extractStacktrace( e, offset ); + } + } + + /** * Escape text for attribute or text content. */ -function escapeText( s ) { - if ( !s ) { - return ""; - } - s = s + ""; - // Both single quotes and double quotes (for attributes) - return s.replace( /['"<>&]/g, function( s ) { - switch( s ) { - case '\'': - return '''; - case '"': - return '"'; - case '<': - return '<'; - case '>': - return '>'; - case '&': - return '&'; - } - }); -} - -function synchronize( callback, last ) { - config.queue.push( callback ); - - if ( config.autorun && !config.blocking ) { - process( last ); - } -} - -function process( last ) { - function next() { - process( last ); - } - var start = new Date().getTime(); - config.depth = config.depth ? config.depth + 1 : 1; - - while ( config.queue.length && !config.blocking ) { - if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { - config.queue.shift()(); - } else { - window.setTimeout( next, 13 ); - break; - } - } - config.depth--; - if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { - done(); - } -} - -function saveGlobal() { - config.pollution = []; - - if ( config.noglobals ) { - for ( var key in window ) { - // in Opera sometimes DOM element ids show up here, ignore them - if ( !hasOwn.call( window, key ) || /^qunit-test-output/.test( key ) ) { - continue; - } - config.pollution.push( key ); - } - } -} - -function checkPollution() { - var newGlobals, - deletedGlobals, - old = config.pollution; - - saveGlobal(); - - newGlobals = diff( config.pollution, old ); - if ( newGlobals.length > 0 ) { - QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") ); - } - - deletedGlobals = diff( old, config.pollution ); - if ( deletedGlobals.length > 0 ) { - QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") ); - } -} - -// returns a new Array with the elements that are in a but not in b -function diff( a, b ) { - var i, j, - result = a.slice(); - - for ( i = 0; i < result.length; i++ ) { - for ( j = 0; j < b.length; j++ ) { - if ( result[i] === b[j] ) { - result.splice( i, 1 ); - i--; - break; - } - } - } - return result; -} - -function extend( a, b ) { - for ( var prop in b ) { - if ( b[ prop ] === undefined ) { - delete a[ prop ]; - - // Avoid "Member not found" error in IE8 caused by setting window.constructor - } else if ( prop !== "constructor" || a !== window ) { - a[ prop ] = b[ prop ]; - } - } - - return a; -} - -/** + function escapeText( s ) { + if ( !s ) { + return ''; + } + s = s + ''; + // Both single quotes and double quotes (for attributes) + return s.replace( /['"<>&]/g, function( s ) { + switch ( s ) { + case '\'': + return '''; + case '"': + return '"'; + case '<': + return '<'; + case '>': + return '>'; + case '&': + return '&'; + } + }); + } + + function synchronize( callback, last ) { + config.queue.push( callback ); + + if ( config.autorun && !config.blocking ) { + process( last ); + } + } + + function process( last ) { + function next() { + process( last ); + } + const start = new Date().getTime(); + config.depth = config.depth ? config.depth + 1 : 1; + + while ( config.queue.length && !config.blocking ) { + if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { + config.queue.shift()(); + } else { + window.setTimeout( next, 13 ); + break; + } + } + config.depth--; + if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { + done(); + } + } + + function saveGlobal() { + config.pollution = []; + + if ( config.noglobals ) { + for ( const key in window ) { + // in Opera sometimes DOM element ids show up here, ignore them + if ( !hasOwn.call( window, key ) || /^qunit-test-output/.test( key ) ) { + continue; + } + config.pollution.push( key ); + } + } + } + + function checkPollution() { + let newGlobals; + let deletedGlobals; + const old = config.pollution; + + saveGlobal(); + + newGlobals = diff( config.pollution, old ); + if ( newGlobals.length > 0 ) { + QUnit.pushFailure( 'Introduced global variable(s): ' + newGlobals.join(', ') ); + } + + deletedGlobals = diff( old, config.pollution ); + if ( deletedGlobals.length > 0 ) { + QUnit.pushFailure( 'Deleted global variable(s): ' + deletedGlobals.join(', ') ); + } + } + + // returns a new Array with the elements that are in a but not in b + function diff( a, b ) { + let i; let j; + const result = a.slice(); + + for ( i = 0; i < result.length; i++ ) { + for ( j = 0; j < b.length; j++ ) { + if ( result[i] === b[j] ) { + result.splice( i, 1 ); + i--; + break; + } + } + } + return result; + } + + function extend( a, b ) { + for ( const prop in b ) { + if ( b[prop] === undefined ) { + delete a[prop]; + + // Avoid "Member not found" error in IE8 caused by setting window.constructor + } else if ( prop !== 'constructor' || a !== window ) { + a[prop] = b[prop]; + } + } + + return a; + } + + /** * @param {HTMLElement} elem * @param {string} type * @param {Function} fn */ -function addEvent( elem, type, fn ) { - // Standards-based browsers - if ( elem.addEventListener ) { - elem.addEventListener( type, fn, false ); - // IE - } else { - elem.attachEvent( "on" + type, fn ); - } -} - -/** + function addEvent( elem, type, fn ) { + // Standards-based browsers + if ( elem.addEventListener ) { + elem.addEventListener( type, fn, false ); + // IE + } else { + elem.attachEvent( 'on' + type, fn ); + } + } + + /** * @param {Array|NodeList} elems * @param {string} type * @param {Function} fn */ -function addEvents( elems, type, fn ) { - var i = elems.length; - while ( i-- ) { - addEvent( elems[i], type, fn ); - } -} - -function hasClass( elem, name ) { - return (" " + elem.className + " ").indexOf(" " + name + " ") > -1; -} - -function addClass( elem, name ) { - if ( !hasClass( elem, name ) ) { - elem.className += (elem.className ? " " : "") + name; - } -} - -function removeClass( elem, name ) { - var set = " " + elem.className + " "; - // Class name may appear multiple times - while ( set.indexOf(" " + name + " ") > -1 ) { - set = set.replace(" " + name + " " , " "); - } - // If possible, trim it for prettiness, but not neccecarily - elem.className = window.jQuery ? jQuery.trim( set ) : ( set.trim ? set.trim() : set ); -} - -function id( name ) { - return !!( typeof document !== "undefined" && document && document.getElementById ) && + function addEvents( elems, type, fn ) { + let i = elems.length; + while ( i-- ) { + addEvent( elems[i], type, fn ); + } + } + + function hasClass( elem, name ) { + return (' ' + elem.className + ' ').indexOf(' ' + name + ' ') > -1; + } + + function addClass( elem, name ) { + if ( !hasClass( elem, name ) ) { + elem.className += (elem.className ? ' ' : '') + name; + } + } + + function removeClass( elem, name ) { + let set = ' ' + elem.className + ' '; + // Class name may appear multiple times + while ( set.indexOf(' ' + name + ' ') > -1 ) { + set = set.replace(' ' + name + ' ', ' '); + } + // If possible, trim it for prettiness, but not neccecarily + elem.className = window.jQuery ? jQuery.trim( set ) : ( set.trim ? set.trim() : set ); + } + + function id( name ) { + return !!( typeof document !== 'undefined' && document && document.getElementById ) && document.getElementById( name ); -} - -function registerLoggingCallback( key ) { - return function( callback ) { - config[key].push( callback ); - }; -} - -// Supports deprecated method of completely overwriting logging callbacks -function runLoggingCallbacks( key, scope, args ) { - var i, callbacks; - if ( QUnit.hasOwnProperty( key ) ) { - QUnit[ key ].call(scope, args ); - } else { - callbacks = config[ key ]; - for ( i = 0; i < callbacks.length; i++ ) { - callbacks[ i ].call( scope, args ); - } - } -} - -// Test for equality any JavaScript type. -// Author: Philippe Rathé -QUnit.equiv = (function() { - - // Call the o related callback with the given arguments. - function bindCallbacks( o, callbacks, args ) { - var prop = QUnit.objectType( o ); - if ( prop ) { - if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) { - return callbacks[ prop ].apply( callbacks, args ); - } else { - return callbacks[ prop ]; // or undefined - } - } - } - - // the real equiv function - var innerEquiv, - // stack to decide between skip/abort functions - callers = [], - // stack to avoiding loops from circular referencing - parents = [], - - getProto = Object.getPrototypeOf || function ( obj ) { - return obj.__proto__; - }, - callbacks = (function () { - - // for string, boolean, number and null - function useStrictEquality( b, a ) { - /*jshint eqeqeq:false */ - if ( b instanceof a.constructor || a instanceof b.constructor ) { - // to catch short annotaion VS 'new' annotation of a - // declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function( b ) { - return isNaN( b ); - }, - - "date": function( b, a ) { - return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function( b, a ) { - return QUnit.objectType( b ) === "regexp" && + } + + function registerLoggingCallback( key ) { + return function( callback ) { + config[key].push( callback ); + }; + } + + // Supports deprecated method of completely overwriting logging callbacks + function runLoggingCallbacks( key, scope, args ) { + let i; let callbacks; + if ( QUnit.hasOwnProperty( key ) ) { + QUnit[key].call(scope, args ); + } else { + callbacks = config[key]; + for ( i = 0; i < callbacks.length; i++ ) { + callbacks[i].call( scope, args ); + } + } + } + + // Test for equality any JavaScript type. + // Author: Philippe Rathé + QUnit.equiv = (function() { + // Call the o related callback with the given arguments. + function bindCallbacks( o, callbacks, args ) { + const prop = QUnit.objectType( o ); + if ( prop ) { + if ( QUnit.objectType( callbacks[prop] ) === 'function' ) { + return callbacks[prop].apply( callbacks, args ); + } else { + return callbacks[prop]; // or undefined + } + } + } + + // the real equiv function + let innerEquiv; + // stack to decide between skip/abort functions + const callers = []; + // stack to avoiding loops from circular referencing + const parents = []; + + const getProto = Object.getPrototypeOf || function( obj ) { + return obj.__proto__; + }; + const callbacks = (function() { + // for string, boolean, number and null + function useStrictEquality( b, a ) { + /* jshint eqeqeq:false */ + if ( b instanceof a.constructor || a instanceof b.constructor ) { + // to catch short annotaion VS 'new' annotation of a + // declaration + // e.g. var i = 1; + // var j = new Number(1); + return a == b; + } else { + return a === b; + } + } + + return { + 'string': useStrictEquality, + 'boolean': useStrictEquality, + 'number': useStrictEquality, + 'null': useStrictEquality, + 'undefined': useStrictEquality, + + 'nan': function( b ) { + return isNaN( b ); + }, + + 'date': function( b, a ) { + return QUnit.objectType( b ) === 'date' && a.valueOf() === b.valueOf(); + }, + + 'regexp': function( b, a ) { + return QUnit.objectType( b ) === 'regexp' && // the regex itself a.source === b.source && // and its modifers @@ -1630,126 +1626,126 @@ QUnit.equiv = (function() { a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function() { - var caller = callers[callers.length - 1]; - return caller !== Object && typeof caller !== "undefined"; - }, - - "array": function( b, a ) { - var i, j, len, loop; - - // b could be an object literal here - if ( QUnit.objectType( b ) !== "array" ) { - return false; - } - - len = a.length; - if ( len !== b.length ) { - // safe and faster - return false; - } - - // track reference to avoid circular references - parents.push( a ); - for ( i = 0; i < len; i++ ) { - loop = false; - for ( j = 0; j < parents.length; j++ ) { - if ( parents[j] === a[i] ) { - loop = true;// dont rewalk array - } - } - if ( !loop && !innerEquiv(a[i], b[i]) ) { - parents.pop(); - return false; - } - } - parents.pop(); - return true; - }, - - "object": function( b, a ) { - var i, j, loop, - // Default to true - eq = true, - aProperties = [], - bProperties = []; - - // comparing constructors is more strict than using - // instanceof - if ( a.constructor !== b.constructor ) { - // Allow objects with no prototype to be equivalent to - // objects with Object as their constructor. - if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || + }, + + // - skip when the property is a method of an instance (OOP) + // - abort otherwise, + // initial === would have catch identical references anyway + 'function': function() { + const caller = callers[callers.length - 1]; + return caller !== Object && typeof caller !== 'undefined'; + }, + + 'array': function( b, a ) { + let i; let j; let len; let loop; + + // b could be an object literal here + if ( QUnit.objectType( b ) !== 'array' ) { + return false; + } + + len = a.length; + if ( len !== b.length ) { + // safe and faster + return false; + } + + // track reference to avoid circular references + parents.push( a ); + for ( i = 0; i < len; i++ ) { + loop = false; + for ( j = 0; j < parents.length; j++ ) { + if ( parents[j] === a[i] ) { + loop = true;// dont rewalk array + } + } + if ( !loop && !innerEquiv(a[i], b[i]) ) { + parents.pop(); + return false; + } + } + parents.pop(); + return true; + }, + + 'object': function( b, a ) { + let i; let j; let loop; + // Default to true + let eq = true; + const aProperties = []; + const bProperties = []; + + // comparing constructors is more strict than using + // instanceof + if ( a.constructor !== b.constructor ) { + // Allow objects with no prototype to be equivalent to + // objects with Object as their constructor. + if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || ( getProto(b) === null && getProto(a) === Object.prototype ) ) ) { - return false; - } - } - - // stack constructor before traversing properties - callers.push( a.constructor ); - // track reference to avoid circular references - parents.push( a ); - - for ( i in a ) { // be strict: don't ensures hasOwnProperty - // and go deep - loop = false; - for ( j = 0; j < parents.length; j++ ) { - if ( parents[j] === a[i] ) { - // don't go down the same path twice - loop = true; - } - } - aProperties.push(i); // collect a's properties - - if (!loop && !innerEquiv( a[i], b[i] ) ) { - eq = false; - break; - } - } - - callers.pop(); // unstack, we are done - parents.pop(); - - for ( i in b ) { - bProperties.push( i ); // collect b's properties - } - - // Ensures identical properties name - return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); - } - }; - }()); - - innerEquiv = function() { // can take multiple arguments - var args = [].slice.apply( arguments ); - if ( args.length < 2 ) { - return true; // end transition - } - - return (function( a, b ) { - if ( a === b ) { - return true; // catch the most you can - } else if ( a === null || b === null || typeof a === "undefined" || - typeof b === "undefined" || + return false; + } + } + + // stack constructor before traversing properties + callers.push( a.constructor ); + // track reference to avoid circular references + parents.push( a ); + + for ( i in a ) { // be strict: don't ensures hasOwnProperty + // and go deep + loop = false; + for ( j = 0; j < parents.length; j++ ) { + if ( parents[j] === a[i] ) { + // don't go down the same path twice + loop = true; + } + } + aProperties.push(i); // collect a's properties + + if (!loop && !innerEquiv( a[i], b[i] ) ) { + eq = false; + break; + } + } + + callers.pop(); // unstack, we are done + parents.pop(); + + for ( i in b ) { + bProperties.push( i ); // collect b's properties + } + + // Ensures identical properties name + return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); + }, + }; + }()); + + innerEquiv = function() { // can take multiple arguments + const args = [].slice.apply( arguments ); + if ( args.length < 2 ) { + return true; // end transition + } + + return (function( a, b ) { + if ( a === b ) { + return true; // catch the most you can + } else if ( a === null || b === null || typeof a === 'undefined' || + typeof b === 'undefined' || QUnit.objectType(a) !== QUnit.objectType(b) ) { - return false; // don't lose time with error prone cases - } else { - return bindCallbacks(a, callbacks, [ b, a ]); - } + return false; // don't lose time with error prone cases + } else { + return bindCallbacks(a, callbacks, [b, a]); + } - // apply transition with (1..n) arguments - }( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) ); - }; + // apply transition with (1..n) arguments + }( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) ); + }; - return innerEquiv; -}()); + return innerEquiv; + }()); -/** + /** * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | * http://flesler.blogspot.com Licensed under BSD * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 @@ -1759,242 +1755,242 @@ QUnit.equiv = (function() { * @author Ariel Flesler * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} */ -QUnit.jsDump = (function() { - function quote( str ) { - return '"' + str.toString().replace( /"/g, '\\"' ) + '"'; - } - function literal( o ) { - return o + ""; - } - function join( pre, arr, post ) { - var s = jsDump.separator(), - base = jsDump.indent(), - inner = jsDump.indent(1); - if ( arr.join ) { - arr = arr.join( "," + s + inner ); - } - if ( !arr ) { - return pre + post; - } - return [ pre, inner + arr, base + post ].join(s); - } - function array( arr, stack ) { - var i = arr.length, ret = new Array(i); - this.up(); - while ( i-- ) { - ret[i] = this.parse( arr[i] , undefined , stack); - } - this.down(); - return join( "[", ret, "]" ); - } - - var reName = /^function (\w+)/, - jsDump = { - // type is used mostly internally, you can fix a (custom)type in advance - parse: function( obj, type, stack ) { - stack = stack || [ ]; - var inStack, res, - parser = this.parsers[ type || this.typeOf(obj) ]; - - type = typeof parser; - inStack = inArray( obj, stack ); - - if ( inStack !== -1 ) { - return "recursion(" + (inStack - stack.length) + ")"; - } - if ( type === "function" ) { - stack.push( obj ); - res = parser.call( this, obj, stack ); - stack.pop(); - return res; - } - return ( type === "string" ) ? parser : this.parsers.error; - }, - typeOf: function( obj ) { - var type; - if ( obj === null ) { - type = "null"; - } else if ( typeof obj === "undefined" ) { - type = "undefined"; - } else if ( QUnit.is( "regexp", obj) ) { - type = "regexp"; - } else if ( QUnit.is( "date", obj) ) { - type = "date"; - } else if ( QUnit.is( "function", obj) ) { - type = "function"; - } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) { - type = "window"; - } else if ( obj.nodeType === 9 ) { - type = "document"; - } else if ( obj.nodeType ) { - type = "node"; - } else if ( - // native arrays - toString.call( obj ) === "[object Array]" || + QUnit.jsDump = (function() { + function quote( str ) { + return '"' + str.toString().replace( /"/g, '\\"' ) + '"'; + } + function literal( o ) { + return o + ''; + } + function join( pre, arr, post ) { + const s = jsDump.separator(); + const base = jsDump.indent(); + const inner = jsDump.indent(1); + if ( arr.join ) { + arr = arr.join( ',' + s + inner ); + } + if ( !arr ) { + return pre + post; + } + return [pre, inner + arr, base + post].join(s); + } + function array( arr, stack ) { + let i = arr.length; const ret = new Array(i); + this.up(); + while ( i-- ) { + ret[i] = this.parse( arr[i], undefined, stack); + } + this.down(); + return join( '[', ret, ']' ); + } + + const reName = /^function (\w+)/; + var jsDump = { + // type is used mostly internally, you can fix a (custom)type in advance + parse: function( obj, type, stack ) { + stack = stack || []; + let inStack; let res; + const parser = this.parsers[type || this.typeOf(obj)]; + + type = typeof parser; + inStack = inArray( obj, stack ); + + if ( inStack !== -1 ) { + return 'recursion(' + (inStack - stack.length) + ')'; + } + if ( type === 'function' ) { + stack.push( obj ); + res = parser.call( this, obj, stack ); + stack.pop(); + return res; + } + return ( type === 'string' ) ? parser : this.parsers.error; + }, + typeOf: function( obj ) { + let type; + if ( obj === null ) { + type = 'null'; + } else if ( typeof obj === 'undefined' ) { + type = 'undefined'; + } else if ( QUnit.is( 'regexp', obj) ) { + type = 'regexp'; + } else if ( QUnit.is( 'date', obj) ) { + type = 'date'; + } else if ( QUnit.is( 'function', obj) ) { + type = 'function'; + } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== 'undefined' && typeof obj.nodeType === 'undefined' ) { + type = 'window'; + } else if ( obj.nodeType === 9 ) { + type = 'document'; + } else if ( obj.nodeType ) { + type = 'node'; + } else if ( + // native arrays + toString.call( obj ) === '[object Array]' || // NodeList objects - ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) - ) { - type = "array"; - } else if ( obj.constructor === Error.prototype.constructor ) { - type = "error"; - } else { - type = typeof obj; - } - return type; - }, - separator: function() { - return this.multiline ? this.HTML ? "
                            " : "\n" : this.HTML ? " " : " "; - }, - // extra can be a number, shortcut for increasing-calling-decreasing - indent: function( extra ) { - if ( !this.multiline ) { - return ""; - } - var chr = this.indentChar; - if ( this.HTML ) { - chr = chr.replace( /\t/g, " " ).replace( / /g, " " ); - } - return new Array( this._depth_ + (extra||0) ).join(chr); - }, - up: function( a ) { - this._depth_ += a || 1; - }, - down: function( a ) { - this._depth_ -= a || 1; - }, - setParser: function( name, parser ) { - this.parsers[name] = parser; - }, - // The next 3 are exposed so you can use them - quote: quote, - literal: literal, - join: join, - // - _depth_: 1, - // This is the list of parsers, to modify them, use jsDump.setParser - parsers: { - window: "[Window]", - document: "[Document]", - error: function(error) { - return "Error(\"" + error.message + "\")"; - }, - unknown: "[Unknown]", - "null": "null", - "undefined": "undefined", - "function": function( fn ) { - var ret = "function", - // functions never have name in IE - name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1]; - - if ( name ) { - ret += " " + name; - } - ret += "( "; - - ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" ); - return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" ); - }, - array: array, - nodelist: array, - "arguments": array, - object: function( map, stack ) { - var ret = [ ], keys, key, val, i; - QUnit.jsDump.up(); - keys = []; - for ( key in map ) { - keys.push( key ); - } - keys.sort(); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - val = map[ key ]; - ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) ); - } - QUnit.jsDump.down(); - return join( "{", ret, "}" ); - }, - node: function( node ) { - var len, i, val, - open = QUnit.jsDump.HTML ? "<" : "<", - close = QUnit.jsDump.HTML ? ">" : ">", - tag = node.nodeName.toLowerCase(), - ret = open + tag, - attrs = node.attributes; - - if ( attrs ) { - for ( i = 0, len = attrs.length; i < len; i++ ) { - val = attrs[i].nodeValue; - // IE6 includes all attributes in .attributes, even ones not explicitly set. - // Those have values like undefined, null, 0, false, "" or "inherit". - if ( val && val !== "inherit" ) { - ret += " " + attrs[i].nodeName + "=" + QUnit.jsDump.parse( val, "attribute" ); - } - } - } - ret += close; - - // Show content of TextNode or CDATASection - if ( node.nodeType === 3 || node.nodeType === 4 ) { - ret += node.nodeValue; - } - - return ret + open + "/" + tag + close; - }, - // function calls it internally, it's the arguments part of the function - functionArgs: function( fn ) { - var args, - l = fn.length; - - if ( !l ) { - return ""; - } - - args = new Array(l); - while ( l-- ) { - // 97 is 'a' - args[l] = String.fromCharCode(97+l); - } - return " " + args.join( ", " ) + " "; - }, - // object calls it internally, the key part of an item in a map - key: quote, - // function calls it internally, it's the content of the function - functionCode: "[code]", - // node calls it internally, it's an html attribute value - attribute: quote, - string: quote, - date: quote, - regexp: literal, - number: literal, - "boolean": literal - }, - // if true, entities are escaped ( <, >, \t, space and \n ) - HTML: false, - // indentation unit - indentChar: " ", - // if true, items in a collection, are separated by a \n, else just a space. - multiline: true - }; - - return jsDump; -}()); - -// from jquery.js -function inArray( elem, array ) { - if ( array.indexOf ) { - return array.indexOf( elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; -} - -/* + ( typeof obj.length === 'number' && typeof obj.item !== 'undefined' && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === 'undefined' ) ) ) + ) { + type = 'array'; + } else if ( obj.constructor === Error.prototype.constructor ) { + type = 'error'; + } else { + type = typeof obj; + } + return type; + }, + separator: function() { + return this.multiline ? this.HTML ? '
                            ' : '\n' : this.HTML ? ' ' : ' '; + }, + // extra can be a number, shortcut for increasing-calling-decreasing + indent: function( extra ) { + if ( !this.multiline ) { + return ''; + } + let chr = this.indentChar; + if ( this.HTML ) { + chr = chr.replace( /\t/g, ' ' ).replace( / /g, ' ' ); + } + return new Array( this._depth_ + (extra||0) ).join(chr); + }, + up: function( a ) { + this._depth_ += a || 1; + }, + down: function( a ) { + this._depth_ -= a || 1; + }, + setParser: function( name, parser ) { + this.parsers[name] = parser; + }, + // The next 3 are exposed so you can use them + quote: quote, + literal: literal, + join: join, + // + _depth_: 1, + // This is the list of parsers, to modify them, use jsDump.setParser + parsers: { + 'window': '[Window]', + 'document': '[Document]', + 'error': function(error) { + return 'Error("' + error.message + '")'; + }, + 'unknown': '[Unknown]', + 'null': 'null', + 'undefined': 'undefined', + 'function': function( fn ) { + let ret = 'function'; + // functions never have name in IE + const name = 'name' in fn ? fn.name : (reName.exec(fn) || [])[1]; + + if ( name ) { + ret += ' ' + name; + } + ret += '( '; + + ret = [ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join( '' ); + return join( ret, QUnit.jsDump.parse(fn, 'functionCode' ), '}' ); + }, + 'array': array, + 'nodelist': array, + 'arguments': array, + 'object': function( map, stack ) { + const ret = []; let keys; let key; let val; let i; + QUnit.jsDump.up(); + keys = []; + for ( key in map ) { + keys.push( key ); + } + keys.sort(); + for ( i = 0; i < keys.length; i++ ) { + key = keys[i]; + val = map[key]; + ret.push( QUnit.jsDump.parse( key, 'key' ) + ': ' + QUnit.jsDump.parse( val, undefined, stack ) ); + } + QUnit.jsDump.down(); + return join( '{', ret, '}' ); + }, + 'node': function( node ) { + let len; let i; let val; + const open = QUnit.jsDump.HTML ? '<' : '<'; + const close = QUnit.jsDump.HTML ? '>' : '>'; + const tag = node.nodeName.toLowerCase(); + let ret = open + tag; + const attrs = node.attributes; + + if ( attrs ) { + for ( i = 0, len = attrs.length; i < len; i++ ) { + val = attrs[i].nodeValue; + // IE6 includes all attributes in .attributes, even ones not explicitly set. + // Those have values like undefined, null, 0, false, "" or "inherit". + if ( val && val !== 'inherit' ) { + ret += ' ' + attrs[i].nodeName + '=' + QUnit.jsDump.parse( val, 'attribute' ); + } + } + } + ret += close; + + // Show content of TextNode or CDATASection + if ( node.nodeType === 3 || node.nodeType === 4 ) { + ret += node.nodeValue; + } + + return ret + open + '/' + tag + close; + }, + // function calls it internally, it's the arguments part of the function + 'functionArgs': function( fn ) { + let args; + let l = fn.length; + + if ( !l ) { + return ''; + } + + args = new Array(l); + while ( l-- ) { + // 97 is 'a' + args[l] = String.fromCharCode(97+l); + } + return ' ' + args.join( ', ' ) + ' '; + }, + // object calls it internally, the key part of an item in a map + 'key': quote, + // function calls it internally, it's the content of the function + 'functionCode': '[code]', + // node calls it internally, it's an html attribute value + 'attribute': quote, + 'string': quote, + 'date': quote, + 'regexp': literal, + 'number': literal, + 'boolean': literal, + }, + // if true, entities are escaped ( <, >, \t, space and \n ) + HTML: false, + // indentation unit + indentChar: ' ', + // if true, items in a collection, are separated by a \n, else just a space. + multiline: true, + }; + + return jsDump; + }()); + + // from jquery.js + function inArray( elem, array ) { + if ( array.indexOf ) { + return array.indexOf( elem ); + } + + for ( let i = 0, length = array.length; i < length; i++ ) { + if ( array[i] === elem ) { + return i; + } + } + + return -1; + } + + /* * Javascript Diff Algorithm * By John Resig (http://ejohn.org/) * Modified by Chu Alan "sprite" @@ -2008,145 +2004,141 @@ function inArray( elem, array ) { * * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick brown fox jumped jumps over" */ -QUnit.diff = (function() { - /*jshint eqeqeq:false, eqnull:true */ - function diff( o, n ) { - var i, - ns = {}, - os = {}; - - for ( i = 0; i < n.length; i++ ) { - if ( !hasOwn.call( ns, n[i] ) ) { - ns[ n[i] ] = { - rows: [], - o: null - }; - } - ns[ n[i] ].rows.push( i ); - } - - for ( i = 0; i < o.length; i++ ) { - if ( !hasOwn.call( os, o[i] ) ) { - os[ o[i] ] = { - rows: [], - n: null - }; - } - os[ o[i] ].rows.push( i ); - } - - for ( i in ns ) { - if ( !hasOwn.call( ns, i ) ) { - continue; - } - if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { - n[ ns[i].rows[0] ] = { - text: n[ ns[i].rows[0] ], - row: os[i].rows[0] - }; - o[ os[i].rows[0] ] = { - text: o[ os[i].rows[0] ], - row: ns[i].rows[0] - }; - } - } - - for ( i = 0; i < n.length - 1; i++ ) { - if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null && - n[ i + 1 ] == o[ n[i].row + 1 ] ) { - - n[ i + 1 ] = { - text: n[ i + 1 ], - row: n[i].row + 1 - }; - o[ n[i].row + 1 ] = { - text: o[ n[i].row + 1 ], - row: i + 1 - }; - } - } - - for ( i = n.length - 1; i > 0; i-- ) { - if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null && - n[ i - 1 ] == o[ n[i].row - 1 ]) { - - n[ i - 1 ] = { - text: n[ i - 1 ], - row: n[i].row - 1 - }; - o[ n[i].row - 1 ] = { - text: o[ n[i].row - 1 ], - row: i - 1 - }; - } - } - - return { - o: o, - n: n - }; - } - - return function( o, n ) { - o = o.replace( /\s+$/, "" ); - n = n.replace( /\s+$/, "" ); - - var i, pre, - str = "", - out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ), - oSpace = o.match(/\s+/g), - nSpace = n.match(/\s+/g); - - if ( oSpace == null ) { - oSpace = [ " " ]; - } - else { - oSpace.push( " " ); - } - - if ( nSpace == null ) { - nSpace = [ " " ]; - } - else { - nSpace.push( " " ); - } - - if ( out.n.length === 0 ) { - for ( i = 0; i < out.o.length; i++ ) { - str += "" + out.o[i] + oSpace[i] + ""; - } - } - else { - if ( out.n[0].text == null ) { - for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { - str += "" + out.o[n] + oSpace[n] + ""; - } - } - - for ( i = 0; i < out.n.length; i++ ) { - if (out.n[i].text == null) { - str += "" + out.n[i] + nSpace[i] + ""; - } - else { - // `pre` initialized at top of scope - pre = ""; - - for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { - pre += "" + out.o[n] + oSpace[n] + ""; - } - str += " " + out.n[i].text + nSpace[i] + pre; - } - } - } - - return str; - }; -}()); - -// for CommonJS enviroments, export everything -if ( typeof exports !== "undefined" ) { - extend( exports, QUnit ); -} + QUnit.diff = (function() { + /* jshint eqeqeq:false, eqnull:true */ + function diff( o, n ) { + let i; + const ns = {}; + const os = {}; + + for ( i = 0; i < n.length; i++ ) { + if ( !hasOwn.call( ns, n[i] ) ) { + ns[n[i]] = { + rows: [], + o: null, + }; + } + ns[n[i]].rows.push( i ); + } + + for ( i = 0; i < o.length; i++ ) { + if ( !hasOwn.call( os, o[i] ) ) { + os[o[i]] = { + rows: [], + n: null, + }; + } + os[o[i]].rows.push( i ); + } + + for ( i in ns ) { + if ( !hasOwn.call( ns, i ) ) { + continue; + } + if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { + n[ns[i].rows[0]] = { + text: n[ns[i].rows[0]], + row: os[i].rows[0], + }; + o[os[i].rows[0]] = { + text: o[os[i].rows[0]], + row: ns[i].rows[0], + }; + } + } + + for ( i = 0; i < n.length - 1; i++ ) { + if ( n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null && + n[i + 1] == o[n[i].row + 1] ) { + n[i + 1] = { + text: n[i + 1], + row: n[i].row + 1, + }; + o[n[i].row + 1] = { + text: o[n[i].row + 1], + row: i + 1, + }; + } + } + + for ( i = n.length - 1; i > 0; i-- ) { + if ( n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null && + n[i - 1] == o[n[i].row - 1]) { + n[i - 1] = { + text: n[i - 1], + row: n[i].row - 1, + }; + o[n[i].row - 1] = { + text: o[n[i].row - 1], + row: i - 1, + }; + } + } + + return { + o: o, + n: n, + }; + } + + return function( o, n ) { + o = o.replace( /\s+$/, '' ); + n = n.replace( /\s+$/, '' ); + + let i; let pre; + let str = ''; + const out = diff( o === '' ? [] : o.split(/\s+/), n === '' ? [] : n.split(/\s+/) ); + let oSpace = o.match(/\s+/g); + let nSpace = n.match(/\s+/g); + + if ( oSpace == null ) { + oSpace = [' ']; + } else { + oSpace.push( ' ' ); + } + + if ( nSpace == null ) { + nSpace = [' ']; + } else { + nSpace.push( ' ' ); + } + + if ( out.n.length === 0 ) { + for ( i = 0; i < out.o.length; i++ ) { + str += '' + out.o[i] + oSpace[i] + ''; + } + } else { + if ( out.n[0].text == null ) { + for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { + str += '' + out.o[n] + oSpace[n] + ''; + } + } + + for ( i = 0; i < out.n.length; i++ ) { + if (out.n[i].text == null) { + str += '' + out.n[i] + nSpace[i] + ''; + } else { + // `pre` initialized at top of scope + pre = ''; + + for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { + pre += '' + out.o[n] + oSpace[n] + ''; + } + str += ' ' + out.n[i].text + nSpace[i] + pre; + } + } + } + + return str; + }; + }()); + + // for CommonJS enviroments, export everything + if ( typeof exports !== 'undefined' ) { + extend( exports, QUnit ); + } // get at whatever the global object is, like window in browsers -}( (function() {return this;}.call()) )); +}( (function() { + return this; +}.call()) )); diff --git a/test/yui/resources/tests.js b/test/yui/resources/tests.js index f74569f..5fdc99b 100644 --- a/test/yui/resources/tests.js +++ b/test/yui/resources/tests.js @@ -1,3 +1,3 @@ -test( "hello test", function() { - ok( 1 == "1", "Passed!" ); -}); \ No newline at end of file +test( 'hello test', function() { + ok( 1 == '1', 'Passed!' ); +}); From 5fd68405d9552e54bbc06818e02bcadddb80b810 Mon Sep 17 00:00:00 2001 From: Ralic Lo Date: Thu, 24 Oct 2019 22:22:55 +0800 Subject: [PATCH 3/4] Revised travis.yml --- .travis.yml | 7 ++++--- package.json | 15 ++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index c22a3af..b22cb0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,10 @@ language: node_js sudo: false -node_js: - - "0.12" - - "4.2" +node_js: + - "node" + - "12" + - "8" cache: directories: diff --git a/package.json b/package.json index 3574c82..7cce7ce 100644 --- a/package.json +++ b/package.json @@ -17,23 +17,20 @@ }, "license": "MIT", "engines": { - "node": ">=0.6", - "npm": ">=1.2.12" + "node": ">8", + "npm": ">=3" }, "scripts": { "test": "grunt" }, "dependencies": { - "colors": "~1.1.2", - "lodash": "^4.17.11", - "q": "~1.4.1", + "colors": "^1.1.2", + "lodash": "^4.17.12", + "q": "^1.4.1", "requestretry": "^4.0.2", - "sauce-tunnel": "~2.5.0", + "sauce-tunnel": "^2.5.0", "saucelabs": "^1.5.0" }, - "peerDependencies": { - "grunt": ">=0.4.1" - }, "devDependencies": { "eslint": "^6.5.1", "eslint-config-google": "^0.14.0", From 3bcecc67cd39fa218c09b6d4e40b0c1a2fe347b3 Mon Sep 17 00:00:00 2001 From: Ralic Lo Date: Thu, 24 Oct 2019 23:15:18 +0800 Subject: [PATCH 4/4] Fixing test failures --- .travis.yml | 1 + package.json | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b22cb0b..e370fa9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,7 @@ env: zkP183w3LESZo2MA/iWtADxSY8e4ws1UJ7gwNH4P2sw+Qcxr+Q4= install: + - npm install -g jshint jsonlint npm - npm install -g grunt-cli - npm install diff --git a/package.json b/package.json index 7cce7ce..878cdcc 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,15 @@ }, "dependencies": { "colors": "^1.1.2", - "lodash": "^4.17.12", + "lodash": "^4.17.11", "q": "^1.4.1", "requestretry": "^4.0.2", "sauce-tunnel": "^2.5.0", "saucelabs": "^1.5.0" }, + "peerDependencies": { + "grunt": "~0.4.4" + }, "devDependencies": { "eslint": "^6.5.1", "eslint-config-google": "^0.14.0",