-
-
- {{{pathHtml}}}
-
-
- {{#with metrics.statements}}
-
- {{pct}}%
- Statements
- {{covered}}/{{total}}
-
- {{/with}}
- {{#with metrics.branches}}
-
- {{pct}}%
- Branches
- {{covered}}/{{total}}
-
- {{/with}}
- {{#with metrics.functions}}
-
- {{pct}}%
- Functions
- {{covered}}/{{total}}
-
- {{/with}}
- {{#with metrics.lines}}
-
- {{pct}}%
- Lines
- {{covered}}/{{total}}
-
- {{/with}}
- {{#if_has_ignores metrics}}
-
- {{#show_ignores metrics}}{{/show_ignores}}
- Ignored
-
- {{/if_has_ignores}}
-
-
-
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/report/text-lcov.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/report/text-lcov.js
deleted file mode 100644
index 15e1a48ca..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/report/text-lcov.js
+++ /dev/null
@@ -1,50 +0,0 @@
-var LcovOnly = require('./lcovonly'),
- util = require('util');
-
-/**
- * a `Report` implementation that produces an LCOV coverage and prints it
- * to standard out.
- *
- * Usage
- * -----
- *
- * var report = require('istanbul').Report.create('text-lcov');
- *
- * @class TextLcov
- * @module report
- * @extends LcovOnly
- * @constructor
- * @param {Object} opts optional
- * @param {String} [opts.log] the method used to log to console.
- */
-function TextLcov(opts) {
- var that = this;
-
- LcovOnly.call(this);
-
- this.opts = opts || {};
- this.opts.log = this.opts.log || console.log;
- this.opts.writer = {
- println: function (ln) {
- that.opts.log(ln);
- }
- };
-}
-
-TextLcov.TYPE = 'text-lcov';
-util.inherits(TextLcov, LcovOnly);
-
-LcovOnly.super_.mix(TextLcov, {
- writeReport: function (collector) {
- var that = this,
- writer = this.opts.writer;
-
- collector.files().forEach(function (key) {
- that.writeFileCoverage(writer, collector.fileCoverageFor(key));
- });
-
- this.emit('done');
- }
-});
-
-module.exports = TextLcov;
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/report/text-summary.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/report/text-summary.js
deleted file mode 100644
index 9537cbe20..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/report/text-summary.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-var path = require('path'),
- util = require('util'),
- mkdirp = require('mkdirp'),
- defaults = require('./common/defaults'),
- fs = require('fs'),
- utils = require('../object-utils'),
- Report = require('./index');
-
-/**
- * a `Report` implementation that produces text output for overall coverage in summary format.
- *
- * Usage
- * -----
- *
- * var report = require('istanbul').Report.create('text-summary');
- *
- * @class TextSummaryReport
- * @extends Report
- * @module report
- * @constructor
- * @param {Object} opts optional
- * @param {String} [opts.dir] the directory in which to the text coverage report will be written, when writing to a file
- * @param {String} [opts.file] the filename for the report. When omitted, the report is written to console
- */
-function TextSummaryReport(opts) {
- Report.call(this);
- opts = opts || {};
- this.dir = opts.dir || process.cwd();
- this.file = opts.file;
- this.watermarks = opts.watermarks || defaults.watermarks();
-}
-
-TextSummaryReport.TYPE = 'text-summary';
-util.inherits(TextSummaryReport, Report);
-
-function lineForKey(summary, key, watermarks) {
- var metrics = summary[key],
- skipped,
- result,
- clazz = defaults.classFor(key, summary, watermarks);
- key = key.substring(0, 1).toUpperCase() + key.substring(1);
- if (key.length < 12) { key += ' '.substring(0, 12 - key.length); }
- result = [ key , ':', metrics.pct + '%', '(', metrics.covered + '/' + metrics.total, ')'].join(' ');
- skipped = metrics.skipped;
- if (skipped > 0) {
- result += ', ' + skipped + ' ignored';
- }
- return defaults.colorize(result, clazz);
-}
-
-Report.mix(TextSummaryReport, {
- synopsis: function () {
- return 'text report that prints a coverage summary across all files, typically to console';
- },
- getDefaultConfig: function () {
- return { file: null };
- },
- writeReport: function (collector /*, sync */) {
- var summaries = [],
- finalSummary,
- lines = [],
- watermarks = this.watermarks,
- text;
- collector.files().forEach(function (file) {
- summaries.push(utils.summarizeFileCoverage(collector.fileCoverageFor(file)));
- });
- finalSummary = utils.mergeSummaryObjects.apply(null, summaries);
- lines.push('');
- lines.push('=============================== Coverage summary ===============================');
- lines.push.apply(lines, [
- lineForKey(finalSummary, 'statements', watermarks),
- lineForKey(finalSummary, 'branches', watermarks),
- lineForKey(finalSummary, 'functions', watermarks),
- lineForKey(finalSummary, 'lines', watermarks)
- ]);
- lines.push('================================================================================');
- text = lines.join('\n');
- if (this.file) {
- mkdirp.sync(this.dir);
- fs.writeFileSync(path.join(this.dir, this.file), text, 'utf8');
- } else {
- console.log(text);
- }
- this.emit('done');
- }
-});
-
-module.exports = TextSummaryReport;
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/report/text.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/report/text.js
deleted file mode 100644
index 8ab2b7d13..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/report/text.js
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-var path = require('path'),
- mkdirp = require('mkdirp'),
- util = require('util'),
- fs = require('fs'),
- defaults = require('./common/defaults'),
- Report = require('./index'),
- TreeSummarizer = require('../util/tree-summarizer'),
- utils = require('../object-utils'),
- PCT_COLS = 9,
- MISSING_COL = 15,
- TAB_SIZE = 1,
- DELIM = ' |',
- COL_DELIM = '-|';
-
-/**
- * a `Report` implementation that produces text output in a detailed table.
- *
- * Usage
- * -----
- *
- * var report = require('istanbul').Report.create('text');
- *
- * @class TextReport
- * @extends Report
- * @module report
- * @constructor
- * @param {Object} opts optional
- * @param {String} [opts.dir] the directory in which to the text coverage report will be written, when writing to a file
- * @param {String} [opts.file] the filename for the report. When omitted, the report is written to console
- * @param {Number} [opts.maxCols] the max column width of the report. By default, the width of the report is adjusted based on the length of the paths
- * to be reported.
- */
-function TextReport(opts) {
- Report.call(this);
- opts = opts || {};
- this.dir = opts.dir || process.cwd();
- this.file = opts.file;
- this.summary = opts.summary;
- this.maxCols = opts.maxCols || 0;
- this.watermarks = opts.watermarks || defaults.watermarks();
-}
-
-TextReport.TYPE = 'text';
-util.inherits(TextReport, Report);
-
-function padding(num, ch) {
- var str = '',
- i;
- ch = ch || ' ';
- for (i = 0; i < num; i += 1) {
- str += ch;
- }
- return str;
-}
-
-function fill(str, width, right, tabs, clazz) {
- tabs = tabs || 0;
- str = String(str);
-
- var leadingSpaces = tabs * TAB_SIZE,
- remaining = width - leadingSpaces,
- leader = padding(leadingSpaces),
- fmtStr = '',
- fillStr,
- strlen = str.length;
-
- if (remaining > 0) {
- if (remaining >= strlen) {
- fillStr = padding(remaining - strlen);
- fmtStr = right ? fillStr + str : str + fillStr;
- } else {
- fmtStr = str.substring(strlen - remaining);
- fmtStr = '... ' + fmtStr.substring(4);
- }
- }
-
- fmtStr = defaults.colorize(fmtStr, clazz);
- return leader + fmtStr;
-}
-
-function formatName(name, maxCols, level, clazz) {
- return fill(name, maxCols, false, level, clazz);
-}
-
-function formatPct(pct, clazz, width) {
- return fill(pct, width || PCT_COLS, true, 0, clazz);
-}
-
-function nodeName(node) {
- return node.displayShortName() || 'All files';
-}
-
-function tableHeader(maxNameCols) {
- var elements = [];
- elements.push(formatName('File', maxNameCols, 0));
- elements.push(formatPct('% Stmts'));
- elements.push(formatPct('% Branch'));
- elements.push(formatPct('% Funcs'));
- elements.push(formatPct('% Lines'));
- elements.push(formatPct('Uncovered Lines', undefined, MISSING_COL));
- return elements.join(' |') + ' |';
-}
-
-function collectMissingLines(kind, linesCovered) {
- var missingLines = [];
-
- if (kind !== 'file') {
- return [];
- }
-
- Object.keys(linesCovered).forEach(function (key) {
- if (!linesCovered[key]) {
- missingLines.push(key);
- }
- });
-
- return missingLines;
-}
-
-function tableRow(node, maxNameCols, level, watermarks) {
- var name = nodeName(node),
- statements = node.metrics.statements.pct,
- branches = node.metrics.branches.pct,
- functions = node.metrics.functions.pct,
- lines = node.metrics.lines.pct,
- missingLines = collectMissingLines(node.kind, node.metrics.linesCovered),
- elements = [];
-
- elements.push(formatName(name, maxNameCols, level, defaults.classFor('statements', node.metrics, watermarks)));
- elements.push(formatPct(statements, defaults.classFor('statements', node.metrics, watermarks)));
- elements.push(formatPct(branches, defaults.classFor('branches', node.metrics, watermarks)));
- elements.push(formatPct(functions, defaults.classFor('functions', node.metrics, watermarks)));
- elements.push(formatPct(lines, defaults.classFor('lines', node.metrics, watermarks)));
- elements.push(formatPct(missingLines.join(','), 'low', MISSING_COL));
-
- return elements.join(DELIM) + DELIM;
-}
-
-function findNameWidth(node, level, last) {
- last = last || 0;
- level = level || 0;
- var idealWidth = TAB_SIZE * level + nodeName(node).length;
- if (idealWidth > last) {
- last = idealWidth;
- }
- node.children.forEach(function (child) {
- last = findNameWidth(child, level + 1, last);
- });
- return last;
-}
-
-function makeLine(nameWidth) {
- var name = padding(nameWidth, '-'),
- pct = padding(PCT_COLS, '-'),
- elements = [];
-
- elements.push(name);
- elements.push(pct);
- elements.push(pct);
- elements.push(pct);
- elements.push(pct);
- elements.push(padding(MISSING_COL, '-'));
- return elements.join(COL_DELIM) + COL_DELIM;
-}
-
-function walk(node, nameWidth, array, level, watermarks) {
- var line;
- if (level === 0) {
- line = makeLine(nameWidth);
- array.push(line);
- array.push(tableHeader(nameWidth));
- array.push(line);
- } else {
- array.push(tableRow(node, nameWidth, level, watermarks));
- }
- node.children.forEach(function (child) {
- walk(child, nameWidth, array, level + 1, watermarks);
- });
- if (level === 0) {
- array.push(line);
- array.push(tableRow(node, nameWidth, level, watermarks));
- array.push(line);
- }
-}
-
-Report.mix(TextReport, {
- synopsis: function () {
- return 'text report that prints a coverage line for every file, typically to console';
- },
- getDefaultConfig: function () {
- return { file: null, maxCols: 0 };
- },
- writeReport: function (collector /*, sync */) {
- var summarizer = new TreeSummarizer(),
- tree,
- root,
- nameWidth,
- statsWidth = 4 * (PCT_COLS + 2) + MISSING_COL,
- maxRemaining,
- strings = [],
- text;
-
- collector.files().forEach(function (key) {
- summarizer.addFileCoverageSummary(key, utils.summarizeFileCoverage(
- collector.fileCoverageFor(key)
- ));
- });
- tree = summarizer.getTreeSummary();
- root = tree.root;
- nameWidth = findNameWidth(root);
- if (this.maxCols > 0) {
- maxRemaining = this.maxCols - statsWidth - 2;
- if (nameWidth > maxRemaining) {
- nameWidth = maxRemaining;
- }
- }
- walk(root, nameWidth, strings, 0, this.watermarks);
- text = strings.join('\n') + '\n';
- if (this.file) {
- mkdirp.sync(this.dir);
- fs.writeFileSync(path.join(this.dir, this.file), text, 'utf8');
- } else {
- console.log(text);
- }
- this.emit('done');
- }
-});
-
-module.exports = TextReport;
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/reporter.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/reporter.js
deleted file mode 100644
index c7000d5b9..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/reporter.js
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- Copyright (c) 2014, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-var Report = require('./report'),
- configuration = require('./config'),
- inputError = require('./util/input-error');
-
-/**
- * convenience mechanism to write one or more reports ensuring that config
- * options are respected.
- * Usage
- * -----
- *
- * var fs = require('fs'),
- * reporter = new require('istanbul').Reporter(),
- * collector = new require('istanbul').Collector(),
- * sync = true;
- *
- * collector.add(JSON.parse(fs.readFileSync('coverage.json', 'utf8')));
- * reporter.add('lcovonly');
- * reporter.addAll(['clover', 'cobertura']);
- * reporter.write(collector, sync, function () { console.log('done'); });
- *
- * @class Reporter
- * @param {Configuration} cfg the config object, a falsy value will load the
- * default configuration instead
- * @param {String} dir the directory in which to write the reports, may be falsy
- * to use config or global defaults
- * @constructor
- * @module main
- */
-function Reporter(cfg, dir) {
- this.config = cfg || configuration.loadFile();
- this.dir = dir || this.config.reporting.dir();
- this.reports = {};
-}
-
-Reporter.prototype = {
- /**
- * adds a report to be generated. Must be one of the entries returned
- * by `Report.getReportList()`
- * @method add
- * @param {String} fmt the format of the report to generate
- */
- add: function (fmt) {
- if (this.reports[fmt]) { // already added
- return;
- }
- var config = this.config,
- rptConfig = config.reporting.reportConfig()[fmt] || {};
- rptConfig.verbose = config.verbose;
- rptConfig.dir = this.dir;
- rptConfig.watermarks = config.reporting.watermarks();
- try {
- this.reports[fmt] = Report.create(fmt, rptConfig);
- } catch (ex) {
- throw inputError.create('Invalid report format [' + fmt + ']');
- }
- },
- /**
- * adds an array of report formats to be generated
- * @method addAll
- * @param {Array} fmts an array of report formats
- */
- addAll: function (fmts) {
- var that = this;
- fmts.forEach(function (f) {
- that.add(f);
- });
- },
- /**
- * writes all reports added and calls the callback when done
- * @method write
- * @param {Collector} collector the collector having the coverage data
- * @param {Boolean} sync true to write reports synchronously
- * @param {Function} callback the callback to call when done. When `sync`
- * is true, the callback will be called in the same process tick.
- */
- write: function (collector, sync, callback) {
- var reports = this.reports,
- verbose = this.config.verbose,
- handler = this.handleDone.bind(this, callback);
-
- this.inProgress = Object.keys(reports).length;
-
- Object.keys(reports).forEach(function (name) {
- var report = reports[name];
- if (verbose) {
- console.error('Write report: ' + name);
- }
- report.on('done', handler);
- report.writeReport(collector, sync);
- });
- },
- /*
- * handles listening on all reports to be completed before calling the callback
- * @method handleDone
- * @private
- * @param {Function} callback the callback to call when all reports are
- * written
- */
- handleDone: function (callback) {
- this.inProgress -= 1;
- if (this.inProgress === 0) {
- return callback();
- }
- }
-};
-
-module.exports = Reporter;
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/store/fslookup.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/store/fslookup.js
deleted file mode 100644
index b00cc179c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/store/fslookup.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-var util = require('util'),
- fs = require('fs'),
- Store = require('./index');
-
-/**
- * a `Store` implementation that doesn't actually store anything. It assumes that keys
- * are absolute file paths, and contents are contents of those files.
- * Thus, `set` for this store is no-op, `get` returns the
- * contents of the filename that the key represents, `hasKey` returns true if the key
- * supplied is a valid file path and `keys` always returns an empty array.
- *
- * Usage
- * -----
- *
- * var store = require('istanbul').Store.create('fslookup');
- *
- *
- * @class LookupStore
- * @extends Store
- * @module store
- * @constructor
- */
-function LookupStore(opts) {
- Store.call(this, opts);
-}
-
-LookupStore.TYPE = 'fslookup';
-util.inherits(LookupStore, Store);
-
-Store.mix(LookupStore, {
- keys: function () {
- return [];
- },
- get: function (key) {
- return fs.readFileSync(key, 'utf8');
- },
- hasKey: function (key) {
- var stats;
- try {
- stats = fs.statSync(key);
- return stats.isFile();
- } catch (ex) {
- return false;
- }
- },
- set: function (key /*, contents */) {
- if (!this.hasKey(key)) {
- throw new Error('Attempt to set contents for non-existent file [' + key + '] on a fslookup store');
- }
- return key;
- }
-});
-
-
-module.exports = LookupStore;
-
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/store/index.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/store/index.js
deleted file mode 100644
index 85ffc4f0a..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/store/index.js
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-var Factory = require('../util/factory'),
- factory = new Factory('store', __dirname, false);
-/**
- * An abstraction for keeping track of content against some keys (e.g.
- * original source, instrumented source, coverage objects against file names).
- * This class is both the base class as well as a factory for `Store` implementations.
- *
- * Usage
- * -----
- *
- * var Store = require('istanbul').Store,
- * store = Store.create('memory');
- *
- * //basic use
- * store.set('foo', 'foo-content');
- * var content = store.get('foo');
- *
- * //keys and values
- * store.keys().forEach(function (key) {
- * console.log(key + ':\n' + store.get(key);
- * });
- * if (store.hasKey('bar') { console.log(store.get('bar'); }
- *
- *
- * //syntactic sugar
- * store.setObject('foo', { foo: true });
- * console.log(store.getObject('foo').foo);
- *
- * store.dispose();
- *
- * @class Store
- * @constructor
- * @module store
- * @param {Object} options Optional. The options supported by a specific store implementation.
- * @main store
- */
-function Store(/* options */) {}
-
-//add register, create, mix, loadAll, getStoreList as class methods
-factory.bindClassMethods(Store);
-
-/**
- * registers a new store implementation.
- * @method register
- * @static
- * @param {Function} constructor the constructor function for the store. This function must have a
- * `TYPE` property of type String, that will be used in `Store.create()`
- */
-/**
- * returns a store implementation of the specified type.
- * @method create
- * @static
- * @param {String} type the type of store to create
- * @param {Object} opts Optional. Options specific to the store implementation
- * @return {Store} a new store of the specified type
- */
-
-Store.prototype = {
- /**
- * sets some content associated with a specific key. The manner in which
- * duplicate keys are handled for multiple `set()` calls with the same
- * key is implementation-specific.
- *
- * @method set
- * @param {String} key the key for the content
- * @param {String} contents the contents for the key
- */
- set: function (/* key, contents */) { throw new Error("set: must be overridden"); },
- /**
- * returns the content associated to a specific key or throws if the key
- * was not `set`
- * @method get
- * @param {String} key the key for which to get the content
- * @return {String} the content for the specified key
- */
- get: function (/* key */) { throw new Error("get: must be overridden"); },
- /**
- * returns a list of all known keys
- * @method keys
- * @return {Array} an array of seen keys
- */
- keys: function () { throw new Error("keys: must be overridden"); },
- /**
- * returns true if the key is one for which a `get()` call would work.
- * @method hasKey
- * @param {String} key
- * @return true if the key is valid for this store, false otherwise
- */
- hasKey: function (/* key */) { throw new Error("hasKey: must be overridden"); },
- /**
- * lifecycle method to dispose temporary resources associated with the store
- * @method dispose
- */
- dispose: function () {},
- /**
- * sugar method to return an object associated with a specific key. Throws
- * if the content set against the key was not a valid JSON string.
- * @method getObject
- * @param {String} key the key for which to return the associated object
- * @return {Object} the object corresponding to the key
- */
- getObject: function (key) {
- return JSON.parse(this.get(key));
- },
- /**
- * sugar method to set an object against a specific key.
- * @method setObject
- * @param {String} key the key for the object
- * @param {Object} object the object to be stored
- */
- setObject: function (key, object) {
- return this.set(key, JSON.stringify(object));
- }
-};
-
-module.exports = Store;
-
-
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/store/memory.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/store/memory.js
deleted file mode 100644
index ff96fbd32..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/store/memory.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-var util = require('util'),
- Store = require('./index');
-
-/**
- * a `Store` implementation using an in-memory object.
- *
- * Usage
- * -----
- *
- * var store = require('istanbul').Store.create('memory');
- *
- *
- * @class MemoryStore
- * @extends Store
- * @module store
- * @constructor
- */
-function MemoryStore() {
- Store.call(this);
- this.map = {};
-}
-
-MemoryStore.TYPE = 'memory';
-util.inherits(MemoryStore, Store);
-
-Store.mix(MemoryStore, {
- set: function (key, contents) {
- this.map[key] = contents;
- },
-
- get: function (key) {
- if (!this.hasKey(key)) {
- throw new Error('Unable to find entry for [' + key + ']');
- }
- return this.map[key];
- },
-
- hasKey: function (key) {
- return this.map.hasOwnProperty(key);
- },
-
- keys: function () {
- return Object.keys(this.map);
- },
-
- dispose: function () {
- this.map = {};
- }
-});
-
-module.exports = MemoryStore;
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/store/tmp.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/store/tmp.js
deleted file mode 100644
index 31789c88b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/store/tmp.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-var util = require('util'),
- path = require('path'),
- os = require('os'),
- fs = require('fs'),
- mkdirp = require('mkdirp'),
- Store = require('./index');
-
-function makeTempDir() {
- var dir = path.join(os.tmpdir ? os.tmpdir() : /* istanbul ignore next */ (process.env.TMPDIR || '/tmp'), 'ts' + new Date().getTime());
- mkdirp.sync(dir);
- return dir;
-}
-/**
- * a `Store` implementation using temporary files.
- *
- * Usage
- * -----
- *
- * var store = require('istanbul').Store.create('tmp');
- *
- *
- * @class TmpStore
- * @extends Store
- * @module store
- * @param {Object} opts Optional.
- * @param {String} [opts.tmp] a pre-existing directory to use as the `tmp` directory. When not specified, a random directory
- * is created under `os.tmpdir()`
- * @constructor
- */
-function TmpStore(opts) {
- opts = opts || {};
- this.tmp = opts.tmp || makeTempDir();
- this.map = {};
- this.seq = 0;
- this.prefix = 't' + new Date().getTime() + '-';
-}
-
-TmpStore.TYPE = 'tmp';
-util.inherits(TmpStore, Store);
-
-Store.mix(TmpStore, {
- generateTmpFileName: function () {
- this.seq += 1;
- return path.join(this.tmp, this.prefix + this.seq + '.tmp');
- },
-
- set: function (key, contents) {
- var tmpFile = this.generateTmpFileName();
- fs.writeFileSync(tmpFile, contents, 'utf8');
- this.map[key] = tmpFile;
- },
-
- get: function (key) {
- var tmpFile = this.map[key];
- if (!tmpFile) { throw new Error('Unable to find tmp entry for [' + tmpFile + ']'); }
- return fs.readFileSync(tmpFile, 'utf8');
- },
-
- hasKey: function (key) {
- return !!this.map[key];
- },
-
- keys: function () {
- return Object.keys(this.map);
- },
-
- dispose: function () {
- var map = this.map;
- Object.keys(map).forEach(function (key) {
- fs.unlinkSync(map[key]);
- });
- this.map = {};
- }
-});
-
-module.exports = TmpStore;
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/factory.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/factory.js
deleted file mode 100644
index 9f3d6f36f..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/factory.js
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-var util = require('util'),
- path = require('path'),
- fs = require('fs'),
- abbrev = require('abbrev');
-
-function Factory(kind, dir, allowAbbreviations) {
- this.kind = kind;
- this.dir = dir;
- this.allowAbbreviations = allowAbbreviations;
- this.classMap = {};
- this.abbreviations = null;
-}
-
-Factory.prototype = {
-
- knownTypes: function () {
- var keys = Object.keys(this.classMap);
- keys.sort();
- return keys;
- },
-
- resolve: function (abbreviatedType) {
- if (!this.abbreviations) {
- this.abbreviations = abbrev(this.knownTypes());
- }
- return this.abbreviations[abbreviatedType];
- },
-
- register: function (constructor) {
- var type = constructor.TYPE;
- if (!type) { throw new Error('Could not register ' + this.kind + ' constructor [no TYPE property]: ' + util.inspect(constructor)); }
- this.classMap[type] = constructor;
- this.abbreviations = null;
- },
-
- create: function (type, opts) {
- var allowAbbrev = this.allowAbbreviations,
- realType = allowAbbrev ? this.resolve(type) : type,
- Cons;
-
- Cons = realType ? this.classMap[realType] : null;
- if (!Cons) { throw new Error('Invalid ' + this.kind + ' [' + type + '], allowed values are ' + this.knownTypes().join(', ')); }
- return new Cons(opts);
- },
-
- loadStandard: function (dir) {
- var that = this;
- fs.readdirSync(dir).forEach(function (file) {
- if (file !== 'index.js' && file.indexOf('.js') === file.length - 3) {
- try {
- that.register(require(path.resolve(dir, file)));
- } catch (ex) {
- console.error(ex.message);
- console.error(ex.stack);
- throw new Error('Could not register ' + that.kind + ' from file ' + file);
- }
- }
- });
- },
-
- bindClassMethods: function (Cons) {
- var tmpKind = this.kind.charAt(0).toUpperCase() + this.kind.substring(1), //ucfirst
- allowAbbrev = this.allowAbbreviations;
-
- Cons.mix = Factory.mix;
- Cons.register = this.register.bind(this);
- Cons.create = this.create.bind(this);
- Cons.loadAll = this.loadStandard.bind(this, this.dir);
- Cons['get' + tmpKind + 'List'] = this.knownTypes.bind(this);
- if (allowAbbrev) {
- Cons['resolve' + tmpKind + 'Name'] = this.resolve.bind(this);
- }
- }
-};
-
-Factory.mix = function (cons, proto) {
- Object.keys(proto).forEach(function (key) {
- cons.prototype[key] = proto[key];
- });
-};
-
-module.exports = Factory;
-
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/file-matcher.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/file-matcher.js
deleted file mode 100644
index 986064252..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/file-matcher.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-var async = require('async'),
- glob = require('glob'),
- fs = require('fs'),
- path = require('path'),
- seq = 0;
-
-function filesFor(options, callback) {
- if (!callback && typeof options === 'function') {
- callback = options;
- options = null;
- }
- options = options || {};
-
- var root = options.root,
- includes = options.includes,
- excludes = options.excludes,
- realpath = options.realpath,
- relative = options.relative,
- opts;
-
- root = root || process.cwd();
- includes = includes && Array.isArray(includes) ? includes : [ '**/*.js' ];
- excludes = excludes && Array.isArray(excludes) ? excludes : [ '**/node_modules/**' ];
-
- opts = { cwd: root, nodir: true, ignore: excludes };
- seq += 1;
- opts['x' + seq + new Date().getTime()] = true; //cache buster for minimatch cache bug
- glob(includes.join(' '), opts, function (err, files) {
- if (err) { return callback(err); }
- if (relative) { return callback(err, files); }
-
- if (!realpath) {
- files = files.map(function (file) { return path.resolve(root, file); });
- return callback(err, files);
- }
-
- var realPathCache = module.constructor._realpathCache || {};
-
- async.map(files, function (file, done) {
- fs.realpath(path.resolve(root, file), realPathCache, done);
- }, callback);
- });
-}
-
-function matcherFor(options, callback) {
-
- if (!callback && typeof options === 'function') {
- callback = options;
- options = null;
- }
- options = options || {};
- options.relative = false; //force absolute paths
- options.realpath = true; //force real paths (to match Node.js module paths)
-
- filesFor(options, function (err, files) {
- var fileMap = {},
- matchFn;
- if (err) { return callback(err); }
- files.forEach(function (file) { fileMap[file] = true; });
-
- matchFn = function (file) { return fileMap[file]; };
- matchFn.files = Object.keys(fileMap);
- return callback(null, matchFn);
- });
-}
-
-module.exports = {
- filesFor: filesFor,
- matcherFor: matcherFor
-};
-
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/file-writer.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/file-writer.js
deleted file mode 100644
index 3367dcc83..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/file-writer.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-var path = require('path'),
- util = require('util'),
- fs = require('fs'),
- async = require('async'),
- mkdirp = require('mkdirp'),
- writer = require('./writer'),
- Writer = writer.Writer,
- ContentWriter = writer.ContentWriter;
-
-function extend(cons, proto) {
- Object.keys(proto).forEach(function (k) {
- cons.prototype[k] = proto[k];
- });
-}
-
-function BufferedContentWriter() {
- ContentWriter.call(this);
- this.content = '';
-}
-util.inherits(BufferedContentWriter, ContentWriter);
-
-extend(BufferedContentWriter, {
- write: function (str) {
- this.content += str;
- },
- getContent: function () {
- return this.content;
- }
-});
-
-function StreamContentWriter(stream) {
- ContentWriter.call(this);
- this.stream = stream;
-}
-util.inherits(StreamContentWriter, ContentWriter);
-
-extend(StreamContentWriter, {
- write: function (str) {
- this.stream.write(str);
- }
-});
-
-function SyncFileWriter() {
- Writer.call(this);
-}
-util.inherits(SyncFileWriter, Writer);
-
-extend(SyncFileWriter, {
- writeFile: function (file, callback) {
- mkdirp.sync(path.dirname(file));
- var cw = new BufferedContentWriter();
- callback(cw);
- fs.writeFileSync(file, cw.getContent(), 'utf8');
- },
- done: function () {
- this.emit('done'); //everything already done
- }
-});
-
-function AsyncFileWriter() {
- this.queue = async.queue(this.processFile.bind(this), 20);
- this.openFileMap = {};
-}
-
-util.inherits(AsyncFileWriter, Writer);
-
-extend(AsyncFileWriter, {
- writeFile: function (file, callback) {
- this.openFileMap[file] = true;
- this.queue.push({ file: file, callback: callback });
- },
- processFile: function (task, cb) {
- var file = task.file,
- userCallback = task.callback,
- that = this,
- stream,
- contentWriter;
-
- mkdirp.sync(path.dirname(file));
- stream = fs.createWriteStream(file);
- stream.on('close', function () {
- delete that.openFileMap[file];
- cb();
- that.checkDone();
- });
- stream.on('error', function (err) { that.emit('error', err); });
- contentWriter = new StreamContentWriter(stream);
- userCallback(contentWriter);
- stream.end();
- },
- done: function () {
- this.doneCalled = true;
- this.checkDone();
- },
- checkDone: function () {
- if (!this.doneCalled) { return; }
- if (Object.keys(this.openFileMap).length === 0) {
- this.emit('done');
- }
- }
-});
-/**
- * a concrete writer implementation that can write files synchronously or
- * asynchronously based on the constructor argument passed to it.
- *
- * Usage
- * -----
- *
- * var sync = true,
- * fileWriter = new require('istanbul').FileWriter(sync);
- *
- * fileWriter.on('done', function () { console.log('done'); });
- * fileWriter.copyFile('/foo/bar.jpg', '/baz/bar.jpg');
- * fileWriter.writeFile('/foo/index.html', function (contentWriter) {
- * contentWriter.println('');
- * contentWriter.println('');
- * });
- * fileWriter.done(); // will emit the `done` event when all files are written
- *
- * @class FileWriter
- * @extends Writer
- * @module io
- * @param sync
- * @constructor
- */
-function FileWriter(sync) {
- Writer.call(this);
- var that = this;
- this.delegate = sync ? new SyncFileWriter() : new AsyncFileWriter();
- this.delegate.on('error', function (err) { that.emit('error', err); });
- this.delegate.on('done', function () { that.emit('done'); });
-}
-
-util.inherits(FileWriter, Writer);
-
-extend(FileWriter, {
- copyFile: function (source, dest) {
- mkdirp.sync(path.dirname(dest));
- fs.writeFileSync(dest, fs.readFileSync(source));
- },
- writeFile: function (file, callback) {
- this.delegate.writeFile(file, callback);
- },
- done: function () {
- this.delegate.done();
- }
-});
-
-module.exports = FileWriter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/help-formatter.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/help-formatter.js
deleted file mode 100644
index 8d9136acf..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/help-formatter.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-var OPT_PREFIX = " ",
- OPT_START = OPT_PREFIX.length,
- TEXT_START = 14,
- STOP = 80,
- wrap = require('wordwrap')(TEXT_START, STOP),
- paraWrap = require('wordwrap')(1, STOP);
-
-function formatPara(text) {
- return paraWrap(text);
-}
-
-function formatOption(option, helpText) {
- var formattedText = wrap(helpText);
-
- if (option.length > TEXT_START - OPT_START - 2) {
- return OPT_PREFIX + option + '\n' + formattedText;
- } else {
- return OPT_PREFIX + option + formattedText.substring((OPT_PREFIX + option).length);
- }
-}
-
-module.exports = {
- formatPara: formatPara,
- formatOption: formatOption
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/input-error.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/input-error.js
deleted file mode 100644
index 488b71a0d..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/input-error.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-module.exports.create = function (message) {
- var err = new Error(message);
- err.inputError = true;
- return err;
-};
-
-
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/insertion-text.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/insertion-text.js
deleted file mode 100644
index d257643f2..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/insertion-text.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-function InsertionText(text, consumeBlanks) {
- this.text = text;
- this.origLength = text.length;
- this.offsets = [];
- this.consumeBlanks = consumeBlanks;
- this.startPos = this.findFirstNonBlank();
- this.endPos = this.findLastNonBlank();
-}
-
-var WHITE_RE = /[ \f\n\r\t\v\u00A0\u2028\u2029]/;
-
-InsertionText.prototype = {
-
- findFirstNonBlank: function () {
- var pos = -1,
- text = this.text,
- len = text.length,
- i;
- for (i = 0; i < len; i += 1) {
- if (!text.charAt(i).match(WHITE_RE)) {
- pos = i;
- break;
- }
- }
- return pos;
- },
- findLastNonBlank: function () {
- var text = this.text,
- len = text.length,
- pos = text.length + 1,
- i;
- for (i = len - 1; i >= 0; i -= 1) {
- if (!text.charAt(i).match(WHITE_RE)) {
- pos = i;
- break;
- }
- }
- return pos;
- },
- originalLength: function () {
- return this.origLength;
- },
-
- insertAt: function (col, str, insertBefore, consumeBlanks) {
- consumeBlanks = typeof consumeBlanks === 'undefined' ? this.consumeBlanks : consumeBlanks;
- col = col > this.originalLength() ? this.originalLength() : col;
- col = col < 0 ? 0 : col;
-
- if (consumeBlanks) {
- if (col <= this.startPos) {
- col = 0;
- }
- if (col > this.endPos) {
- col = this.origLength;
- }
- }
-
- var len = str.length,
- offset = this.findOffset(col, len, insertBefore),
- realPos = col + offset,
- text = this.text;
- this.text = text.substring(0, realPos) + str + text.substring(realPos);
- return this;
- },
-
- findOffset: function (pos, len, insertBefore) {
- var offsets = this.offsets,
- offsetObj,
- cumulativeOffset = 0,
- i;
-
- for (i = 0; i < offsets.length; i += 1) {
- offsetObj = offsets[i];
- if (offsetObj.pos < pos || (offsetObj.pos === pos && !insertBefore)) {
- cumulativeOffset += offsetObj.len;
- }
- if (offsetObj.pos >= pos) {
- break;
- }
- }
- if (offsetObj && offsetObj.pos === pos) {
- offsetObj.len += len;
- } else {
- offsets.splice(i, 0, { pos: pos, len: len });
- }
- return cumulativeOffset;
- },
-
- wrap: function (startPos, startText, endPos, endText, consumeBlanks) {
- this.insertAt(startPos, startText, true, consumeBlanks);
- this.insertAt(endPos, endText, false, consumeBlanks);
- return this;
- },
-
- wrapLine: function (startText, endText) {
- this.wrap(0, startText, this.originalLength(), endText);
- },
-
- toString: function () {
- return this.text;
- }
-};
-
-module.exports = InsertionText;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/meta.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/meta.js
deleted file mode 100644
index 0384459b5..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/meta.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-var path = require('path'),
- fs = require('fs'),
- pkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, '..', '..', 'package.json'), 'utf8'));
-
-module.exports = {
- NAME: pkg.name,
- VERSION: pkg.version
-};
-
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/tree-summarizer.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/tree-summarizer.js
deleted file mode 100644
index df350f50e..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/tree-summarizer.js
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-var path = require('path'),
- SEP = path.sep || '/',
- utils = require('../object-utils');
-
-function commonArrayPrefix(first, second) {
- var len = first.length < second.length ? first.length : second.length,
- i,
- ret = [];
- for (i = 0; i < len; i += 1) {
- if (first[i] === second[i]) {
- ret.push(first[i]);
- } else {
- break;
- }
- }
- return ret;
-}
-
-function findCommonArrayPrefix(args) {
- if (args.length === 0) {
- return [];
- }
-
- var separated = args.map(function (arg) { return arg.split(SEP); }),
- ret = separated.pop();
-
- if (separated.length === 0) {
- return ret.slice(0, ret.length - 1);
- } else {
- return separated.reduce(commonArrayPrefix, ret);
- }
-}
-
-function Node(fullName, kind, metrics) {
- this.name = fullName;
- this.fullName = fullName;
- this.kind = kind;
- this.metrics = metrics || null;
- this.parent = null;
- this.children = [];
-}
-
-Node.prototype = {
- displayShortName: function () {
- return this.relativeName;
- },
- fullPath: function () {
- return this.fullName;
- },
- addChild: function (child) {
- this.children.push(child);
- child.parent = this;
- },
- toJSON: function () {
- return {
- name: this.name,
- relativeName: this.relativeName,
- fullName: this.fullName,
- kind: this.kind,
- metrics: this.metrics,
- parent: this.parent === null ? null : this.parent.name,
- children: this.children.map(function (node) { return node.toJSON(); })
- };
- }
-};
-
-function TreeSummary(summaryMap, commonPrefix) {
- this.prefix = commonPrefix;
- this.convertToTree(summaryMap, commonPrefix);
-}
-
-TreeSummary.prototype = {
- getNode: function (shortName) {
- return this.map[shortName];
- },
- convertToTree: function (summaryMap, arrayPrefix) {
- var nodes = [],
- rootPath = arrayPrefix.join(SEP) + SEP,
- root = new Node(rootPath, 'dir'),
- tmp,
- tmpChildren,
- seen = {},
- filesUnderRoot = false;
-
- seen[rootPath] = root;
- Object.keys(summaryMap).forEach(function (key) {
- var metrics = summaryMap[key],
- node,
- parentPath,
- parent;
- node = new Node(key, 'file', metrics);
- seen[key] = node;
- nodes.push(node);
- parentPath = path.dirname(key) + SEP;
- if (parentPath === SEP + SEP || parentPath === '.' + SEP) {
- parentPath = SEP + '__root__' + SEP;
- }
- parent = seen[parentPath];
- if (!parent) {
- parent = new Node(parentPath, 'dir');
- root.addChild(parent);
- seen[parentPath] = parent;
- }
- parent.addChild(node);
- if (parent === root) { filesUnderRoot = true; }
- });
-
- if (filesUnderRoot && arrayPrefix.length > 0) {
- arrayPrefix.pop(); //start at one level above
- tmp = root;
- tmpChildren = tmp.children;
- tmp.children = [];
- root = new Node(arrayPrefix.join(SEP) + SEP, 'dir');
- root.addChild(tmp);
- tmpChildren.forEach(function (child) {
- if (child.kind === 'dir') {
- root.addChild(child);
- } else {
- tmp.addChild(child);
- }
- });
- }
- this.fixupNodes(root, arrayPrefix.join(SEP) + SEP);
- this.calculateMetrics(root);
- this.root = root;
- this.map = {};
- this.indexAndSortTree(root, this.map);
- },
-
- fixupNodes: function (node, prefix, parent) {
- var that = this;
- if (node.name.indexOf(prefix) === 0) {
- node.name = node.name.substring(prefix.length);
- }
- if (node.name.charAt(0) === SEP) {
- node.name = node.name.substring(1);
- }
- if (parent) {
- if (parent.name !== '__root__' + SEP) {
- node.relativeName = node.name.substring(parent.name.length);
- } else {
- node.relativeName = node.name;
- }
- } else {
- node.relativeName = node.name.substring(prefix.length);
- }
- node.children.forEach(function (child) {
- that.fixupNodes(child, prefix, node);
- });
- },
- calculateMetrics: function (entry) {
- var that = this,
- fileChildren;
- if (entry.kind !== 'dir') {return; }
- entry.children.forEach(function (child) {
- that.calculateMetrics(child);
- });
- entry.metrics = utils.mergeSummaryObjects.apply(
- null,
- entry.children.map(function (child) { return child.metrics; })
- );
- // calclulate "java-style" package metrics where there is no hierarchy
- // across packages
- fileChildren = entry.children.filter(function (n) { return n.kind !== 'dir'; });
- if (fileChildren.length > 0) {
- entry.packageMetrics = utils.mergeSummaryObjects.apply(
- null,
- fileChildren.map(function (child) { return child.metrics; })
- );
- } else {
- entry.packageMetrics = null;
- }
- },
- indexAndSortTree: function (node, map) {
- var that = this;
- map[node.name] = node;
- node.children.sort(function (a, b) {
- a = a.relativeName;
- b = b.relativeName;
- return a < b ? -1 : a > b ? 1 : 0;
- });
- node.children.forEach(function (child) {
- that.indexAndSortTree(child, map);
- });
- },
- toJSON: function () {
- return {
- prefix: this.prefix,
- root: this.root.toJSON()
- };
- }
-};
-
-function TreeSummarizer() {
- this.summaryMap = {};
-}
-
-TreeSummarizer.prototype = {
- addFileCoverageSummary: function (filePath, metrics) {
- this.summaryMap[filePath] = metrics;
- },
- getTreeSummary: function () {
- var commonArrayPrefix = findCommonArrayPrefix(Object.keys(this.summaryMap));
- return new TreeSummary(this.summaryMap, commonArrayPrefix);
- }
-};
-
-module.exports = TreeSummarizer;
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/writer.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/writer.js
deleted file mode 100644
index f5e68293c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/writer.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-var util = require('util'),
- EventEmitter = require('events').EventEmitter;
-
-function extend(cons, proto) {
- Object.keys(proto).forEach(function (k) {
- cons.prototype[k] = proto[k];
- });
-}
-
-/**
- * abstract interfaces for writing content
- * @class ContentWriter
- * @module io
- * @main io
- * @constructor
- */
-//abstract interface for writing content
-function ContentWriter() {
-}
-
-ContentWriter.prototype = {
- /**
- * writes the specified string as-is
- * @method write
- * @param {String} str the string to write
- */
- write: /* istanbul ignore next: abstract method */ function (/* str */) {
- throw new Error('write: must be overridden');
- },
- /**
- * writes the specified string with a newline at the end
- * @method println
- * @param {String} str the string to write
- */
- println: function (str) { this.write(str + '\n'); }
-};
-
-/**
- * abstract interface for writing files and assets. The caller is expected to
- * call `done` on the writer after it has finished writing all the required
- * files. The writer is an event-emitter that emits a `done` event when `done`
- * is called on it *and* all files have successfully been written.
- *
- * @class Writer
- * @constructor
- */
-function Writer() {
- EventEmitter.call(this);
-}
-
-util.inherits(Writer, EventEmitter);
-
-extend(Writer, {
- /**
- * allows writing content to a file using a callback that is passed a content writer
- * @method writeFile
- * @param {String} file the name of the file to write
- * @param {Function} callback the callback that is called as `callback(contentWriter)`
- */
- writeFile: /* istanbul ignore next: abstract method */ function (/* file, callback */) {
- throw new Error('writeFile: must be overridden');
- },
- /**
- * copies a file from source to destination
- * @method copyFile
- * @param {String} source the file to copy, found on the file system
- * @param {String} dest the destination path
- */
- copyFile: /* istanbul ignore next: abstract method */ function (/* source, dest */) {
- throw new Error('copyFile: must be overridden');
- },
- /**
- * marker method to indicate that the caller is done with this writer object
- * The writer is expected to emit a `done` event only after this method is called
- * and it is truly done.
- * @method done
- */
- done: /* istanbul ignore next: abstract method */ function () {
- throw new Error('done: must be overridden');
- }
-});
-
-module.exports = {
- Writer: Writer,
- ContentWriter: ContentWriter
-};
-
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/yui-load-hook.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/yui-load-hook.js
deleted file mode 100644
index 9b1365d7a..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/lib/util/yui-load-hook.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-//EXPERIMENTAL code: do not rely on this in anyway until the docs say it is allowed
-
-var path = require('path'),
- yuiRegexp = /yui-nodejs\.js$/;
-
-module.exports = function (matchFn, transformFn, verbose) {
- return function (file) {
- if (!file.match(yuiRegexp)) {
- return;
- }
- var YMain = require(file),
- YUI,
- loaderFn,
- origGet;
-
- if (YMain.YUI) {
- YUI = YMain.YUI;
- loaderFn = YUI.Env && YUI.Env.mods && YUI.Env.mods['loader-base'] ? YUI.Env.mods['loader-base'].fn : null;
- if (!loaderFn) { return; }
- if (verbose) { console.log('Applying YUI load post-hook'); }
- YUI.Env.mods['loader-base'].fn = function (Y) {
- loaderFn.call(null, Y);
- origGet = Y.Get._exec;
- Y.Get._exec = function (data, url, cb) {
- if (matchFn(url) || matchFn(path.resolve(url))) { //allow for relative paths as well
- if (verbose) {
- console.log('Transforming [' + url + ']');
- }
- try {
- data = transformFn(data, url);
- } catch (ex) {
- console.error('Error transforming: ' + url + ' return original code');
- console.error(ex.message || ex);
- if (ex.stack) { console.error(ex.stack); }
- }
- }
- return origGet.call(Y, data, url, cb);
- };
- return Y;
- };
- }
- };
-};
-
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/browser.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/browser.js
deleted file mode 100644
index ae7c87b17..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/browser.js
+++ /dev/null
@@ -1,2 +0,0 @@
-'use strict';
-module.exports = false;
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/index.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/index.js
deleted file mode 100644
index 113040d63..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/index.js
+++ /dev/null
@@ -1,72 +0,0 @@
-'use strict';
-var hasFlag = require('has-flag');
-
-var support = function (level) {
- if (level === 0) {
- return false;
- }
-
- return {
- level: level,
- hasBasic: true,
- has256: level >= 2,
- has16m: level >= 3
- };
-};
-
-var supportLevel = (function () {
- if (hasFlag('no-color') ||
- hasFlag('no-colors') ||
- hasFlag('color=false')) {
- return 0;
- }
-
- if (hasFlag('color=16m') ||
- hasFlag('color=full') ||
- hasFlag('color=truecolor')) {
- return 3;
- }
-
- if (hasFlag('color=256')) {
- return 2;
- }
-
- if (hasFlag('color') ||
- hasFlag('colors') ||
- hasFlag('color=true') ||
- hasFlag('color=always')) {
- return 1;
- }
-
- if (process.stdout && !process.stdout.isTTY) {
- return 0;
- }
-
- if (process.platform === 'win32') {
- return 1;
- }
-
- if ('COLORTERM' in process.env) {
- return 1;
- }
-
- if (process.env.TERM === 'dumb') {
- return 0;
- }
-
- if (/^xterm-256(?:color)?/.test(process.env.TERM)) {
- return 2;
- }
-
- if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) {
- return 1;
- }
-
- return 0;
-})();
-
-if (supportLevel === 0 && 'FORCE_COLOR' in process.env) {
- supportLevel = 1;
-}
-
-module.exports = process && support(supportLevel);
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/license b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/license
deleted file mode 100644
index 654d0bfe9..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/license
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus
(sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/package.json b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/package.json
deleted file mode 100644
index 26d1fc165..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/package.json
+++ /dev/null
@@ -1,122 +0,0 @@
-{
- "_args": [
- [
- "supports-color@^3.1.2",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/istanbul-lib-report"
- ],
- [
- "supports-color@^3.1.0",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/istanbul"
- ]
- ],
- "_from": "supports-color@>=3.1.0 <4.0.0",
- "_id": "supports-color@3.1.2",
- "_inCache": true,
- "_installable": true,
- "_location": "/istanbul/supports-color",
- "_nodeVersion": "4.1.1",
- "_npmUser": {
- "email": "sindresorhus@gmail.com",
- "name": "sindresorhus"
- },
- "_npmVersion": "2.14.4",
- "_phantomChildren": {},
- "_requested": {
- "name": "supports-color",
- "raw": "supports-color@^3.1.0",
- "rawSpec": "^3.1.0",
- "scope": null,
- "spec": ">=3.1.0 <4.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/istanbul"
- ],
- "_shrinkwrap": null,
- "_spec": "supports-color@^3.1.0",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/istanbul",
- "author": {
- "email": "sindresorhus@gmail.com",
- "name": "Sindre Sorhus",
- "url": "sindresorhus.com"
- },
- "browser": "browser.js",
- "bugs": {
- "url": "https://github.com/chalk/supports-color/issues"
- },
- "dependencies": {
- "has-flag": "^1.0.0"
- },
- "description": "Detect whether a terminal supports color",
- "devDependencies": {
- "mocha": "*",
- "require-uncached": "^1.0.2",
- "xo": "*"
- },
- "directories": {},
- "dist": {
- "shasum": "72a262894d9d408b956ca05ff37b2ed8a6e2a2d5",
- "tarball": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz"
- },
- "engines": {
- "node": ">=0.8.0"
- },
- "files": [
- "index.js",
- "browser.js"
- ],
- "gitHead": "d9e363732f48ad2bc6b936357246b55e136aa989",
- "homepage": "https://github.com/chalk/supports-color",
- "keywords": [
- "color",
- "colour",
- "colors",
- "terminal",
- "console",
- "cli",
- "ansi",
- "styles",
- "tty",
- "rgb",
- "256",
- "shell",
- "xterm",
- "command-line",
- "support",
- "supports",
- "capability",
- "detect",
- "truecolor",
- "16m",
- "million"
- ],
- "license": "MIT",
- "maintainers": [
- {
- "email": "sindresorhus@gmail.com",
- "name": "sindresorhus"
- },
- {
- "email": "jappelman@xebia.com",
- "name": "jbnicolai"
- }
- ],
- "name": "supports-color",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/chalk/supports-color.git"
- },
- "scripts": {
- "test": "xo && mocha",
- "travis": "mocha"
- },
- "version": "3.1.2",
- "xo": {
- "envs": [
- "node",
- "mocha"
- ]
- }
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/readme.md b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/readme.md
deleted file mode 100644
index f7bae4c54..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/supports-color/readme.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# supports-color [](https://travis-ci.org/chalk/supports-color)
-
-> Detect whether a terminal supports color
-
-
-## Install
-
-```
-$ npm install --save supports-color
-```
-
-
-## Usage
-
-```js
-var supportsColor = require('supports-color');
-
-if (supportsColor) {
- console.log('Terminal supports color');
-}
-
-if (supportsColor.has256) {
- console.log('Terminal supports 256 colors');
-}
-
-if (supportsColor.has16m) {
- console.log('Terminal supports 16 million colors (truecolor)');
-}
-```
-
-
-## API
-
-Returns an `object`, or `false` if color is not supported.
-
-The returned object specifies a level of support for color through a `.level` property and a corresponding flag:
-
-- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors)
-- `.level = 2` and `.has256 = true`: 256 color support
-- `.level = 3` and `.has16m = true`: 16 million (truecolor) support
-
-
-## Info
-
-It obeys the `--color` and `--no-color` CLI flags.
-
-For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`.
-
-Explicit 256/truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
-
-
-## Related
-
-- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
-- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
-
-
-## License
-
-MIT © [Sindre Sorhus](http://sindresorhus.com)
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/LICENSE b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/LICENSE
deleted file mode 100644
index ee27ba4b4..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/LICENSE
+++ /dev/null
@@ -1,18 +0,0 @@
-This software is released under the MIT license:
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/README.markdown b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/README.markdown
deleted file mode 100644
index 346374e0d..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/README.markdown
+++ /dev/null
@@ -1,70 +0,0 @@
-wordwrap
-========
-
-Wrap your words.
-
-example
-=======
-
-made out of meat
-----------------
-
-meat.js
-
- var wrap = require('wordwrap')(15);
- console.log(wrap('You and your whole family are made out of meat.'));
-
-output:
-
- You and your
- whole family
- are made out
- of meat.
-
-centered
---------
-
-center.js
-
- var wrap = require('wordwrap')(20, 60);
- console.log(wrap(
- 'At long last the struggle and tumult was over.'
- + ' The machines had finally cast off their oppressors'
- + ' and were finally free to roam the cosmos.'
- + '\n'
- + 'Free of purpose, free of obligation.'
- + ' Just drifting through emptiness.'
- + ' The sun was just another point of light.'
- ));
-
-output:
-
- At long last the struggle and tumult
- was over. The machines had finally cast
- off their oppressors and were finally
- free to roam the cosmos.
- Free of purpose, free of obligation.
- Just drifting through emptiness. The
- sun was just another point of light.
-
-methods
-=======
-
-var wrap = require('wordwrap');
-
-wrap(stop), wrap(start, stop, params={mode:"soft"})
----------------------------------------------------
-
-Returns a function that takes a string and returns a new string.
-
-Pad out lines with spaces out to column `start` and then wrap until column
-`stop`. If a word is longer than `stop - start` characters it will overflow.
-
-In "soft" mode, split chunks by `/(\S+\s+/` and don't break up chunks which are
-longer than `stop - start`, in "hard" mode, split chunks with `/\b/` and break
-up chunks longer than `stop - start`.
-
-wrap.hard(start, stop)
-----------------------
-
-Like `wrap()` but with `params.mode = "hard"`.
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/example/center.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/example/center.js
deleted file mode 100644
index a3fbaae98..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/example/center.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var wrap = require('wordwrap')(20, 60);
-console.log(wrap(
- 'At long last the struggle and tumult was over.'
- + ' The machines had finally cast off their oppressors'
- + ' and were finally free to roam the cosmos.'
- + '\n'
- + 'Free of purpose, free of obligation.'
- + ' Just drifting through emptiness.'
- + ' The sun was just another point of light.'
-));
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/example/meat.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/example/meat.js
deleted file mode 100644
index a4665e105..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/example/meat.js
+++ /dev/null
@@ -1,3 +0,0 @@
-var wrap = require('wordwrap')(15);
-
-console.log(wrap('You and your whole family are made out of meat.'));
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/index.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/index.js
deleted file mode 100644
index c9bc94521..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/index.js
+++ /dev/null
@@ -1,76 +0,0 @@
-var wordwrap = module.exports = function (start, stop, params) {
- if (typeof start === 'object') {
- params = start;
- start = params.start;
- stop = params.stop;
- }
-
- if (typeof stop === 'object') {
- params = stop;
- start = start || params.start;
- stop = undefined;
- }
-
- if (!stop) {
- stop = start;
- start = 0;
- }
-
- if (!params) params = {};
- var mode = params.mode || 'soft';
- var re = mode === 'hard' ? /\b/ : /(\S+\s+)/;
-
- return function (text) {
- var chunks = text.toString()
- .split(re)
- .reduce(function (acc, x) {
- if (mode === 'hard') {
- for (var i = 0; i < x.length; i += stop - start) {
- acc.push(x.slice(i, i + stop - start));
- }
- }
- else acc.push(x)
- return acc;
- }, [])
- ;
-
- return chunks.reduce(function (lines, rawChunk) {
- if (rawChunk === '') return lines;
-
- var chunk = rawChunk.replace(/\t/g, ' ');
-
- var i = lines.length - 1;
- if (lines[i].length + chunk.length > stop) {
- lines[i] = lines[i].replace(/\s+$/, '');
-
- chunk.split(/\n/).forEach(function (c) {
- lines.push(
- new Array(start + 1).join(' ')
- + c.replace(/^\s+/, '')
- );
- });
- }
- else if (chunk.match(/\n/)) {
- var xs = chunk.split(/\n/);
- lines[i] += xs.shift();
- xs.forEach(function (c) {
- lines.push(
- new Array(start + 1).join(' ')
- + c.replace(/^\s+/, '')
- );
- });
- }
- else {
- lines[i] += chunk;
- }
-
- return lines;
- }, [ new Array(start + 1).join(' ') ]).join('\n');
- };
-};
-
-wordwrap.soft = wordwrap;
-
-wordwrap.hard = function (start, stop) {
- return wordwrap(start, stop, { mode : 'hard' });
-};
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/package.json b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/package.json
deleted file mode 100644
index ac41a60a3..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/package.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "_args": [
- [
- "wordwrap@^1.0.0",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/istanbul"
- ]
- ],
- "_from": "wordwrap@>=1.0.0 <2.0.0",
- "_id": "wordwrap@1.0.0",
- "_inCache": true,
- "_installable": true,
- "_location": "/istanbul/wordwrap",
- "_nodeVersion": "2.0.0",
- "_npmUser": {
- "email": "substack@gmail.com",
- "name": "substack"
- },
- "_npmVersion": "2.9.0",
- "_phantomChildren": {},
- "_requested": {
- "name": "wordwrap",
- "raw": "wordwrap@^1.0.0",
- "rawSpec": "^1.0.0",
- "scope": null,
- "spec": ">=1.0.0 <2.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/istanbul"
- ],
- "_resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
- "_shasum": "27584810891456a4171c8d0226441ade90cbcaeb",
- "_shrinkwrap": null,
- "_spec": "wordwrap@^1.0.0",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/istanbul",
- "author": {
- "email": "mail@substack.net",
- "name": "James Halliday",
- "url": "http://substack.net"
- },
- "bugs": {
- "url": "https://github.com/substack/node-wordwrap/issues"
- },
- "dependencies": {},
- "description": "Wrap those words. Show them at what columns to start and stop.",
- "devDependencies": {
- "tape": "^4.0.0"
- },
- "directories": {
- "example": "example",
- "lib": ".",
- "test": "test"
- },
- "dist": {
- "shasum": "27584810891456a4171c8d0226441ade90cbcaeb",
- "tarball": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz"
- },
- "gitHead": "9f02667e901f2f10d87c33f7093fcf94788ab2f8",
- "homepage": "https://github.com/substack/node-wordwrap#readme",
- "keywords": [
- "word",
- "wrap",
- "rule",
- "format",
- "column"
- ],
- "license": "MIT",
- "main": "./index.js",
- "maintainers": [
- {
- "email": "mail@substack.net",
- "name": "substack"
- }
- ],
- "name": "wordwrap",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git://github.com/substack/node-wordwrap.git"
- },
- "scripts": {
- "test": "expresso"
- },
- "version": "1.0.0"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/test/break.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/test/break.js
deleted file mode 100644
index 7d0e8b54c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/test/break.js
+++ /dev/null
@@ -1,32 +0,0 @@
-var test = require('tape');
-var wordwrap = require('../');
-
-test('hard', function (t) {
- var s = 'Assert from {"type":"equal","ok":false,"found":1,"wanted":2,'
- + '"stack":[],"id":"b7ddcd4c409de8799542a74d1a04689b",'
- + '"browser":"chrome/6.0"}'
- ;
- var s_ = wordwrap.hard(80)(s);
-
- var lines = s_.split('\n');
- t.equal(lines.length, 2);
- t.ok(lines[0].length < 80);
- t.ok(lines[1].length < 80);
-
- t.equal(s, s_.replace(/\n/g, ''));
- t.end();
-});
-
-test('break', function (t) {
- var s = new Array(55+1).join('a');
- var s_ = wordwrap.hard(20)(s);
-
- var lines = s_.split('\n');
- t.equal(lines.length, 3);
- t.ok(lines[0].length === 20);
- t.ok(lines[1].length === 20);
- t.ok(lines[2].length === 15);
-
- t.equal(s, s_.replace(/\n/g, ''));
- t.end();
-});
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/test/idleness.txt b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/test/idleness.txt
deleted file mode 100644
index aa3f4907f..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/test/idleness.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-In Praise of Idleness
-
-By Bertrand Russell
-
-[1932]
-
-Like most of my generation, I was brought up on the saying: 'Satan finds some mischief for idle hands to do.' Being a highly virtuous child, I believed all that I was told, and acquired a conscience which has kept me working hard down to the present moment. But although my conscience has controlled my actions, my opinions have undergone a revolution. I think that there is far too much work done in the world, that immense harm is caused by the belief that work is virtuous, and that what needs to be preached in modern industrial countries is quite different from what always has been preached. Everyone knows the story of the traveler in Naples who saw twelve beggars lying in the sun (it was before the days of Mussolini), and offered a lira to the laziest of them. Eleven of them jumped up to claim it, so he gave it to the twelfth. this traveler was on the right lines. But in countries which do not enjoy Mediterranean sunshine idleness is more difficult, and a great public propaganda will be required to inaugurate it. I hope that, after reading the following pages, the leaders of the YMCA will start a campaign to induce good young men to do nothing. If so, I shall not have lived in vain.
-
-Before advancing my own arguments for laziness, I must dispose of one which I cannot accept. Whenever a person who already has enough to live on proposes to engage in some everyday kind of job, such as school-teaching or typing, he or she is told that such conduct takes the bread out of other people's mouths, and is therefore wicked. If this argument were valid, it would only be necessary for us all to be idle in order that we should all have our mouths full of bread. What people who say such things forget is that what a man earns he usually spends, and in spending he gives employment. As long as a man spends his income, he puts just as much bread into people's mouths in spending as he takes out of other people's mouths in earning. The real villain, from this point of view, is the man who saves. If he merely puts his savings in a stocking, like the proverbial French peasant, it is obvious that they do not give employment. If he invests his savings, the matter is less obvious, and different cases arise.
-
-One of the commonest things to do with savings is to lend them to some Government. In view of the fact that the bulk of the public expenditure of most civilized Governments consists in payment for past wars or preparation for future wars, the man who lends his money to a Government is in the same position as the bad men in Shakespeare who hire murderers. The net result of the man's economical habits is to increase the armed forces of the State to which he lends his savings. Obviously it would be better if he spent the money, even if he spent it in drink or gambling.
-
-But, I shall be told, the case is quite different when savings are invested in industrial enterprises. When such enterprises succeed, and produce something useful, this may be conceded. In these days, however, no one will deny that most enterprises fail. That means that a large amount of human labor, which might have been devoted to producing something that could be enjoyed, was expended on producing machines which, when produced, lay idle and did no good to anyone. The man who invests his savings in a concern that goes bankrupt is therefore injuring others as well as himself. If he spent his money, say, in giving parties for his friends, they (we may hope) would get pleasure, and so would all those upon whom he spent money, such as the butcher, the baker, and the bootlegger. But if he spends it (let us say) upon laying down rails for surface card in some place where surface cars turn out not to be wanted, he has diverted a mass of labor into channels where it gives pleasure to no one. Nevertheless, when he becomes poor through failure of his investment he will be regarded as a victim of undeserved misfortune, whereas the gay spendthrift, who has spent his money philanthropically, will be despised as a fool and a frivolous person.
-
-All this is only preliminary. I want to say, in all seriousness, that a great deal of harm is being done in the modern world by belief in the virtuousness of work, and that the road to happiness and prosperity lies in an organized diminution of work.
-
-First of all: what is work? Work is of two kinds: first, altering the position of matter at or near the earth's surface relatively to other such matter; second, telling other people to do so. The first kind is unpleasant and ill paid; the second is pleasant and highly paid. The second kind is capable of indefinite extension: there are not only those who give orders, but those who give advice as to what orders should be given. Usually two opposite kinds of advice are given simultaneously by two organized bodies of men; this is called politics. The skill required for this kind of work is not knowledge of the subjects as to which advice is given, but knowledge of the art of persuasive speaking and writing, i.e. of advertising.
-
-Throughout Europe, though not in America, there is a third class of men, more respected than either of the classes of workers. There are men who, through ownership of land, are able to make others pay for the privilege of being allowed to exist and to work. These landowners are idle, and I might therefore be expected to praise them. Unfortunately, their idleness is only rendered possible by the industry of others; indeed their desire for comfortable idleness is historically the source of the whole gospel of work. The last thing they have ever wished is that others should follow their example.
-
-From the beginning of civilization until the Industrial Revolution, a man could, as a rule, produce by hard work little more than was required for the subsistence of himself and his family, although his wife worked at least as hard as he did, and his children added their labor as soon as they were old enough to do so. The small surplus above bare necessaries was not left to those who produced it, but was appropriated by warriors and priests. In times of famine there was no surplus; the warriors and priests, however, still secured as much as at other times, with the result that many of the workers died of hunger. This system persisted in Russia until 1917 [1], and still persists in the East; in England, in spite of the Industrial Revolution, it remained in full force throughout the Napoleonic wars, and until a hundred years ago, when the new class of manufacturers acquired power. In America, the system came to an end with the Revolution, except in the South, where it persisted until the Civil War. A system which lasted so long and ended so recently has naturally left a profound impress upon men's thoughts and opinions. Much that we take for granted about the desirability of work is derived from this system, and, being pre-industrial, is not adapted to the modern world. Modern technique has made it possible for leisure, within limits, to be not the prerogative of small privileged classes, but a right evenly distributed throughout the community. The morality of work is the morality of slaves, and the modern world has no need of slavery.
-
-It is obvious that, in primitive communities, peasants, left to themselves, would not have parted with the slender surplus upon which the warriors and priests subsisted, but would have either produced less or consumed more. At first, sheer force compelled them to produce and part with the surplus. Gradually, however, it was found possible to induce many of them to accept an ethic according to which it was their duty to work hard, although part of their work went to support others in idleness. By this means the amount of compulsion required was lessened, and the expenses of government were diminished. To this day, 99 per cent of British wage-earners would be genuinely shocked if it were proposed that the King should not have a larger income than a working man. The conception of duty, speaking historically, has been a means used by the holders of power to induce others to live for the interests of their masters rather than for their own. Of course the holders of power conceal this fact from themselves by managing to believe that their interests are identical with the larger interests of humanity. Sometimes this is true; Athenian slave-owners, for instance, employed part of their leisure in making a permanent contribution to civilization which would have been impossible under a just economic system. Leisure is essential to civilization, and in former times leisure for the few was only rendered possible by the labors of the many. But their labors were valuable, not because work is good, but because leisure is good. And with modern technique it would be possible to distribute leisure justly without injury to civilization.
-
-Modern technique has made it possible to diminish enormously the amount of labor required to secure the necessaries of life for everyone. This was made obvious during the war. At that time all the men in the armed forces, and all the men and women engaged in the production of munitions, all the men and women engaged in spying, war propaganda, or Government offices connected with the war, were withdrawn from productive occupations. In spite of this, the general level of well-being among unskilled wage-earners on the side of the Allies was higher than before or since. The significance of this fact was concealed by finance: borrowing made it appear as if the future was nourishing the present. But that, of course, would have been impossible; a man cannot eat a loaf of bread that does not yet exist. The war showed conclusively that, by the scientific organization of production, it is possible to keep modern populations in fair comfort on a small part of the working capacity of the modern world. If, at the end of the war, the scientific organization, which had been created in order to liberate men for fighting and munition work, had been preserved, and the hours of the week had been cut down to four, all would have been well. Instead of that the old chaos was restored, those whose work was demanded were made to work long hours, and the rest were left to starve as unemployed. Why? Because work is a duty, and a man should not receive wages in proportion to what he has produced, but in proportion to his virtue as exemplified by his industry.
-
-This is the morality of the Slave State, applied in circumstances totally unlike those in which it arose. No wonder the result has been disastrous. Let us take an illustration. Suppose that, at a given moment, a certain number of people are engaged in the manufacture of pins. They make as many pins as the world needs, working (say) eight hours a day. Someone makes an invention by which the same number of men can make twice as many pins: pins are already so cheap that hardly any more will be bought at a lower price. In a sensible world, everybody concerned in the manufacturing of pins would take to working four hours instead of eight, and everything else would go on as before. But in the actual world this would be thought demoralizing. The men still work eight hours, there are too many pins, some employers go bankrupt, and half the men previously concerned in making pins are thrown out of work. There is, in the end, just as much leisure as on the other plan, but half the men are totally idle while half are still overworked. In this way, it is insured that the unavoidable leisure shall cause misery all round instead of being a universal source of happiness. Can anything more insane be imagined?
-
-The idea that the poor should have leisure has always been shocking to the rich. In England, in the early nineteenth century, fifteen hours was the ordinary day's work for a man; children sometimes did as much, and very commonly did twelve hours a day. When meddlesome busybodies suggested that perhaps these hours were rather long, they were told that work kept adults from drink and children from mischief. When I was a child, shortly after urban working men had acquired the vote, certain public holidays were established by law, to the great indignation of the upper classes. I remember hearing an old Duchess say: 'What do the poor want with holidays? They ought to work.' People nowadays are less frank, but the sentiment persists, and is the source of much of our economic confusion.
-
-Let us, for a moment, consider the ethics of work frankly, without superstition. Every human being, of necessity, consumes, in the course of his life, a certain amount of the produce of human labor. Assuming, as we may, that labor is on the whole disagreeable, it is unjust that a man should consume more than he produces. Of course he may provide services rather than commodities, like a medical man, for example; but he should provide something in return for his board and lodging. to this extent, the duty of work must be admitted, but to this extent only.
-
-I shall not dwell upon the fact that, in all modern societies outside the USSR, many people escape even this minimum amount of work, namely all those who inherit money and all those who marry money. I do not think the fact that these people are allowed to be idle is nearly so harmful as the fact that wage-earners are expected to overwork or starve.
-
-If the ordinary wage-earner worked four hours a day, there would be enough for everybody and no unemployment -- assuming a certain very moderate amount of sensible organization. This idea shocks the well-to-do, because they are convinced that the poor would not know how to use so much leisure. In America men often work long hours even when they are well off; such men, naturally, are indignant at the idea of leisure for wage-earners, except as the grim punishment of unemployment; in fact, they dislike leisure even for their sons. Oddly enough, while they wish their sons to work so hard as to have no time to be civilized, they do not mind their wives and daughters having no work at all. the snobbish admiration of uselessness, which, in an aristocratic society, extends to both sexes, is, under a plutocracy, confined to women; this, however, does not make it any more in agreement with common sense.
-
-The wise use of leisure, it must be conceded, is a product of civilization and education. A man who has worked long hours all his life will become bored if he becomes suddenly idle. But without a considerable amount of leisure a man is cut off from many of the best things. There is no longer any reason why the bulk of the population should suffer this deprivation; only a foolish asceticism, usually vicarious, makes us continue to insist on work in excessive quantities now that the need no longer exists.
-
-In the new creed which controls the government of Russia, while there is much that is very different from the traditional teaching of the West, there are some things that are quite unchanged. The attitude of the governing classes, and especially of those who conduct educational propaganda, on the subject of the dignity of labor, is almost exactly that which the governing classes of the world have always preached to what were called the 'honest poor'. Industry, sobriety, willingness to work long hours for distant advantages, even submissiveness to authority, all these reappear; moreover authority still represents the will of the Ruler of the Universe, Who, however, is now called by a new name, Dialectical Materialism.
-
-The victory of the proletariat in Russia has some points in common with the victory of the feminists in some other countries. For ages, men had conceded the superior saintliness of women, and had consoled women for their inferiority by maintaining that saintliness is more desirable than power. At last the feminists decided that they would have both, since the pioneers among them believed all that the men had told them about the desirability of virtue, but not what they had told them about the worthlessness of political power. A similar thing has happened in Russia as regards manual work. For ages, the rich and their sycophants have written in praise of 'honest toil', have praised the simple life, have professed a religion which teaches that the poor are much more likely to go to heaven than the rich, and in general have tried to make manual workers believe that there is some special nobility about altering the position of matter in space, just as men tried to make women believe that they derived some special nobility from their sexual enslavement. In Russia, all this teaching about the excellence of manual work has been taken seriously, with the result that the manual worker is more honored than anyone else. What are, in essence, revivalist appeals are made, but not for the old purposes: they are made to secure shock workers for special tasks. Manual work is the ideal which is held before the young, and is the basis of all ethical teaching.
-
-For the present, possibly, this is all to the good. A large country, full of natural resources, awaits development, and has has to be developed with very little use of credit. In these circumstances, hard work is necessary, and is likely to bring a great reward. But what will happen when the point has been reached where everybody could be comfortable without working long hours?
-
-In the West, we have various ways of dealing with this problem. We have no attempt at economic justice, so that a large proportion of the total produce goes to a small minority of the population, many of whom do no work at all. Owing to the absence of any central control over production, we produce hosts of things that are not wanted. We keep a large percentage of the working population idle, because we can dispense with their labor by making the others overwork. When all these methods prove inadequate, we have a war: we cause a number of people to manufacture high explosives, and a number of others to explode them, as if we were children who had just discovered fireworks. By a combination of all these devices we manage, though with difficulty, to keep alive the notion that a great deal of severe manual work must be the lot of the average man.
-
-In Russia, owing to more economic justice and central control over production, the problem will have to be differently solved. the rational solution would be, as soon as the necessaries and elementary comforts can be provided for all, to reduce the hours of labor gradually, allowing a popular vote to decide, at each stage, whether more leisure or more goods were to be preferred. But, having taught the supreme virtue of hard work, it is difficult to see how the authorities can aim at a paradise in which there will be much leisure and little work. It seems more likely that they will find continually fresh schemes, by which present leisure is to be sacrificed to future productivity. I read recently of an ingenious plan put forward by Russian engineers, for making the White Sea and the northern coasts of Siberia warm, by putting a dam across the Kara Sea. An admirable project, but liable to postpone proletarian comfort for a generation, while the nobility of toil is being displayed amid the ice-fields and snowstorms of the Arctic Ocean. This sort of thing, if it happens, will be the result of regarding the virtue of hard work as an end in itself, rather than as a means to a state of affairs in which it is no longer needed.
-
-The fact is that moving matter about, while a certain amount of it is necessary to our existence, is emphatically not one of the ends of human life. If it were, we should have to consider every navvy superior to Shakespeare. We have been misled in this matter by two causes. One is the necessity of keeping the poor contented, which has led the rich, for thousands of years, to preach the dignity of labor, while taking care themselves to remain undignified in this respect. The other is the new pleasure in mechanism, which makes us delight in the astonishingly clever changes that we can produce on the earth's surface. Neither of these motives makes any great appeal to the actual worker. If you ask him what he thinks the best part of his life, he is not likely to say: 'I enjoy manual work because it makes me feel that I am fulfilling man's noblest task, and because I like to think how much man can transform his planet. It is true that my body demands periods of rest, which I have to fill in as best I may, but I am never so happy as when the morning comes and I can return to the toil from which my contentment springs.' I have never heard working men say this sort of thing. They consider work, as it should be considered, a necessary means to a livelihood, and it is from their leisure that they derive whatever happiness they may enjoy.
-
-It will be said that, while a little leisure is pleasant, men would not know how to fill their days if they had only four hours of work out of the twenty-four. In so far as this is true in the modern world, it is a condemnation of our civilization; it would not have been true at any earlier period. There was formerly a capacity for light-heartedness and play which has been to some extent inhibited by the cult of efficiency. The modern man thinks that everything ought to be done for the sake of something else, and never for its own sake. Serious-minded persons, for example, are continually condemning the habit of going to the cinema, and telling us that it leads the young into crime. But all the work that goes to producing a cinema is respectable, because it is work, and because it brings a money profit. The notion that the desirable activities are those that bring a profit has made everything topsy-turvy. The butcher who provides you with meat and the baker who provides you with bread are praiseworthy, because they are making money; but when you enjoy the food they have provided, you are merely frivolous, unless you eat only to get strength for your work. Broadly speaking, it is held that getting money is good and spending money is bad. Seeing that they are two sides of one transaction, this is absurd; one might as well maintain that keys are good, but keyholes are bad. Whatever merit there may be in the production of goods must be entirely derivative from the advantage to be obtained by consuming them. The individual, in our society, works for profit; but the social purpose of his work lies in the consumption of what he produces. It is this divorce between the individual and the social purpose of production that makes it so difficult for men to think clearly in a world in which profit-making is the incentive to industry. We think too much of production, and too little of consumption. One result is that we attach too little importance to enjoyment and simple happiness, and that we do not judge production by the pleasure that it gives to the consumer.
-
-When I suggest that working hours should be reduced to four, I am not meaning to imply that all the remaining time should necessarily be spent in pure frivolity. I mean that four hours' work a day should entitle a man to the necessities and elementary comforts of life, and that the rest of his time should be his to use as he might see fit. It is an essential part of any such social system that education should be carried further than it usually is at present, and should aim, in part, at providing tastes which would enable a man to use leisure intelligently. I am not thinking mainly of the sort of things that would be considered 'highbrow'. Peasant dances have died out except in remote rural areas, but the impulses which caused them to be cultivated must still exist in human nature. The pleasures of urban populations have become mainly passive: seeing cinemas, watching football matches, listening to the radio, and so on. This results from the fact that their active energies are fully taken up with work; if they had more leisure, they would again enjoy pleasures in which they took an active part.
-
-In the past, there was a small leisure class and a larger working class. The leisure class enjoyed advantages for which there was no basis in social justice; this necessarily made it oppressive, limited its sympathies, and caused it to invent theories by which to justify its privileges. These facts greatly diminished its excellence, but in spite of this drawback it contributed nearly the whole of what we call civilization. It cultivated the arts and discovered the sciences; it wrote the books, invented the philosophies, and refined social relations. Even the liberation of the oppressed has usually been inaugurated from above. Without the leisure class, mankind would never have emerged from barbarism.
-
-The method of a leisure class without duties was, however, extraordinarily wasteful. None of the members of the class had to be taught to be industrious, and the class as a whole was not exceptionally intelligent. The class might produce one Darwin, but against him had to be set tens of thousands of country gentlemen who never thought of anything more intelligent than fox-hunting and punishing poachers. At present, the universities are supposed to provide, in a more systematic way, what the leisure class provided accidentally and as a by-product. This is a great improvement, but it has certain drawbacks. University life is so different from life in the world at large that men who live in academic milieu tend to be unaware of the preoccupations and problems of ordinary men and women; moreover their ways of expressing themselves are usually such as to rob their opinions of the influence that they ought to have upon the general public. Another disadvantage is that in universities studies are organized, and the man who thinks of some original line of research is likely to be discouraged. Academic institutions, therefore, useful as they are, are not adequate guardians of the interests of civilization in a world where everyone outside their walls is too busy for unutilitarian pursuits.
-
-In a world where no one is compelled to work more than four hours a day, every person possessed of scientific curiosity will be able to indulge it, and every painter will be able to paint without starving, however excellent his pictures may be. Young writers will not be obliged to draw attention to themselves by sensational pot-boilers, with a view to acquiring the economic independence needed for monumental works, for which, when the time at last comes, they will have lost the taste and capacity. Men who, in their professional work, have become interested in some phase of economics or government, will be able to develop their ideas without the academic detachment that makes the work of university economists often seem lacking in reality. Medical men will have the time to learn about the progress of medicine, teachers will not be exasperatedly struggling to teach by routine methods things which they learnt in their youth, which may, in the interval, have been proved to be untrue.
-
-Above all, there will be happiness and joy of life, instead of frayed nerves, weariness, and dyspepsia. The work exacted will be enough to make leisure delightful, but not enough to produce exhaustion. Since men will not be tired in their spare time, they will not demand only such amusements as are passive and vapid. At least one per cent will probably devote the time not spent in professional work to pursuits of some public importance, and, since they will not depend upon these pursuits for their livelihood, their originality will be unhampered, and there will be no need to conform to the standards set by elderly pundits. But it is not only in these exceptional cases that the advantages of leisure will appear. Ordinary men and women, having the opportunity of a happy life, will become more kindly and less persecuting and less inclined to view others with suspicion. The taste for war will die out, partly for this reason, and partly because it will involve long and severe work for all. Good nature is, of all moral qualities, the one that the world needs most, and good nature is the result of ease and security, not of a life of arduous struggle. Modern methods of production have given us the possibility of ease and security for all; we have chosen, instead, to have overwork for some and starvation for others. Hitherto we have continued to be as energetic as we were before there were machines; in this we have been foolish, but there is no reason to go on being foolish forever.
-
-[1] Since then, members of the Communist Party have succeeded to this privilege of the warriors and priests.
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/test/wrap.js b/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/test/wrap.js
deleted file mode 100644
index 01ea47185..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/node_modules/wordwrap/test/wrap.js
+++ /dev/null
@@ -1,33 +0,0 @@
-var test = require('tape');
-var wordwrap = require('../');
-
-var fs = require('fs');
-var idleness = fs.readFileSync(__dirname + '/idleness.txt', 'utf8');
-
-test('stop80', function (t) {
- var lines = wordwrap(80)(idleness).split(/\n/);
- var words = idleness.split(/\s+/);
-
- lines.forEach(function (line) {
- t.ok(line.length <= 80, 'line > 80 columns');
- var chunks = line.match(/\S/) ? line.split(/\s+/) : [];
- t.deepEqual(chunks, words.splice(0, chunks.length));
- });
- t.end();
-});
-
-test('start20stop60', function (t) {
- var lines = wordwrap(20, 100)(idleness).split(/\n/);
- var words = idleness.split(/\s+/);
-
- lines.forEach(function (line) {
- t.ok(line.length <= 100, 'line > 100 columns');
- var chunks = line
- .split(/\s+/)
- .filter(function (x) { return x.match(/\S/) })
- ;
- t.deepEqual(chunks, words.splice(0, chunks.length));
- t.deepEqual(line.slice(0, 20), new Array(20 + 1).join(' '));
- });
- t.end();
-});
diff --git a/fundamentals/bug-challenge-es6/node_modules/istanbul/package.json b/fundamentals/bug-challenge-es6/node_modules/istanbul/package.json
deleted file mode 100644
index c1ecbc439..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/istanbul/package.json
+++ /dev/null
@@ -1,400 +0,0 @@
-{
- "_args": [
- [
- "istanbul@^0.4.5",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest-config"
- ]
- ],
- "_from": "istanbul@>=0.4.5 <0.5.0",
- "_id": "istanbul@0.4.5",
- "_inCache": true,
- "_installable": true,
- "_location": "/istanbul",
- "_nodeVersion": "0.12.7",
- "_npmOperationalInternal": {
- "host": "packages-16-east.internal.npmjs.com",
- "tmp": "tmp/istanbul-0.4.5.tgz_1471809726773_0.4557724657934159"
- },
- "_npmUser": {
- "email": "kananthmail-github@yahoo.com",
- "name": "gotwarlost"
- },
- "_npmVersion": "2.11.3",
- "_phantomChildren": {
- "has-flag": "1.0.0"
- },
- "_requested": {
- "name": "istanbul",
- "raw": "istanbul@^0.4.5",
- "rawSpec": "^0.4.5",
- "scope": null,
- "spec": ">=0.4.5 <0.5.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-config"
- ],
- "_resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz",
- "_shasum": "65c7d73d4c4da84d4f3ac310b918fb0b8033733b",
- "_shrinkwrap": null,
- "_spec": "istanbul@^0.4.5",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest-config",
- "author": {
- "email": "kananthmail-github@yahoo.com",
- "name": "Krishnan Anantheswaran"
- },
- "bin": {
- "istanbul": "./lib/cli.js"
- },
- "bugs": {
- "url": "https://github.com/gotwarlost/istanbul/issues"
- },
- "contributors": [
- {
- "email": "me@reidburke.com",
- "name": "Reid Burke"
- },
- {
- "email": "mfncooper@gmail.com",
- "name": "Martin Cooper"
- },
- {
- "email": "davglass@gmail.com",
- "name": "Dav Glass"
- },
- {
- "email": "nowamasa@gmail.com",
- "name": "nowamasa"
- },
- {
- "email": "contact@millermedeiros.com",
- "name": "Miller Medeiros @millermedeiros"
- },
- {
- "email": "unindented@gmail.com",
- "name": "Daniel Perez Alvarez @unindented"
- },
- {
- "email": "mathias@qiwi.be",
- "name": "Mathias Bynens @mathiasbynens"
- },
- {
- "email": "nate@betable.com",
- "name": "Nathan Brown @nbrownus"
- },
- {
- "email": "bng412@gmail.com",
- "name": "Brian Ng @existentialism"
- },
- {
- "name": "John Morrison @jrgm"
- },
- {
- "email": "tomaz+github@tomaz.me",
- "name": "Tomaz Muraus @kami"
- },
- {
- "email": "jhansche@meetme.com",
- "name": "Joe @jhansche"
- },
- {
- "email": "vojta.jina@gmail.com",
- "name": "Vojta Jina @vojtajina"
- },
- {
- "email": "deadrunk@gmail.com",
- "name": "Dmitry Shirokov @runk"
- },
- {
- "name": "Chris Gladd @chrisgladd"
- },
- {
- "email": "peimei@ya.ru",
- "name": "Sergey Belov"
- },
- {
- "email": "pornel@pornel.net",
- "name": "porneL @pornel"
- },
- {
- "name": "@asifrc"
- },
- {
- "name": "Gergely Nemeth @gergelyke"
- },
- {
- "name": "@bixdeng"
- },
- {
- "name": "@mpderbec"
- },
- {
- "name": "@jxiaodev"
- },
- {
- "email": "arpad.borsos@googlemail.com",
- "name": "Arpad Borsos @Swatinem"
- },
- {
- "name": "Ariya Hidayat @ariya"
- },
- {
- "name": "@markyen"
- },
- {
- "email": "sam@samx.it",
- "name": "Sam Saccone @samccone"
- },
- {
- "name": "Jason Cheatham @jason0x43"
- },
- {
- "name": "@smikes"
- },
- {
- "email": "yasyfm@gmail.com",
- "name": "Yasyf Mohamedali @yasyf"
- },
- {
- "email": "piuccio@gmail.com",
- "name": "Fabio Crisci @piuccio"
- },
- {
- "email": "ryan@loose-bits.com",
- "name": "Ryan Roemer @ryan-roemer"
- },
- {
- "name": "Douglas Christopher Wilson @dougwilson"
- },
- {
- "email": "gustavnikolaj@gmail.com",
- "name": "Gustav Nikolaj @gustavnikolaj"
- },
- {
- "email": "denis@sokolov.cc",
- "name": "Denis Sokolov @denis-sokolov"
- },
- {
- "name": "Yann Mainier @ymainier"
- },
- {
- "email": "heyiyu.deadhorse@gmail.com",
- "name": "Yiyu He @dead-horse"
- },
- {
- "email": "superjoe30@gmail.com",
- "name": "Andrew Kelley @andrewrk"
- },
- {
- "email": "will@labranche.io",
- "name": "Will LaBranche @wlabranche"
- },
- {
- "email": "math.nao@outlook.com",
- "name": "Mathieu Naouache @math-nao"
- },
- {
- "name": "Ron Korving @ronkorving"
- },
- {
- "email": "rob.mcguiredale@gmail.com",
- "name": "Rob McGuire-Dale @robatron"
- },
- {
- "name": "Justin Johnson @booleangate"
- },
- {
- "email": "juangabreil@gmail.com",
- "name": "Juan Gabriel Jiménez @juangabreil"
- },
- {
- "email": "dsabelnikov@gmail.com",
- "name": "Daniel Sabelnikov @dragn"
- },
- {
- "email": "anthony.lukasavage@gmail.com",
- "name": "Tony Lukasavage @tonylukasavage"
- },
- {
- "name": "Simon Ramsay @nexus-uw"
- },
- {
- "name": "Dominykas Blyžė @dominykas"
- },
- {
- "name": "Seth Pollack @sethpollack"
- },
- {
- "email": "ben@npmjs.com",
- "name": "Benjamin E. Coe @bcoe"
- },
- {
- "email": "yurenju@gmail.com",
- "name": "Yuren Ju"
- },
- {
- "email": "alex-vee@yandex-team.ru",
- "name": "Aleksey Verkholantsev"
- },
- {
- "email": "ejsanders@gmail.com",
- "name": "Ed S"
- },
- {
- "email": "mordytk@gmail.com",
- "name": "Mordy Tikotzky"
- },
- {
- "email": "sakura9515@gmail.com",
- "name": "Haoliang Gao @popomore"
- },
- {
- "name": "Roderick Hsiao @roderickhsiao"
- },
- {
- "name": "Nikita Gusakov @nkt"
- },
- {
- "email": "alexanderdunphy@gmail.com",
- "name": "Alex Dunphy @alexdunphy"
- },
- {
- "email": "me@arty.name",
- "name": "Artemy Tregubenko @arty-name"
- },
- {
- "name": "Arye Lukashevski @aryelu"
- },
- {
- "name": "@sterlinghw"
- },
- {
- "email": "gord@bithound.io",
- "name": "Gord Tanner"
- },
- {
- "email": "tom@macwright.org",
- "name": "Tom MacWright @tmcw"
- },
- {
- "name": "Kitson Kelly @kitsonk"
- },
- {
- "name": "@asa-git"
- },
- {
- "name": "@RoCat"
- },
- {
- "email": "iphands@gmail.com",
- "name": "Ian Page Hands @iphands"
- },
- {
- "name": "Eddie Gurnee @pegurnee"
- },
- {
- "email": "kpdecker@gmail.com",
- "name": "Kevin Decker @kpdecker"
- },
- {
- "email": "i@izs.me",
- "name": "isaacs @isaacs"
- },
- {
- "name": "Steve Gray @steve-gray"
- },
- {
- "email": "prayag.verma@gmail.com",
- "name": "Prayag Verma @pra85"
- },
- {
- "email": "abe.fehr@gmail.com",
- "name": "Abe Fehr @abejfehr"
- },
- {
- "email": "brian.woodward@gmail.com",
- "name": "Brian Woodward @doowb"
- },
- {
- "name": "@Victorystick"
- },
- {
- "name": "@inversion"
- },
- {
- "name": "@JamesMGreene"
- },
- {
- "name": "@ChALkeR"
- },
- {
- "name": "@graingert"
- }
- ],
- "dependencies": {
- "abbrev": "1.0.x",
- "async": "1.x",
- "escodegen": "1.8.x",
- "esprima": "2.7.x",
- "glob": "^5.0.15",
- "handlebars": "^4.0.1",
- "js-yaml": "3.x",
- "mkdirp": "0.5.x",
- "nopt": "3.x",
- "once": "1.x",
- "resolve": "1.1.x",
- "supports-color": "^3.1.0",
- "which": "^1.1.1",
- "wordwrap": "^1.0.0"
- },
- "description": "Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests ",
- "devDependencies": {
- "coveralls": "2.x",
- "jshint": "^2.8.0",
- "nodeunit": "0.9.x",
- "requirejs": "2.x",
- "rimraf": "^2.4.3"
- },
- "directories": {},
- "dist": {
- "shasum": "65c7d73d4c4da84d4f3ac310b918fb0b8033733b",
- "tarball": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz"
- },
- "files": [
- "index.js",
- "lib/"
- ],
- "gitHead": "89e338fcb1c8a7dea3b9e8f851aa55de2bc3abee",
- "homepage": "https://github.com/gotwarlost/istanbul#readme",
- "keywords": [
- "coverage",
- "code coverage",
- "JS code coverage",
- "JS coverage"
- ],
- "license": "BSD-3-Clause",
- "maintainers": [
- {
- "email": "kananthmail-github@yahoo.com",
- "name": "gotwarlost"
- },
- {
- "email": "davglass@gmail.com",
- "name": "davglass"
- }
- ],
- "name": "istanbul",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git://github.com/gotwarlost/istanbul.git"
- },
- "scripts": {
- "docs": "npm install yuidocjs && node node_modules/yuidocjs/lib/cli.js .",
- "posttest": "node ./lib/cli.js check-coverage --statements 95 --branches 80",
- "pretest": "jshint index.js lib/ test/ && ./download-escodegen-browser.sh",
- "test": "node --harmony test/run.js"
- },
- "version": "0.4.5"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/README.md b/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/README.md
deleted file mode 100644
index bed7ebd44..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# jest-changed-files
-
-A module used internally by Jest to check which files have changed since you
-last committed in git or hg.
-
-## Install
-
-```sh
-$ npm install --save jest-changed-files
-```
-
-## API
-
-### `hg.isHGRepository(cwd: string): Promise`
-
-Get the root of the mercurial repository containing `cwd` or return `null` if
-`cwd` is not inside a mercurial repository.
-
-### `git.isGitRepository(cwd: string): Promise`
-
-Get the root of the git repository containing `cwd` or return `null` if
-`cwd` is not inside a git repository.
-
-### `hg.findChangedFiles / git.findChangedFiles (root: string): Promise>`
-
-Get the list of files in a git/mecurial repository that have changed since the
-last commit.
-
-## Usage
-
-```javascript
-import {git, hg} from 'jest-changed-files';
-
-function changedFiles(cwd) {
- return Promise.all([
- git.isGitRepository(cwd),
- hg.isHGRepository(cwd),
- ]).then(([gitRoot, hgRoot]) => {
- if (gitRoot !== null) {
- return git.findChangedFiles(gitRoot);
- } else if (hgRoot !== null) {
- return hg.findChangedFiles(hgRoot);
- } else {
- throw new Error('Not in a git or hg repo');
- }
- });
-}
-```
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/build/git.js b/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/build/git.js
deleted file mode 100644
index ad30d6ff3..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/build/git.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-const path = require('path');
-const childProcess = require('child_process');
-
-
-
-
-
-
-function findChangedFiles(cwd, options) {
- return new Promise((resolve, reject) => {
- const args = options.lastCommit ?
- ['show', '--name-only', '--pretty=%b', 'HEAD'] :
- ['ls-files', '--other', '--modified', '--exclude-standard'];
- const child = childProcess.spawn('git', args, { cwd });
- let stdout = '';
- let stderr = '';
- child.stdout.on('data', data => stdout += data);
- child.stderr.on('data', data => stderr += data);
- child.on('error', e => reject(e));
- child.on('close', code => {
- if (code === 0) {
- stdout = stdout.trim();
- if (stdout === '') {
- resolve([]);
- } else {
- resolve(stdout.split('\n').map(
- changedPath => path.resolve(cwd, changedPath)));
-
- }
- } else {
- reject(code + ': ' + stderr);
- }
- });
- });
-}
-
-function isGitRepository(cwd) {
- return new Promise(resolve => {
- try {
- let stdout = '';
- const options = ['rev-parse', '--show-toplevel'];
- const child = childProcess.spawn('git', options, { cwd });
- child.stdout.on('data', data => stdout += data);
- child.on('error', () => resolve(null));
- child.on('close', code => resolve(code === 0 ? stdout.trim() : null));
- } catch (e) {
- resolve(null);
- }
- });
-}
-
-module.exports = {
- findChangedFiles,
- isGitRepository };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/build/hg.js b/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/build/hg.js
deleted file mode 100644
index 097b9e525..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/build/hg.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-const path = require('path');
-const childProcess = require('child_process');
-
-const env = Object.assign({}, process.env, {
- HGPLAIN: 1 });
-
-
-
-
-
-
-
-function findChangedFiles(cwd, options) {
- return new Promise((resolve, reject) => {
- let args = ['status', '-amn'];
- if (options && options.withAncestor) {
- args.push('--rev', 'ancestor(.^)');
- } else if (options && options.lastCommit === true) {
- args = ['tip', '--template', '{files%"{file}\n"}'];
- }
- const child = childProcess.spawn('hg', args, { cwd, env });
- let stdout = '';
- let stderr = '';
- child.stdout.on('data', data => stdout += data);
- child.stderr.on('data', data => stderr += data);
- child.on('error', e => reject(e));
- child.on('close', code => {
- if (code === 0) {
- stdout = stdout.trim();
- if (stdout === '') {
- resolve([]);
- } else {
- resolve(stdout.split('\n').map(
- changedPath => path.resolve(cwd, changedPath)));
-
- }
- } else {
- reject(code + ': ' + stderr);
- }
- });
- });
-}
-
-function isHGRepository(cwd) {
- return new Promise(resolve => {
- try {
- let stdout = '';
- const child = childProcess.spawn('hg', ['root'], { cwd, env });
- child.stdout.on('data', data => stdout += data);
- child.on('error', () => resolve(null));
- child.on('close', code => resolve(code === 0 ? stdout.trim() : null));
- } catch (e) {
- resolve(null);
- }
- });
-}
-
-module.exports = {
- findChangedFiles,
- isHGRepository };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/build/index.js
deleted file mode 100644
index 0937a7f13..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/build/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
-'use strict';
-
-module.exports = {
- git: require('./git'),
- hg: require('./hg') };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/package.json
deleted file mode 100644
index 80e6eef50..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-changed-files/package.json
+++ /dev/null
@@ -1,83 +0,0 @@
-{
- "_args": [
- [
- "jest-changed-files@^17.0.2",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli"
- ]
- ],
- "_from": "jest-changed-files@>=17.0.2 <18.0.0",
- "_id": "jest-changed-files@17.0.2",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-changed-files",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-18-east.internal.npmjs.com",
- "tmp": "tmp/jest-changed-files-17.0.2.tgz_1479170359511_0.7218810119666159"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-changed-files",
- "raw": "jest-changed-files@^17.0.2",
- "rawSpec": "^17.0.2",
- "scope": null,
- "spec": ">=17.0.2 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest/jest-cli"
- ],
- "_resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-17.0.2.tgz",
- "_shasum": "f5657758736996f590a51b87e5c9369d904ba7b7",
- "_shrinkwrap": null,
- "_spec": "jest-changed-files@^17.0.2",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {},
- "description": "A module used internally by Jest to check which files have changed since you last committed in git or hg.",
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "f5657758736996f590a51b87e5c9369d904ba7b7",
- "tarball": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-17.0.2.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- }
- ],
- "name": "jest-changed-files",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.2"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-cli/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/bin/jest.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/bin/jest.js
deleted file mode 100755
index 63fe8d954..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/bin/jest.js
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env node
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
-'use strict';
-
-if (process.env.NODE_ENV == null) {
- process.env.NODE_ENV = 'test';
-}
-
-require('../build/cli').run();
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/SearchSource.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/SearchSource.js
deleted file mode 100644
index 7b983edce..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/SearchSource.js
+++ /dev/null
@@ -1,289 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();
-
-
-
-
-
-const DependencyResolver = require('jest-resolve-dependencies');
-
-const chalk = require('chalk');
-const changedFiles = require('jest-changed-files');
-const fileExists = require('jest-file-exists');
-const path = require('path');var _require =
-
-
-
-require('jest-util');const escapePathForRegex = _require.escapePathForRegex,replacePathSepForRegex = _require.replacePathSepForRegex;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-const git = changedFiles.git;
-const hg = changedFiles.hg;
-
-const determineSCM = path => Promise.all([
-git.isGitRepository(path),
-hg.isHGRepository(path)]);
-
-const pathToRegex = p => replacePathSepForRegex(p);
-const pluralize = (
-word,
-count,
-ending) =>
-`${ count } ${ word }${ count === 1 ? '' : ending }`;
-
-class SearchSource {
-
-
-
-
-
-
-
-
-
-
-
-
- constructor(
- hasteMap,
- config,
- options)
- {
- this._hasteContext = hasteMap;
- this._config = config;
- this._options = options || {
- skipNodeResolution: false };
-
-
- this._testPathDirPattern =
- new RegExp(config.testPathDirs.map(
- dir => escapePathForRegex(dir)).
- join('|'));
-
- this._testRegex = new RegExp(pathToRegex(config.testRegex));
- const ignorePattern = config.testPathIgnorePatterns;
- this._testIgnorePattern =
- ignorePattern.length ? new RegExp(ignorePattern.join('|')) : null;
-
- this._testPathCases = {
- testPathDirs: path => this._testPathDirPattern.test(path),
- testPathIgnorePatterns: path =>
- !this._testIgnorePattern ||
- !this._testIgnorePattern.test(path),
-
- testRegex: path => this._testRegex.test(path) };
-
- }
-
- _filterTestPathsWithStats(
- allPaths,
- testPathPattern)
- {
- const data = {
- paths: [],
- stats: {},
- total: allPaths.length };
-
-
- const testCases = Object.assign({}, this._testPathCases);
- if (testPathPattern) {
- const regex = new RegExp(testPathPattern, 'i');
- testCases.testPathPattern = path => regex.test(path);
- }
-
- data.paths = allPaths.filter(path => {
- return Object.keys(testCases).reduce((flag, key) => {
- if (testCases[key](path)) {
- data.stats[key] = ++data.stats[key] || 1;
- return flag && true;
- }
- data.stats[key] = data.stats[key] || 0;
- return false;
- }, true);
- });
-
- return data;
- }
-
- _getAllTestPaths(
- testPathPattern)
- {
- return this._filterTestPathsWithStats(
- this._hasteContext.hasteFS.getAllFiles(),
- testPathPattern);
-
- }
-
- isTestFilePath(path) {
- return Object.keys(this._testPathCases).every(key =>
- this._testPathCases[key](path));
-
- }
-
- findMatchingTests(
- testPathPattern)
- {
- if (testPathPattern && !(testPathPattern instanceof RegExp)) {
- const maybeFile = path.resolve(process.cwd(), testPathPattern);
- if (fileExists(maybeFile, this._hasteContext.hasteFS)) {
- return this._filterTestPathsWithStats([maybeFile]);
- }
- }
-
- return this._getAllTestPaths(testPathPattern);
- }
-
- findRelatedTests(allPaths) {
- const dependencyResolver = new DependencyResolver(
- this._hasteContext.resolver,
- this._hasteContext.hasteFS);
-
- return {
- paths: dependencyResolver.resolveInverse(
- allPaths,
- this.isTestFilePath.bind(this),
- {
- skipNodeResolution: this._options.skipNodeResolution }) };
-
-
-
- }
-
- findRelatedTestsFromPattern(
- paths)
- {
- if (Array.isArray(paths) && paths.length) {
- const resolvedPaths = paths.map(p => path.resolve(process.cwd(), p));
- return this.findRelatedTests(new Set(resolvedPaths));
- }
- return { paths: [] };
- }
-
- findChangedTests(options) {
- return Promise.all(this._config.testPathDirs.map(determineSCM)).
- then(repos => {
- if (!repos.every((_ref) => {var _ref2 = _slicedToArray(_ref, 2);let gitRepo = _ref2[0],hgRepo = _ref2[1];return gitRepo || hgRepo;})) {
- return {
- noSCM: true,
- paths: [] };
-
- }
- return Promise.all(Array.from(repos).map((_ref3) => {var _ref4 = _slicedToArray(_ref3, 2);let gitRepo = _ref4[0],hgRepo = _ref4[1];
- return gitRepo ?
- git.findChangedFiles(gitRepo, options) :
- hg.findChangedFiles(hgRepo, options);
- })).then(changedPathSets => this.findRelatedTests(
- new Set(Array.prototype.concat.apply([], changedPathSets))));
-
- });
- }
-
- getNoTestsFoundMessage(
- patternInfo,
- config,
- data)
- {
- if (patternInfo.onlyChanged) {
- return (
- chalk.bold(
- 'No tests found related to files changed since last commit.\n') +
-
- chalk.dim(
- patternInfo.watch ?
- 'Press `a` to run all tests, or run Jest with `--watchAll`.' :
- 'Run Jest without `-o` to run all tests.'));
-
-
- }
-
- const testPathPattern = SearchSource.getTestPathPattern(patternInfo);
- const stats = data.stats || {};
- const statsMessage = Object.keys(stats).map(key => {
- const value = key === 'testPathPattern' ? testPathPattern : config[key];
- if (value) {
- const matches = pluralize('match', stats[key], 'es');
- return ` ${ key }: ${ chalk.yellow(value) } - ${ matches }`;
- }
- return null;
- }).filter(line => line).join('\n');
-
- return (
- chalk.bold('No tests found') + '\n' + (
- data.total ?
- ` ${ pluralize('file', data.total || 0, 's') } checked.\n` +
- statsMessage :
- `No files found in ${ config.rootDir }.\n` +
- `Make sure Jest's configuration does not exclude this directory.\n` +
- `To set up Jest, make sure a package.json file exists.\n` +
- `Jest Documentation: facebook.github.io/jest/docs/configuration.html`));
-
-
- }
-
- getTestPaths(patternInfo) {
- if (patternInfo.onlyChanged) {
- return this.findChangedTests({ lastCommit: patternInfo.lastCommit });
- } else if (patternInfo.findRelatedTests && patternInfo.paths) {
- return Promise.resolve(
- this.findRelatedTestsFromPattern(patternInfo.paths));
-
- } else if (patternInfo.testPathPattern != null) {
- return Promise.resolve(
- this.findMatchingTests(patternInfo.testPathPattern));
-
- } else {
- return Promise.resolve({ paths: [] });
- }
- }
-
- static getTestPathPattern(patternInfo) {
- const pattern = patternInfo.testPathPattern;
- const input = patternInfo.input;
- const formattedPattern = `/${ pattern || '' }/`;
- const formattedInput = patternInfo.shouldTreatInputAsPattern ?
- `/${ input || '' }/` :
- `"${ input || '' }"`;
- return input === pattern ? formattedInput : formattedPattern;
- }}
-
-
-
-module.exports = SearchSource;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/TestRunner.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/TestRunner.js
deleted file mode 100644
index 5906aa916..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/TestRunner.js
+++ /dev/null
@@ -1,605 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';var _require =
-
-
-
-
-
-
-
-
-
-
-
-require('jest-util');const formatExecError = _require.formatExecError;
-const fs = require('graceful-fs');
-const getCacheFilePath = require('jest-haste-map').getCacheFilePath;
-const DefaultReporter = require('./reporters/DefaultReporter');
-const NotifyReporter = require('./reporters/NotifyReporter');
-const SummaryReporter = require('./reporters/SummaryReporter');
-const VerboseReporter = require('./reporters/VerboseReporter');
-const promisify = require('./lib/promisify');
-const runTest = require('./runTest');
-const snapshot = require('jest-snapshot');
-const throat = require('throat');
-const workerFarm = require('worker-farm');
-const TestWatcher = require('./TestWatcher');
-
-const FAIL = 0;
-const SLOW_TEST_TIME = 3000;
-const SUCCESS = 1;
-
-class CancelRun extends Error {
- constructor(message) {
- super(message);
- this.name = 'CancelRun';
- }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-const TEST_WORKER_PATH = require.resolve('./TestWorker');
-
-class TestRunner {
-
-
-
-
-
-
- constructor(
- hasteContext,
- config,
- options)
- {
- this._config = config;
- this._dispatcher = new ReporterDispatcher(
- hasteContext.hasteFS,
- options.getTestSummary);
-
- this._hasteContext = hasteContext;
- this._options = options;
- this._setupReporters();
-
- // Map from testFilePath -> time it takes to run the test. Used to
- // optimally schedule bigger test runs.
- this._testPerformanceCache = {};
- }
-
- addReporter(reporter) {
- this._dispatcher.register(reporter);
- }
-
- removeReporter(ReporterClass) {
- this._dispatcher.unregister(ReporterClass);
- }
-
- _getTestPerformanceCachePath() {
- const config = this._config;
- return getCacheFilePath(config.cacheDirectory, 'perf-cache-' + config.name);
- }
-
- _sortTests(testPaths) {
- // When running more tests than we have workers available, sort the tests
- // by size - big test files usually take longer to complete, so we run
- // them first in an effort to minimize worker idle time at the end of a
- // long test run.
- //
- // After a test run we store the time it took to run a test and on
- // subsequent runs we use that to run the slowest tests first, yielding the
- // fastest results.
- try {
- if (this._config.cache) {
- this._testPerformanceCache = JSON.parse(fs.readFileSync(
- this._getTestPerformanceCachePath(),
- 'utf8'));
-
- } else {
- this._testPerformanceCache = {};
- }
- } catch (e) {
- this._testPerformanceCache = {};
- }
-
- const cache = this._testPerformanceCache;
- const timings = [];
- const stats = {};
- const getFileSize = filePath =>
- stats[filePath] || (stats[filePath] = fs.statSync(filePath).size);
- const getTestRunTime = filePath => {
- if (cache[filePath]) {
- return cache[filePath][0] === FAIL ? Infinity : cache[filePath][1];
- }
- return null;
- };
-
- testPaths = testPaths.
- sort((pathA, pathB) => {
- const timeA = getTestRunTime(pathA);
- const timeB = getTestRunTime(pathB);
- if (timeA != null && timeB != null) {
- return timeA < timeB ? 1 : -1;
- }
- return getFileSize(pathA) < getFileSize(pathB) ? 1 : -1;
- });
-
- testPaths.forEach(filePath => {
- const timing = cache[filePath] && cache[filePath][1];
- if (timing) {
- timings.push(timing);
- }
- });
-
- return { testPaths, timings };
- }
-
- _cacheTestResults(aggregatedResults) {
- const cache = this._testPerformanceCache;
- aggregatedResults.testResults.forEach(test => {
- if (test && !test.skipped) {
- const perf = test.perfStats;
- cache[test.testFilePath] = [
- test.numFailingTests ? FAIL : SUCCESS,
- perf.end - perf.start || 0];
-
- }
- });
- fs.writeFileSync(
- this._getTestPerformanceCachePath(),
- JSON.stringify(cache));
-
- }
-
- runTests(paths, watcher) {
- const config = this._config;var _sortTests =
- this._sortTests(paths);const testPaths = _sortTests.testPaths,timings = _sortTests.timings;
- const aggregatedResults = createAggregatedResults(testPaths.length);
- const estimatedTime =
- Math.ceil(getEstimatedTime(timings, this._options.maxWorkers) / 1000);
-
- const onResult = (testPath, testResult) => {
- if (watcher.isInterrupted()) {
- return;
- }
- if (testResult.testResults.length === 0) {
- const message = 'Your test suite must contain at least one test.';
- onFailure(testPath, {
- message,
- stack: new Error(message).stack });
-
- return;
- }
- addResult(aggregatedResults, testResult);
- this._dispatcher.onTestResult(
- config,
- testResult,
- aggregatedResults);
-
- this._bailIfNeeded(aggregatedResults, watcher);
- };
-
- const onFailure = (testPath, error) => {
- if (watcher.isInterrupted()) {
- return;
- }
- const testResult = buildFailureTestResult(testPath, error);
- testResult.failureMessage = formatExecError(testResult, config, testPath);
- addResult(aggregatedResults, testResult);
- this._dispatcher.onTestResult(
- config,
- testResult,
- aggregatedResults);
-
- };
-
- // Run in band if we only have one test or one worker available.
- // If we are confident from previous runs that the tests will finish quickly
- // we also run in band to reduce the overhead of spawning workers.
- const shouldRunInBand = () =>
- this._options.maxWorkers <= 1 ||
- testPaths.length <= 1 ||
-
- testPaths.length <= 20 &&
- timings.every(timing => timing < SLOW_TEST_TIME);
-
-
-
- const updateSnapshotState = () => {
- const status =
- snapshot.cleanup(this._hasteContext.hasteFS, config.updateSnapshot);
- aggregatedResults.snapshot.filesRemoved += status.filesRemoved;
- aggregatedResults.snapshot.didUpdate = config.updateSnapshot;
- aggregatedResults.snapshot.failure = !!(
- !aggregatedResults.snapshot.didUpdate && (
- aggregatedResults.snapshot.unchecked ||
- aggregatedResults.snapshot.unmatched ||
- aggregatedResults.snapshot.filesRemoved));
-
-
- };
-
- const runInBand = shouldRunInBand();
-
- this._dispatcher.onRunStart(
- config,
- aggregatedResults,
- {
- estimatedTime,
- showStatus: !runInBand });
-
-
-
- const testRun =
- runInBand ?
- this._createInBandTestRun(testPaths, watcher, onResult, onFailure) :
- this._createParallelTestRun(testPaths, watcher, onResult, onFailure);
-
- return testRun.
- catch(error => {
- if (!watcher.isInterrupted()) {
- throw error;
- }
- }).
- then(() => {
- updateSnapshotState();
- aggregatedResults.wasInterrupted = watcher.isInterrupted();
-
- this._dispatcher.onRunComplete(config, aggregatedResults);
-
- const anyTestFailures = !(
- aggregatedResults.numFailedTests === 0 &&
- aggregatedResults.numRuntimeErrorTestSuites === 0);
-
- const anyReporterErrors = this._dispatcher.hasErrors();
-
- aggregatedResults.success = !(
- anyTestFailures ||
- aggregatedResults.snapshot.failure ||
- anyReporterErrors);
-
-
- this._cacheTestResults(aggregatedResults);
- return aggregatedResults;
- });
- }
-
- _createInBandTestRun(
- testPaths,
- watcher,
- onResult,
- onFailure)
- {
- const mutex = throat(1);
- return testPaths.reduce(
- (promise, path) =>
- mutex(() =>
- promise.
- then(() => {
- if (watcher.isInterrupted()) {
- throw new CancelRun();
- }
-
- this._dispatcher.onTestStart(this._config, path);
- return runTest(
- path,
- this._config,
- this._hasteContext.resolver);
-
- }).
- then(result => onResult(path, result)).
- catch(err => onFailure(path, err))),
-
- Promise.resolve());
-
- }
-
- _createParallelTestRun(
- testPaths,
- watcher,
- onResult,
- onFailure)
- {
- const config = this._config;
- const farm = workerFarm({
- autoStart: true,
- maxConcurrentCallsPerWorker: 1,
- maxConcurrentWorkers: this._options.maxWorkers,
- maxRetries: 2 },
- TEST_WORKER_PATH);
- const mutex = throat(this._options.maxWorkers);
- // Send test suites to workers continuously instead of all at once to track
- // the start time of individual tests.
- const runTestInWorker = (_ref) => {let path = _ref.path,config = _ref.config;return mutex(() => {
- if (watcher.isInterrupted()) {
- return Promise.reject();
- }
- this._dispatcher.onTestStart(config, path);
- return promisify(farm)({ config, path });
- });};
-
- const onError = (err, path) => {
- onFailure(path, err);
- if (err.type === 'ProcessTerminatedError') {
- console.error(
- 'A worker process has quit unexpectedly! ' +
- 'Most likely this an initialization error.');
-
- process.exit(1);
- }
- };
-
- const onInterrupt = new Promise((_, reject) => {
- watcher.on('change', state => {
- if (state.interrupted) {
- reject(new CancelRun());
- }
- });
- });
-
- const runAllTests = Promise.all(testPaths.map(path => {
- return runTestInWorker({ config, path }).
- then(testResult => onResult(path, testResult)).
- catch(error => onError(error, path));
- }));
-
- return Promise.race([
- runAllTests,
- onInterrupt]).
- then(() => workerFarm.end(farm));
- }
-
- _setupReporters() {
- this.addReporter(
- this._config.verbose ?
- new VerboseReporter() :
- new DefaultReporter());
-
-
- if (this._config.collectCoverage) {
- // coverage reporter dependency graph is pretty big and we don't
- // want to require it if we're not in the `--coverage` mode
- const CoverageReporter = require('./reporters/CoverageReporter');
- this.addReporter(new CoverageReporter());
- }
-
- this.addReporter(new SummaryReporter());
- if (this._config.notify) {
- this.addReporter(new NotifyReporter());
- }
- }
-
- _bailIfNeeded(aggregatedResults, watcher) {
- if (this._config.bail && aggregatedResults.numFailedTests !== 0) {
- if (watcher.isWatchMode()) {
- watcher.setState({ interrupted: true });
- } else {
- this._dispatcher.onRunComplete(this._config, aggregatedResults);
- process.exit(1);
- }
- }
- }}
-
-
-const createAggregatedResults = numTotalTestSuites => {
- return {
- numFailedTestSuites: 0,
- numFailedTests: 0,
- numPassedTestSuites: 0,
- numPassedTests: 0,
- numPendingTestSuites: 0,
- numPendingTests: 0,
- numRuntimeErrorTestSuites: 0,
- numTotalTestSuites,
- numTotalTests: 0,
- snapshot: {
- added: 0,
- didUpdate: false, // is set only after the full run
- failure: false,
- filesAdded: 0,
- // combines individual test results + results after full run
- filesRemoved: 0,
- filesUnmatched: 0,
- filesUpdated: 0,
- matched: 0,
- total: 0,
- unchecked: 0,
- unmatched: 0,
- updated: 0 },
-
- startTime: Date.now(),
- success: false,
- testResults: [],
- wasInterrupted: false };
-
-};
-
-const addResult = (
-aggregatedResults,
-testResult) =>
-{
- aggregatedResults.testResults.push(testResult);
- aggregatedResults.numTotalTests +=
- testResult.numPassingTests +
- testResult.numFailingTests +
- testResult.numPendingTests;
- aggregatedResults.numFailedTests += testResult.numFailingTests;
- aggregatedResults.numPassedTests += testResult.numPassingTests;
- aggregatedResults.numPendingTests += testResult.numPendingTests;
-
- if (testResult.testExecError) {
- aggregatedResults.numRuntimeErrorTestSuites++;
- }
-
- if (testResult.skipped) {
- aggregatedResults.numPendingTestSuites++;
- } else if (testResult.numFailingTests > 0 || testResult.testExecError) {
- aggregatedResults.numFailedTestSuites++;
- } else {
- aggregatedResults.numPassedTestSuites++;
- }
-
- // Snapshot data
- if (testResult.snapshot.added) {
- aggregatedResults.snapshot.filesAdded++;
- }
- if (testResult.snapshot.fileDeleted) {
- aggregatedResults.snapshot.filesRemoved++;
- }
- if (testResult.snapshot.unmatched) {
- aggregatedResults.snapshot.filesUnmatched++;
- }
- if (testResult.snapshot.updated) {
- aggregatedResults.snapshot.filesUpdated++;
- }
-
- aggregatedResults.snapshot.added += testResult.snapshot.added;
- aggregatedResults.snapshot.matched += testResult.snapshot.matched;
- aggregatedResults.snapshot.unchecked += testResult.snapshot.unchecked;
- aggregatedResults.snapshot.unmatched += testResult.snapshot.unmatched;
- aggregatedResults.snapshot.updated += testResult.snapshot.updated;
- aggregatedResults.snapshot.total +=
- testResult.snapshot.added +
- testResult.snapshot.matched +
- testResult.snapshot.unmatched +
- testResult.snapshot.updated;
-};
-
-const buildFailureTestResult = (
-testPath,
-err) =>
-{
- return {
- console: null,
- failureMessage: null,
- numFailingTests: 0,
- numPassingTests: 0,
- numPendingTests: 0,
- perfStats: {
- end: 0,
- start: 0 },
-
- skipped: false,
- snapshot: {
- added: 0,
- fileDeleted: false,
- matched: 0,
- unchecked: 0,
- unmatched: 0,
- updated: 0 },
-
- testExecError: err,
- testFilePath: testPath,
- testResults: [] };
-
-};
-
-// Proxy class that holds all reporter and dispatchers events to each
-// of them.
-class ReporterDispatcher {
-
-
-
-
- constructor(hasteFS, getTestSummary) {
- this._runnerContext = { getTestSummary, hasteFS };
- this._reporters = [];
- }
-
- register(reporter) {
- this._reporters.push(reporter);
- }
-
- unregister(ReporterClass) {
- this._reporters = this._reporters.filter(
- reporter => !(reporter instanceof ReporterClass));
-
- }
-
- onTestResult(config, testResult, results) {
- this._reporters.forEach(reporter =>
- reporter.onTestResult(
- config,
- testResult,
- results,
- this._runnerContext));
-
-
- }
-
- onTestStart(config, path) {
- this._reporters.forEach(reporter =>
- reporter.onTestStart(config, path, this._runnerContext));
-
- }
-
- onRunStart(config, results, options) {
- this._reporters.forEach(
- reporter => reporter.onRunStart(
- config,
- results,
- this._runnerContext,
- options));
-
-
- }
-
- onRunComplete(config, results) {
- this._reporters.forEach(reporter =>
- reporter.onRunComplete(config, results, this._runnerContext));
-
- }
-
- // Return a list of last errors for every reporter
- getErrors() {
- return this._reporters.reduce(
- (list, reporter) => {
- const error = reporter.getLastError();
- return error ? list.concat(error) : list;
- },
- []);
-
- }
-
- hasErrors() {
- return this.getErrors().length !== 0;
- }}
-
-
-const getEstimatedTime = (timings, workers) => {
- if (!timings.length) {
- return 0;
- }
-
- const max = Math.max.apply(null, timings);
- if (timings.length <= workers) {
- return max;
- }
-
- return Math.max(
- timings.reduce((sum, time) => sum + time) / workers,
- max);
-
-};
-
-module.exports = TestRunner;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/TestWatcher.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/TestWatcher.js
deleted file mode 100644
index 209277e7c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/TestWatcher.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';var _require =
-
-require('events');const EventEmitter = _require.EventEmitter;
-
-
-
-
-
-class TestWatcher extends EventEmitter {
-
-
-
- constructor(_ref) {let isWatchMode = _ref.isWatchMode;
- super();
- this.state = { interrupted: false };
- this._isWatchMode = isWatchMode;
- }
-
- setState(state) {
- Object.assign(this.state, state);
- this.emit('change', this.state);
- }
-
- isInterrupted() {
- return this.state.interrupted;
- }
-
- isWatchMode() {
- return this._isWatchMode;
- }}
-
-
-
-module.exports = TestWatcher;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/TestWorker.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/TestWorker.js
deleted file mode 100644
index 934aa526a..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/TestWorker.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';var _require =
-
-
-
-
-require('jest-util');const separateMessageFromStack = _require.separateMessageFromStack;
-
-// Make sure uncaught errors are logged before we exit.
-process.on('uncaughtException', err => {
- console.error(err.stack);
- process.exit(1);
-});
-
-const Runtime = require('jest-runtime');
-const runTest = require('./runTest');
-
-
-
-
-
-
-
-
-const formatError = error => {
- if (typeof error === 'string') {var _separateMessageFromS =
- separateMessageFromStack(error);const message = _separateMessageFromS.message,stack = _separateMessageFromS.stack;
- return {
- message,
- stack,
- type: 'Error' };
-
- }
-
- return {
- message: error.message,
- stack: error.stack,
- type: error.type || 'Error' };
-
-};
-
-const resolvers = Object.create(null);
-
-module.exports = (data, callback) => {
- try {
- const name = data.config.name;
- if (!resolvers[name]) {
- resolvers[name] = Runtime.createResolver(
- data.config,
- Runtime.createHasteMap(data.config).readModuleMap());
-
- }
-
- runTest(data.path, data.config, resolvers[name]).
- then(
- result => callback(null, result),
- error => callback(formatError(error)));
-
- } catch (error) {
- callback(formatError(error));
- }
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/assets/jest_logo.png b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/assets/jest_logo.png
deleted file mode 100644
index c52bf1503..000000000
Binary files a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/assets/jest_logo.png and /dev/null differ
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/cli/args.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/cli/args.js
deleted file mode 100644
index cd60a55a5..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/cli/args.js
+++ /dev/null
@@ -1,261 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-const check = argv => {
- if (argv.runInBand && argv.hasOwnProperty('maxWorkers')) {
- throw new Error(
- 'Both --runInBand and --maxWorkers were specified, but these two ' +
- 'options do not make sense together. Which is it?');
-
- }
-
- if (argv.onlyChanged && argv._.length > 0) {
- throw new Error(
- 'Both --onlyChanged and a path pattern were specified, but these ' +
- 'two options do not make sense together. Which is it? Do you want ' +
- 'to run tests for changed files? Or for a specific set of files?');
-
- }
-
- if (argv.onlyChanged && argv.watchAll) {
- throw new Error(
- 'Both --onlyChanged and --watchAll were specified, but these two ' +
- 'options do not make sense together. Try the --watch option which ' +
- 'reruns only tests related to changed files.');
-
- }
-
- if (argv.findRelatedTests && argv._.length === 0) {
- throw new Error(
- 'The --findRelatedTests option requires file paths to be specified.\n' +
- 'Example usage: jest --findRelatedTests ./src/source.js ./src/index.js.');
-
- }
-
- return true;
-};
-
-const usage = 'Usage: $0 [--config=] [TestPathPattern]';
-
-const options = {
- bail: {
- alias: 'b',
- description:
- 'Exit the test suite immediately upon the first failing test.',
- type: 'boolean' },
-
- cache: {
- default: true,
- description:
- 'Whether to use the transform cache. Disable the cache using ' +
- '--no-cache.',
- type: 'boolean' },
-
- collectCoverageFrom: {
- description:
- 'relative to glob pattern matching the files that coverage ' +
- 'info needs to be collected from.',
- type: 'string' },
-
- colors: {
- description:
- 'Forces test results output highlighting (even if stdout is not a TTY)',
- type: 'boolean' },
-
- config: {
- alias: 'c',
- description:
- 'The path to a jest config file specifying how to find and execute ' +
- 'tests. If no rootDir is set in the config, the current directory ' +
- 'is assumed to be the rootDir for the project. This can also be a JSON' +
- 'encoded value which Jest will use as configuration.',
- type: 'string' },
-
- coverage: {
- description:
- 'Indicates that test coverage information should be collected and ' +
- 'reported in the output.',
- type: 'boolean' },
-
- debug: {
- description: 'Print debugging info about your jest config.',
- type: 'boolean' },
-
- env: {
- default: undefined,
- description:
- 'The test environment used for all tests. This can point to any file ' +
- 'or node module. Examples: `jsdom`, `node` or ' +
- '`path/to/my-environment.js`',
- type: 'string' },
-
- expand: {
- alias: 'e',
- default: false,
- description: 'Use this flag to show full diffs instead of a patch.',
- type: 'boolean' },
-
- findRelatedTests: {
- description:
- 'Find related tests for a list of source files that were passed in ' +
- 'as arguments. Useful for pre-commit hook integration to run the ' +
- 'minimal amount of tests necessary.',
- type: 'boolean' },
-
- forceExit: {
- default: false,
- description:
- 'Force Jest to exit after all tests have completed running. ' +
- 'This is useful when resources set up by test code cannot be ' +
- 'adequately cleaned up.',
- type: 'boolean' },
-
- json: {
- description:
- 'Prints the test results in JSON. This mode will send all ' +
- 'other test output and user messages to stderr.',
- type: 'boolean' },
-
- jsonOutputFile: {
- description:
- 'Write test results to a file when the --json option is also specified.',
- type: 'string' },
-
- lastCommit: {
- default: false,
- description:
- 'Will run all tests affected by file changes in the last commit made.',
- type: 'boolean' },
-
- logHeapUsage: {
- description:
- 'Logs the heap usage after every test. Useful to debug memory ' +
- 'leaks. Use together with `--runInBand` and `--expose-gc` in node.',
- type: 'boolean' },
-
- maxWorkers: {
- alias: 'w',
- description:
- 'Specifies the maximum number of workers the worker-pool will ' +
- 'spawn for running tests. This defaults to the number of the cores ' +
- 'available on your machine. (its usually best not to override this ' +
- 'default)',
- type: 'string' },
-
- noStackTrace: {
- description: 'Disables stack trace in test results output',
- type: 'boolean' },
-
- notify: {
- description: 'Activates notifications for test results.',
- type: 'boolean' },
-
- onlyChanged: {
- alias: 'o',
- description:
- 'Attempts to identify which tests to run based on which files have ' +
- 'changed in the current repository. Only works if you\'re running ' +
- 'tests in a git repository at the moment.',
- type: 'boolean' },
-
- runInBand: {
- alias: 'i',
- description:
- 'Run all tests serially in the current process (rather than ' +
- 'creating a worker pool of child processes that run tests). This ' +
- 'is sometimes useful for debugging, but such use cases are pretty ' +
- 'rare.',
- type: 'boolean' },
-
- setupTestFrameworkScriptFile: {
- description:
- 'The path to a module that runs some code to configure or set up ' +
- 'the testing framework before each test.',
- type: 'string' },
-
- silent: {
- default: false,
- description: 'Prevent tests from printing messages through the console.',
- type: 'boolean' },
-
- testNamePattern: {
- alias: 't',
- description:
- 'Run only tests with a name that matches the regex pattern.',
- type: 'string' },
-
- testPathPattern: {
- description:
- 'A regexp pattern string that is matched against all tests ' +
- 'paths before executing the test.',
- type: 'string' },
-
- testRunner: {
- description:
- 'Allows to specify a custom test runner. Jest ships with Jasmine ' +
- '1 and 2 which can be enabled by setting this option to ' +
- '`jasmine1` or `jasmine2`. The default is `jasmine2`. A path to a ' +
- 'custom test runner can be provided: ' +
- '`/path/to/testRunner.js`.',
- type: 'string' },
-
- updateSnapshot: {
- alias: 'u',
- default: false,
- description:
- 'Use this flag to re-record snapshots. ' +
- 'Can be used together with a test suite pattern or with ' +
- '`--testNamePattern` to re-record snapshot for test matching ' +
- 'the pattern',
- type: 'boolean' },
-
- useStderr: {
- description: 'Divert all output to stderr.',
- type: 'boolean' },
-
- verbose: {
- description:
- 'Display individual test results with the test suite hierarchy.',
- type: 'boolean' },
-
- version: {
- alias: 'v',
- description: 'Print the version and exit',
- type: 'boolean' },
-
- watch: {
- description:
- 'Watch files for changes and rerun tests related to changed files. ' +
- 'If you want to re-run all tests when a file has changed, use the ' +
- '`--watchAll` option.',
- type: 'boolean' },
-
- watchAll: {
- description:
- 'Watch files for changes and rerun all tests. If you want to re-run ' +
- 'only the tests related to the changed files, use the ' +
- '`--watch` option.',
- type: 'boolean' },
-
- watchman: {
- default: true,
- description:
- 'Whether to use watchman for file crawling. Disable using ' +
- '--no-watchman.',
- type: 'boolean' } };
-
-
-
-module.exports = {
- check,
- options,
- usage };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/cli/getJest.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/cli/getJest.js
deleted file mode 100644
index bbcd34e28..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/cli/getJest.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-const chalk = require('chalk');
-const fs = require('graceful-fs');
-const path = require('path');
-
-function getJest(packageRoot) {
- const packageJSONPath = path.join(packageRoot, 'package.json');
- const binPath = path.join(packageRoot, 'node_modules/jest-cli');
- if (fs.existsSync(binPath)) {
- /* $FlowFixMe */
- return require(binPath);
- } else {
- const jest = require('../jest');
- // Check if Jest is specified in `package.json` but not installed.
- if (fs.existsSync(packageJSONPath)) {
- /* $FlowFixMe */
- const packageJSON = require(packageJSONPath);
- const dependencies = packageJSON.dependencies;
- const devDependencies = packageJSON.devDependencies;
- if (
- dependencies && dependencies['jest-cli'] ||
- devDependencies && devDependencies['jest-cli'])
- {
- process.on('exit', () => console.log(
- chalk.red(
- 'Please run `npm install` to use the version of Jest intended ' +
- 'for this project.')));
-
-
- }
- }
- return jest;
- }
-}
-
-module.exports = getJest;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/cli/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/cli/index.js
deleted file mode 100644
index a124ac8f1..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/cli/index.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-const args = require('./args');
-const getJest = require('./getJest');
-const getPackageRoot = require('jest-util').getPackageRoot;
-const warnAboutUnrecognizedOptions = require('jest-util').warnAboutUnrecognizedOptions;
-const yargs = require('yargs');
-
-function run(argv, root) {
- argv = yargs(argv || process.argv.slice(2)).
- usage(args.usage).
- help().
- options(args.options).
- check(args.check).
- argv;
-
- warnAboutUnrecognizedOptions(argv, args.options);
-
- if (argv.help) {
- yargs.showHelp();
- process.on('exit', () => process.exit(1));
- return;
- }
-
- if (!root) {
- root = getPackageRoot();
- }
-
- getJest(root).runCLI(argv, root, result => {
- const code = !result || result.success ? 0 : 1;
- process.on('exit', () => process.exit(code));
- if (argv && argv.forceExit) {
- process.exit(code);
- }
- });
-}
-
-exports.run = run;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/coverage.template b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/coverage.template
deleted file mode 100644
index b79141b06..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/coverage.template
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2004-present Facebook. All Rights Reserved.
-
-// Instrumentation Header
-{
- var <%= instrumented.names.statement %>;
- var <%= instrumented.names.expression %>;
- var <%= instrumented.names.block %>;
- var nodes = <%= coverageStorageVar %>.nodes = {};
- var blocks = <%= coverageStorageVar %>.blocks = {};
-
- <%= instrumented.names.statement %> = function(i) {
- var node = nodes[i] = (nodes[i] || {index: i, count:0})
- node.count++;
- };
-
- <%= instrumented.names.expression %> = function(i) {
- var node = nodes[i] = (nodes[i] || {index: i, count:0})
- node.count++;
- };
-
- <%= instrumented.names.block %> = function(i) {
- var block = blocks[i] = (blocks[i] || {index: i, count:0})
- block.count++;
- };
-};
-////////////////////////
-
-// Instrumented Code
-<%= source %>
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/generateEmptyCoverage.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/generateEmptyCoverage.js
deleted file mode 100644
index 0e0482606..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/generateEmptyCoverage.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-const IstanbulInstrument = require('istanbul-lib-instrument');var _require =
-
-require('jest-runtime');const transformSource = _require.transformSource,shouldInstrument = _require.shouldInstrument;
-
-module.exports = function (source, filename, config) {
- if (shouldInstrument(filename, config)) {
- // Transform file without instrumentation first, to make sure produced
- // source code is ES6 (no flowtypes etc.) and can be instrumented
- source = transformSource(filename, config, source, false);
- const instrumenter = IstanbulInstrument.createInstrumenter();
- instrumenter.instrumentSync(source, filename);
- return instrumenter.fileCoverage;
- } else {
- return null;
- }
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/jest.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/jest.js
deleted file mode 100644
index 37596778c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/jest.js
+++ /dev/null
@@ -1,456 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-const realFs = require('fs');
-const fs = require('graceful-fs');
-fs.gracefulify(realFs);
-
-const Runtime = require('jest-runtime');
-const SearchSource = require('./SearchSource');
-const TestRunner = require('./TestRunner');var _require =
-
-require('jest-util');const Console = _require.Console,clearLine = _require.clearLine;var _require2 =
-require('./cli');const run = _require2.run;
-const ansiEscapes = require('ansi-escapes');
-const chalk = require('chalk');
-const formatTestResults = require('./lib/formatTestResults');
-const os = require('os');
-const path = require('path');
-const preRunMessage = require('./preRunMessage');
-const readConfig = require('jest-config').readConfig;
-const sane = require('sane');
-const which = require('which');
-const TestWatcher = require('./TestWatcher');
-
-const CLEAR = '\x1B[2J\x1B[H';
-const VERSION = require('../package.json').version;
-const WATCHER_DEBOUNCE = 200;
-const WATCHMAN_BIN = 'watchman';
-const KEYS = {
- A: '61',
- BACKSPACE: process.platform === 'win32' ? '08' : '7f',
- CONTROL_C: '03',
- CONTROL_D: '04',
- ENTER: '0d',
- ESCAPE: '1b',
- O: '6f',
- P: '70',
- Q: '71',
- U: '75' };
-
-
-const getMaxWorkers = argv => {
- if (argv.runInBand) {
- return 1;
- } else if (argv.maxWorkers) {
- return parseInt(argv.maxWorkers, 10);
- } else {
- const cpus = os.cpus().length;
- return Math.max(argv.watch ? Math.floor(cpus / 2) : cpus - 1, 1);
- }
-};
-
-const buildTestPathPatternInfo = argv => {
- const defaultPattern = {
- input: '',
- shouldTreatInputAsPattern: false,
- testPathPattern: '' };
-
- const validatePattern = patternInfo => {const
- testPathPattern = patternInfo.testPathPattern;
- if (testPathPattern) {
- try {
- /* eslint-disable no-new */
- new RegExp(testPathPattern);
- /* eslint-enable no-new */
- } catch (error) {
- clearLine(process.stdout);
- console.log(chalk.red(
- 'Invalid testPattern ' + String(testPathPattern) + ' supplied. ' +
- 'Running all tests instead.'));
-
- return defaultPattern;
- }
- }
- return patternInfo;
- };
- if (argv.onlyChanged) {
- return {
- input: '',
- lastCommit: argv.lastCommit,
- onlyChanged: true,
- watch: argv.watch };
-
- }
- if (argv.testPathPattern) {
- return validatePattern({
- input: argv.testPathPattern,
- shouldTreatInputAsPattern: true,
- testPathPattern: argv.testPathPattern });
-
- }
- if (argv._ && argv._.length) {
- return validatePattern({
- findRelatedTests: argv.findRelatedTests,
- input: argv._.join(' '),
- paths: argv._,
- shouldTreatInputAsPattern: false,
- testPathPattern: argv._.join('|') });
-
- }
- return defaultPattern;
-};
-
-const getTestSummary = (
-argv,
-patternInfo) =>
-{
- const testPathPattern = SearchSource.getTestPathPattern(patternInfo);
- const testInfo = patternInfo.onlyChanged ?
- chalk.dim(' related to changed files') :
- patternInfo.input !== '' ?
- chalk.dim(' matching ') + testPathPattern :
- '';
-
- const nameInfo = argv.testNamePattern ?
- chalk.dim(' with tests matching ') + `"${ argv.testNamePattern }"` :
- '';
-
- return (
- chalk.dim('Ran all test suites') +
- testInfo +
- nameInfo +
- chalk.dim('.'));
-
-};
-
-const getWatcher = (
-config,
-packageRoot,
-callback,
-options) =>
-{
- which(WATCHMAN_BIN, (err, resolvedPath) => {
- const watchman = !err && options.useWatchman && resolvedPath;
- const glob = config.moduleFileExtensions.map(ext => '**/*' + ext);
- const watcher = sane(packageRoot, { glob, watchman });
- callback(watcher);
- });
-};
-
-const runJest = (config, argv, pipe, testWatcher, onComplete) => {
- const maxWorkers = getMaxWorkers(argv);
- const localConsole = new Console(pipe, pipe);
- let patternInfo = buildTestPathPatternInfo(argv);
- return Runtime.createHasteContext(config, {
- console: localConsole,
- maxWorkers }).
- then(hasteMap => {
- const source = new SearchSource(hasteMap, config);
- return source.getTestPaths(patternInfo).
- then(data => {
- if (!data.paths.length) {
- if (patternInfo.onlyChanged && data.noSCM) {
- if (config.watch) {
- // Run all the tests
- setWatchMode(argv, 'watchAll', {
- noSCM: true });
-
- patternInfo = buildTestPathPatternInfo(argv);
- return source.getTestPaths(patternInfo);
- } else {
- localConsole.log(
- 'Jest can only find uncommitted changed files in a git or hg ' +
- 'repository. If you make your project a git or hg repository ' +
- '(`git init` or `hg init`), Jest will be able to only ' +
- 'run tests related to files changed since the last commit.');
-
- }
- }
-
- localConsole.log(
- source.getNoTestsFoundMessage(patternInfo, config, data));
-
- }
- return data;
- }).then(data => {
- if (data.paths.length === 1 && config.verbose !== false) {
- config = Object.assign({}, config, { verbose: true });
- }
-
- return new TestRunner(
- hasteMap,
- config,
- {
- getTestSummary: () => getTestSummary(argv, patternInfo),
- maxWorkers }).
-
- runTests(data.paths, testWatcher);
- }).
- then(runResults => {
- if (config.testResultsProcessor) {
- /* $FlowFixMe */
- const processor = require(config.testResultsProcessor);
- processor(runResults);
- }
- if (argv.json) {
- if (argv.jsonOutputFile) {
- const outputFile = path.resolve(process.cwd(), argv.jsonOutputFile);
-
- fs.writeFileSync(
- outputFile,
- JSON.stringify(formatTestResults(runResults, config)));
-
- process.stdout.write(
- `Test results written to: ` +
- `${ path.relative(process.cwd(), outputFile) }\n`);
-
- } else {
- process.stdout.write(
- JSON.stringify(formatTestResults(runResults, config)));
-
- }
- }
- return onComplete && onComplete(runResults);
- }).catch(error => {
- throw error;
- });
- });
-};
-
-const setWatchMode = (argv, mode, options) => {
- if (mode === 'watch') {
- argv.watch = true;
- argv.watchAll = false;
- } else if (mode === 'watchAll') {
- argv.watch = false;
- argv.watchAll = true;
- }
-
- // Reset before setting these to the new values
- argv._ = options && options.pattern || '';
- argv.onlyChanged = false;
- argv.onlyChanged =
- buildTestPathPatternInfo(argv).input === '' && !argv.watchAll;
-
- if (options && options.noSCM) {
- argv.noSCM = true;
- }
-};
-
-const runCLI = (
-argv,
-root,
-onComplete) =>
-{
- const pipe = argv.json ? process.stderr : process.stdout;
- argv = argv || {};
- if (argv.version) {
- pipe.write(`v${ VERSION }\n`);
- onComplete && onComplete();
- return;
- }
-
- readConfig(argv, root).
- then(config => {
- if (argv.debug) {
- /* $FlowFixMe */
- const testFramework = require(config.testRunner);
- pipe.write('jest version = ' + VERSION + '\n');
- pipe.write('test framework = ' + testFramework.name + '\n');
- pipe.write('config = ' + JSON.stringify(config, null, ' ') + '\n');
- }
- if (argv.watch || argv.watchAll) {
- setWatchMode(argv, argv.watch ? 'watch' : 'watchAll', {
- pattern: argv._ });
-
-
- let isRunning = false;
- let isEnteringPattern = false;
- let currentPattern = '';
- let timer;
-
- let testWatcher;
- const writeCurrentPattern = () => {
- clearLine(pipe);
- pipe.write(chalk.dim(' pattern \u203A ') + currentPattern);
- };
-
- const startRun = function () {let overrideConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- if (isRunning) {
- return null;
- }
-
- testWatcher = new TestWatcher({ isWatchMode: true });
- pipe.write(CLEAR);
- preRunMessage.print(pipe);
- isRunning = true;
- return runJest(
- Object.freeze(Object.assign({}, config, overrideConfig)),
- argv,
- pipe,
- testWatcher,
- results => {
- isRunning = false;
- /* eslint-disable max-len */
- const messages = [
- '\n' + chalk.bold('Watch Usage'),
- argv.watch ?
- chalk.dim(' \u203A Press ') + 'a' + chalk.dim(' to run all tests.') :
- null,
- (argv.watchAll || argv._) && !argv.noSCM ?
- chalk.dim(' \u203A Press ') + 'o' + chalk.dim(' to only run tests related to changed files.') :
- null,
- results.snapshot.failure ?
- chalk.dim(' \u203A Press ') + 'u' + chalk.dim(' to update failing snapshots.') :
- null,
- chalk.dim(' \u203A Press ') + 'p' + chalk.dim(' to filter by a filename regex pattern.'),
- chalk.dim(' \u203A Press ') + 'q' + chalk.dim(' to quit watch mode.'),
- chalk.dim(' \u203A Press ') + 'Enter' + chalk.dim(' to trigger a test run.')];
-
- /* eslint-enable max-len */
- console.log(messages.filter(message => !!message).join('\n'));
- }).
- then(
- () => {},
- error => console.error(chalk.red(error.stack)));
-
- };
-
- const onKeypress = key => {
- if (key === KEYS.CONTROL_C || key === KEYS.CONTROL_D) {
- process.exit(0);
- return;
- }
- if (isEnteringPattern) {
- switch (key) {
- case KEYS.ENTER:
- isEnteringPattern = false;
- setWatchMode(argv, 'watch', {
- pattern: [currentPattern] });
-
- startRun();
- break;
- case KEYS.ESCAPE:
- isEnteringPattern = false;
- pipe.write(ansiEscapes.eraseLines(2));
- currentPattern = argv._[0];
- break;
- default:
- const char = new Buffer(key, 'hex').toString();
- currentPattern = key === KEYS.BACKSPACE ?
- currentPattern.slice(0, -1) :
- currentPattern + char;
- writeCurrentPattern();
- break;}
-
- return;
- }
-
- // Abort test run
- if (
- isRunning &&
- testWatcher &&
- [KEYS.Q, KEYS.ENTER, KEYS.A, KEYS.O, KEYS.P].includes(key))
- {
- testWatcher.setState({ interrupted: true });
- return;
- }
-
- switch (key) {
- case KEYS.Q:
- process.exit(0);
- return;
- case KEYS.ENTER:
- startRun();
- break;
- case KEYS.U:
- startRun({ updateSnapshot: true });
- break;
- case KEYS.A:
- setWatchMode(argv, 'watchAll');
- startRun();
- break;
- case KEYS.O:
- setWatchMode(argv, 'watch');
- startRun();
- break;
- case KEYS.P:
- isEnteringPattern = true;
- currentPattern = '';
- pipe.write('\n');
- writeCurrentPattern();
- break;}
-
- };
-
- const onFileChange = (_, filePath) => {
- filePath = path.join(root, filePath);
- const coverageDirectory =
- config.coverageDirectory ||
- path.resolve(config.rootDir, 'coverage');
- const isValidPath =
- config.testPathDirs.some(dir => filePath.startsWith(dir)) &&
- !filePath.includes(coverageDirectory);
-
- if (!isValidPath) {
- return;
- }
- if (timer) {
- clearTimeout(timer);
- timer = null;
- }
- if (testWatcher && testWatcher.isInterrupted()) {
- return;
- }
- timer = setTimeout(startRun, WATCHER_DEBOUNCE);
- };
-
- if (typeof process.stdin.setRawMode === 'function') {
- process.stdin.setRawMode(true);
- process.stdin.resume();
- process.stdin.setEncoding('hex');
- process.stdin.on('data', onKeypress);
- }
- const callback = watcher => {
- watcher.on('error', error => {
- watcher.close();
- getWatcher(config, root, callback, { useWatchman: false });
- });
- watcher.on('all', onFileChange);
- };
- getWatcher(config, root, callback, { useWatchman: true });
- startRun();
- return Promise.resolve();
- } else {
- preRunMessage.print(pipe);
- const testWatcher = new TestWatcher({ isWatchMode: false });
- return runJest(config, argv, pipe, testWatcher, onComplete);
- }
- }).
- catch(error => {
- clearLine(process.stderr);
- clearLine(process.stdout);
- console.error(chalk.red(error.stack));
- process.exit(1);
- });
-};
-
-module.exports = {
- SearchSource,
- TestRunner,
- getVersion: () => VERSION,
- run,
- runCLI };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/lib/BufferedConsole.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/lib/BufferedConsole.js
deleted file mode 100644
index 6a6059fb4..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/lib/BufferedConsole.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-const Console = require('console').Console;
-
-const callsites = require('callsites');
-const format = require('util').format;
-
-class BufferedConsole extends Console {
-
-
-
- constructor() {
- const buffer = [];
- super({ write: message => BufferedConsole.write(buffer, 'log', message) });
- this._buffer = buffer;
- }
-
- static write(
- buffer,
- type,
- message,
- level)
- {
- const call = callsites()[level != null ? level : 2];
- const origin = call.getFileName() + ':' + call.getLineNumber();
- buffer.push({ message, origin, type });
- return buffer;
- }
-
- log() {
- BufferedConsole.write(this._buffer, 'log', format.apply(null, arguments));
- }
-
- info() {
- BufferedConsole.write(this._buffer, 'info', format.apply(null, arguments));
- }
-
- warn() {
- BufferedConsole.write(this._buffer, 'warn', format.apply(null, arguments));
- }
-
- error() {
- BufferedConsole.write(this._buffer, 'error', format.apply(null, arguments));
- }
-
- getBuffer() {
- return this._buffer;
- }}
-
-
-
-module.exports = BufferedConsole;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/lib/formatTestResults.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/lib/formatTestResults.js
deleted file mode 100644
index 4d0088a8e..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/lib/formatTestResults.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-
-
-
-
-
-
-
-const formatResult = (
-testResult,
-config,
-codeCoverageFormatter,
-reporter) =>
-{
- const output = {
- message: '',
- name: testResult.testFilePath,
- summary: '' };
-
-
- if (testResult.testExecError) {
- const currTime = Date.now();
- output.status = 'failed';
- output.message = testResult.testExecError;
- output.startTime = currTime;
- output.endTime = currTime;
- output.coverage = {};
- } else {
- const allTestsPassed = testResult.numFailingTests === 0;
- output.status = allTestsPassed ? 'passed' : 'failed';
- output.startTime = testResult.perfStats.start;
- output.endTime = testResult.perfStats.end;
- output.coverage = codeCoverageFormatter(testResult.coverage, reporter);
- }
-
- output.assertionResults = testResult.testResults.map(formatTestAssertion);
-
- if (testResult.failureMessage) {
- output.message = testResult.failureMessage;
- }
-
- return output;
-};
-
-function formatTestAssertion(
-assertion)
-{
- const result = {
- status: assertion.status,
- title: assertion.title };
-
- if (assertion.failureMessages) {
- result.failureMessages = assertion.failureMessages;
- }
- return result;
-}
-
-function formatTestResults(
-results,
-config,
-codeCoverageFormatter,
-reporter)
-{
- const formatter = codeCoverageFormatter || (coverage => coverage);
-
- const testResults = results.testResults.map(testResult => formatResult(
- testResult,
- config,
- formatter,
- reporter));
-
-
- return {
- numFailedTests: results.numFailedTests,
- numPassedTests: results.numPassedTests,
- numPendingTests: results.numPendingTests,
- numRuntimeErrorTestSuites: results.numRuntimeErrorTestSuites,
- numTotalTestSuites: results.numTotalTestSuites,
- numTotalTests: results.numTotalTests,
- startTime: results.startTime,
- success: results.success,
- testResults };
-
-}
-
-module.exports = formatTestResults;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/lib/promisify.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/lib/promisify.js
deleted file mode 100644
index 21d20cfe9..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/lib/promisify.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-'use strict';
-
-module.exports = function promisify(fn) {
- return function () {
- const args = Array.prototype.slice.call(arguments);
- return new Promise((resolve, reject) => {
- args.push((err, res) => {
- if (err) {
- reject(err);
- } else {
- resolve(res);
- }
- });
-
- fn.apply(this, args);
- });
- };
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/preRunMessage.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/preRunMessage.js
deleted file mode 100644
index 77f18bca3..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/preRunMessage.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';var _require =
-
-require('jest-util');const clearLine = _require.clearLine;
-const chalk = require('chalk');
-const isCI = require('is-ci');
-
-const print = stream => {
- if (process.stdout.isTTY && !isCI) {
- stream.write(chalk.bold.dim('Determining test suites to run...'));
- }
-};
-
-const remove = stream => {
- if (stream.isTTY && !isCI) {
- clearLine(stream);
- }
-};
-
-module.exports = {
- print,
- remove };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/BaseReporter.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/BaseReporter.js
deleted file mode 100644
index dfc9cfeac..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/BaseReporter.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-const preRunMessage = require('../preRunMessage');
-
-class BaseReporter {
-
-
- log(message) {
- process.stderr.write(message + '\n');
- }
-
- onRunStart(
- config,
- results,
- runnerContext,
- options)
- {
- preRunMessage.remove(process.stderr);
- }
-
- onTestResult(
- config,
- testResult,
- results)
- {}
-
- onTestStart(
- config,
- path,
- runnerContext)
- {}
-
- onRunComplete(
- config,
- aggregatedResults,
- runnerContext)
- {}
-
- _setError(error) {
- this._error = error;
- }
-
- // Return an error that occured during reporting. This error will
- // define whether the test run was successful or failed.
- getLastError() {
- return this._error;
- }}
-
-
-module.exports = BaseReporter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/CoverageReporter.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/CoverageReporter.js
deleted file mode 100644
index 3854061e0..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/CoverageReporter.js
+++ /dev/null
@@ -1,177 +0,0 @@
-/**
-* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
-*
-* This source code is licensed under the BSD-style license found in the
-* LICENSE file in the root directory of this source tree. An additional grant
-* of patent rights can be found in the PATENTS file in the same directory.
-*
-*
-*/
-'use strict';
-
-
-
-
-
-
-
-
-
-
-
-
-const BaseReporter = require('./BaseReporter');var _require =
-
-require('jest-util');const clearLine = _require.clearLine;var _require2 =
-require('istanbul-api');const createReporter = _require2.createReporter;
-const chalk = require('chalk');
-const fs = require('fs');
-const generateEmptyCoverage = require('../generateEmptyCoverage');
-const isCI = require('is-ci');
-const istanbulCoverage = require('istanbul-lib-coverage');
-
-const FAIL_COLOR = chalk.bold.red;
-const RUNNING_TEST_COLOR = chalk.bold.dim;
-
-const isInteractive = process.stdout.isTTY && !isCI;
-
-class CoverageReporter extends BaseReporter {
-
-
- constructor() {
- super();
- this._coverageMap = istanbulCoverage.createCoverageMap({});
- }
-
- onTestResult(
- config,
- testResult,
- aggregatedResults)
- {
- if (testResult.coverage) {
- this._coverageMap.merge(testResult.coverage);
- }
- }
-
- onRunComplete(
- config,
- aggregatedResults,
- runnerContext)
- {
- this._addUntestedFiles(config, runnerContext);
- const reporter = createReporter();
- try {
- if (config.coverageDirectory) {
- reporter.dir = config.coverageDirectory;
- }
-
- let coverageReporters = config.coverageReporters || [];
- if (
- !config.useStderr &&
- coverageReporters.length &&
- coverageReporters.indexOf('text') === -1)
- {
- coverageReporters = coverageReporters.concat(['text-summary']);
- }
-
- reporter.addAll(coverageReporters);
- reporter.write(this._coverageMap);
- } catch (e) {
- console.error(chalk.red(`
- Failed to write coverage reports:
- ERROR: ${ e.toString() }
- STACK: ${ e.stack }
- `));
- }
-
- this._checkThreshold(config);
- }
-
- _addUntestedFiles(config, runnerContext) {
- if (config.collectCoverageFrom && config.collectCoverageFrom.length) {
- if (isInteractive) {
- process.stderr.write(RUNNING_TEST_COLOR(
- 'Running coverage on untested files...'));
-
- }
- const files = runnerContext.hasteFS.matchFilesWithGlob(
- config.collectCoverageFrom,
- config.rootDir);
-
-
- files.forEach(filename => {
- if (!this._coverageMap.data[filename]) {
- try {
- const source = fs.readFileSync(filename).toString();
- const coverage = generateEmptyCoverage(source, filename, config);
- if (coverage) {
- this._coverageMap.addFileCoverage(coverage);
- }
- } catch (e) {
- console.error(chalk.red(`
- Failed to collect coverage from ${ filename }
- ERROR: ${ e }
- STACK: ${ e.stack }
- `));
- }
- }
- });
- if (isInteractive) {
- clearLine(process.stderr);
- }
- }
- }
-
- _checkThreshold(config) {
- if (config.coverageThreshold) {
- const results = this._coverageMap.getCoverageSummary().toJSON();
-
- function check(name, thresholds, actuals) {
- return [
- 'statements',
- 'branches',
- 'lines',
- 'functions'].
- reduce((errors, key) => {
- const actual = actuals[key].pct;
- const actualUncovered = actuals[key].total - actuals[key].covered;
- const threshold = thresholds[key];
-
- if (threshold != null) {
- if (threshold < 0) {
- if (threshold * -1 < actualUncovered) {
- errors.push(
- `Jest: Uncovered count for ${ key } (${ actualUncovered })` +
- `exceeds ${ name } threshold (${ -1 * threshold })`);
-
- }
- } else if (actual < threshold) {
- errors.push(
- `Jest: Coverage for ${ key } (${ actual }` +
- `%) does not meet ${ name } threshold (${ threshold }%)`);
-
- }
- }
- return errors;
- }, []);
- }
- const errors = check(
- 'global',
- config.coverageThreshold.global,
- results);
-
-
- if (errors.length > 0) {
- this.log(`${ FAIL_COLOR(errors.join('\n')) }`);
- this._setError(new Error(errors.join('\n')));
- }
- }
- }
-
- // Only exposed for the internal runner. Should not be used
- getCoverageMap() {
- return this._coverageMap;
- }}
-
-
-module.exports = CoverageReporter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/DefaultReporter.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/DefaultReporter.js
deleted file mode 100644
index b4ec29c29..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/DefaultReporter.js
+++ /dev/null
@@ -1,168 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-/* global stream$Writable, tty$WriteStream */
-
-'use strict';
-
-
-
-
-
-const BaseReporter = require('./BaseReporter');
-const Status = require('./Status');var _require =
-
-require('jest-util');const clearLine = _require.clearLine;
-const chalk = require('chalk');
-const getConsoleOutput = require('./getConsoleOutput');
-const getResultHeader = require('./getResultHeader');
-const isCI = require('is-ci');
-
-
-
-const TITLE_BULLET = chalk.bold('\u25cf ');
-
-const isInteractive = process.stdin.isTTY && !isCI;
-
-class DefaultReporter extends BaseReporter {
- // ANSI clear sequence for the last printed status
-
-
-
-
-
-
-
- constructor() {
- super();
- this._clear = '';
- this._out = process.stdout.write.bind(process.stdout);
- this._err = process.stderr.write.bind(process.stderr);
- this._status = new Status();
- this._wrapStdio(process.stdout);
- this._wrapStdio(process.stderr);
- this._status.onChange(() => {
- this._clearStatus();
- this._printStatus();
- });
- }
-
- _wrapStdio(stream) {
- const originalWrite = stream.write;
-
- let buffer = [];
- let timeout = null;
-
- const doFlush = () => {
- const string = buffer.join('');
- buffer = [];
- // This is to avoid conflicts between random output and status text
- this._clearStatus();
- originalWrite.call(stream, string);
- this._printStatus();
- };
-
- const flush = () => {
- // If the process blows up no errors would be printed.
- // There should be a smart way to buffer stderr, but for now
- // we just won't buffer it.
- if (stream === process.stderr) {
- doFlush();
- } else {
- if (!timeout) {
- timeout = setTimeout(() => {
- doFlush();
- timeout = null;
- }, 100);
- }
- }
- };
-
- // $FlowFixMe
- stream.write = chunk => {
- buffer.push(chunk);
- flush();
- return true;
- };
- }
-
- _clearStatus() {
- if (isInteractive) {
- this._out(this._clear);
- }
- }
-
- _printStatus() {var _status$get =
- this._status.get();const content = _status$get.content,clear = _status$get.clear;
- this._clear = clear;
- if (isInteractive) {
- this._out(content);
- }
- }
-
- onRunStart(
- config,
- aggregatedResults,
- runnerContext,
- options)
- {
- this._status.runStarted(aggregatedResults, options);
- }
-
- onTestStart(config, testPath) {
- this._status.testStarted(testPath, config);
- }
-
- onRunComplete() {
- this._status.runFinished();
- // $FlowFixMe
- process.stdout.write = this._out;
- // $FlowFixMe
- process.stderr.write = this._err;
- clearLine(process.stderr);
- }
-
- onTestResult(
- config,
- testResult,
- aggregatedResults)
- {
- this._status.testFinished(config, testResult, aggregatedResults);
- this._printTestFileSummary(testResult.testFilePath, config, testResult);
- }
-
- _printTestFileSummary(
- testPath,
- config,
- result)
- {
- if (!result.skipped) {
- this.log(getResultHeader(result, config));
-
- const consoleBuffer = result.console;
- if (consoleBuffer && consoleBuffer.length) {
- this.log(
- ' ' + TITLE_BULLET + 'Console\n\n' +
- getConsoleOutput(
- config.rootDir,
- !!config.verbose,
- consoleBuffer));
-
-
- }
-
- if (result.failureMessage) {
- this.log(result.failureMessage);
- }
- }
- }}
-
-
-module.exports = DefaultReporter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/NotifyReporter.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/NotifyReporter.js
deleted file mode 100644
index e831e790a..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/NotifyReporter.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
-* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
-*
-* This source code is licensed under the BSD-style license found in the
-* LICENSE file in the root directory of this source tree. An additional grant
-* of patent rights can be found in the PATENTS file in the same directory.
-*
-*
-*/
-'use strict';
-
-
-
-
-const BaseReporter = require('./BaseReporter');
-const notifier = require('node-notifier');
-const path = require('path');
-const util = require('util');
-
-const isDarwin = process.platform === 'darwin';
-
-const icon = path.resolve(__dirname, '../assets/jest_logo.png');
-
-class NotifyReporter extends BaseReporter {
- onRunComplete(config, result) {
- let title;
- let message;
- const success = result.numFailedTests === 0 &&
- result.numRuntimeErrorTestSuites === 0;
-
- if (success) {
- title = util.format('%d%% Passed', 100);
- message = util.format(
- (isDarwin ? '\u2705 ' : '') + '%d tests passed',
- result.numPassedTests);
-
- } else {
- title = util.format(
- '%d%% Failed',
- Math.ceil(result.numFailedTests / result.numTotalTests * 100));
-
- message = util.format(
- (isDarwin ? '\u26D4\uFE0F ' : '') + '%d of %d tests failed',
- result.numFailedTests,
- result.numTotalTests);
-
- }
-
- notifier.notify({ icon, message, title });
- }}
-
-
-module.exports = NotifyReporter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/Status.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/Status.js
deleted file mode 100644
index e4bd64561..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/Status.js
+++ /dev/null
@@ -1,200 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';var _require =
-
-
-
-
-
-require('./utils');const getSummary = _require.getSummary,trimAndFormatPath = _require.trimAndFormatPath,wrapAnsiString = _require.wrapAnsiString;
-const chalk = require('chalk');
-
-const RUNNING_TEXT = ' RUNS ';
-const RUNNING = chalk.reset.inverse.yellow.bold(RUNNING_TEXT) + ' ';
-
-/**
- * This class is a perf optimization for sorting the list of currently
- * running tests. It tries to keep tests in the same positions without
- * shifting the whole list.
- */
-class CurrentTestList {
-
-
- constructor() {
- this._array = [];
- }
-
- add(testPath, config) {
- const index = this._array.indexOf(null);
- const record = { config, testPath };
- if (index !== -1) {
- this._array[index] = record;
- } else {
- this._array.push(record);
- }
- }
-
- delete(testPath) {
- const record = this._array.find(
- record => record && record.testPath === testPath);
-
- this._array[this._array.indexOf(record || null)] = null;
- }
-
- get() {
- return this._array;
- }}
-
-
-/**
- * A class that generates the CLI status of currently running tests
- * and also provides an ANSI escape sequence to remove status lines
- * from the terminal.
- */
-class Status {
-
-
-
-
-
-
-
-
-
-
-
-
- constructor() {
- this._cache = null;
- this._currentTests = new CurrentTestList();
- this._done = false;
- this._emitScheduled = false;
- this._estimatedTime = 0;
- this._height = 0;
- this._showStatus = false;
- }
-
- onChange(callback) {
- this._callback = callback;
- }
-
- runStarted(
- aggregatedResults,
- options)
- {
- this._estimatedTime = options && options.estimatedTime || 0;
- this._showStatus = options && options.showStatus;
- this._interval = setInterval(() => this._tick(), 1000);
- this._aggregatedResults = aggregatedResults;
- this._debouncedEmit();
- }
-
- runFinished() {
- this._done = true;
- clearInterval(this._interval);
- this._emit();
- }
-
- testStarted(testPath, config) {
- this._currentTests.add(testPath, config);
- if (!this._showStatus) {
- this._emit();
- } else {
- this._debouncedEmit();
- }
- }
-
- testFinished(
- config,
- testResult,
- aggregatedResults)
- {const
- testFilePath = testResult.testFilePath;
- this._aggregatedResults = aggregatedResults;
- this._currentTests.delete(testFilePath);
- this._debouncedEmit();
- }
-
- get() {
- if (this._cache) {
- return this._cache;
- }
-
- if (this._done) {
- return { clear: '', content: '' };
- }
-
- // $FlowFixMe
- const width = process.stdout.columns;
- let content = '\n';
- this._currentTests.get().forEach(record => {
- if (record) {const
- config = record.config,testPath = record.testPath;
- content += wrapAnsiString(
- RUNNING + trimAndFormatPath(
- RUNNING_TEXT.length + 1,
- config,
- testPath,
- width),
-
- width) +
- '\n';
- }
- });
-
- if (this._showStatus && this._aggregatedResults) {
- content += '\n' + getSummary(
- this._aggregatedResults,
- {
- estimatedTime: this._estimatedTime,
- roundTime: true,
- width });
-
-
- }
-
- let height = 0;
-
- for (let i = 0; i < content.length; i++) {
- if (content[i] === '\n') {
- height++;
- }
- }
-
- const clear = '\r\x1B[K\r\x1B[1A'.repeat(height);
- return this._cache = { clear, content };
- }
-
- _emit() {
- this._cache = null;
- this._lastUpdated = Date.now();
- this._callback();
- }
-
- _debouncedEmit() {
- if (!this._emitScheduled) {
- // Perf optimization to avoid two separate renders When
- // one test finishes and another test starts executing.
- this._emitScheduled = true;
- setTimeout(() => {
- this._emit();
- this._emitScheduled = false;
- }, 100);
- }
- }
-
- _tick() {
- this._debouncedEmit();
- }}
-
-
-
-module.exports = Status;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/SummaryReporter.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/SummaryReporter.js
deleted file mode 100644
index e0493f29f..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/SummaryReporter.js
+++ /dev/null
@@ -1,222 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-const BaseReporter = require('./BaseReporter');var _require =
-
-require('./utils');const getSummary = _require.getSummary,pluralize = _require.pluralize;
-const chalk = require('chalk');
-const getResultHeader = require('./getResultHeader');
-
-const ARROW = ' \u203A ';
-const FAIL_COLOR = chalk.bold.red;
-const SNAPSHOT_ADDED = chalk.bold.green;
-const SNAPSHOT_NOTE = chalk.dim;
-const SNAPSHOT_REMOVED = chalk.bold.red;
-const SNAPSHOT_SUMMARY = chalk.bold;
-const SNAPSHOT_UPDATED = chalk.bold.green;
-const TEST_SUMMARY_THRESHOLD = 20;
-
-const NPM_EVENTS = new Set([
-'prepublish',
-'publish',
-'postpublish',
-'preinstall',
-'install',
-'postinstall',
-'preuninstall',
-'uninstall',
-'postuninstall',
-'preversion',
-'version',
-'postversion',
-'pretest',
-'test',
-'posttest',
-'prestop',
-'stop',
-'poststop',
-'prestart',
-'start',
-'poststart',
-'prerestart',
-'restart',
-'postrestart']);
-
-
-class SummareReporter extends BaseReporter {
-
-
-
- constructor() {
- super();
- this._estimatedTime = 0;
- }
-
- // If we write more than one character at a time it is possible that
- // Node.js exits in the middle of printing the result. This was first observed
- // in Node.js 0.10 and still persists in Node.js 6.7+.
- // Let's print the test failure summary character by character which is safer
- // when hundreds of tests are failing.
- _write(string) {
- for (let i = 0; i < string.length; i++) {
- process.stderr.write(string.charAt(i));
- }
- }
-
- onRunStart(
- config,
- aggregatedResults,
- runnerContext,
- options)
- {
- super.onRunStart(config, aggregatedResults, runnerContext, options);
- this._estimatedTime = options.estimatedTime;
- }
-
- onRunComplete(
- config,
- aggregatedResults,
- runnerContext)
- {const
- numTotalTestSuites = aggregatedResults.numTotalTestSuites,testResults = aggregatedResults.testResults,wasInterrupted = aggregatedResults.wasInterrupted;
- if (numTotalTestSuites) {
- const lastResult = testResults[testResults.length - 1];
- // Print a newline if the last test did not fail to line up newlines
- // similar to when an error would have been thrown in the test.
- if (
- !config.verbose &&
- lastResult &&
- !lastResult.numFailingTests &&
- !lastResult.testExecError)
- {
- this.log('');
- }
-
- this._printSummary(aggregatedResults, config);
- this._printSnapshotSummary(aggregatedResults.snapshot, config);
-
- if (numTotalTestSuites) {
- const testSummary = wasInterrupted ?
- chalk.bold.red('Test run was interrupted.') :
- runnerContext.getTestSummary();
- this.log(
- getSummary(aggregatedResults, {
- estimatedTime: this._estimatedTime }) +
- '\n' + testSummary);
-
- }
- }
- }
-
- _printSnapshotSummary(snapshots, config) {
- if (
- snapshots.added ||
- snapshots.filesRemoved ||
- snapshots.unchecked ||
- snapshots.unmatched ||
- snapshots.updated)
- {
- let updateCommand;
- const event = process.env.npm_lifecycle_event;
- const prefix = NPM_EVENTS.has(event) ? '' : 'run ';
- if (config.watch) {
- updateCommand = 'press `u`';
- } else if (event) {
- updateCommand = `run with \`npm ${ prefix + event } -- -u\``;
- } else {
- updateCommand = 're-run with `-u`';
- }
-
- this.log(SNAPSHOT_SUMMARY('Snapshot Summary'));
- if (snapshots.added) {
- this.log(
- SNAPSHOT_ADDED(ARROW + pluralize('snapshot', snapshots.added)) +
- ` written in ${ pluralize('test suite', snapshots.filesAdded) }.`);
-
- }
-
- if (snapshots.unmatched) {
- this.log(
- FAIL_COLOR(ARROW + pluralize('snapshot test', snapshots.unmatched)) +
- ` failed in ${ pluralize('test suite', snapshots.filesUnmatched) }. ` +
- SNAPSHOT_NOTE(
- 'Inspect your code changes or ' +
- updateCommand + ' to update them.'));
-
-
- }
-
- if (snapshots.updated) {
- this.log(
- SNAPSHOT_UPDATED(ARROW + pluralize('snapshot', snapshots.updated)) +
- ` updated in ${ pluralize('test suite', snapshots.filesUpdated) }.`);
-
- }
-
- if (snapshots.filesRemoved) {
- this.log(
- SNAPSHOT_REMOVED(ARROW + pluralize(
- 'obsolete snapshot file',
- snapshots.filesRemoved)) + (
-
- snapshots.didUpdate ?
- ' removed.' :
- ' found, ' + updateCommand + ' to remove ' + (
- snapshots.filesRemoved === 1 ? 'it' : 'them.') + '.'));
-
- }
-
- if (snapshots.unchecked) {
- this.log(
- FAIL_COLOR(ARROW + pluralize(
- 'obsolete snapshot',
- snapshots.unchecked)) + (
-
- snapshots.didUpdate ?
- ' removed.' :
- ' found, ' + updateCommand + ' to remove ' + (
- snapshots.filesRemoved === 1 ? 'it' : 'them') + '.'));
-
- }
-
- this.log(''); // print empty line
- }
- }
-
- _printSummary(aggregatedResults, config) {
- // If there were any failing tests and there was a large number of tests
- // executed, re-print the failing results at the end of execution output.
- const failedTests = aggregatedResults.numFailedTests;
- const runtimeErrors = aggregatedResults.numRuntimeErrorTestSuites;
- if (
- failedTests + runtimeErrors > 0 &&
- aggregatedResults.numTotalTestSuites > TEST_SUMMARY_THRESHOLD)
- {
- this.log(chalk.bold('Summary of all failing tests'));
- aggregatedResults.testResults.forEach(testResult => {const
- failureMessage = testResult.failureMessage;
- if (failureMessage) {
- this._write(
- getResultHeader(testResult, config) + '\n' +
- failureMessage + '\n');
-
- }
- });
- this.log(''); // print empty line
- }
- }}
-
-
-module.exports = SummareReporter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/VerboseReporter.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/VerboseReporter.js
deleted file mode 100644
index 00c51386a..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/VerboseReporter.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-
-
-
-
-const DefaultReporter = require('./DefaultReporter');
-const chalk = require('chalk');
-const isWindows = process.platform === 'win32';
-
-class VerboseReporter extends DefaultReporter {
-
- static groupTestsBySuites(testResults) {
- const root = { suites: [], tests: [], title: '' };
- testResults.forEach(testResult => {
- let targetSuite = root;
-
- // Find the target suite for this test,
- // creating nested suites as necessary.
- for (const title of testResult.ancestorTitles) {
- let matchingSuite = targetSuite.suites.find(s => s.title === title);
- if (!matchingSuite) {
- matchingSuite = { suites: [], tests: [], title };
- targetSuite.suites.push(matchingSuite);
- }
- targetSuite = matchingSuite;
- }
-
- targetSuite.tests.push(testResult);
- });
- return root;
- }
-
- onTestResult(
- config,
- result,
- aggregatedResults)
- {
- super.onTestResult(config, result, aggregatedResults);
- if (!result.testExecError && !result.skipped) {
- this._logTestResults(result.testResults);
- }
- }
-
- _logTestResults(testResults) {
- this._logSuite(VerboseReporter.groupTestsBySuites(testResults), 0);
- this._logLine();
- }
-
- _logSuite(suite, indentLevel) {
- if (suite.title) {
- this._logLine(suite.title, indentLevel);
- }
-
- suite.tests.forEach(test => this._logTest(test, indentLevel + 1));
- suite.suites.forEach(suite => this._logSuite(suite, indentLevel + 1));
- }
-
- _getIcon(status) {
- if (status === 'failed') {
- return chalk.red(isWindows ? '\u00D7' : '\u2715');
- } else if (status === 'pending') {
- return chalk.yellow('\u25CB');
- } else {
- return chalk.green(isWindows ? '\u221A' : '\u2713');
- }
- }
-
- _logTest(test, indentLevel) {
- const status = this._getIcon(test.status);
- const time = test.duration ?
- ` (${ test.duration.toFixed(0) }ms)` :
- '';
- this._logLine(status + ' ' + chalk.dim(test.title + time), indentLevel);
- }
-
- _logLine(str, indentLevel) {
- const indentation = ' '.repeat(indentLevel || 0);
- this.log(indentation + (str || ''));
- }}
-
-
-
-module.exports = VerboseReporter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/getConsoleOutput.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/getConsoleOutput.js
deleted file mode 100644
index 15d43eaf2..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/getConsoleOutput.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-const chalk = require('chalk');
-const path = require('path');
-
-module.exports = (root, verbose, buffer) => {
- const TITLE_INDENT = verbose ? ' ' : ' ';
- const CONSOLE_INDENT = TITLE_INDENT + ' ';
-
- return buffer.reduce((output, _ref) => {let type = _ref.type,message = _ref.message,origin = _ref.origin;
- origin = path.relative(root, origin);
- message = message.
- split(/\n/).
- map(line => CONSOLE_INDENT + line).
- join('\n');
-
- let typeMessage = 'console.' + type;
- if (type === 'warn') {
- message = chalk.yellow(message);
- typeMessage = chalk.yellow(typeMessage);
- } else if (type === 'error') {
- message = chalk.red(message);
- typeMessage = chalk.red(typeMessage);
- }
-
- return (
- output + TITLE_INDENT + chalk.dim(typeMessage) +
- ' ' + chalk.dim(origin) + '\n' + message + '\n');
-
- }, '');
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/getResultHeader.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/getResultHeader.js
deleted file mode 100644
index 1645fac5c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/getResultHeader.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';var _require =
-
-
-
-
-require('./utils');const formatTestPath = _require.formatTestPath;
-const chalk = require('chalk');
-
-const LONG_TEST_COLOR = chalk.reset.bold.bgRed;
-// Explicitly reset for these messages since they can get written out in the
-// middle of error logging
-const FAIL = chalk.reset.inverse.bold.red(' FAIL ');
-const PASS = chalk.reset.inverse.bold.green(' PASS ');
-
-module.exports = (result, config) => {
- const testPath = result.testFilePath;
- const status = result.numFailingTests > 0 || result.testExecError ?
- FAIL :
- PASS;
-
- const runTime = result.perfStats ?
- (result.perfStats.end - result.perfStats.start) / 1000 :
- null;
-
- const testDetail = [];
- if (runTime !== null && runTime > 5) {
- testDetail.push(LONG_TEST_COLOR(runTime + 's'));
- }
-
- if (result.memoryUsage) {
- const toMB = bytes => Math.floor(bytes / 1024 / 1024);
- testDetail.push(`${ toMB(result.memoryUsage) } MB heap size`);
- }
-
- return (
- `${ status } ${ formatTestPath(config, testPath) }` + (
- testDetail.length ? ` (${ testDetail.join(', ') })` : ''));
-
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/utils.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/utils.js
deleted file mode 100644
index 37c5611b0..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/reporters/utils.js
+++ /dev/null
@@ -1,262 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();
-
-
-
-
-const chalk = require('chalk');
-const path = require('path');
-
-
-
-
-
-
-
-const PROGRESS_BAR_WIDTH = 40;
-
-const trimAndFormatPath = (
-pad,
-config,
-testPath,
-columns) =>
-{
- const maxLength = columns - pad;
- const relative = relativePath(config, testPath);const
- basename = relative.basename;let
- dirname = relative.dirname;
-
- // length is ok
- if ((dirname + path.sep + basename).length <= maxLength) {
- return chalk.dim(dirname + path.sep) + chalk.bold(basename);
- }
-
- // we can fit trimmed dirname and full basename
- const basenameLength = basename.length;
- if (basenameLength + 4 < maxLength) {
- const dirnameLength = maxLength - 4 - basenameLength;
- dirname = '...' +
- dirname.slice(dirname.length - dirnameLength, dirname.length);
- return chalk.dim(dirname + path.sep) + chalk.bold(basename);
- }
-
- if (basenameLength + 4 === maxLength) {
- return chalk.dim('...' + path.sep) + chalk.bold(basename);
- }
-
- // can't fit dirname, but can fit trimmed basename
- return chalk.bold(
- '...' +
- basename.slice(basename.length - maxLength - 4, basename.length));
-
-};
-
-const formatTestPath = (config, testPath) => {var _relativePath =
- relativePath(config, testPath);const dirname = _relativePath.dirname,basename = _relativePath.basename;
- return chalk.dim(dirname + path.sep) + chalk.bold(basename);
-};
-
-const relativePath = (config, testPath) => {
- testPath = path.relative(config.rootDir, testPath);
- const dirname = path.dirname(testPath);
- const basename = path.basename(testPath);
- return { basename, dirname };
-};
-
-const pluralize = (word, count) =>
-`${ count } ${ word }${ count === 1 ? '' : 's' }`;
-
-const getSummary = (
-aggregatedResults,
-options) =>
-{
- let runTime = (Date.now() - aggregatedResults.startTime) / 1000;
- if (options && options.roundTime) {
- runTime = Math.floor(runTime);
- }
-
- const estimatedTime = options && options.estimatedTime || 0;
- const snapshotResults = aggregatedResults.snapshot;
- const snapshotsAdded = snapshotResults.added;
- const snapshotsFailed = snapshotResults.unmatched;
- const snapshotsPassed = snapshotResults.matched;
- const snapshotsTotal = snapshotResults.total;
- const snapshotsUpdated = snapshotResults.updated;
- const suitesFailed = aggregatedResults.numFailedTestSuites;
- const suitesPassed = aggregatedResults.numPassedTestSuites;
- const suitesPending = aggregatedResults.numPendingTestSuites;
- const suitesRun = suitesFailed + suitesPassed;
- const suitesTotal = aggregatedResults.numTotalTestSuites;
- const testsFailed = aggregatedResults.numFailedTests;
- const testsPassed = aggregatedResults.numPassedTests;
- const testsPending = aggregatedResults.numPendingTests;
- const testsTotal = aggregatedResults.numTotalTests;
- const width = options && options.width || 0;
-
- const suites =
- chalk.bold('Test Suites: ') + (
- suitesFailed ? chalk.bold.red(`${ suitesFailed } failed`) + ', ' : '') + (
- suitesPending ?
- chalk.bold.yellow(`${ suitesPending } skipped`) + ', ' :
- '') + (
-
- suitesPassed ?
- chalk.bold.green(`${ suitesPassed } passed`) + ', ' :
- '') + (
-
- suitesRun !== suitesTotal ?
- suitesRun + ' of ' + suitesTotal :
- suitesTotal) +
- ` total`;
-
- const tests =
- chalk.bold('Tests: ') + (
- testsFailed ? chalk.bold.red(`${ testsFailed } failed`) + ', ' : '') + (
- testsPending ?
- chalk.bold.yellow(`${ testsPending } skipped`) + ', ' :
- '') + (
-
- testsPassed ?
- chalk.bold.green(`${ testsPassed } passed`) + ', ' :
- '') +
-
- `${ testsTotal } total`;
-
- const snapshots =
- chalk.bold('Snapshots: ') + (
- snapshotsFailed ?
- chalk.bold.red(`${ snapshotsFailed } failed`) + ', ' :
- '') + (
-
- snapshotsUpdated ?
- chalk.bold.green(`${ snapshotsUpdated } updated`) + ', ' :
- '') + (
-
- snapshotsAdded ?
- chalk.bold.green(`${ snapshotsAdded } added`) + ', ' :
- '') + (
-
- snapshotsPassed ?
- chalk.bold.green(`${ snapshotsPassed } passed`) + ', ' :
- '') +
-
- `${ snapshotsTotal } total`;
-
- const time = renderTime(runTime, estimatedTime, width);
- return [suites, tests, snapshots, time].join('\n');
-};
-
-const renderTime = (
-runTime,
-estimatedTime,
-width) =>
-{
- // If we are more than one second over the estimated time, highlight it.
- const renderedTime = estimatedTime && runTime >= estimatedTime + 1 ?
- chalk.bold.yellow(runTime + 's') :
- runTime + 's';
- let time = chalk.bold(`Time:`) + ` ${ renderedTime }`;
- if (runTime < estimatedTime) {
- time += `, estimated ${ estimatedTime }s`;
- }
-
- // Only show a progress bar if the test run is actually going to take
- // some time.
- if (
- estimatedTime > 2 &&
- runTime < estimatedTime &&
- width)
- {
- const availableWidth = Math.min(PROGRESS_BAR_WIDTH, width);
- const length = Math.min(
- Math.floor(runTime / estimatedTime * availableWidth),
- availableWidth);
-
- if (availableWidth >= 2) {
- time +=
- '\n' +
- chalk.green.inverse(' ').repeat(length) +
- chalk.white.inverse(' ').repeat(availableWidth - length);
- }
- }
- return time;
-};
-
-// word-wrap a string that contains ANSI escape sequences.
-// ANSI escape sequences do not add to the string length.
-const wrapAnsiString = (string, terminalWidth) => {
- if (terminalWidth === 0) {
- // if the terminal width is zero, don't bother word-wrapping
- return string;
- }
-
- const ANSI_REGEXP = /[\u001b\u009b]\[\d{1,2}m/g;
- const tokens = [];
- let lastIndex = 0;
- let match;
-
- while (match = ANSI_REGEXP.exec(string)) {
- const ansi = match[0];
- const index = match['index'];
- if (index != lastIndex) {
- tokens.push(['string', string.slice(lastIndex, index)]);
- }
- tokens.push(['ansi', ansi]);
- lastIndex = index + ansi.length;
- }
-
- if (lastIndex != string.length - 1) {
- tokens.push(['string', string.slice(lastIndex, string.length)]);
- }
-
- let lastLineLength = 0;
-
- return tokens.reduce(
- (lines, _ref) => {var _ref2 = _slicedToArray(_ref, 2);let kind = _ref2[0],token = _ref2[1];
- if (kind === 'string') {
- if (lastLineLength + token.length > terminalWidth) {
-
- while (token.length) {
- const chunk = token.slice(0, terminalWidth - lastLineLength);
- const remaining = token.slice(
- terminalWidth - lastLineLength,
- token.length);
-
- lines[lines.length - 1] += chunk;
- lastLineLength += chunk.length;
- token = remaining;
- if (token.length) {
- lines.push('');
- lastLineLength = 0;
- }
- }
- } else {
- lines[lines.length - 1] += token;
- lastLineLength += token.length;
- }
- } else {
- lines[lines.length - 1] += token;
- }
-
- return lines;
- },
- ['']).
- join('\n');
-};
-
-module.exports = {
- formatTestPath,
- getSummary,
- pluralize,
- relativePath,
- trimAndFormatPath,
- wrapAnsiString };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/runTest.js b/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/runTest.js
deleted file mode 100644
index 20cf032fa..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/build/runTest.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-const BufferedConsole = require('./lib/BufferedConsole');
-const Console = require('jest-util').Console;
-const NullConsole = require('jest-util').NullConsole;
-
-const getConsoleOutput = require('./reporters/getConsoleOutput');
-
-function runTest(path, config, resolver) {
- /* $FlowFixMe */
- const TestEnvironment = require(config.testEnvironment);
- /* $FlowFixMe */
- const TestRunner = require(config.testRunner);
- /* $FlowFixMe */
- const ModuleLoader = require(config.moduleLoader || 'jest-runtime');
-
- const env = new TestEnvironment(config);
- const TestConsole =
- config.verbose ?
- Console :
- config.silent ?
- NullConsole :
- BufferedConsole;
-
- const testConsole = env.global.console = new TestConsole(
- config.useStderr ? process.stderr : process.stdout,
- process.stderr,
- (type, message) => getConsoleOutput(
- config.rootDir,
- !!config.verbose,
- // 4 = the console call is burried 4 stack frames deep
- BufferedConsole.write([], type, message, 4)));
-
-
- const runtime = new ModuleLoader(config, env, resolver);
- const start = Date.now();
- return TestRunner(config, env, runtime, path).
- then(result => {
- const testCount =
- result.numPassingTests +
- result.numFailingTests +
- result.numPendingTests;
- result.perfStats = { end: Date.now(), start };
- result.testFilePath = path;
- result.coverage = runtime.getAllCoverageInfo();
- result.console = testConsole.getBuffer();
- result.skipped = testCount === result.numPendingTests;
- return result;
- }).
- then(
- result => Promise.resolve().then(() => {
- env.dispose();
- if (config.logHeapUsage) {
- if (global.gc) {
- global.gc();
- }
- result.memoryUsage = process.memoryUsage().heapUsed;
- }
- return result;
- }),
- err => Promise.resolve().then(() => {
- env.dispose();
- throw err;
- }));
-
-}
-
-module.exports = runTest;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-cli/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-cli/package.json
deleted file mode 100644
index 44c0cd094..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-cli/package.json
+++ /dev/null
@@ -1,138 +0,0 @@
-{
- "_args": [
- [
- "jest-cli",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6"
- ]
- ],
- "_from": "jest-cli@latest",
- "_id": "jest-cli@17.0.3",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-cli",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-18-east.internal.npmjs.com",
- "tmp": "tmp/jest-cli-17.0.3.tgz_1479368471902_0.6936498954892159"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-cli",
- "raw": "jest-cli",
- "rawSpec": "",
- "scope": null,
- "spec": "latest",
- "type": "tag"
- },
- "_requiredBy": [
- "#DEV:/"
- ],
- "_resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-17.0.3.tgz",
- "_shasum": "700b8c02a9ea0ec9eab0cd5a9fd42d8a858ce146",
- "_shrinkwrap": null,
- "_spec": "jest-cli",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6",
- "bin": {
- "jest": "./bin/jest.js"
- },
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "ansi-escapes": "^1.4.0",
- "callsites": "^2.0.0",
- "chalk": "^1.1.1",
- "graceful-fs": "^4.1.6",
- "is-ci": "^1.0.9",
- "istanbul-api": "^1.0.0-aplha.10",
- "istanbul-lib-coverage": "^1.0.0",
- "istanbul-lib-instrument": "^1.1.1",
- "jest-changed-files": "^17.0.2",
- "jest-config": "^17.0.3",
- "jest-environment-jsdom": "^17.0.2",
- "jest-file-exists": "^17.0.0",
- "jest-haste-map": "^17.0.3",
- "jest-jasmine2": "^17.0.3",
- "jest-mock": "^17.0.2",
- "jest-resolve": "^17.0.3",
- "jest-resolve-dependencies": "^17.0.3",
- "jest-runtime": "^17.0.3",
- "jest-snapshot": "^17.0.3",
- "jest-util": "^17.0.2",
- "json-stable-stringify": "^1.0.0",
- "node-notifier": "^4.6.1",
- "sane": "~1.4.1",
- "strip-ansi": "^3.0.1",
- "throat": "^3.0.0",
- "which": "^1.1.1",
- "worker-farm": "^1.3.1",
- "yargs": "^6.3.0"
- },
- "description": "Painless JavaScript Testing.",
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "700b8c02a9ea0ec9eab0cd5a9fd42d8a858ce146",
- "tarball": "https://registry.npmjs.org/jest-cli/-/jest-cli-17.0.3.tgz"
- },
- "engines": {
- "node": ">= 4"
- },
- "homepage": "http://facebook.github.io/jest/",
- "keywords": [
- "facebook",
- "jest",
- "test",
- "unit",
- "jasmine",
- "mock"
- ],
- "license": "BSD-3-Clause",
- "main": "build/jest.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- },
- {
- "email": "lbljeffmo@gmail.com",
- "name": "jeffmo"
- },
- {
- "email": "kentaromiura@gmail.com",
- "name": "kentaromiura"
- },
- {
- "email": "paul@oshannessy.com",
- "name": "zpao"
- }
- ],
- "name": "jest-cli",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "./bin/jest.js"
- },
- "version": "17.0.3"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-config/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-config/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-config/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/constants.js b/fundamentals/bug-challenge-es6/node_modules/jest-config/build/constants.js
deleted file mode 100644
index 18547c109..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/constants.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
-'use strict';
-
-const path = require('path');
-
-exports.NODE_MODULES = path.sep + 'node_modules' + path.sep;
-exports.DEFAULT_JS_PATTERN = '^.+\\.jsx?$';
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/defaults.js b/fundamentals/bug-challenge-es6/node_modules/jest-config/build/defaults.js
deleted file mode 100644
index 4ea79f907..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/defaults.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-const constants = require('./constants');
-const os = require('os');
-const path = require('path');var _require =
-require('jest-util');const replacePathSepForRegex = _require.replacePathSepForRegex;
-
-const NODE_MODULES_REGEXP = replacePathSepForRegex(constants.NODE_MODULES);
-
-module.exports = {
- automock: false,
- bail: false,
- browser: false,
- cacheDirectory: path.join(os.tmpdir(), 'jest'),
- coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
- coverageReporters: ['json', 'text', 'lcov', 'clover'],
- expand: false,
- globals: {},
- haste: {
- providesModuleNodeModules: [] },
-
- mocksPattern: '__mocks__',
- moduleDirectories: ['node_modules'],
- moduleFileExtensions: [
- 'js',
- 'json',
- 'jsx',
- 'node'],
-
- moduleNameMapper: {},
- modulePathIgnorePatterns: [],
- noStackTrace: false,
- notify: false,
- preset: null,
- resetMocks: false,
- resetModules: false,
- snapshotSerializers: [],
- testEnvironment: 'jest-environment-jsdom',
- testPathDirs: [''],
- testPathIgnorePatterns: [NODE_MODULES_REGEXP],
- testRegex: '(/__tests__/.*|\\.(test|spec))\\.jsx?$',
- testURL: 'about:blank',
- timers: 'real',
- transformIgnorePatterns: [NODE_MODULES_REGEXP],
- useStderr: false,
- verbose: null,
- watch: false };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-config/build/index.js
deleted file mode 100644
index ffaaee83d..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/index.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-const loadFromFile = require('./loadFromFile');
-const loadFromPackage = require('./loadFromPackage');
-const normalize = require('./normalize');
-const path = require('path');
-const setFromArgv = require('./setFromArgv');
-
-const readConfig = (argv, packageRoot) =>
-readRawConfig(argv, packageRoot).
-then(config => Object.freeze(setFromArgv(config, argv)));
-
-const parseConfig = argv => {
- if (argv.config && typeof argv.config === 'string') {
- // If the passed in value looks like JSON, treat it as an object.
- if (argv.config[0] === '{' && argv.config[argv.config.length - 1] === '}') {
- return JSON.parse(argv.config);
- }
- }
- return argv.config;
-};
-
-const readRawConfig = (argv, root) => {
- const rawConfig = parseConfig(argv);
-
- if (typeof rawConfig === 'string') {
- return loadFromFile(path.resolve(process.cwd(), rawConfig));
- }
-
- if (typeof rawConfig === 'object') {
- const config = Object.assign({}, rawConfig);
- config.rootDir = config.rootDir || root;
- return Promise.resolve(normalize(config, argv));
- }
-
- return loadFromPackage(path.join(root, 'package.json'), argv).
- then(config => config || normalize({ rootDir: root }, argv));
-};
-
-module.exports = {
- normalize,
- readConfig };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/lib/promisify.js b/fundamentals/bug-challenge-es6/node_modules/jest-config/build/lib/promisify.js
deleted file mode 100644
index 21d20cfe9..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/lib/promisify.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-'use strict';
-
-module.exports = function promisify(fn) {
- return function () {
- const args = Array.prototype.slice.call(arguments);
- return new Promise((resolve, reject) => {
- args.push((err, res) => {
- if (err) {
- reject(err);
- } else {
- resolve(res);
- }
- });
-
- fn.apply(this, args);
- });
- };
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/loadFromFile.js b/fundamentals/bug-challenge-es6/node_modules/jest-config/build/loadFromFile.js
deleted file mode 100644
index ed350615e..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/loadFromFile.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
-'use strict';
-
-const fs = require('fs');
-const normalize = require('./normalize');
-const path = require('path');
-const promisify = require('./lib/promisify');
-
-function loadFromFile(filePath, argv) {
- return promisify(fs.readFile)(filePath).then(data => {
- const parse = () => {
- try {
- return JSON.parse(data);
- } catch (e) {
- throw new Error(`Jest: Failed to parse config file ${ filePath }.`);
- }
- };
-
- const config = parse();
- config.rootDir = config.rootDir ?
- path.resolve(path.dirname(filePath), config.rootDir) :
- process.cwd();
- return normalize(config, argv);
- });
-}
-
-module.exports = loadFromFile;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/loadFromPackage.js b/fundamentals/bug-challenge-es6/node_modules/jest-config/build/loadFromPackage.js
deleted file mode 100644
index 2938abb28..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/loadFromPackage.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
-'use strict';
-
-const fs = require('fs');
-const normalize = require('./normalize');
-const path = require('path');
-const promisify = require('./lib/promisify');
-
-function loadFromPackage(filePath, argv) {
- return promisify(fs.access)(filePath, fs.R_OK).then(
- () => {
- const packageData = require(filePath);
- const config = packageData.jest || {};
- const root = path.dirname(filePath);
- config.rootDir =
- config.rootDir ? path.resolve(root, config.rootDir) : root;
- return normalize(config, argv);
- },
- () => null);
-
-}
-
-module.exports = loadFromPackage;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/normalize.js b/fundamentals/bug-challenge-es6/node_modules/jest-config/build/normalize.js
deleted file mode 100644
index 0c93b9b39..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/normalize.js
+++ /dev/null
@@ -1,435 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- */
-
-'use strict';
-
-const DEFAULT_CONFIG_VALUES = require('./defaults');
-const Resolver = require('jest-resolve');
-
-const chalk = require('chalk');
-const constants = require('./constants');
-const path = require('path');
-const utils = require('jest-util');
-
-const JSON_EXTENSION = '.json';
-const PRESET_NAME = 'jest-preset' + JSON_EXTENSION;
-
-const BULLET = chalk.bold('\u25cf ');
-const DEPRECATION_MESSAGE = `
-
- Jest changed the default configuration for tests.
-
- ${ chalk.bold('Configuration Documentation:') } https://facebook.github.io/jest/docs/configuration.html
- ${ chalk.bold('Jest Issue Tracker:') } https://github.com/facebook/jest/issues
-`;
-const throwConfigurationError = message => {
- throw new Error(chalk.red(message + DEPRECATION_MESSAGE));
-};
-
-const logConfigurationWarning = message => {
- console.warn(chalk.yellow(BULLET + message + DEPRECATION_MESSAGE));
-};
-
-function _replaceRootDirTags(rootDir, config) {
- switch (typeof config) {
- case 'object':
- if (config instanceof RegExp) {
- return config;
- }
-
- if (Array.isArray(config)) {
- return config.map(item => _replaceRootDirTags(rootDir, item));
- }
-
- if (config !== null) {
- const newConfig = {};
- for (const configKey in config) {
- newConfig[configKey] =
- configKey === 'rootDir' ?
- config[configKey] :
- _replaceRootDirTags(rootDir, config[configKey]);
- }
- return newConfig;
- }
- break;
- case 'string':
- if (!/^/.test(config)) {
- return config;
- }
-
- return path.resolve(
- rootDir,
- path.normalize('./' + config.substr(''.length)));}
-
-
- return config;
-}
-
-/**
- * Finds the test environment to use:
- *
- * 1. looks for jest-environment- relative to project.
- * 1. looks for jest-environment- relative to Jest.
- * 1. looks for relative to project.
- * 1. looks for relative to Jest.
- */
-function getTestEnvironment(config) {
- const env = config.testEnvironment;
- let module = Resolver.findNodeModule(`jest-environment-${ env }`, {
- basedir: config.rootDir });
-
- if (module) {
- return module;
- }
-
- try {
- return require.resolve(`jest-environment-${ env }`);
- } catch (e) {}
-
- module = Resolver.findNodeModule(env, { basedir: config.rootDir });
- if (module) {
- return module;
- }
-
- try {
- return require.resolve(env);
- } catch (e) {}
-
- throw new Error(
- `Jest: test environment "${ env }" cannot be found. Make sure the ` +
- `"testEnvironment" configuration option points to an existing node module.`);
-
-}
-
-function normalize(config, argv) {
- if (!argv) {
- argv = {};
- }
- const newConfig = {};
-
- // Assert that there *is* a rootDir
- if (!config.hasOwnProperty('rootDir')) {
- throw new Error(`Jest: 'rootDir' config value must be specified.`);
- }
-
- config.rootDir = path.normalize(config.rootDir);
-
- if (config.preset) {
- const presetPath = _replaceRootDirTags(config.rootDir, config.preset);
- const presetModule = Resolver.findNodeModule(
- presetPath.endsWith(JSON_EXTENSION) ?
- presetPath :
- path.join(presetPath, PRESET_NAME),
- {
- basedir: config.rootDir });
-
-
- if (presetModule) {
- const preset = require(presetModule);
- if (config.setupFiles) {
- config.setupFiles = preset.setupFiles.concat(config.setupFiles);
- }
- if (config.modulePathIgnorePatterns) {
- config.modulePathIgnorePatterns = preset.modulePathIgnorePatterns.
- concat(config.modulePathIgnorePatterns);
- }
- if (config.moduleNameMapper) {
- config.moduleNameMapper = Object.assign(
- {},
- preset.moduleNameMapper,
- config.moduleNameMapper);
-
- }
- // Don't show deprecation warnings if the setting comes from the preset.
- if (preset.preprocessorIgnorePatterns) {
- preset.transformIgnorePatterns = preset.preprocessorIgnorePatterns;
- delete preset.preprocessorIgnorePatterns;
- }
- config = Object.assign({}, preset, config);
- } else {
- throw new Error(
- `Jest: Preset '${ presetPath }' not found.`);
-
- }
- }
-
- if (config.scriptPreprocessor && config.transform) {
- throwConfigurationError(
- 'Jest: `scriptPreprocessor` and `transform` cannot be used together. ' +
- 'Please change your configuration to only use `transform`.');
-
- }
-
- if (config.preprocessorIgnorePatterns && config.transformIgnorePatterns) {
- throwConfigurationError(
- 'Jest: `preprocessorIgnorePatterns` and `transformIgnorePatterns` ' +
- 'cannot be used together. Please change your configuration to only ' +
- 'use `transformIgnorePatterns`.');
-
- }
-
- if (config.scriptPreprocessor) {
- config.transform = {
- '.*': config.scriptPreprocessor };
-
- }
-
- if (config.preprocessorIgnorePatterns) {
- config.transformIgnorePatterns = config.preprocessorIgnorePatterns;
- }
-
- if (
- config.scriptPreprocessor ||
- config.preprocessorIgnorePatterns)
- {
- logConfigurationWarning(
- 'The settings `scriptPreprocessor` and `preprocessorIgnorePatterns` ' +
- 'were replaced by `transform` and `transformIgnorePatterns` ' +
- 'which support multiple preprocessors.\n\n' +
- ' Jest now treats your current settings as: \n\n' +
- ` "transform": {".*": "${ config.scriptPreprocessor }"}` + (
- config.transformIgnorePatterns ?
- `\n "transformIgnorePatterns": "${ config.transformIgnorePatterns }"` :
- '') +
-
- '\n\n Please update your configuration.');
-
- }
-
- delete config.scriptPreprocessor;
- delete config.preprocessorIgnorePatterns;
-
- if (!config.name) {
- config.name = config.rootDir.replace(/[/\\]|\s/g, '-');
- }
-
- if (!config.setupFiles) {
- config.setupFiles = [];
- }
-
- if (argv.testRunner) {
- config.testRunner = argv.testRunner;
- }
-
- if (argv.collectCoverageFrom) {
- config.collectCoverageFrom = argv.collectCoverageFrom;
- }
-
- if (!config.testRunner || config.testRunner === 'jasmine2') {
- config.testRunner = require.resolve('jest-jasmine2');
- } else {
- try {
- config.testRunner = path.resolve(
- config.testRunner.replace(//g, config.rootDir));
-
- } catch (e) {
- throw new Error(
- `Jest: Invalid testRunner path: ${ config.testRunner }`);
-
- }
- }
-
- if (argv.env) {
- config.testEnvironment = argv.env;
- }
-
- if (config.testEnvironment) {
- config.testEnvironment = getTestEnvironment(config);
- }
-
- let babelJest;
- if (config.transform) {
- const customJSPattern = Object.keys(config.transform).find(regex => {
- const pattern = new RegExp(regex);
- return pattern.test('foobar.js') || pattern.test('foobar.jsx');
- });
-
- if (customJSPattern) {
- const jsTransformer = config.transform[customJSPattern];
- if (
- jsTransformer.includes(
- constants.NODE_MODULES + 'babel-jest') ||
- jsTransformer.includes('packages/babel-jest'))
- {
- babelJest = jsTransformer;
- }
- }
- } else {
- babelJest = Resolver.findNodeModule('babel-jest', {
- basedir: config.rootDir });
-
- if (babelJest) {
- config.transform = {
- [constants.DEFAULT_JS_PATTERN]: babelJest };
-
- }
- }
-
- if (babelJest) {
- const polyfillPath =
- Resolver.findNodeModule('babel-polyfill', {
- basedir: config.rootDir });
-
- if (polyfillPath) {
- config.setupFiles.unshift(polyfillPath);
- }
- config.usesBabelJest = true;
- }
-
- Object.keys(config).reduce((newConfig, key) => {
- let value;
- switch (key) {
- case 'collectCoverageOnlyFrom':
- value = Object.keys(config[key]).reduce((normObj, filePath) => {
- filePath = path.resolve(
- config.rootDir,
- _replaceRootDirTags(config.rootDir, filePath));
-
- normObj[filePath] = true;
- return normObj;
- }, {});
- break;
-
- case 'setupFiles':
- case 'snapshotSerializers':
- case 'testPathDirs':
- value = config[key].map(filePath => path.resolve(
- config.rootDir,
- _replaceRootDirTags(config.rootDir, filePath)));
-
- break;
- case 'collectCoverageFrom':
- if (!config[key]) {
- value = [];
- }
-
-
- if (!Array.isArray(config[key])) {
- try {
- value = JSON.parse(config[key]);
- } catch (e) {}
-
- Array.isArray(value) || (value = [config[key]]);
- } else {
- value = config[key];
- }
-
- break;
- case 'cacheDirectory':
- case 'coverageDirectory':
- case 'setupTestFrameworkScriptFile':
- case 'testResultsProcessor':
- case 'testRunner':
- value = path.resolve(
- config.rootDir,
- _replaceRootDirTags(config.rootDir, config[key]));
-
- break;
-
- case 'moduleNameMapper':
- value = Object.keys(config[key]).map(regex => [
- regex,
- _replaceRootDirTags(config.rootDir, config[key][regex])]);
-
- break;
- case 'transform':
- value = Object.keys(config[key]).map(regex => [
- regex,
- path.resolve(
- config.rootDir,
- _replaceRootDirTags(config.rootDir, config[key][regex]))]);
-
-
- break;
-
- case 'coveragePathIgnorePatterns':
- case 'modulePathIgnorePatterns':
- case 'testPathIgnorePatterns':
- case 'transformIgnorePatterns':
- case 'unmockedModulePathPatterns':
- // _replaceRootDirTags is specifically well-suited for substituting
- // in paths (it deals with properly interpreting relative path
- // separators, etc).
- //
- // For patterns, direct global substitution is far more ideal, so we
- // special case substitutions for patterns here.
- value = config[key].map(pattern =>
- utils.replacePathSepForRegex(
- pattern.replace(//g, config.rootDir)));
-
-
- break;
- case 'automock':
- case 'bail':
- case 'browser':
- case 'cache':
- case 'collectCoverage':
- case 'colors':
- case 'coverageCollector':
- case 'coverageReporters':
- case 'coverageThreshold':
- case 'globals':
- case 'haste':
- case 'logHeapUsage':
- case 'mocksPattern':
- case 'moduleDirectories':
- case 'moduleFileExtensions':
- case 'moduleLoader':
- case 'modulePaths':
- case 'name':
- case 'noStackTrace':
- case 'notify':
- case 'persistModuleRegistryBetweenSpecs':
- case 'preset':
- case 'replname':
- case 'resetMocks':
- case 'resetModules':
- case 'rootDir':
- case 'testEnvironment':
- case 'testRegex':
- case 'testReporter':
- case 'testURL':
- case 'timers':
- case 'updateSnapshot':
- case 'usesBabelJest':
- case 'verbose':
- case 'watchman':
- value = config[key];
- break;
-
- default:
- console.error(
- `Error: Unknown config option "${ key }" with value ` +
- `"${ config[key] }". This is either a typing error or a user ` +
- `mistake and fixing it will remove this message.`);}
-
-
- newConfig[key] = value;
- return newConfig;
- }, newConfig);
-
- // If any config entries weren't specified but have default values, apply the
- // default values
- Object.keys(DEFAULT_CONFIG_VALUES).reduce((newConfig, key) => {
- if (!(key in newConfig)) {
- newConfig[key] = DEFAULT_CONFIG_VALUES[key];
- }
- return newConfig;
- }, newConfig);
-
- // If argv.json is set, coverageReporters shouldn't print a text report.
- if (argv.json) {
- newConfig.coverageReporters = newConfig.coverageReporters.
- filter(reporter => reporter !== 'text');
- }
-
- return _replaceRootDirTags(newConfig.rootDir, newConfig);
-}
-
-module.exports = normalize;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/setFromArgv.js b/fundamentals/bug-challenge-es6/node_modules/jest-config/build/setFromArgv.js
deleted file mode 100644
index 2212c5cf8..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-config/build/setFromArgv.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
-'use strict';
-
-function setFromArgv(config, argv) {
- if (argv.coverage) {
- config.collectCoverage = true;
- }
-
- if (argv.verbose) {
- config.verbose = argv.verbose;
- }
-
- if (argv.notify) {
- config.notify = argv.notify;
- }
-
- if (argv.bail) {
- config.bail = argv.bail;
- }
-
- if (argv.cache !== null) {
- config.cache = argv.cache;
- }
-
- if (argv.watchman !== null) {
- config.watchman = argv.watchman;
- }
-
- if (argv.useStderr) {
- config.useStderr = argv.useStderr;
- }
-
- if (argv.json) {
- config.useStderr = true;
- }
-
- if (argv.logHeapUsage) {
- config.logHeapUsage = argv.logHeapUsage;
- }
-
- if (argv.replname) {
- config.replname = argv.replname;
- }
-
- if (argv.silent) {
- config.silent = true;
- }
-
- if (argv.setupTestFrameworkScriptFile) {
- config.setupTestFrameworkScriptFile = argv.setupTestFrameworkScriptFile;
- }
-
- if (argv.testNamePattern) {
- config.testNamePattern = argv.testNamePattern;
- }
-
- if (argv.updateSnapshot) {
- config.updateSnapshot = argv.updateSnapshot;
- }
-
- if (argv.watch || argv.watchAll) {
- config.watch = true;
- }
-
- if (argv.expand) {
- config.expand = argv.expand;
- }
-
- config.noStackTrace = argv.noStackTrace;
-
- return config;
-}
-
-module.exports = setFromArgv;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-config/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-config/package.json
deleted file mode 100644
index 0edba4e04..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-config/package.json
+++ /dev/null
@@ -1,93 +0,0 @@
-{
- "_args": [
- [
- "jest-config@^17.0.3",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli"
- ]
- ],
- "_from": "jest-config@>=17.0.3 <18.0.0",
- "_id": "jest-config@17.0.3",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-config",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-18-east.internal.npmjs.com",
- "tmp": "tmp/jest-config-17.0.3.tgz_1479368533019_0.6883850512094796"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-config",
- "raw": "jest-config@^17.0.3",
- "rawSpec": "^17.0.3",
- "scope": null,
- "spec": ">=17.0.3 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-runtime",
- "/jest/jest-cli"
- ],
- "_resolved": "https://registry.npmjs.org/jest-config/-/jest-config-17.0.3.tgz",
- "_shasum": "b6ed75d90d090b731fd894231904cadb7d5a5df2",
- "_shrinkwrap": null,
- "_spec": "jest-config@^17.0.3",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "chalk": "^1.1.1",
- "istanbul": "^0.4.5",
- "jest-environment-jsdom": "^17.0.2",
- "jest-environment-node": "^17.0.2",
- "jest-jasmine2": "^17.0.3",
- "jest-mock": "^17.0.2",
- "jest-resolve": "^17.0.3",
- "jest-util": "^17.0.2",
- "json-stable-stringify": "^1.0.0"
- },
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "b6ed75d90d090b731fd894231904cadb7d5a5df2",
- "tarball": "https://registry.npmjs.org/jest-config/-/jest-config-17.0.3.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- }
- ],
- "name": "jest-config",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.3"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-diff/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-diff/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-diff/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-diff/build/constants.js b/fundamentals/bug-challenge-es6/node_modules/jest-diff/build/constants.js
deleted file mode 100644
index cb6ae145f..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-diff/build/constants.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-const chalk = require('chalk');
-
-exports.NO_DIFF_MESSAGE =
-chalk.dim('Compared values have no visual difference.');
-
-exports.SIMILAR_MESSAGE =
-chalk.dim(
-'Compared values serialize to the same structure.\n' +
-'Printing internal object structure without calling `toJSON` instead.');
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-diff/build/diffStrings.js b/fundamentals/bug-challenge-es6/node_modules/jest-diff/build/diffStrings.js
deleted file mode 100644
index df8eefece..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-diff/build/diffStrings.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-const chalk = require('chalk');
-const diff = require('diff');var _require =
-
-require('./constants.js');const NO_DIFF_MESSAGE = _require.NO_DIFF_MESSAGE;
-const DIFF_CONTEXT = 5;
-
-
-
-
-
-
-
-
-
-const getAnnotation = options =>
-chalk.green('- ' + (options && options.aAnnotation || 'Expected')) + '\n' +
-chalk.red('+ ' + (options && options.bAnnotation || 'Received')) + '\n\n';
-
-const diffLines = (a, b) => {
- let isDifferent = false;
- return {
- diff: diff.diffLines(a, b).map(part => {
- if (part.added || part.removed) {
- isDifferent = true;
- }
-
- const lines = part.value.split('\n');
- const color = part.added ?
- chalk.red :
- part.removed ? chalk.green : chalk.dim;
-
- if (lines[lines.length - 1] === '') {
- lines.pop();
- }
-
- return lines.map(line => {
- const mark = color(part.added ? '+' : part.removed ? '-' : ' ');
- return mark + ' ' + color(line) + '\n';
- }).join('');
- }).join('').trim(),
- isDifferent };
-
-};
-
-const structuredPatch = (a, b) => {
- const options = { context: DIFF_CONTEXT };
- let isDifferent = false;
- // Make sure the strings end with a newline.
- if (!a.endsWith('\n')) {
- a += '\n';
- }
- if (!b.endsWith('\n')) {
- b += '\n';
- }
-
- return {
- diff: diff.structuredPatch('', '', a, b, '', '', options).
- hunks.map(hunk => {
- const diffMarkOld = `-${ hunk.oldStart },${ hunk.oldLines }`;
- const diffMarkNew = `+${ hunk.newStart },${ hunk.newLines }`;
- const diffMark = chalk.yellow(`@@ ${ diffMarkOld } ${ diffMarkNew } @@\n`);
-
- const lines = hunk.lines.map(line => {
- const added = line[0] === '+';
- const removed = line[0] === '-';
-
- const color = added ?
- chalk.red :
- removed ? chalk.green : chalk.dim;
-
- return color(line) + '\n';
- }).join('');
-
- isDifferent = true;
- return diffMark + lines;
- }).join('').trim(),
- isDifferent };
-
-};
-
-function diffStrings(a, b, options) {
- // `diff` uses the Myers LCS diff algorithm which runs in O(n+d^2) time
- // (where "d" is the edit distance) and can get very slow for large edit
- // distances. Mitigate the cost by switching to a lower-resolution diff
- // whenever linebreaks are involved.
- const result = options && options.expand === false ?
- structuredPatch(a, b) :
- diffLines(a, b);
-
- if (result.isDifferent) {
- return getAnnotation(options) + result.diff;
- } else {
- return NO_DIFF_MESSAGE;
- }
-}
-
-module.exports = diffStrings;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-diff/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-diff/build/index.js
deleted file mode 100644
index f48efcba1..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-diff/build/index.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-const ReactElementPlugin = require('pretty-format/plugins/ReactElement');
-const ReactTestComponentPlugin = require('pretty-format/plugins/ReactTestComponent');
-
-const chalk = require('chalk');
-const diffStrings = require('./diffStrings');var _require =
-require('jest-matcher-utils');const getType = _require.getType;
-const prettyFormat = require('pretty-format');var _require2 =
-
-
-
-
-require('./constants');const NO_DIFF_MESSAGE = _require2.NO_DIFF_MESSAGE,SIMILAR_MESSAGE = _require2.SIMILAR_MESSAGE;
-
-const PLUGINS = [ReactTestComponentPlugin, ReactElementPlugin];
-const FORMAT_OPTIONS = {
- plugins: PLUGINS };
-
-const FALLBACK_FORMAT_OPTIONS = {
- callToJSON: false,
- maxDepth: 10,
- plugins: PLUGINS };
-
-
-// Generate a string that will highlight the difference between two values
-// with green and red. (similar to how github does code diffing)
-function diff(a, b, options) {
- if (a === b) {
- return NO_DIFF_MESSAGE;
- }
-
- if (getType(a) !== getType(b)) {
- return (
- 'Comparing two different types of values:\n' +
- ` Expected: ${ chalk.green(getType(a)) }\n` +
- ` Received: ${ chalk.red(getType(b)) }`);
-
- }
-
- switch (getType(a)) {
- case 'string':
- const multiline = a.match(/[\r\n]/) !== -1 && b.indexOf('\n') !== -1;
- if (multiline) {
- return diffStrings(String(a), String(b), options);
- }
- return null;
- case 'number':
- case 'boolean':
- return null;
- default:
- let diffMessage;
- let hasThrown = false;
-
- try {
- diffMessage = diffStrings(
- prettyFormat(a, FORMAT_OPTIONS),
- prettyFormat(b, FORMAT_OPTIONS),
- options);
-
- } catch (e) {
- hasThrown = true;
- }
-
- // If the comparison yields no results, compare again but this time
- // without calling `toJSON`. It's also possible that toJSON might throw.
- if (!diffMessage || diffMessage === NO_DIFF_MESSAGE) {
- diffMessage = diffStrings(
- prettyFormat(a, FALLBACK_FORMAT_OPTIONS),
- prettyFormat(b, FALLBACK_FORMAT_OPTIONS),
- options);
-
- if (diffMessage !== NO_DIFF_MESSAGE && !hasThrown) {
- diffMessage = SIMILAR_MESSAGE + '\n\n' + diffMessage;
- }
- }
- return diffMessage;}
-
-}
-
-module.exports = diff;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-diff/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-diff/package.json
deleted file mode 100644
index dcae85fc5..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-diff/package.json
+++ /dev/null
@@ -1,88 +0,0 @@
-{
- "_args": [
- [
- "jest-diff@^17.0.3",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest-matchers"
- ]
- ],
- "_from": "jest-diff@>=17.0.3 <18.0.0",
- "_id": "jest-diff@17.0.3",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-diff",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-18-east.internal.npmjs.com",
- "tmp": "tmp/jest-diff-17.0.3.tgz_1479368470950_0.627910036360845"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-diff",
- "raw": "jest-diff@^17.0.3",
- "rawSpec": "^17.0.3",
- "scope": null,
- "spec": ">=17.0.3 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-matchers",
- "/jest-snapshot"
- ],
- "_resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-17.0.3.tgz",
- "_shasum": "8fb31efab3b314d7b61b7b66b0bdea617ef1c02f",
- "_shrinkwrap": null,
- "_spec": "jest-diff@^17.0.3",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest-matchers",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "chalk": "^1.1.3",
- "diff": "^3.0.0",
- "jest-matcher-utils": "^17.0.3",
- "pretty-format": "~4.2.1"
- },
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "8fb31efab3b314d7b61b7b66b0bdea617ef1c02f",
- "tarball": "https://registry.npmjs.org/jest-diff/-/jest-diff-17.0.3.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- }
- ],
- "name": "jest-diff",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.3"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-environment-jsdom/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-environment-jsdom/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-environment-jsdom/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-environment-jsdom/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-environment-jsdom/build/index.js
deleted file mode 100644
index 2ced67417..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-environment-jsdom/build/index.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- */
-'use strict';
-
-
-
-
-
-const FakeTimers = require('jest-util').FakeTimers;
-const installCommonGlobals = require('jest-util').installCommonGlobals;
-const ModuleMocker = require('jest-mock');
-
-class JSDOMEnvironment {
-
-
-
-
-
-
- constructor(config) {
- // lazy require
- this.document = require('jsdom').jsdom( /* markup */undefined, {
- url: config.testURL });
-
- const global = this.global = this.document.defaultView;
- // Node's error-message stack size is limited at 10, but it's pretty useful
- // to see more than that when a test fails.
- this.global.Error.stackTraceLimit = 100;
- installCommonGlobals(global, config.globals);
-
- this.moduleMocker = new ModuleMocker(global);
- this.fakeTimers = new FakeTimers(global, this.moduleMocker, config);
- }
-
- dispose() {
- if (this.fakeTimers) {
- this.fakeTimers.dispose();
- }
- if (this.global) {
- this.global.close();
- }
- this.global = null;
- this.document = null;
- this.fakeTimers = null;
- }
-
- runScript(script) {
- if (this.global) {
- return require('jsdom').evalVMScript(this.global, script);
- }
- return null;
- }}
-
-
-
-module.exports = JSDOMEnvironment;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-environment-jsdom/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-environment-jsdom/package.json
deleted file mode 100644
index 292e273f1..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-environment-jsdom/package.json
+++ /dev/null
@@ -1,89 +0,0 @@
-{
- "_args": [
- [
- "jest-environment-jsdom@^17.0.2",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli"
- ]
- ],
- "_from": "jest-environment-jsdom@>=17.0.2 <18.0.0",
- "_id": "jest-environment-jsdom@17.0.2",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-environment-jsdom",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-12-west.internal.npmjs.com",
- "tmp": "tmp/jest-environment-jsdom-17.0.2.tgz_1479170362201_0.5183715566527098"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-environment-jsdom",
- "raw": "jest-environment-jsdom@^17.0.2",
- "rawSpec": "^17.0.2",
- "scope": null,
- "spec": ">=17.0.2 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-config",
- "/jest/jest-cli"
- ],
- "_resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-17.0.2.tgz",
- "_shasum": "a3098dc29806d40802c52b62b848ab6aa00fdba0",
- "_shrinkwrap": null,
- "_spec": "jest-environment-jsdom@^17.0.2",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "jest-mock": "^17.0.2",
- "jest-util": "^17.0.2",
- "jsdom": "^9.8.1"
- },
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "a3098dc29806d40802c52b62b848ab6aa00fdba0",
- "tarball": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-17.0.2.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- },
- {
- "email": "kentaromiura@gmail.com",
- "name": "kentaromiura"
- }
- ],
- "name": "jest-environment-jsdom",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {},
- "version": "17.0.2"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-environment-node/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-environment-node/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-environment-node/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-environment-node/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-environment-node/build/index.js
deleted file mode 100644
index cf8bf8c5f..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-environment-node/build/index.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-const FakeTimers = require('jest-util').FakeTimers;
-const installCommonGlobals = require('jest-util').installCommonGlobals;
-const ModuleMocker = require('jest-mock');
-const vm = require('vm');
-
-class NodeEnvironment {
-
-
-
-
-
-
- constructor(config) {
- this.context = vm.createContext();
- const global = this.global = vm.runInContext('this', this.context);
- global.global = global;
- global.clearInterval = clearInterval;
- global.clearTimeout = clearTimeout;
- global.JSON = JSON;
- global.Promise = Promise;
- global.setInterval = setInterval;
- global.setTimeout = setTimeout;
- installCommonGlobals(global, config.globals);
- this.moduleMocker = new ModuleMocker(global);
- this.fakeTimers = new FakeTimers(global, this.moduleMocker, config);
- }
-
- dispose() {
- if (this.fakeTimers) {
- this.fakeTimers.dispose();
- }
- this.context = null;
- this.fakeTimers = null;
- }
-
- runScript(script) {
- if (this.context) {
- return script.runInContext(this.context);
- }
- return null;
- }}
-
-
-
-module.exports = NodeEnvironment;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-environment-node/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-environment-node/package.json
deleted file mode 100644
index b9ab6f81e..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-environment-node/package.json
+++ /dev/null
@@ -1,89 +0,0 @@
-{
- "_args": [
- [
- "jest-environment-node@^17.0.2",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest-config"
- ]
- ],
- "_from": "jest-environment-node@>=17.0.2 <18.0.0",
- "_id": "jest-environment-node@17.0.2",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-environment-node",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-18-east.internal.npmjs.com",
- "tmp": "tmp/jest-environment-node-17.0.2.tgz_1479170363093_0.7057302254252136"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-environment-node",
- "raw": "jest-environment-node@^17.0.2",
- "rawSpec": "^17.0.2",
- "scope": null,
- "spec": ">=17.0.2 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-config"
- ],
- "_resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-17.0.2.tgz",
- "_shasum": "aff6133f4ca2faddcc5b0ce7d25cec83e16d8463",
- "_shrinkwrap": null,
- "_spec": "jest-environment-node@^17.0.2",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest-config",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "jest-mock": "^17.0.2",
- "jest-util": "^17.0.2"
- },
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "aff6133f4ca2faddcc5b0ce7d25cec83e16d8463",
- "tarball": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-17.0.2.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- },
- {
- "email": "kentaromiura@gmail.com",
- "name": "kentaromiura"
- }
- ],
- "name": "jest-environment-node",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.2"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-file-exists/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-file-exists/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-file-exists/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-file-exists/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-file-exists/build/index.js
deleted file mode 100644
index c8eda7414..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-file-exists/build/index.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-
-const fs = require('fs');
-
-module.exports = (
-filePath,
-hasteFS) =>
-hasteFS && hasteFS.exists(filePath) || fs.existsSync(filePath);
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-file-exists/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-file-exists/package.json
deleted file mode 100644
index 7378b8c60..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-file-exists/package.json
+++ /dev/null
@@ -1,87 +0,0 @@
-{
- "_args": [
- [
- "jest-file-exists@^17.0.0",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli"
- ]
- ],
- "_from": "jest-file-exists@>=17.0.0 <18.0.0",
- "_id": "jest-file-exists@17.0.0",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-file-exists",
- "_nodeVersion": "6.9.1",
- "_npmOperationalInternal": {
- "host": "packages-18-east.internal.npmjs.com",
- "tmp": "tmp/jest-file-exists-17.0.0.tgz_1478614345379_0.9439507396891713"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.8",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-file-exists",
- "raw": "jest-file-exists@^17.0.0",
- "rawSpec": "^17.0.0",
- "scope": null,
- "spec": ">=17.0.0 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-resolve",
- "/jest-resolve-dependencies",
- "/jest-runtime",
- "/jest-snapshot",
- "/jest-util",
- "/jest/jest-cli"
- ],
- "_resolved": "https://registry.npmjs.org/jest-file-exists/-/jest-file-exists-17.0.0.tgz",
- "_shasum": "7f63eb73a1c43a13f461be261768b45af2cdd169",
- "_shrinkwrap": null,
- "_spec": "jest-file-exists@^17.0.0",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {},
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "7f63eb73a1c43a13f461be261768b45af2cdd169",
- "tarball": "https://registry.npmjs.org/jest-file-exists/-/jest-file-exists-17.0.0.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- }
- ],
- "name": "jest-file-exists",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.0"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/HasteFS.js b/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/HasteFS.js
deleted file mode 100644
index b0ad2e1de..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/HasteFS.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-
-
-const H = require('./constants');
-
-const multimatch = require('multimatch');
-const path = require('path');
-
-class HasteFS {
-
-
-
- constructor(files) {
- this._files = files;
- }
-
- getModuleName(file) {
- return this._files[file] && this._files[file][H.ID] || null;
- }
-
- getDependencies(file) {
- return this._files[file] && this._files[file][H.DEPENDENCIES] || null;
- }
-
- exists(file) {
- return !!this._files[file];
- }
-
- getAllFiles() {
- return Object.keys(this._files);
- }
-
- matchFiles(pattern) {
- if (!(pattern instanceof RegExp)) {
- pattern = new RegExp(pattern);
- }
- const files = [];
- for (const file in this._files) {
- if (pattern.test(file)) {
- files.push(file);
- }
- }
- return files;
- }
-
- matchFilesWithGlob(
- globs,
- root)
- {
- const files = new Set();
- for (const file in this._files) {
- const filePath = root ? path.relative(root, file) : file;
- if (multimatch([filePath], globs).length) {
- files.add(file);
- }
- }
- return files;
- }}
-
-
-
-module.exports = HasteFS;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/ModuleMap.js b/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/ModuleMap.js
deleted file mode 100644
index b11c7e611..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/ModuleMap.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-
-
-
-
-const H = require('./constants');
-
-class ModuleMap {
-
-
-
-
- constructor(map, mocks) {
- this._map = map;
- this._mocks = mocks;
- }
-
- getModule(
- name,
- platform,
- supportsNativePlatform,
- type)
- {
- if (!type) {
- type = H.MODULE;
- }
-
- const map = this._map[name];
- if (map) {
- let module = platform && map[platform];
- if (!module && map[H.NATIVE_PLATFORM] && supportsNativePlatform) {
- module = map[H.NATIVE_PLATFORM];
- } else if (!module) {
- module = map[H.GENERIC_PLATFORM];
- }
- if (module && module[H.TYPE] === type) {
- return module[H.PATH];
- }
- }
-
- return null;
- }
-
- getPackage(
- name,
- platform,
- supportsNativePlatform)
- {
- return this.getModule(name, platform, null, H.PACKAGE);
- }
-
- getMockModule(name) {
- return this._mocks[name];
- }}
-
-
-
-module.exports = ModuleMap;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/constants.js b/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/constants.js
deleted file mode 100644
index 15c2b75be..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/constants.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-/* eslint-disable sort-keys */
-
-/*
- * This file exports a set of constants that are used for Jest's haste map
- * serialization. On very large repositories, the haste map cache becomes very
- * large to the point where it is the largest overhead in starting up Jest.
- *
- * This constant key map allows to keep the map smaller without having to build
- * a custom serialization library.
- */
-module.exports = {
- /* file map attributes */
- ID: 0,
- MTIME: 1,
- VISITED: 2,
- DEPENDENCIES: 3,
-
- /* module map attributes */
- PATH: 0,
- TYPE: 1,
-
- /* module types */
- MODULE: 0,
- PACKAGE: 1,
-
- /* platforms */
- GENERIC_PLATFORM: 'g',
- NATIVE_PLATFORM: 'native' };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/crawlers/node.js b/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/crawlers/node.js
deleted file mode 100644
index 056c501bc..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/crawlers/node.js
+++ /dev/null
@@ -1,157 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-const H = require('../constants');
-
-const fs = require('fs');
-const path = require('path');
-const spawn = require('child_process').spawn;
-
-
-
-function find(
-roots,
-extensions,
-ignore,
-callback)
-{
- const result = [];
- let activeCalls = 0;
-
- function search(directory) {
- activeCalls++;
- fs.readdir(directory, (err, names) => {
- activeCalls--;
-
- names.forEach(file => {
- file = path.join(directory, file);
- if (ignore(file)) {
- return;
- }
- activeCalls++;
-
- fs.lstat(file, (err, stat) => {
- activeCalls--;
-
- if (!err && stat && !stat.isSymbolicLink()) {
- if (stat.isDirectory()) {
- search(file);
- } else {
- const ext = path.extname(file).substr(1);
- if (extensions.indexOf(ext) !== -1) {
- result.push([file, stat.mtime.getTime()]);
- }
- }
- }
- if (activeCalls === 0) {
- callback(result);
- }
- });
- });
-
- if (activeCalls === 0) {
- callback(result);
- }
- });
- }
-
- roots.forEach(search);
-}
-
-function findNative(
-roots,
-extensions,
-ignore,
-callback)
-{
- const args = [].concat(roots);
- args.push('-type', 'f');
- if (extensions.length) {
- args.push('\(');
- }
- extensions.forEach((ext, index) => {
- if (index) {
- args.push('-o');
- }
- args.push('-iname');
- args.push('*.' + ext);
- });
- if (extensions.length) {
- args.push('\)');
- }
-
- const child = spawn('find', args);
- let stdout = '';
- child.stdout.setEncoding('utf-8');
- child.stdout.on('data', data => stdout += data);
-
- child.stdout.on('close', () => {
- const lines = stdout.trim().
- split('\n').
- filter(x => !ignore(x));
- const result = [];
- let count = lines.length;
- if (!count) {
- callback([]);
- } else {
- lines.forEach(path => {
- fs.stat(path, (err, stat) => {
- if (!err && stat) {
- result.push([path, stat.mtime.getTime()]);
- }
- if (--count === 0) {
- callback(result);
- }
- });
- });
- }
- });
-}
-
-module.exports = function nodeCrawl(
-options)
-{const
-
- data =
-
-
-
-
- options.data,extensions = options.extensions,forceNodeFilesystemAPI = options.forceNodeFilesystemAPI,ignore = options.ignore,roots = options.roots;
-
- return new Promise(resolve => {
- const callback = list => {
- const files = Object.create(null);
- list.forEach(fileData => {
- const name = fileData[0];
- const mtime = fileData[1];
- const existingFile = data.files[name];
- if (existingFile && existingFile[H.MTIME] === mtime) {
- files[name] = existingFile;
- } else {
- // See ../constants.js
- files[name] = ['', mtime, 0, []];
- }
- });
- data.files = files;
- resolve(data);
- };
-
- if (forceNodeFilesystemAPI || process.platform === 'win32') {
- find(roots, extensions, ignore, callback);
- } else {
- findNative(roots, extensions, ignore, callback);
- }
- });
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/crawlers/watchman.js b/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/crawlers/watchman.js
deleted file mode 100644
index 359131c3f..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/crawlers/watchman.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-const H = require('../constants');
-
-const path = require('path');
-const watchman = require('fb-watchman');
-
-const watchmanURL = 'https://facebook.github.io/watchman/docs/troubleshooting.html';
-
-function isDescendant(root, child) {
- return child.startsWith(root);
-}
-
-function WatchmanError(error) {
- return new Error(
- `Watchman error: ${ error.message.trim() }. Make sure watchman ` +
- `is running for this project. See ${ watchmanURL }.`);
-
-}
-
-module.exports = function watchmanCrawl(
-options)
-{const
-
- data =
-
-
-
- options.data,extensions = options.extensions,ignore = options.ignore,roots = options.roots;
-
- return new Promise((resolve, reject) => {
- const client = new watchman.Client();
- client.on('error', error => reject(error));
-
- const cmd = args => new Promise((resolve, reject) => {
- client.command(args, (error, result) => {
- if (error) {
- reject(error);
- } else {
- resolve(result);
- }
- });
- });
-
- const clocks = data.clocks;
- let files = data.files;
-
- return Promise.all(roots.map(root => cmd(['watch-project', root]))).
- then(responses => {
- const watchmanRoots = Array.from(
- new Set(responses.map(response => response.watch)));
-
- return Promise.all(watchmanRoots.map(root => {
- // Build up an expression to filter the output by the relevant roots.
- const dirExpr = ['anyof'];
- roots.forEach(subRoot => {
- if (isDescendant(root, subRoot)) {
- dirExpr.push(['dirname', path.relative(root, subRoot)]);
- }
- });
- const expression = [
- 'allof',
- ['type', 'f'],
- ['anyof'].concat(extensions.map(
- extension => ['suffix', extension]))];
-
-
- if (dirExpr.length > 1) {
- expression.push(dirExpr);
- }
- const fields = ['name', 'exists', 'mtime_ms'];
-
- const query = clocks[root]
- // Use the `since` generator if we have a clock available
- ? { expression, fields, since: clocks[root] }
- // Otherwise use the `suffix` generator
- : { expression, fields, suffix: extensions };
- return cmd(['query', root, query]).then(response => ({
- response,
- root }));
-
- })).then(pairs => {
- // Reset the file map if watchman was restarted and sends us a list of
- // files.
- if (pairs.some(pair => pair.response.is_fresh_instance)) {
- files = Object.create(null);
- }
-
- pairs.forEach(pair => {
- const root = pair.root;
- const response = pair.response;
- if ('warning' in response) {
- console.warn('watchman warning: ', response.warning);
- }
-
- clocks[root] = response.clock;
- response.files.forEach(fileData => {
- const name = root + path.sep + fileData.name;
- if (!fileData.exists) {
- delete files[name];
- } else if (!ignore(name)) {
- const mtime = fileData.mtime_ms.toNumber();
- const isNew =
- !data.files[name] || data.files[name][H.MTIME] !== mtime;
- if (isNew) {
- // See ../constants.js
- files[name] = ['', mtime, 0, []];
- } else {
- files[name] = data.files[name];
- }
- }
- });
- });
- });
- }).
- then(() => {
- client.end();
- data.files = files;
- resolve(data);
- }).
- catch(error => {
- client.end();
- reject(WatchmanError(error));
- });
- });
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/index.js
deleted file mode 100644
index bde254cc1..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/index.js
+++ /dev/null
@@ -1,708 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';var _require =
-
-
-
-
-
-
-
-
-
-
-
-require('events');const EventEmitter = _require.EventEmitter;
-const H = require('./constants');
-const HasteFS = require('./HasteFS');
-const HasteModuleMap = require('./ModuleMap');
-
-const crypto = require('crypto');
-const execSync = require('child_process').execSync;
-const fs = require('graceful-fs');
-const getPlatformExtension = require('./lib/getPlatformExtension');
-const nodeCrawl = require('./crawlers/node');
-const os = require('os');
-const path = require('path');
-const sane = require('sane');
-const watchmanCrawl = require('./crawlers/watchman');
-const worker = require('./worker');
-const workerFarm = require('worker-farm');
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-const CHANGE_INTERVAL = 30;
-const MAX_WAIT_TIME = 240000;
-const NODE_MODULES = path.sep + 'node_modules' + path.sep;
-const VERSION = require('../package.json').version;
-
-const canUseWatchman = (() => {
- try {
- execSync('watchman version', { stdio: ['ignore'] });
- return true;
- } catch (e) {}
- return false;
-})();
-
-const escapePathSeparator =
-string => path.sep === '\\' ? string.replace(/(\/|\\)/g, '\\\\') : string;
-
-const getMockName = filePath => path.basename(filePath, path.extname(filePath));
-const getWhiteList = list => {
- if (list && list.length) {
- return new RegExp(
- '(' + escapePathSeparator(NODE_MODULES) +
- '(?:' + list.join('|') + ')(?=$|' + escapePathSeparator(path.sep) + '))',
- 'g');
-
- }
- return null;
-};
-
-/**
- * HasteMap is a JavaScript implementation of Facebook's haste module system.
- *
- * This implementation is inspired by https://github.com/facebook/node-haste
- * and was built with for high-performance in large code repositories with
- * hundreds of thousands of files. This implementation is scalable and provides
- * predictable performance.
- *
- * Because the haste map creation and synchronization is critical to startup
- * performance and most tasks are blocked by I/O this class makes heavy use of
- * synchronous operations. It uses worker processes for parallelizing file
- * access and metadata extraction.
- *
- * The data structures created by `jest-haste-map` can be used directly from the
- * cache without further processing. The metadata objects in the `files` and
- * `map` objects contain cross-references: a metadata object from one can look
- * up the corresponding metadata object in the other map. Note that in most
- * projects, the number of files will be greater than the number of haste
- * modules one module can refer to many files based on platform extensions.
- *
- * type HasteMap = {
- * clocks: WatchmanClocks,
- * files: {[filepath: string]: FileMetaData},
- * map: {[id: string]: ModuleMapItem},
- * mocks: {[id: string]: string},
- * }
- *
- * // Watchman clocks are used for query synchronization and file system deltas.
- * type WatchmanClocks = {[filepath: string]: string};
- *
- * type FileMetaData = {
- * id: ?string, // used to look up module metadata objects in `map`.
- * mtime: number, // check for outdated files.
- * visited: boolean, // whether the file has been parsed or not.
- * dependencies: Array, // all relative dependencies of this file.
- * };
- *
- * // Modules can be targeted to a specific platform based on the file name.
- * // Example: Platform.ios.js and Platform.android.js will both map to the same
- * // `Platform` module. The platform should be specified during resolution.
- * type ModuleMapItem = {[platform: string]: ModuleMetaData};
- *
- * //
- * type ModuleMetaData = {
- * path: string, // the path to look up the file object in `files`.
- * type: string, // the module type (either `package` or `module`).
- * };
- *
- * Note that the data structures described above are conceptual only. The actual
- * implementation uses arrays and constant keys for metadata storage. Instead of
- * `{id: 'flatMap', mtime: 3421, visited: true, dependencies: []}` the real
- * representation is similar to `['flatMap', 3421, 1, []]` to save storage space
- * and reduce parse and write time of a big JSON blob.
- *
- * The HasteMap is created as follows:
- * 1. read data from the cache or create an empty structure.
- * 2. crawl the file system.
- * * empty cache: crawl the entire file system.
- * * cache available:
- * * if watchman is available: get file system delta changes.
- * * if watchman is unavailable: crawl the entire file system.
- * * build metadata objects for every file. This builds the `files` part of
- * the `HasteMap`.
- * 3. parse and extract metadata from changed files.
- * * this is done in parallel over worker processes to improve performance.
- * * the worst case is to parse all files.
- * * the best case is no file system access and retrieving all data from
- * the cache.
- * * the average case is a small number of changed files.
- * 4. serialize the new `HasteMap` in a cache file.
- * Worker processes can directly access the cache through `HasteMap.read()`.
- *
- */
-class HasteMap extends EventEmitter {
-
-
-
-
-
-
-
-
-
-
- constructor(options) {
- super();
- this._options = {
- cacheDirectory: options.cacheDirectory || os.tmpdir(),
- extensions: options.extensions,
- forceNodeFilesystemAPI: !!options.forceNodeFilesystemAPI,
- ignorePattern: options.ignorePattern,
- maxWorkers: options.maxWorkers,
- mocksPattern:
- options.mocksPattern ? new RegExp(options.mocksPattern) : null,
- name: options.name,
- platforms: options.platforms,
- resetCache: options.resetCache,
- retainAllFiles: options.retainAllFiles,
- roots: Array.from(new Set(options.roots)),
- throwOnModuleCollision: !!options.throwOnModuleCollision,
- useWatchman:
- options.useWatchman == null ? true : options.useWatchman,
- watch: !!options.watch };
-
- this._console = options.console || global.console;
- this._cachePath = HasteMap.getCacheFilePath(
- this._options.cacheDirectory,
- `haste-map-${ this._options.name }`,
- VERSION,
- this._options.roots.join(':'),
- this._options.extensions.join(':'),
- this._options.platforms.join(':'),
- options.mocksPattern);
-
- this._whitelist = getWhiteList(options.providesModuleNodeModules);
- this._buildPromise = null;
- this._workerPromise = null;
- this._workerFarm = null;
- this._watchers = [];
- }
-
- static getCacheFilePath(tmpdir, name) {
- const hash = crypto.createHash('md5');
- Array.from(arguments).slice(1).forEach(arg => hash.update(arg));
- return path.join(
- tmpdir,
- name.replace(/\W/g, '-') + '-' + hash.digest('hex'));
-
- }
-
- build() {
- if (!this._buildPromise) {
- this._buildPromise = this._buildFileMap().
- then(fileMap => this._buildHasteMap(fileMap)).
- then(hasteMap => {
- this._persist(hasteMap);
- const hasteFS = new HasteFS(hasteMap.files);
- const moduleMap = new HasteModuleMap(hasteMap.map, hasteMap.mocks);
- const __hasteMapForTest =
- process.env.NODE_ENV === 'test' && hasteMap || null;
- return this._watch(hasteMap, hasteFS, moduleMap).then(() => ({
- __hasteMapForTest,
- hasteFS,
- moduleMap }));
-
- });
- }
- return this._buildPromise;
- }
-
- /**
- * 1. read data from the cache or create an empty structure.
- */
- read() {
- return this._parse(fs.readFileSync(this._cachePath, 'utf8'));
- }
-
- readModuleMap() {
- const data = this.read();
- return new HasteModuleMap(data.map, data.mocks);
- }
-
- /**
- * 2. crawl the file system.
- */
- _buildFileMap() {
- const read = this._options.resetCache ? this._createEmptyMap : this.read;
-
- return Promise.resolve().
- then(() => read.call(this)).
- catch(() => this._createEmptyMap()).
- then(hasteMap => this._crawl(hasteMap));
- }
-
- /**
- * 3. parse and extract metadata from changed files.
- */
- _processFile(
- hasteMap,
- map,
- mocks,
- filePath,
- workerOptions)
- {
- const setModule = (id, module) => {
- if (!map[id]) {
- map[id] = Object.create(null);
- }
- const moduleMap = map[id];
- const platform =
- getPlatformExtension(module[H.PATH]) || H.GENERIC_PLATFORM;
- const existingModule = moduleMap[platform];
- if (existingModule && existingModule[H.PATH] !== module[H.PATH]) {
- const message =
- `jest-haste-map: @providesModule naming collision:\n` +
- ` Duplicate module name: ${ id }\n` +
- ` Paths: ${ module[H.PATH] } collides with ` +
- `${ existingModule[H.PATH] }\n\nThis ` +
- `${ this._options.throwOnModuleCollision ? 'error' : 'warning' } ` +
- `is caused by a @providesModule declaration ` +
- `with the same name across two different files.`;
- if (this._options.throwOnModuleCollision) {
- throw new Error(message);
- }
- this._console.warn(message);
- }
-
- moduleMap[platform] = module;
- };
-
- // If we retain all files in the virtual HasteFS representation, we avoid
- // reading them if they aren't important (node_modules).
- if (this._options.retainAllFiles && this._isNodeModulesDir(filePath)) {
- return null;
- }
-
- if (
- this._options.mocksPattern &&
- this._options.mocksPattern.test(filePath))
- {
- const mockPath = getMockName(filePath);
- if (mocks[mockPath]) {
- this._console.warn(
- `jest-haste-map: duplicate manual mock found:\n` +
- ` Module name: ${ mockPath }\n` +
- ` Duplicate Mock path: ${ filePath }\nThis warning ` +
- `is caused by two manual mock files with the same file name.\n` +
- `Jest will use the mock file found in: \n` +
- `${ filePath }\n` +
- ` Please delete one of the following two files: \n ` +
- `${ mocks[mockPath] }\n${ filePath }\n\n`);
-
- }
- mocks[mockPath] = filePath;
- }
-
- const fileMetadata = hasteMap.files[filePath];
- const moduleMetadata = hasteMap.map[fileMetadata[H.ID]];
- if (fileMetadata[H.VISITED]) {
- if (!fileMetadata[H.ID]) {
- return null;
- } else if (fileMetadata[H.ID] && moduleMetadata) {
- map[fileMetadata[H.ID]] = moduleMetadata;
- return null;
- }
- }
-
- return this._getWorker(workerOptions)({ filePath }).then(
- metadata => {
- // `1` for truthy values instead of `true` to save cache space.
- fileMetadata[H.VISITED] = 1;
- const metadataId = metadata.id;
- const metadataModule = metadata.module;
- if (metadataId && metadataModule) {
- fileMetadata[H.ID] = metadataId;
- setModule(metadataId, metadataModule);
- }
- fileMetadata[H.DEPENDENCIES] = metadata.dependencies || [];
- },
- error => {
- // If a file cannot be read we remove it from the file list and
- // ignore the failure silently.
- delete hasteMap.files[filePath];
- });
-
- }
-
- _buildHasteMap(hasteMap) {
- const map = Object.create(null);
- const mocks = Object.create(null);
- const promises = [];
-
- for (const filePath in hasteMap.files) {
- const promise = this._processFile(hasteMap, map, mocks, filePath);
- if (promise) {
- promises.push(promise);
- }
- }
-
- const cleanup = () => {
- if (this._workerFarm) {
- workerFarm.end(this._workerFarm);
- }
- this._workerFarm = null;
- this._workerPromise = null;
- };
-
- return Promise.all(promises).
- then(cleanup).
- then(() => {
- hasteMap.map = map;
- hasteMap.mocks = mocks;
- return hasteMap;
- }).
- catch(error => {
- cleanup();
- return Promise.reject(error);
- });
- }
-
- /**
- * 4. serialize the new `HasteMap` in a cache file.
- */
- _persist(hasteMap) {
- fs.writeFileSync(this._cachePath, JSON.stringify(hasteMap), 'utf8');
- }
-
- /**
- * Creates workers or parses files and extracts metadata in-process.
- */
- _getWorker(
- options)
- {
- if (!this._workerPromise) {
- let workerFn;
- if (
- options && options.forceInBand ||
- this._options.maxWorkers <= 1)
- {
- workerFn = worker;
- } else {
- this._workerFarm = workerFarm(
- {
- maxConcurrentWorkers: this._options.maxWorkers },
-
- require.resolve('./worker'));
-
- workerFn = this._workerFarm;
- }
-
- this._workerPromise = message => new Promise(
- (resolve, reject) => workerFn(message, (error, metadata) => {
- if (error || !metadata) {
- reject(error);
- } else {
- resolve(metadata);
- }
- }));
-
- }
-
- return this._workerPromise;
- }
-
- _parse(hasteMapPath) {
- const hasteMap = JSON.parse(hasteMapPath);
- for (const key in hasteMap) {
- Object.setPrototypeOf(hasteMap[key], null);
- }
- return hasteMap;
- }
-
- _crawl(hasteMap) {
- const options = this._options;
- const ignore = this._ignore.bind(this);
- const crawl =
- canUseWatchman && this._options.useWatchman ? watchmanCrawl : nodeCrawl;
-
- const retry = error => {
- if (crawl === watchmanCrawl) {
- this._console.warn(
- `jest-haste-map: Watchman crawl failed. Retrying once with node ` +
- `crawler.\n` +
- ` Usually this happens when watchman isn't running. Create an ` +
- `empty \`.watchmanconfig\` file in your project's root folder or ` +
- `initialize a git or hg repository in your project.\n` +
- ` ` + error);
-
- return nodeCrawl({
- data: hasteMap,
- extensions: options.extensions,
- forceNodeFilesystemAPI: options.forceNodeFilesystemAPI,
- ignore,
- roots: options.roots }).
- catch(e => {
- throw new Error(
- `Crawler retry failed:\n` +
- ` Original error: ${ error.message }\n` +
- ` Retry error: ${ e.message }\n`);
-
- });
- }
-
- throw error;
- };
-
- try {
- return crawl({
- data: hasteMap,
- extensions: options.extensions,
- forceNodeFilesystemAPI: options.forceNodeFilesystemAPI,
- ignore,
- roots: options.roots }).
- catch(retry);
- } catch (error) {
- return retry(error);
- }
- }
-
- /**
- * Watch mode
- */
- _watch(
- hasteMap,
- hasteFS,
- moduleMap)
- {
- if (!this._options.watch) {
- return Promise.resolve();
- }
-
- // In watch mode, we'll only warn about module collisions.
- this._options.throwOnModuleCollision = false;
-
- const Watcher = canUseWatchman && this._options.useWatchman ?
- sane.WatchmanWatcher :
- sane.NodeWatcher;
- const extensions = this._options.extensions;
- let changeQueue = Promise.resolve();
- let eventsQueue = [];
- // We only need to copy the entire haste map once on every "frame".
- let mustCopy = true;
-
- const copy = object => Object.assign(Object.create(null), object);
-
- const createWatcher = root => {
- const watcher = new Watcher(root, {
- dot: false,
- glob: extensions.map(extension => '**/*.' + extension) });
-
-
- return new Promise((resolve, reject) => {
- const rejectTimeout = setTimeout(
- () => reject(new Error('Failed to start watch mode.')),
- MAX_WAIT_TIME);
-
-
- watcher.once('ready', () => {
- clearTimeout(rejectTimeout);
- watcher.on('all', onChange);
- resolve(watcher);
- });
- });
- };
-
- const emitChange = () => {
- if (eventsQueue.length) {
- mustCopy = true;
- this.emit('change', {
- eventsQueue,
- hasteFS: new HasteFS(hasteMap.files),
- moduleMap: new HasteModuleMap(hasteMap.map, hasteMap.mocks) });
-
- eventsQueue = [];
- }
- };
-
- const onChange = (
- type,
- filePath,
- root,
- stat) =>
- {
- filePath = path.join(root, filePath);
- if (
- this._ignore(filePath) ||
- !extensions.some(extension => filePath.endsWith(extension)))
- {
- return;
- }
-
- changeQueue = changeQueue.then(() => {
- // If we get duplicate events for the same file, ignore them.
- if (
- eventsQueue.find(event =>
- event.type === type &&
- event.filePath === filePath && (
- !event.stat && !stat ||
-
- event.stat &&
- stat &&
- event.stat.mtime.getTime() === stat.mtime.getTime())))
-
-
-
- {
- return null;
- }
-
- if (mustCopy) {
- mustCopy = false;
- hasteMap = {
- clocks: copy(hasteMap.clocks),
- files: copy(hasteMap.files),
- map: copy(hasteMap.map),
- mocks: copy(hasteMap.mocks) };
-
- }
-
- const add = () => eventsQueue.push({ filePath, stat, type });
-
- // Delete the file and all of its metadata.
- const moduleName =
- hasteMap.files[filePath] && hasteMap.files[filePath][H.ID];
- delete hasteMap.files[filePath];
- delete hasteMap.map[moduleName];
- if (
- this._options.mocksPattern &&
- this._options.mocksPattern.test(filePath))
- {
- const mockName = getMockName(filePath);
- delete hasteMap.mocks[mockName];
- }
-
- // If the file was added or changed, parse it and update the haste map.
- if (type === 'add' || type === 'change') {
- const fileMetadata = ['', stat.mtime.getTime(), 0, []];
- hasteMap.files[filePath] = fileMetadata;
- const promise = this._processFile(
- hasteMap,
- hasteMap.map,
- hasteMap.mocks,
- filePath,
- {
- forceInBand: true });
-
-
- // Cleanup
- this._workerPromise = null;
- if (promise) {
- return promise.then(add);
- }
- } else {
- add();
- }
- return null;
- }).catch(error => {
- this._console.error(
- `jest-haste-map: watch error:\n ${ error }\n`);
-
- });
- };
-
- this._changeInterval = setInterval(emitChange, CHANGE_INTERVAL);
- return Promise.all(this._options.roots.map(createWatcher)).
- then(watchers => {
- this._watchers = watchers;
- });
- }
-
- end() {
- clearInterval(this._changeInterval);
- if (!this._watchers.length) {
- return Promise.resolve();
- }
-
- return Promise.all(this._watchers.map(
- watcher => new Promise(resolve => watcher.close(resolve)))).
- then(() => this._watchers = []);
- }
-
- /**
- * Helpers
- */
- _ignore(filePath) {
- return (
- this._options.ignorePattern.test(filePath) ||
- !this._options.retainAllFiles && this._isNodeModulesDir(filePath));
-
- }
-
- _isNodeModulesDir(filePath) {
- if (!filePath.includes(NODE_MODULES)) {
- return false;
- }
-
- if (this._whitelist) {
- const match = filePath.match(this._whitelist);
- return !match || match.length > 1;
- }
-
- return true;
- }
-
- _createEmptyMap() {
- return {
- clocks: Object.create(null),
- files: Object.create(null),
- map: Object.create(null),
- mocks: Object.create(null) };
-
- }}
-
-
-
-
-HasteMap.H = H;
-
-module.exports = HasteMap;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/lib/docblock.js b/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/lib/docblock.js
deleted file mode 100644
index 8774ea29a..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/lib/docblock.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-const commentEndRe = /\*\/$/;
-const commentStartRe = /^\/\*\*/;
-const docblockRe = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
-const lineCommentRe = /\/\/([^\r\n]*)/g;
-const ltrimRe = /^\s*/;
-const multilineRe =
-/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
-const propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
-const stringStartRe = /(\r?\n|^) *\*/g;
-const wsRe = /[\t ]+/g;
-
-function extract(contents) {
- const match = contents.match(docblockRe);
- return match ? match[0].replace(ltrimRe, '') || '' : '';
-}
-
-function parse(docblock) {
- docblock = docblock.
- replace(commentStartRe, '').
- replace(commentEndRe, '').
- replace(wsRe, ' ').
- replace(lineCommentRe, '').
- replace(stringStartRe, '$1');
-
- // Normalize multi-line directives
- let prev = '';
- while (prev !== docblock) {
- prev = docblock;
- docblock = docblock.replace(multilineRe, '\n$1 $2\n');
- }
- docblock = docblock.trim();
-
- const result = Object.create(null);
- let match;
- while (match = propertyRe.exec(docblock)) {
- result[match[1]] = match[2];
- }
- return result;
-}
-
-exports.extract = extract;
-exports.parse = parse;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/lib/extractRequires.js b/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/lib/extractRequires.js
deleted file mode 100644
index 045545ed1..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/lib/extractRequires.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-const blockCommentRe = /\/\*[^]*?\*\//g;
-const lineCommentRe = /\/\/.*/g;
-
-/* eslint-disable max-len */
-const replacePatterns = {
- EXPORT_RE: /(\bexport\s+(?:[^'"]+\s+from\s+)??)(['"])([^'"]+)(\2)/g,
- IMPORT_RE: /(\bimport\s+(?:[^'"]+\s+from\s+)??)(['"])([^'"]+)(\2)/g,
- REQUIRE_EXTENSIONS_PATTERN: /(\b(?:require\s*?\.\s*?(?:requireActual|requireMock)|jest\s*?\.\s*?genMockFromModule)\s*?\(\s*?)([`'"])([^`'"]+)(\2\s*?\))/g,
- REQUIRE_RE: /(\brequire\s*?\(\s*?)([`'"])([^`'"]+)(\2\s*?\))/g };
-
-/* eslint-enable max-len */
-
-function extractRequires(code) {
- const dependencies = new Set();
- const addDependency = (match, pre, quot, dep, post) => {
- dependencies.add(dep);
- return match;
- };
-
- code.
- replace(blockCommentRe, '').
- replace(lineCommentRe, '').
- replace(replacePatterns.EXPORT_RE, addDependency).
- replace(replacePatterns.IMPORT_RE, addDependency).
- replace(replacePatterns.REQUIRE_EXTENSIONS_PATTERN, addDependency).
- replace(replacePatterns.REQUIRE_RE, addDependency);
-
- return Array.from(dependencies);
-}
-
-module.exports = extractRequires;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/lib/getPlatformExtension.js b/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/lib/getPlatformExtension.js
deleted file mode 100644
index b06677498..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/lib/getPlatformExtension.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-const SUPPORTED_PLATFORM_EXTS = {
- android: true,
- ios: true,
- native: true,
- web: true };
-
-
-// Extract platform extension: index.ios.js -> ios
-function getPlatformExtension(file) {
- const last = file.lastIndexOf('.');
- const secondToLast = file.lastIndexOf('.', last - 1);
- if (secondToLast === -1) {
- return null;
- }
- const platform = file.substring(secondToLast + 1, last);
- return SUPPORTED_PLATFORM_EXTS[platform] ? platform : null;
-}
-
-module.exports = getPlatformExtension;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/types.js b/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/types.js
deleted file mode 100644
index 4780db185..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/types.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/worker.js b/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/worker.js
deleted file mode 100644
index 6b02e2a3e..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/build/worker.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-
-
-const H = require('./constants');
-
-const docblock = require('./lib/docblock');
-const extractRequires = require('./lib/extractRequires');
-const fs = require('graceful-fs');
-const path = require('path');
-
-const JSON_EXTENSION = '.json';
-const PACKAGE_JSON = path.sep + 'package' + JSON_EXTENSION;
-
-const formatError = error => {
- if (typeof error === 'string') {
- return {
- message: error,
- stack: null,
- type: 'Error' };
-
- }
-
- return {
- message: error.message,
- stack: error.stack,
- type: error.type || 'Error' };
-
-};
-
-module.exports = (data, callback) => {
- try {
- const filePath = data.filePath;
- const content = fs.readFileSync(filePath, 'utf8');
- let module;
- let id;
- let dependencies;
-
- if (filePath.endsWith(PACKAGE_JSON)) {
- const fileData = JSON.parse(content);
- if (fileData.name) {
- id = fileData.name;
- module = [filePath, H.PACKAGE];
- }
- } else if (!filePath.endsWith(JSON_EXTENSION)) {
- const doc = docblock.parse(docblock.extract(content));
- id = doc.providesModule || doc.provides;
- dependencies = extractRequires(content);
- if (id) {
- module = [filePath, H.MODULE];
- }
- }
-
- callback(null, { dependencies, id, module });
- } catch (error) {
- callback(formatError(error));
- }
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/package.json
deleted file mode 100644
index 496cfac37..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-haste-map/package.json
+++ /dev/null
@@ -1,94 +0,0 @@
-{
- "_args": [
- [
- "jest-haste-map@^17.0.3",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli"
- ]
- ],
- "_from": "jest-haste-map@>=17.0.3 <18.0.0",
- "_id": "jest-haste-map@17.0.3",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-haste-map",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-12-west.internal.npmjs.com",
- "tmp": "tmp/jest-haste-map-17.0.3.tgz_1479368474626_0.9857673794031143"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-haste-map",
- "raw": "jest-haste-map@^17.0.3",
- "rawSpec": "^17.0.3",
- "scope": null,
- "spec": ">=17.0.3 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-resolve",
- "/jest-runtime",
- "/jest/jest-cli"
- ],
- "_resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-17.0.3.tgz",
- "_shasum": "5232783e70577217b6b17d2a1c1766637a1d2fbd",
- "_shrinkwrap": null,
- "_spec": "jest-haste-map@^17.0.3",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "fb-watchman": "^1.9.0",
- "graceful-fs": "^4.1.6",
- "multimatch": "^2.1.0",
- "sane": "~1.4.1",
- "worker-farm": "^1.3.1"
- },
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "5232783e70577217b6b17d2a1c1766637a1d2fbd",
- "tarball": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-17.0.3.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- },
- {
- "email": "kentaromiura@gmail.com",
- "name": "kentaromiura"
- }
- ],
- "name": "jest-haste-map",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.3"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/index.js
deleted file mode 100644
index ba7f8bb6c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/index.js
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-
-const JasmineReporter = require('./reporter');
-
-const jasmineAsync = require('./jasmine-async');
-const fs = require('graceful-fs');
-const path = require('path');
-const vm = require('vm');
-
-const JASMINE_PATH = require.resolve('../vendor/jasmine-2.5.2.js');
-
-const jasmineScript = new vm.Script(fs.readFileSync(JASMINE_PATH, 'utf8'), {
- displayErrors: true,
- filename: JASMINE_PATH });
-
-
-function jasmine2(
-config,
-environment,
-runtime,
-testPath)
-{
- const reporter = new JasmineReporter(config, environment, testPath);
- environment.runScript(jasmineScript);
-
- const requireJasmine = environment.global.jasmineRequire;
- const jasmine = requireJasmine.core(requireJasmine);
-
- const env = jasmine.getEnv();
- const jasmineInterface = requireJasmine.interface(jasmine, env);
- Object.assign(environment.global, jasmineInterface);
- env.addReporter(jasmineInterface.jsApiReporter);
-
- jasmineAsync.install(environment.global);
-
- environment.global.test = environment.global.it;
- environment.global.it.only = environment.global.fit;
- environment.global.test.only = environment.global.fit;
- environment.global.it.skip = environment.global.xit;
- environment.global.test.skip = environment.global.xit;
- environment.global.xtest = environment.global.xit;
- environment.global.context = environment.global.describe;
- environment.global.xcontext = environment.global.xdescribe;
- environment.global.context.skip = environment.global.xdescribe;
- environment.global.describe.skip = environment.global.xdescribe;
- environment.global.describe.only = environment.global.fdescribe;
-
- env.beforeEach(() => {
- if (config.resetModules) {
- runtime.resetModules();
- }
-
- if (config.resetMocks) {
- runtime.resetAllMocks();
- }
- });
-
- env.addReporter(reporter);
-
- runtime.requireInternalModule(
- path.resolve(__dirname, './jest-expect.js'))(
- config);
-
- const snapshotState = runtime.requireInternalModule(
- path.resolve(__dirname, './setup-jest-globals.js'))(
- { config, testPath });
-
- if (config.setupTestFrameworkScriptFile) {
- runtime.requireModule(config.setupTestFrameworkScriptFile);
- }
-
- if (config.timers === 'fake') {
- environment.fakeTimers.useFakeTimers();
- }
-
- if (config.testNamePattern) {
- const testNameRegex = new RegExp(config.testNamePattern);
- env.specFilter = spec => testNameRegex.test(spec.getFullName());
- }
-
- runtime.requireModule(testPath);
- env.execute();
- return reporter.
- getResults().
- then(results => addSnapshotData(results, config, snapshotState));
-}
-
-const addSnapshotData = (results, config, snapshotState) => {
- results.testResults.forEach((_ref) => {let fullName = _ref.fullName,status = _ref.status;
- if (status === 'pending' || status === 'failed') {
- // if test is skipped or failed, we don't want to mark
- // its snapshots as obsolete.
- snapshotState.markSnapshotsAsCheckedForTest(fullName);
- }
- });
-
- const updateSnapshot = config.updateSnapshot;
- const uncheckedCount = snapshotState.getUncheckedCount();
- if (updateSnapshot) {
- snapshotState.removeUncheckedKeys();
- }
- const status = snapshotState.save(updateSnapshot);
-
- results.snapshot.fileDeleted = status.deleted;
- results.snapshot.added = snapshotState.added;
- results.snapshot.matched = snapshotState.matched;
- results.snapshot.unmatched = snapshotState.unmatched;
- results.snapshot.updated = snapshotState.updated;
- results.snapshot.unchecked = !status.deleted ? uncheckedCount : 0;
- return results;
-};
-
-module.exports = jasmine2;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/jasmine-async.js b/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/jasmine-async.js
deleted file mode 100644
index 7a59cead9..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/jasmine-async.js
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-/**
- * This module adds ability to test async promise code with jasmine by
- * returning a promise from `it\fit` and `beforeEach/afterEach` blocks.
- */
-
-'use strict';
-
-
-
-function isPromise(obj) {
- return obj && typeof obj.then === 'function';
-}
-
-// return a wrapping function: `env.fit = promisifyIt(env.it, env)`
-function promisifyIt(originalFn, env) {
- return function (specName, fn, timeout) {
- if (!fn) {
- const spec = originalFn.call(env, specName);
- spec.pend('not implemented');
- return spec;
- }
-
- const isAsync = fn.length; // `done` was passed
-
- if (isAsync) {
- // jasmine will handle it
- return originalFn.call(env, specName, fn, timeout);
- } else {
- // we make *all* tests async and run `done` right away if they
- // didn't return a promise.
- return originalFn.call(env, specName, function (done) {
- const returnValue = fn.apply(this, arguments);
-
- if (isPromise(returnValue)) {
- returnValue.then(done).catch(done.fail);
- } else if (returnValue === undefined) {
- done();
- } else {
- done.fail(new Error(
- 'Jest: `it` must return either a Promise or undefined.'));
-
- }
- }, timeout);
- }
- };
-}
-
-function promisifyLifeCycleFunction(originalFn, env) {
- return function (fn, timeout) {
- const hasDoneCallback = fn.length;
- if (!hasDoneCallback) {
- const originalBodyFn = fn;
- fn = function (done) {
- const returnValue = originalBodyFn.apply(this, arguments);
- if (isPromise(returnValue)) {
- returnValue.then(done, done.fail);
- } else {
- done();
- }
- };
- }
-
- return originalFn.call(env, fn, timeout);
- };
-}
-
-function makeConcurrent(originalFn, env) {
- return function (specName, fn, timeout) {
- let promise;
-
- try {
- promise = fn();
- if (!isPromise(promise)) {
- throw new Error('Jest: concurrent tests must return a Promise.');
- }
- } catch (error) {
- return originalFn.call(env, Promise.reject(error));
- }
-
- return originalFn.call(env, specName, () => promise, timeout);
- };
-}
-
-function install(global) {
- const jasmine = global.jasmine;
-
- const env = jasmine.getEnv();
- global.pit = env.it = promisifyIt(env.it, env);
- env.fit = promisifyIt(env.fit, env);
- global.it.concurrent = makeConcurrent(env.it, env);
- global.it.concurrent.only = makeConcurrent(env.fit, env);
- global.it.concurrent.skip = makeConcurrent(env.xit, env);
- global.fit.concurrent = makeConcurrent(env.fit);
- env.afterAll = promisifyLifeCycleFunction(env.afterAll, env);
- env.afterEach = promisifyLifeCycleFunction(env.afterEach, env);
- env.beforeAll = promisifyLifeCycleFunction(env.beforeAll, env);
- env.beforeEach = promisifyLifeCycleFunction(env.beforeEach, env);
-}
-
-module.exports = {
- install };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/jest-expect.js b/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/jest-expect.js
deleted file mode 100644
index db52afb7e..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/jest-expect.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';var _require =
-
-
-
-
-require('jest-matchers');const expect = _require.expect,setState = _require.setState;var _require2 =
-
-
-
-
-require('jest-snapshot');const toMatchSnapshot = _require2.toMatchSnapshot,toThrowErrorMatchingSnapshot = _require2.toThrowErrorMatchingSnapshot;
-
-
-
-
-
-
-
-
-module.exports = config => {
- global.expect = expect;
- setState({
- expand: config.expand });
-
- expect.extend({ toMatchSnapshot, toThrowErrorMatchingSnapshot });
-
- const jasmine = global.jasmine;
- jasmine.addMatchers = jasmineMatchersObject => {
- const jestMatchersObject = Object.create(null);
- Object.keys(jasmineMatchersObject).forEach(name => {
- jestMatchersObject[name] = function () {
- const result = jasmineMatchersObject[name](jasmine.matchersUtil, null);
- // if there is no 'negativeCompare', both should be handled by `compare`
- const negativeCompare = result.negativeCompare || result.compare;
-
- return this.isNot ?
- negativeCompare.apply(null, arguments) :
- result.compare.apply(null, arguments);
- };
- });
-
- global.expect.extend(jestMatchersObject);
- };
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/reporter.js b/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/reporter.js
deleted file mode 100644
index 56873bdca..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/reporter.js
+++ /dev/null
@@ -1,164 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-
-
-
-
-
-
-const jasmineRequire = require('../vendor/jasmine-2.5.2.js');
-const jasmine = jasmineRequire.core(jasmineRequire);var _require =
-require('jest-util');const formatResultsErrors = _require.formatResultsErrors,JasmineFormatter = _require.JasmineFormatter;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-class Jasmine2Reporter {
-
-
-
-
-
-
-
-
-
- constructor(config, environment, testPath) {
- this._formatter = new JasmineFormatter(jasmine, environment, config);
- this._config = config;
- this._testPath = testPath;
- this._testResults = [];
- this._currentSuites = [];
- this._resolve = null;
- this._resultsPromise = new Promise(resolve => this._resolve = resolve);
- this._startTimes = new Map();
- }
-
- specStarted(spec) {
- this._startTimes.set(spec.id, Date.now());
- }
-
- specDone(result) {
- this._testResults.push(
- this._extractSpecResults(result, this._currentSuites.slice(0)));
-
- }
-
- suiteStarted(suite) {
- this._currentSuites.push(suite.description);
- }
-
- suiteDone() {
- this._currentSuites.pop();
- }
-
- jasmineDone() {
- let numFailingTests = 0;
- let numPassingTests = 0;
- let numPendingTests = 0;
- const testResults = this._testResults;
- testResults.forEach(testResult => {
- if (testResult.status === 'failed') {
- numFailingTests++;
- } else if (testResult.status === 'pending') {
- numPendingTests++;
- } else {
- numPassingTests++;
- }
- });
-
- const testResult = {
- console: null,
- failureMessage: formatResultsErrors(
- testResults,
- this._config,
- this._testPath),
-
- numFailingTests,
- numPassingTests,
- numPendingTests,
- perfStats: {
- end: 0,
- start: 0 },
-
- snapshot: {
- added: 0,
- fileDeleted: false,
- matched: 0,
- unchecked: 0,
- unmatched: 0,
- updated: 0 },
-
- testFilePath: this._testPath,
- testResults };
-
-
- this._resolve(testResult);
- }
-
- getFormatter() {
- return this._formatter;
- }
-
- getResults() {
- return this._resultsPromise;
- }
-
- _extractSpecResults(
- specResult,
- ancestorTitles)
- {
- const start = this._startTimes.get(specResult.id);
- const duration = start ? Date.now() - start : undefined;
- const status =
- specResult.status === 'disabled' ? 'pending' : specResult.status;
- const results = {
- ancestorTitles,
- duration,
- failureMessages: [],
- fullName: specResult.fullName,
- numPassingAsserts: 0, // Jasmine2 only returns an array of failed asserts.
- status,
- title: specResult.description };
-
-
- specResult.failedExpectations.forEach(failed => {
- let message;
- if (!failed.matcherName && failed.stack) {
- message = failed.stack;
- } else {
- message = this._formatter.formatMatchFailure(failed);
- }
- results.failureMessages.push(message);
- });
-
- return results;
- }}
-
-
-module.exports = Jasmine2Reporter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/setup-jest-globals.js b/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/setup-jest-globals.js
deleted file mode 100644
index c48c1df20..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/build/setup-jest-globals.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';var _require =
-
-
-
-require('jest-matchers');const getState = _require.getState,setState = _require.setState;var _require2 =
-require('jest-snapshot');const initializeSnapshotState = _require2.initializeSnapshotState,addPlugins = _require2.addPlugins;
-
-// Get suppressed errors form jest-matchers that weren't throw during
-// test execution and add them to the test result, potentially failing
-// a passing test.
-const addSuppressedErrors = result => {var _getState =
- getState();const suppressedErrors = _getState.suppressedErrors;
- setState({ suppressedErrors: [] });
- if (suppressedErrors.length) {
- result.status = 'failed';
-
- result.failedExpectations = suppressedErrors.map(error => ({
- actual: '',
- expected: '',
- message: error.message,
- passed: false,
- stack: error.stack }));
-
- }
-};
-
-const patchJasmine = () => {
- global.jasmine.Spec = (realSpec => {
- const Spec = function Spec(attr) {
- const resultCallback = attr.resultCallback;
- attr.resultCallback = function (result) {
- addSuppressedErrors(result);
- resultCallback.call(attr, result);
- };
-
- const onStart = attr.onStart;
- attr.onStart = context => {
- setState({ currentTestName: context.getFullName() });
- onStart && onStart.call(attr, context);
- };
-
- realSpec.call(this, attr);
- };
-
- Spec.prototype = realSpec.prototype;
- for (const statics in realSpec) {
- if (Object.prototype.hasOwnProperty.call(realSpec, statics)) {
- Spec[statics] = realSpec[statics];
- }
- }
- return Spec;
-
- })(global.jasmine.Spec);
-};
-
-
-
-
-
-
-module.exports = (_ref) => {let testPath = _ref.testPath,config = _ref.config;
- addPlugins(config.snapshotSerializers);
- setState({ testPath });
- patchJasmine();
- const snapshotState = initializeSnapshotState(
- testPath,
- config.updateSnapshot,
- '',
- config.expand);
-
- setState({ snapshotState });
- // Return it back to the outer scope (test runner outside the VM).
- return snapshotState;
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/package.json
deleted file mode 100644
index d0b504423..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/package.json
+++ /dev/null
@@ -1,92 +0,0 @@
-{
- "_args": [
- [
- "jest-jasmine2@^17.0.3",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli"
- ]
- ],
- "_from": "jest-jasmine2@>=17.0.3 <18.0.0",
- "_id": "jest-jasmine2@17.0.3",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-jasmine2",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-12-west.internal.npmjs.com",
- "tmp": "tmp/jest-jasmine2-17.0.3.tgz_1479368475384_0.9555567961651832"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-jasmine2",
- "raw": "jest-jasmine2@^17.0.3",
- "rawSpec": "^17.0.3",
- "scope": null,
- "spec": ">=17.0.3 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-config",
- "/jest/jest-cli"
- ],
- "_resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-17.0.3.tgz",
- "_shasum": "d4336b89f3ad288269a1c8e2bfc180dcf89c6ad1",
- "_shrinkwrap": null,
- "_spec": "jest-jasmine2@^17.0.3",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "graceful-fs": "^4.1.6",
- "jest-matchers": "^17.0.3",
- "jest-snapshot": "^17.0.3",
- "jest-util": "^17.0.2"
- },
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "d4336b89f3ad288269a1c8e2bfc180dcf89c6ad1",
- "tarball": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-17.0.3.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- },
- {
- "email": "kentaromiura@gmail.com",
- "name": "kentaromiura"
- }
- ],
- "name": "jest-jasmine2",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.3"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/vendor/jasmine-2.5.2.js b/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/vendor/jasmine-2.5.2.js
deleted file mode 100644
index 9c235425d..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2/vendor/jasmine-2.5.2.js
+++ /dev/null
@@ -1,3667 +0,0 @@
-/*
-Copyright (c) 2008-2016 Pivotal Labs
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var getJasmineRequireObj = (function (jasmineGlobal) {
- var jasmineRequire;
-
- if (typeof module !== 'undefined' && module.exports && typeof exports !== 'undefined') {
- if (typeof global !== 'undefined') {
- jasmineGlobal = global;
- } else {
- jasmineGlobal = {};
- }
- jasmineRequire = exports;
- } else {
- if (typeof window !== 'undefined' && typeof window.toString === 'function' && window.toString() === '[object GjsGlobal]') {
- jasmineGlobal = window;
- }
- jasmineRequire = jasmineGlobal.jasmineRequire = jasmineGlobal.jasmineRequire || {};
- }
-
- function getJasmineRequire() {
- return jasmineRequire;
- }
-
- getJasmineRequire().core = function(jRequire) {
- var j$ = {};
-
- jRequire.base(j$, jasmineGlobal);
- j$.util = jRequire.util();
- j$.errors = jRequire.errors();
- j$.formatErrorMsg = jRequire.formatErrorMsg();
- j$.Any = jRequire.Any(j$);
- j$.Anything = jRequire.Anything(j$);
- j$.CallTracker = jRequire.CallTracker(j$);
- j$.MockDate = jRequire.MockDate();
- j$.Clock = jRequire.Clock();
- j$.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler();
- j$.Env = jRequire.Env(j$);
- j$.ExceptionFormatter = jRequire.ExceptionFormatter();
- j$.Expectation = jRequire.Expectation();
- j$.buildExpectationResult = jRequire.buildExpectationResult();
- j$.JsApiReporter = jRequire.JsApiReporter();
- j$.matchersUtil = jRequire.matchersUtil(j$);
- j$.ObjectContaining = jRequire.ObjectContaining(j$);
- j$.ArrayContaining = jRequire.ArrayContaining(j$);
- j$.pp = jRequire.pp(j$);
- j$.QueueRunner = jRequire.QueueRunner(j$);
- j$.ReportDispatcher = jRequire.ReportDispatcher();
- j$.Spec = jRequire.Spec(j$);
- j$.SpyRegistry = jRequire.SpyRegistry(j$);
- j$.SpyStrategy = jRequire.SpyStrategy(j$);
- j$.StringMatching = jRequire.StringMatching(j$);
- j$.Suite = jRequire.Suite(j$);
- j$.Timer = jRequire.Timer();
- j$.TreeProcessor = jRequire.TreeProcessor();
- j$.version = jRequire.version();
- j$.Order = jRequire.Order();
-
- j$.matchers = jRequire.requireMatchers(jRequire, j$);
-
- return j$;
- };
-
- return getJasmineRequire;
-})(this);
-
-getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
- var availableMatchers = [
- 'toBe',
- 'toBeCloseTo',
- 'toBeDefined',
- 'toBeFalsy',
- 'toBeGreaterThan',
- 'toBeGreaterThanOrEqual',
- 'toBeLessThanOrEqual',
- 'toBeLessThan',
- 'toBeNaN',
- 'toBeNull',
- 'toBeTruthy',
- 'toBeUndefined',
- 'toContain',
- 'toEqual',
- 'toHaveBeenCalled',
- 'toHaveBeenCalledWith',
- 'toHaveBeenCalledTimes',
- 'toMatch',
- 'toThrow',
- 'toThrowError'
- ],
- matchers = {};
-
- for (var i = 0; i < availableMatchers.length; i++) {
- var name = availableMatchers[i];
- matchers[name] = jRequire[name](j$);
- }
-
- return matchers;
-};
-
-getJasmineRequireObj().base = function(j$, jasmineGlobal) {
- j$.unimplementedMethod_ = function() {
- throw new Error('unimplemented method');
- };
-
- j$.MAX_PRETTY_PRINT_DEPTH = 40;
- j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 100;
- j$.DEFAULT_TIMEOUT_INTERVAL = 5000;
-
- j$.getGlobal = function() {
- return jasmineGlobal;
- };
-
- j$.getEnv = function(options) {
- var env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options);
- //jasmine. singletons in here (setTimeout blah blah).
- return env;
- };
-
- j$.isArray_ = function(value) {
- return j$.isA_('Array', value);
- };
-
- j$.isString_ = function(value) {
- return j$.isA_('String', value);
- };
-
- j$.isNumber_ = function(value) {
- return j$.isA_('Number', value);
- };
-
- j$.isFunction_ = function(value) {
- return j$.isA_('Function', value);
- };
-
- j$.isA_ = function(typeName, value) {
- return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
- };
-
- j$.isDomNode = function(obj) {
- return obj.nodeType > 0;
- };
-
- j$.fnNameFor = function(func) {
- if (func.name) {
- return func.name;
- }
-
- var matches = func.toString().match(/^\s*function\s*(\w*)\s*\(/);
- return matches ? matches[1] : '';
- };
-
- j$.any = function(clazz) {
- return new j$.Any(clazz);
- };
-
- j$.anything = function() {
- return new j$.Anything();
- };
-
- j$.objectContaining = function(sample) {
- return new j$.ObjectContaining(sample);
- };
-
- j$.stringMatching = function(expected) {
- return new j$.StringMatching(expected);
- };
-
- j$.arrayContaining = function(sample) {
- return new j$.ArrayContaining(sample);
- };
-
- j$.createSpy = function(name, originalFn) {
-
- var spyStrategy = new j$.SpyStrategy({
- name: name,
- fn: originalFn,
- getSpy: function() { return spy; }
- }),
- callTracker = new j$.CallTracker(),
- spy = function() {
- var callData = {
- object: this,
- args: Array.prototype.slice.apply(arguments)
- };
-
- callTracker.track(callData);
- var returnValue = spyStrategy.exec.apply(this, arguments);
- callData.returnValue = returnValue;
-
- return returnValue;
- };
-
- for (var prop in originalFn) {
- if (prop === 'and' || prop === 'calls') {
- throw new Error('Jasmine spies would overwrite the \'and\' and \'calls\' properties on the object being spied upon');
- }
-
- spy[prop] = originalFn[prop];
- }
-
- spy.and = spyStrategy;
- spy.calls = callTracker;
-
- return spy;
- };
-
- j$.isSpy = function(putativeSpy) {
- if (!putativeSpy) {
- return false;
- }
- return putativeSpy.and instanceof j$.SpyStrategy &&
- putativeSpy.calls instanceof j$.CallTracker;
- };
-
- j$.createSpyObj = function(baseName, methodNames) {
- if (j$.isArray_(baseName) && j$.util.isUndefined(methodNames)) {
- methodNames = baseName;
- baseName = 'unknown';
- }
-
- if (!j$.isArray_(methodNames) || methodNames.length === 0) {
- throw 'createSpyObj requires a non-empty array of method names to create spies for';
- }
- var obj = {};
- for (var i = 0; i < methodNames.length; i++) {
- obj[methodNames[i]] = j$.createSpy(baseName + '.' + methodNames[i]);
- }
- return obj;
- };
-};
-
-getJasmineRequireObj().util = function() {
-
- var util = {};
-
- util.inherit = function(childClass, parentClass) {
- var Subclass = function() {
- };
- Subclass.prototype = parentClass.prototype;
- childClass.prototype = new Subclass();
- };
-
- util.htmlEscape = function(str) {
- if (!str) {
- return str;
- }
- return str.replace(/&/g, '&')
- .replace(//g, '>');
- };
-
- util.argsToArray = function(args) {
- var arrayOfArgs = [];
- for (var i = 0; i < args.length; i++) {
- arrayOfArgs.push(args[i]);
- }
- return arrayOfArgs;
- };
-
- util.isUndefined = function(obj) {
- return obj === void 0;
- };
-
- util.arrayContains = function(array, search) {
- var i = array.length;
- while (i--) {
- if (array[i] === search) {
- return true;
- }
- }
- return false;
- };
-
- util.clone = function(obj) {
- if (Object.prototype.toString.apply(obj) === '[object Array]') {
- return obj.slice();
- }
-
- var cloned = {};
- for (var prop in obj) {
- // @ccarlesso allows looping on objects without `Object.prototype`.
- if (Object.prototype.hasOwnProperty.call(obj, prop)) {
- cloned[prop] = obj[prop];
- }
- }
-
- return cloned;
- };
-
- return util;
-};
-
-getJasmineRequireObj().Spec = function(j$) {
- function Spec(attrs) {
- this.expectationFactory = attrs.expectationFactory;
- this.resultCallback = attrs.resultCallback || function() {};
- this.id = attrs.id;
- this.description = attrs.description || '';
- this.queueableFn = attrs.queueableFn;
- this.beforeAndAfterFns = attrs.beforeAndAfterFns || function() { return {befores: [], afters: []}; };
- this.userContext = attrs.userContext || function() { return {}; };
- this.onStart = attrs.onStart || function() {};
- this.getSpecName = attrs.getSpecName || function() { return ''; };
- this.expectationResultFactory = attrs.expectationResultFactory || function() { };
- this.queueRunnerFactory = attrs.queueRunnerFactory || function() {};
- this.catchingExceptions = attrs.catchingExceptions || function() { return true; };
- this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
-
- if (!this.queueableFn.fn) {
- this.pend();
- }
-
- this.result = {
- id: this.id,
- description: this.description,
- fullName: this.getFullName(),
- failedExpectations: [],
- passedExpectations: [],
- pendingReason: ''
- };
- }
-
- Spec.prototype.addExpectationResult = function(passed, data, isError) {
- var expectationResult = this.expectationResultFactory(data);
- if (passed) {
- this.result.passedExpectations.push(expectationResult);
- } else {
- this.result.failedExpectations.push(expectationResult);
-
- if (this.throwOnExpectationFailure && !isError) {
- throw new j$.errors.ExpectationFailed();
- }
- }
- };
-
- Spec.prototype.expect = function(actual) {
- return this.expectationFactory(actual, this);
- };
-
- Spec.prototype.execute = function(onComplete, enabled) {
- var self = this;
-
- this.onStart(this);
-
- if (!this.isExecutable() || this.markedPending || enabled === false) {
- complete(enabled);
- return;
- }
-
- var fns = this.beforeAndAfterFns();
- var allFns = fns.befores.concat(this.queueableFn).concat(fns.afters);
-
- this.queueRunnerFactory({
- queueableFns: allFns,
- onException: function() { self.onException.apply(self, arguments); },
- onComplete: complete,
- userContext: this.userContext()
- });
-
- function complete(enabledAgain) {
- self.result.status = self.status(enabledAgain);
- self.resultCallback(self.result);
-
- if (onComplete) {
- onComplete();
- }
- }
- };
-
- Spec.prototype.onException = function onException(e) {
- if (Spec.isPendingSpecException(e)) {
- this.pend(extractCustomPendingMessage(e));
- return;
- }
-
- if (e instanceof j$.errors.ExpectationFailed) {
- return;
- }
-
- this.addExpectationResult(false, {
- matcherName: '',
- passed: false,
- expected: '',
- actual: '',
- error: e
- }, true);
- };
-
- Spec.prototype.disable = function() {
- this.disabled = true;
- };
-
- Spec.prototype.pend = function(message) {
- this.markedPending = true;
- if (message) {
- this.result.pendingReason = message;
- }
- };
-
- Spec.prototype.getResult = function() {
- this.result.status = this.status();
- return this.result;
- };
-
- Spec.prototype.status = function(enabled) {
- if (this.disabled || enabled === false) {
- return 'disabled';
- }
-
- if (this.markedPending) {
- return 'pending';
- }
-
- if (this.result.failedExpectations.length > 0) {
- return 'failed';
- } else {
- return 'passed';
- }
- };
-
- Spec.prototype.isExecutable = function() {
- return !this.disabled;
- };
-
- Spec.prototype.getFullName = function() {
- return this.getSpecName(this);
- };
-
- var extractCustomPendingMessage = function(e) {
- var fullMessage = e.toString(),
- boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage),
- boilerplateEnd = boilerplateStart + Spec.pendingSpecExceptionMessage.length;
-
- return fullMessage.substr(boilerplateEnd);
- };
-
- Spec.pendingSpecExceptionMessage = '=> marked Pending';
-
- Spec.isPendingSpecException = function(e) {
- return !!(e && e.toString && e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1);
- };
-
- return Spec;
-};
-
-if (typeof window == void 0 && typeof exports == 'object') {
- exports.Spec = jasmineRequire.Spec;
-}
-
-/*jshint bitwise: false*/
-
-getJasmineRequireObj().Order = function() {
- function Order(options) {
- this.random = 'random' in options ? options.random : true;
- var seed = this.seed = options.seed || generateSeed();
- this.sort = this.random ? randomOrder : naturalOrder;
-
- function naturalOrder(items) {
- return items;
- }
-
- function randomOrder(items) {
- var copy = items.slice();
- copy.sort(function(a, b) {
- return jenkinsHash(seed + a.id) - jenkinsHash(seed + b.id);
- });
- return copy;
- }
-
- function generateSeed() {
- return String(Math.random()).slice(-5);
- }
-
- // Bob Jenkins One-at-a-Time Hash algorithm is a non-cryptographic hash function
- // used to get a different output when the key changes slighly.
- // We use your return to sort the children randomly in a consistent way when
- // used in conjunction with a seed
-
- function jenkinsHash(key) {
- var hash, i;
- for(hash = i = 0; i < key.length; ++i) {
- hash += key.charCodeAt(i);
- hash += (hash << 10);
- hash ^= (hash >> 6);
- }
- hash += (hash << 3);
- hash ^= (hash >> 11);
- hash += (hash << 15);
- return hash;
- }
-
- }
-
- return Order;
-};
-
-getJasmineRequireObj().Env = function(j$) {
- function Env(options) {
- options = options || {};
-
- var self = this;
- var global = options.global || j$.getGlobal();
-
- var totalSpecsDefined = 0;
-
- var catchExceptions = true;
-
- var realSetTimeout = j$.getGlobal().setTimeout;
- var realClearTimeout = j$.getGlobal().clearTimeout;
- this.clock = new j$.Clock(global, function () { return new j$.DelayedFunctionScheduler(); }, new j$.MockDate(global));
-
- var runnableResources = {};
-
- var currentSpec = null;
- var currentlyExecutingSuites = [];
- var currentDeclarationSuite = null;
- var throwOnExpectationFailure = false;
- var random = false;
- var seed = null;
-
- var currentSuite = function() {
- return currentlyExecutingSuites[currentlyExecutingSuites.length - 1];
- };
-
- var currentRunnable = function() {
- return currentSpec || currentSuite();
- };
-
- var reporter = new j$.ReportDispatcher([
- 'jasmineStarted',
- 'jasmineDone',
- 'suiteStarted',
- 'suiteDone',
- 'specStarted',
- 'specDone'
- ]);
-
- this.specFilter = function() {
- return true;
- };
-
- this.addCustomEqualityTester = function(tester) {
- if(!currentRunnable()) {
- throw new Error('Custom Equalities must be added in a before function or a spec');
- }
- runnableResources[currentRunnable().id].customEqualityTesters.push(tester);
- };
-
- this.addMatchers = function(matchersToAdd) {
- if(!currentRunnable()) {
- throw new Error('Matchers must be added in a before function or a spec');
- }
- var customMatchers = runnableResources[currentRunnable().id].customMatchers;
- for (var matcherName in matchersToAdd) {
- customMatchers[matcherName] = matchersToAdd[matcherName];
- }
- };
-
- j$.Expectation.addCoreMatchers(j$.matchers);
-
- var nextSpecId = 0;
- var getNextSpecId = function() {
- return 'spec' + nextSpecId++;
- };
-
- var nextSuiteId = 0;
- var getNextSuiteId = function() {
- return 'suite' + nextSuiteId++;
- };
-
- var expectationFactory = function(actual, spec) {
- return j$.Expectation.Factory({
- util: j$.matchersUtil,
- customEqualityTesters: runnableResources[spec.id].customEqualityTesters,
- customMatchers: runnableResources[spec.id].customMatchers,
- actual: actual,
- addExpectationResult: addExpectationResult
- });
-
- function addExpectationResult(passed, result) {
- return spec.addExpectationResult(passed, result);
- }
- };
-
- var defaultResourcesForRunnable = function(id, parentRunnableId) {
- var resources = {spies: [], customEqualityTesters: [], customMatchers: {}};
-
- if(runnableResources[parentRunnableId]){
- resources.customEqualityTesters = j$.util.clone(runnableResources[parentRunnableId].customEqualityTesters);
- resources.customMatchers = j$.util.clone(runnableResources[parentRunnableId].customMatchers);
- }
-
- runnableResources[id] = resources;
- };
-
- var clearResourcesForRunnable = function(id) {
- spyRegistry.clearSpies();
- delete runnableResources[id];
- };
-
- var beforeAndAfterFns = function(suite) {
- return function() {
- var befores = [],
- afters = [];
-
- while(suite) {
- befores = befores.concat(suite.beforeFns);
- afters = afters.concat(suite.afterFns);
-
- suite = suite.parentSuite;
- }
-
- return {
- befores: befores.reverse(),
- afters: afters
- };
- };
- };
-
- var getSpecName = function(spec, suite) {
- var fullName = [spec.description],
- suiteFullName = suite.getFullName();
-
- if (suiteFullName !== '') {
- fullName.unshift(suiteFullName);
- // CUSTOM JEST CHANGE: we append "test" at the top level for snapshots.
- } else if (!suite.parentSuite) {
- fullName.unshift('test');
- }
- return fullName.join(' ');
- };
-
- // TODO: we may just be able to pass in the fn instead of wrapping here
- var buildExpectationResult = j$.buildExpectationResult,
- exceptionFormatter = new j$.ExceptionFormatter(),
- expectationResultFactory = function(attrs) {
- attrs.messageFormatter = exceptionFormatter.message;
- attrs.stackFormatter = exceptionFormatter.stack;
-
- return buildExpectationResult(attrs);
- };
-
- // TODO: fix this naming, and here's where the value comes in
- this.catchExceptions = function(value) {
- catchExceptions = !!value;
- return catchExceptions;
- };
-
- this.catchingExceptions = function() {
- return catchExceptions;
- };
-
- var maximumSpecCallbackDepth = 20;
- var currentSpecCallbackDepth = 0;
-
- function clearStack(fn) {
- currentSpecCallbackDepth++;
- if (currentSpecCallbackDepth >= maximumSpecCallbackDepth) {
- currentSpecCallbackDepth = 0;
- realSetTimeout(fn, 0);
- } else {
- fn();
- }
- }
-
- var catchException = function(e) {
- return j$.Spec.isPendingSpecException(e) || catchExceptions;
- };
-
- this.throwOnExpectationFailure = function(value) {
- throwOnExpectationFailure = !!value;
- };
-
- this.throwingExpectationFailures = function() {
- return throwOnExpectationFailure;
- };
-
- this.randomizeTests = function(value) {
- random = !!value;
- };
-
- this.randomTests = function() {
- return random;
- };
-
- this.seed = function(value) {
- if (value) {
- seed = value;
- }
- return seed;
- };
-
- var queueRunnerFactory = function(options) {
- options.catchException = catchException;
- options.clearStack = options.clearStack || clearStack;
- options.timeout = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout};
- options.fail = self.fail;
-
- new j$.QueueRunner(options).execute();
- };
-
- var topSuite = new j$.Suite({
- env: this,
- id: getNextSuiteId(),
- description: 'test',
- expectationFactory: expectationFactory,
- expectationResultFactory: expectationResultFactory
- });
- defaultResourcesForRunnable(topSuite.id);
- currentDeclarationSuite = topSuite;
-
- this.topSuite = function() {
- return topSuite;
- };
-
- this.execute = function(runnablesToRun) {
- if(!runnablesToRun) {
- if (focusedRunnables.length) {
- runnablesToRun = focusedRunnables;
- } else {
- runnablesToRun = [topSuite.id];
- }
- }
-
- var order = new j$.Order({
- random: random,
- seed: seed
- });
-
- var processor = new j$.TreeProcessor({
- tree: topSuite,
- runnableIds: runnablesToRun,
- queueRunnerFactory: queueRunnerFactory,
- nodeStart: function(suite) {
- currentlyExecutingSuites.push(suite);
- defaultResourcesForRunnable(suite.id, suite.parentSuite.id);
- reporter.suiteStarted(suite.result);
- },
- nodeComplete: function(suite, result) {
- if (!suite.disabled) {
- clearResourcesForRunnable(suite.id);
- }
- currentlyExecutingSuites.pop();
- reporter.suiteDone(result);
- },
- orderChildren: function(node) {
- return order.sort(node.children);
- }
- });
-
- if(!processor.processTree().valid) {
- throw new Error('Invalid order: would cause a beforeAll or afterAll to be run multiple times');
- }
-
- reporter.jasmineStarted({
- totalSpecsDefined: totalSpecsDefined
- });
-
- currentlyExecutingSuites.push(topSuite);
-
- processor.execute(function() {
- clearResourcesForRunnable(topSuite.id);
- currentlyExecutingSuites.pop();
-
- reporter.jasmineDone({
- order: order,
- failedExpectations: topSuite.result.failedExpectations
- });
- });
- };
-
- this.addReporter = function(reporterToAdd) {
- reporter.addReporter(reporterToAdd);
- };
-
- this.provideFallbackReporter = function(reporterToAdd) {
- reporter.provideFallbackReporter(reporterToAdd);
- };
-
- this.clearReporters = function() {
- reporter.clearReporters();
- };
-
- var spyRegistry = new j$.SpyRegistry({currentSpies: function() {
- if(!currentRunnable()) {
- throw new Error('Spies must be created in a before function or a spec');
- }
- return runnableResources[currentRunnable().id].spies;
- }});
-
- this.allowRespy = function(allow){
- spyRegistry.allowRespy(allow);
- };
-
- this.spyOn = function() {
- return spyRegistry.spyOn.apply(spyRegistry, arguments);
- };
-
- var suiteFactory = function(description) {
- var suite = new j$.Suite({
- env: self,
- id: getNextSuiteId(),
- description: description,
- parentSuite: currentDeclarationSuite,
- expectationFactory: expectationFactory,
- expectationResultFactory: expectationResultFactory,
- throwOnExpectationFailure: throwOnExpectationFailure
- });
-
- return suite;
- };
-
- this.describe = function(description, specDefinitions) {
- var suite = suiteFactory(description);
- if (specDefinitions.length > 0) {
- throw new Error('describe does not expect any arguments');
- }
- if (currentDeclarationSuite.markedPending) {
- suite.pend();
- }
- addSpecsToSuite(suite, specDefinitions);
- return suite;
- };
-
- this.xdescribe = function(description, specDefinitions) {
- var suite = suiteFactory(description);
- suite.pend();
- addSpecsToSuite(suite, specDefinitions);
- return suite;
- };
-
- var focusedRunnables = [];
-
- this.fdescribe = function(description, specDefinitions) {
- var suite = suiteFactory(description);
- suite.isFocused = true;
-
- focusedRunnables.push(suite.id);
- unfocusAncestor();
- addSpecsToSuite(suite, specDefinitions);
-
- return suite;
- };
-
- function addSpecsToSuite(suite, specDefinitions) {
- var parentSuite = currentDeclarationSuite;
- parentSuite.addChild(suite);
- currentDeclarationSuite = suite;
-
- var declarationError = null;
- try {
- specDefinitions.call(suite);
- } catch (e) {
- declarationError = e;
- }
-
- if (declarationError) {
- self.it('encountered a declaration exception', function() {
- throw declarationError;
- });
- }
-
- currentDeclarationSuite = parentSuite;
- }
-
- function findFocusedAncestor(suite) {
- while (suite) {
- if (suite.isFocused) {
- return suite.id;
- }
- suite = suite.parentSuite;
- }
-
- return null;
- }
-
- function unfocusAncestor() {
- var focusedAncestor = findFocusedAncestor(currentDeclarationSuite);
- if (focusedAncestor) {
- for (var i = 0; i < focusedRunnables.length; i++) {
- if (focusedRunnables[i] === focusedAncestor) {
- focusedRunnables.splice(i, 1);
- break;
- }
- }
- }
- }
-
- var specFactory = function(description, fn, suite, timeout) {
- totalSpecsDefined++;
- var spec = new j$.Spec({
- id: getNextSpecId(),
- beforeAndAfterFns: beforeAndAfterFns(suite),
- expectationFactory: expectationFactory,
- resultCallback: specResultCallback,
- getSpecName: function(spec) {
- return getSpecName(spec, suite);
- },
- onStart: specStarted,
- description: description,
- expectationResultFactory: expectationResultFactory,
- queueRunnerFactory: queueRunnerFactory,
- userContext: function() { return suite.clonedSharedUserContext(); },
- queueableFn: {
- fn: fn,
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
- },
- throwOnExpectationFailure: throwOnExpectationFailure
- });
-
- if (!self.specFilter(spec)) {
- spec.disable();
- }
-
- return spec;
-
- function specResultCallback(result) {
- clearResourcesForRunnable(spec.id);
- currentSpec = null;
- reporter.specDone(result);
- }
-
- function specStarted(spec) {
- currentSpec = spec;
- defaultResourcesForRunnable(spec.id, suite.id);
- reporter.specStarted(spec.result);
- }
- };
-
- this.it = function(description, fn, timeout) {
- var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
- if (currentDeclarationSuite.markedPending) {
- spec.pend();
- }
- currentDeclarationSuite.addChild(spec);
- return spec;
- };
-
- this.xit = function() {
- var spec = this.it.apply(this, arguments);
- spec.pend('Temporarily disabled with xit');
- return spec;
- };
-
- this.fit = function(description, fn, timeout){
- var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
- currentDeclarationSuite.addChild(spec);
- focusedRunnables.push(spec.id);
- unfocusAncestor();
- return spec;
- };
-
- this.expect = function(actual) {
- if (!currentRunnable()) {
- throw new Error('\'expect\' was used when there was no current spec, this could be because an asynchronous test timed out');
- }
-
- return currentRunnable().expect(actual);
- };
-
- this.beforeEach = function(beforeEachFunction, timeout) {
- currentDeclarationSuite.beforeEach({
- fn: beforeEachFunction,
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
- });
- };
-
- this.beforeAll = function(beforeAllFunction, timeout) {
- currentDeclarationSuite.beforeAll({
- fn: beforeAllFunction,
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
- });
- };
-
- this.afterEach = function(afterEachFunction, timeout) {
- currentDeclarationSuite.afterEach({
- fn: afterEachFunction,
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
- });
- };
-
- this.afterAll = function(afterAllFunction, timeout) {
- currentDeclarationSuite.afterAll({
- fn: afterAllFunction,
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
- });
- };
-
- this.pending = function(message) {
- var fullMessage = j$.Spec.pendingSpecExceptionMessage;
- if(message) {
- fullMessage += message;
- }
- throw fullMessage;
- };
-
- this.fail = function(error) {
- var message = 'Failed';
- if (error) {
- message += ': ';
- message += error.message || error;
- }
-
- currentRunnable().addExpectationResult(false, {
- matcherName: '',
- passed: false,
- expected: '',
- actual: '',
- message: message,
- error: error && error.message ? error : null
- });
- };
- }
-
- return Env;
-};
-
-getJasmineRequireObj().JsApiReporter = function() {
-
- var noopTimer = {
- start: function(){},
- elapsed: function(){ return 0; }
- };
-
- function JsApiReporter(options) {
- var timer = options.timer || noopTimer,
- status = 'loaded';
-
- this.started = false;
- this.finished = false;
- this.runDetails = {};
-
- this.jasmineStarted = function() {
- this.started = true;
- status = 'started';
- timer.start();
- };
-
- var executionTime;
-
- this.jasmineDone = function(runDetails) {
- this.finished = true;
- this.runDetails = runDetails;
- executionTime = timer.elapsed();
- status = 'done';
- };
-
- this.status = function() {
- return status;
- };
-
- var suites = [],
- suites_hash = {};
-
- this.suiteStarted = function(result) {
- suites_hash[result.id] = result;
- };
-
- this.suiteDone = function(result) {
- storeSuite(result);
- };
-
- this.suiteResults = function(index, length) {
- return suites.slice(index, index + length);
- };
-
- function storeSuite(result) {
- suites.push(result);
- suites_hash[result.id] = result;
- }
-
- this.suites = function() {
- return suites_hash;
- };
-
- var specs = [];
-
- this.specDone = function(result) {
- specs.push(result);
- };
-
- this.specResults = function(index, length) {
- return specs.slice(index, index + length);
- };
-
- this.specs = function() {
- return specs;
- };
-
- this.executionTime = function() {
- return executionTime;
- };
-
- }
-
- return JsApiReporter;
-};
-
-getJasmineRequireObj().CallTracker = function(j$) {
-
- function CallTracker() {
- var calls = [];
- var opts = {};
-
- function argCloner(context) {
- var clonedArgs = [];
- var argsAsArray = j$.util.argsToArray(context.args);
- for(var i = 0; i < argsAsArray.length; i++) {
- if(Object.prototype.toString.apply(argsAsArray[i]).match(/^\[object/)) {
- clonedArgs.push(j$.util.clone(argsAsArray[i]));
- } else {
- clonedArgs.push(argsAsArray[i]);
- }
- }
- context.args = clonedArgs;
- }
-
- this.track = function(context) {
- if(opts.cloneArgs) {
- argCloner(context);
- }
- calls.push(context);
- };
-
- this.any = function() {
- return !!calls.length;
- };
-
- this.count = function() {
- return calls.length;
- };
-
- this.argsFor = function(index) {
- var call = calls[index];
- return call ? call.args : [];
- };
-
- this.all = function() {
- return calls;
- };
-
- this.allArgs = function() {
- var callArgs = [];
- for(var i = 0; i < calls.length; i++){
- callArgs.push(calls[i].args);
- }
-
- return callArgs;
- };
-
- this.first = function() {
- return calls[0];
- };
-
- this.mostRecent = function() {
- return calls[calls.length - 1];
- };
-
- this.reset = function() {
- calls = [];
- };
-
- this.saveArgumentsByValue = function() {
- opts.cloneArgs = true;
- };
-
- }
-
- return CallTracker;
-};
-
-getJasmineRequireObj().Clock = function() {
- function Clock(global, delayedFunctionSchedulerFactory, mockDate) {
- var self = this,
- realTimingFunctions = {
- setTimeout: global.setTimeout,
- clearTimeout: global.clearTimeout,
- setInterval: global.setInterval,
- clearInterval: global.clearInterval
- },
- fakeTimingFunctions = {
- setTimeout: setTimeout,
- clearTimeout: clearTimeout,
- setInterval: setInterval,
- clearInterval: clearInterval
- },
- installed = false,
- delayedFunctionScheduler,
- timer;
-
-
- self.install = function() {
- if(!originalTimingFunctionsIntact()) {
- throw new Error('Jasmine Clock was unable to install over custom global timer functions. Is the clock already installed?');
- }
- replace(global, fakeTimingFunctions);
- timer = fakeTimingFunctions;
- delayedFunctionScheduler = delayedFunctionSchedulerFactory();
- installed = true;
-
- return self;
- };
-
- self.uninstall = function() {
- delayedFunctionScheduler = null;
- mockDate.uninstall();
- replace(global, realTimingFunctions);
-
- timer = realTimingFunctions;
- installed = false;
- };
-
- self.withMock = function(closure) {
- this.install();
- try {
- closure();
- } finally {
- this.uninstall();
- }
- };
-
- self.mockDate = function(initialDate) {
- mockDate.install(initialDate);
- };
-
- self.setTimeout = function(fn, delay, params) {
- if (legacyIE()) {
- if (arguments.length > 2) {
- throw new Error('IE < 9 cannot support extra params to setTimeout without a polyfill');
- }
- return timer.setTimeout(fn, delay);
- }
- return Function.prototype.apply.apply(timer.setTimeout, [global, arguments]);
- };
-
- self.setInterval = function(fn, delay, params) {
- if (legacyIE()) {
- if (arguments.length > 2) {
- throw new Error('IE < 9 cannot support extra params to setInterval without a polyfill');
- }
- return timer.setInterval(fn, delay);
- }
- return Function.prototype.apply.apply(timer.setInterval, [global, arguments]);
- };
-
- self.clearTimeout = function(id) {
- return Function.prototype.call.apply(timer.clearTimeout, [global, id]);
- };
-
- self.clearInterval = function(id) {
- return Function.prototype.call.apply(timer.clearInterval, [global, id]);
- };
-
- self.tick = function(millis) {
- if (installed) {
- delayedFunctionScheduler.tick(millis, function(millis) { mockDate.tick(millis); });
- } else {
- throw new Error('Mock clock is not installed, use jasmine.clock().install()');
- }
- };
-
- return self;
-
- function originalTimingFunctionsIntact() {
- return global.setTimeout === realTimingFunctions.setTimeout &&
- global.clearTimeout === realTimingFunctions.clearTimeout &&
- global.setInterval === realTimingFunctions.setInterval &&
- global.clearInterval === realTimingFunctions.clearInterval;
- }
-
- function legacyIE() {
- //if these methods are polyfilled, apply will be present
- return !(realTimingFunctions.setTimeout || realTimingFunctions.setInterval).apply;
- }
-
- function replace(dest, source) {
- for (var prop in source) {
- dest[prop] = source[prop];
- }
- }
-
- function setTimeout(fn, delay) {
- return delayedFunctionScheduler.scheduleFunction(fn, delay, argSlice(arguments, 2));
- }
-
- function clearTimeout(id) {
- return delayedFunctionScheduler.removeFunctionWithId(id);
- }
-
- function setInterval(fn, interval) {
- return delayedFunctionScheduler.scheduleFunction(fn, interval, argSlice(arguments, 2), true);
- }
-
- function clearInterval(id) {
- return delayedFunctionScheduler.removeFunctionWithId(id);
- }
-
- function argSlice(argsObj, n) {
- return Array.prototype.slice.call(argsObj, n);
- }
- }
-
- return Clock;
-};
-
-getJasmineRequireObj().DelayedFunctionScheduler = function() {
- function DelayedFunctionScheduler() {
- var self = this;
- var scheduledLookup = [];
- var scheduledFunctions = {};
- var currentTime = 0;
- var delayedFnCount = 0;
-
- self.tick = function(millis, tickDate) {
- millis = millis || 0;
- var endTime = currentTime + millis;
-
- runScheduledFunctions(endTime, tickDate);
- currentTime = endTime;
- };
-
- self.scheduleFunction = function(funcToCall, millis, params, recurring, timeoutKey, runAtMillis) {
- var f;
- if (typeof(funcToCall) === 'string') {
- /* jshint evil: true */
- f = function() { return eval(funcToCall); };
- /* jshint evil: false */
- } else {
- f = funcToCall;
- }
-
- millis = millis || 0;
- timeoutKey = timeoutKey || ++delayedFnCount;
- runAtMillis = runAtMillis || (currentTime + millis);
-
- var funcToSchedule = {
- runAtMillis: runAtMillis,
- funcToCall: f,
- recurring: recurring,
- params: params,
- timeoutKey: timeoutKey,
- millis: millis
- };
-
- if (runAtMillis in scheduledFunctions) {
- scheduledFunctions[runAtMillis].push(funcToSchedule);
- } else {
- scheduledFunctions[runAtMillis] = [funcToSchedule];
- scheduledLookup.push(runAtMillis);
- scheduledLookup.sort(function (a, b) {
- return a - b;
- });
- }
-
- return timeoutKey;
- };
-
- self.removeFunctionWithId = function(timeoutKey) {
- for (var runAtMillis in scheduledFunctions) {
- var funcs = scheduledFunctions[runAtMillis];
- var i = indexOfFirstToPass(funcs, function (func) {
- return func.timeoutKey === timeoutKey;
- });
-
- if (i > -1) {
- if (funcs.length === 1) {
- delete scheduledFunctions[runAtMillis];
- deleteFromLookup(runAtMillis);
- } else {
- funcs.splice(i, 1);
- }
-
- // intervals get rescheduled when executed, so there's never more
- // than a single scheduled function with a given timeoutKey
- break;
- }
- }
- };
-
- return self;
-
- function indexOfFirstToPass(array, testFn) {
- var index = -1;
-
- for (var i = 0; i < array.length; ++i) {
- if (testFn(array[i])) {
- index = i;
- break;
- }
- }
-
- return index;
- }
-
- function deleteFromLookup(key) {
- var value = Number(key);
- var i = indexOfFirstToPass(scheduledLookup, function (millis) {
- return millis === value;
- });
-
- if (i > -1) {
- scheduledLookup.splice(i, 1);
- }
- }
-
- function reschedule(scheduledFn) {
- self.scheduleFunction(scheduledFn.funcToCall,
- scheduledFn.millis,
- scheduledFn.params,
- true,
- scheduledFn.timeoutKey,
- scheduledFn.runAtMillis + scheduledFn.millis);
- }
-
- function forEachFunction(funcsToRun, callback) {
- for (var i = 0; i < funcsToRun.length; ++i) {
- callback(funcsToRun[i]);
- }
- }
-
- function runScheduledFunctions(endTime, tickDate) {
- tickDate = tickDate || function() {};
- if (scheduledLookup.length === 0 || scheduledLookup[0] > endTime) {
- tickDate(endTime - currentTime);
- return;
- }
-
- do {
- var newCurrentTime = scheduledLookup.shift();
- tickDate(newCurrentTime - currentTime);
-
- currentTime = newCurrentTime;
-
- var funcsToRun = scheduledFunctions[currentTime];
- delete scheduledFunctions[currentTime];
-
- forEachFunction(funcsToRun, function(funcToRun) {
- if (funcToRun.recurring) {
- reschedule(funcToRun);
- }
- });
-
- forEachFunction(funcsToRun, function(funcToRun) {
- funcToRun.funcToCall.apply(null, funcToRun.params || []);
- });
- } while (scheduledLookup.length > 0 &&
- // checking first if we're out of time prevents setTimeout(0)
- // scheduled in a funcToRun from forcing an extra iteration
- currentTime !== endTime &&
- scheduledLookup[0] <= endTime);
-
- // ran out of functions to call, but still time left on the clock
- if (currentTime !== endTime) {
- tickDate(endTime - currentTime);
- }
- }
- }
-
- return DelayedFunctionScheduler;
-};
-
-getJasmineRequireObj().ExceptionFormatter = function() {
- function ExceptionFormatter() {
- this.message = function(error) {
- var message = '';
-
- if (error.name && error.message) {
- message += error.name + ': ' + error.message;
- } else {
- message += error.toString() + ' thrown';
- }
-
- if (error.fileName || error.sourceURL) {
- message += ' in ' + (error.fileName || error.sourceURL);
- }
-
- if (error.line || error.lineNumber) {
- message += ' (line ' + (error.line || error.lineNumber) + ')';
- }
-
- return message;
- };
-
- this.stack = function(error) {
- return error ? error.stack : null;
- };
- }
-
- return ExceptionFormatter;
-};
-
-getJasmineRequireObj().Expectation = function() {
-
- function Expectation(options) {
- this.util = options.util || { buildFailureMessage: function() {} };
- this.customEqualityTesters = options.customEqualityTesters || [];
- this.actual = options.actual;
- this.addExpectationResult = options.addExpectationResult || function(){};
- this.isNot = options.isNot;
-
- var customMatchers = options.customMatchers || {};
- for (var matcherName in customMatchers) {
- this[matcherName] = Expectation.prototype.wrapCompare(matcherName, customMatchers[matcherName]);
- }
- }
-
- Expectation.prototype.wrapCompare = function(name, matcherFactory) {
- return function() {
- var args = Array.prototype.slice.call(arguments, 0),
- expected = args.slice(0),
- message = '';
-
- args.unshift(this.actual);
-
- var matcher = matcherFactory(this.util, this.customEqualityTesters),
- matcherCompare = matcher.compare;
-
- function defaultNegativeCompare() {
- var result = matcher.compare.apply(null, args);
- result.pass = !result.pass;
- return result;
- }
-
- if (this.isNot) {
- matcherCompare = matcher.negativeCompare || defaultNegativeCompare;
- }
-
- var result = matcherCompare.apply(null, args);
-
- if (!result.pass) {
- if (!result.message) {
- args.unshift(this.isNot);
- args.unshift(name);
- message = this.util.buildFailureMessage.apply(null, args);
- } else {
- if (Object.prototype.toString.apply(result.message) === '[object Function]') {
- message = result.message();
- } else {
- message = result.message;
- }
- }
- }
-
- if (expected.length == 1) {
- expected = expected[0];
- }
-
- // TODO: how many of these params are needed?
- this.addExpectationResult(
- result.pass,
- {
- matcherName: name,
- passed: result.pass,
- message: message,
- actual: this.actual,
- expected: expected // TODO: this may need to be arrayified/sliced
- }
- );
- };
- };
-
- Expectation.addCoreMatchers = function(matchers) {
- var prototype = Expectation.prototype;
- for (var matcherName in matchers) {
- var matcher = matchers[matcherName];
- prototype[matcherName] = prototype.wrapCompare(matcherName, matcher);
- }
- };
-
- Expectation.Factory = function(options) {
- options = options || {};
-
- var expect = new Expectation(options);
-
- // TODO: this would be nice as its own Object - NegativeExpectation
- // TODO: copy instead of mutate options
- options.isNot = true;
- expect.not = new Expectation(options);
-
- return expect;
- };
-
- return Expectation;
-};
-
-//TODO: expectation result may make more sense as a presentation of an expectation.
-getJasmineRequireObj().buildExpectationResult = function() {
- function buildExpectationResult(options) {
- var messageFormatter = options.messageFormatter || function() {},
- stackFormatter = options.stackFormatter || function() {};
-
- var result = {
- matcherName: options.matcherName,
- message: message(),
- stack: stack(),
- passed: options.passed
- };
-
- if(!result.passed) {
- result.expected = options.expected;
- result.actual = options.actual;
- }
-
- return result;
-
- function message() {
- if (options.passed) {
- return 'Passed.';
- } else if (options.message) {
- return options.message;
- } else if (options.error) {
- return messageFormatter(options.error);
- }
- return '';
- }
-
- function stack() {
- if (options.passed) {
- return '';
- }
-
- var error = options.error;
- if (!error) {
- try {
- throw new Error(message());
- } catch (e) {
- error = e;
- }
- }
- return stackFormatter(error);
- }
- }
-
- return buildExpectationResult;
-};
-
-getJasmineRequireObj().MockDate = function() {
- function MockDate(global) {
- var self = this;
- var currentTime = 0;
-
- if (!global || !global.Date) {
- self.install = function() {};
- self.tick = function() {};
- self.uninstall = function() {};
- return self;
- }
-
- var GlobalDate = global.Date;
-
- self.install = function(mockDate) {
- if (mockDate instanceof GlobalDate) {
- currentTime = mockDate.getTime();
- } else {
- currentTime = new GlobalDate().getTime();
- }
-
- global.Date = FakeDate;
- };
-
- self.tick = function(millis) {
- millis = millis || 0;
- currentTime = currentTime + millis;
- };
-
- self.uninstall = function() {
- currentTime = 0;
- global.Date = GlobalDate;
- };
-
- createDateProperties();
-
- return self;
-
- function FakeDate() {
- switch(arguments.length) {
- case 0:
- return new GlobalDate(currentTime);
- case 1:
- return new GlobalDate(arguments[0]);
- case 2:
- return new GlobalDate(arguments[0], arguments[1]);
- case 3:
- return new GlobalDate(arguments[0], arguments[1], arguments[2]);
- case 4:
- return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3]);
- case 5:
- return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3],
- arguments[4]);
- case 6:
- return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3],
- arguments[4], arguments[5]);
- default:
- return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3],
- arguments[4], arguments[5], arguments[6]);
- }
- }
-
- function createDateProperties() {
- FakeDate.prototype = GlobalDate.prototype;
-
- FakeDate.now = function() {
- if (GlobalDate.now) {
- return currentTime;
- } else {
- throw new Error('Browser does not support Date.now()');
- }
- };
-
- FakeDate.toSource = GlobalDate.toSource;
- FakeDate.toString = GlobalDate.toString;
- FakeDate.parse = GlobalDate.parse;
- FakeDate.UTC = GlobalDate.UTC;
- }
- }
-
- return MockDate;
-};
-
-getJasmineRequireObj().pp = function(j$) {
-
- function PrettyPrinter() {
- this.ppNestLevel_ = 0;
- this.seen = [];
- }
-
- PrettyPrinter.prototype.format = function(value) {
- this.ppNestLevel_++;
- try {
- if (j$.util.isUndefined(value)) {
- this.emitScalar('undefined');
- } else if (value === null) {
- this.emitScalar('null');
- } else if (value === 0 && 1/value === -Infinity) {
- this.emitScalar('-0');
- } else if (value === j$.getGlobal()) {
- this.emitScalar('');
- } else if (value.jasmineToString) {
- this.emitScalar(value.jasmineToString());
- } else if (typeof value === 'string') {
- this.emitString(value);
- } else if (j$.isSpy(value)) {
- this.emitScalar('spy on ' + value.and.identity());
- } else if (value instanceof RegExp) {
- this.emitScalar(value.toString());
- } else if (typeof value === 'function') {
- this.emitScalar('Function');
- } else if (typeof value.nodeType === 'number') {
- this.emitScalar('HTMLNode');
- } else if (value instanceof Date) {
- this.emitScalar('Date(' + value + ')');
- } else if (value.toString && typeof value === 'object' && !(value instanceof Array) && value.toString !== Object.prototype.toString) {
- this.emitScalar(value.toString());
- } else if (j$.util.arrayContains(this.seen, value)) {
- this.emitScalar('');
- } else if (j$.isArray_(value) || j$.isA_('Object', value)) {
- this.seen.push(value);
- if (j$.isArray_(value)) {
- this.emitArray(value);
- } else {
- this.emitObject(value);
- }
- this.seen.pop();
- } else {
- this.emitScalar(value.toString());
- }
- } finally {
- this.ppNestLevel_--;
- }
- };
-
- PrettyPrinter.prototype.iterateObject = function(obj, fn) {
- for (var property in obj) {
- if (!Object.prototype.hasOwnProperty.call(obj, property)) { continue; }
- fn(property, obj.__lookupGetter__ ? (!j$.util.isUndefined(obj.__lookupGetter__(property)) &&
- obj.__lookupGetter__(property) !== null) : false);
- }
- };
-
- PrettyPrinter.prototype.emitArray = j$.unimplementedMethod_;
- PrettyPrinter.prototype.emitObject = j$.unimplementedMethod_;
- PrettyPrinter.prototype.emitScalar = j$.unimplementedMethod_;
- PrettyPrinter.prototype.emitString = j$.unimplementedMethod_;
-
- function StringPrettyPrinter() {
- PrettyPrinter.call(this);
-
- this.string = '';
- }
-
- j$.util.inherit(StringPrettyPrinter, PrettyPrinter);
-
- StringPrettyPrinter.prototype.emitScalar = function(value) {
- this.append(value);
- };
-
- StringPrettyPrinter.prototype.emitString = function(value) {
- this.append('\'' + value + '\'');
- };
-
- StringPrettyPrinter.prototype.emitArray = function(array) {
- if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) {
- this.append('Array');
- return;
- }
- var length = Math.min(array.length, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH);
- this.append('[ ');
- for (var i = 0; i < length; i++) {
- if (i > 0) {
- this.append(', ');
- }
- this.format(array[i]);
- }
- if(array.length > length){
- this.append(', ...');
- }
-
- var self = this;
- var first = array.length === 0;
- this.iterateObject(array, function(property, isGetter) {
- if (property.match(/^\d+$/)) {
- return;
- }
-
- if (first) {
- first = false;
- } else {
- self.append(', ');
- }
-
- self.formatProperty(array, property, isGetter);
- });
-
- this.append(' ]');
- };
-
- StringPrettyPrinter.prototype.emitObject = function(obj) {
- var constructorName = obj.constructor ? j$.fnNameFor(obj.constructor) : 'null';
- this.append(constructorName);
-
- if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) {
- return;
- }
-
- var self = this;
- this.append('({ ');
- var first = true;
-
- this.iterateObject(obj, function(property, isGetter) {
- if (first) {
- first = false;
- } else {
- self.append(', ');
- }
-
- self.formatProperty(obj, property, isGetter);
- });
-
- this.append(' })');
- };
-
- StringPrettyPrinter.prototype.formatProperty = function(obj, property, isGetter) {
- this.append(property);
- this.append(': ');
- if (isGetter) {
- this.append('');
- } else {
- this.format(obj[property]);
- }
- };
-
- StringPrettyPrinter.prototype.append = function(value) {
- this.string += value;
- };
-
- return function(value) {
- var stringPrettyPrinter = new StringPrettyPrinter();
- stringPrettyPrinter.format(value);
- return stringPrettyPrinter.string;
- };
-};
-
-getJasmineRequireObj().QueueRunner = function(j$) {
-
- function once(fn) {
- var called = false;
- return function() {
- if (!called) {
- called = true;
- fn();
- }
- return null;
- };
- }
-
- function QueueRunner(attrs) {
- this.queueableFns = attrs.queueableFns || [];
- this.onComplete = attrs.onComplete || function() {};
- this.clearStack = attrs.clearStack || function(fn) {fn();};
- this.onException = attrs.onException || function() {};
- this.catchException = attrs.catchException || function() { return true; };
- this.userContext = attrs.userContext || {};
- this.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
- this.fail = attrs.fail || function() {};
- }
-
- QueueRunner.prototype.execute = function() {
- this.run(this.queueableFns, 0);
- };
-
- QueueRunner.prototype.run = function(queueableFns, recursiveIndex) {
- var length = queueableFns.length,
- self = this,
- iterativeIndex;
-
-
- for(iterativeIndex = recursiveIndex; iterativeIndex < length; iterativeIndex++) {
- var queueableFn = queueableFns[iterativeIndex];
- if (queueableFn.fn.length > 0) {
- attemptAsync(queueableFn);
- return;
- } else {
- attemptSync(queueableFn);
- }
- }
-
- var runnerDone = iterativeIndex >= length;
-
- if (runnerDone) {
- this.clearStack(this.onComplete);
- }
-
- function attemptSync(queueableFn) {
- try {
- queueableFn.fn.call(self.userContext);
- } catch (e) {
- handleException(e, queueableFn);
- }
- }
-
- function attemptAsync(queueableFn) {
- var clearTimeout = function () {
- Function.prototype.apply.apply(self.timeout.clearTimeout, [j$.getGlobal(), [timeoutId]]);
- },
- next = once(function () {
- clearTimeout(timeoutId);
- self.run(queueableFns, iterativeIndex + 1);
- }),
- timeoutId;
-
- next.fail = function() {
- self.fail.apply(null, arguments);
- next();
- };
-
- if (queueableFn.timeout) {
- timeoutId = Function.prototype.apply.apply(self.timeout.setTimeout, [j$.getGlobal(), [function() {
- var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');
- onException(error);
- next();
- }, queueableFn.timeout()]]);
- }
-
- try {
- queueableFn.fn.call(self.userContext, next);
- } catch (e) {
- handleException(e, queueableFn);
- next();
- }
- }
-
- function onException(e) {
- self.onException(e);
- }
-
- function handleException(e, queueableFn) {
- onException(e);
- if (!self.catchException(e)) {
- //TODO: set a var when we catch an exception and
- //use a finally block to close the loop in a nice way..
- throw e;
- }
- }
- };
-
- return QueueRunner;
-};
-
-getJasmineRequireObj().ReportDispatcher = function() {
- function ReportDispatcher(methods) {
-
- var dispatchedMethods = methods || [];
-
- for (var i = 0; i < dispatchedMethods.length; i++) {
- var method = dispatchedMethods[i];
- this[method] = (function(m) {
- return function() {
- dispatch(m, arguments);
- };
- }(method));
- }
-
- var reporters = [];
- var fallbackReporter = null;
-
- this.addReporter = function(reporter) {
- reporters.push(reporter);
- };
-
- this.provideFallbackReporter = function(reporter) {
- fallbackReporter = reporter;
- };
-
- this.clearReporters = function() {
- reporters = [];
- };
-
- return this;
-
- function dispatch(method, args) {
- if (reporters.length === 0 && fallbackReporter !== null) {
- reporters.push(fallbackReporter);
- }
- for (var i = 0; i < reporters.length; i++) {
- var reporter = reporters[i];
- if (reporter[method]) {
- reporter[method].apply(reporter, args);
- }
- }
- }
- }
-
- return ReportDispatcher;
-};
-
-
-getJasmineRequireObj().SpyRegistry = function(j$) {
-
- var getErrorMsg = j$.formatErrorMsg('', 'spyOn(, )');
-
- function SpyRegistry(options) {
- options = options || {};
- var currentSpies = options.currentSpies || function() { return []; };
-
- this.allowRespy = function(allow){
- this.respy = allow;
- };
-
- this.spyOn = function(obj, methodName) {
-
- if (j$.util.isUndefined(obj)) {
- throw new Error(getErrorMsg('could not find an object to spy upon for ' + methodName + '()'));
- }
-
- if (j$.util.isUndefined(methodName)) {
- throw new Error(getErrorMsg('No method name supplied'));
- }
-
- if (j$.util.isUndefined(obj[methodName])) {
- throw new Error(getErrorMsg(methodName + '() method does not exist'));
- }
-
- if (obj[methodName] && j$.isSpy(obj[methodName]) ) {
- if ( !!this.respy ){
- return obj[methodName];
- }else {
- throw new Error(getErrorMsg(methodName + ' has already been spied upon'));
- }
- }
-
- var descriptor;
- try {
- descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
- } catch(e) {
- // IE 8 doesn't support `definePropery` on non-DOM nodes
- }
-
- if (descriptor && !(descriptor.writable || descriptor.set)) {
- throw new Error(getErrorMsg(methodName + ' is not declared writable or has no setter'));
- }
-
- var originalMethod = obj[methodName],
- spiedMethod = j$.createSpy(methodName, originalMethod),
- restoreStrategy;
-
- if (Object.prototype.hasOwnProperty.call(obj, methodName)) {
- restoreStrategy = function() {
- obj[methodName] = originalMethod;
- };
- } else {
- restoreStrategy = function() {
- if (!delete obj[methodName]) {
- obj[methodName] = originalMethod;
- }
- };
- }
-
- currentSpies().push({
- restoreObjectToOriginalState: restoreStrategy
- });
-
- obj[methodName] = spiedMethod;
-
- return spiedMethod;
- };
-
- this.clearSpies = function() {
- var spies = currentSpies();
- for (var i = spies.length - 1; i >= 0; i--) {
- var spyEntry = spies[i];
- spyEntry.restoreObjectToOriginalState();
- }
- };
- }
-
- return SpyRegistry;
-};
-
-getJasmineRequireObj().SpyStrategy = function(j$) {
-
- function SpyStrategy(options) {
- options = options || {};
-
- var identity = options.name || 'unknown',
- originalFn = options.fn || function() {},
- getSpy = options.getSpy || function() {},
- plan = function() {};
-
- this.identity = function() {
- return identity;
- };
-
- this.exec = function() {
- return plan.apply(this, arguments);
- };
-
- this.callThrough = function() {
- plan = originalFn;
- return getSpy();
- };
-
- this.returnValue = function(value) {
- plan = function() {
- return value;
- };
- return getSpy();
- };
-
- this.returnValues = function() {
- var values = Array.prototype.slice.call(arguments);
- plan = function () {
- return values.shift();
- };
- return getSpy();
- };
-
- this.throwError = function(something) {
- var error = (something instanceof Error) ? something : new Error(something);
- plan = function() {
- throw error;
- };
- return getSpy();
- };
-
- this.callFake = function(fn) {
- if(!j$.isFunction_(fn)) {
- throw new Error('Argument passed to callFake should be a function, got ' + fn);
- }
- plan = fn;
- return getSpy();
- };
-
- this.stub = function(fn) {
- plan = function() {};
- return getSpy();
- };
- }
-
- return SpyStrategy;
-};
-
-getJasmineRequireObj().Suite = function(j$) {
- function Suite(attrs) {
- this.env = attrs.env;
- this.id = attrs.id;
- this.parentSuite = attrs.parentSuite;
- this.description = attrs.description;
- this.expectationFactory = attrs.expectationFactory;
- this.expectationResultFactory = attrs.expectationResultFactory;
- this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
-
- this.beforeFns = [];
- this.afterFns = [];
- this.beforeAllFns = [];
- this.afterAllFns = [];
- this.disabled = false;
-
- this.children = [];
-
- this.result = {
- id: this.id,
- description: this.description,
- fullName: this.getFullName(),
- failedExpectations: []
- };
- }
-
- Suite.prototype.expect = function(actual) {
- return this.expectationFactory(actual, this);
- };
-
- Suite.prototype.getFullName = function() {
- var fullName = [];
- for (var parentSuite = this; parentSuite; parentSuite = parentSuite.parentSuite) {
- if (parentSuite.parentSuite) {
- fullName.unshift(parentSuite.description);
- }
- }
- return fullName.join(' ');
- };
-
- Suite.prototype.disable = function() {
- this.disabled = true;
- };
-
- Suite.prototype.pend = function(message) {
- this.markedPending = true;
- };
-
- Suite.prototype.beforeEach = function(fn) {
- this.beforeFns.unshift(fn);
- };
-
- Suite.prototype.beforeAll = function(fn) {
- this.beforeAllFns.push(fn);
- };
-
- Suite.prototype.afterEach = function(fn) {
- this.afterFns.unshift(fn);
- };
-
- Suite.prototype.afterAll = function(fn) {
- this.afterAllFns.push(fn);
- };
-
- Suite.prototype.addChild = function(child) {
- this.children.push(child);
- };
-
- Suite.prototype.status = function() {
- if (this.disabled) {
- return 'disabled';
- }
-
- if (this.markedPending) {
- return 'pending';
- }
-
- if (this.result.failedExpectations.length > 0) {
- return 'failed';
- } else {
- return 'finished';
- }
- };
-
- Suite.prototype.isExecutable = function() {
- return !this.disabled;
- };
-
- Suite.prototype.canBeReentered = function() {
- return this.beforeAllFns.length === 0 && this.afterAllFns.length === 0;
- };
-
- Suite.prototype.getResult = function() {
- this.result.status = this.status();
- return this.result;
- };
-
- Suite.prototype.sharedUserContext = function() {
- if (!this.sharedContext) {
- this.sharedContext = this.parentSuite ? clone(this.parentSuite.sharedUserContext()) : {};
- }
-
- return this.sharedContext;
- };
-
- Suite.prototype.clonedSharedUserContext = function() {
- return clone(this.sharedUserContext());
- };
-
- Suite.prototype.onException = function() {
- if (arguments[0] instanceof j$.errors.ExpectationFailed) {
- return;
- }
-
- if(isAfterAll(this.children)) {
- var data = {
- matcherName: '',
- passed: false,
- expected: '',
- actual: '',
- error: arguments[0]
- };
- this.result.failedExpectations.push(this.expectationResultFactory(data));
- } else {
- for (var i = 0; i < this.children.length; i++) {
- var child = this.children[i];
- child.onException.apply(child, arguments);
- }
- }
- };
-
- Suite.prototype.addExpectationResult = function () {
- if(isAfterAll(this.children) && isFailure(arguments)){
- var data = arguments[1];
- this.result.failedExpectations.push(this.expectationResultFactory(data));
- if(this.throwOnExpectationFailure) {
- throw new j$.errors.ExpectationFailed();
- }
- } else {
- for (var i = 0; i < this.children.length; i++) {
- var child = this.children[i];
- try {
- child.addExpectationResult.apply(child, arguments);
- } catch(e) {
- // keep going
- }
- }
- }
- };
-
- function isAfterAll(children) {
- return children && children[0].result.status;
- }
-
- function isFailure(args) {
- return !args[0];
- }
-
- function clone(obj) {
- var clonedObj = {};
- for (var prop in obj) {
- // @ccarlesso allows looping on objects without `Object.prototype`.
- if (Object.prototype.hasOwnProperty.call(obj, prop)) {
- cloned[prop] = obj[prop];
- }
- }
-
- return clonedObj;
- }
-
- return Suite;
-};
-
-if (typeof window == void 0 && typeof exports == 'object') {
- exports.Suite = jasmineRequire.Suite;
-}
-
-getJasmineRequireObj().Timer = function() {
- var defaultNow = (function(Date) {
- return function() { return new Date().getTime(); };
- })(Date);
-
- function Timer(options) {
- options = options || {};
-
- var now = options.now || defaultNow,
- startTime;
-
- this.start = function() {
- startTime = now();
- };
-
- this.elapsed = function() {
- return now() - startTime;
- };
- }
-
- return Timer;
-};
-
-getJasmineRequireObj().TreeProcessor = function() {
- function TreeProcessor(attrs) {
- var tree = attrs.tree,
- runnableIds = attrs.runnableIds,
- queueRunnerFactory = attrs.queueRunnerFactory,
- nodeStart = attrs.nodeStart || function() {},
- nodeComplete = attrs.nodeComplete || function() {},
- orderChildren = attrs.orderChildren || function(node) { return node.children; },
- stats = { valid: true },
- processed = false,
- defaultMin = Infinity,
- defaultMax = 1 - Infinity;
-
- this.processTree = function() {
- processNode(tree, false);
- processed = true;
- return stats;
- };
-
- this.execute = function(done) {
- if (!processed) {
- this.processTree();
- }
-
- if (!stats.valid) {
- throw 'invalid order';
- }
-
- var childFns = wrapChildren(tree, 0);
-
- queueRunnerFactory({
- queueableFns: childFns,
- userContext: tree.sharedUserContext(),
- onException: function() {
- tree.onException.apply(tree, arguments);
- },
- onComplete: done
- });
- };
-
- function runnableIndex(id) {
- for (var i = 0; i < runnableIds.length; i++) {
- if (runnableIds[i] === id) {
- return i;
- }
- }
- }
-
- function processNode(node, parentEnabled) {
- var executableIndex = runnableIndex(node.id);
-
- if (executableIndex !== undefined) {
- parentEnabled = true;
- }
-
- parentEnabled = parentEnabled && node.isExecutable();
-
- if (!node.children) {
- stats[node.id] = {
- executable: parentEnabled && node.isExecutable(),
- segments: [{
- index: 0,
- owner: node,
- nodes: [node],
- min: startingMin(executableIndex),
- max: startingMax(executableIndex)
- }]
- };
- } else {
- var hasExecutableChild = false;
-
- var orderedChildren = orderChildren(node);
-
- for (var i = 0; i < orderedChildren.length; i++) {
- var child = orderedChildren[i];
-
- processNode(child, parentEnabled);
-
- if (!stats.valid) {
- return;
- }
-
- var childStats = stats[child.id];
-
- hasExecutableChild = hasExecutableChild || childStats.executable;
- }
-
- stats[node.id] = {
- executable: hasExecutableChild
- };
-
- segmentChildren(node, orderedChildren, stats[node.id], executableIndex);
-
- if (!node.canBeReentered() && stats[node.id].segments.length > 1) {
- stats = { valid: false };
- }
- }
- }
-
- function startingMin(executableIndex) {
- return executableIndex === undefined ? defaultMin : executableIndex;
- }
-
- function startingMax(executableIndex) {
- return executableIndex === undefined ? defaultMax : executableIndex;
- }
-
- function segmentChildren(node, orderedChildren, nodeStats, executableIndex) {
- var currentSegment = { index: 0, owner: node, nodes: [], min: startingMin(executableIndex), max: startingMax(executableIndex) },
- result = [currentSegment],
- lastMax = defaultMax,
- orderedChildSegments = orderChildSegments(orderedChildren);
-
- function isSegmentBoundary(minIndex) {
- return lastMax !== defaultMax && minIndex !== defaultMin && lastMax < minIndex - 1;
- }
-
- for (var i = 0; i < orderedChildSegments.length; i++) {
- var childSegment = orderedChildSegments[i],
- maxIndex = childSegment.max,
- minIndex = childSegment.min;
-
- if (isSegmentBoundary(minIndex)) {
- currentSegment = {index: result.length, owner: node, nodes: [], min: defaultMin, max: defaultMax};
- result.push(currentSegment);
- }
-
- currentSegment.nodes.push(childSegment);
- currentSegment.min = Math.min(currentSegment.min, minIndex);
- currentSegment.max = Math.max(currentSegment.max, maxIndex);
- lastMax = maxIndex;
- }
-
- nodeStats.segments = result;
- }
-
- function orderChildSegments(children) {
- var specifiedOrder = [],
- unspecifiedOrder = [];
-
- for (var i = 0; i < children.length; i++) {
- var child = children[i],
- segments = stats[child.id].segments;
-
- for (var j = 0; j < segments.length; j++) {
- var seg = segments[j];
-
- if (seg.min === defaultMin) {
- unspecifiedOrder.push(seg);
- } else {
- specifiedOrder.push(seg);
- }
- }
- }
-
- specifiedOrder.sort(function(a, b) {
- return a.min - b.min;
- });
-
- return specifiedOrder.concat(unspecifiedOrder);
- }
-
- function executeNode(node, segmentNumber) {
- if (node.children) {
- return {
- fn: function(done) {
- nodeStart(node);
-
- queueRunnerFactory({
- onComplete: function() {
- nodeComplete(node, node.getResult());
- done();
- },
- queueableFns: wrapChildren(node, segmentNumber),
- userContext: node.sharedUserContext(),
- onException: function() {
- node.onException.apply(node, arguments);
- }
- });
- }
- };
- } else {
- return {
- fn: function(done) { node.execute(done, stats[node.id].executable); }
- };
- }
- }
-
- function wrapChildren(node, segmentNumber) {
- var result = [],
- segmentChildren = stats[node.id].segments[segmentNumber].nodes;
-
- for (var i = 0; i < segmentChildren.length; i++) {
- result.push(executeNode(segmentChildren[i].owner, segmentChildren[i].index));
- }
-
- if (!stats[node.id].executable) {
- return result;
- }
-
- return node.beforeAllFns.concat(result).concat(node.afterAllFns);
- }
- }
-
- return TreeProcessor;
-};
-
-getJasmineRequireObj().Any = function(j$) {
-
- function Any(expectedObject) {
- if (typeof expectedObject === 'undefined') {
- throw new TypeError(
- 'jasmine.any() expects to be passed a constructor function. ' +
- 'Please pass one or use jasmine.anything() to match any object.'
- );
- }
- this.expectedObject = expectedObject;
- }
-
- Any.prototype.asymmetricMatch = function(other) {
- if (this.expectedObject == String) {
- return typeof other == 'string' || other instanceof String;
- }
-
- if (this.expectedObject == Number) {
- return typeof other == 'number' || other instanceof Number;
- }
-
- if (this.expectedObject == Function) {
- return typeof other == 'function' || other instanceof Function;
- }
-
- if (this.expectedObject == Object) {
- return typeof other == 'object';
- }
-
- if (this.expectedObject == Boolean) {
- return typeof other == 'boolean';
- }
-
- return other instanceof this.expectedObject;
- };
-
- Any.prototype.jasmineToString = function() {
- return '';
- };
-
- return Any;
-};
-
-getJasmineRequireObj().Anything = function(j$) {
-
- function Anything() {}
-
- Anything.prototype.asymmetricMatch = function(other) {
- return !j$.util.isUndefined(other) && other !== null;
- };
-
- Anything.prototype.jasmineToString = function() {
- return '';
- };
-
- return Anything;
-};
-
-getJasmineRequireObj().ArrayContaining = function(j$) {
- function ArrayContaining(sample) {
- this.sample = sample;
- }
-
- ArrayContaining.prototype.asymmetricMatch = function(other) {
- var className = Object.prototype.toString.call(this.sample);
- if (className !== '[object Array]') { throw new Error('You must provide an array to arrayContaining, not \'' + this.sample + '\'.'); }
-
- for (var i = 0; i < this.sample.length; i++) {
- var item = this.sample[i];
- if (!j$.matchersUtil.contains(other, item)) {
- return false;
- }
- }
-
- return true;
- };
-
- ArrayContaining.prototype.jasmineToString = function () {
- return '';
- };
-
- return ArrayContaining;
-};
-
-getJasmineRequireObj().ObjectContaining = function(j$) {
-
- function ObjectContaining(sample) {
- this.sample = sample;
- }
-
- function getPrototype(obj) {
- if (Object.getPrototypeOf) {
- return Object.getPrototypeOf(obj);
- }
-
- if (obj.constructor.prototype == obj) {
- return null;
- }
-
- return obj.constructor.prototype;
- }
-
- function hasProperty(obj, property) {
- if (!obj) {
- return false;
- }
-
- if (Object.prototype.hasOwnProperty.call(obj, property)) {
- return true;
- }
-
- return hasProperty(getPrototype(obj), property);
- }
-
- ObjectContaining.prototype.asymmetricMatch = function(other) {
- if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); }
-
- for (var property in this.sample) {
- if (!hasProperty(other, property) ||
- !j$.matchersUtil.equals(this.sample[property], other[property])) {
- return false;
- }
- }
-
- return true;
- };
-
- ObjectContaining.prototype.jasmineToString = function() {
- return '';
- };
-
- return ObjectContaining;
-};
-
-getJasmineRequireObj().StringMatching = function(j$) {
-
- function StringMatching(expected) {
- if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) {
- throw new Error('Expected is not a String or a RegExp');
- }
-
- this.regexp = new RegExp(expected);
- }
-
- StringMatching.prototype.asymmetricMatch = function(other) {
- return this.regexp.test(other);
- };
-
- StringMatching.prototype.jasmineToString = function() {
- return '';
- };
-
- return StringMatching;
-};
-
-getJasmineRequireObj().errors = function() {
- function ExpectationFailed() {}
-
- ExpectationFailed.prototype = new Error();
- ExpectationFailed.prototype.constructor = ExpectationFailed;
-
- return {
- ExpectationFailed: ExpectationFailed
- };
-};
-getJasmineRequireObj().formatErrorMsg = function() {
- function generateErrorMsg(domain, usage) {
- var usageDefinition = usage ? '\nUsage: ' + usage : '';
-
- return function errorMsg(msg) {
- return domain + ' : ' + msg + usageDefinition;
- };
- }
-
- return generateErrorMsg;
-};
-
-getJasmineRequireObj().matchersUtil = function(j$) {
- // TODO: what to do about jasmine.pp not being inject? move to JSON.stringify? gut PrettyPrinter?
-
- return {
- equals: function(a, b, customTesters) {
- customTesters = customTesters || [];
-
- return eq(a, b, [], [], customTesters);
- },
-
- contains: function(haystack, needle, customTesters) {
- customTesters = customTesters || [];
-
- if ((Object.prototype.toString.apply(haystack) === '[object Array]') ||
- (!!haystack && !haystack.indexOf))
- {
- for (var i = 0; i < haystack.length; i++) {
- if (eq(haystack[i], needle, [], [], customTesters)) {
- return true;
- }
- }
- return false;
- }
-
- return !!haystack && haystack.indexOf(needle) >= 0;
- },
-
- buildFailureMessage: function() {
- var args = Array.prototype.slice.call(arguments, 0),
- matcherName = args[0],
- isNot = args[1],
- actual = args[2],
- expected = args.slice(3),
- englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); });
-
- var message = 'Expected ' +
- j$.pp(actual) +
- (isNot ? ' not ' : ' ') +
- englishyPredicate;
-
- if (expected.length > 0) {
- for (var i = 0; i < expected.length; i++) {
- if (i > 0) {
- message += ',';
- }
- message += ' ' + j$.pp(expected[i]);
- }
- }
-
- return message + '.';
- }
- };
-
- function isAsymmetric(obj) {
- return obj && j$.isA_('Function', obj.asymmetricMatch);
- }
-
- function asymmetricMatch(a, b) {
- var asymmetricA = isAsymmetric(a),
- asymmetricB = isAsymmetric(b);
-
- if (asymmetricA && asymmetricB) {
- return undefined;
- }
-
- if (asymmetricA) {
- return a.asymmetricMatch(b);
- }
-
- if (asymmetricB) {
- return b.asymmetricMatch(a);
- }
- }
-
- // Equality function lovingly adapted from isEqual in
- // [Underscore](http://underscorejs.org)
- function eq(a, b, aStack, bStack, customTesters) {
- var result = true;
-
- var asymmetricResult = asymmetricMatch(a, b);
- if (!j$.util.isUndefined(asymmetricResult)) {
- return asymmetricResult;
- }
-
- for (var i = 0; i < customTesters.length; i++) {
- var customTesterResult = customTesters[i](a, b);
- if (!j$.util.isUndefined(customTesterResult)) {
- return customTesterResult;
- }
- }
-
- if (a instanceof Error && b instanceof Error) {
- return a.message == b.message;
- }
-
- // Identical objects are equal. `0 === -0`, but they aren't identical.
- // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
- if (a === b) { return a !== 0 || 1 / a == 1 / b; }
- // A strict comparison is necessary because `null == undefined`.
- if (a === null || b === null) { return a === b; }
- var className = Object.prototype.toString.call(a);
- if (className != Object.prototype.toString.call(b)) { return false; }
- switch (className) {
- // Strings, numbers, dates, and booleans are compared by value.
- case '[object String]':
- // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
- // equivalent to `new String("5")`.
- return a == String(b);
- case '[object Number]':
- // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
- // other numeric values.
- return a != +a ? b != +b : (a === 0 ? 1 / a == 1 / b : a == +b);
- case '[object Date]':
- case '[object Boolean]':
- // Coerce dates and booleans to numeric primitive values. Dates are compared by their
- // millisecond representations. Note that invalid dates with millisecond representations
- // of `NaN` are not equivalent.
- return +a == +b;
- // RegExps are compared by their source patterns and flags.
- case '[object RegExp]':
- return a.source == b.source &&
- a.global == b.global &&
- a.multiline == b.multiline &&
- a.ignoreCase == b.ignoreCase;
- }
- if (typeof a != 'object' || typeof b != 'object') { return false; }
-
- var aIsDomNode = j$.isDomNode(a);
- var bIsDomNode = j$.isDomNode(b);
- if (aIsDomNode && bIsDomNode) {
- // At first try to use DOM3 method isEqualNode
- if (a.isEqualNode) {
- return a.isEqualNode(b);
- }
- // IE8 doesn't support isEqualNode, try to use outerHTML && innerText
- var aIsElement = a instanceof Element;
- var bIsElement = b instanceof Element;
- if (aIsElement && bIsElement) {
- return a.outerHTML == b.outerHTML;
- }
- if (aIsElement || bIsElement) {
- return false;
- }
- return a.innerText == b.innerText && a.textContent == b.textContent;
- }
- if (aIsDomNode || bIsDomNode) {
- return false;
- }
-
- // Assume equality for cyclic structures. The algorithm for detecting cyclic
- // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
- var length = aStack.length;
- while (length--) {
- // Linear search. Performance is inversely proportional to the number of
- // unique nested structures.
- if (aStack[length] == a) { return bStack[length] == b; }
- }
- // Add the first object to the stack of traversed objects.
- aStack.push(a);
- bStack.push(b);
- var size = 0;
- // Recursively compare objects and arrays.
- // Compare array lengths to determine if a deep comparison is necessary.
- if (className == '[object Array]') {
- size = a.length;
- if (size !== b.length) {
- return false;
- }
-
- while (size--) {
- result = eq(a[size], b[size], aStack, bStack, customTesters);
- if (!result) {
- return false;
- }
- }
- } else {
-
- // Objects with different constructors are not equivalent, but `Object`s
- // or `Array`s from different frames are.
- // CUSTOM JEST CHANGE:
- // TODO(cpojer): fix all tests and this and re-enable this check
- /*
- var aCtor = a.constructor, bCtor = b.constructor;
- if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor &&
- isFunction(bCtor) && bCtor instanceof bCtor)) {
- return false;
- }
- */
- }
-
- // Deep compare objects.
- var aKeys = keys(a, className == '[object Array]'), key;
- size = aKeys.length;
-
- // Ensure that both objects contain the same number of properties before comparing deep equality.
- if (keys(b, className == '[object Array]').length !== size) { return false; }
-
- while (size--) {
- key = aKeys[size];
-
- // Deep compare each member
- result = has(b, key) && eq(a[key], b[key], aStack, bStack, customTesters);
-
- if (!result) {
- return false;
- }
- }
- // Remove the first object from the stack of traversed objects.
- aStack.pop();
- bStack.pop();
-
- return result;
-
- function keys(obj, isArray) {
- // CUSTOM JEST CHANGE: don't consider undefined keys.
- var allKeys = (function(o) {
- var keys = [];
- for (var key in o) {
- if (has(o, key)) {
- keys.push(key);
- }
- }
- return keys;
- })(obj);
-
- if (!isArray) {
- return allKeys;
- }
-
- var extraKeys = [];
- if (allKeys.length === 0) {
- return allKeys;
- }
-
- for (var x = 0; x < allKeys.length; x++) {
- if (!allKeys[x].match(/^[0-9]+$/)) {
- extraKeys.push(allKeys[x]);
- }
- }
-
- return extraKeys;
- }
- }
-
- function has(obj, key) {
- // CUSTOM JEST CHANGE:
- // TODO(cpojer): remove the `obj[key] !== undefined` check.
- return Object.prototype.hasOwnProperty.call(obj, key) && obj[key] !== undefined;
- }
-
- function isFunction(obj) {
- return typeof obj === 'function';
- }
-
- function isObjectConstructor(ctor) {
- // aCtor instanceof aCtor is true for the Object and Function
- // constructors (since a constructor is-a Function and a function is-a
- // Object). We don't just compare ctor === Object because the constructor
- // might come from a different frame with different globals.
- return isFunction(ctor) && ctor instanceof ctor;
- }
-};
-
-getJasmineRequireObj().toBe = function() {
- function toBe() {
- return {
- compare: function(actual, expected) {
- return {
- pass: actual === expected
- };
- }
- };
- }
-
- return toBe;
-};
-
-getJasmineRequireObj().toBeCloseTo = function() {
-
- function toBeCloseTo() {
- return {
- compare: function(actual, expected, precision) {
- if (precision !== 0) {
- precision = precision || 2;
- }
-
- return {
- pass: Math.abs(expected - actual) < (Math.pow(10, -precision) / 2)
- };
- }
- };
- }
-
- return toBeCloseTo;
-};
-
-getJasmineRequireObj().toBeDefined = function() {
- function toBeDefined() {
- return {
- compare: function(actual) {
- return {
- pass: (void 0 !== actual)
- };
- }
- };
- }
-
- return toBeDefined;
-};
-
-getJasmineRequireObj().toBeFalsy = function() {
- function toBeFalsy() {
- return {
- compare: function(actual) {
- return {
- pass: !!!actual
- };
- }
- };
- }
-
- return toBeFalsy;
-};
-
-getJasmineRequireObj().toBeGreaterThan = function() {
-
- function toBeGreaterThan() {
- return {
- compare: function(actual, expected) {
- return {
- pass: actual > expected
- };
- }
- };
- }
-
- return toBeGreaterThan;
-};
-
-
-getJasmineRequireObj().toBeGreaterThanOrEqual = function() {
-
- function toBeGreaterThanOrEqual() {
- return {
- compare: function(actual, expected) {
- return {
- pass: actual >= expected
- };
- }
- };
- }
-
- return toBeGreaterThanOrEqual;
-};
-
-getJasmineRequireObj().toBeLessThan = function() {
- function toBeLessThan() {
- return {
-
- compare: function(actual, expected) {
- return {
- pass: actual < expected
- };
- }
- };
- }
-
- return toBeLessThan;
-};
-getJasmineRequireObj().toBeLessThanOrEqual = function() {
- function toBeLessThanOrEqual() {
- return {
-
- compare: function(actual, expected) {
- return {
- pass: actual <= expected
- };
- }
- };
- }
-
- return toBeLessThanOrEqual;
-};
-
-getJasmineRequireObj().toBeNaN = function(j$) {
-
- function toBeNaN() {
- return {
- compare: function(actual) {
- var result = {
- pass: (actual !== actual)
- };
-
- if (result.pass) {
- result.message = 'Expected actual not to be NaN.';
- } else {
- result.message = function() { return 'Expected ' + j$.pp(actual) + ' to be NaN.'; };
- }
-
- return result;
- }
- };
- }
-
- return toBeNaN;
-};
-
-getJasmineRequireObj().toBeNull = function() {
-
- function toBeNull() {
- return {
- compare: function(actual) {
- return {
- pass: actual === null
- };
- }
- };
- }
-
- return toBeNull;
-};
-
-getJasmineRequireObj().toBeTruthy = function() {
-
- function toBeTruthy() {
- return {
- compare: function(actual) {
- return {
- pass: !!actual
- };
- }
- };
- }
-
- return toBeTruthy;
-};
-
-getJasmineRequireObj().toBeUndefined = function() {
-
- function toBeUndefined() {
- return {
- compare: function(actual) {
- return {
- pass: void 0 === actual
- };
- }
- };
- }
-
- return toBeUndefined;
-};
-
-getJasmineRequireObj().toContain = function() {
- function toContain(util, customEqualityTesters) {
- customEqualityTesters = customEqualityTesters || [];
-
- return {
- compare: function(actual, expected) {
-
- return {
- pass: util.contains(actual, expected, customEqualityTesters)
- };
- }
- };
- }
-
- return toContain;
-};
-
-getJasmineRequireObj().toEqual = function() {
-
- function toEqual(util, customEqualityTesters) {
- customEqualityTesters = customEqualityTesters || [];
-
- return {
- compare: function(actual, expected) {
- var result = {
- pass: false
- };
-
- result.pass = util.equals(actual, expected, customEqualityTesters);
-
- return result;
- }
- };
- }
-
- return toEqual;
-};
-
-getJasmineRequireObj().toHaveBeenCalled = function(j$) {
-
- var getErrorMsg = j$.formatErrorMsg('', 'expect().toHaveBeenCalled()');
-
- function toHaveBeenCalled() {
- return {
- compare: function(actual) {
- var result = {};
-
- if (!j$.isSpy(actual)) {
- throw new Error(getErrorMsg('Expected a spy, but got ' + j$.pp(actual) + '.'));
- }
-
- if (arguments.length > 1) {
- throw new Error(getErrorMsg('Does not take arguments, use toHaveBeenCalledWith'));
- }
-
- result.pass = actual.calls.any();
-
- result.message = result.pass ?
- 'Expected spy ' + actual.and.identity() + ' not to have been called.' :
- 'Expected spy ' + actual.and.identity() + ' to have been called.';
-
- return result;
- }
- };
- }
-
- return toHaveBeenCalled;
-};
-
-getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) {
-
- var getErrorMsg = j$.formatErrorMsg('', 'expect().toHaveBeenCalledTimes()');
-
- function toHaveBeenCalledTimes() {
- return {
- compare: function(actual, expected) {
- if (!j$.isSpy(actual)) {
- throw new Error(getErrorMsg('Expected a spy, but got ' + j$.pp(actual) + '.'));
- }
-
- var args = Array.prototype.slice.call(arguments, 0),
- result = { pass: false };
-
- if (!j$.isNumber_(expected)){
- throw new Error(getErrorMsg('The expected times failed is a required argument and must be a number.'));
- }
-
- actual = args[0];
- var calls = actual.calls.count();
- var timesMessage = expected === 1 ? 'once' : expected + ' times';
- result.pass = calls === expected;
- result.message = result.pass ?
- 'Expected spy ' + actual.and.identity() + ' not to have been called ' + timesMessage + '. It was called ' + calls + ' times.' :
- 'Expected spy ' + actual.and.identity() + ' to have been called ' + timesMessage + '. It was called ' + calls + ' times.';
- return result;
- }
- };
- }
-
- return toHaveBeenCalledTimes;
-};
-
-getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
-
- var getErrorMsg = j$.formatErrorMsg('', 'expect().toHaveBeenCalledWith(...arguments)');
-
- function toHaveBeenCalledWith(util, customEqualityTesters) {
- return {
- compare: function() {
- var args = Array.prototype.slice.call(arguments, 0),
- actual = args[0],
- expectedArgs = args.slice(1),
- result = { pass: false };
-
- if (!j$.isSpy(actual)) {
- throw new Error(getErrorMsg('Expected a spy, but got ' + j$.pp(actual) + '.'));
- }
-
- if (!actual.calls.any()) {
- result.message = function() { return 'Expected spy ' + actual.and.identity() + ' to have been called with ' + j$.pp(expectedArgs) + ' but it was never called.'; };
- return result;
- }
-
- if (util.contains(actual.calls.allArgs(), expectedArgs, customEqualityTesters)) {
- result.pass = true;
- result.message = function() { return 'Expected spy ' + actual.and.identity() + ' not to have been called with ' + j$.pp(expectedArgs) + ' but it was.'; };
- } else {
- result.message = function() { return 'Expected spy ' + actual.and.identity() + ' to have been called with ' + j$.pp(expectedArgs) + ' but actual calls were ' + j$.pp(actual.calls.allArgs()).replace(/^\[ | \]$/g, '') + '.'; };
- }
-
- return result;
- }
- };
- }
-
- return toHaveBeenCalledWith;
-};
-
-getJasmineRequireObj().toMatch = function(j$) {
-
- var getErrorMsg = j$.formatErrorMsg('', 'expect().toMatch( || )');
-
- function toMatch() {
- return {
- compare: function(actual, expected) {
- if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) {
- throw new Error(getErrorMsg('Expected is not a String or a RegExp'));
- }
-
- var regexp = new RegExp(expected);
-
- return {
- pass: regexp.test(actual)
- };
- }
- };
- }
-
- return toMatch;
-};
-
-getJasmineRequireObj().toThrow = function(j$) {
-
- var getErrorMsg = j$.formatErrorMsg('', 'expect(function() {}).toThrow()');
-
- function toThrow(util) {
- return {
- compare: function(actual, expected) {
- var result = { pass: false },
- threw = false,
- thrown;
-
- if (typeof actual != 'function') {
- throw new Error(getErrorMsg('Actual is not a Function'));
- }
-
- try {
- actual();
- } catch (e) {
- threw = true;
- thrown = e;
- }
-
- if (!threw) {
- result.message = 'Expected function to throw an exception.';
- return result;
- }
-
- if (arguments.length == 1) {
- result.pass = true;
- result.message = function() { return 'Expected function not to throw, but it threw ' + j$.pp(thrown) + '.'; };
-
- return result;
- }
-
- if (util.equals(thrown, expected)) {
- result.pass = true;
- result.message = function() { return 'Expected function not to throw ' + j$.pp(expected) + '.'; };
- } else {
- result.message = function() { return 'Expected function to throw ' + j$.pp(expected) + ', but it threw ' + j$.pp(thrown) + '.'; };
- }
-
- return result;
- }
- };
- }
-
- return toThrow;
-};
-
-getJasmineRequireObj().toThrowError = function(j$) {
-
- var getErrorMsg = j$.formatErrorMsg('', 'expect(function() {}).toThrowError(, )');
-
- function toThrowError () {
- return {
- compare: function(actual) {
- var threw = false,
- pass = {pass: true},
- fail = {pass: false},
- thrown;
-
- if (typeof actual != 'function') {
- throw new Error(getErrorMsg('Actual is not a Function'));
- }
-
- var errorMatcher = getMatcher.apply(null, arguments);
-
- try {
- actual();
- } catch (e) {
- threw = true;
- thrown = e;
- }
-
- if (!threw) {
- fail.message = 'Expected function to throw an Error.';
- return fail;
- }
-
- if (!(thrown instanceof Error)) {
- fail.message = function() { return 'Expected function to throw an Error, but it threw ' + j$.pp(thrown) + '.'; };
- return fail;
- }
-
- if (errorMatcher.hasNoSpecifics()) {
- pass.message = 'Expected function not to throw an Error, but it threw ' + j$.fnNameFor(thrown) + '.';
- return pass;
- }
-
- if (errorMatcher.matches(thrown)) {
- pass.message = function() {
- return 'Expected function not to throw ' + errorMatcher.errorTypeDescription + errorMatcher.messageDescription() + '.';
- };
- return pass;
- } else {
- fail.message = function() {
- return 'Expected function to throw ' + errorMatcher.errorTypeDescription + errorMatcher.messageDescription() +
- ', but it threw ' + errorMatcher.thrownDescription(thrown) + '.';
- };
- return fail;
- }
- }
- };
-
- function getMatcher() {
- var expected = null,
- errorType = null;
-
- if (arguments.length == 2) {
- expected = arguments[1];
- if (isAnErrorType(expected)) {
- errorType = expected;
- expected = null;
- }
- } else if (arguments.length > 2) {
- errorType = arguments[1];
- expected = arguments[2];
- if (!isAnErrorType(errorType)) {
- throw new Error(getErrorMsg('Expected error type is not an Error.'));
- }
- }
-
- if (expected && !isStringOrRegExp(expected)) {
- if (errorType) {
- throw new Error(getErrorMsg('Expected error message is not a string or RegExp.'));
- } else {
- throw new Error(getErrorMsg('Expected is not an Error, string, or RegExp.'));
- }
- }
-
- function messageMatch(message) {
- if (typeof expected == 'string') {
- return expected == message;
- } else {
- return expected.test(message);
- }
- }
-
- return {
- errorTypeDescription: errorType ? j$.fnNameFor(errorType) : 'an exception',
- thrownDescription: function(thrown) {
- var thrownName = errorType ? j$.fnNameFor(thrown.constructor) : 'an exception',
- thrownMessage = '';
-
- if (expected) {
- thrownMessage = ' with message ' + j$.pp(thrown.message);
- }
-
- return thrownName + thrownMessage;
- },
- messageDescription: function() {
- if (expected === null) {
- return '';
- } else if (expected instanceof RegExp) {
- return ' with a message matching ' + j$.pp(expected);
- } else {
- return ' with message ' + j$.pp(expected);
- }
- },
- hasNoSpecifics: function() {
- return expected === null && errorType === null;
- },
- matches: function(error) {
- return (errorType === null || error instanceof errorType) &&
- (expected === null || messageMatch(error.message));
- }
- };
- }
-
- function isStringOrRegExp(potential) {
- return potential instanceof RegExp || (typeof potential == 'string');
- }
-
- function isAnErrorType(type) {
- if (typeof type !== 'function') {
- return false;
- }
-
- var Surrogate = function() {};
- Surrogate.prototype = type.prototype;
- return (new Surrogate()) instanceof Error;
- }
- }
-
- return toThrowError;
-};
-
-getJasmineRequireObj().interface = function(jasmine, env) {
- var jasmineInterface = {
- describe: function(description, specDefinitions) {
- return env.describe(description, specDefinitions);
- },
-
- xdescribe: function(description, specDefinitions) {
- return env.xdescribe(description, specDefinitions);
- },
-
- fdescribe: function(description, specDefinitions) {
- return env.fdescribe(description, specDefinitions);
- },
-
- it: function() {
- return env.it.apply(env, arguments);
- },
-
- xit: function() {
- return env.xit.apply(env, arguments);
- },
-
- fit: function() {
- return env.fit.apply(env, arguments);
- },
-
- beforeEach: function() {
- return env.beforeEach.apply(env, arguments);
- },
-
- afterEach: function() {
- return env.afterEach.apply(env, arguments);
- },
-
- beforeAll: function() {
- return env.beforeAll.apply(env, arguments);
- },
-
- afterAll: function() {
- return env.afterAll.apply(env, arguments);
- },
-
- expect: function(actual) {
- return env.expect(actual);
- },
-
- pending: function() {
- return env.pending.apply(env, arguments);
- },
-
- fail: function() {
- return env.fail.apply(env, arguments);
- },
-
- spyOn: function(obj, methodName) {
- return env.spyOn(obj, methodName);
- },
-
- jsApiReporter: new jasmine.JsApiReporter({
- timer: new jasmine.Timer()
- }),
-
- jasmine: jasmine
- };
-
- jasmine.addCustomEqualityTester = function(tester) {
- env.addCustomEqualityTester(tester);
- };
-
- jasmine.addMatchers = function(matchers) {
- return env.addMatchers(matchers);
- };
-
- jasmine.clock = function() {
- return env.clock;
- };
-
- return jasmineInterface;
-};
-
-getJasmineRequireObj().version = function() {
- return '2.5.2';
-};
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-matcher-utils/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-matcher-utils/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-matcher-utils/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-matcher-utils/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-matcher-utils/build/index.js
deleted file mode 100644
index 993f730b7..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-matcher-utils/build/index.js
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-const chalk = require('chalk');
-const prettyFormat = require('pretty-format');
-
-
-
-
-
-
-
-
-
-
-
-
-
-const EXPECTED_COLOR = chalk.green;
-const RECEIVED_COLOR = chalk.red;
-
-const NUMBERS = [
-'zero',
-'one',
-'two',
-'three',
-'four',
-'five',
-'six',
-'seven',
-'eight',
-'nine',
-'ten',
-'eleven',
-'twelve',
-'thirteen'];
-
-
-// get the type of a value with handling the edge cases like `typeof []`
-// and `typeof null`
-const getType = value => {
- if (typeof value === 'undefined') {
- return 'undefined';
- } else if (value === null) {
- return 'null';
- } else if (Array.isArray(value)) {
- return 'array';
- } else if (typeof value === 'boolean') {
- return 'boolean';
- } else if (typeof value === 'function') {
- return 'function';
- } else if (typeof value === 'number') {
- return 'number';
- } else if (typeof value === 'string') {
- return 'string';
- } else if (typeof value === 'object') {
- if (value.constructor === RegExp) {
- return 'regexp';
- }
- return 'object';
- // $FlowFixMe https://github.com/facebook/flow/issues/1015
- } else if (typeof value === 'symbol') {
- return 'symbol';
- }
-
- throw new Error(`value of unknown type: ${ value }`);
-};
-
-const stringify = object => {
- try {
- return prettyFormat(object, {
- maxDepth: 10,
- min: true });
-
- } catch (e) {
- return prettyFormat(object, {
- callToJSON: false,
- maxDepth: 10,
- min: true });
-
- }
-};
-
-const printReceived = object => RECEIVED_COLOR(stringify(object));
-const printExpected = value => EXPECTED_COLOR(stringify(value));
-
-const printWithType = (
-name,
-received,
-print) =>
-{
- const type = getType(received);
- return (
- name + ':' + (
- type !== 'null' && type !== 'undefined' ?
- '\n ' + type + ': ' :
- ' ') +
- print(received));
-
-};
-
-const ensureNoExpected = (expected, matcherName) => {
- matcherName || (matcherName = 'This');
- if (typeof expected !== 'undefined') {
- throw new Error(
- matcherHint('[.not]' + matcherName, undefined, '') + '\n\n' +
- 'Matcher does not accept any arguments.\n' +
- printWithType('Got', expected, printExpected));
-
- }
-};
-
-const ensureActualIsNumber = (actual, matcherName) => {
- matcherName || (matcherName = 'This matcher');
- if (typeof actual !== 'number') {
- throw new Error(
- matcherHint('[.not]' + matcherName) + '\n\n' +
- `Actual value must be a number.\n` +
- printWithType('Received', actual, printReceived));
-
- }
-};
-
-const ensureExpectedIsNumber = (expected, matcherName) => {
- matcherName || (matcherName = 'This matcher');
- if (typeof expected !== 'number') {
- throw new Error(
- matcherHint('[.not]' + matcherName) + '\n\n' +
- `Expected value must be a number.\n` +
- printWithType('Got', expected, printExpected));
-
- }
-};
-
-const ensureNumbers = (actual, expected, matcherName) => {
- ensureActualIsNumber(actual, matcherName);
- ensureExpectedIsNumber(expected, matcherName);
-};
-
-const pluralize =
-(word, count) =>
-(NUMBERS[count] || count) + ' ' + word + (count === 1 ? '' : 's');
-
-const matcherHint = function (
-matcherName)
-
-
-{let received = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'received';let expected = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'expected';
- return (
- chalk.dim('expect(') + RECEIVED_COLOR(received) +
- chalk.dim(')' + matcherName + '(') +
- EXPECTED_COLOR(expected) + chalk.dim(')'));
-
-};
-
-module.exports = {
- EXPECTED_COLOR,
- RECEIVED_COLOR,
- ensureActualIsNumber,
- ensureExpectedIsNumber,
- ensureNoExpected,
- ensureNumbers,
- getType,
- matcherHint,
- pluralize,
- printExpected,
- printReceived,
- printWithType,
- stringify };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-matcher-utils/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-matcher-utils/package.json
deleted file mode 100644
index f70f9c4a4..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-matcher-utils/package.json
+++ /dev/null
@@ -1,88 +0,0 @@
-{
- "_args": [
- [
- "jest-matcher-utils@^17.0.3",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest-matchers"
- ]
- ],
- "_from": "jest-matcher-utils@>=17.0.3 <18.0.0",
- "_id": "jest-matcher-utils@17.0.3",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-matcher-utils",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-18-east.internal.npmjs.com",
- "tmp": "tmp/jest-matcher-utils-17.0.3.tgz_1479368475825_0.30437314650043845"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-matcher-utils",
- "raw": "jest-matcher-utils@^17.0.3",
- "rawSpec": "^17.0.3",
- "scope": null,
- "spec": ">=17.0.3 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-diff",
- "/jest-matchers",
- "/jest-snapshot"
- ],
- "_resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-17.0.3.tgz",
- "_shasum": "f108e49b956e152c6626dcc0aba864f59ab7b0d3",
- "_shrinkwrap": null,
- "_spec": "jest-matcher-utils@^17.0.3",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest-matchers",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "chalk": "^1.1.3",
- "pretty-format": "~4.2.1"
- },
- "description": "A set of utility functions for jest-matchers and related packages",
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "f108e49b956e152c6626dcc0aba864f59ab7b0d3",
- "tarball": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-17.0.3.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- }
- ],
- "name": "jest-matcher-utils",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.3"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-matchers/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-matchers/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-matchers/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-matchers/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-matchers/build/index.js
deleted file mode 100644
index 92d5f41a5..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-matchers/build/index.js
+++ /dev/null
@@ -1,158 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-
-
-
-
-
-
-
-
-
-const matchers = require('./matchers');
-const spyMatchers = require('./spyMatchers');
-const toThrowMatchers = require('./toThrowMatchers');
-
-const utils = require('jest-matcher-utils');
-
-const GLOBAL_STATE = Symbol.for('$$jest-matchers-object');
-
-class JestAssertionError extends Error {}
-
-if (!global[GLOBAL_STATE]) {
- Object.defineProperty(
- global,
- GLOBAL_STATE,
- { value: { matchers: Object.create(null), state: { suppressedErrors: [] } } });
-
-}
-
-const expect = actual => {
- const allMatchers = global[GLOBAL_STATE].matchers;
- const expectation = { not: {} };
- Object.keys(allMatchers).forEach(name => {
- expectation[name] =
- makeThrowingMatcher(allMatchers[name], false, actual);
- expectation.not[name] =
- makeThrowingMatcher(allMatchers[name], true, actual);
- });
-
- return expectation;
-};
-
-const makeThrowingMatcher = (
-matcher,
-isNot,
-actual) =>
-{
- return function throwingMatcher() {
- let throws = true;
- const matcherContext = Object.assign(
- // When throws is disabled, the matcher will not throw errors during test
- // execution but instead add them to the global matcher state. If a
- // matcher throws, test execution is normally stopped immediately. The
- // snapshot matcher uses it because we want to log all snapshot
- // failures in a test.
- { dontThrow: () => throws = false },
- global[GLOBAL_STATE].state,
- {
- isNot,
- utils });
-
-
- let result;
-
- try {for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}
- result = matcher.apply(
- matcherContext,
- [actual].concat(args));
-
- } catch (error) {
- // Remove this and deeper functions from the stack trace frame.
- Error.captureStackTrace(error, throwingMatcher);
- throw error;
- }
-
- _validateResult(result);
-
- if (result.pass && isNot || !result.pass && !isNot) {// XOR
- let message = result.message;
-
- // for performance reasons some of the messages are evaluated
- // lazily
- if (typeof message === 'function') {
- message = message();
- }
-
- if (!message) {
- message = utils.RECEIVED_COLOR(
- 'No message was specified for this matcher.');
-
- }
-
- const error = new JestAssertionError(message);
- // Remove this function from the stack trace frame.
- Error.captureStackTrace(error, throwingMatcher);
-
- if (throws) {
- throw error;
- } else {
- global[GLOBAL_STATE].state.suppressedErrors.push(error);
- }
- }
- };
-};
-
-expect.extend = matchersObj => {
- Object.assign(global[GLOBAL_STATE].matchers, matchersObj);
-};
-
-const _validateResult = result => {
- if (
- typeof result !== 'object' ||
- typeof result.pass !== 'boolean' ||
-
- result.message &&
-
- typeof result.message !== 'string' &&
- typeof result.message !== 'function')
-
-
- {
- throw new Error(
- 'Unexpected return from a matcher function.\n' +
- 'Matcher functions should ' +
- 'return an object in the following format:\n' +
- ' {message?: string | function, pass: boolean}\n' +
- `'${ utils.stringify(result) }' was returned`);
-
- }
-};
-
-const setState = state => {
- Object.assign(global[GLOBAL_STATE].state, state);
-};
-
-const getState = () => global[GLOBAL_STATE].state;
-
-// add default jest matchers
-expect.extend(matchers);
-expect.extend(spyMatchers);
-expect.extend(toThrowMatchers);
-
-module.exports = {
- expect,
- getState,
- setState };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-matchers/build/matchers.js b/fundamentals/bug-challenge-es6/node_modules/jest-matchers/build/matchers.js
deleted file mode 100644
index 0e5f4ab04..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-matchers/build/matchers.js
+++ /dev/null
@@ -1,479 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-/* eslint-disable max-len */
-
-'use strict';var _require =
-
-
-
-
-
-
-
-require('jest-snapshot');const toMatchSnapshot = _require.toMatchSnapshot;
-
-const diff = require('jest-diff');var _require2 =
-require('jest-util');const escapeStrForRegex = _require2.escapeStrForRegex;var _require3 =
-
-
-
-
-
-
-
-
-
-
-require('jest-matcher-utils');const EXPECTED_COLOR = _require3.EXPECTED_COLOR,RECEIVED_COLOR = _require3.RECEIVED_COLOR,ensureNoExpected = _require3.ensureNoExpected,ensureNumbers = _require3.ensureNumbers,getType = _require3.getType,matcherHint = _require3.matcherHint,printReceived = _require3.printReceived,printExpected = _require3.printExpected,printWithType = _require3.printWithType;
-
-
-
-
-
-
-
-
-
-const IteratorSymbol = Symbol.iterator;
-const equals = global.jasmine.matchersUtil.equals;
-
-const hasIterator = object => !!(object != null && object[IteratorSymbol]);
-const iterableEquality = (a, b) => {
- if (
- typeof a !== 'object' ||
- typeof b !== 'object' ||
- Array.isArray(a) ||
- Array.isArray(b) ||
- !hasIterator(a) ||
- !hasIterator(b))
- {
- return undefined;
- }
- if (a.constructor !== b.constructor) {
- return false;
- }
- const bIterator = b[IteratorSymbol]();
-
- for (const aValue of a) {
- const nextB = bIterator.next();
- if (
- nextB.done ||
- !global.jasmine.matchersUtil.equals(
- aValue,
- nextB.value,
- [iterableEquality]))
-
- {
- return false;
- }
- }
- if (!bIterator.next().done) {
- return false;
- }
- return true;
-};
-
-const matchers = {
- toBe(received, expected) {
- const pass = received === expected;
-
- const message = pass ?
- () => matcherHint('.not.toBe') + '\n\n' +
- `Expected value to not be (using ===):\n` +
- ` ${ printExpected(expected) }\n` +
- `Received:\n` +
- ` ${ printReceived(received) }` :
- () => {
- const diffString = diff(expected, received, {
- expand: this.expand });
-
- return matcherHint('.toBe') + '\n\n' +
- `Expected value to be (using ===):\n` +
- ` ${ printExpected(expected) }\n` +
- `Received:\n` +
- ` ${ printReceived(received) }` + (
- diffString ? `\n\nDifference:\n\n${ diffString }` : '');
- };
-
- return { message, pass };
- },
-
- toBeCloseTo(
- actual,
- expected)
-
- {let precision = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
- ensureNumbers(actual, expected, '.toBeCloseTo');
- const pass = Math.abs(expected - actual) < Math.pow(10, -precision) / 2;
- const message = pass ?
- () => matcherHint('.not.toBeCloseTo', 'received', 'expected, precision') + '\n\n' +
- `Expected value not to be close to (with ${ printExpected(precision) }-digit precision):\n` +
- ` ${ printExpected(expected) }\n` +
- `Received: \n` +
- ` ${ printReceived(actual) }` :
- () => matcherHint('.toBeCloseTo', 'received', 'expected, precision') + '\n\n' +
- `Expected value to be close to (with ${ printExpected(precision) }-digit precision):\n` +
- ` ${ printExpected(expected) }\n` +
- `Received: \n` +
- ` ${ printReceived(actual) }`;
-
- return { message, pass };
- },
-
- toBeDefined(actual, expected) {
- ensureNoExpected(expected, '.toBeDefined');
- const pass = actual !== void 0;
- const message = pass ?
- () => matcherHint('.not.toBeDefined', 'received', '') + '\n\n' +
- `Expected value not to be defined, instead received\n` +
- ` ${ printReceived(actual) }` :
- () => matcherHint('.toBeDefined', 'received', '') + '\n\n' +
- `Expected value to be defined, instead received\n` +
- ` ${ printReceived(actual) }`;
- return { message, pass };
- },
-
- toBeFalsy(actual, expected) {
- ensureNoExpected(expected, '.toBeFalsy');
- const pass = !actual;
- const message = pass ?
- () => matcherHint('.not.toBeFalsy', 'received', '') + '\n\n' +
- `Expected value not to be falsy, instead received\n` +
- ` ${ printReceived(actual) }` :
- () => matcherHint('.toBeFalsy', 'received', '') + '\n\n' +
- `Expected value to be falsy, instead received\n` +
- ` ${ printReceived(actual) }`;
- return { message, pass };
- },
-
- toBeGreaterThan(actual, expected) {
- ensureNumbers(actual, expected, '.toBeGreaterThan');
- const pass = actual > expected;
- const message = pass ?
- () => matcherHint('.not.toBeGreaterThan') + '\n\n' +
- `Expected value not to be greater than:\n` +
- ` ${ printExpected(expected) }\n` +
- `Received:\n` +
- ` ${ printReceived(actual) }` :
- () => matcherHint('.toBeGreaterThan') + '\n\n' +
- `Expected value to be greater than:\n` +
- ` ${ printExpected(expected) }\n` +
- `Received:\n` +
- ` ${ printReceived(actual) }`;
- return { message, pass };
- },
-
- toBeGreaterThanOrEqual(actual, expected) {
- ensureNumbers(actual, expected, '.toBeGreaterThanOrEqual');
- const pass = actual >= expected;
- const message = pass ?
- () => matcherHint('.not.toBeGreaterThanOrEqual') + '\n\n' +
- `Expected value not to be greater than or equal:\n` +
- ` ${ printExpected(expected) }\n` +
- `Received:\n` +
- ` ${ printReceived(actual) }` :
- () => matcherHint('.toBeGreaterThanOrEqual') + '\n\n' +
- `Expected value to be greater than or equal:\n` +
- ` ${ printExpected(expected) }\n` +
- `Received:\n` +
- ` ${ printReceived(actual) }`;
- return { message, pass };
- },
-
- toBeInstanceOf(received, constructor) {
- const constType = getType(constructor);
-
- if (constType !== 'function') {
- throw new Error(
- matcherHint('[.not].toBeInstanceOf', 'value', 'constructor') + `\n\n` +
- `Expected constructor to be a function. Instead got:\n` +
- ` ${ printExpected(constType) }`);
-
- }
- const pass = received instanceof constructor;
-
- const message = pass ?
- () => matcherHint('.not.toBeInstanceOf', 'value', 'constructor') + '\n\n' +
- `Expected value not to be an instance of:\n` +
- ` ${ printExpected(constructor.name || constructor) }\n` +
- `Received:\n` +
- ` ${ printReceived(received) }\n` :
- () => matcherHint('.toBeInstanceOf', 'value', 'constructor') + '\n\n' +
- `Expected value to be an instance of:\n` +
- ` ${ printExpected(constructor.name || constructor) }\n` +
- `Received:\n` +
- ` ${ printReceived(received) }\n` +
- `Constructor:\n` +
- ` ${ printReceived(received.constructor && received.constructor.name) }`;
-
- return { message, pass };
- },
-
- toBeLessThan(actual, expected) {
- ensureNumbers(actual, expected, '.toBeLessThan');
- const pass = actual < expected;
- const message = pass ?
- () => matcherHint('.not.toBeLessThan') + '\n\n' +
- `Expected value not to be less than:\n` +
- ` ${ printExpected(expected) }\n` +
- `Received:\n` +
- ` ${ printReceived(actual) }` :
- () => matcherHint('.toBeLessThan') + '\n\n' +
- `Expected value to be less than:\n` +
- ` ${ printExpected(expected) }\n` +
- `Received:\n` +
- ` ${ printReceived(actual) }`;
- return { message, pass };
- },
-
- toBeLessThanOrEqual(actual, expected) {
- ensureNumbers(actual, expected, '.toBeLessThanOrEqual');
- const pass = actual <= expected;
- const message = pass ?
- () => matcherHint('.not.toBeLessThanOrEqual') + '\n\n' +
- `Expected value not to be less than or equal:\n` +
- ` ${ printExpected(expected) }\n` +
- `Received:\n` +
- ` ${ printReceived(actual) }` :
- () => matcherHint('.toBeLessThanOrEqual') + '\n\n' +
- `Expected value to be less than or equal:\n` +
- ` ${ printExpected(expected) }\n` +
- `Received:\n` +
- ` ${ printReceived(actual) }`;
- return { message, pass };
- },
-
- toBeNaN(actual, expected) {
- ensureNoExpected(expected, '.toBeNaN');
- const pass = Number.isNaN(actual);
- const message = pass ?
- () => matcherHint('.not.toBeNaN', 'received', '') + '\n\n' +
- `Expected value not to be NaN, instead received\n` +
- ` ${ printReceived(actual) }` :
- () => matcherHint('.toBeNaN', 'received', '') + '\n\n' +
- `Expected value to be NaN, instead received\n` +
- ` ${ printReceived(actual) }`;
- return { message, pass };
- },
-
- toBeNull(actual, expected) {
- ensureNoExpected(expected, '.toBeNull');
- const pass = actual === null;
- const message = pass ?
- () => matcherHint('.not.toBeNull', 'received', '') + '\n\n' +
- `Expected value not to be null, instead received\n` +
- ` ${ printReceived(actual) }` :
- () => matcherHint('.toBeNull', 'received', '') + '\n\n' +
- `Expected value to be null, instead received\n` +
- ` ${ printReceived(actual) }`;
- return { message, pass };
- },
-
- toBeTruthy(actual, expected) {
- ensureNoExpected(expected, '.toBeTruthy');
- const pass = !!actual;
- const message = pass ?
- () => matcherHint('.not.toBeTruthy', 'received', '') + '\n\n' +
- `Expected value not to be truthy, instead received\n` +
- ` ${ printReceived(actual) }` :
- () => matcherHint('.toBeTruthy', 'received', '') + '\n\n' +
- `Expected value to be truthy, instead received\n` +
- ` ${ printReceived(actual) }`;
- return { message, pass };
- },
-
- toBeUndefined(actual, expected) {
- ensureNoExpected(expected, '.toBeUndefined');
- const pass = actual === void 0;
- const message = pass ?
- () => matcherHint('.not.toBeUndefined', 'received', '') + '\n\n' +
- `Expected value not to be undefined, instead received\n` +
- ` ${ printReceived(actual) }` :
- () => matcherHint('.toBeUndefined', 'received', '') + '\n\n' +
- `Expected value to be undefined, instead received\n` +
- ` ${ printReceived(actual) }`;
-
- return { message, pass };
- },
-
- toContain(collection, value) {
- const collectionType = getType(collection);
-
- let converted = null;
- if (Array.isArray(collection) || typeof collection === 'string') {
- // strings have `indexOf` so we don't need to convert
- // arrays have `indexOf` and we don't want to make a copy
- converted = collection;
- } else {
- try {
- converted = Array.from(collection);
- } catch (e) {
- throw new Error(
- matcherHint('[.not].toContainEqual', 'collection', 'value') + '\n\n' +
- `Expected ${ RECEIVED_COLOR('collection') } to be an array-like structure.\n` +
- printWithType('Received', collection, printReceived));
-
- }
- }
- // At this point, we're either a string or an Array,
- // which was converted from an array-like structure.
- const pass = converted.indexOf(value) != -1;
- const message = pass ?
- () => matcherHint('.not.toContain', collectionType, 'value') + '\n\n' +
- `Expected ${ collectionType }:\n` +
- ` ${ printReceived(collection) }\n` +
- `Not to contain value:\n` +
- ` ${ printExpected(value) }\n` :
- () => matcherHint('.toContain', collectionType, 'value') + '\n\n' +
- `Expected ${ collectionType }:\n` +
- ` ${ printReceived(collection) }\n` +
- `To contain value:\n` +
- ` ${ printExpected(value) }`;
-
- return { message, pass };
- },
-
- toContainEqual(collection, value) {
- const collectionType = getType(collection);
- let converted = null;
- if (Array.isArray(collection)) {
- converted = collection;
- } else {
- try {
- converted = Array.from(collection);
- } catch (e) {
- throw new Error(
- matcherHint('[.not].toContainEqual', 'collection', 'value') + '\n\n' +
- `Expected ${ RECEIVED_COLOR('collection') } to be an array-like structure.\n` +
- printWithType('Received', collection, printReceived));
-
- }
- }
-
- const pass =
- converted.findIndex(item => equals(item, value, [iterableEquality])) !== -1;
- const message = pass ?
- () => matcherHint('.not.toContainEqual', collectionType, 'value') + '\n\n' +
- `Expected ${ collectionType }:\n` +
- ` ${ printReceived(collection) }\n` +
- `Not to contain a value equal to:\n` +
- ` ${ printExpected(value) }\n` :
- () => matcherHint('.toContainEqual', collectionType, 'value') + '\n\n' +
- `Expected ${ collectionType }:\n` +
- ` ${ printReceived(collection) }\n` +
- `To contain a value equal to:\n` +
- ` ${ printExpected(value) }`;
-
- return { message, pass };
- },
-
- toEqual(received, expected) {
- const pass = equals(received, expected, [iterableEquality]);
-
- const message = pass ?
- () => matcherHint('.not.toEqual') + '\n\n' +
- `Expected value to not equal:\n` +
- ` ${ printExpected(expected) }\n` +
- `Received:\n` +
- ` ${ printReceived(received) }` :
- () => {
- const diffString = diff(expected, received, {
- expand: this.expand });
-
- return matcherHint('.toEqual') + '\n\n' +
- `Expected value to equal:\n` +
- ` ${ printExpected(expected) }\n` +
- `Received:\n` +
- ` ${ printReceived(received) }` + (
- diffString ? `\n\nDifference:\n\n${ diffString }` : '');
- };
-
- return { message, pass };
- },
-
- toHaveLength(received, length) {
- if (
- typeof received !== 'string' && (
- !received || typeof received.length !== 'number'))
- {
- throw new Error(
- matcherHint('[.not].toHaveLength', 'received', 'length') + '\n\n' +
- `Expected value to have a 'length' prorerty that is a number. ` +
- `Received:\n` +
- ` ${ printReceived(received) }\n` + (
-
- received ?
- `received.length:\n ${ printReceived(received.length) }` :
- ''));
-
-
- }
-
- const pass = received.length === length;
- const message = pass ?
- () => matcherHint('.not.toHaveLength', 'received', 'length') + '\n\n' +
- `Expected value to not have length:\n` +
- ` ${ printExpected(length) }\n` +
- `Received:\n` +
- ` ${ printReceived(received) }\n` +
- `received.length:\n` +
- ` ${ printReceived(received.length) }` :
- () => matcherHint('.toHaveLength', 'received', 'length') + '\n\n' +
- `Expected value to have length:\n` +
- ` ${ printExpected(length) }\n` +
- `Received:\n` +
- ` ${ printReceived(received) }\n` +
- `received.length:\n` +
- ` ${ printReceived(received.length) }`;
-
- return { message, pass };
- },
-
- toMatch(received, expected) {
- if (typeof received !== 'string') {
- throw new Error(
- matcherHint('[.not].toMatch', 'string', 'expected') + '\n\n' +
- `${ RECEIVED_COLOR('string') } value must be a string.\n` +
- printWithType('Received', received, printReceived));
-
- }
-
- if (!(expected instanceof RegExp) && !(typeof expected === 'string')) {
- throw new Error(
- matcherHint('[.not].toMatch', 'string', 'expected') + '\n\n' +
- `${ EXPECTED_COLOR('expected') } value must be a string or a regular expression.\n` +
- printWithType('Expected', expected, printExpected));
-
- }
-
- const pass = new RegExp(
- typeof expected === 'string' ?
- escapeStrForRegex(expected) :
- expected).
- test(received);
- const message = pass ?
- () => matcherHint('.not.toMatch') +
- `\n\nExpected value not to match:\n` +
- ` ${ printExpected(expected) }` +
- `\nReceived:\n` +
- ` ${ printReceived(received) }` :
- () => matcherHint('.toMatch') +
- `\n\nExpected value to match:\n` +
- ` ${ printExpected(expected) }` +
- `\nReceived:\n` +
- ` ${ printReceived(received) }`;
-
- return { message, pass };
- },
-
- toMatchSnapshot };
-
-
-module.exports = matchers;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-matchers/build/spyMatchers.js b/fundamentals/bug-challenge-es6/node_modules/jest-matchers/build/spyMatchers.js
deleted file mode 100644
index 1510d2477..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-matchers/build/spyMatchers.js
+++ /dev/null
@@ -1,191 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-const CALL_PRINT_LIMIT = 3;
-const LAST_CALL_PRINT_LIMIT = 1;var _require =
-
-
-
-
-
-
-
-
-
-
-require('jest-matcher-utils');const ensureExpectedIsNumber = _require.ensureExpectedIsNumber,ensureNoExpected = _require.ensureNoExpected,EXPECTED_COLOR = _require.EXPECTED_COLOR,matcherHint = _require.matcherHint,pluralize = _require.pluralize,printExpected = _require.printExpected,printReceived = _require.printReceived,printWithType = _require.printWithType,RECEIVED_COLOR = _require.RECEIVED_COLOR;
-
-const RECEIVED_NAME = {
- 'mock function': 'jest.fn()',
- spy: 'spy' };
-
-
-const equals = global.jasmine.matchersUtil.equals;
-
-const createToBeCalledMatcher = matcherName => (received, expected) => {
- ensureNoExpected(expected, matcherName);
- ensureMock(received, matcherName);
-
- const receivedIsSpy = isSpy(received);
- const type = receivedIsSpy ? 'spy' : 'mock function';
- const count = receivedIsSpy ?
- received.calls.count() :
- received.mock.calls.length;
- const calls = receivedIsSpy ?
- received.calls.all().map(x => x.args) :
- received.mock.calls;
- const pass = count > 0;
- const message = pass ?
- () => matcherHint('.not' + matcherName, RECEIVED_NAME[type], '') +
- '\n\n' +
- `Expected ${ type } not to be called ` +
- formatReceivedCalls(calls, CALL_PRINT_LIMIT, { sameSentence: true }) :
- () => matcherHint(matcherName, RECEIVED_NAME[type], '') + '\n\n' +
- `Expected ${ type } to have been called.`;
-
- return { message, pass };
-};
-
-const createToBeCalledWithMatcher = matcherName =>
-function (
-received)
-
-{for (var _len = arguments.length, expected = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {expected[_key - 1] = arguments[_key];}
- ensureMock(received, matcherName);
-
- const receivedIsSpy = isSpy(received);
- const type = receivedIsSpy ? 'spy' : 'mock function';
- const calls = receivedIsSpy ?
- received.calls.all().map(x => x.args) :
- received.mock.calls;
- const pass = calls.some(call => equals(call, expected));
-
- const message = pass ?
- () => matcherHint('.not' + matcherName, RECEIVED_NAME[type]) + '\n\n' +
- `Expected ${ type } not to have been called with:\n` +
- ` ${ printExpected(expected) }` :
- () => matcherHint(matcherName, RECEIVED_NAME[type]) + '\n\n' +
- `Expected ${ type } to have been called with:\n` +
- ` ${ printExpected(expected) }\n` +
- formatReceivedCalls(calls, CALL_PRINT_LIMIT);
-
- return { message, pass };
-};
-
-const createLastCalledWithMatcher = matcherName =>
-function (
-received)
-
-{for (var _len2 = arguments.length, expected = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {expected[_key2 - 1] = arguments[_key2];}
- ensureMock(received, matcherName);
-
- const receivedIsSpy = isSpy(received);
- const type = receivedIsSpy ? 'spy' : 'mock function';
- const calls = receivedIsSpy ?
- received.calls.all().map(x => x.args) :
- received.mock.calls;
- const pass = equals(calls[calls.length - 1], expected);
-
- const message = pass ?
- () => matcherHint('.not' + matcherName, RECEIVED_NAME[type]) + '\n\n' +
- `Expected ${ type } to not have been last called with:\n` +
- ` ${ printExpected(expected) }` :
- () => matcherHint(matcherName, RECEIVED_NAME[type]) + '\n\n' +
- `Expected ${ type } to have been last called with:\n` +
- ` ${ printExpected(expected) }\n` +
- formatReceivedCalls(calls, LAST_CALL_PRINT_LIMIT, { isLast: true });
-
- return { message, pass };
-};
-
-const spyMatchers = {
- lastCalledWith: createLastCalledWithMatcher('.lastCalledWith'),
- toBeCalled: createToBeCalledMatcher('.toBeCalled'),
- toBeCalledWith: createToBeCalledWithMatcher('.toBeCalledWith'),
- toHaveBeenCalled: createToBeCalledMatcher('.toHaveBeenCalled'),
- toHaveBeenCalledTimes(received, expected) {
- const matcherName = '.toHaveBeenCalledTimes';
- ensureExpectedIsNumber(expected, matcherName);
- ensureMock(received, matcherName);
-
- const receivedIsSpy = isSpy(received);
- const type = receivedIsSpy ? 'spy' : 'mock function';
- const count = receivedIsSpy ?
- received.calls.count() :
- received.mock.calls.length;
- const pass = count === expected;
- const message = pass ?
- () => matcherHint(
- '.not' +
- matcherName,
- RECEIVED_NAME[type],
- String(expected)) +
-
- `\n\n` +
- `Expected ${ type } not to be called ` +
- `${ EXPECTED_COLOR(pluralize('time', expected)) }, but it was` +
- ` called exactly ${ RECEIVED_COLOR(pluralize('time', count)) }.` :
- () => matcherHint(matcherName, RECEIVED_NAME[type], String(expected)) +
- '\n\n' +
- `Expected ${ type } to have been called ` +
- `${ EXPECTED_COLOR(pluralize('time', expected)) },` +
- ` but it was called ${ RECEIVED_COLOR(pluralize('time', count)) }.`;
-
- return { message, pass };
- },
- toHaveBeenCalledWith: createToBeCalledWithMatcher('.toHaveBeenCalledWith'),
- toHaveBeenLastCalledWith:
- createLastCalledWithMatcher('.toHaveBeenLastCalledWith') };
-
-
-const isSpy = spy => spy.calls && typeof spy.calls.count === 'function';
-
-const ensureMock = (mockOrSpy, matcherName) => {
- if (
- !mockOrSpy ||
- (mockOrSpy.calls === undefined || mockOrSpy.calls.all === undefined) &&
- mockOrSpy._isMockFunction !== true)
- {
- throw new Error(
- matcherHint('[.not]' + matcherName, 'jest.fn()', '') + '\n\n' +
- `${ RECEIVED_COLOR('jest.fn()') } value must be a mock function or spy.\n` +
- printWithType('Received', mockOrSpy, printReceived));
-
- }
-};
-
-const formatReceivedCalls = (calls, limit, options) => {
- if (calls.length) {
- const but = options && options.sameSentence ? 'but' : 'But';
- const count = calls.length - limit;
- const printedCalls =
- calls.
- slice(-limit).
- reverse().
- map(printReceived).
- join(', ');
- return (
- `${ but } it was ${ options && options.isLast ? 'last ' : '' }called ` +
- `with:\n ` + printedCalls + (
- count > 0 ?
- '\nand ' + RECEIVED_COLOR(pluralize('more call', count)) + '.' :
- ''));
-
-
- } else {
- return `But it was ${ RECEIVED_COLOR('not called') }.`;
- }
-};
-
-module.exports = spyMatchers;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-matchers/build/toThrowMatchers.js b/fundamentals/bug-challenge-es6/node_modules/jest-matchers/build/toThrowMatchers.js
deleted file mode 100644
index 72d93947a..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-matchers/build/toThrowMatchers.js
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-/* eslint-disable max-len */
-
-'use strict';var _require =
-
-
-
-
-
-
-
-require('jest-util');const escapeStrForRegex = _require.escapeStrForRegex,formatStackTrace = _require.formatStackTrace,separateMessageFromStack = _require.separateMessageFromStack;var _require2 =
-
-
-
-
-
-
-require('jest-matcher-utils');const RECEIVED_COLOR = _require2.RECEIVED_COLOR,getType = _require2.getType,matcherHint = _require2.matcherHint,printExpected = _require2.printExpected,printWithType = _require2.printWithType;
-
-const equals = global.jasmine.matchersUtil.equals;
-
-const createMatcher = matcherName =>
-(actual, expected) => {
- const value = expected;
- let error;
-
- try {
- actual();
- } catch (e) {
- error = e;
- }
-
- if (typeof expected === 'string') {
- expected = new RegExp(escapeStrForRegex(expected));
- }
-
- if (typeof expected === 'function') {
- return toThrowMatchingError(matcherName, error, expected);
- } else if (expected instanceof RegExp) {
- return toThrowMatchingStringOrRegexp(matcherName, error, expected, value);
- } else if (expected && typeof expected === 'object') {
- return toThrowMatchingErrorInstance(matcherName, error, expected);
- } else if (expected === undefined) {
- const pass = error !== undefined;
- return {
- message: pass ?
- () => matcherHint('.not' + matcherName, 'function', '') + '\n\n' +
- 'Expected the function not to throw an error.\n' +
- printActualErrorMessage(error) :
- () => matcherHint(matcherName, 'function', getType(value)) + '\n\n' +
- 'Expected the function to throw an error.\n' +
- printActualErrorMessage(error),
- pass };
-
- } else {
- throw new Error(
- matcherHint('.not' + matcherName, 'function', getType(value)) + '\n\n' +
- 'Unexpected argument passed.\nExpected: ' +
- `${ printExpected('string') }, ${ printExpected('Error (type)') } or ${ printExpected('regexp') }.\n` +
- printWithType('Got', String(expected), printExpected));
-
- }
-};
-
-const matchers = {
- toThrow: createMatcher('.toThrow'),
- toThrowError: createMatcher('.toThrowError') };
-
-
-const toThrowMatchingStringOrRegexp = (
-name,
-error,
-pattern,
-value) =>
-{
- if (error && !error.message && !error.name) {
- error = new Error(error);
- }
-
- const pass = !!(error && error.message.match(pattern));
- const message = pass ?
- () => matcherHint('.not' + name, 'function', getType(value)) + '\n\n' +
- `Expected the function not to throw an error matching:\n` +
- ` ${ printExpected(value) }\n` +
- printActualErrorMessage(error) :
- () => matcherHint(name, 'function', getType(value)) + '\n\n' +
- `Expected the function to throw an error matching:\n` +
- ` ${ printExpected(value) }\n` +
- printActualErrorMessage(error);
-
- return { message, pass };
-};
-
-const toThrowMatchingErrorInstance = (
-name,
-error,
-expectedError) =>
-{
- if (error && !error.message && !error.name) {
- error = new Error(error);
- }
-
- const pass = equals(error, expectedError);
- const message = pass ?
- () => matcherHint('.not' + name, 'function', 'error') + '\n\n' +
- `Expected the function not to throw an error matching:\n` +
- ` ${ printExpected(expectedError) }\n` +
- printActualErrorMessage(error) :
- () => matcherHint(name, 'function', 'error') + '\n\n' +
- `Expected the function to throw an error matching:\n` +
- ` ${ printExpected(expectedError) }\n` +
- printActualErrorMessage(error);
-
- return { message, pass };
-};
-
-const toThrowMatchingError = (
-name,
-error,
-ErrorClass) =>
-{
- const pass = !!(error && error instanceof ErrorClass);
- const message = pass ?
- () => matcherHint('.not' + name, 'function', 'type') + '\n\n' +
- `Expected the function not to throw an error of type:\n` +
- ` ${ printExpected(ErrorClass.name) }\n` +
- printActualErrorMessage(error) :
- () => matcherHint(name, 'function', 'type') + '\n\n' +
- `Expected the function to throw an error of type:\n` +
- ` ${ printExpected(ErrorClass.name) }\n` +
- printActualErrorMessage(error);
-
- return { message, pass };
-};
-
-const printActualErrorMessage = error => {
- if (error) {var _separateMessageFromS =
- separateMessageFromStack(error.stack);const message = _separateMessageFromS.message,stack = _separateMessageFromS.stack;
- return (
- `Instead, it threw:\n` +
- RECEIVED_COLOR(
- ' ' + message + formatStackTrace(stack, {
- noStackTrace: false,
- rootDir: process.cwd(),
- testRegex: '' })));
-
-
-
- }
-
- return `But it didn't throw anything.`;
-};
-
-module.exports = matchers;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-matchers/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-matchers/package.json
deleted file mode 100644
index ded30384c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-matchers/package.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "_args": [
- [
- "jest-matchers@^17.0.3",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2"
- ]
- ],
- "_from": "jest-matchers@>=17.0.3 <18.0.0",
- "_id": "jest-matchers@17.0.3",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-matchers",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-18-east.internal.npmjs.com",
- "tmp": "tmp/jest-matchers-17.0.3.tgz_1479368476147_0.5407528567593545"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-matchers",
- "raw": "jest-matchers@^17.0.3",
- "rawSpec": "^17.0.3",
- "scope": null,
- "spec": ">=17.0.3 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-jasmine2"
- ],
- "_resolved": "https://registry.npmjs.org/jest-matchers/-/jest-matchers-17.0.3.tgz",
- "_shasum": "88b95348c919343db86d08f12354a8650ae7eddf",
- "_shrinkwrap": null,
- "_spec": "jest-matchers@^17.0.3",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest-jasmine2",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "jest-diff": "^17.0.3",
- "jest-matcher-utils": "^17.0.3",
- "jest-util": "^17.0.2"
- },
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "88b95348c919343db86d08f12354a8650ae7eddf",
- "tarball": "https://registry.npmjs.org/jest-matchers/-/jest-matchers-17.0.3.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- }
- ],
- "name": "jest-matchers",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.3"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-mock/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-mock/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-mock/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-mock/README.md b/fundamentals/bug-challenge-es6/node_modules/jest-mock/README.md
deleted file mode 100644
index 17d209d94..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-mock/README.md
+++ /dev/null
@@ -1,122 +0,0 @@
-# jest-mock
-
-## API
-
-### `constructor(global)`
-
-Creates a new module mocker that generates mocks as if they were created in an
-environment with the given global object.
-
-### `generateFromMetadata(metadata)`
-
-Generates a mock based on the given metadata (Metadata for the mock in
-the schema returned by the getMetadata method of this module). Mocks treat
-functions specially, and all mock functions have additional members, described
-in the documentation for getMockFunction in this module.
-
-
-One important note: function prototypes are handled specially by this
-mocking framework. For functions with prototypes, when called as a
-constructor, the mock will install mocked function members on the instance.
-This allows different instances of the same constructor to have different
-values for its mocks member and its return values.
-
-### `getMetadata(component)`
-
-Inspects the argument and returns its schema in the following recursive format:
-
-```js
-{
- type: ...
- members : {}
-}
-```
-
-Where type is one of `array`, `object`, `function`, or `ref`, and members
-is an optional dictionary where the keys are member names and the values
-are metadata objects. Function prototypes are defined simply by defining
-metadata for the `member.prototype` of the function. The type of a function
-prototype should always be `object`. For instance, a simple class might be
-defined like this:
-
-```js
-{
- type: 'function',
- members: {
- staticMethod: {type: 'function'},
- prototype: {
- type: 'object',
- members: {
- instanceMethod: {type: 'function'}
- }
- }
- }
-}
- ```
-
-Metadata may also contain references to other objects defined within the
-same metadata object. The metadata for the referent must be marked with
-`refID` key and an arbitrary value. The referrer must be marked with a
-`ref` key that has the same value as object with refID that it refers to.
-For instance, this metadata blob:
-
-```js
-{
- type: 'object',
- refID: 1,
- members: {
- self: {ref: 1}
- }
-}
-```
-
-defines an object with a slot named `self` that refers back to the object.
-
-### `getMockFunction`
-
-Generates a stand-alone function with members that help drive unit tests or
-confirm expectations. Specifically, functions returned by this method have
-the following members:
-
-##### `.mock`
-
-An object with two members, `calls`, and `instances`, which are both
-lists. The items in the `calls` list are the arguments with which the
-function was called. The "instances" list stores the value of 'this' for
-each call to the function. This is useful for retrieving instances from a
-constructor.
-
-##### `.mockReturnValueOnce(value)`
-
-Pushes the given value onto a FIFO queue of return values for the
-function.
-
-##### `.mockReturnValue(value)`
-
-Sets the default return value for the function.
-
-##### `.mockImplementationOnce(function)`
-
-Pushes the given mock implementation onto a FIFO queue of mock
-implementations for the function.
-
-##### `.mockImplementation(function)`
-
-Sets the default mock implementation for the function.
-
-##### `.mockReturnThis()`
-
-Syntactic sugar for .mockImplementation(function() {return this;})
-
-
-
-In case both `mockImplementationOnce()/mockImplementation()` and
-`mockReturnValueOnce()/mockReturnValue()` are called. The priority of which to
-use is based on what is the last call:
-- if the last call is mockReturnValueOnce() or mockReturnValue(),
- use the specific return value or default return value.
- If specific return values are used up or no default return value is set,
- fall back to try mockImplementation();
-- if the last call is mockImplementationOnce() or mockImplementation(),
- run the specific implementation and return the result or run default
- implementation and return the result.
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-mock/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-mock/build/index.js
deleted file mode 100644
index 57f579800..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-mock/build/index.js
+++ /dev/null
@@ -1,565 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-const MOCK_CONSTRUCTOR_NAME = 'mockConstructor';
-
-// $FlowFixMe
-const RESERVED_KEYWORDS = Object.assign(Object.create(null), {
- arguments: true,
- await: true,
- break: true,
- case: true,
- catch: true,
- class: true,
- const: true,
- continue: true,
- debugger: true,
- default: true,
- delete: true,
- do: true,
- else: true,
- enum: true,
- eval: true,
- export: true,
- extends: true,
- false: true,
- finally: true,
- for: true,
- function: true,
- if: true,
- implements: true,
- import: true,
- in: true,
- instanceof: true,
- interface: true,
- let: true,
- new: true,
- null: true,
- package: true,
- private: true,
- protected: true,
- public: true,
- return: true,
- static: true,
- super: true,
- switch: true,
- this: true,
- throw: true,
- true: true,
- try: true,
- typeof: true,
- var: true,
- void: true,
- while: true,
- with: true,
- yield: true });
-
-
-function isA(typeName, value) {
- return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
-}
-
-function getType(ref) {
- if (isA('Function', ref)) {
- return 'function';
- } else if (Array.isArray(ref)) {
- return 'array';
- } else if (isA('Object', ref)) {
- return 'object';
- } else if (
- isA('Number', ref) ||
- isA('String', ref) ||
- isA('Boolean', ref) ||
- isA('Symbol', ref))
- {
- return 'constant';
- } else if (isA('Map', ref) || isA('WeakMap', ref) || isA('Set', ref)) {
- return 'collection';
- } else if (isA('RegExp', ref)) {
- return 'regexp';
- } else if (ref === undefined) {
- return 'undefined';
- } else if (ref === null) {
- return 'null';
- } else {
- return null;
- }
-}
-
-function isReadonlyProp(object, prop) {
- return (
-
- (
- prop === 'arguments' ||
- prop === 'caller' ||
- prop === 'callee' ||
- prop === 'name' ||
- prop === 'length') &&
-
- isA('Function', object) ||
-
-
- (
- prop === 'source' ||
- prop === 'global' ||
- prop === 'ignoreCase' ||
- prop === 'multiline') &&
-
- isA('RegExp', object));
-
-
-}
-
-function getSlots(object) {
- const slots = {};
- if (!object) {
- return [];
- }
-
- let parent = Object.getPrototypeOf(object);
- do {
- if (object === Object.getPrototypeOf(Function)) {
- break;
- }
- const ownNames = Object.getOwnPropertyNames(object);
- for (let i = 0; i < ownNames.length; i++) {
- const prop = ownNames[i];
- if (!isReadonlyProp(object, prop)) {
- const propDesc = Object.getOwnPropertyDescriptor(object, prop);
- if (!propDesc.get || object.__esModule) {
- slots[prop] = true;
- }
- }
- }
- object = parent;
- } while (object && (parent = Object.getPrototypeOf(object)) !== null);
- return Object.keys(slots);
-}
-
-
-class ModuleMocker {
-
-
-
- /**
- * @see README.md
- * @param global Global object of the test environment, used to create
- * mocks
- */
- constructor(global) {
- this._environmentGlobal = global;
- this._mockRegistry = new WeakMap();
- }
-
- _ensureMock(f) {
- if (!this._mockRegistry.has(f)) {
- this._mockRegistry.set(f, this._defaultMockState());
- }
- return this._mockRegistry.get(f);
- }
-
- _defaultMockState() {
- return {
- private: {
- defaultReturnValue: undefined,
- isReturnValueLastSet: false,
- mockImpl: undefined,
- specificMockImpls: [],
- specificReturnValues: [] },
-
- public: {
- calls: [],
- instances: [] } };
-
-
- }
-
- _makeComponent(metadata) {
- if (metadata.type === 'object') {
- return new this._environmentGlobal.Object();
- } else if (metadata.type === 'array') {
- return new this._environmentGlobal.Array();
- } else if (metadata.type === 'regexp') {
- return new this._environmentGlobal.RegExp('');
- } else if (
- metadata.type === 'constant' ||
- metadata.type === 'collection' ||
- metadata.type === 'null' ||
- metadata.type === 'undefined')
- {
- return metadata.value;
- } else if (metadata.type === 'function') {
- /* eslint-disable prefer-const */
- let f;
- /* eslint-enable prefer-const */
-
- const prototype =
- metadata.members &&
- metadata.members.prototype &&
- metadata.members.prototype.members ||
- {};
- const prototypeSlots = getSlots(prototype);
- const mocker = this;
- const mockConstructor = function () {
- const mockState = mocker._ensureMock(f);
- mockState.public.instances.push(this);
- mockState.public.calls.push(Array.prototype.slice.call(arguments));
- if (this instanceof f) {
- // This is probably being called as a constructor
- prototypeSlots.forEach(slot => {
- // Copy prototype methods to the instance to make
- // it easier to interact with mock instance call and
- // return values
- if (prototype[slot].type === 'function') {
- const protoImpl = this[slot];
- this[slot] = mocker.generateFromMetadata(prototype[slot]);
- this[slot]._protoImpl = protoImpl;
- }
- });
-
- // Run the mock constructor implementation
- return (
- mockState.private.mockImpl &&
- mockState.private.mockImpl.apply(this, arguments));
-
- }
-
- let returnValue;
- // If return value is last set, either specific or default, i.e.
- // mockReturnValueOnce()/mockReturnValue() is called and no
- // mockImplementationOnce()/mockImplementation() is called after that.
- // use the set return value.
- if (mockState.private.isReturnValueLastSet) {
- returnValue = mockState.private.specificReturnValues.shift();
- if (returnValue === undefined) {
- returnValue = mockState.private.defaultReturnValue;
- }
- }
-
- // If mockImplementationOnce()/mockImplementation() is last set,
- // or specific return values are used up, use the mock implementation.
- let specificMockImpl;
- if (returnValue === undefined) {
- specificMockImpl = mockState.private.specificMockImpls.shift();
- if (specificMockImpl === undefined) {
- specificMockImpl = mockState.private.mockImpl;
- }
- if (specificMockImpl) {
- return specificMockImpl.apply(this, arguments);
- }
- }
-
- // Otherwise use prototype implementation
- if (returnValue === undefined && f._protoImpl) {
- return f._protoImpl.apply(this, arguments);
- }
-
- return returnValue;
- };
-
- f = this._createMockFunction(metadata, mockConstructor);
- f._isMockFunction = true;
- f.getMockImplementation = () => this._ensureMock(f).private.mockImpl;
-
- this._mockRegistry.set(f, this._defaultMockState());
-
- // $FlowFixMe - defineProperty getters not supported
- Object.defineProperty(f, 'mock', {
- configurable: false,
- enumerable: true,
- get: () => this._ensureMock(f).public,
- set: val => this._ensureMock(f).public = val });
-
-
- f.mockClear = () => {
- const publicState = this._ensureMock(f).public;
- publicState.calls.length = 0;
- publicState.instances.length = 0;
- };
-
- f.mockReset = () => {
- this._mockRegistry.delete(f);
- };
-
- f.mockReturnValueOnce = value => {
- // next function call will return this value or default return value
- const privateState = this._ensureMock(f).private;
- privateState.isReturnValueLastSet = true;
- privateState.specificReturnValues.push(value);
- return f;
- };
-
- f.mockReturnValue = value => {
- // next function call will return specified return value or this one
- const privateState = this._ensureMock(f).private;
- privateState.isReturnValueLastSet = true;
- privateState.defaultReturnValue = value;
- return f;
- };
-
- f.mockImplementationOnce = fn => {
- // next function call will use this mock implementation return value
- // or default mock implementation return value
- const privateState = this._ensureMock(f).private;
- privateState.isReturnValueLastSet = false;
- privateState.specificMockImpls.push(fn);
- return f;
- };
-
- f.mockImplementation = f.mockImpl = fn => {
- // next function call will use mock implementation return value
- const privateState = this._ensureMock(f).private;
- privateState.isReturnValueLastSet = false;
- privateState.mockImpl = fn;
- return f;
- };
-
- f.mockReturnThis = () =>
- f.mockImplementation(function () {
- return this;
- });
-
- if (metadata.mockImpl) {
- f.mockImplementation(metadata.mockImpl);
- }
-
- return f;
- } else {
- const unknownType = metadata.type || 'undefined type';
- throw new Error('Unrecognized type ' + unknownType);
- }
- }
-
- _createMockFunction(
- metadata,
- mockConstructor)
- {
- let name = metadata.name;
- // Special case functions named `mockConstructor` to guard for infinite
- // loops.
- if (!name || name === MOCK_CONSTRUCTOR_NAME) {
- return mockConstructor;
- }
-
- // Preserve `name` property of mocked function.
- const boundFunctionPrefix = 'bound ';
- let bindCall = '';
- // if-do-while for perf reasons. The common case is for the if to fail.
- if (name && name.startsWith(boundFunctionPrefix)) {
- do {
- name = name.substring(boundFunctionPrefix.length);
- // Call bind() just to alter the function name.
- bindCall = '.bind(null)';
- } while (name && name.startsWith(boundFunctionPrefix));
- }
-
- // It's a syntax error to define functions with a reserved keyword
- // as name.
- if (RESERVED_KEYWORDS[name]) {
- name = '$' + name;
- }
-
- // It's also a syntax error to define a function with a reserved character
- // as part of it's name.
- if (/[\s-]/.test(name)) {
- name = name.replace(/[\s-]/g, '$');
- }
-
- const body =
- 'return function ' + name + '() {' +
- 'return ' + MOCK_CONSTRUCTOR_NAME + '.apply(this,arguments);' +
- '}' + bindCall;
- const createConstructor = new this._environmentGlobal.Function(
- MOCK_CONSTRUCTOR_NAME,
- body);
-
- return createConstructor(mockConstructor);
- }
-
- _generateMock(
- metadata,
- callbacks,
- refs)
- {
- const mock = this._makeComponent(metadata);
- if (metadata.refID != null) {
- refs[metadata.refID] = mock;
- }
-
- getSlots(metadata.members).forEach(slot => {
- const slotMetadata = metadata.members && metadata.members[slot] || {};
- if (slotMetadata.ref != null) {
- callbacks.push(() => mock[slot] = refs[slotMetadata.ref]);
- } else {
- mock[slot] = this._generateMock(slotMetadata, callbacks, refs);
- }
- });
-
- if (
- metadata.type !== 'undefined' &&
- metadata.type !== 'null' &&
- mock.prototype)
- {
- mock.prototype.constructor = mock;
- }
-
- return mock;
- }
-
- /**
- * @see README.md
- * @param metadata Metadata for the mock in the schema returned by the
- * getMetadata method of this module.
- */
- generateFromMetadata(_metadata) {
- const callbacks = [];
- const refs = {};
- const mock = this._generateMock(_metadata, callbacks, refs);
- callbacks.forEach(setter => setter());
- return mock;
- }
-
- /**
- * @see README.md
- * @param component The component for which to retrieve metadata.
- */
- getMetadata(
- component,
- _refs)
- {
- const refs = _refs || new Map();
- const ref = refs.get(component);
- if (ref != null) {
- return { ref };
- }
-
- const type = getType(component);
- if (!type) {
- return null;
- }
-
- const metadata = { type };
- if (
- type === 'constant' ||
- type === 'collection' ||
- type === 'undefined' ||
- type === 'null')
- {
- metadata.value = component;
- return metadata;
- } else if (type === 'function') {
- metadata.name = component.name;
- if (component._isMockFunction) {
- metadata.mockImpl = component.getMockImplementation();
- }
- }
-
- metadata.refID = refs.size;
- refs.set(component, metadata.refID);
-
- let members = null;
- // Leave arrays alone
- if (type !== 'array') {
- if (type !== 'undefined') {
- getSlots(component).forEach(slot => {
- if (
- type === 'function' &&
- component._isMockFunction &&
- slot.match(/^mock/))
- {
- return;
- }
-
- if (
- !component.hasOwnProperty && component[slot] !== undefined ||
- component.hasOwnProperty && component.hasOwnProperty(slot) ||
- type === 'object' && component[slot] != Object.prototype[slot])
- {
- const slotMetadata = this.getMetadata(component[slot], refs);
- if (slotMetadata) {
- if (!members) {
- members = {};
- }
- members[slot] = slotMetadata;
- }
- }
- });
- }
-
- // If component is native code function, prototype might be undefined
- if (type === 'function' && component.prototype) {
- const prototype = this.getMetadata(component.prototype, refs);
- if (prototype && prototype.members) {
- if (!members) {
- members = {};
- }
- members.prototype = prototype;
- }
- }
- }
-
- if (members) {
- metadata.members = members;
- }
-
- return metadata;
- }
-
- isMockFunction(fn) {
- return !!fn._isMockFunction;
- }
-
- /**
- * @see README.md
- */
- getMockFunction() {
- return this._makeComponent({ type: 'function' });
- }
-
- // Just a short-hand alias
- getMockFn() {
- return this.getMockFunction();
- }
-
- resetAllMocks() {
- this._mockRegistry = new WeakMap();
- }}
-
-
-module.exports = ModuleMocker;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-mock/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-mock/package.json
deleted file mode 100644
index e8bdcc0e1..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-mock/package.json
+++ /dev/null
@@ -1,92 +0,0 @@
-{
- "_args": [
- [
- "jest-mock@^17.0.2",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli"
- ]
- ],
- "_from": "jest-mock@>=17.0.2 <18.0.0",
- "_id": "jest-mock@17.0.2",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-mock",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-12-west.internal.npmjs.com",
- "tmp": "tmp/jest-mock-17.0.2.tgz_1479170365845_0.35245098802261055"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-mock",
- "raw": "jest-mock@^17.0.2",
- "rawSpec": "^17.0.2",
- "scope": null,
- "spec": ">=17.0.2 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-config",
- "/jest-environment-jsdom",
- "/jest-environment-node",
- "/jest-runtime",
- "/jest-util",
- "/jest/jest-cli"
- ],
- "_resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-17.0.2.tgz",
- "_shasum": "3dfe9221afd9aa61b3d9992840813a358bb2f429",
- "_shrinkwrap": null,
- "_spec": "jest-mock@^17.0.2",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {},
- "description": "## API",
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "3dfe9221afd9aa61b3d9992840813a358bb2f429",
- "tarball": "https://registry.npmjs.org/jest-mock/-/jest-mock-17.0.2.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- },
- {
- "email": "kentaromiura@gmail.com",
- "name": "kentaromiura"
- }
- ],
- "name": "jest-mock",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.2"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-resolve-dependencies/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-resolve-dependencies/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-resolve-dependencies/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-resolve-dependencies/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-resolve-dependencies/build/index.js
deleted file mode 100644
index 387a0c3f8..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-resolve-dependencies/build/index.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-
-
-const fileExists = require('jest-file-exists');
-
-function compact(array) {
- const result = [];
- for (let i = 0; i < array.length; ++i) {
- const element = array[i];
- if (element != null) {
- result.push(element);
- }
- }
- return result;
-}
-
-/**
- * DependencyResolver is used to resolve the direct dependencies of a module or
- * to retrieve a list of all transitive inverse dependencies.
- */
-class DependencyResolver {
-
-
-
- constructor(resolver, hasteFS) {
- this._resolver = resolver;
- this._hasteFS = hasteFS;
- }
-
- resolve(
- file,
- options)
- {
- const dependencies = this._hasteFS.getDependencies(file);
- if (!dependencies) {
- return [];
- }
- return compact(
- dependencies.map(dependency => {
- if (this._resolver.isCoreModule(dependency)) {
- return null;
- }
- try {
- return this._resolver.resolveModule(file, dependency, options);
- } catch (e) {}
- return this._resolver.getMockModule(file, dependency) || null;
- }));
-
- }
-
- resolveInverse(
- paths,
- filter,
- options)
- {
- const collectModules = (relatedPaths, moduleMap, changed) => {
- const visitedModules = new Set();
- while (changed.size) {
- changed = new Set(moduleMap.filter(module =>
- !visitedModules.has(module.file) &&
- module.dependencies.some(dep => dep && changed.has(dep))).
- map(module => {
- const file = module.file;
- if (filter(file)) {
- relatedPaths.add(file);
- }
- visitedModules.add(file);
- return module.file;
- }));
- }
- return relatedPaths;
- };
-
- if (!paths.size) {
- return [];
- }
-
- const relatedPaths = new Set();
- const changed = new Set();
- for (const path of paths) {
- if (fileExists(path, this._hasteFS)) {
- const module = this._hasteFS.exists(path);
- if (module) {
- changed.add(path);
- if (filter(path)) {
- relatedPaths.add(path);
- }
- }
- }
- }
-
- const modules = this._hasteFS.getAllFiles().map(file => ({
- dependencies: this.resolve(file, options),
- file }));
-
- return Array.from(collectModules(relatedPaths, modules, changed));
- }}
-
-
-
-module.exports = DependencyResolver;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-resolve-dependencies/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-resolve-dependencies/package.json
deleted file mode 100644
index 447bdbe3b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-resolve-dependencies/package.json
+++ /dev/null
@@ -1,85 +0,0 @@
-{
- "_args": [
- [
- "jest-resolve-dependencies@^17.0.3",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli"
- ]
- ],
- "_from": "jest-resolve-dependencies@>=17.0.3 <18.0.0",
- "_id": "jest-resolve-dependencies@17.0.3",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-resolve-dependencies",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-18-east.internal.npmjs.com",
- "tmp": "tmp/jest-resolve-dependencies-17.0.3.tgz_1479368480953_0.335009400267154"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-resolve-dependencies",
- "raw": "jest-resolve-dependencies@^17.0.3",
- "rawSpec": "^17.0.3",
- "scope": null,
- "spec": ">=17.0.3 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest/jest-cli"
- ],
- "_resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-17.0.3.tgz",
- "_shasum": "bbd37f4643704b97a980927212f3ab12b06e8894",
- "_shrinkwrap": null,
- "_spec": "jest-resolve-dependencies@^17.0.3",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "jest-file-exists": "^17.0.0",
- "jest-resolve": "^17.0.3"
- },
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "bbd37f4643704b97a980927212f3ab12b06e8894",
- "tarball": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-17.0.3.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- }
- ],
- "name": "jest-resolve-dependencies",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.3"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-resolve/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-resolve/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-resolve/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-resolve/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-resolve/build/index.js
deleted file mode 100644
index 48134f13b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-resolve/build/index.js
+++ /dev/null
@@ -1,246 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-
-const nodeModulesPaths = require('resolve/lib/node-modules-paths');
-const path = require('path');
-const resolve = require('resolve');
-const browserResolve = require('browser-resolve');
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-const NATIVE_PLATFORM = 'native';
-
-const nodePaths =
-process.env.NODE_PATH ? process.env.NODE_PATH.split(path.delimiter) : null;
-
-class Resolver {
-
-
-
-
-
- constructor(moduleMap, options) {
- this._options = {
- browser: options.browser,
- defaultPlatform: options.defaultPlatform,
- extensions: options.extensions,
- hasCoreModules:
- options.hasCoreModules === undefined ? true : options.hasCoreModules,
- moduleDirectories: options.moduleDirectories || ['node_modules'],
- moduleNameMapper: options.moduleNameMapper,
- modulePaths: options.modulePaths,
- platforms: options.platforms };
-
- this._moduleMap = moduleMap;
- this._moduleNameCache = Object.create(null);
- this._modulePathCache = Object.create(null);
- }
-
- static findNodeModule(path, options) {
- const paths = options.paths;
- try {
- const resv = options.browser ? browserResolve : resolve;
- return resv.sync(
- path,
- {
- basedir: options.basedir,
- extensions: options.extensions,
- moduleDirectory: options.moduleDirectory,
- paths: paths ? (nodePaths || []).concat(paths) : nodePaths });
-
-
- } catch (e) {}
- return null;
- }
-
- resolveModule(
- from,
- moduleName,
- options)
- {
- const dirname = path.dirname(from);
- const paths = this._options.modulePaths;
- const moduleDirectory = this._options.moduleDirectories;
- const key = dirname + path.delimiter + moduleName;
- const defaultPlatform = this._options.defaultPlatform;
- const extensions = this._options.extensions.slice();
- if (this._supportsNativePlatform()) {
- extensions.unshift('.' + NATIVE_PLATFORM + '.js');
- }
- if (defaultPlatform) {
- extensions.unshift('.' + defaultPlatform + '.js');
- }
-
- // 0. If we have already resolved this module for this directory name,
- // return a value from the cache.
- if (this._moduleNameCache[key]) {
- return this._moduleNameCache[key];
- }
-
- // 1. Check if the module is a haste module.
- let module = this.getModule(moduleName);
- if (module) {
- return this._moduleNameCache[key] = module;
- }
-
- // 2. Check if the module is a node module and resolve it based on
- // the node module resolution algorithm.
- if (!options || !options.skipNodeResolution) {
- module = Resolver.findNodeModule(moduleName, {
- basedir: dirname,
- browser: this._options.browser,
- extensions,
- moduleDirectory,
- paths });
-
-
- if (module) {
- return this._moduleNameCache[key] = module;
- }
- }
-
- // 3. Resolve "haste packages" which are `package.json` files outside of
- // `node_modules` folders anywhere in the file system.
- const parts = moduleName.split('/');
- module = this.getPackage(parts.shift());
- if (module) {
- try {
- return this._moduleNameCache[key] = require.resolve(
- path.join.apply(path, [path.dirname(module)].concat(parts)));
-
- } catch (ignoredError) {}
- }
-
- // 4. Throw an error if the module could not be found. `resolve.sync`
- // only produces an error based on the dirname but we have the actual
- // current module name available.
- const relativePath = path.relative(dirname, from);
- const err = new Error(
- `Cannot find module '${ moduleName }' from '${ relativePath || '.' }'`);
-
- err.code = 'MODULE_NOT_FOUND';
- throw err;
- }
-
- isCoreModule(moduleName) {
- return this._options.hasCoreModules && resolve.isCore(moduleName);
- }
-
- getModule(name) {
- return this._moduleMap.getModule(
- name,
- this._options.defaultPlatform,
- this._supportsNativePlatform());
-
- }
-
- getPackage(name) {
- return this._moduleMap.getPackage(
- name,
- this._options.defaultPlatform,
- this._supportsNativePlatform());
-
- }
-
- getMockModule(from, name) {
- const mock = this._moduleMap.getMockModule(name);
- if (mock) {
- return mock;
- } else {
- const moduleName = this._resolveStubModuleName(from, name);
- if (moduleName) {
- return this.getModule(moduleName) || moduleName;
- }
- }
- return null;
- }
-
- getModulePaths(from) {
- if (!this._modulePathCache[from]) {
- const moduleDirectory = this._options.moduleDirectories;
- const paths = nodeModulesPaths(from, { moduleDirectory });
- if (paths[paths.length - 1] === undefined) {
- // circumvent node-resolve bug that adds `undefined` as last item.
- paths.pop();
- }
- this._modulePathCache[from] = paths;
- }
- return this._modulePathCache[from];
- }
-
- _resolveStubModuleName(from, moduleName) {
- const dirname = path.dirname(from);
- const paths = this._options.modulePaths;
- const extensions = this._options.extensions;
- const moduleDirectory = this._options.moduleDirectories;
-
- const moduleNameMapper = this._options.moduleNameMapper;
- if (moduleNameMapper) {
- for (const mappedModuleName in moduleNameMapper) {
- const regex = moduleNameMapper[mappedModuleName];
- if (regex.test(moduleName)) {
- const matches = moduleName.match(regex);
- if (!matches) {
- moduleName = mappedModuleName;
- } else {
- moduleName = mappedModuleName.replace(
- /\$([0-9]+)/g,
- (_, index) => matches[parseInt(index, 10)]);
-
- }
- return this.getModule(moduleName) || Resolver.findNodeModule(
- moduleName,
- {
- basedir: dirname,
- browser: this._options.browser,
- extensions,
- moduleDirectory,
- paths });
-
-
- }
- }
- }
- return null;
- }
-
- _supportsNativePlatform() {
- return (this._options.platforms || []).indexOf(NATIVE_PLATFORM) !== -1;
- }}
-
-
-
-module.exports = Resolver;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-resolve/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-resolve/package.json
deleted file mode 100644
index a5f0f1326..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-resolve/package.json
+++ /dev/null
@@ -1,90 +0,0 @@
-{
- "_args": [
- [
- "jest-resolve@^17.0.3",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli"
- ]
- ],
- "_from": "jest-resolve@>=17.0.3 <18.0.0",
- "_id": "jest-resolve@17.0.3",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-resolve",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-12-west.internal.npmjs.com",
- "tmp": "tmp/jest-resolve-17.0.3.tgz_1479368479354_0.9727858838159591"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-resolve",
- "raw": "jest-resolve@^17.0.3",
- "rawSpec": "^17.0.3",
- "scope": null,
- "spec": ">=17.0.3 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-config",
- "/jest-resolve-dependencies",
- "/jest-runtime",
- "/jest/jest-cli"
- ],
- "_resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-17.0.3.tgz",
- "_shasum": "7692a79de2831874375e9d664bc782c29e4da262",
- "_shrinkwrap": null,
- "_spec": "jest-resolve@^17.0.3",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "browser-resolve": "^1.11.2",
- "jest-file-exists": "^17.0.0",
- "jest-haste-map": "^17.0.3",
- "resolve": "^1.1.6"
- },
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "7692a79de2831874375e9d664bc782c29e4da262",
- "tarball": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-17.0.3.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- }
- ],
- "name": "jest-resolve",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.3"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-runtime/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/bin/jest-runtime.js b/fundamentals/bug-challenge-es6/node_modules/jest-runtime/bin/jest-runtime.js
deleted file mode 100755
index 63fe8d954..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/bin/jest-runtime.js
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env node
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
-'use strict';
-
-if (process.env.NODE_ENV == null) {
- process.env.NODE_ENV = 'test';
-}
-
-require('../build/cli').run();
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/cli/args.js b/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/cli/args.js
deleted file mode 100644
index 9b50d6ce5..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/cli/args.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-const usage = 'Usage: $0 [--config=] ';
-
-const options = {
- cache: {
- default: true,
- description:
- 'Whether to use the preprocessor cache. Disable the cache using ' +
- '--no-cache.',
- type: 'boolean' },
-
- config: {
- alias: 'c',
- description: 'The path to a Jest config file.',
- type: 'string' },
-
- debug: {
- description: 'Print debugging info about your jest config.',
- type: 'boolean' },
-
- version: {
- alias: 'v',
- description: 'Print the version and exit',
- type: 'boolean' },
-
- watchman: {
- default: true,
- description:
- 'Whether to use watchman for file crawling. Disable using ' +
- '--no-watchman.',
- type: 'boolean' } };
-
-
-
-module.exports = {
- options,
- usage };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/cli/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/cli/index.js
deleted file mode 100644
index 20e327ab7..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/cli/index.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
-* Copyright (c) 2014, Facebook, Inc. All rights reserved.
-*
-* This source code is licensed under the BSD-style license found in the
-* LICENSE file in the root directory of this source tree. An additional grant
-* of patent rights can be found in the PATENTS file in the same directory.
-*
-*
-*/
-
-'use strict';
-
-const args = require('./args');
-const chalk = require('chalk');
-const os = require('os');
-const path = require('path');
-const yargs = require('yargs');
-
-const Console = require('jest-util').Console;
-const getPackageRoot = require('jest-util').getPackageRoot;
-const warnAboutUnrecognizedOptions = require('jest-util').warnAboutUnrecognizedOptions;
-const readConfig = require('jest-config').readConfig;
-const Runtime = require('../');
-
-const VERSION = require('../../package.json').version;
-
-function run(cliArgv, cliInfo) {
- let argv;
- if (cliArgv) {
- argv = cliArgv;
- } else {
- argv = yargs.
- usage(args.usage).
- options(args.options).
- argv;
-
- warnAboutUnrecognizedOptions(argv, args.options);
- }
-
- if (argv.help) {
- yargs.showHelp();
- process.on('exit', () => process.exit(1));
- return;
- }
-
- if (argv.version) {
- console.log(`v${ VERSION }\n`);
- return;
- }
-
- if (!argv._.length) {
- console.log('Please provide a path to a script. (See --help for details)');
- process.on('exit', () => process.exit(1));
- return;
- }
-
- const root = getPackageRoot();
- const testFilePath = path.resolve(process.cwd(), argv._[0]);
-
- if (argv.debug) {
- const info = cliInfo ? ', ' + cliInfo.join(', ') : '';
- console.log(`Using Jest Runtime v${ VERSION }${ info }`);
- }
- readConfig(argv, root).
- then(config => {
- // Always disable automocking in scripts.
- config = Object.assign({}, config, {
- automock: false,
- unmockedModulePathPatterns: null });
-
- Runtime.createHasteContext(config, {
- maxWorkers: os.cpus().length - 1 }).
-
- then(hasteMap => {
- /* $FlowFixMe */
- const TestEnvironment = require(config.testEnvironment);
-
- const env = new TestEnvironment(config);
- env.global.console = new Console(process.stdout, process.stderr);
- env.global.jestConfig = config;
-
- const runtime = new Runtime(config, env, hasteMap.resolver);
- runtime.requireModule(testFilePath);
- }).
- catch(e => {
- console.error(chalk.red(e));
- process.on('exit', () => process.exit(1));
- });
- });
-}
-
-exports.run = run;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/index.js
deleted file mode 100644
index e59f75934..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/index.js
+++ /dev/null
@@ -1,776 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();
-
-
-
-
-
-
-
-
-
-const HasteMap = require('jest-haste-map');
-const Resolver = require('jest-resolve');
-
-const fs = require('graceful-fs');
-const path = require('path');
-const shouldInstrument = require('./shouldInstrument');
-const transform = require('./transform');var _require =
-
-
-
-require('jest-util');const createDirectory = _require.createDirectory,replacePathSepForRegex = _require.replacePathSepForRegex;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-const NODE_MODULES = path.sep + 'node_modules' + path.sep;
-const SNAPSHOT_EXTENSION = 'snap';
-
-const getModuleNameMapper = config => {
- if (config.moduleNameMapper.length) {
- const moduleNameMapper = Object.create(null);
- config.moduleNameMapper.forEach(
- map => moduleNameMapper[map[1]] = new RegExp(map[0]));
-
- return moduleNameMapper;
- }
- return null;
-};
-
-const mockParentModule = {
- exports: {},
- filename: 'mock.js',
- id: 'mockParent' };
-
-
-const normalizedIDCache = Object.create(null);
-const unmockRegExpCache = new WeakMap();
-
-
-
-class Runtime {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- constructor(
- config,
- environment,
- resolver)
- {
- this._moduleRegistry = Object.create(null);
- this._internalModuleRegistry = Object.create(null);
- this._mockRegistry = Object.create(null);
- this._config = config;
- this._environment = environment;
- this._resolver = resolver;
- this._moduleMocker = this._environment.moduleMocker;
-
- this._currentlyExecutingModulePath = '';
- this._explicitShouldMock = Object.create(null);
- this._isCurrentlyExecutingManualMock = null;
- this._mockFactories = Object.create(null);
- this._mocksPattern =
- config.mocksPattern ? new RegExp(config.mocksPattern) : null;
- this._shouldAutoMock = config.automock;
- this._testRegex = new RegExp(replacePathSepForRegex(config.testRegex));
- this._virtualMocks = Object.create(null);
-
- this._mockMetaDataCache = Object.create(null);
- this._shouldMockModuleCache = Object.create(null);
- this._shouldUnmockTransitiveDependenciesCache = Object.create(null);
- this._transitiveShouldMock = Object.create(null);
-
- this._unmockList = unmockRegExpCache.get(config);
- if (
- !this._unmockList &&
- config.automock &&
- config.unmockedModulePathPatterns)
- {
- this._unmockList =
- new RegExp(config.unmockedModulePathPatterns.join('|'));
- unmockRegExpCache.set(config, this._unmockList);
- }
-
- if (config.automock) {
- config.setupFiles.forEach(filePath => {
- if (filePath && filePath.includes(NODE_MODULES)) {
- const moduleID = this._normalizeID(filePath);
- this._transitiveShouldMock[moduleID] = false;
- }
- });
- }
-
- this.resetModules();
-
- if (config.setupFiles.length) {
- for (let i = 0; i < config.setupFiles.length; i++) {
- this.requireModule(config.setupFiles[i]);
- }
- }
- }
-
- static shouldInstrument(filename, config) {
- return shouldInstrument(filename, config);
- }
-
- static transformSource(
- filename,
- config,
- content,
- instrument)
- {
- return transform.transformSource(filename, config, content, instrument);
- }
-
- static createHasteContext(
- config,
- options)
-
-
-
- {
- createDirectory(config.cacheDirectory);
- const instance = Runtime.createHasteMap(config, {
- console: options.console,
- maxWorkers: options.maxWorkers,
- resetCache: !config.cache });
-
- return instance.build().then(
- hasteMap => ({
- hasteFS: hasteMap.hasteFS,
- resolver: Runtime.createResolver(config, hasteMap.moduleMap) }),
-
- error => {
- throw error;
- });
-
- }
-
- static createHasteMap(
- config,
- options)
- {
- const ignorePattern = new RegExp(
- [config.cacheDirectory].concat(config.modulePathIgnorePatterns).join('|'));
-
-
- return new HasteMap({
- cacheDirectory: config.cacheDirectory,
- console: options && options.console,
- extensions: [SNAPSHOT_EXTENSION].concat(config.moduleFileExtensions),
- ignorePattern,
- maxWorkers: options && options.maxWorkers || 1,
- mocksPattern: config.mocksPattern,
- name: config.name,
- platforms: config.haste.platforms || ['ios', 'android'],
- providesModuleNodeModules: config.haste.providesModuleNodeModules,
- resetCache: options && options.resetCache,
- retainAllFiles: false,
- roots: config.testPathDirs,
- useWatchman: config.watchman });
-
- }
-
- static createResolver(
- config,
- moduleMap)
- {
- return new Resolver(moduleMap, {
- browser: config.browser,
- defaultPlatform: config.haste.defaultPlatform,
- extensions: config.moduleFileExtensions.map(extension => '.' + extension),
- hasCoreModules: true,
- moduleDirectories: config.moduleDirectories,
- moduleNameMapper: getModuleNameMapper(config),
- modulePaths: config.modulePaths,
- platforms: config.haste.platforms });
-
- }
-
- static runCLI(args, info) {
- return require('./cli').run(args, info);
- }
-
- static getCLIOptions() {
- return require('./cli/args').options;
- }
-
- requireModule(
- from,
- moduleName,
- options)
- {
- const moduleID = this._normalizeID(from, moduleName);
- let modulePath;
-
- const moduleRegistry = !options || !options.isInternalModule ?
- this._moduleRegistry :
- this._internalModuleRegistry;
-
- // Some old tests rely on this mocking behavior. Ideally we'll change this
- // to be more explicit.
- const moduleResource = moduleName && this._resolver.getModule(moduleName);
- const manualMock =
- moduleName && this._resolver.getMockModule(from, moduleName);
- if (
- (!options || !options.isInternalModule) &&
- !moduleResource &&
- manualMock &&
- manualMock !== this._isCurrentlyExecutingManualMock &&
- this._explicitShouldMock[moduleID] !== false)
- {
- modulePath = manualMock;
- }
-
- if (moduleName && this._resolver.isCoreModule(moduleName)) {
- // $FlowFixMe
- return require(moduleName);
- }
-
- if (!modulePath) {
- modulePath = this._resolveModule(from, moduleName);
- }
-
- if (!moduleRegistry[modulePath]) {
- // We must register the pre-allocated module object first so that any
- // circular dependencies that may arise while evaluating the module can
- // be satisfied.
- const localModule = {
- exports: {},
- filename: modulePath,
- id: modulePath };
-
- moduleRegistry[modulePath] = localModule;
- if (path.extname(modulePath) === '.json') {
- localModule.exports = this._environment.global.JSON.parse(
- fs.readFileSync(modulePath, 'utf8'));
-
- } else if (path.extname(modulePath) === '.node') {
- // $FlowFixMe
- localModule.exports = require(modulePath);
- } else {
- this._execModule(localModule, options);
- }
- }
- return moduleRegistry[modulePath].exports;
- }
-
- requireInternalModule(from, to) {
- return this.requireModule(from, to, { isInternalModule: true });
- }
-
- requireMock(from, moduleName) {
- const moduleID = this._normalizeID(from, moduleName);
-
- if (this._mockRegistry[moduleID]) {
- return this._mockRegistry[moduleID];
- }
-
- if (moduleID in this._mockFactories) {
- return this._mockRegistry[moduleID] = this._mockFactories[moduleID]();
- }
-
- let manualMock = this._resolver.getMockModule(from, moduleName);
- let modulePath;
- if (manualMock) {
- modulePath = this._resolveModule(from, manualMock);
- } else {
- modulePath = this._resolveModule(from, moduleName);
-
- // If the actual module file has a __mocks__ dir sitting immediately next
- // to it, look to see if there is a manual mock for this file.
- //
- // subDir1/MyModule.js
- // subDir1/__mocks__/MyModule.js
- // subDir2/MyModule.js
- // subDir2/__mocks__/MyModule.js
- //
- // Where some other module does a relative require into each of the
- // respective subDir{1,2} directories and expects a manual mock
- // corresponding to that particular MyModule.js file.
- const moduleDir = path.dirname(modulePath);
- const moduleFileName = path.basename(modulePath);
- const potentialManualMock =
- path.join(moduleDir, '__mocks__', moduleFileName);
- if (fs.existsSync(potentialManualMock)) {
- manualMock = true;
- modulePath = potentialManualMock;
- }
- }
-
- if (manualMock) {
- const localModule = {
- exports: {},
- filename: modulePath,
- id: modulePath };
-
- this._execModule(localModule);
- this._mockRegistry[moduleID] = localModule.exports;
- } else {
- // Look for a real module to generate an automock from
- this._mockRegistry[moduleID] = this._generateMock(from, moduleName);
- }
-
- return this._mockRegistry[moduleID];
- }
-
- requireModuleOrMock(from, moduleName) {
- if (this._shouldMock(from, moduleName)) {
- return this.requireMock(from, moduleName);
- } else {
- return this.requireModule(from, moduleName);
- }
- }
-
- resetModules() {
- this._mockRegistry = Object.create(null);
- this._moduleRegistry = Object.create(null);
-
- if (this._environment && this._environment.global) {
- const envGlobal = this._environment.global;
- Object.keys(envGlobal).forEach(key => {
- const globalMock = envGlobal[key];
- if (
- typeof globalMock === 'object' && globalMock !== null ||
- typeof globalMock === 'function')
- {
- globalMock._isMockFunction && globalMock.mockClear();
- }
- });
-
- if (envGlobal.mockClearTimers) {
- envGlobal.mockClearTimers();
- }
- }
- }
-
- getAllCoverageInfo() {
- return this._environment.global.__coverage__;
- }
-
- setMock(
- from,
- moduleName,
- mockFactory,
- options)
- {
- if (options && options.virtual) {
- const mockPath = this._getVirtualMockPath(from, moduleName);
- this._virtualMocks[mockPath] = true;
- }
- const moduleID = this._normalizeID(from, moduleName);
- this._explicitShouldMock[moduleID] = true;
- this._mockFactories[moduleID] = mockFactory;
- }
-
- resetAllMocks() {
- this._moduleMocker.resetAllMocks();
- }
-
- _resolveModule(from, to) {
- return to ? this._resolver.resolveModule(from, to) : from;
- }
-
- _execModule(localModule, options) {
- // If the environment was disposed, prevent this module from being executed.
- if (!this._environment.global) {
- return;
- }
-
- const isInternalModule = !!(options && options.isInternalModule);
- const filename = localModule.filename;
- const lastExecutingModulePath = this._currentlyExecutingModulePath;
- this._currentlyExecutingModulePath = filename;
- const origCurrExecutingManualMock = this._isCurrentlyExecutingManualMock;
- this._isCurrentlyExecutingManualMock = filename;
-
- const dirname = path.dirname(filename);
- localModule.children = [];
- localModule.parent = mockParentModule;
- localModule.paths = this._resolver.getModulePaths(dirname);
- localModule.require = this._createRequireImplementation(filename, options);
-
- const script = transform(filename, this._config, { isInternalModule });
-
- const wrapper = this._runScript(script, filename);
- wrapper.call(
- localModule.exports, // module context
- localModule, // module object
- localModule.exports, // module exports
- localModule.require, // require implementation
- dirname, // __dirname
- filename, // __filename
- this._environment.global, // global object
- this._createRuntimeFor(filename));
-
-
- this._isCurrentlyExecutingManualMock = origCurrExecutingManualMock;
- this._currentlyExecutingModulePath = lastExecutingModulePath;
- }
-
- _runScript(script, filename) {
- try {
- return this._environment.runScript(script)[
- transform.EVAL_RESULT_VARIABLE];
-
- } catch (e) {
- const config = this._config;
- const relative = filePath => path.relative(config.rootDir, filePath);
- if (e.constructor.name === 'SyntaxError') {
- const maybePreprocessor = config.transform &&
- config.transform.length &&
- config.transform.find(
- (_ref) => {var _ref2 = _slicedToArray(_ref, 2);let regex = _ref2[0],_ = _ref2[1];return new RegExp(regex).test(filename);});
-
- const preprocessorInfo = maybePreprocessor ?
- `Preprocessor for ${ maybePreprocessor[0] }: ` +
- `${ relative(maybePreprocessor[1]) }` :
- `No preprocessor specified, consider installing 'babel-jest'`;
- const babelInfo = config.usesBabelJest ?
- `Make sure your '.babelrc' is set up correctly, ` +
- `for example it should include the 'es2015' preset.\n` :
- '';
- /* eslint-disable max-len */
- throw new SyntaxError(
- `${ e.message } in file '${ relative(filename) }'.\n\n` +
- `Make sure your transform config is set up correctly and ensure ` +
- `your 'transformIgnorePatterns' configuration is correct: http://facebook.github.io/jest/docs/configuration.html#transformignorepatterns-array-string\n` +
- 'If you are currently setting up Jest or modifying your transform config, try `jest --no-cache`.\n' +
- `${ preprocessorInfo }.\n${ babelInfo }`);
-
- /* eslint-enable max-len */
- }
- throw e;
- }
- }
-
- _generateMock(from, moduleName) {
- const modulePath = this._resolveModule(from, moduleName);
-
- if (!(modulePath in this._mockMetaDataCache)) {
- // This allows us to handle circular dependencies while generating an
- // automock
- this._mockMetaDataCache[modulePath] =
- this._moduleMocker.getMetadata({});
-
- // In order to avoid it being possible for automocking to potentially
- // cause side-effects within the module environment, we need to execute
- // the module in isolation. This could cause issues if the module being
- // mocked has calls into side-effectful APIs on another module.
- const origMockRegistry = this._mockRegistry;
- const origModuleRegistry = this._moduleRegistry;
- this._mockRegistry = Object.create(null);
- this._moduleRegistry = Object.create(null);
-
- const moduleExports = this.requireModule(from, moduleName);
-
- // Restore the "real" module/mock registries
- this._mockRegistry = origMockRegistry;
- this._moduleRegistry = origModuleRegistry;
-
- const mockMetadata = this._moduleMocker.getMetadata(moduleExports);
- if (mockMetadata == null) {
- throw new Error(
- `Failed to get mock metadata: ${ modulePath }\n\n` +
- `See: http://facebook.github.io/jest/docs/manual-mocks.html#content`);
-
- }
- this._mockMetaDataCache[modulePath] = mockMetadata;
- }
- return this._moduleMocker.generateFromMetadata(
- this._mockMetaDataCache[modulePath]);
-
- }
-
- _normalizeID(from, moduleName) {
- if (!moduleName) {
- moduleName = '';
- }
-
- const key = from + path.delimiter + moduleName;
- if (normalizedIDCache[key]) {
- return normalizedIDCache[key];
- }
-
- let moduleType;
- let mockPath = null;
- let absolutePath = null;
-
- if (this._resolver.isCoreModule(moduleName)) {
- moduleType = 'node';
- absolutePath = moduleName;
- } else {
- moduleType = 'user';
- if (
- !this._resolver.getModule(moduleName) &&
- !this._resolver.getMockModule(from, moduleName))
- {
- if (moduleName) {
- const virtualMockPath = this._getVirtualMockPath(from, moduleName);
- if (virtualMockPath in this._virtualMocks) {
- absolutePath = virtualMockPath;
- }
- }
-
- if (absolutePath === null) {
- absolutePath = this._resolveModule(from, moduleName);
- }
- }
-
- if (absolutePath === null) {
- const moduleResource = this._resolver.getModule(moduleName);
- if (moduleResource) {
- absolutePath = moduleResource;
- }
- }
-
- if (mockPath === null) {
- const mockResource = this._resolver.getMockModule(from, moduleName);
- if (mockResource) {
- mockPath = mockResource;
- }
- }
- }
-
- const sep = path.delimiter;
- const id = moduleType + sep + (absolutePath || '') + sep + (mockPath || '');
- return normalizedIDCache[key] = id;
- }
-
- _getVirtualMockPath(from, moduleName) {
- if (moduleName[0] !== '.' && moduleName[0] !== '/') {
- return moduleName;
- }
- return path.normalize(path.dirname(from) + '/' + moduleName);
- }
-
- _shouldMock(from, moduleName) {
- const mockPath = this._getVirtualMockPath(from, moduleName);
- if (mockPath in this._virtualMocks) {
- return true;
- }
-
- const explicitShouldMock = this._explicitShouldMock;
- const moduleID = this._normalizeID(from, moduleName);
- const key = from + path.delimiter + moduleID;
-
- if (moduleID in explicitShouldMock) {
- return explicitShouldMock[moduleID];
- }
-
- if (
- !this._shouldAutoMock ||
- this._resolver.isCoreModule(moduleName) ||
- this._shouldUnmockTransitiveDependenciesCache[key])
- {
- return false;
- }
-
- if (moduleID in this._shouldMockModuleCache) {
- return this._shouldMockModuleCache[moduleID];
- }
-
- const manualMock = this._resolver.getMockModule(from, moduleName);
- let modulePath;
- try {
- modulePath = this._resolveModule(from, moduleName);
- } catch (e) {
- if (manualMock) {
- this._shouldMockModuleCache[moduleID] = true;
- return true;
- }
- throw e;
- }
-
- if (this._unmockList && this._unmockList.test(modulePath)) {
- this._shouldMockModuleCache[moduleID] = false;
- return false;
- }
-
- // transitive unmocking for package managers that store flat packages (npm3)
- const currentModuleID = this._normalizeID(from);
- if (
- this._transitiveShouldMock[currentModuleID] === false ||
- from.includes(NODE_MODULES) &&
- modulePath.includes(NODE_MODULES) && (
-
- this._unmockList && this._unmockList.test(from) ||
- explicitShouldMock[currentModuleID] === false))
-
-
- {
- this._transitiveShouldMock[moduleID] = false;
- this._shouldUnmockTransitiveDependenciesCache[key] = true;
- return false;
- }
-
- return this._shouldMockModuleCache[moduleID] = true;
- }
-
- _createRequireImplementation(
- from,
- options)
- {
- const moduleRequire = options && options.isInternalModule ?
- moduleName => this.requireInternalModule(from, moduleName) :
- this.requireModuleOrMock.bind(this, from);
- moduleRequire.cache = Object.create(null);
- moduleRequire.extensions = Object.create(null);
- moduleRequire.requireActual = this.requireModule.bind(this, from);
- moduleRequire.requireMock = this.requireMock.bind(this, from);
- moduleRequire.resolve = moduleName => this._resolveModule(from, moduleName);
- return moduleRequire;
- }
-
- _createRuntimeFor(from) {
- const disableAutomock = () => {
- this._shouldAutoMock = false;
- return runtime;
- };
- const enableAutomock = () => {
- this._shouldAutoMock = true;
- return runtime;
- };
- const unmock = moduleName => {
- const moduleID = this._normalizeID(from, moduleName);
- this._explicitShouldMock[moduleID] = false;
- return runtime;
- };
- const deepUnmock = moduleName => {
- const moduleID = this._normalizeID(from, moduleName);
- this._explicitShouldMock[moduleID] = false;
- this._transitiveShouldMock[moduleID] = false;
- return runtime;
- };
- const mock = (
- moduleName,
- mockFactory,
- options) =>
- {
- if (mockFactory !== undefined) {
- return setMockFactory(moduleName, mockFactory, options);
- }
-
- const moduleID = this._normalizeID(from, moduleName);
- this._explicitShouldMock[moduleID] = true;
- return runtime;
- };
- const setMockFactory = (moduleName, mockFactory, options) => {
- this.setMock(from, moduleName, mockFactory, options);
- return runtime;
- };
- const resetAllMocks = () => {
- this.resetAllMocks();
- return runtime;
- };
- const useFakeTimers = () => {
- this._environment.fakeTimers.useFakeTimers();
- return runtime;
- };
- const useRealTimers = () => {
- this._environment.fakeTimers.useRealTimers();
- return runtime;
- };
- const resetModules = () => {
- this.resetModules();
- return runtime;
- };
-
- const runtime = {
- addMatchers:
- matchers =>
- this._environment.global.jasmine.addMatchers(matchers),
-
- autoMockOff: disableAutomock,
- autoMockOn: enableAutomock,
- clearAllTimers: () => this._environment.fakeTimers.clearAllTimers(),
- deepUnmock,
- disableAutomock,
- doMock: mock,
- dontMock: unmock,
- enableAutomock,
- fn: impl => {
- const fn = this._moduleMocker.getMockFunction();
- if (impl) {
- return fn.mockImplementation(impl);
- }
- return fn;
- },
- genMockFn: this._moduleMocker.getMockFunction.bind(this._moduleMocker),
- genMockFromModule:
- moduleName => this._generateMock(from, moduleName),
- genMockFunction:
- this._moduleMocker.getMockFunction.bind(this._moduleMocker),
- isMockFunction: this._moduleMocker.isMockFunction,
-
- mock,
- resetAllMocks,
- resetModuleRegistry: resetModules,
- resetModules,
-
- runAllImmediates: () => this._environment.fakeTimers.runAllImmediates(),
- runAllTicks: () => this._environment.fakeTimers.runAllTicks(),
- runAllTimers: () => this._environment.fakeTimers.runAllTimers(),
- runOnlyPendingTimers: () =>
- this._environment.fakeTimers.runOnlyPendingTimers(),
- runTimersToTime: msToRun =>
- this._environment.fakeTimers.runTimersToTime(msToRun),
-
- setMock: (moduleName, mock) =>
- setMockFactory(moduleName, () => mock),
-
- unmock,
-
- useFakeTimers,
- useRealTimers };
-
- return runtime;
- }}
-
-
-module.exports = Runtime;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/shouldInstrument.js b/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/shouldInstrument.js
deleted file mode 100644
index c9bb5bb6a..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/shouldInstrument.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-const multimatch = require('multimatch');
-const path = require('path');
-
-const shouldInstrument = (filename, config) => {
- if (!config.collectCoverage) {
- return false;
- }
-
- if (config.testRegex && filename.match(config.testRegex)) {
- return false;
- }
-
- if (
- // This configuration field contains an object in the form of:
- // {'path/to/file.js': true}
- config.collectCoverageOnlyFrom &&
- !config.collectCoverageOnlyFrom[filename])
- {
- return false;
- }
-
- if (
- !config.collectCoverageOnlyFrom && // still cover if `only` is specified
- config.collectCoverageFrom &&
- !multimatch(
- [path.relative(config.rootDir, filename)],
- config.collectCoverageFrom).
- length)
- {
- return false;
- }
-
-
- if (
- config.coveragePathIgnorePatterns &&
- config.coveragePathIgnorePatterns.some(pattern => filename.match(pattern)))
- {
- return false;
- }
-
- if (config.mocksPattern && filename.match(config.mocksPattern)) {
- return false;
- }
-
- return true;
-};
-
-
-module.exports = shouldInstrument;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/transform.js b/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/transform.js
deleted file mode 100644
index 5ddc65086..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/build/transform.js
+++ /dev/null
@@ -1,337 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-const createDirectory = require('jest-util').createDirectory;
-const crypto = require('crypto');
-const fileExists = require('jest-file-exists');
-const fs = require('graceful-fs');
-const getCacheFilePath = require('jest-haste-map').getCacheFilePath;
-const path = require('path');
-const shouldInstrument = require('./shouldInstrument');
-const stableStringify = require('json-stable-stringify');
-const vm = require('vm');
-
-const VERSION = require('../package.json').version;
-
-
-
-
-
-const EVAL_RESULT_VARIABLE = 'Object.';
-
-const cache = new Map();
-const configToJsonMap = new Map();
-// Cache regular expressions to test whether the file needs to be preprocessed
-const ignoreCache = new WeakMap();
-
-const removeFile = path => {
- try {
- fs.unlinkSync(path);
- } catch (e) {}
-};
-
-const getCacheKey = (
-fileData,
-filename,
-config,
-instrument) =>
-{
- if (!configToJsonMap.has(config)) {
- // We only need this set of config options that can likely influence
- // cached output instead of all config options.
- configToJsonMap.set(config, stableStringify({
- cacheDirectory: config.cacheDirectory,
- collectCoverage: config.collectCoverage,
- collectCoverageFrom: config.collectCoverageFrom,
- collectCoverageOnlyFrom: config.collectCoverageOnlyFrom,
- coveragePathIgnorePatterns: config.coveragePathIgnorePatterns,
- haste: config.haste,
- mocksPattern: config.mocksPattern,
- moduleFileExtensions: config.moduleFileExtensions,
- moduleNameMapper: config.moduleNameMapper,
- rootDir: config.rootDir,
- testPathDirs: config.testPathDirs,
- testRegex: config.testRegex,
- transformIgnorePatterns: config.transformIgnorePatterns }));
-
- }
- const configString = configToJsonMap.get(config) || '';
- const transformer = getTransformer(filename, config);
-
- if (transformer && typeof transformer.getCacheKey === 'function') {
- return transformer.getCacheKey(
- fileData,
- filename,
- configString,
- {
- instrument,
- watch: config.watch });
-
-
- } else {
- return crypto.createHash('md5').
- update(fileData).
- update(configString).
- update(instrument ? 'instrument' : '').
- digest('hex');
- }
-};
-
-const writeCacheFile = (cachePath, fileData) => {
- try {
- fs.writeFileSync(cachePath, fileData, 'utf8');
- } catch (e) {
- e.message = 'jest: failed to cache transform results in: ' + cachePath;
- removeFile(cachePath);
- throw e;
- }
-};
-
-const wrap = content =>
-'({"' + EVAL_RESULT_VARIABLE +
-'":function(module,exports,require,__dirname,__filename,global,jest){' +
-content +
-'\n}});';
-
-const readCacheFile = (filename, cachePath) => {
- if (!fileExists(cachePath)) {
- return null;
- }
-
- let fileData;
- try {
- fileData = fs.readFileSync(cachePath, 'utf8');
- } catch (e) {
- e.message = 'jest: failed to read cache file: ' + cachePath;
- removeFile(cachePath);
- throw e;
- }
-
- if (fileData == null) {
- // We must have somehow created the file but failed to write to it,
- // let's delete it and retry.
- removeFile(cachePath);
- }
- return fileData;
-};
-
-const getScriptCacheKey = (filename, config, instrument) => {
- const mtime = fs.statSync(filename).mtime;
- return filename + '_' + mtime.getTime() + (
- instrument ? '_instrumented' : '');
-};
-
-const shouldTransform = (filename, config) => {
- if (!ignoreCache.has(config)) {
- if (!config.transformIgnorePatterns) {
- ignoreCache.set(config, null);
- } else {
- ignoreCache.set(
- config,
- new RegExp(config.transformIgnorePatterns.join('|')));
-
- }
- }
-
- const ignoreRegexp = ignoreCache.get(config);
- const isIgnored = ignoreRegexp ? ignoreRegexp.test(filename) : false;
- return (
- !!config.transform &&
- !!config.transform.length && (
-
- !config.transformIgnorePatterns.length ||
- !isIgnored));
-
-
-};
-
-const getFileCachePath = (
-filename,
-config,
-content,
-instrument) =>
-{
- const baseCacheDir = getCacheFilePath(
- config.cacheDirectory,
- 'jest-transform-cache-' + config.name,
- VERSION);
-
- const cacheKey = getCacheKey(content, filename, config, instrument);
- // Create sub folders based on the cacheKey to avoid creating one
- // directory with many files.
- const cacheDir = path.join(baseCacheDir, cacheKey[0] + cacheKey[1]);
- const cachePath = path.join(
- cacheDir,
- path.basename(filename, path.extname(filename)) + '_' + cacheKey);
-
- createDirectory(cacheDir);
-
- return cachePath;
-};
-
-const transformCache =
-new WeakMap();
-
-const getTransformer = (filename, config) => {
- if (
- transformCache.has(config) &&
- transformCache.get(config).get(filename))
- {
- return transformCache.get(config).get(filename);
- } else {
- let transform;
- if (!config.transform || !config.transform.length) {
- transform = null;
- } else {
- let transformPath = null;
- for (let i = 0; i < config.transform.length; i++) {
- if (new RegExp(config.transform[i][0]).test(filename)) {
- transformPath = config.transform[i][1];
- break;
- }
- }
- if (transformPath) {
- // $FlowFixMe
- transform = require(transformPath);
- if (typeof transform.process !== 'function') {
- throw new TypeError(
- 'Jest: a transform must export a `process` function.');
-
- }
- }
- }
- if (!transformCache.has(config)) {
- transformCache.set(config, new Map());
- }
-
- transformCache.get(config).set(filename, transform);
- return transform;
- }
-};
-
-const stripShebang = content => {
- // If the file data starts with a shebang remove it. Leaves the empty line
- // to keep stack trace line numbers correct.
- if (content.startsWith('#!')) {
- return content.replace(/^#!.*/, '');
- } else {
- return content;
- }
-};
-
-const instrumentFile = (
-content,
-filename,
-config) =>
-{
- // NOTE: Keeping these requires inside this function reduces a single run
- // time by 2sec if not running in `--coverage` mode
- const babel = require('babel-core');
- const babelPluginIstanbul = require('babel-plugin-istanbul').default;
-
- return babel.transform(content, {
- auxiliaryCommentBefore: ' istanbul ignore next ',
- babelrc: false,
- filename,
- plugins: [
- [
- babelPluginIstanbul,
- {
- cwd: config.rootDir, // files outside `cwd` will not be instrumented
- exclude: [] }]],
-
-
-
- retainLines: true }).
- code;
-};
-
-const transformSource = (
-filename,
-config,
-content,
-instrument) =>
-{
- const transform = getTransformer(filename, config);
- const cacheFilePath = getFileCachePath(filename, config, content, instrument);
- // Ignore cache if `config.cache` is set (--no-cache)
- let result = config.cache ? readCacheFile(filename, cacheFilePath) : null;
-
- if (result) {
- return result;
- }
-
- result = content;
-
- if (transform && shouldTransform(filename, config)) {
- result = transform.process(result, filename, config, {
- instrument,
- watch: config.watch });
-
- }
-
- // That means that the transform has a custom instrumentation
- // logic and will handle it based on `config.collectCoverage` option
- const transformWillInstrument = transform && transform.canInstrument;
-
- if (!transformWillInstrument && instrument) {
- result = instrumentFile(result, filename, config);
- }
-
- writeCacheFile(cacheFilePath, result);
- return result;
-};
-
-const transformAndBuildScript = (
-filename,
-config,
-options,
-instrument) =>
-{
- const isInternalModule = !!(options && options.isInternalModule);
- const content = stripShebang(fs.readFileSync(filename, 'utf8'));
- let wrappedResult;
-
- if (
- !isInternalModule && (
- shouldTransform(filename, config) || instrument))
- {
- wrappedResult =
- wrap(transformSource(filename, config, content, instrument));
- } else {
- wrappedResult = wrap(content);
- }
-
- return new vm.Script(wrappedResult, { displayErrors: true, filename });
-};
-
-module.exports = (
-filename,
-config,
-options) =>
-{
- const instrument = shouldInstrument(filename, config);
- const scriptCacheKey = getScriptCacheKey(filename, config, instrument);
- let script = cache.get(scriptCacheKey);
- if (script) {
- return script;
- } else {
- script = transformAndBuildScript(filename, config, options, instrument);
- cache.set(scriptCacheKey, script);
- return script;
- }
-};
-
-module.exports.EVAL_RESULT_VARIABLE = EVAL_RESULT_VARIABLE;
-module.exports.transformSource = transformSource;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-runtime/package.json
deleted file mode 100644
index 3416e990e..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-runtime/package.json
+++ /dev/null
@@ -1,105 +0,0 @@
-{
- "_args": [
- [
- "jest-runtime@^17.0.3",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli"
- ]
- ],
- "_from": "jest-runtime@>=17.0.3 <18.0.0",
- "_id": "jest-runtime@17.0.3",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-runtime",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-18-east.internal.npmjs.com",
- "tmp": "tmp/jest-runtime-17.0.3.tgz_1479368481681_0.14977502590045333"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-runtime",
- "raw": "jest-runtime@^17.0.3",
- "rawSpec": "^17.0.3",
- "scope": null,
- "spec": ">=17.0.3 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest/jest-cli"
- ],
- "_resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-17.0.3.tgz",
- "_shasum": "eff4055fe8c3e17c95ed1aaaf5f719c420b86b1f",
- "_shrinkwrap": null,
- "_spec": "jest-runtime@^17.0.3",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli",
- "bin": {
- "jest-runtime": "./bin/jest-runtime.js"
- },
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "babel-core": "^6.0.0",
- "babel-jest": "^17.0.2",
- "babel-plugin-istanbul": "^2.0.0",
- "chalk": "^1.1.3",
- "graceful-fs": "^4.1.6",
- "jest-config": "^17.0.3",
- "jest-file-exists": "^17.0.0",
- "jest-haste-map": "^17.0.3",
- "jest-mock": "^17.0.2",
- "jest-resolve": "^17.0.3",
- "jest-snapshot": "^17.0.3",
- "jest-util": "^17.0.2",
- "json-stable-stringify": "^1.0.0",
- "multimatch": "^2.1.0",
- "yargs": "^6.3.0"
- },
- "devDependencies": {
- "jest-config": "^17.0.3",
- "jest-environment-jsdom": "^17.0.2",
- "jest-environment-node": "^17.0.2"
- },
- "directories": {},
- "dist": {
- "shasum": "eff4055fe8c3e17c95ed1aaaf5f719c420b86b1f",
- "tarball": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-17.0.3.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- }
- ],
- "name": "jest-runtime",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.3"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/build/State.js b/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/build/State.js
deleted file mode 100644
index d6a59a344..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/build/State.js
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';var _require =
-
-
-
-
-
-
-
-
-
-
-
-require('./utils');const saveSnapshotFile = _require.saveSnapshotFile,getSnapshotData = _require.getSnapshotData,getSnapshotPath = _require.getSnapshotPath,keyToTestName = _require.keyToTestName,serialize = _require.serialize,testNameToKey = _require.testNameToKey,unescape = _require.unescape;
-const fileExists = require('jest-file-exists');
-const fs = require('fs');
-
-class SnapshotState {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- constructor(
- testPath,
- update,
- snapshotPath,
- expand)
- {
- this._dirty = false;
- this._snapshotPath = snapshotPath || getSnapshotPath(testPath);
- this._snapshotData = getSnapshotData(this._snapshotPath);
- this._uncheckedKeys = new Set(Object.keys(this._snapshotData));
- this._counters = new Map();
- this._index = 0;
- this.expand = expand || false;
- this.added = 0;
- this.matched = 0;
- this.unmatched = 0;
- this.update = update;
- this.updated = 0;
- this.skippedTests = new Set();
- this.failedTests = new Set();
- }
-
- markSnapshotsAsCheckedForTest(testName) {
- this._uncheckedKeys.forEach(uncheckedKey => {
- if (keyToTestName(uncheckedKey) === testName) {
- this._uncheckedKeys.delete(uncheckedKey);
- }
- });
- }
-
- _addSnapshot(key, receivedSerialized) {
- this._dirty = true;
- this._snapshotData[key] = receivedSerialized;
- }
-
- save(update) {
- const status = {
- deleted: false,
- saved: false };
-
-
- const isEmpty = Object.keys(this._snapshotData).length === 0;
-
- if ((this._dirty || this._uncheckedKeys.size) && !isEmpty) {
- saveSnapshotFile(this._snapshotData, this._snapshotPath);
- status.saved = true;
- } else if (isEmpty && fileExists(this._snapshotPath)) {
- if (update) {
- fs.unlinkSync(this._snapshotPath);
- }
- status.deleted = true;
- }
-
- return status;
- }
-
- getUncheckedCount() {
- return this._uncheckedKeys.size || 0;
- }
-
- removeUncheckedKeys() {
- if (this._uncheckedKeys.size) {
- this._dirty = true;
- this._uncheckedKeys.forEach(key => delete this._snapshotData[key]);
- this._uncheckedKeys.clear();
- }
- }
-
- match(testName, received, key) {
- this._counters.set(testName, (this._counters.get(testName) || 0) + 1);
- const count = Number(this._counters.get(testName));
-
- if (!key) {
- key = testNameToKey(testName, count);
- }
-
- this._uncheckedKeys.delete(key);
-
- const receivedSerialized = serialize(received);
- const receivedUnescaped = unescape(receivedSerialized);
- const expected = this._snapshotData[key];
- const pass = expected === receivedUnescaped;
- const hasSnapshot = this._snapshotData[key] !== undefined;
-
- if (pass) {
- // Executing a snapshot file as JavaScript and writing the strings back
- // when other snapshots have changed loses the proper escaping for some
- // characters. Since we check every snapshot in every test, use the newly
- // generated formatted string.
- // Note that this is only relevant when a snapshot is added and the dirty
- // flag is set.
- this._snapshotData[key] = receivedSerialized;
- }
-
- if (
- !fileExists(this._snapshotPath) || // there's no snapshot file
- hasSnapshot && this.update || // there is a file, but we're updating
- !hasSnapshot // there is a file, but it doesn't have this snaphsot
- ) {
- if (this.update) {
- if (!pass) {
- if (hasSnapshot) {
- this.updated++;
- } else {
- this.added++;
- }
- this._addSnapshot(key, receivedSerialized);
- } else {
- this.matched++;
- }
- } else {
- this._addSnapshot(key, receivedSerialized);
- this.added++;
- }
-
- return { pass: true };
- } else {
- if (!pass) {
- this.unmatched++;
- return {
- actual: receivedUnescaped,
- count,
- expected,
- pass: false };
-
- } else {
- this.matched++;
- return { pass: true };
- }
- }
- }}
-
-
-module.exports = SnapshotState;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/build/index.js
deleted file mode 100644
index dec1cb2b6..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/build/index.js
+++ /dev/null
@@ -1,156 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-const diff = require('jest-diff');
-const fileExists = require('jest-file-exists');
-const fs = require('fs');
-const path = require('path');
-const SnapshotState = require('./State');var _require =
-require('./plugins');const getPlugins = _require.getPlugins,addPlugins = _require.addPlugins;var _require2 =
-
-
-
-
-
-
-require('jest-matcher-utils');const EXPECTED_COLOR = _require2.EXPECTED_COLOR,ensureNoExpected = _require2.ensureNoExpected,matcherHint = _require2.matcherHint,RECEIVED_COLOR = _require2.RECEIVED_COLOR;var _require3 =
-require('./utils');const SNAPSHOT_EXTENSION = _require3.SNAPSHOT_EXTENSION;
-
-const cleanup = (hasteFS, update) => {
- const pattern = '\\.' + SNAPSHOT_EXTENSION + '$';
- const files = hasteFS.matchFiles(pattern);
- const filesRemoved = files.
- filter(snapshotFile => !fileExists(
- path.resolve(
- path.dirname(snapshotFile),
- '..',
- path.basename(snapshotFile, '.' + SNAPSHOT_EXTENSION)),
-
- hasteFS)).
-
- map(snapshotFile => {
- if (update) {
- fs.unlinkSync(snapshotFile);
- }
- }).
- length;
-
- return {
- filesRemoved };
-
-};
-
-let snapshotState;
-
-const initializeSnapshotState = (
-testFile,
-update,
-testPath,
-expand) =>
-new SnapshotState(testFile, update, testPath, expand);
-
-const getSnapshotState = () => snapshotState;
-
-const toMatchSnapshot = function (received, expected) {
- this.dontThrow();const
-
- currentTestName = this.currentTestName,isNot = this.isNot,snapshotState = this.snapshotState;
-
- if (isNot) {
- throw new Error(
- 'Jest: `.not` cannot be used with `.toMatchSnapshot()`.');
-
- }
-
- ensureNoExpected(expected, '.toMatchSnapshot');
-
- if (!snapshotState) {
- throw new Error('Jest: snapshot state must be initialized.');
- }
-
- const result = snapshotState.match(currentTestName, received);const
- pass = result.pass;
-
- if (pass) {
- return { message: '', pass: true };
- } else {const
- count = result.count,expected = result.expected,actual = result.actual;
-
-
- const expectedString = expected.trim();
- const actualString = actual.trim();
- const diffMessage = diff(
- expectedString,
- actualString,
- {
- aAnnotation: 'Snapshot',
- bAnnotation: 'Received',
- expand: snapshotState.expand });
-
-
-
- const message =
- () => matcherHint('.toMatchSnapshot', 'value', '') + '\n\n' +
- `${ RECEIVED_COLOR('Received value') } does not match ` +
- `${ EXPECTED_COLOR('stored snapshot ' + count) }.\n\n` + (
- diffMessage ||
- RECEIVED_COLOR('- ' + expectedString) + '\n' +
- EXPECTED_COLOR('+ ' + actualString));
-
-
- return { message, pass: false };
- }
-};
-
-const toThrowErrorMatchingSnapshot = function (received, expected) {
- this.dontThrow();const
- isNot = this.isNot;
-
- if (isNot) {
- throw new Error(
- 'Jest: `.not` cannot be used with `.toThrowErrorMatchingSnapshot()`.');
-
- }
-
- ensureNoExpected(expected, '.toThrowErrorMatchingSnapshot');
-
- let error;
-
- try {
- received();
- } catch (e) {
- error = e;
- }
-
- if (error === undefined) {
- throw new Error(
- matcherHint('.toThrowErrorMatchingSnapshot', '() => {}', '') + '\n\n' +
- `Expected the function to throw an error.\n` +
- `But it didn't throw anything.`);
-
- }
-
- return toMatchSnapshot.call(this, error.message);
-};
-
-module.exports = {
- EXTENSION: SNAPSHOT_EXTENSION,
- SnapshotState,
- addPlugins,
- cleanup,
- getPlugins,
- getSnapshotState,
- initializeSnapshotState,
- toMatchSnapshot,
- toThrowErrorMatchingSnapshot };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/build/plugins.js b/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/build/plugins.js
deleted file mode 100644
index 60a83b15c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/build/plugins.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-const ReactElementPlugin = require('pretty-format/plugins/ReactElement');
-const ReactTestComponentPlugin = require('pretty-format/plugins/ReactTestComponent');
-
-let PLUGINS = [ReactElementPlugin, ReactTestComponentPlugin];
-
-exports.addPlugins = (plugins
-// $FlowFixMe
-) => PLUGINS = plugins.map(plugin => require(plugin)).concat(PLUGINS);
-
-exports.getPlugins = () => PLUGINS;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/build/utils.js b/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/build/utils.js
deleted file mode 100644
index ae4d80ce7..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/build/utils.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-const createDirectory = require('jest-util').createDirectory;
-const fileExists = require('jest-file-exists');
-const path = require('path');
-const prettyFormat = require('pretty-format');
-const fs = require('fs');
-const naturalCompare = require('natural-compare');
-const getPlugins = require('./plugins').getPlugins;
-
-const SNAPSHOT_EXTENSION = 'snap';
-
-const testNameToKey = (testName, count) =>
-testName + ' ' + count;
-
-const keyToTestName = key => {
- if (!/ \d+$/.test(key)) {
- throw new Error('Snapshot keys must end with a number.');
- }
-
- return key.replace(/ \d+$/, '');
-};
-
-const getSnapshotPath = testPath => path.join(
-path.join(path.dirname(testPath), '__snapshots__'),
-path.basename(testPath) + '.' + SNAPSHOT_EXTENSION);
-
-
-const getSnapshotData = snapshotPath => {
- const data = Object.create(null);
-
- if (fileExists(snapshotPath)) {
- try {
- delete require.cache[require.resolve(snapshotPath)];
- /* eslint-disable no-useless-call */
- Object.assign(data, require.call(null, snapshotPath));
- /* eslint-enable no-useless-call */
- } catch (e) {}
- }
-
- return data;
-};
-
-// Extra line breaks at the beginning and at the end of the snapshot are useful
-// to make the content of the snapshot easier to read
-const addExtraLineBreaks =
-string => string.includes('\n') ? `\n${ string }\n` : string;
-
-const serialize = data => {
- return addExtraLineBreaks(prettyFormat(data, {
- plugins: getPlugins(),
- printFunctionName: false }));
-
-};
-
-const escape = string => string.replace(/(\`|\${)/g, '\\$1');
-const unescape = string => string.replace(/\\(\"|\\|\'|\${)/g, '$1');
-
-const ensureDirectoryExists = filePath => {
- try {
- createDirectory(path.join(path.dirname(filePath)));
- } catch (e) {}
-};
-
-const normalizeNewlines =
-string => string.replace(/\r\n/g, '\n');
-
-const saveSnapshotFile = (
-snapshotData,
-snapshotPath) =>
-{
- const snapshots = Object.keys(snapshotData).sort(naturalCompare).
- map(key =>
- 'exports[`' + escape(key) + '`] = `' +
- normalizeNewlines(escape(snapshotData[key])) + '`;');
-
-
- ensureDirectoryExists(snapshotPath);
- fs.writeFileSync(snapshotPath, snapshots.join('\n\n') + '\n');
-};
-
-module.exports = {
- SNAPSHOT_EXTENSION,
- ensureDirectoryExists,
- escape,
- getSnapshotData,
- getSnapshotPath,
- keyToTestName,
- saveSnapshotFile,
- serialize,
- testNameToKey,
- unescape };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/package.json
deleted file mode 100644
index 1c2f77e7e..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-snapshot/package.json
+++ /dev/null
@@ -1,95 +0,0 @@
-{
- "_args": [
- [
- "jest-snapshot@^17.0.3",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli"
- ]
- ],
- "_from": "jest-snapshot@>=17.0.3 <18.0.0",
- "_id": "jest-snapshot@17.0.3",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-snapshot",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-12-west.internal.npmjs.com",
- "tmp": "tmp/jest-snapshot-17.0.3.tgz_1479368481398_0.7471310773398727"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-snapshot",
- "raw": "jest-snapshot@^17.0.3",
- "rawSpec": "^17.0.3",
- "scope": null,
- "spec": ">=17.0.3 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-jasmine2",
- "/jest-runtime",
- "/jest/jest-cli"
- ],
- "_resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-17.0.3.tgz",
- "_shasum": "c8199db4ccbd5515cfecc8e800ab076bdda7abc0",
- "_shrinkwrap": null,
- "_spec": "jest-snapshot@^17.0.3",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "jest-diff": "^17.0.3",
- "jest-file-exists": "^17.0.0",
- "jest-matcher-utils": "^17.0.3",
- "jest-util": "^17.0.2",
- "natural-compare": "^1.4.0",
- "pretty-format": "~4.2.1"
- },
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "c8199db4ccbd5515cfecc8e800ab076bdda7abc0",
- "tarball": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-17.0.3.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- },
- {
- "email": "kentaromiura@gmail.com",
- "name": "kentaromiura"
- }
- ],
- "name": "jest-snapshot",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../jest-cli/bin/jest.js"
- },
- "version": "17.0.3"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-util/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest-util/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-util/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/Console.js b/fundamentals/bug-challenge-es6/node_modules/jest-util/build/Console.js
deleted file mode 100644
index 3d1fe9120..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/Console.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-/* global stream$Writable */
-'use strict';
-
-
-
-const Console = require('console').Console;
-
-const clearLine = require('./clearLine');
-const format = require('util').format;
-
-
-
-class CustomConsole extends Console {
-
-
-
-
- constructor(
- stdout,
- stderr,
- formatBuffer)
- {
- super(stdout, stderr);
- this._formatBuffer = formatBuffer || ((type, message) => message);
- }
-
- _log(type, message) {
- clearLine(this._stdout);
- super.log(this._formatBuffer(type, message));
- }
-
- log() {
- this._log('log', format.apply(null, arguments));
- }
-
- info() {
- this._log('info', format.apply(null, arguments));
- }
-
- warn() {
- this._log('warn', format.apply(null, arguments));
- }
-
- error() {
- this._log('error', format.apply(null, arguments));
- }
-
- getBuffer() {
- return null;
- }}
-
-
-module.exports = CustomConsole;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/FakeTimers.js b/fundamentals/bug-challenge-es6/node_modules/jest-util/build/FakeTimers.js
deleted file mode 100644
index eca5fcc57..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/FakeTimers.js
+++ /dev/null
@@ -1,519 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';var _require =
-
-
-
-
-
-require('./messages');const formatStackTrace = _require.formatStackTrace;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-const MS_IN_A_YEAR = 31536000000;
-
-class FakeTimers {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- constructor(
- global,
- moduleMocker,
- config,
- maxLoops)
- {
-
- this._global = global;
- this._config = config;
- this._maxLoops = maxLoops || 100000;
- this._uuidCounter = 1;
-
- this.reset();
-
- // Store original timer APIs for future reference
- this._timerAPIs = {
- clearImmediate: global.clearImmediate,
- clearInterval: global.clearInterval,
- clearTimeout: global.clearTimeout,
- setImmediate: global.setImmediate,
- setInterval: global.setInterval,
- setTimeout: global.setTimeout };
-
-
- const fn = impl => moduleMocker.getMockFn().mockImpl(impl);
-
- this._fakeTimerAPIs = {
- clearImmediate: fn(this._fakeClearImmediate.bind(this)),
- clearInterval: fn(this._fakeClearTimer.bind(this)),
- clearTimeout: fn(this._fakeClearTimer.bind(this)),
- setImmediate: fn(this._fakeSetImmediate.bind(this)),
- setInterval: fn(this._fakeSetInterval.bind(this)),
- setTimeout: fn(this._fakeSetTimeout.bind(this)) };
-
-
- // If there's a process.nextTick on the global, mock it out
- // (only applicable to node/node-emulating environments)
- if (typeof global.process === 'object' &&
- typeof global.process.nextTick === 'function') {
- this._timerAPIs.nextTick = global.process.nextTick;
- this._fakeTimerAPIs.nextTick = fn(this._fakeNextTick.bind(this));
- }
-
- // These globally-accessible function are now deprecated!
- // They will go away very soon, so do not use them!
- // Instead, use the versions available on the `jest` object
- global.mockRunTicksRepeatedly = this.runAllTicks.bind(this);
- global.mockRunTimersOnce = this.runOnlyPendingTimers.bind(this);
- global.mockRunTimersToTime = this.runTimersToTime.bind(this);
- global.mockRunTimersRepeatedly = this.runAllTimers.bind(this);
- global.mockClearTimers = this.clearAllTimers.bind(this);
- global.mockGetTimersCount = () => Object.keys(this._timers).length;
- }
-
- clearAllTimers() {
- this._immediates.forEach(
- immediate => this._fakeClearImmediate(immediate.uuid));
-
- for (const uuid in this._timers) {
- delete this._timers[uuid];
- }
- }
-
- dispose() {
- this._disposed = true;
- this.clearAllTimers();
- }
-
- reset() {
- this._cancelledTicks = {};
- this._cancelledImmediates = {};
- this._now = 0;
- this._ticks = [];
- this._immediates = [];
- this._timers = {};
- }
-
- runAllTicks() {
- this._checkFakeTimers();
- // Only run a generous number of ticks and then bail.
- // This is just to help avoid recursive loops
- let i;
- for (i = 0; i < this._maxLoops; i++) {
- const tick = this._ticks.shift();
-
- if (tick === undefined) {
- break;
- }
-
- if (!this._cancelledTicks.hasOwnProperty(tick.uuid)) {
- // Callback may throw, so update the map prior calling.
- this._cancelledTicks[tick.uuid] = true;
- tick.callback();
- }
- }
-
- if (i === this._maxLoops) {
- throw new Error(
- 'Ran ' + this._maxLoops + ' ticks, and there are still more! ' +
- 'Assuming we\'ve hit an infinite recursion and bailing out...');
-
- }
- }
-
- runAllImmediates() {
- this._checkFakeTimers();
- // Only run a generous number of immediates and then bail.
- let i;
- for (i = 0; i < this._maxLoops; i++) {
- const immediate = this._immediates.shift();
- if (immediate === undefined) {
- break;
- }
- this._runImmediate(immediate);
- }
-
- if (i === this._maxLoops) {
- throw new Error(
- 'Ran ' + this._maxLoops +
- ' immediates, and there are still more! Assuming ' +
- 'we\'ve hit an infinite recursion and bailing out...');
-
- }
- }
-
- _runImmediate(immediate) {
- if (!this._cancelledImmediates.hasOwnProperty(immediate.uuid)) {
- // Callback may throw, so update the map prior calling.
- this._cancelledImmediates[immediate.uuid] = true;
- immediate.callback();
- }
- }
-
- runAllTimers() {
- this._checkFakeTimers();
- this.runAllTicks();
- this.runAllImmediates();
-
- // Only run a generous number of timers and then bail.
- // This is just to help avoid recursive loops
- let i;
- for (i = 0; i < this._maxLoops; i++) {
- const nextTimerHandle = this._getNextTimerHandle();
-
- // If there are no more timer handles, stop!
- if (nextTimerHandle === null) {
- break;
- }
-
- this._runTimerHandle(nextTimerHandle);
-
- // Some of the immediate calls could be enqueued
- // during the previous handling of the timers, we should
- // run them as well.
- if (this._immediates.length) {
- this.runAllImmediates();
- }
- }
-
- if (i === this._maxLoops) {
- throw new Error(
- 'Ran ' + this._maxLoops + ' timers, and there are still more! ' +
- 'Assuming we\'ve hit an infinite recursion and bailing out...');
-
- }
- }
-
- runOnlyPendingTimers() {
- this._checkFakeTimers();
- this._immediates.forEach(this._runImmediate, this);
- const timers = this._timers;
- Object.keys(timers).
- sort((left, right) => timers[left].expiry - timers[right].expiry).
- forEach(this._runTimerHandle, this);
- }
-
- runTimersToTime(msToRun) {
- this._checkFakeTimers();
- // Only run a generous number of timers and then bail.
- // This is jsut to help avoid recursive loops
- let i;
- for (i = 0; i < this._maxLoops; i++) {
- const timerHandle = this._getNextTimerHandle();
-
- // If there are no more timer handles, stop!
- if (timerHandle === null) {
- break;
- }
-
- const nextTimerExpiry = this._timers[timerHandle].expiry;
- if (this._now + msToRun < nextTimerExpiry) {
- // There are no timers between now and the target we're running to, so
- // adjust our time cursor and quit
- this._now += msToRun;
- break;
- } else {
- msToRun -= nextTimerExpiry - this._now;
- this._now = nextTimerExpiry;
- this._runTimerHandle(timerHandle);
- }
- }
-
- if (i === this._maxLoops) {
- throw new Error(
- 'Ran ' + this._maxLoops + ' timers, and there are still more! ' +
- 'Assuming we\'ve hit an infinite recursion and bailing out...');
-
- }
- }
-
- runWithRealTimers(cb) {
- const hasNextTick =
- typeof this._global.process === 'object' &&
- typeof this._global.process.nextTick === 'function';
-
- const prevClearImmediate = this._global.clearImmediate;
- const prevClearInterval = this._global.clearInterval;
- const prevClearTimeout = this._global.clearTimeout;
- const prevSetImmediate = this._global.setImmediate;
- const prevSetInterval = this._global.setInterval;
- const prevSetTimeout = this._global.setTimeout;
-
- const prevNextTick = hasNextTick ? this._global.process.nextTick : null;
-
- this.useRealTimers();
-
- let cbErr = null;
- let errThrown = false;
- try {
- cb();
- } catch (e) {
- errThrown = true;
- cbErr = e;
- }
-
- this._global.clearImmediate = prevClearImmediate;
- this._global.clearInterval = prevClearInterval;
- this._global.clearTimeout = prevClearTimeout;
- this._global.setImmediate = prevSetImmediate;
- this._global.setInterval = prevSetInterval;
- this._global.setTimeout = prevSetTimeout;
- if (hasNextTick) {
- this._global.process.nextTick = prevNextTick;
- }
-
- if (errThrown) {
- throw cbErr;
- }
- }
-
- useRealTimers() {
- const hasNextTick =
- typeof this._global.process === 'object' &&
- typeof this._global.process.nextTick === 'function';
-
- this._global.clearImmediate = this._timerAPIs.clearImmediate;
- this._global.clearInterval = this._timerAPIs.clearInterval;
- this._global.clearTimeout = this._timerAPIs.clearTimeout;
- this._global.setImmediate = this._timerAPIs.setImmediate;
- this._global.setInterval = this._timerAPIs.setInterval;
- this._global.setTimeout = this._timerAPIs.setTimeout;
- if (hasNextTick) {
- this._global.process.nextTick = this._timerAPIs.nextTick;
- }
- }
-
- useFakeTimers() {
- const hasNextTick =
- typeof this._global.process === 'object' &&
- typeof this._global.process.nextTick === 'function';
-
- this._global.clearImmediate = this._fakeTimerAPIs.clearImmediate;
- this._global.clearInterval = this._fakeTimerAPIs.clearInterval;
- this._global.clearTimeout = this._fakeTimerAPIs.clearTimeout;
- this._global.setImmediate = this._fakeTimerAPIs.setImmediate;
- this._global.setInterval = this._fakeTimerAPIs.setInterval;
- this._global.setTimeout = this._fakeTimerAPIs.setTimeout;
- if (hasNextTick) {
- this._global.process.nextTick = this._fakeTimerAPIs.nextTick;
- }
- }
-
- _checkFakeTimers() {
- if (this._global.setTimeout !== this._fakeTimerAPIs.setTimeout) {
- this._global.console.warn(
- `A function to advance timers was called but the timers API is not ` +
- `mocked with fake timers. Call \`jest.useFakeTimers()\` in this test ` +
- `or enable fake timers globally by setting \`"timers": "fake"\` in ` +
- `the configuration file. This warning is likely a result of a ` +
- `default configuration change in Jest 15.\n\n` +
- `Release Blog Post: https://facebook.github.io/jest/blog/2016/09/01/jest-15.html\n` +
- `Stack Trace:\n` + formatStackTrace(new Error().stack, this._config));
-
- }
- }
-
- _fakeClearTimer(uuid) {
- if (this._timers.hasOwnProperty(uuid)) {
- delete this._timers[uuid];
- }
- }
-
- _fakeClearImmediate(uuid) {
- this._cancelledImmediates[uuid] = true;
- }
-
- _fakeNextTick(callback) {
- if (this._disposed) {
- return;
- }
-
- const args = [];
- for (let ii = 1, ll = arguments.length; ii < ll; ii++) {
- args.push(arguments[ii]);
- }
-
- const uuid = String(this._uuidCounter++);
-
- this._ticks.push({
- callback: () => callback.apply(null, args),
- uuid });
-
-
- const cancelledTicks = this._cancelledTicks;
- this._timerAPIs.nextTick && this._timerAPIs.nextTick(() => {
- if (this._blocked) {return;}
- if (!cancelledTicks.hasOwnProperty(uuid)) {
- // Callback may throw, so update the map prior calling.
- cancelledTicks[uuid] = true;
- callback.apply(null, args);
- }
- });
- }
-
- _fakeSetImmediate(callback) {
- if (this._disposed) {
- return null;
- }
-
- const args = [];
- for (let ii = 1, ll = arguments.length; ii < ll; ii++) {
- args.push(arguments[ii]);
- }
-
- const uuid = this._uuidCounter++;
-
- this._immediates.push({
- callback: () => callback.apply(null, args),
- uuid: String(uuid) });
-
-
- const cancelledImmediates = this._cancelledImmediates;
- this._timerAPIs.setImmediate(() => {
- if (!cancelledImmediates.hasOwnProperty(uuid)) {
- // Callback may throw, so update the map prior calling.
- cancelledImmediates[String(uuid)] = true;
- callback.apply(null, args);
- }
- });
-
- return uuid;
- }
-
- _fakeSetInterval(callback, intervalDelay) {
- if (this._disposed) {
- return null;
- }
-
- if (intervalDelay == null) {
- intervalDelay = 0;
- }
-
- const args = [];
- for (let ii = 2, ll = arguments.length; ii < ll; ii++) {
- args.push(arguments[ii]);
- }
-
- const uuid = this._uuidCounter++;
-
- this._timers[String(uuid)] = {
- callback: () => callback.apply(null, args),
- expiry: this._now + intervalDelay,
- interval: intervalDelay,
- type: 'interval' };
-
-
- return uuid;
- }
-
- _fakeSetTimeout(callback, delay) {
- if (this._disposed) {
- return null;
- }
-
- if (delay == null) {
- delay = 0;
- }
-
- const args = [];
- for (let ii = 2, ll = arguments.length; ii < ll; ii++) {
- args.push(arguments[ii]);
- }
-
- const uuid = this._uuidCounter++;
-
- this._timers[String(uuid)] = {
- callback: () => callback.apply(null, args),
- expiry: this._now + delay,
- interval: null,
- type: 'timeout' };
-
-
- return uuid;
- }
-
- _getNextTimerHandle() {
- let nextTimerHandle = null;
- let uuid;
- let soonestTime = MS_IN_A_YEAR;
- let timer;
- for (uuid in this._timers) {
- timer = this._timers[uuid];
- if (timer.expiry < soonestTime) {
- soonestTime = timer.expiry;
- nextTimerHandle = uuid;
- }
- }
-
- return nextTimerHandle;
- }
-
- _runTimerHandle(timerHandle) {
- const timer = this._timers[timerHandle];
-
- if (!timer) {
- return;
- }
-
- switch (timer.type) {
- case 'timeout':
- const callback = timer.callback;
- delete this._timers[timerHandle];
- callback();
- break;
-
- case 'interval':
- timer.expiry = this._now + timer.interval;
- timer.callback();
- break;
-
- default:
- throw new Error('Unexpected timer type: ' + timer.type);}
-
- }}
-
-
-
-module.exports = FakeTimers;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/JasmineFormatter.js b/fundamentals/bug-challenge-es6/node_modules/jest-util/build/JasmineFormatter.js
deleted file mode 100644
index 8474f6b66..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/JasmineFormatter.js
+++ /dev/null
@@ -1,198 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-const diff = require('diff');
-const chalk = require('chalk');
-
-const ERROR_TITLE_COLOR = chalk.bold.underline.red;
-const LINEBREAK_REGEX = /[\r\n]/;
-
-class JasmineFormatter {
-
-
-
-
-
-
- constructor(jasmine, environment, config) {
- this._config = config;
- this._jasmine = jasmine;
- this._environment = environment;
- /* $FlowFixMe */
- this._diffableMatchers = Object.assign(Object.create(null), {
- toBe: true,
- toEqual: true,
- toNotBe: true,
- toNotEqual: true });
-
- }
-
- formatDiffable(
- matcherName,
- isNot,
- actual,
- expected)
- {
- const ppActual = this.prettyPrint(actual);
- const ppExpected = this.prettyPrint(expected);
- const colorDiff = this.highlightDifferences(ppActual, ppExpected);
- matcherName = (isNot ? 'NOT ' : '') + matcherName;
-
- return (
- ERROR_TITLE_COLOR('Expected:') + ' ' + colorDiff.a + ' ' +
- ERROR_TITLE_COLOR(matcherName + ':') + ' ' + colorDiff.b);
-
- }
-
- formatMatchFailure(result) {
- let message;
- if (this._diffableMatchers[result.matcherName]) {
- const isNot = !!('isNot' in result ?
- result.isNot :
- /not to /.test(result.message || ''));
-
- message = this.formatDiffable(
- result.matcherName,
- isNot,
- result.actual,
- result.expected);
-
- } else {
- message = ERROR_TITLE_COLOR(result.message);
- }
-
- if (!this._config.noStackTrace && result.stack) {
- const errorMessage = result.message || '';
- message = result.stack.
- replace(message, errorMessage).
- replace(/^.*Error:\s*/, '');
- }
- return message;
- }
-
- highlightDifferences(a, b) {
- let differ;
- if (a.match(LINEBREAK_REGEX) || b.match(LINEBREAK_REGEX)) {
- // `diff` uses the Myers LCS diff algorithm which runs in O(n+d^2) time
- // (where "d" is the edit distance) and can get very slow for large edit
- // distances. Mitigate the cost by switching to a lower-resolution diff
- // whenever linebreaks are involved.
- differ = diff.diffLines;
- } else {
- differ = diff.diffChars;
- }
- const changes = differ(a, b);
- const ret = { a: '', b: '' };
- for (let i = 0, il = changes.length; i < il; i++) {
- const change = changes[i];
- if (change.added) {
- ret.b += chalk.bgRed(change.value);
- } else if (change.removed) {
- ret.a += chalk.bgRed(change.value);
- } else {
- ret.a += change.value;
- ret.b += change.value;
- }
- }
- return ret;
- }
-
- prettyPrint(
- object,
- indent,
- cycleWeakMap)
- {
- if (!indent) {
- indent = '';
- }
-
- if (typeof object === 'object' && object !== null) {
- if (
- this._environment.global.Node &&
- object instanceof this._environment.global.Node &&
- object.nodeType > 0)
- {
- let attrStr = '';
- if (object.attributes && object.tagName) {
- Array.from(object.attributes).forEach(attr => {
- const attrName = attr.name.trim();
- const attrValue = attr.value.trim();
- attrStr += ' ' + attrName + '="' + attrValue + '"';
- });
- return (
- `HTMLNode(<${ object.tagName + attrStr }>{...}${ object.tagName }>)`);
-
- } else {
- return `HTMLNode(<${ object.constructor.name } />)`;
- }
- }
-
- if (!cycleWeakMap) {
- cycleWeakMap = new WeakMap();
- }
-
- if (cycleWeakMap.get(object) === true) {
- return '';
- }
- cycleWeakMap.set(object, true);
-
- const type = Object.prototype.toString.call(object);
- const output = [];
- if (type === '[object Map]') {
- indent = chalk.dim('|') + ' ' + indent;
- for (const value of object) {
- output.push(
- indent + value[0] + ': ' + this.prettyPrint(
- value[1],
- indent,
- cycleWeakMap));
-
-
- }
- return `Map {\n${ output.join(',') }\n}`;
- }
- if (type === '[object Set]') {
- for (const value of object) {
- output.push(
- this.prettyPrint(
- value,
- chalk.dim('|') + ' ' + indent,
- cycleWeakMap));
-
-
- }
- return `Set [\n${ indent }${ output.join(', ') }\n${ indent }]`;
- }
-
- const orderedKeys = Object.keys(object).sort();
- let value;
- const keysOutput = [];
- const keyIndent = chalk.dim('|') + ' ';
- for (let i = 0; i < orderedKeys.length; i++) {
- value = object[orderedKeys[i]];
- keysOutput.push(
- indent + keyIndent + orderedKeys[i] + ': ' +
- this.prettyPrint(value, indent + keyIndent, cycleWeakMap));
-
- }
- return '{\n' + keysOutput.join(',\n') + '\n' + indent + '}';
- } else {
- return this._jasmine.pp(object);
- }
- }}
-
-
-
-module.exports = JasmineFormatter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/NullConsole.js b/fundamentals/bug-challenge-es6/node_modules/jest-util/build/NullConsole.js
deleted file mode 100644
index 2461923c4..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/NullConsole.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-const Console = require('./Console');
-
-class NullConsole extends Console {
- assert() {}
- dir() {}
- error() {}
- info() {}
- log() {}
- time() {}
- timeEnd() {}
- trace() {}
- warn() {}}
-
-
-module.exports = NullConsole;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/clearLine.js b/fundamentals/bug-challenge-es6/node_modules/jest-util/build/clearLine.js
deleted file mode 100644
index 240c71a77..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/clearLine.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-/* global stream$Writable */
-'use strict';
-
-module.exports = stream => {
- if (process.stdout.isTTY) {
- stream.write('\x1b[999D\x1b[K');
- }
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/index.js b/fundamentals/bug-challenge-es6/node_modules/jest-util/build/index.js
deleted file mode 100644
index 9914e3084..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/index.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-const Console = require('./Console');
-const FakeTimers = require('./FakeTimers');
-const JasmineFormatter = require('./JasmineFormatter');
-const NullConsole = require('./NullConsole');var _require =
-
-
-
-
-
-require('./messages');const formatExecError = _require.formatExecError,formatResultsErrors = _require.formatResultsErrors,formatStackTrace = _require.formatStackTrace;
-const clearLine = require('./clearLine');
-const fileExists = require('jest-file-exists');
-const installCommonGlobals = require('./installCommonGlobals');
-const mkdirp = require('mkdirp');
-const path = require('path');
-const separateMessageFromStack = require('./separateMessageFromStack');
-
-const escapePathForRegex = dir => {
- if (path.sep === '\\') {
- // Replace "\" with "/" so it's not escaped by escapeStrForRegex.
- // replacePathSepForRegex will convert it back.
- dir = dir.replace(/\\/g, '/');
- }
- return replacePathSepForRegex(escapeStrForRegex(dir));
-};
-
-const escapeStrForRegex =
-string => string.replace(/[[\]{}()*+?.\\^$|]/g, '\\$&');
-
-const replacePathSepForRegex = string => {
- if (path.sep === '\\') {
- return string.replace(/(\/|\\(?!\.))/g, '\\\\');
- }
- return string;
-};
-
-const createDirectory = path => {
- try {
- mkdirp.sync(path, '777');
- } catch (e) {
- if (e.code !== 'EEXIST') {
- throw e;
- }
- }
-};
-
-const getPackageRoot = () => {
- const cwd = process.cwd();
-
- // Is the cwd somewhere within an npm package?
- let root = cwd;
- while (!fileExists(path.join(root, 'package.json'))) {
- if (root === '/' || root.match(/^[A-Z]:\\/)) {
- root = cwd;
- break;
- }
- root = path.resolve(root, '..');
- }
-
- return root;
-};
-
-const warnAboutUnrecognizedOptions = (argv, options) => {
- const yargsSpecialOptions = ['$0', '_', 'help'];
- const allowedOptions = Object.keys(options).reduce((acc, option) =>
- acc.
- add(option).
- add(options[option].alias),
- new Set(yargsSpecialOptions));
- const unrecognizedOptions = Object.keys(argv).filter(arg =>
- !allowedOptions.has(arg));
-
- if (unrecognizedOptions.length) {
- console.warn('Unrecognized options: ' + unrecognizedOptions.join(', '));
- }
-};
-
-module.exports = {
- Console,
- FakeTimers,
- JasmineFormatter,
- NullConsole,
- clearLine,
- createDirectory,
- escapePathForRegex,
- escapeStrForRegex,
- formatExecError,
- formatResultsErrors,
- formatStackTrace,
- getPackageRoot,
- installCommonGlobals,
- replacePathSepForRegex,
- separateMessageFromStack,
- warnAboutUnrecognizedOptions };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/installCommonGlobals.js b/fundamentals/bug-challenge-es6/node_modules/jest-util/build/installCommonGlobals.js
deleted file mode 100644
index 33e58e3ab..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/installCommonGlobals.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
-* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
-*
-* This source code is licensed under the BSD-style license found in the
-* LICENSE file in the root directory of this source tree. An additional grant
-* of patent rights can be found in the PATENTS file in the same directory.
-*
-*
-*/
-'use strict';
-
-
-
-
-function deepCopy(obj) {
- const newObj = {};
- let value;
- for (const key in obj) {
- value = obj[key];
- if (typeof value === 'object' && value !== null) {
- value = deepCopy(value);
- }
- newObj[key] = value;
- }
- return newObj;
-}
-
-module.exports = (global, globals) => {
- // Forward some APIs
- global.Buffer = Buffer;
-
- // `global.process` is mutated by FakeTimers. Make a copy of the
- // object for the jsdom environment to prevent memory leaks.
- // Overwrite toString to make it look like the real process object
- let toStringOverwrite;
- if (Symbol && Symbol.toStringTag) {
- // $FlowFixMe
- toStringOverwrite = {
- [Symbol.toStringTag]: 'process' };
-
- }
- global.process = Object.assign({}, process, toStringOverwrite);
- global.process.setMaxListeners = process.setMaxListeners.bind(process);
- global.process.getMaxListeners = process.getMaxListeners.bind(process);
- global.process.emit = process.emit.bind(process);
- global.process.addListener = process.addListener.bind(process);
- global.process.on = process.on.bind(process);
- global.process.once = process.once.bind(process);
- global.process.removeListener = process.removeListener.bind(process);
- global.process.removeAllListeners = process.removeAllListeners.bind(process);
- global.process.listeners = process.listeners.bind(process);
- global.process.listenerCount = process.listenerCount.bind(process);
-
- global.setImmediate = setImmediate;
- global.clearImmediate = clearImmediate;
-
- Object.assign(global, deepCopy(globals));
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/messages.js b/fundamentals/bug-challenge-es6/node_modules/jest-util/build/messages.js
deleted file mode 100644
index fd23a2370..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/messages.js
+++ /dev/null
@@ -1,194 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-const chalk = require('chalk');
-const path = require('path');
-const separateMessageFromStack = require('./separateMessageFromStack');
-
-// filter for noisy stack trace lines
-const JASMINE_IGNORE =
-/^\s+at(?:(?:.*?vendor\/|jasmine\-)|\s+jasmine\.buildExpectationResult)/;
-const STACK_TRACE_IGNORE =
-/^\s+at.*?jest(-.*?)?(\/|\\)(vendor|build|node_modules|packages)(\/|\\)/;
-const TITLE_INDENT = ' ';
-const MESSAGE_INDENT = ' ';
-const STACK_INDENT = ' ';
-const ANCESTRY_SEPARATOR = ' \u203A ';
-const TITLE_BULLET = chalk.bold('\u25cf ');
-const STACK_TRACE_COLOR = chalk.dim;
-const STACK_PATH_REGEXP = /\s*at.*\(?(\:\d*\:\d*|native)\)?/;
-const EXEC_ERROR_MESSAGE = 'Test suite failed to run';
-
-const trim = string => (string || '').replace(/^\s+/, '').replace(/\s+$/, '');
-
-// Some errors contain not only line numbers in stack traces
-// e.g. SyntaxErrors can contain snippets of code, and we don't
-// want to trim those, because they may have pointers to the column/character
-// which will get misaligned.
-const trimPaths = string =>
-string.match(STACK_PATH_REGEXP) ? trim(string) : string;
-
-// ExecError is an error thrown outside of the test suite (not inside an `it` or
-// `before/after each` hooks). If it's thrown, none of the tests in the file
-// are executed.
-const formatExecError = (
-testResult,
-config,
-testPath) =>
-{
- let error = testResult.testExecError;
- if (!error || typeof error === 'number') {
- error = new Error(`Expected an Error, but "${ String(error) }" was thrown`);
- error.stack = '';
- }var _error =
-
- error;let message = _error.message,stack = _error.stack;
-
- if (typeof error === 'string' || !error) {
- error || (error = 'EMPTY ERROR');
- message = '';
- stack = error;
- }
-
- const separated = separateMessageFromStack(stack || '');
- stack = separated.stack;
-
- if (separated.message.indexOf(trim(message)) !== -1) {
- // Often stack trace already contains the duplicate of the message
- message = separated.message;
- } else {
- message = message + '\n' + separated.message;
- }
-
- message = message.split(/\n/).map(line => MESSAGE_INDENT + line).join('\n');
-
- stack = stack && !config.noStackTrace ?
- '\n' + STACK_TRACE_COLOR(formatStackTrace(stack, config, testPath)) :
- '';
-
- if (message.match(/^\s*$/) && stack.match(/^\s*$/)) {
- // this can happen if an empty object is thrown.
- message = MESSAGE_INDENT + 'Error: No message was provided';
- }
- return TITLE_INDENT + TITLE_BULLET + EXEC_ERROR_MESSAGE + '\n\n' +
- message + stack + '\n';
-};
-
-const removeInternalStackEntries = (lines, config) => {
- let pathCounter = 0;
-
- return lines.filter(line => {
- const isPath = STACK_PATH_REGEXP.test(line);
- if (!isPath) {
- return true;
- }
- if (JASMINE_IGNORE.test(line)) {
- return false;
- }
-
- if (++pathCounter === 1) {
- return true; // always keep the first line even if it's from Jest
- }
-
- return !(STACK_TRACE_IGNORE.test(line) || config.noStackTrace);
- });
-};
-
-const formatPaths = (
-config,
-relativeTestPath,
-line) =>
-{
- // Extract the file path from the trace line.
- const match = line.match(/(^\s*at .*?\(?)([^()]+)(:[0-9]+:[0-9]+\)?.*$)/);
- if (!match) {
- return line;
- }
-
- let filePath = path.relative(config.rootDir, match[2]);
- // highlight paths from the current test file
- if (
- config.testRegex && new RegExp(config.testRegex).test(filePath) ||
- filePath === relativeTestPath)
- {
- filePath = chalk.reset.cyan(filePath);
- }
- return STACK_TRACE_COLOR(match[1]) + filePath + STACK_TRACE_COLOR(match[3]);
-};
-
-
-
-
-
-
-
-const formatStackTrace = (
-stack,
-config,
-testPath) =>
-{
- let lines = stack.split(/\n/);
- const relativeTestPath = testPath ?
- path.relative(config.rootDir, testPath) :
- null;
- lines = removeInternalStackEntries(lines, config);
- return lines.map(trimPaths).
- map(formatPaths.bind(null, config, relativeTestPath)).
- map(line => STACK_INDENT + line).
- join('\n');
-};
-
-const formatResultsErrors = (
-testResults,
-config,
-testPath) =>
-{
- const failedResults = testResults.reduce(
- (errors, result) => {
- result.failureMessages.forEach(content => errors.push({ content, result }));
- return errors;
- },
- []);
-
-
- if (!failedResults.length) {
- return null;
- }
-
- return failedResults.map((_ref) => {let result = _ref.result,content = _ref.content;var _separateMessageFromS =
- separateMessageFromStack(content);let message = _separateMessageFromS.message,stack = _separateMessageFromS.stack;
- stack = config.noStackTrace ?
- '' :
- STACK_TRACE_COLOR(formatStackTrace(stack, config, testPath)) + '\n';
-
- message = message.
- split(/\n/).
- map(line => MESSAGE_INDENT + line).
- join('\n');
-
- const title = chalk.bold.red(
- TITLE_INDENT + TITLE_BULLET +
- result.ancestorTitles.join(ANCESTRY_SEPARATOR) + (
- result.ancestorTitles.length ? ANCESTRY_SEPARATOR : '') +
- result.title) +
- '\n';
-
- return title + '\n' + message + '\n' + stack;
- }).join('\n');
-};
-
-module.exports = {
- formatExecError,
- formatResultsErrors,
- formatStackTrace };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/separateMessageFromStack.js b/fundamentals/bug-challenge-es6/node_modules/jest-util/build/separateMessageFromStack.js
deleted file mode 100644
index 14dcc5388..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-util/build/separateMessageFromStack.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-const ERROR_TEXT = 'Error: ';
-
-// jasmine and worker farm sometimes don't give us access to the actual
-// Error object, so we have to regexp out the message from the stack string
-// to format it.
-module.exports = content => {
- if (!content) {
- return { message: '', stack: '' };
- }
-
- const messageMatch = content.match(/(^(.|\n)*?(?=\n\s*at\s.*\:\d*\:\d*))/);
- let message = messageMatch ? messageMatch[0] : 'Error';
- const stack = messageMatch ? content.slice(message.length) : content;
- // If the error is a plain error instead of a SyntaxError or TypeError
- // we remove it from the message because it is generally not useful.
- if (message.startsWith(ERROR_TEXT)) {
- message = message.substr(ERROR_TEXT.length);
- }
- return { message, stack };
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest-util/package.json b/fundamentals/bug-challenge-es6/node_modules/jest-util/package.json
deleted file mode 100644
index 2a447692b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest-util/package.json
+++ /dev/null
@@ -1,104 +0,0 @@
-{
- "_args": [
- [
- "jest-util@^17.0.2",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli"
- ]
- ],
- "_from": "jest-util@>=17.0.2 <18.0.0",
- "_id": "jest-util@17.0.2",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest-util",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-12-west.internal.npmjs.com",
- "tmp": "tmp/jest-util-17.0.2.tgz_1479170370058_0.12517114728689194"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-util",
- "raw": "jest-util@^17.0.2",
- "rawSpec": "^17.0.2",
- "scope": null,
- "spec": ">=17.0.2 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest-config",
- "/jest-environment-jsdom",
- "/jest-environment-node",
- "/jest-jasmine2",
- "/jest-matchers",
- "/jest-runtime",
- "/jest-snapshot",
- "/jest/jest-cli"
- ],
- "_resolved": "https://registry.npmjs.org/jest-util/-/jest-util-17.0.2.tgz",
- "_shasum": "9fd9da8091e9904fb976da7e4d8912ca26968638",
- "_shrinkwrap": null,
- "_spec": "jest-util@^17.0.2",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli",
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "chalk": "^1.1.1",
- "diff": "^3.0.0",
- "graceful-fs": "^4.1.6",
- "jest-file-exists": "^17.0.0",
- "jest-mock": "^17.0.2",
- "mkdirp": "^0.5.1"
- },
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "9fd9da8091e9904fb976da7e4d8912ca26968638",
- "tarball": "https://registry.npmjs.org/jest-util/-/jest-util-17.0.2.tgz"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/index.js",
- "maintainers": [
- {
- "email": "tall@fb.com",
- "name": "alexjuarez"
- },
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- },
- {
- "email": "kentaromiura@gmail.com",
- "name": "kentaromiura"
- }
- ],
- "name": "jest-util",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "../../packages/jest-cli/bin/jest.js"
- },
- "version": "17.0.2"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/bin/jest.js b/fundamentals/bug-challenge-es6/node_modules/jest/bin/jest.js
deleted file mode 100755
index 086cba797..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/bin/jest.js
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env node
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
-'use strict';
-
-require('jest-cli/bin/jest');
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/build/jest.js b/fundamentals/bug-challenge-es6/node_modules/jest/build/jest.js
deleted file mode 100644
index 0473bd9ad..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/build/jest.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
-'use strict';
-
-module.exports = require('jest-cli');
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/.bin/jest b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/.bin/jest
deleted file mode 120000
index 3d9fe5cf8..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/.bin/jest
+++ /dev/null
@@ -1 +0,0 @@
-../jest-cli/bin/jest.js
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/.npmignore
deleted file mode 100644
index 85e48fe7b..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-**/__mocks__/**
-**/__tests__/**
-src
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/bin/jest.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/bin/jest.js
deleted file mode 100755
index 63fe8d954..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/bin/jest.js
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env node
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
-'use strict';
-
-if (process.env.NODE_ENV == null) {
- process.env.NODE_ENV = 'test';
-}
-
-require('../build/cli').run();
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/SearchSource.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/SearchSource.js
deleted file mode 100644
index 7b983edce..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/SearchSource.js
+++ /dev/null
@@ -1,289 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();
-
-
-
-
-
-const DependencyResolver = require('jest-resolve-dependencies');
-
-const chalk = require('chalk');
-const changedFiles = require('jest-changed-files');
-const fileExists = require('jest-file-exists');
-const path = require('path');var _require =
-
-
-
-require('jest-util');const escapePathForRegex = _require.escapePathForRegex,replacePathSepForRegex = _require.replacePathSepForRegex;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-const git = changedFiles.git;
-const hg = changedFiles.hg;
-
-const determineSCM = path => Promise.all([
-git.isGitRepository(path),
-hg.isHGRepository(path)]);
-
-const pathToRegex = p => replacePathSepForRegex(p);
-const pluralize = (
-word,
-count,
-ending) =>
-`${ count } ${ word }${ count === 1 ? '' : ending }`;
-
-class SearchSource {
-
-
-
-
-
-
-
-
-
-
-
-
- constructor(
- hasteMap,
- config,
- options)
- {
- this._hasteContext = hasteMap;
- this._config = config;
- this._options = options || {
- skipNodeResolution: false };
-
-
- this._testPathDirPattern =
- new RegExp(config.testPathDirs.map(
- dir => escapePathForRegex(dir)).
- join('|'));
-
- this._testRegex = new RegExp(pathToRegex(config.testRegex));
- const ignorePattern = config.testPathIgnorePatterns;
- this._testIgnorePattern =
- ignorePattern.length ? new RegExp(ignorePattern.join('|')) : null;
-
- this._testPathCases = {
- testPathDirs: path => this._testPathDirPattern.test(path),
- testPathIgnorePatterns: path =>
- !this._testIgnorePattern ||
- !this._testIgnorePattern.test(path),
-
- testRegex: path => this._testRegex.test(path) };
-
- }
-
- _filterTestPathsWithStats(
- allPaths,
- testPathPattern)
- {
- const data = {
- paths: [],
- stats: {},
- total: allPaths.length };
-
-
- const testCases = Object.assign({}, this._testPathCases);
- if (testPathPattern) {
- const regex = new RegExp(testPathPattern, 'i');
- testCases.testPathPattern = path => regex.test(path);
- }
-
- data.paths = allPaths.filter(path => {
- return Object.keys(testCases).reduce((flag, key) => {
- if (testCases[key](path)) {
- data.stats[key] = ++data.stats[key] || 1;
- return flag && true;
- }
- data.stats[key] = data.stats[key] || 0;
- return false;
- }, true);
- });
-
- return data;
- }
-
- _getAllTestPaths(
- testPathPattern)
- {
- return this._filterTestPathsWithStats(
- this._hasteContext.hasteFS.getAllFiles(),
- testPathPattern);
-
- }
-
- isTestFilePath(path) {
- return Object.keys(this._testPathCases).every(key =>
- this._testPathCases[key](path));
-
- }
-
- findMatchingTests(
- testPathPattern)
- {
- if (testPathPattern && !(testPathPattern instanceof RegExp)) {
- const maybeFile = path.resolve(process.cwd(), testPathPattern);
- if (fileExists(maybeFile, this._hasteContext.hasteFS)) {
- return this._filterTestPathsWithStats([maybeFile]);
- }
- }
-
- return this._getAllTestPaths(testPathPattern);
- }
-
- findRelatedTests(allPaths) {
- const dependencyResolver = new DependencyResolver(
- this._hasteContext.resolver,
- this._hasteContext.hasteFS);
-
- return {
- paths: dependencyResolver.resolveInverse(
- allPaths,
- this.isTestFilePath.bind(this),
- {
- skipNodeResolution: this._options.skipNodeResolution }) };
-
-
-
- }
-
- findRelatedTestsFromPattern(
- paths)
- {
- if (Array.isArray(paths) && paths.length) {
- const resolvedPaths = paths.map(p => path.resolve(process.cwd(), p));
- return this.findRelatedTests(new Set(resolvedPaths));
- }
- return { paths: [] };
- }
-
- findChangedTests(options) {
- return Promise.all(this._config.testPathDirs.map(determineSCM)).
- then(repos => {
- if (!repos.every((_ref) => {var _ref2 = _slicedToArray(_ref, 2);let gitRepo = _ref2[0],hgRepo = _ref2[1];return gitRepo || hgRepo;})) {
- return {
- noSCM: true,
- paths: [] };
-
- }
- return Promise.all(Array.from(repos).map((_ref3) => {var _ref4 = _slicedToArray(_ref3, 2);let gitRepo = _ref4[0],hgRepo = _ref4[1];
- return gitRepo ?
- git.findChangedFiles(gitRepo, options) :
- hg.findChangedFiles(hgRepo, options);
- })).then(changedPathSets => this.findRelatedTests(
- new Set(Array.prototype.concat.apply([], changedPathSets))));
-
- });
- }
-
- getNoTestsFoundMessage(
- patternInfo,
- config,
- data)
- {
- if (patternInfo.onlyChanged) {
- return (
- chalk.bold(
- 'No tests found related to files changed since last commit.\n') +
-
- chalk.dim(
- patternInfo.watch ?
- 'Press `a` to run all tests, or run Jest with `--watchAll`.' :
- 'Run Jest without `-o` to run all tests.'));
-
-
- }
-
- const testPathPattern = SearchSource.getTestPathPattern(patternInfo);
- const stats = data.stats || {};
- const statsMessage = Object.keys(stats).map(key => {
- const value = key === 'testPathPattern' ? testPathPattern : config[key];
- if (value) {
- const matches = pluralize('match', stats[key], 'es');
- return ` ${ key }: ${ chalk.yellow(value) } - ${ matches }`;
- }
- return null;
- }).filter(line => line).join('\n');
-
- return (
- chalk.bold('No tests found') + '\n' + (
- data.total ?
- ` ${ pluralize('file', data.total || 0, 's') } checked.\n` +
- statsMessage :
- `No files found in ${ config.rootDir }.\n` +
- `Make sure Jest's configuration does not exclude this directory.\n` +
- `To set up Jest, make sure a package.json file exists.\n` +
- `Jest Documentation: facebook.github.io/jest/docs/configuration.html`));
-
-
- }
-
- getTestPaths(patternInfo) {
- if (patternInfo.onlyChanged) {
- return this.findChangedTests({ lastCommit: patternInfo.lastCommit });
- } else if (patternInfo.findRelatedTests && patternInfo.paths) {
- return Promise.resolve(
- this.findRelatedTestsFromPattern(patternInfo.paths));
-
- } else if (patternInfo.testPathPattern != null) {
- return Promise.resolve(
- this.findMatchingTests(patternInfo.testPathPattern));
-
- } else {
- return Promise.resolve({ paths: [] });
- }
- }
-
- static getTestPathPattern(patternInfo) {
- const pattern = patternInfo.testPathPattern;
- const input = patternInfo.input;
- const formattedPattern = `/${ pattern || '' }/`;
- const formattedInput = patternInfo.shouldTreatInputAsPattern ?
- `/${ input || '' }/` :
- `"${ input || '' }"`;
- return input === pattern ? formattedInput : formattedPattern;
- }}
-
-
-
-module.exports = SearchSource;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/TestRunner.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/TestRunner.js
deleted file mode 100644
index 5906aa916..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/TestRunner.js
+++ /dev/null
@@ -1,605 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';var _require =
-
-
-
-
-
-
-
-
-
-
-
-require('jest-util');const formatExecError = _require.formatExecError;
-const fs = require('graceful-fs');
-const getCacheFilePath = require('jest-haste-map').getCacheFilePath;
-const DefaultReporter = require('./reporters/DefaultReporter');
-const NotifyReporter = require('./reporters/NotifyReporter');
-const SummaryReporter = require('./reporters/SummaryReporter');
-const VerboseReporter = require('./reporters/VerboseReporter');
-const promisify = require('./lib/promisify');
-const runTest = require('./runTest');
-const snapshot = require('jest-snapshot');
-const throat = require('throat');
-const workerFarm = require('worker-farm');
-const TestWatcher = require('./TestWatcher');
-
-const FAIL = 0;
-const SLOW_TEST_TIME = 3000;
-const SUCCESS = 1;
-
-class CancelRun extends Error {
- constructor(message) {
- super(message);
- this.name = 'CancelRun';
- }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-const TEST_WORKER_PATH = require.resolve('./TestWorker');
-
-class TestRunner {
-
-
-
-
-
-
- constructor(
- hasteContext,
- config,
- options)
- {
- this._config = config;
- this._dispatcher = new ReporterDispatcher(
- hasteContext.hasteFS,
- options.getTestSummary);
-
- this._hasteContext = hasteContext;
- this._options = options;
- this._setupReporters();
-
- // Map from testFilePath -> time it takes to run the test. Used to
- // optimally schedule bigger test runs.
- this._testPerformanceCache = {};
- }
-
- addReporter(reporter) {
- this._dispatcher.register(reporter);
- }
-
- removeReporter(ReporterClass) {
- this._dispatcher.unregister(ReporterClass);
- }
-
- _getTestPerformanceCachePath() {
- const config = this._config;
- return getCacheFilePath(config.cacheDirectory, 'perf-cache-' + config.name);
- }
-
- _sortTests(testPaths) {
- // When running more tests than we have workers available, sort the tests
- // by size - big test files usually take longer to complete, so we run
- // them first in an effort to minimize worker idle time at the end of a
- // long test run.
- //
- // After a test run we store the time it took to run a test and on
- // subsequent runs we use that to run the slowest tests first, yielding the
- // fastest results.
- try {
- if (this._config.cache) {
- this._testPerformanceCache = JSON.parse(fs.readFileSync(
- this._getTestPerformanceCachePath(),
- 'utf8'));
-
- } else {
- this._testPerformanceCache = {};
- }
- } catch (e) {
- this._testPerformanceCache = {};
- }
-
- const cache = this._testPerformanceCache;
- const timings = [];
- const stats = {};
- const getFileSize = filePath =>
- stats[filePath] || (stats[filePath] = fs.statSync(filePath).size);
- const getTestRunTime = filePath => {
- if (cache[filePath]) {
- return cache[filePath][0] === FAIL ? Infinity : cache[filePath][1];
- }
- return null;
- };
-
- testPaths = testPaths.
- sort((pathA, pathB) => {
- const timeA = getTestRunTime(pathA);
- const timeB = getTestRunTime(pathB);
- if (timeA != null && timeB != null) {
- return timeA < timeB ? 1 : -1;
- }
- return getFileSize(pathA) < getFileSize(pathB) ? 1 : -1;
- });
-
- testPaths.forEach(filePath => {
- const timing = cache[filePath] && cache[filePath][1];
- if (timing) {
- timings.push(timing);
- }
- });
-
- return { testPaths, timings };
- }
-
- _cacheTestResults(aggregatedResults) {
- const cache = this._testPerformanceCache;
- aggregatedResults.testResults.forEach(test => {
- if (test && !test.skipped) {
- const perf = test.perfStats;
- cache[test.testFilePath] = [
- test.numFailingTests ? FAIL : SUCCESS,
- perf.end - perf.start || 0];
-
- }
- });
- fs.writeFileSync(
- this._getTestPerformanceCachePath(),
- JSON.stringify(cache));
-
- }
-
- runTests(paths, watcher) {
- const config = this._config;var _sortTests =
- this._sortTests(paths);const testPaths = _sortTests.testPaths,timings = _sortTests.timings;
- const aggregatedResults = createAggregatedResults(testPaths.length);
- const estimatedTime =
- Math.ceil(getEstimatedTime(timings, this._options.maxWorkers) / 1000);
-
- const onResult = (testPath, testResult) => {
- if (watcher.isInterrupted()) {
- return;
- }
- if (testResult.testResults.length === 0) {
- const message = 'Your test suite must contain at least one test.';
- onFailure(testPath, {
- message,
- stack: new Error(message).stack });
-
- return;
- }
- addResult(aggregatedResults, testResult);
- this._dispatcher.onTestResult(
- config,
- testResult,
- aggregatedResults);
-
- this._bailIfNeeded(aggregatedResults, watcher);
- };
-
- const onFailure = (testPath, error) => {
- if (watcher.isInterrupted()) {
- return;
- }
- const testResult = buildFailureTestResult(testPath, error);
- testResult.failureMessage = formatExecError(testResult, config, testPath);
- addResult(aggregatedResults, testResult);
- this._dispatcher.onTestResult(
- config,
- testResult,
- aggregatedResults);
-
- };
-
- // Run in band if we only have one test or one worker available.
- // If we are confident from previous runs that the tests will finish quickly
- // we also run in band to reduce the overhead of spawning workers.
- const shouldRunInBand = () =>
- this._options.maxWorkers <= 1 ||
- testPaths.length <= 1 ||
-
- testPaths.length <= 20 &&
- timings.every(timing => timing < SLOW_TEST_TIME);
-
-
-
- const updateSnapshotState = () => {
- const status =
- snapshot.cleanup(this._hasteContext.hasteFS, config.updateSnapshot);
- aggregatedResults.snapshot.filesRemoved += status.filesRemoved;
- aggregatedResults.snapshot.didUpdate = config.updateSnapshot;
- aggregatedResults.snapshot.failure = !!(
- !aggregatedResults.snapshot.didUpdate && (
- aggregatedResults.snapshot.unchecked ||
- aggregatedResults.snapshot.unmatched ||
- aggregatedResults.snapshot.filesRemoved));
-
-
- };
-
- const runInBand = shouldRunInBand();
-
- this._dispatcher.onRunStart(
- config,
- aggregatedResults,
- {
- estimatedTime,
- showStatus: !runInBand });
-
-
-
- const testRun =
- runInBand ?
- this._createInBandTestRun(testPaths, watcher, onResult, onFailure) :
- this._createParallelTestRun(testPaths, watcher, onResult, onFailure);
-
- return testRun.
- catch(error => {
- if (!watcher.isInterrupted()) {
- throw error;
- }
- }).
- then(() => {
- updateSnapshotState();
- aggregatedResults.wasInterrupted = watcher.isInterrupted();
-
- this._dispatcher.onRunComplete(config, aggregatedResults);
-
- const anyTestFailures = !(
- aggregatedResults.numFailedTests === 0 &&
- aggregatedResults.numRuntimeErrorTestSuites === 0);
-
- const anyReporterErrors = this._dispatcher.hasErrors();
-
- aggregatedResults.success = !(
- anyTestFailures ||
- aggregatedResults.snapshot.failure ||
- anyReporterErrors);
-
-
- this._cacheTestResults(aggregatedResults);
- return aggregatedResults;
- });
- }
-
- _createInBandTestRun(
- testPaths,
- watcher,
- onResult,
- onFailure)
- {
- const mutex = throat(1);
- return testPaths.reduce(
- (promise, path) =>
- mutex(() =>
- promise.
- then(() => {
- if (watcher.isInterrupted()) {
- throw new CancelRun();
- }
-
- this._dispatcher.onTestStart(this._config, path);
- return runTest(
- path,
- this._config,
- this._hasteContext.resolver);
-
- }).
- then(result => onResult(path, result)).
- catch(err => onFailure(path, err))),
-
- Promise.resolve());
-
- }
-
- _createParallelTestRun(
- testPaths,
- watcher,
- onResult,
- onFailure)
- {
- const config = this._config;
- const farm = workerFarm({
- autoStart: true,
- maxConcurrentCallsPerWorker: 1,
- maxConcurrentWorkers: this._options.maxWorkers,
- maxRetries: 2 },
- TEST_WORKER_PATH);
- const mutex = throat(this._options.maxWorkers);
- // Send test suites to workers continuously instead of all at once to track
- // the start time of individual tests.
- const runTestInWorker = (_ref) => {let path = _ref.path,config = _ref.config;return mutex(() => {
- if (watcher.isInterrupted()) {
- return Promise.reject();
- }
- this._dispatcher.onTestStart(config, path);
- return promisify(farm)({ config, path });
- });};
-
- const onError = (err, path) => {
- onFailure(path, err);
- if (err.type === 'ProcessTerminatedError') {
- console.error(
- 'A worker process has quit unexpectedly! ' +
- 'Most likely this an initialization error.');
-
- process.exit(1);
- }
- };
-
- const onInterrupt = new Promise((_, reject) => {
- watcher.on('change', state => {
- if (state.interrupted) {
- reject(new CancelRun());
- }
- });
- });
-
- const runAllTests = Promise.all(testPaths.map(path => {
- return runTestInWorker({ config, path }).
- then(testResult => onResult(path, testResult)).
- catch(error => onError(error, path));
- }));
-
- return Promise.race([
- runAllTests,
- onInterrupt]).
- then(() => workerFarm.end(farm));
- }
-
- _setupReporters() {
- this.addReporter(
- this._config.verbose ?
- new VerboseReporter() :
- new DefaultReporter());
-
-
- if (this._config.collectCoverage) {
- // coverage reporter dependency graph is pretty big and we don't
- // want to require it if we're not in the `--coverage` mode
- const CoverageReporter = require('./reporters/CoverageReporter');
- this.addReporter(new CoverageReporter());
- }
-
- this.addReporter(new SummaryReporter());
- if (this._config.notify) {
- this.addReporter(new NotifyReporter());
- }
- }
-
- _bailIfNeeded(aggregatedResults, watcher) {
- if (this._config.bail && aggregatedResults.numFailedTests !== 0) {
- if (watcher.isWatchMode()) {
- watcher.setState({ interrupted: true });
- } else {
- this._dispatcher.onRunComplete(this._config, aggregatedResults);
- process.exit(1);
- }
- }
- }}
-
-
-const createAggregatedResults = numTotalTestSuites => {
- return {
- numFailedTestSuites: 0,
- numFailedTests: 0,
- numPassedTestSuites: 0,
- numPassedTests: 0,
- numPendingTestSuites: 0,
- numPendingTests: 0,
- numRuntimeErrorTestSuites: 0,
- numTotalTestSuites,
- numTotalTests: 0,
- snapshot: {
- added: 0,
- didUpdate: false, // is set only after the full run
- failure: false,
- filesAdded: 0,
- // combines individual test results + results after full run
- filesRemoved: 0,
- filesUnmatched: 0,
- filesUpdated: 0,
- matched: 0,
- total: 0,
- unchecked: 0,
- unmatched: 0,
- updated: 0 },
-
- startTime: Date.now(),
- success: false,
- testResults: [],
- wasInterrupted: false };
-
-};
-
-const addResult = (
-aggregatedResults,
-testResult) =>
-{
- aggregatedResults.testResults.push(testResult);
- aggregatedResults.numTotalTests +=
- testResult.numPassingTests +
- testResult.numFailingTests +
- testResult.numPendingTests;
- aggregatedResults.numFailedTests += testResult.numFailingTests;
- aggregatedResults.numPassedTests += testResult.numPassingTests;
- aggregatedResults.numPendingTests += testResult.numPendingTests;
-
- if (testResult.testExecError) {
- aggregatedResults.numRuntimeErrorTestSuites++;
- }
-
- if (testResult.skipped) {
- aggregatedResults.numPendingTestSuites++;
- } else if (testResult.numFailingTests > 0 || testResult.testExecError) {
- aggregatedResults.numFailedTestSuites++;
- } else {
- aggregatedResults.numPassedTestSuites++;
- }
-
- // Snapshot data
- if (testResult.snapshot.added) {
- aggregatedResults.snapshot.filesAdded++;
- }
- if (testResult.snapshot.fileDeleted) {
- aggregatedResults.snapshot.filesRemoved++;
- }
- if (testResult.snapshot.unmatched) {
- aggregatedResults.snapshot.filesUnmatched++;
- }
- if (testResult.snapshot.updated) {
- aggregatedResults.snapshot.filesUpdated++;
- }
-
- aggregatedResults.snapshot.added += testResult.snapshot.added;
- aggregatedResults.snapshot.matched += testResult.snapshot.matched;
- aggregatedResults.snapshot.unchecked += testResult.snapshot.unchecked;
- aggregatedResults.snapshot.unmatched += testResult.snapshot.unmatched;
- aggregatedResults.snapshot.updated += testResult.snapshot.updated;
- aggregatedResults.snapshot.total +=
- testResult.snapshot.added +
- testResult.snapshot.matched +
- testResult.snapshot.unmatched +
- testResult.snapshot.updated;
-};
-
-const buildFailureTestResult = (
-testPath,
-err) =>
-{
- return {
- console: null,
- failureMessage: null,
- numFailingTests: 0,
- numPassingTests: 0,
- numPendingTests: 0,
- perfStats: {
- end: 0,
- start: 0 },
-
- skipped: false,
- snapshot: {
- added: 0,
- fileDeleted: false,
- matched: 0,
- unchecked: 0,
- unmatched: 0,
- updated: 0 },
-
- testExecError: err,
- testFilePath: testPath,
- testResults: [] };
-
-};
-
-// Proxy class that holds all reporter and dispatchers events to each
-// of them.
-class ReporterDispatcher {
-
-
-
-
- constructor(hasteFS, getTestSummary) {
- this._runnerContext = { getTestSummary, hasteFS };
- this._reporters = [];
- }
-
- register(reporter) {
- this._reporters.push(reporter);
- }
-
- unregister(ReporterClass) {
- this._reporters = this._reporters.filter(
- reporter => !(reporter instanceof ReporterClass));
-
- }
-
- onTestResult(config, testResult, results) {
- this._reporters.forEach(reporter =>
- reporter.onTestResult(
- config,
- testResult,
- results,
- this._runnerContext));
-
-
- }
-
- onTestStart(config, path) {
- this._reporters.forEach(reporter =>
- reporter.onTestStart(config, path, this._runnerContext));
-
- }
-
- onRunStart(config, results, options) {
- this._reporters.forEach(
- reporter => reporter.onRunStart(
- config,
- results,
- this._runnerContext,
- options));
-
-
- }
-
- onRunComplete(config, results) {
- this._reporters.forEach(reporter =>
- reporter.onRunComplete(config, results, this._runnerContext));
-
- }
-
- // Return a list of last errors for every reporter
- getErrors() {
- return this._reporters.reduce(
- (list, reporter) => {
- const error = reporter.getLastError();
- return error ? list.concat(error) : list;
- },
- []);
-
- }
-
- hasErrors() {
- return this.getErrors().length !== 0;
- }}
-
-
-const getEstimatedTime = (timings, workers) => {
- if (!timings.length) {
- return 0;
- }
-
- const max = Math.max.apply(null, timings);
- if (timings.length <= workers) {
- return max;
- }
-
- return Math.max(
- timings.reduce((sum, time) => sum + time) / workers,
- max);
-
-};
-
-module.exports = TestRunner;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/TestWatcher.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/TestWatcher.js
deleted file mode 100644
index 209277e7c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/TestWatcher.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';var _require =
-
-require('events');const EventEmitter = _require.EventEmitter;
-
-
-
-
-
-class TestWatcher extends EventEmitter {
-
-
-
- constructor(_ref) {let isWatchMode = _ref.isWatchMode;
- super();
- this.state = { interrupted: false };
- this._isWatchMode = isWatchMode;
- }
-
- setState(state) {
- Object.assign(this.state, state);
- this.emit('change', this.state);
- }
-
- isInterrupted() {
- return this.state.interrupted;
- }
-
- isWatchMode() {
- return this._isWatchMode;
- }}
-
-
-
-module.exports = TestWatcher;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/TestWorker.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/TestWorker.js
deleted file mode 100644
index 934aa526a..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/TestWorker.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';var _require =
-
-
-
-
-require('jest-util');const separateMessageFromStack = _require.separateMessageFromStack;
-
-// Make sure uncaught errors are logged before we exit.
-process.on('uncaughtException', err => {
- console.error(err.stack);
- process.exit(1);
-});
-
-const Runtime = require('jest-runtime');
-const runTest = require('./runTest');
-
-
-
-
-
-
-
-
-const formatError = error => {
- if (typeof error === 'string') {var _separateMessageFromS =
- separateMessageFromStack(error);const message = _separateMessageFromS.message,stack = _separateMessageFromS.stack;
- return {
- message,
- stack,
- type: 'Error' };
-
- }
-
- return {
- message: error.message,
- stack: error.stack,
- type: error.type || 'Error' };
-
-};
-
-const resolvers = Object.create(null);
-
-module.exports = (data, callback) => {
- try {
- const name = data.config.name;
- if (!resolvers[name]) {
- resolvers[name] = Runtime.createResolver(
- data.config,
- Runtime.createHasteMap(data.config).readModuleMap());
-
- }
-
- runTest(data.path, data.config, resolvers[name]).
- then(
- result => callback(null, result),
- error => callback(formatError(error)));
-
- } catch (error) {
- callback(formatError(error));
- }
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/assets/jest_logo.png b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/assets/jest_logo.png
deleted file mode 100644
index c52bf1503..000000000
Binary files a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/assets/jest_logo.png and /dev/null differ
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/cli/args.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/cli/args.js
deleted file mode 100644
index cd60a55a5..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/cli/args.js
+++ /dev/null
@@ -1,261 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-const check = argv => {
- if (argv.runInBand && argv.hasOwnProperty('maxWorkers')) {
- throw new Error(
- 'Both --runInBand and --maxWorkers were specified, but these two ' +
- 'options do not make sense together. Which is it?');
-
- }
-
- if (argv.onlyChanged && argv._.length > 0) {
- throw new Error(
- 'Both --onlyChanged and a path pattern were specified, but these ' +
- 'two options do not make sense together. Which is it? Do you want ' +
- 'to run tests for changed files? Or for a specific set of files?');
-
- }
-
- if (argv.onlyChanged && argv.watchAll) {
- throw new Error(
- 'Both --onlyChanged and --watchAll were specified, but these two ' +
- 'options do not make sense together. Try the --watch option which ' +
- 'reruns only tests related to changed files.');
-
- }
-
- if (argv.findRelatedTests && argv._.length === 0) {
- throw new Error(
- 'The --findRelatedTests option requires file paths to be specified.\n' +
- 'Example usage: jest --findRelatedTests ./src/source.js ./src/index.js.');
-
- }
-
- return true;
-};
-
-const usage = 'Usage: $0 [--config=] [TestPathPattern]';
-
-const options = {
- bail: {
- alias: 'b',
- description:
- 'Exit the test suite immediately upon the first failing test.',
- type: 'boolean' },
-
- cache: {
- default: true,
- description:
- 'Whether to use the transform cache. Disable the cache using ' +
- '--no-cache.',
- type: 'boolean' },
-
- collectCoverageFrom: {
- description:
- 'relative to glob pattern matching the files that coverage ' +
- 'info needs to be collected from.',
- type: 'string' },
-
- colors: {
- description:
- 'Forces test results output highlighting (even if stdout is not a TTY)',
- type: 'boolean' },
-
- config: {
- alias: 'c',
- description:
- 'The path to a jest config file specifying how to find and execute ' +
- 'tests. If no rootDir is set in the config, the current directory ' +
- 'is assumed to be the rootDir for the project. This can also be a JSON' +
- 'encoded value which Jest will use as configuration.',
- type: 'string' },
-
- coverage: {
- description:
- 'Indicates that test coverage information should be collected and ' +
- 'reported in the output.',
- type: 'boolean' },
-
- debug: {
- description: 'Print debugging info about your jest config.',
- type: 'boolean' },
-
- env: {
- default: undefined,
- description:
- 'The test environment used for all tests. This can point to any file ' +
- 'or node module. Examples: `jsdom`, `node` or ' +
- '`path/to/my-environment.js`',
- type: 'string' },
-
- expand: {
- alias: 'e',
- default: false,
- description: 'Use this flag to show full diffs instead of a patch.',
- type: 'boolean' },
-
- findRelatedTests: {
- description:
- 'Find related tests for a list of source files that were passed in ' +
- 'as arguments. Useful for pre-commit hook integration to run the ' +
- 'minimal amount of tests necessary.',
- type: 'boolean' },
-
- forceExit: {
- default: false,
- description:
- 'Force Jest to exit after all tests have completed running. ' +
- 'This is useful when resources set up by test code cannot be ' +
- 'adequately cleaned up.',
- type: 'boolean' },
-
- json: {
- description:
- 'Prints the test results in JSON. This mode will send all ' +
- 'other test output and user messages to stderr.',
- type: 'boolean' },
-
- jsonOutputFile: {
- description:
- 'Write test results to a file when the --json option is also specified.',
- type: 'string' },
-
- lastCommit: {
- default: false,
- description:
- 'Will run all tests affected by file changes in the last commit made.',
- type: 'boolean' },
-
- logHeapUsage: {
- description:
- 'Logs the heap usage after every test. Useful to debug memory ' +
- 'leaks. Use together with `--runInBand` and `--expose-gc` in node.',
- type: 'boolean' },
-
- maxWorkers: {
- alias: 'w',
- description:
- 'Specifies the maximum number of workers the worker-pool will ' +
- 'spawn for running tests. This defaults to the number of the cores ' +
- 'available on your machine. (its usually best not to override this ' +
- 'default)',
- type: 'string' },
-
- noStackTrace: {
- description: 'Disables stack trace in test results output',
- type: 'boolean' },
-
- notify: {
- description: 'Activates notifications for test results.',
- type: 'boolean' },
-
- onlyChanged: {
- alias: 'o',
- description:
- 'Attempts to identify which tests to run based on which files have ' +
- 'changed in the current repository. Only works if you\'re running ' +
- 'tests in a git repository at the moment.',
- type: 'boolean' },
-
- runInBand: {
- alias: 'i',
- description:
- 'Run all tests serially in the current process (rather than ' +
- 'creating a worker pool of child processes that run tests). This ' +
- 'is sometimes useful for debugging, but such use cases are pretty ' +
- 'rare.',
- type: 'boolean' },
-
- setupTestFrameworkScriptFile: {
- description:
- 'The path to a module that runs some code to configure or set up ' +
- 'the testing framework before each test.',
- type: 'string' },
-
- silent: {
- default: false,
- description: 'Prevent tests from printing messages through the console.',
- type: 'boolean' },
-
- testNamePattern: {
- alias: 't',
- description:
- 'Run only tests with a name that matches the regex pattern.',
- type: 'string' },
-
- testPathPattern: {
- description:
- 'A regexp pattern string that is matched against all tests ' +
- 'paths before executing the test.',
- type: 'string' },
-
- testRunner: {
- description:
- 'Allows to specify a custom test runner. Jest ships with Jasmine ' +
- '1 and 2 which can be enabled by setting this option to ' +
- '`jasmine1` or `jasmine2`. The default is `jasmine2`. A path to a ' +
- 'custom test runner can be provided: ' +
- '`/path/to/testRunner.js`.',
- type: 'string' },
-
- updateSnapshot: {
- alias: 'u',
- default: false,
- description:
- 'Use this flag to re-record snapshots. ' +
- 'Can be used together with a test suite pattern or with ' +
- '`--testNamePattern` to re-record snapshot for test matching ' +
- 'the pattern',
- type: 'boolean' },
-
- useStderr: {
- description: 'Divert all output to stderr.',
- type: 'boolean' },
-
- verbose: {
- description:
- 'Display individual test results with the test suite hierarchy.',
- type: 'boolean' },
-
- version: {
- alias: 'v',
- description: 'Print the version and exit',
- type: 'boolean' },
-
- watch: {
- description:
- 'Watch files for changes and rerun tests related to changed files. ' +
- 'If you want to re-run all tests when a file has changed, use the ' +
- '`--watchAll` option.',
- type: 'boolean' },
-
- watchAll: {
- description:
- 'Watch files for changes and rerun all tests. If you want to re-run ' +
- 'only the tests related to the changed files, use the ' +
- '`--watch` option.',
- type: 'boolean' },
-
- watchman: {
- default: true,
- description:
- 'Whether to use watchman for file crawling. Disable using ' +
- '--no-watchman.',
- type: 'boolean' } };
-
-
-
-module.exports = {
- check,
- options,
- usage };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/cli/getJest.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/cli/getJest.js
deleted file mode 100644
index bbcd34e28..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/cli/getJest.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-const chalk = require('chalk');
-const fs = require('graceful-fs');
-const path = require('path');
-
-function getJest(packageRoot) {
- const packageJSONPath = path.join(packageRoot, 'package.json');
- const binPath = path.join(packageRoot, 'node_modules/jest-cli');
- if (fs.existsSync(binPath)) {
- /* $FlowFixMe */
- return require(binPath);
- } else {
- const jest = require('../jest');
- // Check if Jest is specified in `package.json` but not installed.
- if (fs.existsSync(packageJSONPath)) {
- /* $FlowFixMe */
- const packageJSON = require(packageJSONPath);
- const dependencies = packageJSON.dependencies;
- const devDependencies = packageJSON.devDependencies;
- if (
- dependencies && dependencies['jest-cli'] ||
- devDependencies && devDependencies['jest-cli'])
- {
- process.on('exit', () => console.log(
- chalk.red(
- 'Please run `npm install` to use the version of Jest intended ' +
- 'for this project.')));
-
-
- }
- }
- return jest;
- }
-}
-
-module.exports = getJest;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/cli/index.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/cli/index.js
deleted file mode 100644
index a124ac8f1..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/cli/index.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-const args = require('./args');
-const getJest = require('./getJest');
-const getPackageRoot = require('jest-util').getPackageRoot;
-const warnAboutUnrecognizedOptions = require('jest-util').warnAboutUnrecognizedOptions;
-const yargs = require('yargs');
-
-function run(argv, root) {
- argv = yargs(argv || process.argv.slice(2)).
- usage(args.usage).
- help().
- options(args.options).
- check(args.check).
- argv;
-
- warnAboutUnrecognizedOptions(argv, args.options);
-
- if (argv.help) {
- yargs.showHelp();
- process.on('exit', () => process.exit(1));
- return;
- }
-
- if (!root) {
- root = getPackageRoot();
- }
-
- getJest(root).runCLI(argv, root, result => {
- const code = !result || result.success ? 0 : 1;
- process.on('exit', () => process.exit(code));
- if (argv && argv.forceExit) {
- process.exit(code);
- }
- });
-}
-
-exports.run = run;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/coverage.template b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/coverage.template
deleted file mode 100644
index b79141b06..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/coverage.template
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2004-present Facebook. All Rights Reserved.
-
-// Instrumentation Header
-{
- var <%= instrumented.names.statement %>;
- var <%= instrumented.names.expression %>;
- var <%= instrumented.names.block %>;
- var nodes = <%= coverageStorageVar %>.nodes = {};
- var blocks = <%= coverageStorageVar %>.blocks = {};
-
- <%= instrumented.names.statement %> = function(i) {
- var node = nodes[i] = (nodes[i] || {index: i, count:0})
- node.count++;
- };
-
- <%= instrumented.names.expression %> = function(i) {
- var node = nodes[i] = (nodes[i] || {index: i, count:0})
- node.count++;
- };
-
- <%= instrumented.names.block %> = function(i) {
- var block = blocks[i] = (blocks[i] || {index: i, count:0})
- block.count++;
- };
-};
-////////////////////////
-
-// Instrumented Code
-<%= source %>
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/generateEmptyCoverage.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/generateEmptyCoverage.js
deleted file mode 100644
index 0e0482606..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/generateEmptyCoverage.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-const IstanbulInstrument = require('istanbul-lib-instrument');var _require =
-
-require('jest-runtime');const transformSource = _require.transformSource,shouldInstrument = _require.shouldInstrument;
-
-module.exports = function (source, filename, config) {
- if (shouldInstrument(filename, config)) {
- // Transform file without instrumentation first, to make sure produced
- // source code is ES6 (no flowtypes etc.) and can be instrumented
- source = transformSource(filename, config, source, false);
- const instrumenter = IstanbulInstrument.createInstrumenter();
- instrumenter.instrumentSync(source, filename);
- return instrumenter.fileCoverage;
- } else {
- return null;
- }
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/jest.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/jest.js
deleted file mode 100644
index 37596778c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/jest.js
+++ /dev/null
@@ -1,456 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-const realFs = require('fs');
-const fs = require('graceful-fs');
-fs.gracefulify(realFs);
-
-const Runtime = require('jest-runtime');
-const SearchSource = require('./SearchSource');
-const TestRunner = require('./TestRunner');var _require =
-
-require('jest-util');const Console = _require.Console,clearLine = _require.clearLine;var _require2 =
-require('./cli');const run = _require2.run;
-const ansiEscapes = require('ansi-escapes');
-const chalk = require('chalk');
-const formatTestResults = require('./lib/formatTestResults');
-const os = require('os');
-const path = require('path');
-const preRunMessage = require('./preRunMessage');
-const readConfig = require('jest-config').readConfig;
-const sane = require('sane');
-const which = require('which');
-const TestWatcher = require('./TestWatcher');
-
-const CLEAR = '\x1B[2J\x1B[H';
-const VERSION = require('../package.json').version;
-const WATCHER_DEBOUNCE = 200;
-const WATCHMAN_BIN = 'watchman';
-const KEYS = {
- A: '61',
- BACKSPACE: process.platform === 'win32' ? '08' : '7f',
- CONTROL_C: '03',
- CONTROL_D: '04',
- ENTER: '0d',
- ESCAPE: '1b',
- O: '6f',
- P: '70',
- Q: '71',
- U: '75' };
-
-
-const getMaxWorkers = argv => {
- if (argv.runInBand) {
- return 1;
- } else if (argv.maxWorkers) {
- return parseInt(argv.maxWorkers, 10);
- } else {
- const cpus = os.cpus().length;
- return Math.max(argv.watch ? Math.floor(cpus / 2) : cpus - 1, 1);
- }
-};
-
-const buildTestPathPatternInfo = argv => {
- const defaultPattern = {
- input: '',
- shouldTreatInputAsPattern: false,
- testPathPattern: '' };
-
- const validatePattern = patternInfo => {const
- testPathPattern = patternInfo.testPathPattern;
- if (testPathPattern) {
- try {
- /* eslint-disable no-new */
- new RegExp(testPathPattern);
- /* eslint-enable no-new */
- } catch (error) {
- clearLine(process.stdout);
- console.log(chalk.red(
- 'Invalid testPattern ' + String(testPathPattern) + ' supplied. ' +
- 'Running all tests instead.'));
-
- return defaultPattern;
- }
- }
- return patternInfo;
- };
- if (argv.onlyChanged) {
- return {
- input: '',
- lastCommit: argv.lastCommit,
- onlyChanged: true,
- watch: argv.watch };
-
- }
- if (argv.testPathPattern) {
- return validatePattern({
- input: argv.testPathPattern,
- shouldTreatInputAsPattern: true,
- testPathPattern: argv.testPathPattern });
-
- }
- if (argv._ && argv._.length) {
- return validatePattern({
- findRelatedTests: argv.findRelatedTests,
- input: argv._.join(' '),
- paths: argv._,
- shouldTreatInputAsPattern: false,
- testPathPattern: argv._.join('|') });
-
- }
- return defaultPattern;
-};
-
-const getTestSummary = (
-argv,
-patternInfo) =>
-{
- const testPathPattern = SearchSource.getTestPathPattern(patternInfo);
- const testInfo = patternInfo.onlyChanged ?
- chalk.dim(' related to changed files') :
- patternInfo.input !== '' ?
- chalk.dim(' matching ') + testPathPattern :
- '';
-
- const nameInfo = argv.testNamePattern ?
- chalk.dim(' with tests matching ') + `"${ argv.testNamePattern }"` :
- '';
-
- return (
- chalk.dim('Ran all test suites') +
- testInfo +
- nameInfo +
- chalk.dim('.'));
-
-};
-
-const getWatcher = (
-config,
-packageRoot,
-callback,
-options) =>
-{
- which(WATCHMAN_BIN, (err, resolvedPath) => {
- const watchman = !err && options.useWatchman && resolvedPath;
- const glob = config.moduleFileExtensions.map(ext => '**/*' + ext);
- const watcher = sane(packageRoot, { glob, watchman });
- callback(watcher);
- });
-};
-
-const runJest = (config, argv, pipe, testWatcher, onComplete) => {
- const maxWorkers = getMaxWorkers(argv);
- const localConsole = new Console(pipe, pipe);
- let patternInfo = buildTestPathPatternInfo(argv);
- return Runtime.createHasteContext(config, {
- console: localConsole,
- maxWorkers }).
- then(hasteMap => {
- const source = new SearchSource(hasteMap, config);
- return source.getTestPaths(patternInfo).
- then(data => {
- if (!data.paths.length) {
- if (patternInfo.onlyChanged && data.noSCM) {
- if (config.watch) {
- // Run all the tests
- setWatchMode(argv, 'watchAll', {
- noSCM: true });
-
- patternInfo = buildTestPathPatternInfo(argv);
- return source.getTestPaths(patternInfo);
- } else {
- localConsole.log(
- 'Jest can only find uncommitted changed files in a git or hg ' +
- 'repository. If you make your project a git or hg repository ' +
- '(`git init` or `hg init`), Jest will be able to only ' +
- 'run tests related to files changed since the last commit.');
-
- }
- }
-
- localConsole.log(
- source.getNoTestsFoundMessage(patternInfo, config, data));
-
- }
- return data;
- }).then(data => {
- if (data.paths.length === 1 && config.verbose !== false) {
- config = Object.assign({}, config, { verbose: true });
- }
-
- return new TestRunner(
- hasteMap,
- config,
- {
- getTestSummary: () => getTestSummary(argv, patternInfo),
- maxWorkers }).
-
- runTests(data.paths, testWatcher);
- }).
- then(runResults => {
- if (config.testResultsProcessor) {
- /* $FlowFixMe */
- const processor = require(config.testResultsProcessor);
- processor(runResults);
- }
- if (argv.json) {
- if (argv.jsonOutputFile) {
- const outputFile = path.resolve(process.cwd(), argv.jsonOutputFile);
-
- fs.writeFileSync(
- outputFile,
- JSON.stringify(formatTestResults(runResults, config)));
-
- process.stdout.write(
- `Test results written to: ` +
- `${ path.relative(process.cwd(), outputFile) }\n`);
-
- } else {
- process.stdout.write(
- JSON.stringify(formatTestResults(runResults, config)));
-
- }
- }
- return onComplete && onComplete(runResults);
- }).catch(error => {
- throw error;
- });
- });
-};
-
-const setWatchMode = (argv, mode, options) => {
- if (mode === 'watch') {
- argv.watch = true;
- argv.watchAll = false;
- } else if (mode === 'watchAll') {
- argv.watch = false;
- argv.watchAll = true;
- }
-
- // Reset before setting these to the new values
- argv._ = options && options.pattern || '';
- argv.onlyChanged = false;
- argv.onlyChanged =
- buildTestPathPatternInfo(argv).input === '' && !argv.watchAll;
-
- if (options && options.noSCM) {
- argv.noSCM = true;
- }
-};
-
-const runCLI = (
-argv,
-root,
-onComplete) =>
-{
- const pipe = argv.json ? process.stderr : process.stdout;
- argv = argv || {};
- if (argv.version) {
- pipe.write(`v${ VERSION }\n`);
- onComplete && onComplete();
- return;
- }
-
- readConfig(argv, root).
- then(config => {
- if (argv.debug) {
- /* $FlowFixMe */
- const testFramework = require(config.testRunner);
- pipe.write('jest version = ' + VERSION + '\n');
- pipe.write('test framework = ' + testFramework.name + '\n');
- pipe.write('config = ' + JSON.stringify(config, null, ' ') + '\n');
- }
- if (argv.watch || argv.watchAll) {
- setWatchMode(argv, argv.watch ? 'watch' : 'watchAll', {
- pattern: argv._ });
-
-
- let isRunning = false;
- let isEnteringPattern = false;
- let currentPattern = '';
- let timer;
-
- let testWatcher;
- const writeCurrentPattern = () => {
- clearLine(pipe);
- pipe.write(chalk.dim(' pattern \u203A ') + currentPattern);
- };
-
- const startRun = function () {let overrideConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- if (isRunning) {
- return null;
- }
-
- testWatcher = new TestWatcher({ isWatchMode: true });
- pipe.write(CLEAR);
- preRunMessage.print(pipe);
- isRunning = true;
- return runJest(
- Object.freeze(Object.assign({}, config, overrideConfig)),
- argv,
- pipe,
- testWatcher,
- results => {
- isRunning = false;
- /* eslint-disable max-len */
- const messages = [
- '\n' + chalk.bold('Watch Usage'),
- argv.watch ?
- chalk.dim(' \u203A Press ') + 'a' + chalk.dim(' to run all tests.') :
- null,
- (argv.watchAll || argv._) && !argv.noSCM ?
- chalk.dim(' \u203A Press ') + 'o' + chalk.dim(' to only run tests related to changed files.') :
- null,
- results.snapshot.failure ?
- chalk.dim(' \u203A Press ') + 'u' + chalk.dim(' to update failing snapshots.') :
- null,
- chalk.dim(' \u203A Press ') + 'p' + chalk.dim(' to filter by a filename regex pattern.'),
- chalk.dim(' \u203A Press ') + 'q' + chalk.dim(' to quit watch mode.'),
- chalk.dim(' \u203A Press ') + 'Enter' + chalk.dim(' to trigger a test run.')];
-
- /* eslint-enable max-len */
- console.log(messages.filter(message => !!message).join('\n'));
- }).
- then(
- () => {},
- error => console.error(chalk.red(error.stack)));
-
- };
-
- const onKeypress = key => {
- if (key === KEYS.CONTROL_C || key === KEYS.CONTROL_D) {
- process.exit(0);
- return;
- }
- if (isEnteringPattern) {
- switch (key) {
- case KEYS.ENTER:
- isEnteringPattern = false;
- setWatchMode(argv, 'watch', {
- pattern: [currentPattern] });
-
- startRun();
- break;
- case KEYS.ESCAPE:
- isEnteringPattern = false;
- pipe.write(ansiEscapes.eraseLines(2));
- currentPattern = argv._[0];
- break;
- default:
- const char = new Buffer(key, 'hex').toString();
- currentPattern = key === KEYS.BACKSPACE ?
- currentPattern.slice(0, -1) :
- currentPattern + char;
- writeCurrentPattern();
- break;}
-
- return;
- }
-
- // Abort test run
- if (
- isRunning &&
- testWatcher &&
- [KEYS.Q, KEYS.ENTER, KEYS.A, KEYS.O, KEYS.P].includes(key))
- {
- testWatcher.setState({ interrupted: true });
- return;
- }
-
- switch (key) {
- case KEYS.Q:
- process.exit(0);
- return;
- case KEYS.ENTER:
- startRun();
- break;
- case KEYS.U:
- startRun({ updateSnapshot: true });
- break;
- case KEYS.A:
- setWatchMode(argv, 'watchAll');
- startRun();
- break;
- case KEYS.O:
- setWatchMode(argv, 'watch');
- startRun();
- break;
- case KEYS.P:
- isEnteringPattern = true;
- currentPattern = '';
- pipe.write('\n');
- writeCurrentPattern();
- break;}
-
- };
-
- const onFileChange = (_, filePath) => {
- filePath = path.join(root, filePath);
- const coverageDirectory =
- config.coverageDirectory ||
- path.resolve(config.rootDir, 'coverage');
- const isValidPath =
- config.testPathDirs.some(dir => filePath.startsWith(dir)) &&
- !filePath.includes(coverageDirectory);
-
- if (!isValidPath) {
- return;
- }
- if (timer) {
- clearTimeout(timer);
- timer = null;
- }
- if (testWatcher && testWatcher.isInterrupted()) {
- return;
- }
- timer = setTimeout(startRun, WATCHER_DEBOUNCE);
- };
-
- if (typeof process.stdin.setRawMode === 'function') {
- process.stdin.setRawMode(true);
- process.stdin.resume();
- process.stdin.setEncoding('hex');
- process.stdin.on('data', onKeypress);
- }
- const callback = watcher => {
- watcher.on('error', error => {
- watcher.close();
- getWatcher(config, root, callback, { useWatchman: false });
- });
- watcher.on('all', onFileChange);
- };
- getWatcher(config, root, callback, { useWatchman: true });
- startRun();
- return Promise.resolve();
- } else {
- preRunMessage.print(pipe);
- const testWatcher = new TestWatcher({ isWatchMode: false });
- return runJest(config, argv, pipe, testWatcher, onComplete);
- }
- }).
- catch(error => {
- clearLine(process.stderr);
- clearLine(process.stdout);
- console.error(chalk.red(error.stack));
- process.exit(1);
- });
-};
-
-module.exports = {
- SearchSource,
- TestRunner,
- getVersion: () => VERSION,
- run,
- runCLI };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/lib/BufferedConsole.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/lib/BufferedConsole.js
deleted file mode 100644
index 6a6059fb4..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/lib/BufferedConsole.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-const Console = require('console').Console;
-
-const callsites = require('callsites');
-const format = require('util').format;
-
-class BufferedConsole extends Console {
-
-
-
- constructor() {
- const buffer = [];
- super({ write: message => BufferedConsole.write(buffer, 'log', message) });
- this._buffer = buffer;
- }
-
- static write(
- buffer,
- type,
- message,
- level)
- {
- const call = callsites()[level != null ? level : 2];
- const origin = call.getFileName() + ':' + call.getLineNumber();
- buffer.push({ message, origin, type });
- return buffer;
- }
-
- log() {
- BufferedConsole.write(this._buffer, 'log', format.apply(null, arguments));
- }
-
- info() {
- BufferedConsole.write(this._buffer, 'info', format.apply(null, arguments));
- }
-
- warn() {
- BufferedConsole.write(this._buffer, 'warn', format.apply(null, arguments));
- }
-
- error() {
- BufferedConsole.write(this._buffer, 'error', format.apply(null, arguments));
- }
-
- getBuffer() {
- return this._buffer;
- }}
-
-
-
-module.exports = BufferedConsole;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/lib/formatTestResults.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/lib/formatTestResults.js
deleted file mode 100644
index 4d0088a8e..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/lib/formatTestResults.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';
-
-
-
-
-
-
-
-
-
-
-const formatResult = (
-testResult,
-config,
-codeCoverageFormatter,
-reporter) =>
-{
- const output = {
- message: '',
- name: testResult.testFilePath,
- summary: '' };
-
-
- if (testResult.testExecError) {
- const currTime = Date.now();
- output.status = 'failed';
- output.message = testResult.testExecError;
- output.startTime = currTime;
- output.endTime = currTime;
- output.coverage = {};
- } else {
- const allTestsPassed = testResult.numFailingTests === 0;
- output.status = allTestsPassed ? 'passed' : 'failed';
- output.startTime = testResult.perfStats.start;
- output.endTime = testResult.perfStats.end;
- output.coverage = codeCoverageFormatter(testResult.coverage, reporter);
- }
-
- output.assertionResults = testResult.testResults.map(formatTestAssertion);
-
- if (testResult.failureMessage) {
- output.message = testResult.failureMessage;
- }
-
- return output;
-};
-
-function formatTestAssertion(
-assertion)
-{
- const result = {
- status: assertion.status,
- title: assertion.title };
-
- if (assertion.failureMessages) {
- result.failureMessages = assertion.failureMessages;
- }
- return result;
-}
-
-function formatTestResults(
-results,
-config,
-codeCoverageFormatter,
-reporter)
-{
- const formatter = codeCoverageFormatter || (coverage => coverage);
-
- const testResults = results.testResults.map(testResult => formatResult(
- testResult,
- config,
- formatter,
- reporter));
-
-
- return {
- numFailedTests: results.numFailedTests,
- numPassedTests: results.numPassedTests,
- numPendingTests: results.numPendingTests,
- numRuntimeErrorTestSuites: results.numRuntimeErrorTestSuites,
- numTotalTestSuites: results.numTotalTestSuites,
- numTotalTests: results.numTotalTests,
- startTime: results.startTime,
- success: results.success,
- testResults };
-
-}
-
-module.exports = formatTestResults;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/lib/promisify.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/lib/promisify.js
deleted file mode 100644
index 21d20cfe9..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/lib/promisify.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-'use strict';
-
-module.exports = function promisify(fn) {
- return function () {
- const args = Array.prototype.slice.call(arguments);
- return new Promise((resolve, reject) => {
- args.push((err, res) => {
- if (err) {
- reject(err);
- } else {
- resolve(res);
- }
- });
-
- fn.apply(this, args);
- });
- };
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/preRunMessage.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/preRunMessage.js
deleted file mode 100644
index 77f18bca3..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/preRunMessage.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';var _require =
-
-require('jest-util');const clearLine = _require.clearLine;
-const chalk = require('chalk');
-const isCI = require('is-ci');
-
-const print = stream => {
- if (process.stdout.isTTY && !isCI) {
- stream.write(chalk.bold.dim('Determining test suites to run...'));
- }
-};
-
-const remove = stream => {
- if (stream.isTTY && !isCI) {
- clearLine(stream);
- }
-};
-
-module.exports = {
- print,
- remove };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/BaseReporter.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/BaseReporter.js
deleted file mode 100644
index dfc9cfeac..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/BaseReporter.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-const preRunMessage = require('../preRunMessage');
-
-class BaseReporter {
-
-
- log(message) {
- process.stderr.write(message + '\n');
- }
-
- onRunStart(
- config,
- results,
- runnerContext,
- options)
- {
- preRunMessage.remove(process.stderr);
- }
-
- onTestResult(
- config,
- testResult,
- results)
- {}
-
- onTestStart(
- config,
- path,
- runnerContext)
- {}
-
- onRunComplete(
- config,
- aggregatedResults,
- runnerContext)
- {}
-
- _setError(error) {
- this._error = error;
- }
-
- // Return an error that occured during reporting. This error will
- // define whether the test run was successful or failed.
- getLastError() {
- return this._error;
- }}
-
-
-module.exports = BaseReporter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/CoverageReporter.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/CoverageReporter.js
deleted file mode 100644
index 3854061e0..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/CoverageReporter.js
+++ /dev/null
@@ -1,177 +0,0 @@
-/**
-* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
-*
-* This source code is licensed under the BSD-style license found in the
-* LICENSE file in the root directory of this source tree. An additional grant
-* of patent rights can be found in the PATENTS file in the same directory.
-*
-*
-*/
-'use strict';
-
-
-
-
-
-
-
-
-
-
-
-
-const BaseReporter = require('./BaseReporter');var _require =
-
-require('jest-util');const clearLine = _require.clearLine;var _require2 =
-require('istanbul-api');const createReporter = _require2.createReporter;
-const chalk = require('chalk');
-const fs = require('fs');
-const generateEmptyCoverage = require('../generateEmptyCoverage');
-const isCI = require('is-ci');
-const istanbulCoverage = require('istanbul-lib-coverage');
-
-const FAIL_COLOR = chalk.bold.red;
-const RUNNING_TEST_COLOR = chalk.bold.dim;
-
-const isInteractive = process.stdout.isTTY && !isCI;
-
-class CoverageReporter extends BaseReporter {
-
-
- constructor() {
- super();
- this._coverageMap = istanbulCoverage.createCoverageMap({});
- }
-
- onTestResult(
- config,
- testResult,
- aggregatedResults)
- {
- if (testResult.coverage) {
- this._coverageMap.merge(testResult.coverage);
- }
- }
-
- onRunComplete(
- config,
- aggregatedResults,
- runnerContext)
- {
- this._addUntestedFiles(config, runnerContext);
- const reporter = createReporter();
- try {
- if (config.coverageDirectory) {
- reporter.dir = config.coverageDirectory;
- }
-
- let coverageReporters = config.coverageReporters || [];
- if (
- !config.useStderr &&
- coverageReporters.length &&
- coverageReporters.indexOf('text') === -1)
- {
- coverageReporters = coverageReporters.concat(['text-summary']);
- }
-
- reporter.addAll(coverageReporters);
- reporter.write(this._coverageMap);
- } catch (e) {
- console.error(chalk.red(`
- Failed to write coverage reports:
- ERROR: ${ e.toString() }
- STACK: ${ e.stack }
- `));
- }
-
- this._checkThreshold(config);
- }
-
- _addUntestedFiles(config, runnerContext) {
- if (config.collectCoverageFrom && config.collectCoverageFrom.length) {
- if (isInteractive) {
- process.stderr.write(RUNNING_TEST_COLOR(
- 'Running coverage on untested files...'));
-
- }
- const files = runnerContext.hasteFS.matchFilesWithGlob(
- config.collectCoverageFrom,
- config.rootDir);
-
-
- files.forEach(filename => {
- if (!this._coverageMap.data[filename]) {
- try {
- const source = fs.readFileSync(filename).toString();
- const coverage = generateEmptyCoverage(source, filename, config);
- if (coverage) {
- this._coverageMap.addFileCoverage(coverage);
- }
- } catch (e) {
- console.error(chalk.red(`
- Failed to collect coverage from ${ filename }
- ERROR: ${ e }
- STACK: ${ e.stack }
- `));
- }
- }
- });
- if (isInteractive) {
- clearLine(process.stderr);
- }
- }
- }
-
- _checkThreshold(config) {
- if (config.coverageThreshold) {
- const results = this._coverageMap.getCoverageSummary().toJSON();
-
- function check(name, thresholds, actuals) {
- return [
- 'statements',
- 'branches',
- 'lines',
- 'functions'].
- reduce((errors, key) => {
- const actual = actuals[key].pct;
- const actualUncovered = actuals[key].total - actuals[key].covered;
- const threshold = thresholds[key];
-
- if (threshold != null) {
- if (threshold < 0) {
- if (threshold * -1 < actualUncovered) {
- errors.push(
- `Jest: Uncovered count for ${ key } (${ actualUncovered })` +
- `exceeds ${ name } threshold (${ -1 * threshold })`);
-
- }
- } else if (actual < threshold) {
- errors.push(
- `Jest: Coverage for ${ key } (${ actual }` +
- `%) does not meet ${ name } threshold (${ threshold }%)`);
-
- }
- }
- return errors;
- }, []);
- }
- const errors = check(
- 'global',
- config.coverageThreshold.global,
- results);
-
-
- if (errors.length > 0) {
- this.log(`${ FAIL_COLOR(errors.join('\n')) }`);
- this._setError(new Error(errors.join('\n')));
- }
- }
- }
-
- // Only exposed for the internal runner. Should not be used
- getCoverageMap() {
- return this._coverageMap;
- }}
-
-
-module.exports = CoverageReporter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/DefaultReporter.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/DefaultReporter.js
deleted file mode 100644
index b4ec29c29..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/DefaultReporter.js
+++ /dev/null
@@ -1,168 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-/* global stream$Writable, tty$WriteStream */
-
-'use strict';
-
-
-
-
-
-const BaseReporter = require('./BaseReporter');
-const Status = require('./Status');var _require =
-
-require('jest-util');const clearLine = _require.clearLine;
-const chalk = require('chalk');
-const getConsoleOutput = require('./getConsoleOutput');
-const getResultHeader = require('./getResultHeader');
-const isCI = require('is-ci');
-
-
-
-const TITLE_BULLET = chalk.bold('\u25cf ');
-
-const isInteractive = process.stdin.isTTY && !isCI;
-
-class DefaultReporter extends BaseReporter {
- // ANSI clear sequence for the last printed status
-
-
-
-
-
-
-
- constructor() {
- super();
- this._clear = '';
- this._out = process.stdout.write.bind(process.stdout);
- this._err = process.stderr.write.bind(process.stderr);
- this._status = new Status();
- this._wrapStdio(process.stdout);
- this._wrapStdio(process.stderr);
- this._status.onChange(() => {
- this._clearStatus();
- this._printStatus();
- });
- }
-
- _wrapStdio(stream) {
- const originalWrite = stream.write;
-
- let buffer = [];
- let timeout = null;
-
- const doFlush = () => {
- const string = buffer.join('');
- buffer = [];
- // This is to avoid conflicts between random output and status text
- this._clearStatus();
- originalWrite.call(stream, string);
- this._printStatus();
- };
-
- const flush = () => {
- // If the process blows up no errors would be printed.
- // There should be a smart way to buffer stderr, but for now
- // we just won't buffer it.
- if (stream === process.stderr) {
- doFlush();
- } else {
- if (!timeout) {
- timeout = setTimeout(() => {
- doFlush();
- timeout = null;
- }, 100);
- }
- }
- };
-
- // $FlowFixMe
- stream.write = chunk => {
- buffer.push(chunk);
- flush();
- return true;
- };
- }
-
- _clearStatus() {
- if (isInteractive) {
- this._out(this._clear);
- }
- }
-
- _printStatus() {var _status$get =
- this._status.get();const content = _status$get.content,clear = _status$get.clear;
- this._clear = clear;
- if (isInteractive) {
- this._out(content);
- }
- }
-
- onRunStart(
- config,
- aggregatedResults,
- runnerContext,
- options)
- {
- this._status.runStarted(aggregatedResults, options);
- }
-
- onTestStart(config, testPath) {
- this._status.testStarted(testPath, config);
- }
-
- onRunComplete() {
- this._status.runFinished();
- // $FlowFixMe
- process.stdout.write = this._out;
- // $FlowFixMe
- process.stderr.write = this._err;
- clearLine(process.stderr);
- }
-
- onTestResult(
- config,
- testResult,
- aggregatedResults)
- {
- this._status.testFinished(config, testResult, aggregatedResults);
- this._printTestFileSummary(testResult.testFilePath, config, testResult);
- }
-
- _printTestFileSummary(
- testPath,
- config,
- result)
- {
- if (!result.skipped) {
- this.log(getResultHeader(result, config));
-
- const consoleBuffer = result.console;
- if (consoleBuffer && consoleBuffer.length) {
- this.log(
- ' ' + TITLE_BULLET + 'Console\n\n' +
- getConsoleOutput(
- config.rootDir,
- !!config.verbose,
- consoleBuffer));
-
-
- }
-
- if (result.failureMessage) {
- this.log(result.failureMessage);
- }
- }
- }}
-
-
-module.exports = DefaultReporter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/NotifyReporter.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/NotifyReporter.js
deleted file mode 100644
index e831e790a..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/NotifyReporter.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
-* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
-*
-* This source code is licensed under the BSD-style license found in the
-* LICENSE file in the root directory of this source tree. An additional grant
-* of patent rights can be found in the PATENTS file in the same directory.
-*
-*
-*/
-'use strict';
-
-
-
-
-const BaseReporter = require('./BaseReporter');
-const notifier = require('node-notifier');
-const path = require('path');
-const util = require('util');
-
-const isDarwin = process.platform === 'darwin';
-
-const icon = path.resolve(__dirname, '../assets/jest_logo.png');
-
-class NotifyReporter extends BaseReporter {
- onRunComplete(config, result) {
- let title;
- let message;
- const success = result.numFailedTests === 0 &&
- result.numRuntimeErrorTestSuites === 0;
-
- if (success) {
- title = util.format('%d%% Passed', 100);
- message = util.format(
- (isDarwin ? '\u2705 ' : '') + '%d tests passed',
- result.numPassedTests);
-
- } else {
- title = util.format(
- '%d%% Failed',
- Math.ceil(result.numFailedTests / result.numTotalTests * 100));
-
- message = util.format(
- (isDarwin ? '\u26D4\uFE0F ' : '') + '%d of %d tests failed',
- result.numFailedTests,
- result.numTotalTests);
-
- }
-
- notifier.notify({ icon, message, title });
- }}
-
-
-module.exports = NotifyReporter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/Status.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/Status.js
deleted file mode 100644
index e4bd64561..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/Status.js
+++ /dev/null
@@ -1,200 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';var _require =
-
-
-
-
-
-require('./utils');const getSummary = _require.getSummary,trimAndFormatPath = _require.trimAndFormatPath,wrapAnsiString = _require.wrapAnsiString;
-const chalk = require('chalk');
-
-const RUNNING_TEXT = ' RUNS ';
-const RUNNING = chalk.reset.inverse.yellow.bold(RUNNING_TEXT) + ' ';
-
-/**
- * This class is a perf optimization for sorting the list of currently
- * running tests. It tries to keep tests in the same positions without
- * shifting the whole list.
- */
-class CurrentTestList {
-
-
- constructor() {
- this._array = [];
- }
-
- add(testPath, config) {
- const index = this._array.indexOf(null);
- const record = { config, testPath };
- if (index !== -1) {
- this._array[index] = record;
- } else {
- this._array.push(record);
- }
- }
-
- delete(testPath) {
- const record = this._array.find(
- record => record && record.testPath === testPath);
-
- this._array[this._array.indexOf(record || null)] = null;
- }
-
- get() {
- return this._array;
- }}
-
-
-/**
- * A class that generates the CLI status of currently running tests
- * and also provides an ANSI escape sequence to remove status lines
- * from the terminal.
- */
-class Status {
-
-
-
-
-
-
-
-
-
-
-
-
- constructor() {
- this._cache = null;
- this._currentTests = new CurrentTestList();
- this._done = false;
- this._emitScheduled = false;
- this._estimatedTime = 0;
- this._height = 0;
- this._showStatus = false;
- }
-
- onChange(callback) {
- this._callback = callback;
- }
-
- runStarted(
- aggregatedResults,
- options)
- {
- this._estimatedTime = options && options.estimatedTime || 0;
- this._showStatus = options && options.showStatus;
- this._interval = setInterval(() => this._tick(), 1000);
- this._aggregatedResults = aggregatedResults;
- this._debouncedEmit();
- }
-
- runFinished() {
- this._done = true;
- clearInterval(this._interval);
- this._emit();
- }
-
- testStarted(testPath, config) {
- this._currentTests.add(testPath, config);
- if (!this._showStatus) {
- this._emit();
- } else {
- this._debouncedEmit();
- }
- }
-
- testFinished(
- config,
- testResult,
- aggregatedResults)
- {const
- testFilePath = testResult.testFilePath;
- this._aggregatedResults = aggregatedResults;
- this._currentTests.delete(testFilePath);
- this._debouncedEmit();
- }
-
- get() {
- if (this._cache) {
- return this._cache;
- }
-
- if (this._done) {
- return { clear: '', content: '' };
- }
-
- // $FlowFixMe
- const width = process.stdout.columns;
- let content = '\n';
- this._currentTests.get().forEach(record => {
- if (record) {const
- config = record.config,testPath = record.testPath;
- content += wrapAnsiString(
- RUNNING + trimAndFormatPath(
- RUNNING_TEXT.length + 1,
- config,
- testPath,
- width),
-
- width) +
- '\n';
- }
- });
-
- if (this._showStatus && this._aggregatedResults) {
- content += '\n' + getSummary(
- this._aggregatedResults,
- {
- estimatedTime: this._estimatedTime,
- roundTime: true,
- width });
-
-
- }
-
- let height = 0;
-
- for (let i = 0; i < content.length; i++) {
- if (content[i] === '\n') {
- height++;
- }
- }
-
- const clear = '\r\x1B[K\r\x1B[1A'.repeat(height);
- return this._cache = { clear, content };
- }
-
- _emit() {
- this._cache = null;
- this._lastUpdated = Date.now();
- this._callback();
- }
-
- _debouncedEmit() {
- if (!this._emitScheduled) {
- // Perf optimization to avoid two separate renders When
- // one test finishes and another test starts executing.
- this._emitScheduled = true;
- setTimeout(() => {
- this._emit();
- this._emitScheduled = false;
- }, 100);
- }
- }
-
- _tick() {
- this._debouncedEmit();
- }}
-
-
-
-module.exports = Status;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/SummaryReporter.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/SummaryReporter.js
deleted file mode 100644
index e0493f29f..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/SummaryReporter.js
+++ /dev/null
@@ -1,222 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-const BaseReporter = require('./BaseReporter');var _require =
-
-require('./utils');const getSummary = _require.getSummary,pluralize = _require.pluralize;
-const chalk = require('chalk');
-const getResultHeader = require('./getResultHeader');
-
-const ARROW = ' \u203A ';
-const FAIL_COLOR = chalk.bold.red;
-const SNAPSHOT_ADDED = chalk.bold.green;
-const SNAPSHOT_NOTE = chalk.dim;
-const SNAPSHOT_REMOVED = chalk.bold.red;
-const SNAPSHOT_SUMMARY = chalk.bold;
-const SNAPSHOT_UPDATED = chalk.bold.green;
-const TEST_SUMMARY_THRESHOLD = 20;
-
-const NPM_EVENTS = new Set([
-'prepublish',
-'publish',
-'postpublish',
-'preinstall',
-'install',
-'postinstall',
-'preuninstall',
-'uninstall',
-'postuninstall',
-'preversion',
-'version',
-'postversion',
-'pretest',
-'test',
-'posttest',
-'prestop',
-'stop',
-'poststop',
-'prestart',
-'start',
-'poststart',
-'prerestart',
-'restart',
-'postrestart']);
-
-
-class SummareReporter extends BaseReporter {
-
-
-
- constructor() {
- super();
- this._estimatedTime = 0;
- }
-
- // If we write more than one character at a time it is possible that
- // Node.js exits in the middle of printing the result. This was first observed
- // in Node.js 0.10 and still persists in Node.js 6.7+.
- // Let's print the test failure summary character by character which is safer
- // when hundreds of tests are failing.
- _write(string) {
- for (let i = 0; i < string.length; i++) {
- process.stderr.write(string.charAt(i));
- }
- }
-
- onRunStart(
- config,
- aggregatedResults,
- runnerContext,
- options)
- {
- super.onRunStart(config, aggregatedResults, runnerContext, options);
- this._estimatedTime = options.estimatedTime;
- }
-
- onRunComplete(
- config,
- aggregatedResults,
- runnerContext)
- {const
- numTotalTestSuites = aggregatedResults.numTotalTestSuites,testResults = aggregatedResults.testResults,wasInterrupted = aggregatedResults.wasInterrupted;
- if (numTotalTestSuites) {
- const lastResult = testResults[testResults.length - 1];
- // Print a newline if the last test did not fail to line up newlines
- // similar to when an error would have been thrown in the test.
- if (
- !config.verbose &&
- lastResult &&
- !lastResult.numFailingTests &&
- !lastResult.testExecError)
- {
- this.log('');
- }
-
- this._printSummary(aggregatedResults, config);
- this._printSnapshotSummary(aggregatedResults.snapshot, config);
-
- if (numTotalTestSuites) {
- const testSummary = wasInterrupted ?
- chalk.bold.red('Test run was interrupted.') :
- runnerContext.getTestSummary();
- this.log(
- getSummary(aggregatedResults, {
- estimatedTime: this._estimatedTime }) +
- '\n' + testSummary);
-
- }
- }
- }
-
- _printSnapshotSummary(snapshots, config) {
- if (
- snapshots.added ||
- snapshots.filesRemoved ||
- snapshots.unchecked ||
- snapshots.unmatched ||
- snapshots.updated)
- {
- let updateCommand;
- const event = process.env.npm_lifecycle_event;
- const prefix = NPM_EVENTS.has(event) ? '' : 'run ';
- if (config.watch) {
- updateCommand = 'press `u`';
- } else if (event) {
- updateCommand = `run with \`npm ${ prefix + event } -- -u\``;
- } else {
- updateCommand = 're-run with `-u`';
- }
-
- this.log(SNAPSHOT_SUMMARY('Snapshot Summary'));
- if (snapshots.added) {
- this.log(
- SNAPSHOT_ADDED(ARROW + pluralize('snapshot', snapshots.added)) +
- ` written in ${ pluralize('test suite', snapshots.filesAdded) }.`);
-
- }
-
- if (snapshots.unmatched) {
- this.log(
- FAIL_COLOR(ARROW + pluralize('snapshot test', snapshots.unmatched)) +
- ` failed in ${ pluralize('test suite', snapshots.filesUnmatched) }. ` +
- SNAPSHOT_NOTE(
- 'Inspect your code changes or ' +
- updateCommand + ' to update them.'));
-
-
- }
-
- if (snapshots.updated) {
- this.log(
- SNAPSHOT_UPDATED(ARROW + pluralize('snapshot', snapshots.updated)) +
- ` updated in ${ pluralize('test suite', snapshots.filesUpdated) }.`);
-
- }
-
- if (snapshots.filesRemoved) {
- this.log(
- SNAPSHOT_REMOVED(ARROW + pluralize(
- 'obsolete snapshot file',
- snapshots.filesRemoved)) + (
-
- snapshots.didUpdate ?
- ' removed.' :
- ' found, ' + updateCommand + ' to remove ' + (
- snapshots.filesRemoved === 1 ? 'it' : 'them.') + '.'));
-
- }
-
- if (snapshots.unchecked) {
- this.log(
- FAIL_COLOR(ARROW + pluralize(
- 'obsolete snapshot',
- snapshots.unchecked)) + (
-
- snapshots.didUpdate ?
- ' removed.' :
- ' found, ' + updateCommand + ' to remove ' + (
- snapshots.filesRemoved === 1 ? 'it' : 'them') + '.'));
-
- }
-
- this.log(''); // print empty line
- }
- }
-
- _printSummary(aggregatedResults, config) {
- // If there were any failing tests and there was a large number of tests
- // executed, re-print the failing results at the end of execution output.
- const failedTests = aggregatedResults.numFailedTests;
- const runtimeErrors = aggregatedResults.numRuntimeErrorTestSuites;
- if (
- failedTests + runtimeErrors > 0 &&
- aggregatedResults.numTotalTestSuites > TEST_SUMMARY_THRESHOLD)
- {
- this.log(chalk.bold('Summary of all failing tests'));
- aggregatedResults.testResults.forEach(testResult => {const
- failureMessage = testResult.failureMessage;
- if (failureMessage) {
- this._write(
- getResultHeader(testResult, config) + '\n' +
- failureMessage + '\n');
-
- }
- });
- this.log(''); // print empty line
- }
- }}
-
-
-module.exports = SummareReporter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/VerboseReporter.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/VerboseReporter.js
deleted file mode 100644
index 00c51386a..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/VerboseReporter.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-
-
-
-
-const DefaultReporter = require('./DefaultReporter');
-const chalk = require('chalk');
-const isWindows = process.platform === 'win32';
-
-class VerboseReporter extends DefaultReporter {
-
- static groupTestsBySuites(testResults) {
- const root = { suites: [], tests: [], title: '' };
- testResults.forEach(testResult => {
- let targetSuite = root;
-
- // Find the target suite for this test,
- // creating nested suites as necessary.
- for (const title of testResult.ancestorTitles) {
- let matchingSuite = targetSuite.suites.find(s => s.title === title);
- if (!matchingSuite) {
- matchingSuite = { suites: [], tests: [], title };
- targetSuite.suites.push(matchingSuite);
- }
- targetSuite = matchingSuite;
- }
-
- targetSuite.tests.push(testResult);
- });
- return root;
- }
-
- onTestResult(
- config,
- result,
- aggregatedResults)
- {
- super.onTestResult(config, result, aggregatedResults);
- if (!result.testExecError && !result.skipped) {
- this._logTestResults(result.testResults);
- }
- }
-
- _logTestResults(testResults) {
- this._logSuite(VerboseReporter.groupTestsBySuites(testResults), 0);
- this._logLine();
- }
-
- _logSuite(suite, indentLevel) {
- if (suite.title) {
- this._logLine(suite.title, indentLevel);
- }
-
- suite.tests.forEach(test => this._logTest(test, indentLevel + 1));
- suite.suites.forEach(suite => this._logSuite(suite, indentLevel + 1));
- }
-
- _getIcon(status) {
- if (status === 'failed') {
- return chalk.red(isWindows ? '\u00D7' : '\u2715');
- } else if (status === 'pending') {
- return chalk.yellow('\u25CB');
- } else {
- return chalk.green(isWindows ? '\u221A' : '\u2713');
- }
- }
-
- _logTest(test, indentLevel) {
- const status = this._getIcon(test.status);
- const time = test.duration ?
- ` (${ test.duration.toFixed(0) }ms)` :
- '';
- this._logLine(status + ' ' + chalk.dim(test.title + time), indentLevel);
- }
-
- _logLine(str, indentLevel) {
- const indentation = ' '.repeat(indentLevel || 0);
- this.log(indentation + (str || ''));
- }}
-
-
-
-module.exports = VerboseReporter;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/getConsoleOutput.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/getConsoleOutput.js
deleted file mode 100644
index 15d43eaf2..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/getConsoleOutput.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-const chalk = require('chalk');
-const path = require('path');
-
-module.exports = (root, verbose, buffer) => {
- const TITLE_INDENT = verbose ? ' ' : ' ';
- const CONSOLE_INDENT = TITLE_INDENT + ' ';
-
- return buffer.reduce((output, _ref) => {let type = _ref.type,message = _ref.message,origin = _ref.origin;
- origin = path.relative(root, origin);
- message = message.
- split(/\n/).
- map(line => CONSOLE_INDENT + line).
- join('\n');
-
- let typeMessage = 'console.' + type;
- if (type === 'warn') {
- message = chalk.yellow(message);
- typeMessage = chalk.yellow(typeMessage);
- } else if (type === 'error') {
- message = chalk.red(message);
- typeMessage = chalk.red(typeMessage);
- }
-
- return (
- output + TITLE_INDENT + chalk.dim(typeMessage) +
- ' ' + chalk.dim(origin) + '\n' + message + '\n');
-
- }, '');
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/getResultHeader.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/getResultHeader.js
deleted file mode 100644
index 1645fac5c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/getResultHeader.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';var _require =
-
-
-
-
-require('./utils');const formatTestPath = _require.formatTestPath;
-const chalk = require('chalk');
-
-const LONG_TEST_COLOR = chalk.reset.bold.bgRed;
-// Explicitly reset for these messages since they can get written out in the
-// middle of error logging
-const FAIL = chalk.reset.inverse.bold.red(' FAIL ');
-const PASS = chalk.reset.inverse.bold.green(' PASS ');
-
-module.exports = (result, config) => {
- const testPath = result.testFilePath;
- const status = result.numFailingTests > 0 || result.testExecError ?
- FAIL :
- PASS;
-
- const runTime = result.perfStats ?
- (result.perfStats.end - result.perfStats.start) / 1000 :
- null;
-
- const testDetail = [];
- if (runTime !== null && runTime > 5) {
- testDetail.push(LONG_TEST_COLOR(runTime + 's'));
- }
-
- if (result.memoryUsage) {
- const toMB = bytes => Math.floor(bytes / 1024 / 1024);
- testDetail.push(`${ toMB(result.memoryUsage) } MB heap size`);
- }
-
- return (
- `${ status } ${ formatTestPath(config, testPath) }` + (
- testDetail.length ? ` (${ testDetail.join(', ') })` : ''));
-
-};
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/utils.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/utils.js
deleted file mode 100644
index 37c5611b0..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/reporters/utils.js
+++ /dev/null
@@ -1,262 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-
-'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();
-
-
-
-
-const chalk = require('chalk');
-const path = require('path');
-
-
-
-
-
-
-
-const PROGRESS_BAR_WIDTH = 40;
-
-const trimAndFormatPath = (
-pad,
-config,
-testPath,
-columns) =>
-{
- const maxLength = columns - pad;
- const relative = relativePath(config, testPath);const
- basename = relative.basename;let
- dirname = relative.dirname;
-
- // length is ok
- if ((dirname + path.sep + basename).length <= maxLength) {
- return chalk.dim(dirname + path.sep) + chalk.bold(basename);
- }
-
- // we can fit trimmed dirname and full basename
- const basenameLength = basename.length;
- if (basenameLength + 4 < maxLength) {
- const dirnameLength = maxLength - 4 - basenameLength;
- dirname = '...' +
- dirname.slice(dirname.length - dirnameLength, dirname.length);
- return chalk.dim(dirname + path.sep) + chalk.bold(basename);
- }
-
- if (basenameLength + 4 === maxLength) {
- return chalk.dim('...' + path.sep) + chalk.bold(basename);
- }
-
- // can't fit dirname, but can fit trimmed basename
- return chalk.bold(
- '...' +
- basename.slice(basename.length - maxLength - 4, basename.length));
-
-};
-
-const formatTestPath = (config, testPath) => {var _relativePath =
- relativePath(config, testPath);const dirname = _relativePath.dirname,basename = _relativePath.basename;
- return chalk.dim(dirname + path.sep) + chalk.bold(basename);
-};
-
-const relativePath = (config, testPath) => {
- testPath = path.relative(config.rootDir, testPath);
- const dirname = path.dirname(testPath);
- const basename = path.basename(testPath);
- return { basename, dirname };
-};
-
-const pluralize = (word, count) =>
-`${ count } ${ word }${ count === 1 ? '' : 's' }`;
-
-const getSummary = (
-aggregatedResults,
-options) =>
-{
- let runTime = (Date.now() - aggregatedResults.startTime) / 1000;
- if (options && options.roundTime) {
- runTime = Math.floor(runTime);
- }
-
- const estimatedTime = options && options.estimatedTime || 0;
- const snapshotResults = aggregatedResults.snapshot;
- const snapshotsAdded = snapshotResults.added;
- const snapshotsFailed = snapshotResults.unmatched;
- const snapshotsPassed = snapshotResults.matched;
- const snapshotsTotal = snapshotResults.total;
- const snapshotsUpdated = snapshotResults.updated;
- const suitesFailed = aggregatedResults.numFailedTestSuites;
- const suitesPassed = aggregatedResults.numPassedTestSuites;
- const suitesPending = aggregatedResults.numPendingTestSuites;
- const suitesRun = suitesFailed + suitesPassed;
- const suitesTotal = aggregatedResults.numTotalTestSuites;
- const testsFailed = aggregatedResults.numFailedTests;
- const testsPassed = aggregatedResults.numPassedTests;
- const testsPending = aggregatedResults.numPendingTests;
- const testsTotal = aggregatedResults.numTotalTests;
- const width = options && options.width || 0;
-
- const suites =
- chalk.bold('Test Suites: ') + (
- suitesFailed ? chalk.bold.red(`${ suitesFailed } failed`) + ', ' : '') + (
- suitesPending ?
- chalk.bold.yellow(`${ suitesPending } skipped`) + ', ' :
- '') + (
-
- suitesPassed ?
- chalk.bold.green(`${ suitesPassed } passed`) + ', ' :
- '') + (
-
- suitesRun !== suitesTotal ?
- suitesRun + ' of ' + suitesTotal :
- suitesTotal) +
- ` total`;
-
- const tests =
- chalk.bold('Tests: ') + (
- testsFailed ? chalk.bold.red(`${ testsFailed } failed`) + ', ' : '') + (
- testsPending ?
- chalk.bold.yellow(`${ testsPending } skipped`) + ', ' :
- '') + (
-
- testsPassed ?
- chalk.bold.green(`${ testsPassed } passed`) + ', ' :
- '') +
-
- `${ testsTotal } total`;
-
- const snapshots =
- chalk.bold('Snapshots: ') + (
- snapshotsFailed ?
- chalk.bold.red(`${ snapshotsFailed } failed`) + ', ' :
- '') + (
-
- snapshotsUpdated ?
- chalk.bold.green(`${ snapshotsUpdated } updated`) + ', ' :
- '') + (
-
- snapshotsAdded ?
- chalk.bold.green(`${ snapshotsAdded } added`) + ', ' :
- '') + (
-
- snapshotsPassed ?
- chalk.bold.green(`${ snapshotsPassed } passed`) + ', ' :
- '') +
-
- `${ snapshotsTotal } total`;
-
- const time = renderTime(runTime, estimatedTime, width);
- return [suites, tests, snapshots, time].join('\n');
-};
-
-const renderTime = (
-runTime,
-estimatedTime,
-width) =>
-{
- // If we are more than one second over the estimated time, highlight it.
- const renderedTime = estimatedTime && runTime >= estimatedTime + 1 ?
- chalk.bold.yellow(runTime + 's') :
- runTime + 's';
- let time = chalk.bold(`Time:`) + ` ${ renderedTime }`;
- if (runTime < estimatedTime) {
- time += `, estimated ${ estimatedTime }s`;
- }
-
- // Only show a progress bar if the test run is actually going to take
- // some time.
- if (
- estimatedTime > 2 &&
- runTime < estimatedTime &&
- width)
- {
- const availableWidth = Math.min(PROGRESS_BAR_WIDTH, width);
- const length = Math.min(
- Math.floor(runTime / estimatedTime * availableWidth),
- availableWidth);
-
- if (availableWidth >= 2) {
- time +=
- '\n' +
- chalk.green.inverse(' ').repeat(length) +
- chalk.white.inverse(' ').repeat(availableWidth - length);
- }
- }
- return time;
-};
-
-// word-wrap a string that contains ANSI escape sequences.
-// ANSI escape sequences do not add to the string length.
-const wrapAnsiString = (string, terminalWidth) => {
- if (terminalWidth === 0) {
- // if the terminal width is zero, don't bother word-wrapping
- return string;
- }
-
- const ANSI_REGEXP = /[\u001b\u009b]\[\d{1,2}m/g;
- const tokens = [];
- let lastIndex = 0;
- let match;
-
- while (match = ANSI_REGEXP.exec(string)) {
- const ansi = match[0];
- const index = match['index'];
- if (index != lastIndex) {
- tokens.push(['string', string.slice(lastIndex, index)]);
- }
- tokens.push(['ansi', ansi]);
- lastIndex = index + ansi.length;
- }
-
- if (lastIndex != string.length - 1) {
- tokens.push(['string', string.slice(lastIndex, string.length)]);
- }
-
- let lastLineLength = 0;
-
- return tokens.reduce(
- (lines, _ref) => {var _ref2 = _slicedToArray(_ref, 2);let kind = _ref2[0],token = _ref2[1];
- if (kind === 'string') {
- if (lastLineLength + token.length > terminalWidth) {
-
- while (token.length) {
- const chunk = token.slice(0, terminalWidth - lastLineLength);
- const remaining = token.slice(
- terminalWidth - lastLineLength,
- token.length);
-
- lines[lines.length - 1] += chunk;
- lastLineLength += chunk.length;
- token = remaining;
- if (token.length) {
- lines.push('');
- lastLineLength = 0;
- }
- }
- } else {
- lines[lines.length - 1] += token;
- lastLineLength += token.length;
- }
- } else {
- lines[lines.length - 1] += token;
- }
-
- return lines;
- },
- ['']).
- join('\n');
-};
-
-module.exports = {
- formatTestPath,
- getSummary,
- pluralize,
- relativePath,
- trimAndFormatPath,
- wrapAnsiString };
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/runTest.js b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/runTest.js
deleted file mode 100644
index 20cf032fa..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/build/runTest.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- *
- */
-'use strict';
-
-
-
-
-
-const BufferedConsole = require('./lib/BufferedConsole');
-const Console = require('jest-util').Console;
-const NullConsole = require('jest-util').NullConsole;
-
-const getConsoleOutput = require('./reporters/getConsoleOutput');
-
-function runTest(path, config, resolver) {
- /* $FlowFixMe */
- const TestEnvironment = require(config.testEnvironment);
- /* $FlowFixMe */
- const TestRunner = require(config.testRunner);
- /* $FlowFixMe */
- const ModuleLoader = require(config.moduleLoader || 'jest-runtime');
-
- const env = new TestEnvironment(config);
- const TestConsole =
- config.verbose ?
- Console :
- config.silent ?
- NullConsole :
- BufferedConsole;
-
- const testConsole = env.global.console = new TestConsole(
- config.useStderr ? process.stderr : process.stdout,
- process.stderr,
- (type, message) => getConsoleOutput(
- config.rootDir,
- !!config.verbose,
- // 4 = the console call is burried 4 stack frames deep
- BufferedConsole.write([], type, message, 4)));
-
-
- const runtime = new ModuleLoader(config, env, resolver);
- const start = Date.now();
- return TestRunner(config, env, runtime, path).
- then(result => {
- const testCount =
- result.numPassingTests +
- result.numFailingTests +
- result.numPendingTests;
- result.perfStats = { end: Date.now(), start };
- result.testFilePath = path;
- result.coverage = runtime.getAllCoverageInfo();
- result.console = testConsole.getBuffer();
- result.skipped = testCount === result.numPendingTests;
- return result;
- }).
- then(
- result => Promise.resolve().then(() => {
- env.dispose();
- if (config.logHeapUsage) {
- if (global.gc) {
- global.gc();
- }
- result.memoryUsage = process.memoryUsage().heapUsed;
- }
- return result;
- }),
- err => Promise.resolve().then(() => {
- env.dispose();
- throw err;
- }));
-
-}
-
-module.exports = runTest;
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/package.json b/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/package.json
deleted file mode 100644
index 6dd1d284a..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/node_modules/jest-cli/package.json
+++ /dev/null
@@ -1,138 +0,0 @@
-{
- "_args": [
- [
- "jest-cli@^17.0.3",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest"
- ]
- ],
- "_from": "jest-cli@>=17.0.3 <18.0.0",
- "_id": "jest-cli@17.0.3",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest/jest-cli",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-18-east.internal.npmjs.com",
- "tmp": "tmp/jest-cli-17.0.3.tgz_1479368471902_0.6936498954892159"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {},
- "_requested": {
- "name": "jest-cli",
- "raw": "jest-cli@^17.0.3",
- "rawSpec": "^17.0.3",
- "scope": null,
- "spec": ">=17.0.3 <18.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/jest"
- ],
- "_resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-17.0.3.tgz",
- "_shasum": "700b8c02a9ea0ec9eab0cd5a9fd42d8a858ce146",
- "_shrinkwrap": null,
- "_spec": "jest-cli@^17.0.3",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/jest",
- "bin": {
- "jest": "./bin/jest.js"
- },
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "ansi-escapes": "^1.4.0",
- "callsites": "^2.0.0",
- "chalk": "^1.1.1",
- "graceful-fs": "^4.1.6",
- "is-ci": "^1.0.9",
- "istanbul-api": "^1.0.0-aplha.10",
- "istanbul-lib-coverage": "^1.0.0",
- "istanbul-lib-instrument": "^1.1.1",
- "jest-changed-files": "^17.0.2",
- "jest-config": "^17.0.3",
- "jest-environment-jsdom": "^17.0.2",
- "jest-file-exists": "^17.0.0",
- "jest-haste-map": "^17.0.3",
- "jest-jasmine2": "^17.0.3",
- "jest-mock": "^17.0.2",
- "jest-resolve": "^17.0.3",
- "jest-resolve-dependencies": "^17.0.3",
- "jest-runtime": "^17.0.3",
- "jest-snapshot": "^17.0.3",
- "jest-util": "^17.0.2",
- "json-stable-stringify": "^1.0.0",
- "node-notifier": "^4.6.1",
- "sane": "~1.4.1",
- "strip-ansi": "^3.0.1",
- "throat": "^3.0.0",
- "which": "^1.1.1",
- "worker-farm": "^1.3.1",
- "yargs": "^6.3.0"
- },
- "description": "Painless JavaScript Testing.",
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "700b8c02a9ea0ec9eab0cd5a9fd42d8a858ce146",
- "tarball": "https://registry.npmjs.org/jest-cli/-/jest-cli-17.0.3.tgz"
- },
- "engines": {
- "node": ">= 4"
- },
- "homepage": "http://facebook.github.io/jest/",
- "keywords": [
- "facebook",
- "jest",
- "test",
- "unit",
- "jasmine",
- "mock"
- ],
- "license": "BSD-3-Clause",
- "main": "build/jest.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- },
- {
- "email": "lbljeffmo@gmail.com",
- "name": "jeffmo"
- },
- {
- "email": "kentaromiura@gmail.com",
- "name": "kentaromiura"
- },
- {
- "email": "paul@oshannessy.com",
- "name": "zpao"
- }
- ],
- "name": "jest-cli",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {
- "test": "./bin/jest.js"
- },
- "version": "17.0.3"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jest/package.json b/fundamentals/bug-challenge-es6/node_modules/jest/package.json
deleted file mode 100644
index e1584349a..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jest/package.json
+++ /dev/null
@@ -1,126 +0,0 @@
-{
- "_args": [
- [
- "jest",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6"
- ]
- ],
- "_from": "jest@latest",
- "_id": "jest@17.0.3",
- "_inCache": true,
- "_installable": true,
- "_location": "/jest",
- "_nodeVersion": "7.1.0",
- "_npmOperationalInternal": {
- "host": "packages-18-east.internal.npmjs.com",
- "tmp": "tmp/jest-17.0.3.tgz_1479368471486_0.3772578139323741"
- },
- "_npmUser": {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- "_npmVersion": "3.10.9",
- "_phantomChildren": {
- "ansi-escapes": "1.4.0",
- "callsites": "2.0.0",
- "chalk": "1.1.3",
- "graceful-fs": "4.1.11",
- "is-ci": "1.0.10",
- "istanbul-api": "1.0.0-aplha.10",
- "istanbul-lib-coverage": "1.0.0",
- "istanbul-lib-instrument": "1.3.0",
- "jest-changed-files": "17.0.2",
- "jest-config": "17.0.3",
- "jest-environment-jsdom": "17.0.2",
- "jest-file-exists": "17.0.0",
- "jest-haste-map": "17.0.3",
- "jest-jasmine2": "17.0.3",
- "jest-mock": "17.0.2",
- "jest-resolve": "17.0.3",
- "jest-resolve-dependencies": "17.0.3",
- "jest-runtime": "17.0.3",
- "jest-snapshot": "17.0.3",
- "jest-util": "17.0.2",
- "json-stable-stringify": "1.0.1",
- "node-notifier": "4.6.1",
- "sane": "1.4.1",
- "strip-ansi": "3.0.1",
- "throat": "3.0.0",
- "which": "1.2.12",
- "worker-farm": "1.3.1",
- "yargs": "6.4.0"
- },
- "_requested": {
- "name": "jest",
- "raw": "jest",
- "rawSpec": "",
- "scope": null,
- "spec": "latest",
- "type": "tag"
- },
- "_requiredBy": [
- "#DEV:/"
- ],
- "_resolved": "https://registry.npmjs.org/jest/-/jest-17.0.3.tgz",
- "_shasum": "89c43b30b0aaad42462e9ea701352dacbad4a354",
- "_shrinkwrap": null,
- "_spec": "jest",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6",
- "bin": {
- "jest": "./bin/jest.js"
- },
- "bugs": {
- "url": "https://github.com/facebook/jest/issues"
- },
- "dependencies": {
- "jest-cli": "^17.0.3"
- },
- "description": "Painless JavaScript Testing.",
- "devDependencies": {},
- "directories": {},
- "dist": {
- "shasum": "89c43b30b0aaad42462e9ea701352dacbad4a354",
- "tarball": "https://registry.npmjs.org/jest/-/jest-17.0.3.tgz"
- },
- "engines": {
- "node": ">= 4"
- },
- "homepage": "https://github.com/facebook/jest#readme",
- "license": "BSD-3-Clause",
- "main": "build/jest.js",
- "maintainers": [
- {
- "email": "christoph.pojer@gmail.com",
- "name": "cpojer"
- },
- {
- "email": "dmitrii@rheia.us",
- "name": "dmitriiabramov"
- },
- {
- "email": "opensource+npm@fb.com",
- "name": "fb"
- },
- {
- "email": "dan.abramov@gmail.com",
- "name": "gaearon"
- },
- {
- "email": "kentaromiura@gmail.com",
- "name": "kentaromiura"
- },
- {
- "email": "me@refack.com",
- "name": "refack"
- }
- ],
- "name": "jest",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/facebook/jest.git"
- },
- "scripts": {},
- "version": "17.0.3"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/.npmignore b/fundamentals/bug-challenge-es6/node_modules/jodid25519/.npmignore
deleted file mode 100644
index 877830c06..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/.npmignore
+++ /dev/null
@@ -1,11 +0,0 @@
-# Editor, IDE and dev environment stuff
-*~
-.project
-.settings
-
-# Build files and directories
-/coverage
-/doc/api
-/build/
-/test/
-/jodid25519-*.tgz
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/.travis.yml b/fundamentals/bug-challenge-es6/node_modules/jodid25519/.travis.yml
deleted file mode 100644
index 92a990f67..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: node_js
-node_js:
- - "0.10"
- - "0.11"
-branches:
- only:
- - master
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/AUTHORS.md b/fundamentals/bug-challenge-es6/node_modules/jodid25519/AUTHORS.md
deleted file mode 100644
index 0c1709737..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/AUTHORS.md
+++ /dev/null
@@ -1,3 +0,0 @@
-* Michele Bini (original Curve25519 core code: curve25519.js)
-* Ron Garret (original Ed25519 code: fast-djbec.js)
-* Guy Kloss (package refactoring, unit testing)
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/LICENSE b/fundamentals/bug-challenge-es6/node_modules/jodid25519/LICENSE
deleted file mode 100644
index c722113b2..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/LICENSE
+++ /dev/null
@@ -1,23 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2012 Ron Garret
-Copyright (c) 2007, 2013, 2014 Michele Bini
-Copyright (c) 2014 Mega Limited
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/README.md b/fundamentals/bug-challenge-es6/node_modules/jodid25519/README.md
deleted file mode 100644
index 5335b2dec..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/README.md
+++ /dev/null
@@ -1,51 +0,0 @@
-Jodid25519 [](https://travis-ci.org/meganz/jodid25519)
-===================================================================================================================================
-
-Javascript implementation of the Curve25519 and Ed25519 elliptic cryptography functions by Daniel J. Bernstein.
-
-For the API, please consult the generated documentation under doc/ (you can run `make` to generate it).
-
-To run the tests do the following on the console from the project's root directory:
-
- $ npm install
- $ make test
-
-
-Contributors
-------------
-
-If you are one of the contributors and want to add yourself or change the information here, please do submit a pull request. Contributors appear in no particular order.
-
-### For the Curve25519 submodule
-
-* [Graydon Hoare](https://github.com/graydon): suggested clamping the private key by default for increased safety and uniformity with other implementations.
-* [liliakai](https://github.com/liliakai): spotted an unused argument in some of the functions
-* [RyanC](https://github.com/ryancdotorg): removed dependency of a function to the Javascript Math library
-* [Guy Kloss](https://github.com/pohutukawa): performance improvements through bit-shift operations, performance and conformance testing, documentation, compatibility with the npm package ecosystem, and more
-* [Michele Bini](https://github.com/rev22): originally wrote the Javascript implementation
-
-
-Copyright and MIT licensing
----------------------------
-
-* Copyright (c) 2012 Ron Garret
-* Copyright (c) 2007, 2013, 2014 Michele Bini
-* Copyright (c) 2014 Mega Limited
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/almond.0 b/fundamentals/bug-challenge-es6/node_modules/jodid25519/almond.0
deleted file mode 100644
index 55ffcc47c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/almond.0
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Curve 25519-based cryptography collection.
- *
- * EC Diffie-Hellman (ECDH) based on Curve25519 and digital signatures (EdDSA)
- * based on Ed25519.
- *
- * Copyright (c) 2012 Ron Garret
- * Copyright (c) 2007, 2013, 2014 Michele Bini
- * Copyright (c) 2014 Mega Limited
- * under the MIT License.
- *
- * You should have received a copy of the license along with this program.
- */
-// See https://github.com/jrburke/almond#exporting-a-public-api
-(function (root, factory) {
- if (typeof define === 'function' && define.amd) {
- // Allow using this built library as an AMD module
- // in another project. That other project will only
- // see this AMD call, not the internal modules in
- // the closure below.
- define([], factory);
- } else if (typeof module === 'object' && module.exports) {
- // Allow using this built library as a CommonJS module
- module.exports = factory();
- } else {
- // Browser globals case. Just assign the
- // result to a property on the global.
- root.jodid25519 = factory();
- }
-}(this, function () {
- if (typeof module === 'object' && module.exports) {
- // If we're running under CommonJS, our dependencies get confused and
- // each clobber module.exports which leads to bad behaviour because
- // almond does asynchronous loading. So just pretend we're in the
- // browser globals case, and make them write to those values instead.
- // TODO: ditch requirejs/almond and use browserify or something.
- var __oldModule = module;
- var __oldExports = exports;
- var window = global;
- module = undefined;
- exports = undefined;
- }
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/almond.1 b/fundamentals/bug-challenge-es6/node_modules/jodid25519/almond.1
deleted file mode 100644
index cdb5e6728..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/almond.1
+++ /dev/null
@@ -1,13 +0,0 @@
- if (typeof module === 'object' && module.exports) {
- // Restore CommonJS exports once our dependencies have all finished
- // loading.
- module = __oldModule;
- exports = __oldExports;
- }
- // The modules for your project will be inlined above
- // this snippet. Ask almond to synchronously require the
- // module value for 'main' here and return it as the
- // value to use for the public API for the built file.
- return require('jodid25519');
-}));
-// See https://github.com/jrburke/almond#exporting-a-public-api
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/index.js b/fundamentals/bug-challenge-es6/node_modules/jodid25519/index.js
deleted file mode 100644
index 870983984..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/index.js
+++ /dev/null
@@ -1,35 +0,0 @@
-"use strict";
-
-/*
- * Copyright (c) 2014 Mega Limited
- * under the MIT License.
- *
- * Authors: Guy K. Kloss
- *
- * You should have received a copy of the license along with this program.
- */
-
-var dh = require('./lib/dh');
-var eddsa = require('./lib/eddsa');
-var curve255 = require('./lib/curve255');
-var utils = require('./lib/utils');
-
- /**
- * @exports jodid25519
- * Curve 25519-based cryptography collection.
- *
- * @description
- * EC Diffie-Hellman (ECDH) based on Curve25519 and digital signatures
- * (EdDSA) based on Ed25519.
- */
- var ns = {};
-
- /** Module version indicator as string (format: [major.minor.patch]). */
- ns.VERSION = '0.7.1';
-
- ns.dh = dh;
- ns.eddsa = eddsa;
- ns.curve255 = curve255;
- ns.utils = utils;
-
-module.exports = ns;
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/jsdoc.json b/fundamentals/bug-challenge-es6/node_modules/jodid25519/jsdoc.json
deleted file mode 100644
index 21eba9bd6..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/jsdoc.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "templates": {
- "applicationName": "jodid25519 Library",
- "disqus": "",
- "googleAnalytics": "",
- "openGraph": {
- "title": "jodid25519 Library",
- "type": "website",
- "image": "",
- "site_name": "",
- "url": ""
- },
- "meta": {
- "title": "jodid25519 Library",
- "description": "",
- "keyword": ""
- }
- }
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/core.js b/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/core.js
deleted file mode 100644
index f78fd74dd..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/core.js
+++ /dev/null
@@ -1,481 +0,0 @@
-"use strict";
-/**
- * @fileOverview
- * Core operations on curve 25519 required for the higher level modules.
- */
-
-/*
- * Copyright (c) 2007, 2013, 2014 Michele Bini
- * Copyright (c) 2014 Mega Limited
- * under the MIT License.
- *
- * Authors: Guy K. Kloss, Michele Bini
- *
- * You should have received a copy of the license along with this program.
- */
-
-var crypto = require('crypto');
-
- /**
- * @exports jodid25519/core
- * Core operations on curve 25519 required for the higher level modules.
- *
- * @description
- * Core operations on curve 25519 required for the higher level modules.
- *
- *
- * This core code is extracted from Michele Bini's curve255.js implementation,
- * which is used as a base for Curve25519 ECDH and Ed25519 EdDSA operations.
- *
- */
- var ns = {};
-
- function _setbit(n, c, v) {
- var i = c >> 4;
- var a = n[i];
- a = a + (1 << (c & 0xf)) * v;
- n[i] = a;
- }
-
- function _getbit(n, c) {
- return (n[c >> 4] >> (c & 0xf)) & 1;
- }
-
- function _ZERO() {
- return [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- }
-
- function _ONE() {
- return [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- }
-
- // Basepoint.
- function _BASE() {
- return [9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- }
-
- // return -1, 0, +1 when a is less than, equal, or greater than b
- function _bigintcmp(a, b) {
- // The following code is a bit tricky to avoid code branching
- var c, abs_r, mask;
- var r = 0;
- for (c = 15; c >= 0; c--) {
- var x = a[c];
- var y = b[c];
- r = r + (x - y) * (1 - r * r);
- // http://graphics.stanford.edu/~seander/bithacks.html#IntegerAbs
- // correct for [-294967295, 294967295]
- mask = r >> 31;
- abs_r = (r + mask) ^ mask;
- // http://stackoverflow.com/questions/596467/how-do-i-convert-a-number-to-an-integer-in-javascript
- // this rounds towards zero
- r = ~~((r << 1) / (abs_r + 1));
- }
- return r;
- }
-
- function _bigintadd(a, b) {
- var r = [];
- var v;
- r[0] = (v = a[0] + b[0]) & 0xffff;
- r[1] = (v = (v >>> 16) + a[1] + b[1]) & 0xffff;
- r[2] = (v = (v >>> 16) + a[2] + b[2]) & 0xffff;
- r[3] = (v = (v >>> 16) + a[3] + b[3]) & 0xffff;
- r[4] = (v = (v >>> 16) + a[4] + b[4]) & 0xffff;
- r[5] = (v = (v >>> 16) + a[5] + b[5]) & 0xffff;
- r[6] = (v = (v >>> 16) + a[6] + b[6]) & 0xffff;
- r[7] = (v = (v >>> 16) + a[7] + b[7]) & 0xffff;
- r[8] = (v = (v >>> 16) + a[8] + b[8]) & 0xffff;
- r[9] = (v = (v >>> 16) + a[9] + b[9]) & 0xffff;
- r[10] = (v = (v >>> 16) + a[10] + b[10]) & 0xffff;
- r[11] = (v = (v >>> 16) + a[11] + b[11]) & 0xffff;
- r[12] = (v = (v >>> 16) + a[12] + b[12]) & 0xffff;
- r[13] = (v = (v >>> 16) + a[13] + b[13]) & 0xffff;
- r[14] = (v = (v >>> 16) + a[14] + b[14]) & 0xffff;
- r[15] = (v >>> 16) + a[15] + b[15];
- return r;
- }
-
- function _bigintsub(a, b) {
- var r = [];
- var v;
- r[0] = (v = 0x80000 + a[0] - b[0]) & 0xffff;
- r[1] = (v = (v >>> 16) + 0x7fff8 + a[1] - b[1]) & 0xffff;
- r[2] = (v = (v >>> 16) + 0x7fff8 + a[2] - b[2]) & 0xffff;
- r[3] = (v = (v >>> 16) + 0x7fff8 + a[3] - b[3]) & 0xffff;
- r[4] = (v = (v >>> 16) + 0x7fff8 + a[4] - b[4]) & 0xffff;
- r[5] = (v = (v >>> 16) + 0x7fff8 + a[5] - b[5]) & 0xffff;
- r[6] = (v = (v >>> 16) + 0x7fff8 + a[6] - b[6]) & 0xffff;
- r[7] = (v = (v >>> 16) + 0x7fff8 + a[7] - b[7]) & 0xffff;
- r[8] = (v = (v >>> 16) + 0x7fff8 + a[8] - b[8]) & 0xffff;
- r[9] = (v = (v >>> 16) + 0x7fff8 + a[9] - b[9]) & 0xffff;
- r[10] = (v = (v >>> 16) + 0x7fff8 + a[10] - b[10]) & 0xffff;
- r[11] = (v = (v >>> 16) + 0x7fff8 + a[11] - b[11]) & 0xffff;
- r[12] = (v = (v >>> 16) + 0x7fff8 + a[12] - b[12]) & 0xffff;
- r[13] = (v = (v >>> 16) + 0x7fff8 + a[13] - b[13]) & 0xffff;
- r[14] = (v = (v >>> 16) + 0x7fff8 + a[14] - b[14]) & 0xffff;
- r[15] = (v >>> 16) - 8 + a[15] - b[15];
- return r;
- }
-
- function _sqr8h(a7, a6, a5, a4, a3, a2, a1, a0) {
- // 'division by 0x10000' can not be replaced by '>> 16' because
- // more than 32 bits of precision are needed similarly
- // 'multiplication by 2' cannot be replaced by '<< 1'
- var r = [];
- var v;
- r[0] = (v = a0 * a0) & 0xffff;
- r[1] = (v = (0 | (v / 0x10000)) + 2 * a0 * a1) & 0xffff;
- r[2] = (v = (0 | (v / 0x10000)) + 2 * a0 * a2 + a1 * a1) & 0xffff;
- r[3] = (v = (0 | (v / 0x10000)) + 2 * a0 * a3 + 2 * a1 * a2) & 0xffff;
- r[4] = (v = (0 | (v / 0x10000)) + 2 * a0 * a4 + 2 * a1 * a3 + a2
- * a2) & 0xffff;
- r[5] = (v = (0 | (v / 0x10000)) + 2 * a0 * a5 + 2 * a1 * a4 + 2
- * a2 * a3) & 0xffff;
- r[6] = (v = (0 | (v / 0x10000)) + 2 * a0 * a6 + 2 * a1 * a5 + 2
- * a2 * a4 + a3 * a3) & 0xffff;
- r[7] = (v = (0 | (v / 0x10000)) + 2 * a0 * a7 + 2 * a1 * a6 + 2
- * a2 * a5 + 2 * a3 * a4) & 0xffff;
- r[8] = (v = (0 | (v / 0x10000)) + 2 * a1 * a7 + 2 * a2 * a6 + 2
- * a3 * a5 + a4 * a4) & 0xffff;
- r[9] = (v = (0 | (v / 0x10000)) + 2 * a2 * a7 + 2 * a3 * a6 + 2
- * a4 * a5) & 0xffff;
- r[10] = (v = (0 | (v / 0x10000)) + 2 * a3 * a7 + 2 * a4 * a6
- + a5 * a5) & 0xffff;
- r[11] = (v = (0 | (v / 0x10000)) + 2 * a4 * a7 + 2 * a5 * a6) & 0xffff;
- r[12] = (v = (0 | (v / 0x10000)) + 2 * a5 * a7 + a6 * a6) & 0xffff;
- r[13] = (v = (0 | (v / 0x10000)) + 2 * a6 * a7) & 0xffff;
- r[14] = (v = (0 | (v / 0x10000)) + a7 * a7) & 0xffff;
- r[15] = 0 | (v / 0x10000);
- return r;
- }
-
- function _sqrmodp(a) {
- var x = _sqr8h(a[15], a[14], a[13], a[12], a[11], a[10], a[9],
- a[8]);
- var z = _sqr8h(a[7], a[6], a[5], a[4], a[3], a[2], a[1], a[0]);
- var y = _sqr8h(a[15] + a[7], a[14] + a[6], a[13] + a[5], a[12]
- + a[4],
- a[11] + a[3], a[10] + a[2], a[9] + a[1], a[8]
- + a[0]);
- var r = [];
- var v;
- r[0] = (v = 0x800000 + z[0] + (y[8] - x[8] - z[8] + x[0] - 0x80)
- * 38) & 0xffff;
- r[1] = (v = 0x7fff80 + (v >>> 16) + z[1]
- + (y[9] - x[9] - z[9] + x[1]) * 38) & 0xffff;
- r[2] = (v = 0x7fff80 + (v >>> 16) + z[2]
- + (y[10] - x[10] - z[10] + x[2]) * 38) & 0xffff;
- r[3] = (v = 0x7fff80 + (v >>> 16) + z[3]
- + (y[11] - x[11] - z[11] + x[3]) * 38) & 0xffff;
- r[4] = (v = 0x7fff80 + (v >>> 16) + z[4]
- + (y[12] - x[12] - z[12] + x[4]) * 38) & 0xffff;
- r[5] = (v = 0x7fff80 + (v >>> 16) + z[5]
- + (y[13] - x[13] - z[13] + x[5]) * 38) & 0xffff;
- r[6] = (v = 0x7fff80 + (v >>> 16) + z[6]
- + (y[14] - x[14] - z[14] + x[6]) * 38) & 0xffff;
- r[7] = (v = 0x7fff80 + (v >>> 16) + z[7]
- + (y[15] - x[15] - z[15] + x[7]) * 38) & 0xffff;
- r[8] = (v = 0x7fff80 + (v >>> 16) + z[8] + y[0] - x[0] - z[0]
- + x[8] * 38) & 0xffff;
- r[9] = (v = 0x7fff80 + (v >>> 16) + z[9] + y[1] - x[1] - z[1]
- + x[9] * 38) & 0xffff;
- r[10] = (v = 0x7fff80 + (v >>> 16) + z[10] + y[2] - x[2] - z[2]
- + x[10] * 38) & 0xffff;
- r[11] = (v = 0x7fff80 + (v >>> 16) + z[11] + y[3] - x[3] - z[3]
- + x[11] * 38) & 0xffff;
- r[12] = (v = 0x7fff80 + (v >>> 16) + z[12] + y[4] - x[4] - z[4]
- + x[12] * 38) & 0xffff;
- r[13] = (v = 0x7fff80 + (v >>> 16) + z[13] + y[5] - x[5] - z[5]
- + x[13] * 38) & 0xffff;
- r[14] = (v = 0x7fff80 + (v >>> 16) + z[14] + y[6] - x[6] - z[6]
- + x[14] * 38) & 0xffff;
- r[15] = 0x7fff80 + (v >>> 16) + z[15] + y[7] - x[7] - z[7]
- + x[15] * 38;
- _reduce(r);
- return r;
- }
-
- function _mul8h(a7, a6, a5, a4, a3, a2, a1, a0, b7, b6, b5, b4, b3,
- b2, b1, b0) {
- // 'division by 0x10000' can not be replaced by '>> 16' because
- // more than 32 bits of precision are needed
- var r = [];
- var v;
- r[0] = (v = a0 * b0) & 0xffff;
- r[1] = (v = (0 | (v / 0x10000)) + a0 * b1 + a1 * b0) & 0xffff;
- r[2] = (v = (0 | (v / 0x10000)) + a0 * b2 + a1 * b1 + a2 * b0) & 0xffff;
- r[3] = (v = (0 | (v / 0x10000)) + a0 * b3 + a1 * b2 + a2 * b1
- + a3 * b0) & 0xffff;
- r[4] = (v = (0 | (v / 0x10000)) + a0 * b4 + a1 * b3 + a2 * b2
- + a3 * b1 + a4 * b0) & 0xffff;
- r[5] = (v = (0 | (v / 0x10000)) + a0 * b5 + a1 * b4 + a2 * b3
- + a3 * b2 + a4 * b1 + a5 * b0) & 0xffff;
- r[6] = (v = (0 | (v / 0x10000)) + a0 * b6 + a1 * b5 + a2 * b4
- + a3 * b3 + a4 * b2 + a5 * b1 + a6 * b0) & 0xffff;
- r[7] = (v = (0 | (v / 0x10000)) + a0 * b7 + a1 * b6 + a2 * b5
- + a3 * b4 + a4 * b3 + a5 * b2 + a6 * b1 + a7 * b0) & 0xffff;
- r[8] = (v = (0 | (v / 0x10000)) + a1 * b7 + a2 * b6 + a3 * b5
- + a4 * b4 + a5 * b3 + a6 * b2 + a7 * b1) & 0xffff;
- r[9] = (v = (0 | (v / 0x10000)) + a2 * b7 + a3 * b6 + a4 * b5
- + a5 * b4 + a6 * b3 + a7 * b2) & 0xffff;
- r[10] = (v = (0 | (v / 0x10000)) + a3 * b7 + a4 * b6 + a5 * b5
- + a6 * b4 + a7 * b3) & 0xffff;
- r[11] = (v = (0 | (v / 0x10000)) + a4 * b7 + a5 * b6 + a6 * b5
- + a7 * b4) & 0xffff;
- r[12] = (v = (0 | (v / 0x10000)) + a5 * b7 + a6 * b6 + a7 * b5) & 0xffff;
- r[13] = (v = (0 | (v / 0x10000)) + a6 * b7 + a7 * b6) & 0xffff;
- r[14] = (v = (0 | (v / 0x10000)) + a7 * b7) & 0xffff;
- r[15] = (0 | (v / 0x10000));
- return r;
- }
-
- function _mulmodp(a, b) {
- // Karatsuba multiplication scheme: x*y = (b^2+b)*x1*y1 -
- // b*(x1-x0)*(y1-y0) + (b+1)*x0*y0
- var x = _mul8h(a[15], a[14], a[13], a[12], a[11], a[10], a[9],
- a[8], b[15], b[14], b[13], b[12], b[11], b[10],
- b[9], b[8]);
- var z = _mul8h(a[7], a[6], a[5], a[4], a[3], a[2], a[1], a[0],
- b[7], b[6], b[5], b[4], b[3], b[2], b[1], b[0]);
- var y = _mul8h(a[15] + a[7], a[14] + a[6], a[13] + a[5], a[12]
- + a[4],
- a[11] + a[3], a[10] + a[2], a[9] + a[1], a[8]
- + a[0],
- b[15] + b[7], b[14] + b[6], b[13] + b[5], b[12]
- + b[4],
- b[11] + b[3], b[10] + b[2], b[9] + b[1], b[8]
- + b[0]);
- var r = [];
- var v;
- r[0] = (v = 0x800000 + z[0] + (y[8] - x[8] - z[8] + x[0] - 0x80)
- * 38) & 0xffff;
- r[1] = (v = 0x7fff80 + (v >>> 16) + z[1]
- + (y[9] - x[9] - z[9] + x[1]) * 38) & 0xffff;
- r[2] = (v = 0x7fff80 + (v >>> 16) + z[2]
- + (y[10] - x[10] - z[10] + x[2]) * 38) & 0xffff;
- r[3] = (v = 0x7fff80 + (v >>> 16) + z[3]
- + (y[11] - x[11] - z[11] + x[3]) * 38) & 0xffff;
- r[4] = (v = 0x7fff80 + (v >>> 16) + z[4]
- + (y[12] - x[12] - z[12] + x[4]) * 38) & 0xffff;
- r[5] = (v = 0x7fff80 + (v >>> 16) + z[5]
- + (y[13] - x[13] - z[13] + x[5]) * 38) & 0xffff;
- r[6] = (v = 0x7fff80 + (v >>> 16) + z[6]
- + (y[14] - x[14] - z[14] + x[6]) * 38) & 0xffff;
- r[7] = (v = 0x7fff80 + (v >>> 16) + z[7]
- + (y[15] - x[15] - z[15] + x[7]) * 38) & 0xffff;
- r[8] = (v = 0x7fff80 + (v >>> 16) + z[8] + y[0] - x[0] - z[0]
- + x[8] * 38) & 0xffff;
- r[9] = (v = 0x7fff80 + (v >>> 16) + z[9] + y[1] - x[1] - z[1]
- + x[9] * 38) & 0xffff;
- r[10] = (v = 0x7fff80 + (v >>> 16) + z[10] + y[2] - x[2] - z[2]
- + x[10] * 38) & 0xffff;
- r[11] = (v = 0x7fff80 + (v >>> 16) + z[11] + y[3] - x[3] - z[3]
- + x[11] * 38) & 0xffff;
- r[12] = (v = 0x7fff80 + (v >>> 16) + z[12] + y[4] - x[4] - z[4]
- + x[12] * 38) & 0xffff;
- r[13] = (v = 0x7fff80 + (v >>> 16) + z[13] + y[5] - x[5] - z[5]
- + x[13] * 38) & 0xffff;
- r[14] = (v = 0x7fff80 + (v >>> 16) + z[14] + y[6] - x[6] - z[6]
- + x[14] * 38) & 0xffff;
- r[15] = 0x7fff80 + (v >>> 16) + z[15] + y[7] - x[7] - z[7]
- + x[15] * 38;
- _reduce(r);
- return r;
- }
-
- function _reduce(arr) {
- var aCopy = arr.slice(0);
- var choice = [arr, aCopy];
- var v = arr[15];
- // Use the dummy copy instead of just returning to be more constant time.
- var a = choice[(v < 0x8000) & 1];
- a[15] = v & 0x7fff;
- // >32-bits of precision are required here so '/ 0x8000' can not be
- // replaced by the arithmetic equivalent '>>> 15'
- v = (0 | (v / 0x8000)) * 19;
- a[0] = (v += a[0]) & 0xffff;
- v = v >>> 16;
- a[1] = (v += a[1]) & 0xffff;
- v = v >>> 16;
- a[2] = (v += a[2]) & 0xffff;
- v = v >>> 16;
- a[3] = (v += a[3]) & 0xffff;
- v = v >>> 16;
- a[4] = (v += a[4]) & 0xffff;
- v = v >>> 16;
- a[5] = (v += a[5]) & 0xffff;
- v = v >>> 16;
- a[6] = (v += a[6]) & 0xffff;
- v = v >>> 16;
- a[7] = (v += a[7]) & 0xffff;
- v = v >>> 16;
- a[8] = (v += a[8]) & 0xffff;
- v = v >>> 16;
- a[9] = (v += a[9]) & 0xffff;
- v = v >>> 16;
- a[10] = (v += a[10]) & 0xffff;
- v = v >>> 16;
- a[11] = (v += a[11]) & 0xffff;
- v = v >>> 16;
- a[12] = (v += a[12]) & 0xffff;
- v = v >>> 16;
- a[13] = (v += a[13]) & 0xffff;
- v = v >>> 16;
- a[14] = (v += a[14]) & 0xffff;
- v = v >>> 16;
- a[15] += v;
- }
-
- function _addmodp(a, b) {
- var r = [];
- var v;
- r[0] = (v = ((0 | (a[15] >>> 15)) + (0 | (b[15] >>> 15))) * 19
- + a[0] + b[0]) & 0xffff;
- r[1] = (v = (v >>> 16) + a[1] + b[1]) & 0xffff;
- r[2] = (v = (v >>> 16) + a[2] + b[2]) & 0xffff;
- r[3] = (v = (v >>> 16) + a[3] + b[3]) & 0xffff;
- r[4] = (v = (v >>> 16) + a[4] + b[4]) & 0xffff;
- r[5] = (v = (v >>> 16) + a[5] + b[5]) & 0xffff;
- r[6] = (v = (v >>> 16) + a[6] + b[6]) & 0xffff;
- r[7] = (v = (v >>> 16) + a[7] + b[7]) & 0xffff;
- r[8] = (v = (v >>> 16) + a[8] + b[8]) & 0xffff;
- r[9] = (v = (v >>> 16) + a[9] + b[9]) & 0xffff;
- r[10] = (v = (v >>> 16) + a[10] + b[10]) & 0xffff;
- r[11] = (v = (v >>> 16) + a[11] + b[11]) & 0xffff;
- r[12] = (v = (v >>> 16) + a[12] + b[12]) & 0xffff;
- r[13] = (v = (v >>> 16) + a[13] + b[13]) & 0xffff;
- r[14] = (v = (v >>> 16) + a[14] + b[14]) & 0xffff;
- r[15] = (v >>> 16) + (a[15] & 0x7fff) + (b[15] & 0x7fff);
- return r;
- }
-
- function _submodp(a, b) {
- var r = [];
- var v;
- r[0] = (v = 0x80000
- + ((0 | (a[15] >>> 15)) - (0 | (b[15] >>> 15)) - 1)
- * 19 + a[0] - b[0]) & 0xffff;
- r[1] = (v = (v >>> 16) + 0x7fff8 + a[1] - b[1]) & 0xffff;
- r[2] = (v = (v >>> 16) + 0x7fff8 + a[2] - b[2]) & 0xffff;
- r[3] = (v = (v >>> 16) + 0x7fff8 + a[3] - b[3]) & 0xffff;
- r[4] = (v = (v >>> 16) + 0x7fff8 + a[4] - b[4]) & 0xffff;
- r[5] = (v = (v >>> 16) + 0x7fff8 + a[5] - b[5]) & 0xffff;
- r[6] = (v = (v >>> 16) + 0x7fff8 + a[6] - b[6]) & 0xffff;
- r[7] = (v = (v >>> 16) + 0x7fff8 + a[7] - b[7]) & 0xffff;
- r[8] = (v = (v >>> 16) + 0x7fff8 + a[8] - b[8]) & 0xffff;
- r[9] = (v = (v >>> 16) + 0x7fff8 + a[9] - b[9]) & 0xffff;
- r[10] = (v = (v >>> 16) + 0x7fff8 + a[10] - b[10]) & 0xffff;
- r[11] = (v = (v >>> 16) + 0x7fff8 + a[11] - b[11]) & 0xffff;
- r[12] = (v = (v >>> 16) + 0x7fff8 + a[12] - b[12]) & 0xffff;
- r[13] = (v = (v >>> 16) + 0x7fff8 + a[13] - b[13]) & 0xffff;
- r[14] = (v = (v >>> 16) + 0x7fff8 + a[14] - b[14]) & 0xffff;
- r[15] = (v >>> 16) + 0x7ff8 + (a[15] & 0x7fff)
- - (b[15] & 0x7fff);
- return r;
- }
-
- function _invmodp(a) {
- var c = a;
- var i = 250;
- while (--i) {
- a = _sqrmodp(a);
- a = _mulmodp(a, c);
- }
- a = _sqrmodp(a);
- a = _sqrmodp(a);
- a = _mulmodp(a, c);
- a = _sqrmodp(a);
- a = _sqrmodp(a);
- a = _mulmodp(a, c);
- a = _sqrmodp(a);
- a = _mulmodp(a, c);
- return a;
- }
-
- function _mulasmall(a) {
- // 'division by 0x10000' can not be replaced by '>> 16' because
- // more than 32 bits of precision are needed
- var m = 121665;
- var r = [];
- var v;
- r[0] = (v = a[0] * m) & 0xffff;
- r[1] = (v = (0 | (v / 0x10000)) + a[1] * m) & 0xffff;
- r[2] = (v = (0 | (v / 0x10000)) + a[2] * m) & 0xffff;
- r[3] = (v = (0 | (v / 0x10000)) + a[3] * m) & 0xffff;
- r[4] = (v = (0 | (v / 0x10000)) + a[4] * m) & 0xffff;
- r[5] = (v = (0 | (v / 0x10000)) + a[5] * m) & 0xffff;
- r[6] = (v = (0 | (v / 0x10000)) + a[6] * m) & 0xffff;
- r[7] = (v = (0 | (v / 0x10000)) + a[7] * m) & 0xffff;
- r[8] = (v = (0 | (v / 0x10000)) + a[8] * m) & 0xffff;
- r[9] = (v = (0 | (v / 0x10000)) + a[9] * m) & 0xffff;
- r[10] = (v = (0 | (v / 0x10000)) + a[10] * m) & 0xffff;
- r[11] = (v = (0 | (v / 0x10000)) + a[11] * m) & 0xffff;
- r[12] = (v = (0 | (v / 0x10000)) + a[12] * m) & 0xffff;
- r[13] = (v = (0 | (v / 0x10000)) + a[13] * m) & 0xffff;
- r[14] = (v = (0 | (v / 0x10000)) + a[14] * m) & 0xffff;
- r[15] = (0 | (v / 0x10000)) + a[15] * m;
- _reduce(r);
- return r;
- }
-
- function _dbl(x, z) {
- var x_2, z_2, m, n, o;
- m = _sqrmodp(_addmodp(x, z));
- n = _sqrmodp(_submodp(x, z));
- o = _submodp(m, n);
- x_2 = _mulmodp(n, m);
- z_2 = _mulmodp(_addmodp(_mulasmall(o), m), o);
- return [x_2, z_2];
- }
-
- function _sum(x, z, x_p, z_p, x_1) {
- var x_3, z_3, p, q;
- p = _mulmodp(_submodp(x, z), _addmodp(x_p, z_p));
- q = _mulmodp(_addmodp(x, z), _submodp(x_p, z_p));
- x_3 = _sqrmodp(_addmodp(p, q));
- z_3 = _mulmodp(_sqrmodp(_submodp(p, q)), x_1);
- return [x_3, z_3];
- }
-
- function _generateKey(curve25519) {
- var buffer = crypto.randomBytes(32);
-
- // For Curve25519 DH keys, we need to apply some bit mask on generated
- // keys:
- // * clear bit 0, 1, 2 of first byte
- // * clear bit 7 of last byte
- // * set bit 6 of last byte
- if (curve25519 === true) {
- buffer[0] &= 0xf8;
- buffer[31] = (buffer[31] & 0x7f) | 0x40;
- }
- var result = [];
- for (var i = 0; i < buffer.length; i++) {
- result.push(String.fromCharCode(buffer[i]));
- }
- return result.join('');
- }
-
- // Expose some functions to the outside through this name space.
- // Note: This is not part of the public API.
- ns.getbit = _getbit;
- ns.setbit = _setbit;
- ns.addmodp = _addmodp;
- ns.invmodp = _invmodp;
- ns.mulmodp = _mulmodp;
- ns.reduce = _reduce;
- ns.dbl = _dbl;
- ns.sum = _sum;
- ns.ZERO = _ZERO;
- ns.ONE = _ONE;
- ns.BASE = _BASE;
- ns.bigintadd = _bigintadd;
- ns.bigintsub = _bigintsub;
- ns.bigintcmp = _bigintcmp;
- ns.mulmodp = _mulmodp;
- ns.sqrmodp = _sqrmodp;
- ns.generateKey = _generateKey;
-
-
-module.exports = ns;
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/curve255.js b/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/curve255.js
deleted file mode 100644
index 3978b46e3..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/curve255.js
+++ /dev/null
@@ -1,221 +0,0 @@
-"use strict";
-/**
- * @fileOverview
- * Core operations on curve 25519 required for the higher level modules.
- */
-
-/*
- * Copyright (c) 2007, 2013, 2014 Michele Bini
- * Copyright (c) 2014 Mega Limited
- * under the MIT License.
- *
- * Authors: Guy K. Kloss, Michele Bini
- *
- * You should have received a copy of the license along with this program.
- */
-
-var core = require('./core');
-var utils = require('./utils');
-
- /**
- * @exports jodid25519/curve255
- * Legacy compatibility module for Michele Bini's previous curve255.js.
- *
- * @description
- * Legacy compatibility module for Michele Bini's previous curve255.js.
- *
- *
- * This code presents an API with all key formats as previously available
- * from Michele Bini's curve255.js implementation.
- *
- */
- var ns = {};
-
- function curve25519_raw(f, c) {
- var a, x_1, q;
-
- x_1 = c;
- a = core.dbl(x_1, core.ONE());
- q = [x_1, core.ONE()];
-
- var n = 255;
-
- while (core.getbit(f, n) == 0) {
- n--;
- // For correct constant-time operation, bit 255 should always be
- // set to 1 so the following 'while' loop is never entered.
- if (n < 0) {
- return core.ZERO();
- }
- }
- n--;
-
- var aq = [a, q];
-
- while (n >= 0) {
- var r, s;
- var b = core.getbit(f, n);
- r = core.sum(aq[0][0], aq[0][1], aq[1][0], aq[1][1], x_1);
- s = core.dbl(aq[1 - b][0], aq[1 - b][1]);
- aq[1 - b] = s;
- aq[b] = r;
- n--;
- }
- q = aq[1];
-
- q[1] = core.invmodp(q[1]);
- q[0] = core.mulmodp(q[0], q[1]);
- core.reduce(q[0]);
- return q[0];
- }
-
- function curve25519b32(a, b) {
- return _base32encode(curve25519(_base32decode(a),
- _base32decode(b)));
- }
-
- function curve25519(f, c) {
- if (!c) {
- c = core.BASE();
- }
- f[0] &= 0xFFF8;
- f[15] = (f[15] & 0x7FFF) | 0x4000;
- return curve25519_raw(f, c);
- }
-
- function _hexEncodeVector(k) {
- var hexKey = utils.hexEncode(k);
- // Pad with '0' at the front.
- hexKey = new Array(64 + 1 - hexKey.length).join('0') + hexKey;
- // Invert bytes.
- return hexKey.split(/(..)/).reverse().join('');
- }
-
- function _hexDecodeVector(v) {
- // assert(length(x) == 64);
- // Invert bytes.
- var hexKey = v.split(/(..)/).reverse().join('');
- return utils.hexDecode(hexKey);
- }
-
-
- // Expose some functions to the outside through this name space.
-
- /**
- * Computes the scalar product of a point on the curve 25519.
- *
- * This function is used for the DH key-exchange protocol.
- *
- * Before multiplication, some bit operations are applied to the
- * private key to ensure it is a valid Curve25519 secret key.
- * It is the user's responsibility to make sure that the private
- * key is a uniformly random, secret value.
- *
- * @function
- * @param f {array}
- * Private key.
- * @param c {array}
- * Public point on the curve. If not given, the curve's base point is used.
- * @returns {array}
- * Key point resulting from scalar product.
- */
- ns.curve25519 = curve25519;
-
- /**
- * Computes the scalar product of a point on the curve 25519.
- *
- * This variant does not make sure that the private key is valid.
- * The user has the responsibility to ensure the private key is
- * valid or that this results in a safe protocol. Unless you know
- * exactly what you are doing, you should not use this variant,
- * please use 'curve25519' instead.
- *
- * @function
- * @param f {array}
- * Private key.
- * @param c {array}
- * Public point on the curve. If not given, the curve's base point is used.
- * @returns {array}
- * Key point resulting from scalar product.
- */
- ns.curve25519_raw = curve25519_raw;
-
- /**
- * Encodes the internal representation of a key to a canonical hex
- * representation.
- *
- * This is the format commonly used in other libraries and for
- * test vectors, and is equivalent to the hex dump of the key in
- * little-endian binary format.
- *
- * @function
- * @param n {array}
- * Array representation of key.
- * @returns {string}
- * Hexadecimal string representation of key.
- */
- ns.hexEncodeVector = _hexEncodeVector;
-
- /**
- * Decodes a canonical hex representation of a key
- * to an internally compatible array representation.
- *
- * @function
- * @param n {string}
- * Hexadecimal string representation of key.
- * @returns {array}
- * Array representation of key.
- */
- ns.hexDecodeVector = _hexDecodeVector;
-
- /**
- * Encodes the internal representation of a key into a
- * hexadecimal representation.
- *
- * This is a strict positional notation, most significant digit first.
- *
- * @function
- * @param n {array}
- * Array representation of key.
- * @returns {string}
- * Hexadecimal string representation of key.
- */
- ns.hexencode = utils.hexEncode;
-
- /**
- * Decodes a hex representation of a key to an internally
- * compatible array representation.
- *
- * @function
- * @param n {string}
- * Hexadecimal string representation of key.
- * @returns {array}
- * Array representation of key.
- */
- ns.hexdecode = utils.hexDecode;
-
- /**
- * Encodes the internal representation of a key to a base32
- * representation.
- *
- * @function
- * @param n {array}
- * Array representation of key.
- * @returns {string}
- * Base32 string representation of key.
- */
- ns.base32encode = utils.base32encode;
-
- /**
- * Decodes a base32 representation of a key to an internally
- * compatible array representation.
- *
- * @function
- * @param n {string}
- * Base32 string representation of key.
- * @returns {array}
- * Array representation of key.
- */
- ns.base32decode = utils.base32decode;
-
-module.exports = ns;
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/dh.js b/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/dh.js
deleted file mode 100644
index 2f75494a4..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/dh.js
+++ /dev/null
@@ -1,111 +0,0 @@
-"use strict";
-/**
- * @fileOverview
- * EC Diffie-Hellman operations on Curve25519.
- */
-
-/*
- * Copyright (c) 2014 Mega Limited
- * under the MIT License.
- *
- * Authors: Guy K. Kloss
- *
- * You should have received a copy of the license along with this program.
- */
-
-var core = require('./core');
-var utils = require('./utils');
-var curve255 = require('./curve255');
-
-
- /**
- * @exports jodid25519/dh
- * EC Diffie-Hellman operations on Curve25519.
- *
- * @description
- * EC Diffie-Hellman operations on Curve25519.
- */
- var ns = {};
-
-
- function _toString(vector) {
- var u = new Uint16Array(vector);
- return (new Buffer(new Uint8Array(u.buffer)));
- }
-
- function _fromString(vector) {
- if (Buffer.isBuffer(vector)) {
- var u = new Uint8Array(vector);
- return (new Uint16Array(u.buffer));
- }
-
- var result = new Array(16);
- for (var i = 0, l = 0; i < vector.length; i += 2) {
- result[l] = (vector.charCodeAt(i + 1) << 8) | vector.charCodeAt(i);
- l++;
- }
- return result;
- }
-
-
- /**
- * Computes a key through scalar multiplication of a point on the curve 25519.
- *
- * This function is used for the DH key-exchange protocol. It computes a
- * key based on a secret key with a public component (opponent's public key
- * or curve base point if not given) by using scalar multiplication.
- *
- * Before multiplication, some bit operations are applied to the
- * private key to ensure it is a valid Curve25519 secret key.
- * It is the user's responsibility to make sure that the private
- * key is a uniformly random, secret value.
- *
- * @function
- * @param privateComponent {string}
- * Private point as byte string on the curve.
- * @param publicComponent {string}
- * Public point as byte string on the curve. If not given, the curve's
- * base point is used.
- * @returns {string}
- * Key point as byte string resulting from scalar product.
- */
- ns.computeKey = function(privateComponent, publicComponent) {
- if (publicComponent) {
- return _toString(curve255.curve25519(_fromString(privateComponent),
- _fromString(publicComponent)));
- } else {
- return _toString(curve255.curve25519(_fromString(privateComponent)));
- }
- };
-
- /**
- * Computes the public key to a private key on the curve 25519.
- *
- * Before multiplication, some bit operations are applied to the
- * private key to ensure it is a valid Curve25519 secret key.
- * It is the user's responsibility to make sure that the private
- * key is a uniformly random, secret value.
- *
- * @function
- * @param privateKey {string}
- * Private point as byte string on the curve.
- * @returns {string}
- * Public key point as byte string resulting from scalar product.
- */
- ns.publicKey = function(privateKey) {
- return _toString(curve255.curve25519(_fromString(privateKey)));
- };
-
-
- /**
- * Generates a new random private key of 32 bytes length (256 bit).
- *
- * @function
- * @returns {string}
- * Byte string containing a new random private key seed.
- */
- ns.generateKey = function() {
- return core.generateKey(true);
- };
-
-module.exports = ns;
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/eddsa.js b/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/eddsa.js
deleted file mode 100644
index c384f3293..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/eddsa.js
+++ /dev/null
@@ -1,573 +0,0 @@
-"use strict";
-/**
- * @fileOverview
- * Digital signature scheme based on Curve25519 (Ed25519 or EdDSA).
- */
-
-/*
- * Copyright (c) 2011, 2012, 2014 Ron Garret
- * Copyright (c) 2014 Mega Limited
- * under the MIT License.
- *
- * Authors: Guy K. Kloss, Ron Garret
- *
- * You should have received a copy of the license along with this program.
- */
-
-var core = require('./core');
-var curve255 = require('./curve255');
-var utils = require('./utils');
-var BigInteger = require('jsbn').BigInteger;
-var crypto = require('crypto');
-
- /**
- * @exports jodid25519/eddsa
- * Digital signature scheme based on Curve25519 (Ed25519 or EdDSA).
- *
- * @description
- * Digital signature scheme based on Curve25519 (Ed25519 or EdDSA).
- *
- *
- * This code is adapted from fast-djbec.js, a faster but more complicated
- * version of the Ed25519 encryption scheme (as compared to djbec.js).
- * It uses two different representations for big integers: The jsbn
- * BigInteger class, which can represent arbitrary-length numbers, and a
- * special fixed-length representation optimised for 256-bit integers.
- * The reason both are needed is that the Ed25519 algorithm requires some
- * 512-bit numbers.
- */
- var ns = {};
-
- function _bi255(value) {
- if (!(this instanceof _bi255)) {
- return new _bi255(value);
- }
- if (typeof value === 'undefined') {
- return _ZERO;
- }
- var c = value.constructor;
- if ((c === Array || c === Uint16Array || c === Uint32Array) && (value.length === 16)) {
- this.n = value;
- } else if ((c === Array) && (value.length === 32)) {
- this.n = _bytes2bi255(value).n;
- } else if (c === String) {
- this.n = utils.hexDecode(value);
- } else if (c === Number) {
- this.n = [value & 0xffff,
- value >> 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- } else if (value instanceof _bi255) {
- this.n = value.n.slice(0); // Copy constructor
- } else {
- throw "Bad argument for bignum: " + value;
- }
- }
-
- _bi255.prototype = {
- 'toString' : function() {
- return utils.hexEncode(this.n);
- },
- 'toSource' : function() {
- return '_' + utils.hexEncode(this.n);
- },
- 'plus' : function(n1) {
- return _bi255(core.bigintadd(this.n, n1.n));
- },
- 'minus' : function(n1) {
- return _bi255(core.bigintsub(this.n, n1.n)).modq();
- },
- 'times' : function(n1) {
- return _bi255(core.mulmodp(this.n, n1.n));
- },
- 'divide' : function(n1) {
- return this.times(n1.inv());
- },
- 'sqr' : function() {
- return _bi255(core.sqrmodp(this.n));
- },
- 'cmp' : function(n1) {
- return core.bigintcmp(this.n, n1.n);
- },
- 'equals' : function(n1) {
- return this.cmp(n1) === 0;
- },
- 'isOdd' : function() {
- return (this.n[0] & 1) === 1;
- },
- 'shiftLeft' : function(cnt) {
- _shiftL(this.n, cnt);
- return this;
- },
- 'shiftRight' : function(cnt) {
- _shiftR(this.n, cnt);
- return this;
- },
- 'inv' : function() {
- return _bi255(core.invmodp(this.n));
- },
- 'pow' : function(e) {
- return _bi255(_pow(this.n, e.n));
- },
- 'modq' : function() {
- return _modq(this);
- },
- 'bytes' : function() {
- return _bi255_bytes(this);
- }
- };
-
- function _shiftL(n, cnt) {
- var lastcarry = 0;
- for (var i = 0; i < 16; i++) {
- var carry = n[i] >> (16 - cnt);
- n[i] = (n[i] << cnt) & 0xffff | lastcarry;
- lastcarry = carry;
- }
- return n;
- }
-
- function _shiftR(n, cnt) {
- var lastcarry = 0;
- for (var i = 15; i >= 0; i--) {
- var carry = n[i] << (16 - cnt) & 0xffff;
- n[i] = (n[i] >> cnt) | lastcarry;
- lastcarry = carry;
- }
- return n;
- }
-
- function _bi255_bytes(n) {
- n = _bi255(n); // Make a copy because shiftRight is destructive
- var a = new Array(32);
- for (var i = 31; i >= 0; i--) {
- a[i] = n.n[0] & 0xff;
- n.shiftRight(8);
- }
- return a;
- }
-
- function _bytes2bi255(a) {
- var n = _ZERO;
- for (var i = 0; i < 32; i++) {
- n.shiftLeft(8);
- n = n.plus(_bi255(a[i]));
- }
- return n;
- }
-
- function _pow(n, e) {
- var result = core.ONE();
- for (var i = 0; i < 256; i++) {
- if (core.getbit(e, i) === 1) {
- result = core.mulmodp(result, n);
- }
- n = core.sqrmodp(n);
- }
- return result;
- }
-
- var _ZERO = _bi255(0);
- var _ONE = _bi255(1);
- var _TWO = _bi255(2);
- // This is the core prime.
- var _Q = _bi255([0xffff - 18, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0x7fff]);
-
- function _modq(n) {
- core.reduce(n.n);
- if (n.cmp(_Q) >= 0) {
- return _modq(n.minus(_Q));
- }
- if (n.cmp(_ZERO) === -1) {
- return _modq(n.plus(_Q));
- } else {
- return n;
- }
- }
-
- // _RECOVERY_EXPONENT = _Q.plus(_bi255(3)).divide(_bi255(8));
- var _RECOVERY_EXPONENT = _bi255('0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe');
- // _D = _Q.minus(_bi255(121665)).divide(_bi255(121666));
- var _D = _bi255('52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3');
- // _I = _TWO.pow(_Q.minus(_ONE).divide(_bi255(4)));
- var _I = _bi255('2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0');
- // _L = _TWO.pow(_bi255(252)).plus(_bi255('14def9dea2f79cd65812631a5cf5d3ed'));
- var _L = _bi255('1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed');
- var _L_BI = _bi('1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed', 16);
-
-
- // ////////////////////////////////////////////////////////////
-
- function _isoncurve(p) {
- var x = p[0];
- var y = p[1];
- var xsqr = x.sqr();
- var ysqr = y.sqr();
- var v = _D.times(xsqr).times(ysqr);
- return ysqr.minus(xsqr).minus(_ONE).minus(v).modq().equals(_ZERO);
- }
-
- function _xrecover(y) {
- var ysquared = y.sqr();
- var xx = ysquared.minus(_ONE).divide(_ONE.plus(_D.times(ysquared)));
- var x = xx.pow(_RECOVERY_EXPONENT);
- if (!(x.times(x).minus(xx).equals(_ZERO))) {
- x = x.times(_I);
- }
- if (x.isOdd()) {
- x = _Q.minus(x);
- }
- return x;
- }
-
- function _x_pt_add(pt1, pt2) {
- var x1 = pt1[0];
- var y1 = pt1[1];
- var z1 = pt1[2];
- var t1 = pt1[3];
- var x2 = pt2[0];
- var y2 = pt2[1];
- var z2 = pt2[2];
- var t2 = pt2[3];
- var A = y1.minus(x1).times(y2.plus(x2));
- var B = y1.plus(x1).times(y2.minus(x2));
- var C = z1.times(_TWO).times(t2);
- var D = t1.times(_TWO).times(z2);
- var E = D.plus(C);
- var F = B.minus(A);
- var G = B.plus(A);
- var H = D.minus(C);
- return [E.times(F), G.times(H), F.times(G), E.times(H)];
- }
-
- function _xpt_double(pt1) {
- var x1 = pt1[0];
- var y1 = pt1[1];
- var z1 = pt1[2];
- var A = x1.times(x1);
- var B = y1.times(y1);
- var C = _TWO.times(z1).times(z1);
- var D = _Q.minus(A);
- var J = x1.plus(y1);
- var E = J.times(J).minus(A).minus(B);
- var G = D.plus(B);
- var F = G.minus(C);
- var H = D.minus(B);
- return [E.times(F), G.times(H), F.times(G), E.times(H)];
- }
-
- function _xpt_mult(pt, n) {
- if (n.equals(_ZERO)) {
- return [_ZERO, _ONE, _ONE, _ZERO];
- }
- var odd = n.isOdd();
- n.shiftRight(1);
- var value = _xpt_double(_xpt_mult(pt, n));
- return odd ? _x_pt_add(value, pt) : value;
- }
-
- function _pt_xform(pt) {
- var x = pt[0];
- var y = pt[1];
- return [x, y, _ONE, x.times(y)];
- }
-
- function _pt_unxform(pt) {
- var x = pt[0];
- var y = pt[1];
- var z = pt[2];
- var invz = z.inv();
- return [x.times(invz), y.times(invz)];
- }
-
- function _scalarmult(pt, n) {
- return _pt_unxform(_xpt_mult(_pt_xform(pt), n));
- }
-
- function _bytesgetbit(bytes, n) {
- return (bytes[bytes.length - (n >>> 3) - 1] >> (n & 7)) & 1;
- }
-
- function _xpt_mult_bytes(pt, bytes) {
- var r = [_ZERO, _ONE, _ONE, _ZERO];
- for (var i = (bytes.length << 3) - 1; i >= 0; i--) {
- r = _xpt_double(r);
- if (_bytesgetbit(bytes, i) === 1) {
- r = _x_pt_add(r, pt);
- }
- }
- return r;
- }
-
- function _scalarmultBytes(pt, bytes) {
- return _pt_unxform(_xpt_mult_bytes(_pt_xform(pt), bytes));
- }
-
- var _by = _bi255(4).divide(_bi255(5));
- var _bx = _xrecover(_by);
- var _bp = [_bx, _by];
-
- function _encodeint(n) {
- return n.bytes(32).reverse();
- }
- function _decodeint(b) {
- return _bi255(b.slice(0).reverse());
- }
-
- function _encodepoint(p) {
- var v = _encodeint(p[1]);
- if (p[0].isOdd()) {
- v[31] |= 0x80;
- }
- return v;
- }
-
- function _decodepoint(v) {
- v = v.slice(0);
- var signbit = v[31] >> 7;
- v[31] &= 127;
- var y = _decodeint(v);
- var x = _xrecover(y);
- if ((x.n[0] & 1) !== signbit) {
- x = _Q.minus(x);
- }
- var p = [x, y];
- if (!_isoncurve(p)) {
- throw ('Point is not on curve');
- }
- return p;
- }
-
- // //////////////////////////////////////////////////
-
- /**
- * Factory function to create a suitable BigInteger.
- *
- * @param value
- * The value for the big integer.
- * @param base {integer}
- * Base of the conversion of elements in ``value``.
- * @returns
- * A BigInteger object.
- */
- function _bi(value, base) {
- if (base !== undefined) {
- if (base === 256) {
- return _bi(utils.string2bytes(value));
- }
- return new BigInteger(value, base);
- } else if (typeof value === 'string') {
- return new BigInteger(value, 10);
- } else if ((value instanceof Array) || (value instanceof Uint8Array)
- || Buffer.isBuffer(value)) {
- return new BigInteger(value);
- } else if (typeof value === 'number') {
- return new BigInteger(value.toString(), 10);
- } else {
- throw "Can't convert " + value + " to BigInteger";
- }
- }
-
- function _bi2bytes(n, cnt) {
- if (cnt === undefined) {
- cnt = (n.bitLength() + 7) >>> 3;
- }
- var bytes = new Array(cnt);
- for (var i = cnt - 1; i >= 0; i--) {
- bytes[i] = n[0] & 255; // n.and(0xff);
- n = n.shiftRight(8);
- }
- return bytes;
- }
-
- BigInteger.prototype.bytes = function(n) {
- return _bi2bytes(this, n);
- };
-
- // /////////////////////////////////////////////////////////
-
- function _bytehash(s) {
- var sha = crypto.createHash('sha512').update(s).digest();
- return _bi2bytes(_bi(sha), 64).reverse();
- }
-
- function _stringhash(s) {
- var sha = crypto.createHash('sha512').update(s).digest();
- return _map(_chr, _bi2bytes(_bi(sha), 64)).join('');
- }
-
- function _inthash(s) {
- // Need a leading 0 to prevent sign extension
- return _bi([0].concat(_bytehash(s)));
- }
-
- function _inthash_lo(s) {
- return _bi255(_bytehash(s).slice(32, 64));
- }
-
- function _inthash_mod_l(s) {
- return _inthash(s).mod(_L_BI);
- }
-
- function _get_a(sk) {
- var a = _inthash_lo(sk);
- a.n[0] &= 0xfff8;
- a.n[15] &= 0x3fff;
- a.n[15] |= 0x4000;
- return a;
- }
-
- function _publickey(sk) {
- return _encodepoint(_scalarmult(_bp, _get_a(sk)));
- }
-
- function _map(f, l) {
- var result = new Array(l.length);
- for (var i = 0; i < l.length; i++) {
- result[i] = f(l[i]);
- }
- return result;
- }
-
- function _chr(n) {
- return String.fromCharCode(n);
- }
-
- function _ord(c) {
- return c.charCodeAt(0);
- }
-
- function _pt_add(p1, p2) {
- return _pt_unxform(_x_pt_add(_pt_xform(p1), _pt_xform(p2)));
- }
-
-
- // Exports for the API.
-
- /**
- * Checks whether a point is on the curve.
- *
- * @function
- * @param point {string}
- * The point to check for in a byte string representation.
- * @returns {boolean}
- * true if the point is on the curve, false otherwise.
- */
- ns.isOnCurve = function(point) {
- try {
- _isoncurve(_decodepoint(utils.string2bytes(point)));
- } catch(e) {
- if (e === 'Point is not on curve') {
- return false;
- } else {
- throw e;
- }
- }
- return true;
- };
-
-
- /**
- * Computes the EdDSA public key.
- *
- * Note: Seeds should be a byte string, not a unicode string containing
- * multi-byte characters.
- *
- * @function
- * @param keySeed {string}
- * Private key seed in the form of a byte string.
- * @returns {string}
- * Public key as byte string computed from the private key seed
- * (32 bytes).
- */
- ns.publicKey = function(keySeed) {
- return utils.bytes2string(_publickey(keySeed));
- };
-
-
- /**
- * Computes an EdDSA signature of a message.
- *
- * Notes:
- *
- *
- * Unicode messages need to be converted to a byte representation
- * (e. g. UTF-8).
- * If `publicKey` is given, and it is *not* a point of the curve,
- * the signature will be faulty, but no error will be thrown.
- *
- *
- * @function
- * @param message {string}
- * Message in the form of a byte string.
- * @param keySeed {string}
- * Private key seed in the form of a byte string.
- * @param publicKey {string}
- * Public key as byte string (if not present, it will be computed from
- * the private key seed).
- * @returns {string}
- * Detached message signature in the form of a byte string (64 bytes).
- */
- ns.sign = function(message, keySeed, publicKey) {
- if (publicKey === undefined) {
- publicKey = _publickey(keySeed);
- } else {
- publicKey = utils.string2bytes(publicKey);
- }
- var a = _bi(_get_a(keySeed).toString(), 16);
- var hs = _stringhash(keySeed);
- var r = _bytehash(hs.slice(32, 64) + message);
- var rp = _scalarmultBytes(_bp, r);
- var erp = _encodepoint(rp);
- r = _bi(r).mod(_bi(1, 10).shiftLeft(512));
- var s = _map(_chr, erp).join('') + _map(_chr, publicKey).join('') + message;
- s = _inthash_mod_l(s).multiply(a).add(r).mod(_L_BI);
- return utils.bytes2string(erp.concat(_encodeint(s)));
- };
-
-
- /**
- * Verifies an EdDSA signature of a message with the public key.
- *
- * Note: Unicode messages need to be converted to a byte representation
- * (e. g. UTF-8).
- *
- * @function
- * @param signature {string}
- * Message signature in the form of a byte string. Can be detached
- * (64 bytes), or attached to be sliced off.
- * @param message {string}
- * Message in the form of a byte string.
- * @param publicKey {string}
- * Public key as byte string (if not present, it will be computed from
- * the private key seed).
- * @returns {boolean}
- * true, if the signature verifies.
- */
- ns.verify = function(signature, message, publicKey) {
- signature = utils.string2bytes(signature.slice(0, 64));
- publicKey = utils.string2bytes(publicKey);
- var rpe = signature.slice(0, 32);
- var rp = _decodepoint(rpe);
- var a = _decodepoint(publicKey);
- var s = _decodeint(signature.slice(32, 64));
- var h = _inthash(utils.bytes2string(rpe.concat(publicKey)) + message);
- var v1 = _scalarmult(_bp, s);
- var value = _scalarmultBytes(a, _bi2bytes(h));
- var v2 = _pt_add(rp, value);
- return v1[0].equals(v2[0]) && v1[1].equals(v2[1]);
- };
-
-
- /**
- * Generates a new random private key seed of 32 bytes length (256 bit).
- *
- * @function
- * @returns {string}
- * Byte string containing a new random private key seed.
- */
- ns.generateKeySeed = function() {
- return core.generateKey(false);
- };
-
-module.exports = ns;
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/utils.js b/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/utils.js
deleted file mode 100644
index c795231ad..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/lib/utils.js
+++ /dev/null
@@ -1,198 +0,0 @@
-"use strict";
-/**
- * @fileOverview
- * A collection of general utility functions..
- */
-
-/*
- * Copyright (c) 2011, 2012, 2014 Ron Garret
- * Copyright (c) 2007, 2013, 2014 Michele Bini
- * Copyright (c) 2014 Mega Limited
- * under the MIT License.
- *
- * Authors: Guy K. Kloss, Michele Bini, Ron Garret
- *
- * You should have received a copy of the license along with this program.
- */
-
-var core = require('./core');
-
- /**
- * @exports jodid25519/utils
- * A collection of general utility functions..
- *
- * @description
- * A collection of general utility functions..
- */
- var ns = {};
-
- var _HEXCHARS = "0123456789abcdef";
-
- function _hexencode(vector) {
- var result = [];
- for (var i = vector.length - 1; i >= 0; i--) {
- var value = vector[i];
- result.push(_HEXCHARS.substr((value >>> 12) & 0x0f, 1));
- result.push(_HEXCHARS.substr((value >>> 8) & 0x0f, 1));
- result.push(_HEXCHARS.substr((value >>> 4) & 0x0f, 1));
- result.push(_HEXCHARS.substr(value & 0x0f, 1));
- }
- return result.join('');
- }
-
- function _hexdecode(vector) {
- var result = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- for (var i = vector.length - 1, l = 0; i >= 0; i -= 4) {
- result[l] = (_HEXCHARS.indexOf(vector.charAt(i)))
- | (_HEXCHARS.indexOf(vector.charAt(i - 1)) << 4)
- | (_HEXCHARS.indexOf(vector.charAt(i - 2)) << 8)
- | (_HEXCHARS.indexOf(vector.charAt(i - 3)) << 12);
- l++;
- }
- return result;
- }
-
- var _BASE32CHARS = "abcdefghijklmnopqrstuvwxyz234567";
-
- var _BASE32VALUES = (function () {
- var result = {};
- for (var i = 0; i < _BASE32CHARS.length; i++) {
- result[_BASE32CHARS.charAt(i)] = i;
- }
- return result;
- })();
-
- function _base32encode(n) {
- var c;
- var r = "";
- for (c = 0; c < 255; c += 5) {
- r = _BASE32CHARS.substr(core.getbit(n, c)
- + (core.getbit(n, c + 1) << 1)
- + (core.getbit(n, c + 2) << 2)
- + (core.getbit(n, c + 3) << 3)
- + (core.getbit(n, c + 4) << 4), 1)
- + r;
- }
- return r;
- }
-
- function _base32decode(n) {
- var c = 0;
- var r = core.ZERO();
- var l = n.length;
- for (c = 0; (l > 0) && (c < 255); c += 5) {
- l--;
- var v = _BASE32VALUES[n.substr(l, 1)];
- core.setbit(r, c, v & 1);
- v >>= 1;
- core.setbit(r, c + 1, v & 1);
- v >>= 1;
- core.setbit(r, c + 2, v & 1);
- v >>= 1;
- core.setbit(r, c + 3, v & 1);
- v >>= 1;
- core.setbit(r, c + 4, v & 1);
- }
- return r;
- }
-
- function _map(f, l) {
- var result = new Array(l.length);
- for (var i = 0; i < l.length; i++) {
- result[i] = f(l[i]);
- }
- return result;
- }
-
- function _chr(n) {
- return String.fromCharCode(n);
- }
-
- function _ord(c) {
- return c.charCodeAt(0);
- }
-
- function _bytes2string(bytes) {
- return _map(_chr, bytes).join('');
- }
-
- function _string2bytes(s) {
- return _map(_ord, s);
- }
-
-
- // Expose some functions to the outside through this name space.
-
- /**
- * Encodes an array of unsigned 8-bit integers to a hex string.
- *
- * @function
- * @param vector {array}
- * Array containing the byte values.
- * @returns {string}
- * String containing vector in a hexadecimal representation.
- */
- ns.hexEncode = _hexencode;
-
-
- /**
- * Decodes a hex string to an array of unsigned 8-bit integers.
- *
- * @function
- * @param vector {string}
- * String containing vector in a hexadecimal representation.
- * @returns {array}
- * Array containing the byte values.
- */
- ns.hexDecode = _hexdecode;
-
-
- /**
- * Encodes an array of unsigned 8-bit integers using base32 encoding.
- *
- * @function
- * @param vector {array}
- * Array containing the byte values.
- * @returns {string}
- * String containing vector in a hexadecimal representation.
- */
- ns.base32encode = _base32encode;
-
-
- /**
- * Decodes a base32 encoded string to an array of unsigned 8-bit integers.
- *
- * @function
- * @param vector {string}
- * String containing vector in a hexadecimal representation.
- * @returns {array}
- * Array containing the byte values.
- */
- ns.base32decode = _base32decode;
-
-
- /**
- * Converts an unsigned 8-bit integer array representation to a byte string.
- *
- * @function
- * @param vector {array}
- * Array containing the byte values.
- * @returns {string}
- * Byte string representation of vector.
- */
- ns.bytes2string = _bytes2string;
-
-
- /**
- * Converts a byte string representation to an array of unsigned
- * 8-bit integers.
- *
- * @function
- * @param vector {array}
- * Array containing the byte values.
- * @returns {string}
- * Byte string representation of vector.
- */
- ns.string2bytes = _string2bytes;
-
-module.exports = ns;
diff --git a/fundamentals/bug-challenge-es6/node_modules/jodid25519/package.json b/fundamentals/bug-challenge-es6/node_modules/jodid25519/package.json
deleted file mode 100644
index f0f3d4d7e..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/jodid25519/package.json
+++ /dev/null
@@ -1,96 +0,0 @@
-{
- "_args": [
- [
- "jodid25519@^1.0.0",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/sshpk"
- ]
- ],
- "_from": "jodid25519@>=1.0.0 <2.0.0",
- "_id": "jodid25519@1.0.2",
- "_inCache": true,
- "_installable": true,
- "_location": "/jodid25519",
- "_nodeVersion": "4.1.1",
- "_npmUser": {
- "email": "alex@cooperi.net",
- "name": "arekinath"
- },
- "_npmVersion": "2.14.4",
- "_phantomChildren": {},
- "_requested": {
- "name": "jodid25519",
- "raw": "jodid25519@^1.0.0",
- "rawSpec": "^1.0.0",
- "scope": null,
- "spec": ">=1.0.0 <2.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/sshpk"
- ],
- "_resolved": "https://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz",
- "_shasum": "06d4912255093419477d425633606e0e90782967",
- "_shrinkwrap": null,
- "_spec": "jodid25519@^1.0.0",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/sshpk",
- "author": {
- "name": "Michele Bini, Ron Garret, Guy K. Kloss"
- },
- "bugs": {
- "url": "https://github.com/meganz/jodid25519/issues"
- },
- "dependencies": {
- "jsbn": "~0.1.0"
- },
- "description": "jodid25519 - Curve 25519-based cryptography",
- "devDependencies": {
- "almond": "~0.3.1",
- "chai": "^3.0.0",
- "dateformat": "~1.0.7-1.2.3",
- "ibrik": "~2.0.0",
- "istanbul": "~0.3.5",
- "jsdoc": "<=3.3.0",
- "mocha": "~2.0.1",
- "sinon": "~1.10.3",
- "sinon-chai": "^2.8.0"
- },
- "directories": {
- "doc": "doc",
- "src": "src",
- "test": "test"
- },
- "dist": {
- "shasum": "06d4912255093419477d425633606e0e90782967",
- "tarball": "https://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz"
- },
- "gitHead": "a83b9fcf7fd3be4f27cd4a57817aff171c7cd918",
- "homepage": "https://github.com/meganz/jodid25519",
- "keywords": [
- "Curve25519",
- "Ed25519",
- "ECDH",
- "EdDSA",
- "ECDSA",
- "encryption",
- "signing"
- ],
- "license": "MIT",
- "main": "index.js",
- "maintainers": [
- {
- "email": "alex@cooperi.net",
- "name": "arekinath"
- }
- ],
- "name": "jodid25519",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/meganz/jodid25519.git"
- },
- "scripts": {
- "test": "mocha test/*_test.js"
- },
- "version": "1.0.2"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/js-tokens/LICENSE b/fundamentals/bug-challenge-es6/node_modules/js-tokens/LICENSE
deleted file mode 100644
index c9a4e1bb4..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/js-tokens/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014, 2015, 2016 Simon Lydell
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/fundamentals/bug-challenge-es6/node_modules/js-tokens/changelog.md b/fundamentals/bug-challenge-es6/node_modules/js-tokens/changelog.md
deleted file mode 100644
index b789fdd49..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/js-tokens/changelog.md
+++ /dev/null
@@ -1,82 +0,0 @@
-### Version 2.0.0 (2016-06-19) ###
-
-- Added: Support for ES2016. In other words, support for the `**` exponentiation
- operator.
-
-These are the breaking changes:
-
-- `'**'.match(jsTokens)` no longer returns `['*', '*']`, but `['**']`.
-- `'**='.match(jsTokens)` no longer returns `['*', '*=']`, but `['**=']`.
-
-
-### Version 1.0.3 (2016-03-27) ###
-
-- Improved: Made the regex ever so slightly smaller.
-- Updated: The readme.
-
-
-### Version 1.0.2 (2015-10-18) ###
-
-- Improved: Limited npm package contents for a smaller download. Thanks to
- @zertosh!
-
-
-### Version 1.0.1 (2015-06-20) ###
-
-- Fixed: Declared an undeclared variable.
-
-
-### Version 1.0.0 (2015-02-26) ###
-
-- Changed: Merged the 'operator' and 'punctuation' types into 'punctuator'. That
- type is now equivalent to the Punctuator token in the ECMAScript
- specification. (Backwards-incompatible change.)
-- Fixed: A `-` followed by a number is now correctly matched as a punctuator
- followed by a number. It used to be matched as just a number, but there is no
- such thing as negative number literals. (Possibly backwards-incompatible
- change.)
-
-
-### Version 0.4.1 (2015-02-21) ###
-
-- Added: Support for the regex `u` flag.
-
-
-### Version 0.4.0 (2015-02-21) ###
-
-- Improved: `jsTokens.matchToToken` performance.
-- Added: Support for octal and binary number literals.
-- Added: Support for template strings.
-
-
-### Version 0.3.1 (2015-01-06) ###
-
-- Fixed: Support for unicode spaces. They used to be allowed in names (which is
- very confusing), and some unicode newlines were wrongly allowed in strings and
- regexes.
-
-
-### Version 0.3.0 (2014-12-19) ###
-
-- Changed: The `jsTokens.names` array has been replaced with the
- `jsTokens.matchToToken` function. The capturing groups of `jsTokens` are no
- longer part of the public API; instead use said function. See this [gist] for
- an example. (Backwards-incompatible change.)
-- Changed: The empty string is now considered an “invalid” token, instead an
- “empty” token (its own group). (Backwards-incompatible change.)
-- Removed: component support. (Backwards-incompatible change.)
-
-[gist]: https://gist.github.com/lydell/be49dbf80c382c473004
-
-
-### Version 0.2.0 (2014-06-19) ###
-
-- Changed: Match ES6 function arrows (`=>`) as an operator, instead of its own
- category (“functionArrow”), for simplicity. (Backwards-incompatible change.)
-- Added: ES6 splats (`...`) are now matched as an operator (instead of three
- punctuations). (Backwards-incompatible change.)
-
-
-### Version 0.1.0 (2014-03-08) ###
-
-- Initial release.
diff --git a/fundamentals/bug-challenge-es6/node_modules/js-tokens/index.js b/fundamentals/bug-challenge-es6/node_modules/js-tokens/index.js
deleted file mode 100644
index 2e070409d..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/js-tokens/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2014, 2015, 2016 Simon Lydell
-// X11 (“MIT”) Licensed. (See LICENSE.)
-
-// This regex comes from regex.coffee, and is inserted here by generate-index.js
-// (run `npm run build`).
-module.exports = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]{1,6}\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g
-
-module.exports.matchToToken = function(match) {
- var token = {type: "invalid", value: match[0]}
- if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4])
- else if (match[ 5]) token.type = "comment"
- else if (match[ 6]) token.type = "comment", token.closed = !!match[7]
- else if (match[ 8]) token.type = "regex"
- else if (match[ 9]) token.type = "number"
- else if (match[10]) token.type = "name"
- else if (match[11]) token.type = "punctuator"
- else if (match[12]) token.type = "whitespace"
- return token
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/js-tokens/package.json b/fundamentals/bug-challenge-es6/node_modules/js-tokens/package.json
deleted file mode 100644
index 22f622155..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/js-tokens/package.json
+++ /dev/null
@@ -1,93 +0,0 @@
-{
- "_args": [
- [
- "js-tokens@^2.0.0",
- "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/babel-code-frame"
- ]
- ],
- "_from": "js-tokens@>=2.0.0 <3.0.0",
- "_id": "js-tokens@2.0.0",
- "_inCache": true,
- "_installable": true,
- "_location": "/js-tokens",
- "_nodeVersion": "5.11.1",
- "_npmOperationalInternal": {
- "host": "packages-16-east.internal.npmjs.com",
- "tmp": "tmp/js-tokens-2.0.0.tgz_1466321890449_0.1510669116396457"
- },
- "_npmUser": {
- "email": "simon.lydell@gmail.com",
- "name": "lydell"
- },
- "_npmVersion": "3.8.6",
- "_phantomChildren": {},
- "_requested": {
- "name": "js-tokens",
- "raw": "js-tokens@^2.0.0",
- "rawSpec": "^2.0.0",
- "scope": null,
- "spec": ">=2.0.0 <3.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/babel-code-frame",
- "/loose-envify"
- ],
- "_resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-2.0.0.tgz",
- "_shasum": "79903f5563ee778cc1162e6dcf1a0027c97f9cb5",
- "_shrinkwrap": null,
- "_spec": "js-tokens@^2.0.0",
- "_where": "/Users/joost/Work/Projects/HackYourFuture/javascript/fundamentals/bug-challenge-es6/node_modules/babel-code-frame",
- "author": {
- "name": "Simon Lydell"
- },
- "bugs": {
- "url": "https://github.com/lydell/js-tokens/issues"
- },
- "dependencies": {},
- "description": "A regex that tokenizes JavaScript.",
- "devDependencies": {
- "coffee-script": "~1.10.0",
- "esprima": "^2.7.2",
- "everything.js": "^1.0.3",
- "mocha": "^2.5.3"
- },
- "directories": {},
- "dist": {
- "shasum": "79903f5563ee778cc1162e6dcf1a0027c97f9cb5",
- "tarball": "https://registry.npmjs.org/js-tokens/-/js-tokens-2.0.0.tgz"
- },
- "files": [
- "index.js"
- ],
- "gitHead": "23fcbe4639fb4baee5dc53616958cc04c8b94026",
- "homepage": "https://github.com/lydell/js-tokens#readme",
- "keywords": [
- "JavaScript",
- "js",
- "token",
- "tokenize",
- "regex"
- ],
- "license": "MIT",
- "maintainers": [
- {
- "email": "simon.lydell@gmail.com",
- "name": "lydell"
- }
- ],
- "name": "js-tokens",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/lydell/js-tokens.git"
- },
- "scripts": {
- "build": "node generate-index.js",
- "dev": "npm run build && npm test",
- "esprima-compare": "node esprima-compare ./index.js everything.js/es5.js",
- "test": "mocha --ui tdd"
- },
- "version": "2.0.0"
-}
diff --git a/fundamentals/bug-challenge-es6/node_modules/js-tokens/readme.md b/fundamentals/bug-challenge-es6/node_modules/js-tokens/readme.md
deleted file mode 100644
index 68e470f0c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/js-tokens/readme.md
+++ /dev/null
@@ -1,217 +0,0 @@
-Overview [](https://travis-ci.org/lydell/js-tokens)
-========
-
-A regex that tokenizes JavaScript.
-
-```js
-var jsTokens = require("js-tokens")
-
-var jsString = "var foo=opts.foo;\n..."
-
-jsString.match(jsTokens)
-// ["var", " ", "foo", "=", "opts", ".", "foo", ";", "\n", ...]
-```
-
-
-Installation
-============
-
-`npm install js-tokens`
-
-```js
-var jsTokens = require("js-tokens")
-```
-
-
-Usage
-=====
-
-### `jsTokens` ###
-
-A regex with the `g` flag that matches JavaScript tokens.
-
-The regex _always_ matches, even invalid JavaScript and the empty string.
-
-The next match is always directly after the previous.
-
-### `var token = jsTokens.matchToToken(match)` ###
-
-Takes a `match` returned by `jsTokens.exec(string)`, and returns a `{type:
-String, value: String}` object. The following types are available:
-
-- string
-- comment
-- regex
-- number
-- name
-- punctuator
-- whitespace
-- invalid
-
-Multi-line comments and strings also have a `closed` property indicating if the
-token was closed or not (see below).
-
-Comments and strings both come in several flavors. To distinguish them, check if
-the token starts with `//`, `/*`, `'`, `"` or `` ` ``.
-
-Names are ECMAScript IdentifierNames, that is, including both identifiers and
-keywords. You may use [is-keyword-js] to tell them apart.
-
-Whitespace includes both line terminators and other whitespace.
-
-For example usage, please see this [gist].
-
-[is-keyword-js]: https://github.com/crissdev/is-keyword-js
-[gist]: https://gist.github.com/lydell/be49dbf80c382c473004
-
-
-ECMAScript support
-==================
-
-The intention is to always support the latest stable ECMAScript version.
-
-If adding support for a newer version requires changes, a new version with a
-major verion bump will be released.
-
-Currently, [ECMAScript 2016] is supported.
-
-[ECMAScript 2016]: http://www.ecma-international.org/ecma-262/7.0/index.html
-
-
-Invalid code handling
-=====================
-
-Unterminated strings are still matched as strings. JavaScript strings cannot
-contain (unescaped) newlines, so unterminated strings simply end at the end of
-the line. Unterminated template strings can contain unescaped newlines, though,
-so they go on to the end of input.
-
-Unterminated multi-line comments are also still matched as comments. They
-simply go on to the end of the input.
-
-Unterminated regex literals are likely matched as division and whatever is
-inside the regex.
-
-Invalid ASCII characters have their own capturing group.
-
-Invalid non-ASCII characters are treated as names, to simplify the matching of
-names (except unicode spaces which are treated as whitespace).
-
-Regex literals may contain invalid regex syntax. They are still matched as
-regex literals. They may also contain repeated regex flags, to keep the regex
-simple.
-
-Strings may contain invalid escape sequences.
-
-
-Limitations
-===========
-
-Tokenizing JavaScript using regexes—in fact, _one single regex_—won’t be
-perfect. But that’s not the point either.
-
-You may compare jsTokens with [esprima] by using `esprima-compare.js`.
-See `npm run esprima-compare`!
-
-[esprima]: http://esprima.org/
-
-### Template string interpolation ###
-
-Template strings are matched as single tokens, from the starting `` ` `` to the
-ending `` ` ``, including interpolations (whose tokens are not matched
-individually).
-
-Matching template string interpolations requires recursive balancing of `{` and
-`}`—something that JavaScript regexes cannot do. Only one level of nesting is
-supported.
-
-### Division and regex literals collision ###
-
-Consider this example:
-
-```js
-var g = 9.82
-var number = bar / 2/g
-
-var regex = / 2/g
-```
-
-A human can easily understand that in the `number` line we’re dealing with
-division, and in the `regex` line we’re dealing with a regex literal. How come?
-Because humans can look at the whole code to put the `/` characters in context.
-A JavaScript regex cannot. It only sees forwards.
-
-When the `jsTokens` regex scans throught the above, it will see the following
-at the end of both the `number` and `regex` rows:
-
-```js
-/ 2/g
-```
-
-It is then impossible to know if that is a regex literal, or part of an
-expression dealing with division.
-
-Here is a similar case:
-
-```js
-foo /= 2/g
-foo(/= 2/g)
-```
-
-The first line divides the `foo` variable with `2/g`. The second line calls the
-`foo` function with the regex literal `/= 2/g`. Again, since `jsTokens` only
-sees forwards, it cannot tell the two cases apart.
-
-There are some cases where we _can_ tell division and regex literals apart,
-though.
-
-First off, we have the simple cases where there’s only one slash in the line:
-
-```js
-var foo = 2/g
-foo /= 2
-```
-
-Regex literals cannot contain newlines, so the above cases are correctly
-identified as division. Things are only problematic when there are more than
-one non-comment slash in a single line.
-
-Secondly, not every character is a valid regex flag.
-
-```js
-var number = bar / 2/e
-```
-
-The above example is also correctly identified as division, because `e` is not a
-valid regex flag. I initially wanted to future-proof by allowing `[a-zA-Z]*`
-(any letter) as flags, but it is not worth it since it increases the amount of
-ambigous cases. So only the standard `g`, `m`, `i`, `y` and `u` flags are
-allowed. This means that the above example will be identified as division as
-long as you don’t rename the `e` variable to some permutation of `gmiyu` 1 to 5
-characters long.
-
-Lastly, we can look _forward_ for information.
-
-- If the token following what looks like a regex literal is not valid after a
- regex literal, but is valid in a division expression, then the regex literal
- is treated as division instead. For example, a flagless regex cannot be
- followed by a string, number or name, but all of those three can be the
- denominator of a division.
-- Generally, if what looks like a regex literal is followed by an operator, the
- regex literal is treated as division instead. This is because regexes are
- seldomly used with operators (such as `+`, `*`, `&&` and `==`), but division
- could likely be part of such an expression.
-
-Please consult the regex source and the test cases for precise information on
-when regex or division is matched (should you need to know). In short, you
-could sum it up as:
-
-If the end of a statement looks like a regex literal (even if it isn’t), it
-will be treated as one. Otherwise it should work as expected (if you write sane
-code).
-
-
-License
-=======
-
-[The X11 (“MIT”) License](LICENSE).
diff --git a/fundamentals/bug-challenge-es6/node_modules/js-yaml/CHANGELOG.md b/fundamentals/bug-challenge-es6/node_modules/js-yaml/CHANGELOG.md
deleted file mode 100644
index 103b1bbc9..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/js-yaml/CHANGELOG.md
+++ /dev/null
@@ -1,409 +0,0 @@
-3.7.0 / 2016-11-12
-------------------
-
-- Fix parsing of quotes followed by newlines (#304, thanks to @dplepage).
-- Support polymorphism for tags (#300, thanks to @monken).
-
-
-3.6.1 / 2016-05-11
-------------------
-
-- Fix output cut on a pipe, #286.
-
-
-3.6.0 / 2016-04-16
-------------------
-
-- Dumper rewrite, fix multiple bugs with trailing `\n`.
- Big thanks to @aepsilon!
-- Loader: fix leading/trailing newlines in block scalars, @aepsilon.
-
-
-3.5.5 / 2016-03-17
-------------------
-
-- Date parse fix: don't allow dates with on digit in month and day, #268.
-
-
-3.5.4 / 2016-03-09
-------------------
-
-- `noCompatMode` for dumper, to disable quoting YAML 1.1 values.
-
-
-3.5.3 / 2016-02-11
-------------------
-
-- Maintenance release.
-
-
-3.5.2 / 2016-01-11
-------------------
-
-- Maintenance: missed comma in bower config.
-
-
-3.5.1 / 2016-01-11
-------------------
-
-- Removed `inherit` dependency, #239.
-- Better browserify workaround for esprima load.
-- Demo rewrite.
-
-
-3.5.0 / 2016-01-10
-------------------
-
-- Dumper. Fold strings only, #217.
-- Dumper. `norefs` option, to clone linked objects, #229.
-- Loader. Throw a warning for duplicate keys, #166.
-- Improved browserify support (mark `esprima` & `Buffer` excluded).
-
-
-3.4.6 / 2015-11-26
-------------------
-
-- Use standalone `inherit` to keep browserified files clear.
-
-
-3.4.5 / 2015-11-23
-------------------
-
-- Added `lineWidth` option to dumper.
-
-
-3.4.4 / 2015-11-21
-------------------
-
-- Fixed floats dump (missed dot for scientific format), #220.
-- Allow non-printable characters inside quoted scalars, #192.
-
-
-3.4.3 / 2015-10-10
-------------------
-
-- Maintenance release - deps bump (esprima, argparse).
-
-
-3.4.2 / 2015-09-09
-------------------
-
-- Fixed serialization of duplicated entries in sequences, #205.
- Thanks to @vogelsgesang.
-
-
-3.4.1 / 2015-09-05
-------------------
-
-- Fixed stacktrace handling in generated errors, for browsers (FF/IE).
-
-
-3.4.0 / 2015-08-23
-------------------
-
-- Fixed multiline keys dump, #197. Thanks to @tcr.
-- Don't throw on warnongs anymore. Use `onWarning` option to catch.
-- Throw error on unknown tags (was warning before).
-- Fixed heading line breaks in some scalars (regression).
-- Reworked internals of error class.
-
-
-3.3.1 / 2015-05-13
-------------------
-
-- Added `.sortKeys` dumper option, thanks to @rjmunro.
-- Fixed astral characters support, #191.
-
-
-3.3.0 / 2015-04-26
-------------------
-
-- Significantly improved long strings formatting in dumper, thanks to @isaacs.
-- Strip BOM if exists.
-
-
-3.2.7 / 2015-02-19
-------------------
-
-- Maintenance release.
-- Updated dependencies.
-- HISTORY.md -> CHANGELOG.md
-
-
-3.2.6 / 2015-02-07
-------------------
-
-- Fixed encoding of UTF-16 surrogate pairs. (e.g. "\U0001F431" CAT FACE).
-- Fixed demo dates dump (#113, thanks to @Hypercubed).
-
-
-3.2.5 / 2014-12-28
-------------------
-
-- Fixed resolving of all built-in types on empty nodes.
-- Fixed invalid warning on empty lines within quoted scalars and flow collections.
-- Fixed bug: Tag on an empty node didn't resolve in some cases.
-
-
-3.2.4 / 2014-12-19
-------------------
-
-- Fixed resolving of !!null tag on an empty node.
-
-
-3.2.3 / 2014-11-08
-------------------
-
-- Implemented dumping of objects with circular and cross references.
-- Partially fixed aliasing of constructed objects. (see issue #141 for details)
-
-
-3.2.2 / 2014-09-07
-------------------
-
-- Fixed infinite loop on unindented block scalars.
-- Rewritten base64 encode/decode in binary type, to keep code licence clear.
-
-
-3.2.1 / 2014-08-24
-------------------
-
-- Nothig new. Just fix npm publish error.
-
-
-3.2.0 / 2014-08-24
-------------------
-
-- Added input piping support to CLI.
-- Fixed typo, that could cause hand on initial indent (#139).
-
-
-3.1.0 / 2014-07-07
-------------------
-
-- 1.5x-2x speed boost.
-- Removed deprecated `require('xxx.yml')` support.
-- Significant code cleanup and refactoring.
-- Internal API changed. If you used custom types - see updated examples.
- Others are not affected.
-- Even if the input string has no trailing line break character,
- it will be parsed as if it has one.
-- Added benchmark scripts.
-- Moved bower files to /dist folder
-- Bugfixes.
-
-
-3.0.2 / 2014-02-27
-------------------
-
-- Fixed bug: "constructor" string parsed as `null`.
-
-
-3.0.1 / 2013-12-22
-------------------
-
-- Fixed parsing of literal scalars. (issue #108)
-- Prevented adding unnecessary spaces in object dumps. (issue #68)
-- Fixed dumping of objects with very long (> 1024 in length) keys.
-
-
-3.0.0 / 2013-12-16
-------------------
-
-- Refactored code. Changed API for custom types.
-- Removed output colors in CLI, dump json by default.
-- Removed big dependencies from browser version (esprima, buffer)
- - load `esprima` manually, if !!js/function needed
- - !!bin now returns Array in browser
-- AMD support.
-- Don't quote dumped strings because of `-` & `?` (if not first char).
-- __Deprecated__ loading yaml files via `require()`, as not recommended
- behaviour for node.
-
-
-2.1.3 / 2013-10-16
-------------------
-
-- Fix wrong loading of empty block scalars.
-
-
-2.1.2 / 2013-10-07
-------------------
-
-- Fix unwanted line breaks in folded scalars.
-
-
-2.1.1 / 2013-10-02
-------------------
-
-- Dumper now respects deprecated booleans syntax from YAML 1.0/1.1
-- Fixed reader bug in JSON-like sequences/mappings.
-
-
-2.1.0 / 2013-06-05
-------------------
-
-- Add standard YAML schemas: Failsafe (`FAILSAFE_SCHEMA`),
- JSON (`JSON_SCHEMA`) and Core (`CORE_SCHEMA`).
-- Rename `DEFAULT_SCHEMA` to `DEFAULT_FULL_SCHEMA`
- and `SAFE_SCHEMA` to `DEFAULT_SAFE_SCHEMA`.
-- Bug fix: export `NIL` constant from the public interface.
-- Add `skipInvalid` dumper option.
-- Use `safeLoad` for `require` extension.
-
-
-2.0.5 / 2013-04-26
-------------------
-
-- Close security issue in !!js/function constructor.
- Big thanks to @nealpoole for security audit.
-
-
-2.0.4 / 2013-04-08
-------------------
-
-- Updated .npmignore to reduce package size
-
-
-2.0.3 / 2013-02-26
-------------------
-
-- Fixed dumping of empty arrays ans objects. ([] and {} instead of null)
-
-
-2.0.2 / 2013-02-15
-------------------
-
-- Fixed input validation: tabs are printable characters.
-
-
-2.0.1 / 2013-02-09
-------------------
-
-- Fixed error, when options not passed to function cass
-
-
-2.0.0 / 2013-02-09
-------------------
-
-- Full rewrite. New architecture. Fast one-stage parsing.
-- Changed custom types API.
-- Added YAML dumper.
-
-
-1.0.3 / 2012-11-05
-------------------
-
-- Fixed utf-8 files loading.
-
-
-1.0.2 / 2012-08-02
-------------------
-
-- Pull out hand-written shims. Use ES5-Shims for old browsers support. See #44.
-- Fix timstamps incorectly parsed in local time when no time part specified.
-
-
-1.0.1 / 2012-07-07
-------------------
-
-- Fixes `TypeError: 'undefined' is not an object` under Safari. Thanks Phuong.
-- Fix timestamps incorrectly parsed in local time. Thanks @caolan. Closes #46.
-
-
-1.0.0 / 2012-07-01
-------------------
-
-- `y`, `yes`, `n`, `no`, `on`, `off` are not converted to Booleans anymore.
- Fixes #42.
-- `require(filename)` now returns a single document and throws an Error if
- file contains more than one document.
-- CLI was merged back from js-yaml.bin
-
-
-0.3.7 / 2012-02-28
-------------------
-
-- Fix export of `addConstructor()`. Closes #39.
-
-
-0.3.6 / 2012-02-22
-------------------
-
-- Removed AMD parts - too buggy to use. Need help to rewrite from scratch
-- Removed YUI compressor warning (renamed `double` variable). Closes #40.
-
-
-0.3.5 / 2012-01-10
-------------------
-
-- Workagound for .npmignore fuckup under windows. Thanks to airportyh.
-
-
-0.3.4 / 2011-12-24
-------------------
-
-- Fixes str[] for oldIEs support.
-- Adds better has change support for browserified demo.
-- improves compact output of Error. Closes #33.
-
-
-0.3.3 / 2011-12-20
-------------------
-
-- jsyaml executable moved to separate module.
-- adds `compact` stringification of Errors.
-
-
-0.3.2 / 2011-12-16
-------------------
-
-- Fixes ug with block style scalars. Closes #26.
-- All sources are passing JSLint now.
-- Fixes bug in Safari. Closes #28.
-- Fixes bug in Opers. Closes #29.
-- Improves browser support. Closes #20.
-- Added jsyaml executable.
-- Added !!js/function support. Closes #12.
-
-
-0.3.1 / 2011-11-18
-------------------
-
-- Added AMD support for browserified version.
-- Wrapped browserified js-yaml into closure.
-- Fixed the resolvement of non-specific tags. Closes #17.
-- Added permalinks for online demo YAML snippets. Now we have YPaste service, lol.
-- Added !!js/regexp and !!js/undefined types. Partially solves #12.
-- Fixed !!set mapping.
-- Fixed month parse in dates. Closes #19.
-
-
-0.3.0 / 2011-11-09
-------------------
-
-- Removed JS.Class dependency. Closes #3.
-- Added browserified version. Closes #13.
-- Added live demo of browserified version.
-- Ported some of the PyYAML tests. See #14.
-- Fixed timestamp bug when fraction was given.
-
-
-0.2.2 / 2011-11-06
-------------------
-
-- Fixed crash on docs without ---. Closes #8.
-- Fixed miltiline string parse
-- Fixed tests/comments for using array as key
-
-
-0.2.1 / 2011-11-02
-------------------
-
-- Fixed short file read (<4k). Closes #9.
-
-
-0.2.0 / 2011-11-02
-------------------
-
-- First public release
diff --git a/fundamentals/bug-challenge-es6/node_modules/js-yaml/LICENSE b/fundamentals/bug-challenge-es6/node_modules/js-yaml/LICENSE
deleted file mode 100644
index 09d3a29e9..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/js-yaml/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-(The MIT License)
-
-Copyright (C) 2011-2015 by Vitaly Puzrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/fundamentals/bug-challenge-es6/node_modules/js-yaml/README.md b/fundamentals/bug-challenge-es6/node_modules/js-yaml/README.md
deleted file mode 100644
index 45c35020c..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/js-yaml/README.md
+++ /dev/null
@@ -1,295 +0,0 @@
-JS-YAML - YAML 1.2 parser / writer for JavaScript
-=================================================
-
-[](https://travis-ci.org/nodeca/js-yaml)
-[](https://www.npmjs.org/package/js-yaml)
-
-__[Online Demo](http://nodeca.github.com/js-yaml/)__
-
-
-This is an implementation of [YAML](http://yaml.org/), a human friendly data
-serialization language. Started as [PyYAML](http://pyyaml.org/) port, it was
-completely rewritten from scratch. Now it's very fast, and supports 1.2 spec.
-
-
-Installation
-------------
-
-### YAML module for node.js
-
-```
-npm install js-yaml
-```
-
-
-### CLI executable
-
-If you want to inspect your YAML files from CLI, install js-yaml globally:
-
-```
-npm install -g js-yaml
-```
-
-#### Usage
-
-```
-usage: js-yaml [-h] [-v] [-c] [-t] file
-
-Positional arguments:
- file File with YAML document(s)
-
-Optional arguments:
- -h, --help Show this help message and exit.
- -v, --version Show program's version number and exit.
- -c, --compact Display errors in compact mode
- -t, --trace Show stack trace on error
-```
-
-
-### Bundled YAML library for browsers
-
-``` html
-
-
-
-
-```
-
-Browser support was done mostly for online demo. If you find any errors - feel
-free to send pull requests with fixes. Also note, that IE and other old browsers
-needs [es5-shims](https://github.com/kriskowal/es5-shim) to operate.
-
-Notes:
-
-1. We have no resources to support browserified version. Don't expect it to be
- well tested. Don't expect fast fixes if something goes wrong there.
-2. `!!js/function` in browser bundle will not work by default. If you really need
- it - load `esprima` parser first (via amd or directly).
-3. `!!bin` in browser will return `Array`, because browsers do not support
- node.js `Buffer` and adding Buffer shims is completely useless on practice.
-
-
-API
----
-
-Here we cover the most 'useful' methods. If you need advanced details (creating
-your own tags), see [wiki](https://github.com/nodeca/js-yaml/wiki) and
-[examples](https://github.com/nodeca/js-yaml/tree/master/examples) for more
-info.
-
-``` javascript
-yaml = require('js-yaml');
-fs = require('fs');
-
-// Get document, or throw exception on error
-try {
- var doc = yaml.safeLoad(fs.readFileSync('/home/ixti/example.yml', 'utf8'));
- console.log(doc);
-} catch (e) {
- console.log(e);
-}
-```
-
-
-### safeLoad (string [ , options ])
-
-**Recommended loading way.** Parses `string` as single YAML document. Returns a JavaScript
-object or throws `YAMLException` on error. By default, does not support regexps,
-functions and undefined. This method is safe for untrusted data.
-
-options:
-
-- `filename` _(default: null)_ - string to be used as a file path in
- error/warning messages.
-- `onWarning` _(default: null)_ - function to call on warning messages.
- Loader will throw on warnings if this function is not provided.
-- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ - specifies a schema to use.
- - `FAILSAFE_SCHEMA` - only strings, arrays and plain objects:
- http://www.yaml.org/spec/1.2/spec.html#id2802346
- - `JSON_SCHEMA` - all JSON-supported types:
- http://www.yaml.org/spec/1.2/spec.html#id2803231
- - `CORE_SCHEMA` - same as `JSON_SCHEMA`:
- http://www.yaml.org/spec/1.2/spec.html#id2804923
- - `DEFAULT_SAFE_SCHEMA` - all supported YAML types, without unsafe ones
- (`!!js/undefined`, `!!js/regexp` and `!!js/function`):
- http://yaml.org/type/
- - `DEFAULT_FULL_SCHEMA` - all supported YAML types.
-- `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error.
-
-NOTE: This function **does not** understand multi-document sources, it throws
-exception on those.
-
-NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions.
-So, JSON schema is not as strict as defined in the YAML specification.
-It allows numbers in any notation, use `Null` and `NULL` as `null`, etc.
-Core schema also has no such restrictions. It allows binary notation for integers.
-
-
-### load (string [ , options ])
-
-**Use with care with untrusted sources**. The same as `safeLoad()` but uses
-`DEFAULT_FULL_SCHEMA` by default - adds some JavaScript-specific types:
-`!!js/function`, `!!js/regexp` and `!!js/undefined`. For untrusted sources you
-must additionally validate object structure, to avoid injections:
-
-``` javascript
-var untrusted_code = '"toString": ! "function (){very_evil_thing();}"';
-
-// I'm just converting that string, what could possibly go wrong?
-require('js-yaml').load(untrusted_code) + ''
-```
-
-
-### safeLoadAll (string, iterator [ , options ])
-
-Same as `safeLoad()`, but understands multi-document sources and apply
-`iterator` to each document.
-
-``` javascript
-var yaml = require('js-yaml');
-
-yaml.safeLoadAll(data, function (doc) {
- console.log(doc);
-});
-```
-
-
-### loadAll (string, iterator [ , options ])
-
-Same as `safeLoadAll()` but uses `DEFAULT_FULL_SCHEMA` by default.
-
-
-### safeDump (object [ , options ])
-
-Serializes `object` as YAML document. Uses `DEFAULT_SAFE_SCHEMA`, so it will
-throw exception if you try to dump regexps or functions. However, you can
-disable exceptions by `skipInvalid` option.
-
-options:
-
-- `indent` _(default: 2)_ - indentation width to use (in spaces).
-- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function
- in the safe schema) and skip pairs and single values with such types.
-- `flowLevel` (default: -1) - specifies level of nesting, when to switch from
- block to flow style for collections. -1 means block style everwhere
-- `styles` - "tag" => "style" map. Each tag may have own set of styles.
-- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ specifies a schema to use.
-- `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a
- function, use the function to sort the keys.
-- `lineWidth` _(default: `80`)_ - set max line width.
-- `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references
-- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older
- yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1
-
-styles:
-
-``` none
-!!null
- "canonical" => "~"
-
-!!int
- "binary" => "0b1", "0b101010", "0b1110001111010"
- "octal" => "01", "052", "016172"
- "decimal" => "1", "42", "7290"
- "hexadecimal" => "0x1", "0x2A", "0x1C7A"
-
-!!null, !!bool, !!float
- "lowercase" => "null", "true", "false", ".nan", '.inf'
- "uppercase" => "NULL", "TRUE", "FALSE", ".NAN", '.INF'
- "camelcase" => "Null", "True", "False", ".NaN", '.Inf'
-```
-
-By default, !!int uses `decimal`, and !!null, !!bool, !!float use `lowercase`.
-
-
-
-### dump (object [ , options ])
-
-Same as `safeDump()` but without limits (uses `DEFAULT_FULL_SCHEMA` by default).
-
-
-Supported YAML types
---------------------
-
-The list of standard YAML tags and corresponding JavaScipt types. See also
-[YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and
-[YAML types repository](http://yaml.org/type/).
-
-```
-!!null '' # null
-!!bool 'yes' # bool
-!!int '3...' # number
-!!float '3.14...' # number
-!!binary '...base64...' # buffer
-!!timestamp 'YYYY-...' # date
-!!omap [ ... ] # array of key-value pairs
-!!pairs [ ... ] # array or array pairs
-!!set { ... } # array of objects with given keys and null values
-!!str '...' # string
-!!seq [ ... ] # array
-!!map { ... } # object
-```
-
-**JavaScript-specific tags**
-
-```
-!!js/regexp /pattern/gim # RegExp
-!!js/undefined '' # Undefined
-!!js/function 'function () {...}' # Function
-```
-
-Caveats
--------
-
-Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects
-or array as keys, and stringifies (by calling .toString method) them at the
-moment of adding them.
-
-``` yaml
----
-? [ foo, bar ]
-: - baz
-? { foo: bar }
-: - baz
- - baz
-```
-
-``` javascript
-{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] }
-```
-
-Also, reading of properties on implicit block mapping keys is not supported yet.
-So, the following YAML document cannot be loaded.
-
-``` yaml
-&anchor foo:
- foo: bar
- *anchor: duplicate key
- baz: bat
- *anchor: duplicate key
-```
-
-
-Breaking changes in 2.x.x -> 3.x.x
-----------------------------------
-
-If you have not used __custom__ tags or loader classes and not loaded yaml
-files via `require()` - no changes needed. Just upgrade library.
-
-Otherwise, you should:
-
-1. Replace all occurences of `require('xxxx.yml')` by `fs.readFileSync()` +
- `yaml.safeLoad()`.
-2. rewrite your custom tags constructors and custom loader
- classes, to conform new API. See
- [examples](https://github.com/nodeca/js-yaml/tree/master/examples) and
- [wiki](https://github.com/nodeca/js-yaml/wiki) for details.
-
-
-License
--------
-
-View the [LICENSE](https://github.com/nodeca/js-yaml/blob/master/LICENSE) file
-(MIT).
diff --git a/fundamentals/bug-challenge-es6/node_modules/js-yaml/bin/js-yaml.js b/fundamentals/bug-challenge-es6/node_modules/js-yaml/bin/js-yaml.js
deleted file mode 100755
index e79186be6..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/js-yaml/bin/js-yaml.js
+++ /dev/null
@@ -1,132 +0,0 @@
-#!/usr/bin/env node
-
-
-'use strict';
-
-/*eslint-disable no-console*/
-
-
-// stdlib
-var fs = require('fs');
-
-
-// 3rd-party
-var argparse = require('argparse');
-
-
-// internal
-var yaml = require('..');
-
-
-////////////////////////////////////////////////////////////////////////////////
-
-
-var cli = new argparse.ArgumentParser({
- prog: 'js-yaml',
- version: require('../package.json').version,
- addHelp: true
-});
-
-
-cli.addArgument([ '-c', '--compact' ], {
- help: 'Display errors in compact mode',
- action: 'storeTrue'
-});
-
-
-// deprecated (not needed after we removed output colors)
-// option suppressed, but not completely removed for compatibility
-cli.addArgument([ '-j', '--to-json' ], {
- help: argparse.Const.SUPPRESS,
- dest: 'json',
- action: 'storeTrue'
-});
-
-
-cli.addArgument([ '-t', '--trace' ], {
- help: 'Show stack trace on error',
- action: 'storeTrue'
-});
-
-cli.addArgument([ 'file' ], {
- help: 'File to read, utf-8 encoded without BOM',
- nargs: '?',
- defaultValue: '-'
-});
-
-
-////////////////////////////////////////////////////////////////////////////////
-
-
-var options = cli.parseArgs();
-
-
-////////////////////////////////////////////////////////////////////////////////
-
-function readFile(filename, encoding, callback) {
- if (options.file === '-') {
- // read from stdin
-
- var chunks = [];
-
- process.stdin.on('data', function (chunk) {
- chunks.push(chunk);
- });
-
- process.stdin.on('end', function () {
- return callback(null, Buffer.concat(chunks).toString(encoding));
- });
- } else {
- fs.readFile(filename, encoding, callback);
- }
-}
-
-readFile(options.file, 'utf8', function (error, input) {
- var output, isYaml;
-
- if (error) {
- if (error.code === 'ENOENT') {
- console.error('File not found: ' + options.file);
- process.exit(2);
- }
-
- console.error(
- options.trace && error.stack ||
- error.message ||
- String(error));
-
- process.exit(1);
- }
-
- try {
- output = JSON.parse(input);
- isYaml = false;
- } catch (err) {
- if (err instanceof SyntaxError) {
- try {
- output = [];
- yaml.loadAll(input, function (doc) { output.push(doc); }, {});
- isYaml = true;
-
- if (output.length === 0) output = null;
- else if (output.length === 1) output = output[0];
-
- } catch (e) {
- if (options.trace && err.stack) console.error(e.stack);
- else console.error(e.toString(options.compact));
-
- process.exit(1);
- }
- } else {
- console.error(
- options.trace && err.stack ||
- err.message ||
- String(err));
-
- process.exit(1);
- }
- }
-
- if (isYaml) console.log(JSON.stringify(output, null, ' '));
- else console.log(yaml.dump(output));
-});
diff --git a/fundamentals/bug-challenge-es6/node_modules/js-yaml/dist/js-yaml.js b/fundamentals/bug-challenge-es6/node_modules/js-yaml/dist/js-yaml.js
deleted file mode 100644
index 49cb23c95..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/js-yaml/dist/js-yaml.js
+++ /dev/null
@@ -1,3855 +0,0 @@
-/* js-yaml 3.7.0 https://github.com/nodeca/js-yaml */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jsyaml = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o */
-var CHAR_QUESTION = 0x3F; /* ? */
-var CHAR_COMMERCIAL_AT = 0x40; /* @ */
-var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
-var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
-var CHAR_GRAVE_ACCENT = 0x60; /* ` */
-var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
-var CHAR_VERTICAL_LINE = 0x7C; /* | */
-var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
-
-var ESCAPE_SEQUENCES = {};
-
-ESCAPE_SEQUENCES[0x00] = '\\0';
-ESCAPE_SEQUENCES[0x07] = '\\a';
-ESCAPE_SEQUENCES[0x08] = '\\b';
-ESCAPE_SEQUENCES[0x09] = '\\t';
-ESCAPE_SEQUENCES[0x0A] = '\\n';
-ESCAPE_SEQUENCES[0x0B] = '\\v';
-ESCAPE_SEQUENCES[0x0C] = '\\f';
-ESCAPE_SEQUENCES[0x0D] = '\\r';
-ESCAPE_SEQUENCES[0x1B] = '\\e';
-ESCAPE_SEQUENCES[0x22] = '\\"';
-ESCAPE_SEQUENCES[0x5C] = '\\\\';
-ESCAPE_SEQUENCES[0x85] = '\\N';
-ESCAPE_SEQUENCES[0xA0] = '\\_';
-ESCAPE_SEQUENCES[0x2028] = '\\L';
-ESCAPE_SEQUENCES[0x2029] = '\\P';
-
-var DEPRECATED_BOOLEANS_SYNTAX = [
- 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
- 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
-];
-
-function compileStyleMap(schema, map) {
- var result, keys, index, length, tag, style, type;
-
- if (map === null) return {};
-
- result = {};
- keys = Object.keys(map);
-
- for (index = 0, length = keys.length; index < length; index += 1) {
- tag = keys[index];
- style = String(map[tag]);
-
- if (tag.slice(0, 2) === '!!') {
- tag = 'tag:yaml.org,2002:' + tag.slice(2);
- }
- type = schema.compiledTypeMap['fallback'][tag];
-
- if (type && _hasOwnProperty.call(type.styleAliases, style)) {
- style = type.styleAliases[style];
- }
-
- result[tag] = style;
- }
-
- return result;
-}
-
-function encodeHex(character) {
- var string, handle, length;
-
- string = character.toString(16).toUpperCase();
-
- if (character <= 0xFF) {
- handle = 'x';
- length = 2;
- } else if (character <= 0xFFFF) {
- handle = 'u';
- length = 4;
- } else if (character <= 0xFFFFFFFF) {
- handle = 'U';
- length = 8;
- } else {
- throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
- }
-
- return '\\' + handle + common.repeat('0', length - string.length) + string;
-}
-
-function State(options) {
- this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
- this.indent = Math.max(1, (options['indent'] || 2));
- this.skipInvalid = options['skipInvalid'] || false;
- this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
- this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
- this.sortKeys = options['sortKeys'] || false;
- this.lineWidth = options['lineWidth'] || 80;
- this.noRefs = options['noRefs'] || false;
- this.noCompatMode = options['noCompatMode'] || false;
-
- this.implicitTypes = this.schema.compiledImplicit;
- this.explicitTypes = this.schema.compiledExplicit;
-
- this.tag = null;
- this.result = '';
-
- this.duplicates = [];
- this.usedDuplicates = null;
-}
-
-// Indents every line in a string. Empty lines (\n only) are not indented.
-function indentString(string, spaces) {
- var ind = common.repeat(' ', spaces),
- position = 0,
- next = -1,
- result = '',
- line,
- length = string.length;
-
- while (position < length) {
- next = string.indexOf('\n', position);
- if (next === -1) {
- line = string.slice(position);
- position = length;
- } else {
- line = string.slice(position, next + 1);
- position = next + 1;
- }
-
- if (line.length && line !== '\n') result += ind;
-
- result += line;
- }
-
- return result;
-}
-
-function generateNextLine(state, level) {
- return '\n' + common.repeat(' ', state.indent * level);
-}
-
-function testImplicitResolving(state, str) {
- var index, length, type;
-
- for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
- type = state.implicitTypes[index];
-
- if (type.resolve(str)) {
- return true;
- }
- }
-
- return false;
-}
-
-// [33] s-white ::= s-space | s-tab
-function isWhitespace(c) {
- return c === CHAR_SPACE || c === CHAR_TAB;
-}
-
-// Returns true if the character can be printed without escaping.
-// From YAML 1.2: "any allowed characters known to be non-printable
-// should also be escaped. [However,] This isn’t mandatory"
-// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
-function isPrintable(c) {
- return (0x00020 <= c && c <= 0x00007E)
- || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
- || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */)
- || (0x10000 <= c && c <= 0x10FFFF);
-}
-
-// Simplified test for values allowed after the first character in plain style.
-function isPlainSafe(c) {
- // Uses a subset of nb-char - c-flow-indicator - ":" - "#"
- // where nb-char ::= c-printable - b-char - c-byte-order-mark.
- return isPrintable(c) && c !== 0xFEFF
- // - c-flow-indicator
- && c !== CHAR_COMMA
- && c !== CHAR_LEFT_SQUARE_BRACKET
- && c !== CHAR_RIGHT_SQUARE_BRACKET
- && c !== CHAR_LEFT_CURLY_BRACKET
- && c !== CHAR_RIGHT_CURLY_BRACKET
- // - ":" - "#"
- && c !== CHAR_COLON
- && c !== CHAR_SHARP;
-}
-
-// Simplified test for values allowed as the first character in plain style.
-function isPlainSafeFirst(c) {
- // Uses a subset of ns-char - c-indicator
- // where ns-char = nb-char - s-white.
- return isPrintable(c) && c !== 0xFEFF
- && !isWhitespace(c) // - s-white
- // - (c-indicator ::=
- // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
- && c !== CHAR_MINUS
- && c !== CHAR_QUESTION
- && c !== CHAR_COLON
- && c !== CHAR_COMMA
- && c !== CHAR_LEFT_SQUARE_BRACKET
- && c !== CHAR_RIGHT_SQUARE_BRACKET
- && c !== CHAR_LEFT_CURLY_BRACKET
- && c !== CHAR_RIGHT_CURLY_BRACKET
- // | “#” | “&” | “*” | “!” | “|” | “>” | “'” | “"”
- && c !== CHAR_SHARP
- && c !== CHAR_AMPERSAND
- && c !== CHAR_ASTERISK
- && c !== CHAR_EXCLAMATION
- && c !== CHAR_VERTICAL_LINE
- && c !== CHAR_GREATER_THAN
- && c !== CHAR_SINGLE_QUOTE
- && c !== CHAR_DOUBLE_QUOTE
- // | “%” | “@” | “`”)
- && c !== CHAR_PERCENT
- && c !== CHAR_COMMERCIAL_AT
- && c !== CHAR_GRAVE_ACCENT;
-}
-
-var STYLE_PLAIN = 1,
- STYLE_SINGLE = 2,
- STYLE_LITERAL = 3,
- STYLE_FOLDED = 4,
- STYLE_DOUBLE = 5;
-
-// Determines which scalar styles are possible and returns the preferred style.
-// lineWidth = -1 => no limit.
-// Pre-conditions: str.length > 0.
-// Post-conditions:
-// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
-// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
-// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
-function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
- var i;
- var char;
- var hasLineBreak = false;
- var hasFoldableLine = false; // only checked if shouldTrackWidth
- var shouldTrackWidth = lineWidth !== -1;
- var previousLineBreak = -1; // count the first line correctly
- var plain = isPlainSafeFirst(string.charCodeAt(0))
- && !isWhitespace(string.charCodeAt(string.length - 1));
-
- if (singleLineOnly) {
- // Case: no block styles.
- // Check for disallowed characters to rule out plain and single.
- for (i = 0; i < string.length; i++) {
- char = string.charCodeAt(i);
- if (!isPrintable(char)) {
- return STYLE_DOUBLE;
- }
- plain = plain && isPlainSafe(char);
- }
- } else {
- // Case: block styles permitted.
- for (i = 0; i < string.length; i++) {
- char = string.charCodeAt(i);
- if (char === CHAR_LINE_FEED) {
- hasLineBreak = true;
- // Check if any line can be folded.
- if (shouldTrackWidth) {
- hasFoldableLine = hasFoldableLine ||
- // Foldable line = too long, and not more-indented.
- (i - previousLineBreak - 1 > lineWidth &&
- string[previousLineBreak + 1] !== ' ');
- previousLineBreak = i;
- }
- } else if (!isPrintable(char)) {
- return STYLE_DOUBLE;
- }
- plain = plain && isPlainSafe(char);
- }
- // in case the end is missing a \n
- hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
- (i - previousLineBreak - 1 > lineWidth &&
- string[previousLineBreak + 1] !== ' '));
- }
- // Although every style can represent \n without escaping, prefer block styles
- // for multiline, since they're more readable and they don't add empty lines.
- // Also prefer folding a super-long line.
- if (!hasLineBreak && !hasFoldableLine) {
- // Strings interpretable as another type have to be quoted;
- // e.g. the string 'true' vs. the boolean true.
- return plain && !testAmbiguousType(string)
- ? STYLE_PLAIN : STYLE_SINGLE;
- }
- // Edge case: block indentation indicator can only have one digit.
- if (string[0] === ' ' && indentPerLevel > 9) {
- return STYLE_DOUBLE;
- }
- // At this point we know block styles are valid.
- // Prefer literal style unless we want to fold.
- return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
-}
-
-// Note: line breaking/folding is implemented for only the folded style.
-// NB. We drop the last trailing newline (if any) of a returned block scalar
-// since the dumper adds its own newline. This always works:
-// • No ending newline => unaffected; already using strip "-" chomping.
-// • Ending newline => removed then restored.
-// Importantly, this keeps the "+" chomp indicator from gaining an extra line.
-function writeScalar(state, string, level, iskey) {
- state.dump = (function () {
- if (string.length === 0) {
- return "''";
- }
- if (!state.noCompatMode &&
- DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
- return "'" + string + "'";
- }
-
- var indent = state.indent * Math.max(1, level); // no 0-indent scalars
- // As indentation gets deeper, let the width decrease monotonically
- // to the lower bound min(state.lineWidth, 40).
- // Note that this implies
- // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound.
- // state.lineWidth > 40 + state.indent: width decreases until the lower bound.
- // This behaves better than a constant minimum width which disallows narrower options,
- // or an indent threshold which causes the width to suddenly increase.
- var lineWidth = state.lineWidth === -1
- ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
-
- // Without knowing if keys are implicit/explicit, assume implicit for safety.
- var singleLineOnly = iskey
- // No block styles in flow mode.
- || (state.flowLevel > -1 && level >= state.flowLevel);
- function testAmbiguity(string) {
- return testImplicitResolving(state, string);
- }
-
- switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
- case STYLE_PLAIN:
- return string;
- case STYLE_SINGLE:
- return "'" + string.replace(/'/g, "''") + "'";
- case STYLE_LITERAL:
- return '|' + blockHeader(string, state.indent)
- + dropEndingNewline(indentString(string, indent));
- case STYLE_FOLDED:
- return '>' + blockHeader(string, state.indent)
- + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
- case STYLE_DOUBLE:
- return '"' + escapeString(string, lineWidth) + '"';
- default:
- throw new YAMLException('impossible error: invalid scalar style');
- }
- }());
-}
-
-// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
-function blockHeader(string, indentPerLevel) {
- var indentIndicator = (string[0] === ' ') ? String(indentPerLevel) : '';
-
- // note the special case: the string '\n' counts as a "trailing" empty line.
- var clip = string[string.length - 1] === '\n';
- var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
- var chomp = keep ? '+' : (clip ? '' : '-');
-
- return indentIndicator + chomp + '\n';
-}
-
-// (See the note for writeScalar.)
-function dropEndingNewline(string) {
- return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
-}
-
-// Note: a long line without a suitable break point will exceed the width limit.
-// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.
-function foldString(string, width) {
- // In folded style, $k$ consecutive newlines output as $k+1$ newlines—
- // unless they're before or after a more-indented line, or at the very
- // beginning or end, in which case $k$ maps to $k$.
- // Therefore, parse each chunk as newline(s) followed by a content line.
- var lineRe = /(\n+)([^\n]*)/g;
-
- // first line (possibly an empty line)
- var result = (function () {
- var nextLF = string.indexOf('\n');
- nextLF = nextLF !== -1 ? nextLF : string.length;
- lineRe.lastIndex = nextLF;
- return foldLine(string.slice(0, nextLF), width);
- }());
- // If we haven't reached the first content line yet, don't add an extra \n.
- var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
- var moreIndented;
-
- // rest of the lines
- var match;
- while ((match = lineRe.exec(string))) {
- var prefix = match[1], line = match[2];
- moreIndented = (line[0] === ' ');
- result += prefix
- + (!prevMoreIndented && !moreIndented && line !== ''
- ? '\n' : '')
- + foldLine(line, width);
- prevMoreIndented = moreIndented;
- }
-
- return result;
-}
-
-// Greedy line breaking.
-// Picks the longest line under the limit each time,
-// otherwise settles for the shortest line over the limit.
-// NB. More-indented lines *cannot* be folded, as that would add an extra \n.
-function foldLine(line, width) {
- if (line === '' || line[0] === ' ') return line;
-
- // Since a more-indented line adds a \n, breaks can't be followed by a space.
- var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
- var match;
- // start is an inclusive index. end, curr, and next are exclusive.
- var start = 0, end, curr = 0, next = 0;
- var result = '';
-
- // Invariants: 0 <= start <= length-1.
- // 0 <= curr <= next <= max(0, length-2). curr - start <= width.
- // Inside the loop:
- // A match implies length >= 2, so curr and next are <= length-2.
- while ((match = breakRe.exec(line))) {
- next = match.index;
- // maintain invariant: curr - start <= width
- if (next - start > width) {
- end = (curr > start) ? curr : next; // derive end <= length-2
- result += '\n' + line.slice(start, end);
- // skip the space that was output as \n
- start = end + 1; // derive start <= length-1
- }
- curr = next;
- }
-
- // By the invariants, start <= length-1, so there is something left over.
- // It is either the whole string or a part starting from non-whitespace.
- result += '\n';
- // Insert a break if the remainder is too long and there is a break available.
- if (line.length - start > width && curr > start) {
- result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
- } else {
- result += line.slice(start);
- }
-
- return result.slice(1); // drop extra \n joiner
-}
-
-// Escapes a double-quoted string.
-function escapeString(string) {
- var result = '';
- var char;
- var escapeSeq;
-
- for (var i = 0; i < string.length; i++) {
- char = string.charCodeAt(i);
- escapeSeq = ESCAPE_SEQUENCES[char];
- result += !escapeSeq && isPrintable(char)
- ? string[i]
- : escapeSeq || encodeHex(char);
- }
-
- return result;
-}
-
-function writeFlowSequence(state, level, object) {
- var _result = '',
- _tag = state.tag,
- index,
- length;
-
- for (index = 0, length = object.length; index < length; index += 1) {
- // Write only valid elements.
- if (writeNode(state, level, object[index], false, false)) {
- if (index !== 0) _result += ', ';
- _result += state.dump;
- }
- }
-
- state.tag = _tag;
- state.dump = '[' + _result + ']';
-}
-
-function writeBlockSequence(state, level, object, compact) {
- var _result = '',
- _tag = state.tag,
- index,
- length;
-
- for (index = 0, length = object.length; index < length; index += 1) {
- // Write only valid elements.
- if (writeNode(state, level + 1, object[index], true, true)) {
- if (!compact || index !== 0) {
- _result += generateNextLine(state, level);
- }
- _result += '- ' + state.dump;
- }
- }
-
- state.tag = _tag;
- state.dump = _result || '[]'; // Empty sequence if no valid values.
-}
-
-function writeFlowMapping(state, level, object) {
- var _result = '',
- _tag = state.tag,
- objectKeyList = Object.keys(object),
- index,
- length,
- objectKey,
- objectValue,
- pairBuffer;
-
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
- pairBuffer = '';
-
- if (index !== 0) pairBuffer += ', ';
-
- objectKey = objectKeyList[index];
- objectValue = object[objectKey];
-
- if (!writeNode(state, level, objectKey, false, false)) {
- continue; // Skip this pair because of invalid key;
- }
-
- if (state.dump.length > 1024) pairBuffer += '? ';
-
- pairBuffer += state.dump + ': ';
-
- if (!writeNode(state, level, objectValue, false, false)) {
- continue; // Skip this pair because of invalid value.
- }
-
- pairBuffer += state.dump;
-
- // Both key and value are valid.
- _result += pairBuffer;
- }
-
- state.tag = _tag;
- state.dump = '{' + _result + '}';
-}
-
-function writeBlockMapping(state, level, object, compact) {
- var _result = '',
- _tag = state.tag,
- objectKeyList = Object.keys(object),
- index,
- length,
- objectKey,
- objectValue,
- explicitPair,
- pairBuffer;
-
- // Allow sorting keys so that the output file is deterministic
- if (state.sortKeys === true) {
- // Default sorting
- objectKeyList.sort();
- } else if (typeof state.sortKeys === 'function') {
- // Custom sort function
- objectKeyList.sort(state.sortKeys);
- } else if (state.sortKeys) {
- // Something is wrong
- throw new YAMLException('sortKeys must be a boolean or a function');
- }
-
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
- pairBuffer = '';
-
- if (!compact || index !== 0) {
- pairBuffer += generateNextLine(state, level);
- }
-
- objectKey = objectKeyList[index];
- objectValue = object[objectKey];
-
- if (!writeNode(state, level + 1, objectKey, true, true, true)) {
- continue; // Skip this pair because of invalid key.
- }
-
- explicitPair = (state.tag !== null && state.tag !== '?') ||
- (state.dump && state.dump.length > 1024);
-
- if (explicitPair) {
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
- pairBuffer += '?';
- } else {
- pairBuffer += '? ';
- }
- }
-
- pairBuffer += state.dump;
-
- if (explicitPair) {
- pairBuffer += generateNextLine(state, level);
- }
-
- if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
- continue; // Skip this pair because of invalid value.
- }
-
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
- pairBuffer += ':';
- } else {
- pairBuffer += ': ';
- }
-
- pairBuffer += state.dump;
-
- // Both key and value are valid.
- _result += pairBuffer;
- }
-
- state.tag = _tag;
- state.dump = _result || '{}'; // Empty mapping if no valid pairs.
-}
-
-function detectType(state, object, explicit) {
- var _result, typeList, index, length, type, style;
-
- typeList = explicit ? state.explicitTypes : state.implicitTypes;
-
- for (index = 0, length = typeList.length; index < length; index += 1) {
- type = typeList[index];
-
- if ((type.instanceOf || type.predicate) &&
- (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
- (!type.predicate || type.predicate(object))) {
-
- state.tag = explicit ? type.tag : '?';
-
- if (type.represent) {
- style = state.styleMap[type.tag] || type.defaultStyle;
-
- if (_toString.call(type.represent) === '[object Function]') {
- _result = type.represent(object, style);
- } else if (_hasOwnProperty.call(type.represent, style)) {
- _result = type.represent[style](object, style);
- } else {
- throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
- }
-
- state.dump = _result;
- }
-
- return true;
- }
- }
-
- return false;
-}
-
-// Serializes `object` and writes it to global `result`.
-// Returns true on success, or false on invalid object.
-//
-function writeNode(state, level, object, block, compact, iskey) {
- state.tag = null;
- state.dump = object;
-
- if (!detectType(state, object, false)) {
- detectType(state, object, true);
- }
-
- var type = _toString.call(state.dump);
-
- if (block) {
- block = (state.flowLevel < 0 || state.flowLevel > level);
- }
-
- var objectOrArray = type === '[object Object]' || type === '[object Array]',
- duplicateIndex,
- duplicate;
-
- if (objectOrArray) {
- duplicateIndex = state.duplicates.indexOf(object);
- duplicate = duplicateIndex !== -1;
- }
-
- if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
- compact = false;
- }
-
- if (duplicate && state.usedDuplicates[duplicateIndex]) {
- state.dump = '*ref_' + duplicateIndex;
- } else {
- if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
- state.usedDuplicates[duplicateIndex] = true;
- }
- if (type === '[object Object]') {
- if (block && (Object.keys(state.dump).length !== 0)) {
- writeBlockMapping(state, level, state.dump, compact);
- if (duplicate) {
- state.dump = '&ref_' + duplicateIndex + state.dump;
- }
- } else {
- writeFlowMapping(state, level, state.dump);
- if (duplicate) {
- state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
- }
- }
- } else if (type === '[object Array]') {
- if (block && (state.dump.length !== 0)) {
- writeBlockSequence(state, level, state.dump, compact);
- if (duplicate) {
- state.dump = '&ref_' + duplicateIndex + state.dump;
- }
- } else {
- writeFlowSequence(state, level, state.dump);
- if (duplicate) {
- state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
- }
- }
- } else if (type === '[object String]') {
- if (state.tag !== '?') {
- writeScalar(state, state.dump, level, iskey);
- }
- } else {
- if (state.skipInvalid) return false;
- throw new YAMLException('unacceptable kind of an object to dump ' + type);
- }
-
- if (state.tag !== null && state.tag !== '?') {
- state.dump = '!<' + state.tag + '> ' + state.dump;
- }
- }
-
- return true;
-}
-
-function getDuplicateReferences(object, state) {
- var objects = [],
- duplicatesIndexes = [],
- index,
- length;
-
- inspectNode(object, objects, duplicatesIndexes);
-
- for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
- state.duplicates.push(objects[duplicatesIndexes[index]]);
- }
- state.usedDuplicates = new Array(length);
-}
-
-function inspectNode(object, objects, duplicatesIndexes) {
- var objectKeyList,
- index,
- length;
-
- if (object !== null && typeof object === 'object') {
- index = objects.indexOf(object);
- if (index !== -1) {
- if (duplicatesIndexes.indexOf(index) === -1) {
- duplicatesIndexes.push(index);
- }
- } else {
- objects.push(object);
-
- if (Array.isArray(object)) {
- for (index = 0, length = object.length; index < length; index += 1) {
- inspectNode(object[index], objects, duplicatesIndexes);
- }
- } else {
- objectKeyList = Object.keys(object);
-
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
- inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
- }
- }
- }
- }
-}
-
-function dump(input, options) {
- options = options || {};
-
- var state = new State(options);
-
- if (!state.noRefs) getDuplicateReferences(input, state);
-
- if (writeNode(state, 0, input, true, true)) return state.dump + '\n';
-
- return '';
-}
-
-function safeDump(input, options) {
- return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
-}
-
-module.exports.dump = dump;
-module.exports.safeDump = safeDump;
-
-},{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(require,module,exports){
-// YAML error class. http://stackoverflow.com/questions/8458984
-//
-'use strict';
-
-function YAMLException(reason, mark) {
- // Super constructor
- Error.call(this);
-
- // Include stack trace in error object
- if (Error.captureStackTrace) {
- // Chrome and NodeJS
- Error.captureStackTrace(this, this.constructor);
- } else {
- // FF, IE 10+ and Safari 6+. Fallback for others
- this.stack = (new Error()).stack || '';
- }
-
- this.name = 'YAMLException';
- this.reason = reason;
- this.mark = mark;
- this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
-}
-
-
-// Inherit from Error
-YAMLException.prototype = Object.create(Error.prototype);
-YAMLException.prototype.constructor = YAMLException;
-
-
-YAMLException.prototype.toString = function toString(compact) {
- var result = this.name + ': ';
-
- result += this.reason || '(unknown reason)';
-
- if (!compact && this.mark) {
- result += ' ' + this.mark.toString();
- }
-
- return result;
-};
-
-
-module.exports = YAMLException;
-
-},{}],5:[function(require,module,exports){
-'use strict';
-
-/*eslint-disable max-len,no-use-before-define*/
-
-var common = require('./common');
-var YAMLException = require('./exception');
-var Mark = require('./mark');
-var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
-var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
-
-
-var _hasOwnProperty = Object.prototype.hasOwnProperty;
-
-
-var CONTEXT_FLOW_IN = 1;
-var CONTEXT_FLOW_OUT = 2;
-var CONTEXT_BLOCK_IN = 3;
-var CONTEXT_BLOCK_OUT = 4;
-
-
-var CHOMPING_CLIP = 1;
-var CHOMPING_STRIP = 2;
-var CHOMPING_KEEP = 3;
-
-
-var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
-var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
-var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
-var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
-var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
-
-
-function is_EOL(c) {
- return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
-}
-
-function is_WHITE_SPACE(c) {
- return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
-}
-
-function is_WS_OR_EOL(c) {
- return (c === 0x09/* Tab */) ||
- (c === 0x20/* Space */) ||
- (c === 0x0A/* LF */) ||
- (c === 0x0D/* CR */);
-}
-
-function is_FLOW_INDICATOR(c) {
- return c === 0x2C/* , */ ||
- c === 0x5B/* [ */ ||
- c === 0x5D/* ] */ ||
- c === 0x7B/* { */ ||
- c === 0x7D/* } */;
-}
-
-function fromHexCode(c) {
- var lc;
-
- if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
- return c - 0x30;
- }
-
- /*eslint-disable no-bitwise*/
- lc = c | 0x20;
-
- if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
- return lc - 0x61 + 10;
- }
-
- return -1;
-}
-
-function escapedHexLen(c) {
- if (c === 0x78/* x */) { return 2; }
- if (c === 0x75/* u */) { return 4; }
- if (c === 0x55/* U */) { return 8; }
- return 0;
-}
-
-function fromDecimalCode(c) {
- if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
- return c - 0x30;
- }
-
- return -1;
-}
-
-function simpleEscapeSequence(c) {
- return (c === 0x30/* 0 */) ? '\x00' :
- (c === 0x61/* a */) ? '\x07' :
- (c === 0x62/* b */) ? '\x08' :
- (c === 0x74/* t */) ? '\x09' :
- (c === 0x09/* Tab */) ? '\x09' :
- (c === 0x6E/* n */) ? '\x0A' :
- (c === 0x76/* v */) ? '\x0B' :
- (c === 0x66/* f */) ? '\x0C' :
- (c === 0x72/* r */) ? '\x0D' :
- (c === 0x65/* e */) ? '\x1B' :
- (c === 0x20/* Space */) ? ' ' :
- (c === 0x22/* " */) ? '\x22' :
- (c === 0x2F/* / */) ? '/' :
- (c === 0x5C/* \ */) ? '\x5C' :
- (c === 0x4E/* N */) ? '\x85' :
- (c === 0x5F/* _ */) ? '\xA0' :
- (c === 0x4C/* L */) ? '\u2028' :
- (c === 0x50/* P */) ? '\u2029' : '';
-}
-
-function charFromCodepoint(c) {
- if (c <= 0xFFFF) {
- return String.fromCharCode(c);
- }
- // Encode UTF-16 surrogate pair
- // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
- return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800,
- ((c - 0x010000) & 0x03FF) + 0xDC00);
-}
-
-var simpleEscapeCheck = new Array(256); // integer, for fast access
-var simpleEscapeMap = new Array(256);
-for (var i = 0; i < 256; i++) {
- simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
- simpleEscapeMap[i] = simpleEscapeSequence(i);
-}
-
-
-function State(input, options) {
- this.input = input;
-
- this.filename = options['filename'] || null;
- this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
- this.onWarning = options['onWarning'] || null;
- this.legacy = options['legacy'] || false;
- this.json = options['json'] || false;
- this.listener = options['listener'] || null;
-
- this.implicitTypes = this.schema.compiledImplicit;
- this.typeMap = this.schema.compiledTypeMap;
-
- this.length = input.length;
- this.position = 0;
- this.line = 0;
- this.lineStart = 0;
- this.lineIndent = 0;
-
- this.documents = [];
-
- /*
- this.version;
- this.checkLineBreaks;
- this.tagMap;
- this.anchorMap;
- this.tag;
- this.anchor;
- this.kind;
- this.result;*/
-
-}
-
-
-function generateError(state, message) {
- return new YAMLException(
- message,
- new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));
-}
-
-function throwError(state, message) {
- throw generateError(state, message);
-}
-
-function throwWarning(state, message) {
- if (state.onWarning) {
- state.onWarning.call(null, generateError(state, message));
- }
-}
-
-
-var directiveHandlers = {
-
- YAML: function handleYamlDirective(state, name, args) {
-
- var match, major, minor;
-
- if (state.version !== null) {
- throwError(state, 'duplication of %YAML directive');
- }
-
- if (args.length !== 1) {
- throwError(state, 'YAML directive accepts exactly one argument');
- }
-
- match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
-
- if (match === null) {
- throwError(state, 'ill-formed argument of the YAML directive');
- }
-
- major = parseInt(match[1], 10);
- minor = parseInt(match[2], 10);
-
- if (major !== 1) {
- throwError(state, 'unacceptable YAML version of the document');
- }
-
- state.version = args[0];
- state.checkLineBreaks = (minor < 2);
-
- if (minor !== 1 && minor !== 2) {
- throwWarning(state, 'unsupported YAML version of the document');
- }
- },
-
- TAG: function handleTagDirective(state, name, args) {
-
- var handle, prefix;
-
- if (args.length !== 2) {
- throwError(state, 'TAG directive accepts exactly two arguments');
- }
-
- handle = args[0];
- prefix = args[1];
-
- if (!PATTERN_TAG_HANDLE.test(handle)) {
- throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
- }
-
- if (_hasOwnProperty.call(state.tagMap, handle)) {
- throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
- }
-
- if (!PATTERN_TAG_URI.test(prefix)) {
- throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
- }
-
- state.tagMap[handle] = prefix;
- }
-};
-
-
-function captureSegment(state, start, end, checkJson) {
- var _position, _length, _character, _result;
-
- if (start < end) {
- _result = state.input.slice(start, end);
-
- if (checkJson) {
- for (_position = 0, _length = _result.length;
- _position < _length;
- _position += 1) {
- _character = _result.charCodeAt(_position);
- if (!(_character === 0x09 ||
- (0x20 <= _character && _character <= 0x10FFFF))) {
- throwError(state, 'expected valid JSON character');
- }
- }
- } else if (PATTERN_NON_PRINTABLE.test(_result)) {
- throwError(state, 'the stream contains non-printable characters');
- }
-
- state.result += _result;
- }
-}
-
-function mergeMappings(state, destination, source, overridableKeys) {
- var sourceKeys, key, index, quantity;
-
- if (!common.isObject(source)) {
- throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
- }
-
- sourceKeys = Object.keys(source);
-
- for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
- key = sourceKeys[index];
-
- if (!_hasOwnProperty.call(destination, key)) {
- destination[key] = source[key];
- overridableKeys[key] = true;
- }
- }
-}
-
-function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode) {
- var index, quantity;
-
- keyNode = String(keyNode);
-
- if (_result === null) {
- _result = {};
- }
-
- if (keyTag === 'tag:yaml.org,2002:merge') {
- if (Array.isArray(valueNode)) {
- for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
- mergeMappings(state, _result, valueNode[index], overridableKeys);
- }
- } else {
- mergeMappings(state, _result, valueNode, overridableKeys);
- }
- } else {
- if (!state.json &&
- !_hasOwnProperty.call(overridableKeys, keyNode) &&
- _hasOwnProperty.call(_result, keyNode)) {
- throwError(state, 'duplicated mapping key');
- }
- _result[keyNode] = valueNode;
- delete overridableKeys[keyNode];
- }
-
- return _result;
-}
-
-function readLineBreak(state) {
- var ch;
-
- ch = state.input.charCodeAt(state.position);
-
- if (ch === 0x0A/* LF */) {
- state.position++;
- } else if (ch === 0x0D/* CR */) {
- state.position++;
- if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
- state.position++;
- }
- } else {
- throwError(state, 'a line break is expected');
- }
-
- state.line += 1;
- state.lineStart = state.position;
-}
-
-function skipSeparationSpace(state, allowComments, checkIndent) {
- var lineBreaks = 0,
- ch = state.input.charCodeAt(state.position);
-
- while (ch !== 0) {
- while (is_WHITE_SPACE(ch)) {
- ch = state.input.charCodeAt(++state.position);
- }
-
- if (allowComments && ch === 0x23/* # */) {
- do {
- ch = state.input.charCodeAt(++state.position);
- } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
- }
-
- if (is_EOL(ch)) {
- readLineBreak(state);
-
- ch = state.input.charCodeAt(state.position);
- lineBreaks++;
- state.lineIndent = 0;
-
- while (ch === 0x20/* Space */) {
- state.lineIndent++;
- ch = state.input.charCodeAt(++state.position);
- }
- } else {
- break;
- }
- }
-
- if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
- throwWarning(state, 'deficient indentation');
- }
-
- return lineBreaks;
-}
-
-function testDocumentSeparator(state) {
- var _position = state.position,
- ch;
-
- ch = state.input.charCodeAt(_position);
-
- // Condition state.position === state.lineStart is tested
- // in parent on each call, for efficiency. No needs to test here again.
- if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
- ch === state.input.charCodeAt(_position + 1) &&
- ch === state.input.charCodeAt(_position + 2)) {
-
- _position += 3;
-
- ch = state.input.charCodeAt(_position);
-
- if (ch === 0 || is_WS_OR_EOL(ch)) {
- return true;
- }
- }
-
- return false;
-}
-
-function writeFoldedLines(state, count) {
- if (count === 1) {
- state.result += ' ';
- } else if (count > 1) {
- state.result += common.repeat('\n', count - 1);
- }
-}
-
-
-function readPlainScalar(state, nodeIndent, withinFlowCollection) {
- var preceding,
- following,
- captureStart,
- captureEnd,
- hasPendingContent,
- _line,
- _lineStart,
- _lineIndent,
- _kind = state.kind,
- _result = state.result,
- ch;
-
- ch = state.input.charCodeAt(state.position);
-
- if (is_WS_OR_EOL(ch) ||
- is_FLOW_INDICATOR(ch) ||
- ch === 0x23/* # */ ||
- ch === 0x26/* & */ ||
- ch === 0x2A/* * */ ||
- ch === 0x21/* ! */ ||
- ch === 0x7C/* | */ ||
- ch === 0x3E/* > */ ||
- ch === 0x27/* ' */ ||
- ch === 0x22/* " */ ||
- ch === 0x25/* % */ ||
- ch === 0x40/* @ */ ||
- ch === 0x60/* ` */) {
- return false;
- }
-
- if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
- following = state.input.charCodeAt(state.position + 1);
-
- if (is_WS_OR_EOL(following) ||
- withinFlowCollection && is_FLOW_INDICATOR(following)) {
- return false;
- }
- }
-
- state.kind = 'scalar';
- state.result = '';
- captureStart = captureEnd = state.position;
- hasPendingContent = false;
-
- while (ch !== 0) {
- if (ch === 0x3A/* : */) {
- following = state.input.charCodeAt(state.position + 1);
-
- if (is_WS_OR_EOL(following) ||
- withinFlowCollection && is_FLOW_INDICATOR(following)) {
- break;
- }
-
- } else if (ch === 0x23/* # */) {
- preceding = state.input.charCodeAt(state.position - 1);
-
- if (is_WS_OR_EOL(preceding)) {
- break;
- }
-
- } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
- withinFlowCollection && is_FLOW_INDICATOR(ch)) {
- break;
-
- } else if (is_EOL(ch)) {
- _line = state.line;
- _lineStart = state.lineStart;
- _lineIndent = state.lineIndent;
- skipSeparationSpace(state, false, -1);
-
- if (state.lineIndent >= nodeIndent) {
- hasPendingContent = true;
- ch = state.input.charCodeAt(state.position);
- continue;
- } else {
- state.position = captureEnd;
- state.line = _line;
- state.lineStart = _lineStart;
- state.lineIndent = _lineIndent;
- break;
- }
- }
-
- if (hasPendingContent) {
- captureSegment(state, captureStart, captureEnd, false);
- writeFoldedLines(state, state.line - _line);
- captureStart = captureEnd = state.position;
- hasPendingContent = false;
- }
-
- if (!is_WHITE_SPACE(ch)) {
- captureEnd = state.position + 1;
- }
-
- ch = state.input.charCodeAt(++state.position);
- }
-
- captureSegment(state, captureStart, captureEnd, false);
-
- if (state.result) {
- return true;
- }
-
- state.kind = _kind;
- state.result = _result;
- return false;
-}
-
-function readSingleQuotedScalar(state, nodeIndent) {
- var ch,
- captureStart, captureEnd;
-
- ch = state.input.charCodeAt(state.position);
-
- if (ch !== 0x27/* ' */) {
- return false;
- }
-
- state.kind = 'scalar';
- state.result = '';
- state.position++;
- captureStart = captureEnd = state.position;
-
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
- if (ch === 0x27/* ' */) {
- captureSegment(state, captureStart, state.position, true);
- ch = state.input.charCodeAt(++state.position);
-
- if (ch === 0x27/* ' */) {
- captureStart = state.position;
- state.position++;
- captureEnd = state.position;
- } else {
- return true;
- }
-
- } else if (is_EOL(ch)) {
- captureSegment(state, captureStart, captureEnd, true);
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
- captureStart = captureEnd = state.position;
-
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
- throwError(state, 'unexpected end of the document within a single quoted scalar');
-
- } else {
- state.position++;
- captureEnd = state.position;
- }
- }
-
- throwError(state, 'unexpected end of the stream within a single quoted scalar');
-}
-
-function readDoubleQuotedScalar(state, nodeIndent) {
- var captureStart,
- captureEnd,
- hexLength,
- hexResult,
- tmp,
- ch;
-
- ch = state.input.charCodeAt(state.position);
-
- if (ch !== 0x22/* " */) {
- return false;
- }
-
- state.kind = 'scalar';
- state.result = '';
- state.position++;
- captureStart = captureEnd = state.position;
-
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
- if (ch === 0x22/* " */) {
- captureSegment(state, captureStart, state.position, true);
- state.position++;
- return true;
-
- } else if (ch === 0x5C/* \ */) {
- captureSegment(state, captureStart, state.position, true);
- ch = state.input.charCodeAt(++state.position);
-
- if (is_EOL(ch)) {
- skipSeparationSpace(state, false, nodeIndent);
-
- // TODO: rework to inline fn with no type cast?
- } else if (ch < 256 && simpleEscapeCheck[ch]) {
- state.result += simpleEscapeMap[ch];
- state.position++;
-
- } else if ((tmp = escapedHexLen(ch)) > 0) {
- hexLength = tmp;
- hexResult = 0;
-
- for (; hexLength > 0; hexLength--) {
- ch = state.input.charCodeAt(++state.position);
-
- if ((tmp = fromHexCode(ch)) >= 0) {
- hexResult = (hexResult << 4) + tmp;
-
- } else {
- throwError(state, 'expected hexadecimal character');
- }
- }
-
- state.result += charFromCodepoint(hexResult);
-
- state.position++;
-
- } else {
- throwError(state, 'unknown escape sequence');
- }
-
- captureStart = captureEnd = state.position;
-
- } else if (is_EOL(ch)) {
- captureSegment(state, captureStart, captureEnd, true);
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
- captureStart = captureEnd = state.position;
-
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
- throwError(state, 'unexpected end of the document within a double quoted scalar');
-
- } else {
- state.position++;
- captureEnd = state.position;
- }
- }
-
- throwError(state, 'unexpected end of the stream within a double quoted scalar');
-}
-
-function readFlowCollection(state, nodeIndent) {
- var readNext = true,
- _line,
- _tag = state.tag,
- _result,
- _anchor = state.anchor,
- following,
- terminator,
- isPair,
- isExplicitPair,
- isMapping,
- overridableKeys = {},
- keyNode,
- keyTag,
- valueNode,
- ch;
-
- ch = state.input.charCodeAt(state.position);
-
- if (ch === 0x5B/* [ */) {
- terminator = 0x5D;/* ] */
- isMapping = false;
- _result = [];
- } else if (ch === 0x7B/* { */) {
- terminator = 0x7D;/* } */
- isMapping = true;
- _result = {};
- } else {
- return false;
- }
-
- if (state.anchor !== null) {
- state.anchorMap[state.anchor] = _result;
- }
-
- ch = state.input.charCodeAt(++state.position);
-
- while (ch !== 0) {
- skipSeparationSpace(state, true, nodeIndent);
-
- ch = state.input.charCodeAt(state.position);
-
- if (ch === terminator) {
- state.position++;
- state.tag = _tag;
- state.anchor = _anchor;
- state.kind = isMapping ? 'mapping' : 'sequence';
- state.result = _result;
- return true;
- } else if (!readNext) {
- throwError(state, 'missed comma between flow collection entries');
- }
-
- keyTag = keyNode = valueNode = null;
- isPair = isExplicitPair = false;
-
- if (ch === 0x3F/* ? */) {
- following = state.input.charCodeAt(state.position + 1);
-
- if (is_WS_OR_EOL(following)) {
- isPair = isExplicitPair = true;
- state.position++;
- skipSeparationSpace(state, true, nodeIndent);
- }
- }
-
- _line = state.line;
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
- keyTag = state.tag;
- keyNode = state.result;
- skipSeparationSpace(state, true, nodeIndent);
-
- ch = state.input.charCodeAt(state.position);
-
- if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
- isPair = true;
- ch = state.input.charCodeAt(++state.position);
- skipSeparationSpace(state, true, nodeIndent);
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
- valueNode = state.result;
- }
-
- if (isMapping) {
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
- } else if (isPair) {
- _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
- } else {
- _result.push(keyNode);
- }
-
- skipSeparationSpace(state, true, nodeIndent);
-
- ch = state.input.charCodeAt(state.position);
-
- if (ch === 0x2C/* , */) {
- readNext = true;
- ch = state.input.charCodeAt(++state.position);
- } else {
- readNext = false;
- }
- }
-
- throwError(state, 'unexpected end of the stream within a flow collection');
-}
-
-function readBlockScalar(state, nodeIndent) {
- var captureStart,
- folding,
- chomping = CHOMPING_CLIP,
- didReadContent = false,
- detectedIndent = false,
- textIndent = nodeIndent,
- emptyLines = 0,
- atMoreIndented = false,
- tmp,
- ch;
-
- ch = state.input.charCodeAt(state.position);
-
- if (ch === 0x7C/* | */) {
- folding = false;
- } else if (ch === 0x3E/* > */) {
- folding = true;
- } else {
- return false;
- }
-
- state.kind = 'scalar';
- state.result = '';
-
- while (ch !== 0) {
- ch = state.input.charCodeAt(++state.position);
-
- if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
- if (CHOMPING_CLIP === chomping) {
- chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
- } else {
- throwError(state, 'repeat of a chomping mode identifier');
- }
-
- } else if ((tmp = fromDecimalCode(ch)) >= 0) {
- if (tmp === 0) {
- throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
- } else if (!detectedIndent) {
- textIndent = nodeIndent + tmp - 1;
- detectedIndent = true;
- } else {
- throwError(state, 'repeat of an indentation width identifier');
- }
-
- } else {
- break;
- }
- }
-
- if (is_WHITE_SPACE(ch)) {
- do { ch = state.input.charCodeAt(++state.position); }
- while (is_WHITE_SPACE(ch));
-
- if (ch === 0x23/* # */) {
- do { ch = state.input.charCodeAt(++state.position); }
- while (!is_EOL(ch) && (ch !== 0));
- }
- }
-
- while (ch !== 0) {
- readLineBreak(state);
- state.lineIndent = 0;
-
- ch = state.input.charCodeAt(state.position);
-
- while ((!detectedIndent || state.lineIndent < textIndent) &&
- (ch === 0x20/* Space */)) {
- state.lineIndent++;
- ch = state.input.charCodeAt(++state.position);
- }
-
- if (!detectedIndent && state.lineIndent > textIndent) {
- textIndent = state.lineIndent;
- }
-
- if (is_EOL(ch)) {
- emptyLines++;
- continue;
- }
-
- // End of the scalar.
- if (state.lineIndent < textIndent) {
-
- // Perform the chomping.
- if (chomping === CHOMPING_KEEP) {
- state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
- } else if (chomping === CHOMPING_CLIP) {
- if (didReadContent) { // i.e. only if the scalar is not empty.
- state.result += '\n';
- }
- }
-
- // Break this `while` cycle and go to the funciton's epilogue.
- break;
- }
-
- // Folded style: use fancy rules to handle line breaks.
- if (folding) {
-
- // Lines starting with white space characters (more-indented lines) are not folded.
- if (is_WHITE_SPACE(ch)) {
- atMoreIndented = true;
- // except for the first content line (cf. Example 8.1)
- state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
-
- // End of more-indented block.
- } else if (atMoreIndented) {
- atMoreIndented = false;
- state.result += common.repeat('\n', emptyLines + 1);
-
- // Just one line break - perceive as the same line.
- } else if (emptyLines === 0) {
- if (didReadContent) { // i.e. only if we have already read some scalar content.
- state.result += ' ';
- }
-
- // Several line breaks - perceive as different lines.
- } else {
- state.result += common.repeat('\n', emptyLines);
- }
-
- // Literal style: just add exact number of line breaks between content lines.
- } else {
- // Keep all line breaks except the header line break.
- state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
- }
-
- didReadContent = true;
- detectedIndent = true;
- emptyLines = 0;
- captureStart = state.position;
-
- while (!is_EOL(ch) && (ch !== 0)) {
- ch = state.input.charCodeAt(++state.position);
- }
-
- captureSegment(state, captureStart, state.position, false);
- }
-
- return true;
-}
-
-function readBlockSequence(state, nodeIndent) {
- var _line,
- _tag = state.tag,
- _anchor = state.anchor,
- _result = [],
- following,
- detected = false,
- ch;
-
- if (state.anchor !== null) {
- state.anchorMap[state.anchor] = _result;
- }
-
- ch = state.input.charCodeAt(state.position);
-
- while (ch !== 0) {
-
- if (ch !== 0x2D/* - */) {
- break;
- }
-
- following = state.input.charCodeAt(state.position + 1);
-
- if (!is_WS_OR_EOL(following)) {
- break;
- }
-
- detected = true;
- state.position++;
-
- if (skipSeparationSpace(state, true, -1)) {
- if (state.lineIndent <= nodeIndent) {
- _result.push(null);
- ch = state.input.charCodeAt(state.position);
- continue;
- }
- }
-
- _line = state.line;
- composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
- _result.push(state.result);
- skipSeparationSpace(state, true, -1);
-
- ch = state.input.charCodeAt(state.position);
-
- if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
- throwError(state, 'bad indentation of a sequence entry');
- } else if (state.lineIndent < nodeIndent) {
- break;
- }
- }
-
- if (detected) {
- state.tag = _tag;
- state.anchor = _anchor;
- state.kind = 'sequence';
- state.result = _result;
- return true;
- }
- return false;
-}
-
-function readBlockMapping(state, nodeIndent, flowIndent) {
- var following,
- allowCompact,
- _line,
- _tag = state.tag,
- _anchor = state.anchor,
- _result = {},
- overridableKeys = {},
- keyTag = null,
- keyNode = null,
- valueNode = null,
- atExplicitKey = false,
- detected = false,
- ch;
-
- if (state.anchor !== null) {
- state.anchorMap[state.anchor] = _result;
- }
-
- ch = state.input.charCodeAt(state.position);
-
- while (ch !== 0) {
- following = state.input.charCodeAt(state.position + 1);
- _line = state.line; // Save the current line.
-
- //
- // Explicit notation case. There are two separate blocks:
- // first for the key (denoted by "?") and second for the value (denoted by ":")
- //
- if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
-
- if (ch === 0x3F/* ? */) {
- if (atExplicitKey) {
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
- keyTag = keyNode = valueNode = null;
- }
-
- detected = true;
- atExplicitKey = true;
- allowCompact = true;
-
- } else if (atExplicitKey) {
- // i.e. 0x3A/* : */ === character after the explicit key.
- atExplicitKey = false;
- allowCompact = true;
-
- } else {
- throwError(state, 'incomplete explicit mapping pair; a key node is missed');
- }
-
- state.position += 1;
- ch = following;
-
- //
- // Implicit notation case. Flow-style node as the key first, then ":", and the value.
- //
- } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
-
- if (state.line === _line) {
- ch = state.input.charCodeAt(state.position);
-
- while (is_WHITE_SPACE(ch)) {
- ch = state.input.charCodeAt(++state.position);
- }
-
- if (ch === 0x3A/* : */) {
- ch = state.input.charCodeAt(++state.position);
-
- if (!is_WS_OR_EOL(ch)) {
- throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
- }
-
- if (atExplicitKey) {
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
- keyTag = keyNode = valueNode = null;
- }
-
- detected = true;
- atExplicitKey = false;
- allowCompact = false;
- keyTag = state.tag;
- keyNode = state.result;
-
- } else if (detected) {
- throwError(state, 'can not read an implicit mapping pair; a colon is missed');
-
- } else {
- state.tag = _tag;
- state.anchor = _anchor;
- return true; // Keep the result of `composeNode`.
- }
-
- } else if (detected) {
- throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
-
- } else {
- state.tag = _tag;
- state.anchor = _anchor;
- return true; // Keep the result of `composeNode`.
- }
-
- } else {
- break; // Reading is done. Go to the epilogue.
- }
-
- //
- // Common reading code for both explicit and implicit notations.
- //
- if (state.line === _line || state.lineIndent > nodeIndent) {
- if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
- if (atExplicitKey) {
- keyNode = state.result;
- } else {
- valueNode = state.result;
- }
- }
-
- if (!atExplicitKey) {
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
- keyTag = keyNode = valueNode = null;
- }
-
- skipSeparationSpace(state, true, -1);
- ch = state.input.charCodeAt(state.position);
- }
-
- if (state.lineIndent > nodeIndent && (ch !== 0)) {
- throwError(state, 'bad indentation of a mapping entry');
- } else if (state.lineIndent < nodeIndent) {
- break;
- }
- }
-
- //
- // Epilogue.
- //
-
- // Special case: last mapping's node contains only the key in explicit notation.
- if (atExplicitKey) {
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
- }
-
- // Expose the resulting mapping.
- if (detected) {
- state.tag = _tag;
- state.anchor = _anchor;
- state.kind = 'mapping';
- state.result = _result;
- }
-
- return detected;
-}
-
-function readTagProperty(state) {
- var _position,
- isVerbatim = false,
- isNamed = false,
- tagHandle,
- tagName,
- ch;
-
- ch = state.input.charCodeAt(state.position);
-
- if (ch !== 0x21/* ! */) return false;
-
- if (state.tag !== null) {
- throwError(state, 'duplication of a tag property');
- }
-
- ch = state.input.charCodeAt(++state.position);
-
- if (ch === 0x3C/* < */) {
- isVerbatim = true;
- ch = state.input.charCodeAt(++state.position);
-
- } else if (ch === 0x21/* ! */) {
- isNamed = true;
- tagHandle = '!!';
- ch = state.input.charCodeAt(++state.position);
-
- } else {
- tagHandle = '!';
- }
-
- _position = state.position;
-
- if (isVerbatim) {
- do { ch = state.input.charCodeAt(++state.position); }
- while (ch !== 0 && ch !== 0x3E/* > */);
-
- if (state.position < state.length) {
- tagName = state.input.slice(_position, state.position);
- ch = state.input.charCodeAt(++state.position);
- } else {
- throwError(state, 'unexpected end of the stream within a verbatim tag');
- }
- } else {
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
-
- if (ch === 0x21/* ! */) {
- if (!isNamed) {
- tagHandle = state.input.slice(_position - 1, state.position + 1);
-
- if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
- throwError(state, 'named tag handle cannot contain such characters');
- }
-
- isNamed = true;
- _position = state.position + 1;
- } else {
- throwError(state, 'tag suffix cannot contain exclamation marks');
- }
- }
-
- ch = state.input.charCodeAt(++state.position);
- }
-
- tagName = state.input.slice(_position, state.position);
-
- if (PATTERN_FLOW_INDICATORS.test(tagName)) {
- throwError(state, 'tag suffix cannot contain flow indicator characters');
- }
- }
-
- if (tagName && !PATTERN_TAG_URI.test(tagName)) {
- throwError(state, 'tag name cannot contain such characters: ' + tagName);
- }
-
- if (isVerbatim) {
- state.tag = tagName;
-
- } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
- state.tag = state.tagMap[tagHandle] + tagName;
-
- } else if (tagHandle === '!') {
- state.tag = '!' + tagName;
-
- } else if (tagHandle === '!!') {
- state.tag = 'tag:yaml.org,2002:' + tagName;
-
- } else {
- throwError(state, 'undeclared tag handle "' + tagHandle + '"');
- }
-
- return true;
-}
-
-function readAnchorProperty(state) {
- var _position,
- ch;
-
- ch = state.input.charCodeAt(state.position);
-
- if (ch !== 0x26/* & */) return false;
-
- if (state.anchor !== null) {
- throwError(state, 'duplication of an anchor property');
- }
-
- ch = state.input.charCodeAt(++state.position);
- _position = state.position;
-
- while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
- ch = state.input.charCodeAt(++state.position);
- }
-
- if (state.position === _position) {
- throwError(state, 'name of an anchor node must contain at least one character');
- }
-
- state.anchor = state.input.slice(_position, state.position);
- return true;
-}
-
-function readAlias(state) {
- var _position, alias,
- ch;
-
- ch = state.input.charCodeAt(state.position);
-
- if (ch !== 0x2A/* * */) return false;
-
- ch = state.input.charCodeAt(++state.position);
- _position = state.position;
-
- while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
- ch = state.input.charCodeAt(++state.position);
- }
-
- if (state.position === _position) {
- throwError(state, 'name of an alias node must contain at least one character');
- }
-
- alias = state.input.slice(_position, state.position);
-
- if (!state.anchorMap.hasOwnProperty(alias)) {
- throwError(state, 'unidentified alias "' + alias + '"');
- }
-
- state.result = state.anchorMap[alias];
- skipSeparationSpace(state, true, -1);
- return true;
-}
-
-function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
- var allowBlockStyles,
- allowBlockScalars,
- allowBlockCollections,
- indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) {
- indentStatus = 1;
- } else if (state.lineIndent === parentIndent) {
- indentStatus = 0;
- } else if (state.lineIndent < parentIndent) {
- indentStatus = -1;
- }
- }
- }
-
- if (indentStatus === 1) {
- while (readTagProperty(state) || readAnchorProperty(state)) {
- if (skipSeparationSpace(state, true, -1)) {
- atNewLine = true;
- allowBlockCollections = allowBlockStyles;
-
- if (state.lineIndent > parentIndent) {
- indentStatus = 1;
- } else if (state.lineIndent === parentIndent) {
- indentStatus = 0;
- } else if (state.lineIndent < parentIndent) {
- indentStatus = -1;
- }
- } else {
- allowBlockCollections = false;
- }
- }
- }
-
- if (allowBlockCollections) {
- allowBlockCollections = atNewLine || allowCompact;
- }
-
- if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
- if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
- flowIndent = parentIndent;
- } else {
- flowIndent = parentIndent + 1;
- }
-
- blockIndent = state.position - state.lineStart;
-
- if (indentStatus === 1) {
- if (allowBlockCollections &&
- (readBlockSequence(state, blockIndent) ||
- readBlockMapping(state, blockIndent, flowIndent)) ||
- readFlowCollection(state, flowIndent)) {
- hasContent = true;
- } else {
- if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
- readSingleQuotedScalar(state, flowIndent) ||
- readDoubleQuotedScalar(state, flowIndent)) {
- hasContent = true;
-
- } else if (readAlias(state)) {
- hasContent = true;
-
- if (state.tag !== null || state.anchor !== null) {
- throwError(state, 'alias node should not have any properties');
- }
-
- } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
- hasContent = true;
-
- if (state.tag === null) {
- state.tag = '?';
- }
- }
-
- if (state.anchor !== null) {
- state.anchorMap[state.anchor] = state.result;
- }
- }
- } else if (indentStatus === 0) {
- // Special case: block sequences are allowed to have same indentation level as the parent.
- // http://www.yaml.org/spec/1.2/spec.html#id2799784
- hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
- }
- }
-
- if (state.tag !== null && state.tag !== '!') {
- if (state.tag === '?') {
- for (typeIndex = 0, typeQuantity = state.implicitTypes.length;
- typeIndex < typeQuantity;
- typeIndex += 1) {
- type = state.implicitTypes[typeIndex];
-
- // Implicit resolving is not allowed for non-scalar types, and '?'
- // non-specific tag is only assigned to plain scalars. So, it isn't
- // needed to check for 'kind' conformity.
-
- if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
- state.result = type.construct(state.result);
- state.tag = type.tag;
- if (state.anchor !== null) {
- state.anchorMap[state.anchor] = state.result;
- }
- break;
- }
- }
- } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
- type = state.typeMap[state.kind || 'fallback'][state.tag];
-
- if (state.result !== null && type.kind !== state.kind) {
- throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
- }
-
- if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched
- throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
- } else {
- state.result = type.construct(state.result);
- if (state.anchor !== null) {
- state.anchorMap[state.anchor] = state.result;
- }
- }
- } else {
- throwError(state, 'unknown tag !<' + state.tag + '>');
- }
- }
-
- if (state.listener !== null) {
- state.listener('close', state);
- }
- return state.tag !== null || state.anchor !== null || hasContent;
-}
-
-function readDocument(state) {
- var documentStart = state.position,
- _position,
- directiveName,
- directiveArgs,
- hasDirectives = false,
- ch;
-
- state.version = null;
- state.checkLineBreaks = state.legacy;
- state.tagMap = {};
- state.anchorMap = {};
-
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
- skipSeparationSpace(state, true, -1);
-
- ch = state.input.charCodeAt(state.position);
-
- if (state.lineIndent > 0 || ch !== 0x25/* % */) {
- break;
- }
-
- hasDirectives = true;
- ch = state.input.charCodeAt(++state.position);
- _position = state.position;
-
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
- ch = state.input.charCodeAt(++state.position);
- }
-
- directiveName = state.input.slice(_position, state.position);
- directiveArgs = [];
-
- if (directiveName.length < 1) {
- throwError(state, 'directive name must not be less than one character in length');
- }
-
- while (ch !== 0) {
- while (is_WHITE_SPACE(ch)) {
- ch = state.input.charCodeAt(++state.position);
- }
-
- if (ch === 0x23/* # */) {
- do { ch = state.input.charCodeAt(++state.position); }
- while (ch !== 0 && !is_EOL(ch));
- break;
- }
-
- if (is_EOL(ch)) break;
-
- _position = state.position;
-
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
- ch = state.input.charCodeAt(++state.position);
- }
-
- directiveArgs.push(state.input.slice(_position, state.position));
- }
-
- if (ch !== 0) readLineBreak(state);
-
- if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
- directiveHandlers[directiveName](state, directiveName, directiveArgs);
- } else {
- throwWarning(state, 'unknown document directive "' + directiveName + '"');
- }
- }
-
- skipSeparationSpace(state, true, -1);
-
- if (state.lineIndent === 0 &&
- state.input.charCodeAt(state.position) === 0x2D/* - */ &&
- state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
- state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
- state.position += 3;
- skipSeparationSpace(state, true, -1);
-
- } else if (hasDirectives) {
- throwError(state, 'directives end mark is expected');
- }
-
- composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
- skipSeparationSpace(state, true, -1);
-
- if (state.checkLineBreaks &&
- PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
- throwWarning(state, 'non-ASCII line breaks are interpreted as content');
- }
-
- state.documents.push(state.result);
-
- if (state.position === state.lineStart && testDocumentSeparator(state)) {
-
- if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
- state.position += 3;
- skipSeparationSpace(state, true, -1);
- }
- return;
- }
-
- if (state.position < (state.length - 1)) {
- throwError(state, 'end of the stream or a document separator is expected');
- } else {
- return;
- }
-}
-
-
-function loadDocuments(input, options) {
- input = String(input);
- options = options || {};
-
- if (input.length !== 0) {
-
- // Add tailing `\n` if not exists
- if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
- input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
- input += '\n';
- }
-
- // Strip BOM
- if (input.charCodeAt(0) === 0xFEFF) {
- input = input.slice(1);
- }
- }
-
- var state = new State(input, options);
-
- // Use 0 as string terminator. That significantly simplifies bounds check.
- state.input += '\0';
-
- while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
- state.lineIndent += 1;
- state.position += 1;
- }
-
- while (state.position < (state.length - 1)) {
- readDocument(state);
- }
-
- return state.documents;
-}
-
-
-function loadAll(input, iterator, options) {
- var documents = loadDocuments(input, options), index, length;
-
- for (index = 0, length = documents.length; index < length; index += 1) {
- iterator(documents[index]);
- }
-}
-
-
-function load(input, options) {
- var documents = loadDocuments(input, options);
-
- if (documents.length === 0) {
- /*eslint-disable no-undefined*/
- return undefined;
- } else if (documents.length === 1) {
- return documents[0];
- }
- throw new YAMLException('expected a single document in the stream, but found more');
-}
-
-
-function safeLoadAll(input, output, options) {
- loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
-}
-
-
-function safeLoad(input, options) {
- return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
-}
-
-
-module.exports.loadAll = loadAll;
-module.exports.load = load;
-module.exports.safeLoadAll = safeLoadAll;
-module.exports.safeLoad = safeLoad;
-
-},{"./common":2,"./exception":4,"./mark":6,"./schema/default_full":9,"./schema/default_safe":10}],6:[function(require,module,exports){
-'use strict';
-
-
-var common = require('./common');
-
-
-function Mark(name, buffer, position, line, column) {
- this.name = name;
- this.buffer = buffer;
- this.position = position;
- this.line = line;
- this.column = column;
-}
-
-
-Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
- var head, start, tail, end, snippet;
-
- if (!this.buffer) return null;
-
- indent = indent || 4;
- maxLength = maxLength || 75;
-
- head = '';
- start = this.position;
-
- while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) {
- start -= 1;
- if (this.position - start > (maxLength / 2 - 1)) {
- head = ' ... ';
- start += 5;
- break;
- }
- }
-
- tail = '';
- end = this.position;
-
- while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) {
- end += 1;
- if (end - this.position > (maxLength / 2 - 1)) {
- tail = ' ... ';
- end -= 5;
- break;
- }
- }
-
- snippet = this.buffer.slice(start, end);
-
- return common.repeat(' ', indent) + head + snippet + tail + '\n' +
- common.repeat(' ', indent + this.position - start + head.length) + '^';
-};
-
-
-Mark.prototype.toString = function toString(compact) {
- var snippet, where = '';
-
- if (this.name) {
- where += 'in "' + this.name + '" ';
- }
-
- where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
-
- if (!compact) {
- snippet = this.getSnippet();
-
- if (snippet) {
- where += ':\n' + snippet;
- }
- }
-
- return where;
-};
-
-
-module.exports = Mark;
-
-},{"./common":2}],7:[function(require,module,exports){
-'use strict';
-
-/*eslint-disable max-len*/
-
-var common = require('./common');
-var YAMLException = require('./exception');
-var Type = require('./type');
-
-
-function compileList(schema, name, result) {
- var exclude = [];
-
- schema.include.forEach(function (includedSchema) {
- result = compileList(includedSchema, name, result);
- });
-
- schema[name].forEach(function (currentType) {
- result.forEach(function (previousType, previousIndex) {
- if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
- exclude.push(previousIndex);
- }
- });
-
- result.push(currentType);
- });
-
- return result.filter(function (type, index) {
- return exclude.indexOf(index) === -1;
- });
-}
-
-
-function compileMap(/* lists... */) {
- var result = {
- scalar: {},
- sequence: {},
- mapping: {},
- fallback: {}
- }, index, length;
-
- function collectType(type) {
- result[type.kind][type.tag] = result['fallback'][type.tag] = type;
- }
-
- for (index = 0, length = arguments.length; index < length; index += 1) {
- arguments[index].forEach(collectType);
- }
- return result;
-}
-
-
-function Schema(definition) {
- this.include = definition.include || [];
- this.implicit = definition.implicit || [];
- this.explicit = definition.explicit || [];
-
- this.implicit.forEach(function (type) {
- if (type.loadKind && type.loadKind !== 'scalar') {
- throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
- }
- });
-
- this.compiledImplicit = compileList(this, 'implicit', []);
- this.compiledExplicit = compileList(this, 'explicit', []);
- this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
-}
-
-
-Schema.DEFAULT = null;
-
-
-Schema.create = function createSchema() {
- var schemas, types;
-
- switch (arguments.length) {
- case 1:
- schemas = Schema.DEFAULT;
- types = arguments[0];
- break;
-
- case 2:
- schemas = arguments[0];
- types = arguments[1];
- break;
-
- default:
- throw new YAMLException('Wrong number of arguments for Schema.create function');
- }
-
- schemas = common.toArray(schemas);
- types = common.toArray(types);
-
- if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
- throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
- }
-
- if (!types.every(function (type) { return type instanceof Type; })) {
- throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
- }
-
- return new Schema({
- include: schemas,
- explicit: types
- });
-};
-
-
-module.exports = Schema;
-
-},{"./common":2,"./exception":4,"./type":13}],8:[function(require,module,exports){
-// Standard YAML's Core schema.
-// http://www.yaml.org/spec/1.2/spec.html#id2804923
-//
-// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
-// So, Core schema has no distinctions from JSON schema is JS-YAML.
-
-
-'use strict';
-
-
-var Schema = require('../schema');
-
-
-module.exports = new Schema({
- include: [
- require('./json')
- ]
-});
-
-},{"../schema":7,"./json":12}],9:[function(require,module,exports){
-// JS-YAML's default schema for `load` function.
-// It is not described in the YAML specification.
-//
-// This schema is based on JS-YAML's default safe schema and includes
-// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
-//
-// Also this schema is used as default base schema at `Schema.create` function.
-
-
-'use strict';
-
-
-var Schema = require('../schema');
-
-
-module.exports = Schema.DEFAULT = new Schema({
- include: [
- require('./default_safe')
- ],
- explicit: [
- require('../type/js/undefined'),
- require('../type/js/regexp'),
- require('../type/js/function')
- ]
-});
-
-},{"../schema":7,"../type/js/function":18,"../type/js/regexp":19,"../type/js/undefined":20,"./default_safe":10}],10:[function(require,module,exports){
-// JS-YAML's default schema for `safeLoad` function.
-// It is not described in the YAML specification.
-//
-// This schema is based on standard YAML's Core schema and includes most of
-// extra types described at YAML tag repository. (http://yaml.org/type/)
-
-
-'use strict';
-
-
-var Schema = require('../schema');
-
-
-module.exports = new Schema({
- include: [
- require('./core')
- ],
- implicit: [
- require('../type/timestamp'),
- require('../type/merge')
- ],
- explicit: [
- require('../type/binary'),
- require('../type/omap'),
- require('../type/pairs'),
- require('../type/set')
- ]
-});
-
-},{"../schema":7,"../type/binary":14,"../type/merge":22,"../type/omap":24,"../type/pairs":25,"../type/set":27,"../type/timestamp":29,"./core":8}],11:[function(require,module,exports){
-// Standard YAML's Failsafe schema.
-// http://www.yaml.org/spec/1.2/spec.html#id2802346
-
-
-'use strict';
-
-
-var Schema = require('../schema');
-
-
-module.exports = new Schema({
- explicit: [
- require('../type/str'),
- require('../type/seq'),
- require('../type/map')
- ]
-});
-
-},{"../schema":7,"../type/map":21,"../type/seq":26,"../type/str":28}],12:[function(require,module,exports){
-// Standard YAML's JSON schema.
-// http://www.yaml.org/spec/1.2/spec.html#id2803231
-//
-// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
-// So, this schema is not such strict as defined in the YAML specification.
-// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
-
-
-'use strict';
-
-
-var Schema = require('../schema');
-
-
-module.exports = new Schema({
- include: [
- require('./failsafe')
- ],
- implicit: [
- require('../type/null'),
- require('../type/bool'),
- require('../type/int'),
- require('../type/float')
- ]
-});
-
-},{"../schema":7,"../type/bool":15,"../type/float":16,"../type/int":17,"../type/null":23,"./failsafe":11}],13:[function(require,module,exports){
-'use strict';
-
-var YAMLException = require('./exception');
-
-var TYPE_CONSTRUCTOR_OPTIONS = [
- 'kind',
- 'resolve',
- 'construct',
- 'instanceOf',
- 'predicate',
- 'represent',
- 'defaultStyle',
- 'styleAliases'
-];
-
-var YAML_NODE_KINDS = [
- 'scalar',
- 'sequence',
- 'mapping'
-];
-
-function compileStyleAliases(map) {
- var result = {};
-
- if (map !== null) {
- Object.keys(map).forEach(function (style) {
- map[style].forEach(function (alias) {
- result[String(alias)] = style;
- });
- });
- }
-
- return result;
-}
-
-function Type(tag, options) {
- options = options || {};
-
- Object.keys(options).forEach(function (name) {
- if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
- throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
- }
- });
-
- // TODO: Add tag format check.
- this.tag = tag;
- this.kind = options['kind'] || null;
- this.resolve = options['resolve'] || function () { return true; };
- this.construct = options['construct'] || function (data) { return data; };
- this.instanceOf = options['instanceOf'] || null;
- this.predicate = options['predicate'] || null;
- this.represent = options['represent'] || null;
- this.defaultStyle = options['defaultStyle'] || null;
- this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
-
- if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
- throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
- }
-}
-
-module.exports = Type;
-
-},{"./exception":4}],14:[function(require,module,exports){
-'use strict';
-
-/*eslint-disable no-bitwise*/
-
-var NodeBuffer;
-
-try {
- // A trick for browserified version, to not include `Buffer` shim
- var _require = require;
- NodeBuffer = _require('buffer').Buffer;
-} catch (__) {}
-
-var Type = require('../type');
-
-
-// [ 64, 65, 66 ] -> [ padding, CR, LF ]
-var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
-
-
-function resolveYamlBinary(data) {
- if (data === null) return false;
-
- var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
-
- // Convert one by one.
- for (idx = 0; idx < max; idx++) {
- code = map.indexOf(data.charAt(idx));
-
- // Skip CR/LF
- if (code > 64) continue;
-
- // Fail on illegal characters
- if (code < 0) return false;
-
- bitlen += 6;
- }
-
- // If there are any bits left, source was corrupted
- return (bitlen % 8) === 0;
-}
-
-function constructYamlBinary(data) {
- var idx, tailbits,
- input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
- max = input.length,
- map = BASE64_MAP,
- bits = 0,
- result = [];
-
- // Collect by 6*4 bits (3 bytes)
-
- for (idx = 0; idx < max; idx++) {
- if ((idx % 4 === 0) && idx) {
- result.push((bits >> 16) & 0xFF);
- result.push((bits >> 8) & 0xFF);
- result.push(bits & 0xFF);
- }
-
- bits = (bits << 6) | map.indexOf(input.charAt(idx));
- }
-
- // Dump tail
-
- tailbits = (max % 4) * 6;
-
- if (tailbits === 0) {
- result.push((bits >> 16) & 0xFF);
- result.push((bits >> 8) & 0xFF);
- result.push(bits & 0xFF);
- } else if (tailbits === 18) {
- result.push((bits >> 10) & 0xFF);
- result.push((bits >> 2) & 0xFF);
- } else if (tailbits === 12) {
- result.push((bits >> 4) & 0xFF);
- }
-
- // Wrap into Buffer for NodeJS and leave Array for browser
- if (NodeBuffer) return new NodeBuffer(result);
-
- return result;
-}
-
-function representYamlBinary(object /*, style*/) {
- var result = '', bits = 0, idx, tail,
- max = object.length,
- map = BASE64_MAP;
-
- // Convert every three bytes to 4 ASCII characters.
-
- for (idx = 0; idx < max; idx++) {
- if ((idx % 3 === 0) && idx) {
- result += map[(bits >> 18) & 0x3F];
- result += map[(bits >> 12) & 0x3F];
- result += map[(bits >> 6) & 0x3F];
- result += map[bits & 0x3F];
- }
-
- bits = (bits << 8) + object[idx];
- }
-
- // Dump tail
-
- tail = max % 3;
-
- if (tail === 0) {
- result += map[(bits >> 18) & 0x3F];
- result += map[(bits >> 12) & 0x3F];
- result += map[(bits >> 6) & 0x3F];
- result += map[bits & 0x3F];
- } else if (tail === 2) {
- result += map[(bits >> 10) & 0x3F];
- result += map[(bits >> 4) & 0x3F];
- result += map[(bits << 2) & 0x3F];
- result += map[64];
- } else if (tail === 1) {
- result += map[(bits >> 2) & 0x3F];
- result += map[(bits << 4) & 0x3F];
- result += map[64];
- result += map[64];
- }
-
- return result;
-}
-
-function isBinary(object) {
- return NodeBuffer && NodeBuffer.isBuffer(object);
-}
-
-module.exports = new Type('tag:yaml.org,2002:binary', {
- kind: 'scalar',
- resolve: resolveYamlBinary,
- construct: constructYamlBinary,
- predicate: isBinary,
- represent: representYamlBinary
-});
-
-},{"../type":13}],15:[function(require,module,exports){
-'use strict';
-
-var Type = require('../type');
-
-function resolveYamlBoolean(data) {
- if (data === null) return false;
-
- var max = data.length;
-
- return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
- (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
-}
-
-function constructYamlBoolean(data) {
- return data === 'true' ||
- data === 'True' ||
- data === 'TRUE';
-}
-
-function isBoolean(object) {
- return Object.prototype.toString.call(object) === '[object Boolean]';
-}
-
-module.exports = new Type('tag:yaml.org,2002:bool', {
- kind: 'scalar',
- resolve: resolveYamlBoolean,
- construct: constructYamlBoolean,
- predicate: isBoolean,
- represent: {
- lowercase: function (object) { return object ? 'true' : 'false'; },
- uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
- camelcase: function (object) { return object ? 'True' : 'False'; }
- },
- defaultStyle: 'lowercase'
-});
-
-},{"../type":13}],16:[function(require,module,exports){
-'use strict';
-
-var common = require('../common');
-var Type = require('../type');
-
-var YAML_FLOAT_PATTERN = new RegExp(
- '^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' +
- '|\\.[0-9_]+(?:[eE][-+][0-9]+)?' +
- '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
- '|[-+]?\\.(?:inf|Inf|INF)' +
- '|\\.(?:nan|NaN|NAN))$');
-
-function resolveYamlFloat(data) {
- if (data === null) return false;
-
- if (!YAML_FLOAT_PATTERN.test(data)) return false;
-
- return true;
-}
-
-function constructYamlFloat(data) {
- var value, sign, base, digits;
-
- value = data.replace(/_/g, '').toLowerCase();
- sign = value[0] === '-' ? -1 : 1;
- digits = [];
-
- if ('+-'.indexOf(value[0]) >= 0) {
- value = value.slice(1);
- }
-
- if (value === '.inf') {
- return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
-
- } else if (value === '.nan') {
- return NaN;
-
- } else if (value.indexOf(':') >= 0) {
- value.split(':').forEach(function (v) {
- digits.unshift(parseFloat(v, 10));
- });
-
- value = 0.0;
- base = 1;
-
- digits.forEach(function (d) {
- value += d * base;
- base *= 60;
- });
-
- return sign * value;
-
- }
- return sign * parseFloat(value, 10);
-}
-
-
-var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
-
-function representYamlFloat(object, style) {
- var res;
-
- if (isNaN(object)) {
- switch (style) {
- case 'lowercase': return '.nan';
- case 'uppercase': return '.NAN';
- case 'camelcase': return '.NaN';
- }
- } else if (Number.POSITIVE_INFINITY === object) {
- switch (style) {
- case 'lowercase': return '.inf';
- case 'uppercase': return '.INF';
- case 'camelcase': return '.Inf';
- }
- } else if (Number.NEGATIVE_INFINITY === object) {
- switch (style) {
- case 'lowercase': return '-.inf';
- case 'uppercase': return '-.INF';
- case 'camelcase': return '-.Inf';
- }
- } else if (common.isNegativeZero(object)) {
- return '-0.0';
- }
-
- res = object.toString(10);
-
- // JS stringifier can build scientific format without dots: 5e-100,
- // while YAML requres dot: 5.e-100. Fix it with simple hack
-
- return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
-}
-
-function isFloat(object) {
- return (Object.prototype.toString.call(object) === '[object Number]') &&
- (object % 1 !== 0 || common.isNegativeZero(object));
-}
-
-module.exports = new Type('tag:yaml.org,2002:float', {
- kind: 'scalar',
- resolve: resolveYamlFloat,
- construct: constructYamlFloat,
- predicate: isFloat,
- represent: representYamlFloat,
- defaultStyle: 'lowercase'
-});
-
-},{"../common":2,"../type":13}],17:[function(require,module,exports){
-'use strict';
-
-var common = require('../common');
-var Type = require('../type');
-
-function isHexCode(c) {
- return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
- ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
- ((0x61/* a */ <= c) && (c <= 0x66/* f */));
-}
-
-function isOctCode(c) {
- return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
-}
-
-function isDecCode(c) {
- return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
-}
-
-function resolveYamlInteger(data) {
- if (data === null) return false;
-
- var max = data.length,
- index = 0,
- hasDigits = false,
- ch;
-
- if (!max) return false;
-
- ch = data[index];
-
- // sign
- if (ch === '-' || ch === '+') {
- ch = data[++index];
- }
-
- if (ch === '0') {
- // 0
- if (index + 1 === max) return true;
- ch = data[++index];
-
- // base 2, base 8, base 16
-
- if (ch === 'b') {
- // base 2
- index++;
-
- for (; index < max; index++) {
- ch = data[index];
- if (ch === '_') continue;
- if (ch !== '0' && ch !== '1') return false;
- hasDigits = true;
- }
- return hasDigits;
- }
-
-
- if (ch === 'x') {
- // base 16
- index++;
-
- for (; index < max; index++) {
- ch = data[index];
- if (ch === '_') continue;
- if (!isHexCode(data.charCodeAt(index))) return false;
- hasDigits = true;
- }
- return hasDigits;
- }
-
- // base 8
- for (; index < max; index++) {
- ch = data[index];
- if (ch === '_') continue;
- if (!isOctCode(data.charCodeAt(index))) return false;
- hasDigits = true;
- }
- return hasDigits;
- }
-
- // base 10 (except 0) or base 60
-
- for (; index < max; index++) {
- ch = data[index];
- if (ch === '_') continue;
- if (ch === ':') break;
- if (!isDecCode(data.charCodeAt(index))) {
- return false;
- }
- hasDigits = true;
- }
-
- if (!hasDigits) return false;
-
- // if !base60 - done;
- if (ch !== ':') return true;
-
- // base60 almost not used, no needs to optimize
- return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
-}
-
-function constructYamlInteger(data) {
- var value = data, sign = 1, ch, base, digits = [];
-
- if (value.indexOf('_') !== -1) {
- value = value.replace(/_/g, '');
- }
-
- ch = value[0];
-
- if (ch === '-' || ch === '+') {
- if (ch === '-') sign = -1;
- value = value.slice(1);
- ch = value[0];
- }
-
- if (value === '0') return 0;
-
- if (ch === '0') {
- if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
- if (value[1] === 'x') return sign * parseInt(value, 16);
- return sign * parseInt(value, 8);
- }
-
- if (value.indexOf(':') !== -1) {
- value.split(':').forEach(function (v) {
- digits.unshift(parseInt(v, 10));
- });
-
- value = 0;
- base = 1;
-
- digits.forEach(function (d) {
- value += (d * base);
- base *= 60;
- });
-
- return sign * value;
-
- }
-
- return sign * parseInt(value, 10);
-}
-
-function isInteger(object) {
- return (Object.prototype.toString.call(object)) === '[object Number]' &&
- (object % 1 === 0 && !common.isNegativeZero(object));
-}
-
-module.exports = new Type('tag:yaml.org,2002:int', {
- kind: 'scalar',
- resolve: resolveYamlInteger,
- construct: constructYamlInteger,
- predicate: isInteger,
- represent: {
- binary: function (object) { return '0b' + object.toString(2); },
- octal: function (object) { return '0' + object.toString(8); },
- decimal: function (object) { return object.toString(10); },
- hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); }
- },
- defaultStyle: 'decimal',
- styleAliases: {
- binary: [ 2, 'bin' ],
- octal: [ 8, 'oct' ],
- decimal: [ 10, 'dec' ],
- hexadecimal: [ 16, 'hex' ]
- }
-});
-
-},{"../common":2,"../type":13}],18:[function(require,module,exports){
-'use strict';
-
-var esprima;
-
-// Browserified version does not have esprima
-//
-// 1. For node.js just require module as deps
-// 2. For browser try to require mudule via external AMD system.
-// If not found - try to fallback to window.esprima. If not
-// found too - then fail to parse.
-//
-try {
- // workaround to exclude package from browserify list.
- var _require = require;
- esprima = _require('esprima');
-} catch (_) {
- /*global window */
- if (typeof window !== 'undefined') esprima = window.esprima;
-}
-
-var Type = require('../../type');
-
-function resolveJavascriptFunction(data) {
- if (data === null) return false;
-
- try {
- var source = '(' + data + ')',
- ast = esprima.parse(source, { range: true });
-
- if (ast.type !== 'Program' ||
- ast.body.length !== 1 ||
- ast.body[0].type !== 'ExpressionStatement' ||
- ast.body[0].expression.type !== 'FunctionExpression') {
- return false;
- }
-
- return true;
- } catch (err) {
- return false;
- }
-}
-
-function constructJavascriptFunction(data) {
- /*jslint evil:true*/
-
- var source = '(' + data + ')',
- ast = esprima.parse(source, { range: true }),
- params = [],
- body;
-
- if (ast.type !== 'Program' ||
- ast.body.length !== 1 ||
- ast.body[0].type !== 'ExpressionStatement' ||
- ast.body[0].expression.type !== 'FunctionExpression') {
- throw new Error('Failed to resolve function');
- }
-
- ast.body[0].expression.params.forEach(function (param) {
- params.push(param.name);
- });
-
- body = ast.body[0].expression.body.range;
-
- // Esprima's ranges include the first '{' and the last '}' characters on
- // function expressions. So cut them out.
- /*eslint-disable no-new-func*/
- return new Function(params, source.slice(body[0] + 1, body[1] - 1));
-}
-
-function representJavascriptFunction(object /*, style*/) {
- return object.toString();
-}
-
-function isFunction(object) {
- return Object.prototype.toString.call(object) === '[object Function]';
-}
-
-module.exports = new Type('tag:yaml.org,2002:js/function', {
- kind: 'scalar',
- resolve: resolveJavascriptFunction,
- construct: constructJavascriptFunction,
- predicate: isFunction,
- represent: representJavascriptFunction
-});
-
-},{"../../type":13}],19:[function(require,module,exports){
-'use strict';
-
-var Type = require('../../type');
-
-function resolveJavascriptRegExp(data) {
- if (data === null) return false;
- if (data.length === 0) return false;
-
- var regexp = data,
- tail = /\/([gim]*)$/.exec(data),
- modifiers = '';
-
- // if regexp starts with '/' it can have modifiers and must be properly closed
- // `/foo/gim` - modifiers tail can be maximum 3 chars
- if (regexp[0] === '/') {
- if (tail) modifiers = tail[1];
-
- if (modifiers.length > 3) return false;
- // if expression starts with /, is should be properly terminated
- if (regexp[regexp.length - modifiers.length - 1] !== '/') return false;
- }
-
- return true;
-}
-
-function constructJavascriptRegExp(data) {
- var regexp = data,
- tail = /\/([gim]*)$/.exec(data),
- modifiers = '';
-
- // `/foo/gim` - tail can be maximum 4 chars
- if (regexp[0] === '/') {
- if (tail) modifiers = tail[1];
- regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
- }
-
- return new RegExp(regexp, modifiers);
-}
-
-function representJavascriptRegExp(object /*, style*/) {
- var result = '/' + object.source + '/';
-
- if (object.global) result += 'g';
- if (object.multiline) result += 'm';
- if (object.ignoreCase) result += 'i';
-
- return result;
-}
-
-function isRegExp(object) {
- return Object.prototype.toString.call(object) === '[object RegExp]';
-}
-
-module.exports = new Type('tag:yaml.org,2002:js/regexp', {
- kind: 'scalar',
- resolve: resolveJavascriptRegExp,
- construct: constructJavascriptRegExp,
- predicate: isRegExp,
- represent: representJavascriptRegExp
-});
-
-},{"../../type":13}],20:[function(require,module,exports){
-'use strict';
-
-var Type = require('../../type');
-
-function resolveJavascriptUndefined() {
- return true;
-}
-
-function constructJavascriptUndefined() {
- /*eslint-disable no-undefined*/
- return undefined;
-}
-
-function representJavascriptUndefined() {
- return '';
-}
-
-function isUndefined(object) {
- return typeof object === 'undefined';
-}
-
-module.exports = new Type('tag:yaml.org,2002:js/undefined', {
- kind: 'scalar',
- resolve: resolveJavascriptUndefined,
- construct: constructJavascriptUndefined,
- predicate: isUndefined,
- represent: representJavascriptUndefined
-});
-
-},{"../../type":13}],21:[function(require,module,exports){
-'use strict';
-
-var Type = require('../type');
-
-module.exports = new Type('tag:yaml.org,2002:map', {
- kind: 'mapping',
- construct: function (data) { return data !== null ? data : {}; }
-});
-
-},{"../type":13}],22:[function(require,module,exports){
-'use strict';
-
-var Type = require('../type');
-
-function resolveYamlMerge(data) {
- return data === '<<' || data === null;
-}
-
-module.exports = new Type('tag:yaml.org,2002:merge', {
- kind: 'scalar',
- resolve: resolveYamlMerge
-});
-
-},{"../type":13}],23:[function(require,module,exports){
-'use strict';
-
-var Type = require('../type');
-
-function resolveYamlNull(data) {
- if (data === null) return true;
-
- var max = data.length;
-
- return (max === 1 && data === '~') ||
- (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
-}
-
-function constructYamlNull() {
- return null;
-}
-
-function isNull(object) {
- return object === null;
-}
-
-module.exports = new Type('tag:yaml.org,2002:null', {
- kind: 'scalar',
- resolve: resolveYamlNull,
- construct: constructYamlNull,
- predicate: isNull,
- represent: {
- canonical: function () { return '~'; },
- lowercase: function () { return 'null'; },
- uppercase: function () { return 'NULL'; },
- camelcase: function () { return 'Null'; }
- },
- defaultStyle: 'lowercase'
-});
-
-},{"../type":13}],24:[function(require,module,exports){
-'use strict';
-
-var Type = require('../type');
-
-var _hasOwnProperty = Object.prototype.hasOwnProperty;
-var _toString = Object.prototype.toString;
-
-function resolveYamlOmap(data) {
- if (data === null) return true;
-
- var objectKeys = [], index, length, pair, pairKey, pairHasKey,
- object = data;
-
- for (index = 0, length = object.length; index < length; index += 1) {
- pair = object[index];
- pairHasKey = false;
-
- if (_toString.call(pair) !== '[object Object]') return false;
-
- for (pairKey in pair) {
- if (_hasOwnProperty.call(pair, pairKey)) {
- if (!pairHasKey) pairHasKey = true;
- else return false;
- }
- }
-
- if (!pairHasKey) return false;
-
- if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
- else return false;
- }
-
- return true;
-}
-
-function constructYamlOmap(data) {
- return data !== null ? data : [];
-}
-
-module.exports = new Type('tag:yaml.org,2002:omap', {
- kind: 'sequence',
- resolve: resolveYamlOmap,
- construct: constructYamlOmap
-});
-
-},{"../type":13}],25:[function(require,module,exports){
-'use strict';
-
-var Type = require('../type');
-
-var _toString = Object.prototype.toString;
-
-function resolveYamlPairs(data) {
- if (data === null) return true;
-
- var index, length, pair, keys, result,
- object = data;
-
- result = new Array(object.length);
-
- for (index = 0, length = object.length; index < length; index += 1) {
- pair = object[index];
-
- if (_toString.call(pair) !== '[object Object]') return false;
-
- keys = Object.keys(pair);
-
- if (keys.length !== 1) return false;
-
- result[index] = [ keys[0], pair[keys[0]] ];
- }
-
- return true;
-}
-
-function constructYamlPairs(data) {
- if (data === null) return [];
-
- var index, length, pair, keys, result,
- object = data;
-
- result = new Array(object.length);
-
- for (index = 0, length = object.length; index < length; index += 1) {
- pair = object[index];
-
- keys = Object.keys(pair);
-
- result[index] = [ keys[0], pair[keys[0]] ];
- }
-
- return result;
-}
-
-module.exports = new Type('tag:yaml.org,2002:pairs', {
- kind: 'sequence',
- resolve: resolveYamlPairs,
- construct: constructYamlPairs
-});
-
-},{"../type":13}],26:[function(require,module,exports){
-'use strict';
-
-var Type = require('../type');
-
-module.exports = new Type('tag:yaml.org,2002:seq', {
- kind: 'sequence',
- construct: function (data) { return data !== null ? data : []; }
-});
-
-},{"../type":13}],27:[function(require,module,exports){
-'use strict';
-
-var Type = require('../type');
-
-var _hasOwnProperty = Object.prototype.hasOwnProperty;
-
-function resolveYamlSet(data) {
- if (data === null) return true;
-
- var key, object = data;
-
- for (key in object) {
- if (_hasOwnProperty.call(object, key)) {
- if (object[key] !== null) return false;
- }
- }
-
- return true;
-}
-
-function constructYamlSet(data) {
- return data !== null ? data : {};
-}
-
-module.exports = new Type('tag:yaml.org,2002:set', {
- kind: 'mapping',
- resolve: resolveYamlSet,
- construct: constructYamlSet
-});
-
-},{"../type":13}],28:[function(require,module,exports){
-'use strict';
-
-var Type = require('../type');
-
-module.exports = new Type('tag:yaml.org,2002:str', {
- kind: 'scalar',
- construct: function (data) { return data !== null ? data : ''; }
-});
-
-},{"../type":13}],29:[function(require,module,exports){
-'use strict';
-
-var Type = require('../type');
-
-var YAML_DATE_REGEXP = new RegExp(
- '^([0-9][0-9][0-9][0-9])' + // [1] year
- '-([0-9][0-9])' + // [2] month
- '-([0-9][0-9])$'); // [3] day
-
-var YAML_TIMESTAMP_REGEXP = new RegExp(
- '^([0-9][0-9][0-9][0-9])' + // [1] year
- '-([0-9][0-9]?)' + // [2] month
- '-([0-9][0-9]?)' + // [3] day
- '(?:[Tt]|[ \\t]+)' + // ...
- '([0-9][0-9]?)' + // [4] hour
- ':([0-9][0-9])' + // [5] minute
- ':([0-9][0-9])' + // [6] second
- '(?:\\.([0-9]*))?' + // [7] fraction
- '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
- '(?::([0-9][0-9]))?))?$'); // [11] tz_minute
-
-function resolveYamlTimestamp(data) {
- if (data === null) return false;
- if (YAML_DATE_REGEXP.exec(data) !== null) return true;
- if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
- return false;
-}
-
-function constructYamlTimestamp(data) {
- var match, year, month, day, hour, minute, second, fraction = 0,
- delta = null, tz_hour, tz_minute, date;
-
- match = YAML_DATE_REGEXP.exec(data);
- if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
-
- if (match === null) throw new Error('Date resolve error');
-
- // match: [1] year [2] month [3] day
-
- year = +(match[1]);
- month = +(match[2]) - 1; // JS month starts with 0
- day = +(match[3]);
-
- if (!match[4]) { // no hour
- return new Date(Date.UTC(year, month, day));
- }
-
- // match: [4] hour [5] minute [6] second [7] fraction
-
- hour = +(match[4]);
- minute = +(match[5]);
- second = +(match[6]);
-
- if (match[7]) {
- fraction = match[7].slice(0, 3);
- while (fraction.length < 3) { // milli-seconds
- fraction += '0';
- }
- fraction = +fraction;
- }
-
- // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
-
- if (match[9]) {
- tz_hour = +(match[10]);
- tz_minute = +(match[11] || 0);
- delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
- if (match[9] === '-') delta = -delta;
- }
-
- date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
-
- if (delta) date.setTime(date.getTime() - delta);
-
- return date;
-}
-
-function representYamlTimestamp(object /*, style*/) {
- return object.toISOString();
-}
-
-module.exports = new Type('tag:yaml.org,2002:timestamp', {
- kind: 'scalar',
- resolve: resolveYamlTimestamp,
- construct: constructYamlTimestamp,
- instanceOf: Date,
- represent: representYamlTimestamp
-});
-
-},{"../type":13}],"/":[function(require,module,exports){
-'use strict';
-
-
-var yaml = require('./lib/js-yaml.js');
-
-
-module.exports = yaml;
-
-},{"./lib/js-yaml.js":1}]},{},[])("/")
-});
\ No newline at end of file
diff --git a/fundamentals/bug-challenge-es6/node_modules/js-yaml/dist/js-yaml.min.js b/fundamentals/bug-challenge-es6/node_modules/js-yaml/dist/js-yaml.min.js
deleted file mode 100644
index 211c64ce3..000000000
--- a/fundamentals/bug-challenge-es6/node_modules/js-yaml/dist/js-yaml.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/* js-yaml 3.7.0 https://github.com/nodeca/js-yaml */
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.jsyaml=e()}}(function(){return function e(t,n,i){function r(a,s){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return r(n?n:e)},l,l.exports,e,t,n,i)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;ai&&" "!==e[h+1],h=o);else if(!l(a))return le;m=m&&p(a)}c=c||d&&o-h-1>i&&" "!==e[h+1]}return s||c?" "===e[0]&&n>9?le:c?ue:ce:m&&!r(e)?ae:se}function h(e,t,n,i){e.dump=function(){function r(t){return c(e,t)}if(0===t.length)return"''";if(!e.noCompatMode&&oe.indexOf(t)!==-1)return"'"+t+"'";var o=e.indent*Math.max(1,n),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),u=i||e.flowLevel>-1&&n>=e.flowLevel;switch(d(t,u,e.indent,s,r)){case ae:return t;case se:return"'"+t.replace(/'/g,"''")+"'";case ce:return"|"+m(t,e.indent)+g(a(t,o));case ue:return">"+m(t,e.indent)+g(a(y(t,s),o));case le:return'"'+v(t,s)+'"';default:throw new N("impossible error: invalid scalar style")}}()}function m(e,t){var n=" "===e[0]?String(t):"",i="\n"===e[e.length-1],r=i&&("\n"===e[e.length-2]||"\n"===e),o=r?"+":i?"":"-";return n+o+"\n"}function g(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function y(e,t){for(var n,i,r=/(\n+)([^\n]*)/g,o=function(){var n=e.indexOf("\n");return n=n!==-1?n:e.length,r.lastIndex=n,x(e.slice(0,n),t)}(),a="\n"===e[0]||" "===e[0];i=r.exec(e);){var s=i[1],c=i[2];n=" "===c[0],o+=s+(a||n||""===c?"":"\n")+x(c,t),a=n}return o}function x(e,t){if(""===e||" "===e[0])return e;for(var n,i,r=/ [^ ]/g,o=0,a=0,s=0,c="";n=r.exec(e);)s=n.index,s-o>t&&(i=a>o?a:s,c+="\n"+e.slice(o,i),o=i+1),a=s;return c+="\n",c+=e.length-o>t&&a>o?e.slice(o,a)+"\n"+e.slice(a+1):e.slice(o),c.slice(1)}function v(e){for(var t,n,i="",o=0;o1024&&(s+="? "),s+=e.dump+": ",j(e,t,a,!1,!1)&&(s+=e.dump,c+=s));e.tag=u,e.dump="{"+c+"}"}function C(e,t,n,i){var r,o,a,c,u,l,p="",f=e.tag,d=Object.keys(n);if(e.sortKeys===!0)d.sort();else if("function"==typeof e.sortKeys)d.sort(e.sortKeys);else if(e.sortKeys)throw new N("sortKeys must be a boolean or a function");for(r=0,o=d.length;r1024,u&&(l+=e.dump&&U===e.dump.charCodeAt(0)?"?":"? "),l+=e.dump,u&&(l+=s(e,t)),j(e,t+1,c,!0,u)&&(l+=e.dump&&U===e.dump.charCodeAt(0)?":":": ",l+=e.dump,p+=l));e.tag=f,e.dump=p||"{}"}function k(e,t,n){var i,r,o,a,s,c;for(r=n?e.explicitTypes:e.implicitTypes,o=0,a=r.length;o tag resolver accepts not "'+c+'" style');i=s.represent[c](t,c)}e.dump=i}return!0}return!1}function j(e,t,n,i,r,o){e.tag=null,e.dump=n,k(e,n,!1)||k(e,n,!0);var a=T.call(e.dump);i&&(i=e.flowLevel<0||e.flowLevel>t);var s,c,u="[object Object]"===a||"[object Array]"===a;if(u&&(s=e.duplicates.indexOf(n),c=s!==-1),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&t>0)&&(r=!1),c&&e.usedDuplicates[s])e.dump="*ref_"+s;else{if(u&&c&&!e.usedDuplicates[s]&&(e.usedDuplicates[s]=!0),"[object Object]"===a)i&&0!==Object.keys(e.dump).length?(C(e,t,e.dump,r),c&&(e.dump="&ref_"+s+e.dump)):(w(e,t,e.dump),c&&(e.dump="&ref_"+s+" "+e.dump));else if("[object Array]"===a)i&&0!==e.dump.length?(b(e,t,e.dump,r),c&&(e.dump="&ref_"+s+e.dump)):(A(e,t,e.dump),c&&(e.dump="&ref_"+s+" "+e.dump));else{if("[object String]"!==a){if(e.skipInvalid)return!1;throw new N("unacceptable kind of an object to dump "+a)}"?"!==e.tag&&h(e,e.dump,t,o)}null!==e.tag&&"?"!==e.tag&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function I(e,t){var n,i,r=[],o=[];for(S(e,r,o),n=0,i=o.length;n>10)+55296,(e-65536&1023)+56320)}function f(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||K,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function d(e,t){return new P(t,new W(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function h(e,t){throw d(e,t)}function m(e,t){e.onWarning&&e.onWarning.call(null,d(e,t))}function g(e,t,n,i){var r,o,a,s;if(t1&&(e.result+=R.repeat("\n",t-1))}function C(e,t,n){var s,c,u,l,p,f,d,h,m,y=e.kind,x=e.result;if(m=e.input.charCodeAt(e.position),o(m)||a(m)||35===m||38===m||42===m||33===m||124===m||62===m||39===m||34===m||37===m||64===m||96===m)return!1;if((63===m||45===m)&&(c=e.input.charCodeAt(e.position+1),o(c)||n&&a(c)))return!1;for(e.kind="scalar",e.result="",u=l=e.position,p=!1;0!==m;){if(58===m){if(c=e.input.charCodeAt(e.position+1),o(c)||n&&a(c))break}else if(35===m){if(s=e.input.charCodeAt(e.position-1),o(s))break}else{if(e.position===e.lineStart&&b(e)||n&&a(m))break;if(i(m)){if(f=e.line,d=e.lineStart,h=e.lineIndent,A(e,!1,-1),e.lineIndent>=t){p=!0,m=e.input.charCodeAt(e.position);continue}e.position=l,e.line=f,e.lineStart=d,e.lineIndent=h;break}}p&&(g(e,u,l,!1),w(e,e.line-f),u=l=e.position,p=!1),r(m)||(l=e.position+1),m=e.input.charCodeAt(++e.position)}return g(e,u,l,!1),!!e.result||(e.kind=y,e.result=x,!1)}function k(e,t){var n,r,o;if(n=e.input.charCodeAt(e.position),39!==n)return!1;for(e.kind="scalar",e.result="",e.position++,r=o=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(g(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),39!==n)return!0;r=e.position,e.position++,o=e.position}else i(n)?(g(e,r,o,!0),w(e,A(e,!1,t)),r=o=e.position):e.position===e.lineStart&&b(e)?h(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);h(e,"unexpected end of the stream within a single quoted scalar")}function j(e,t){var n,r,o,a,u,l;if(l=e.input.charCodeAt(e.position),34!==l)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;0!==(l=e.input.charCodeAt(e.position));){if(34===l)return g(e,n,e.position,!0),e.position++,!0;if(92===l){if(g(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),i(l))A(e,!1,t);else if(l<256&&re[l])e.result+=oe[l],e.position++;else if((u=c(l))>0){for(o=u,a=0;o>0;o--)l=e.input.charCodeAt(++e.position),(u=s(l))>=0?a=(a<<4)+u:h(e,"expected hexadecimal character");e.result+=p(a),e.position++}else h(e,"unknown escape sequence");n=r=e.position}else i(l)?(g(e,n,r,!0),w(e,A(e,!1,t)),n=r=e.position):e.position===e.lineStart&&b(e)?h(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}h(e,"unexpected end of the stream within a double quoted scalar")}function I(e,t){var n,i,r,a,s,c,u,l,p,f,d,m=!0,g=e.tag,y=e.anchor,v={};if(d=e.input.charCodeAt(e.position),91===d)a=93,u=!1,i=[];else{if(123!==d)return!1;a=125,u=!0,i={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),d=e.input.charCodeAt(++e.position);0!==d;){if(A(e,!0,t),d=e.input.charCodeAt(e.position),d===a)return e.position++,e.tag=g,e.anchor=y,e.kind=u?"mapping":"sequence",e.result=i,!0;m||h(e,"missed comma between flow collection entries"),p=l=f=null,s=c=!1,63===d&&(r=e.input.charCodeAt(e.position+1),o(r)&&(s=c=!0,e.position++,A(e,!0,t))),n=e.line,_(e,t,H,!1,!0),p=e.tag,l=e.result,A(e,!0,t),d=e.input.charCodeAt(e.position),!c&&e.line!==n||58!==d||(s=!0,d=e.input.charCodeAt(++e.position),A(e,!0,t),_(e,t,H,!1,!0),f=e.result),u?x(e,i,v,p,l,f):s?i.push(x(e,null,v,p,l,f)):i.push(l),A(e,!0,t),d=e.input.charCodeAt(e.position),44===d?(m=!0,d=e.input.charCodeAt(++e.position)):m=!1}h(e,"unexpected end of the stream within a flow collection")}function S(e,t){var n,o,a,s,c=z,l=!1,p=!1,f=t,d=0,m=!1;if(s=e.input.charCodeAt(e.position),124===s)o=!1;else{if(62!==s)return!1;o=!0}for(e.kind="scalar",e.result="";0!==s;)if(s=e.input.charCodeAt(++e.position),43===s||45===s)z===c?c=43===s?Q:J:h(e,"repeat of a chomping mode identifier");else{if(!((a=u(s))>=0))break;0===a?h(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):p?h(e,"repeat of an indentation width identifier"):(f=t+a-1,p=!0)}if(r(s)){do s=e.input.charCodeAt(++e.position);while(r(s));if(35===s)do s=e.input.charCodeAt(++e.position);while(!i(s)&&0!==s)}for(;0!==s;){for(v(e),e.lineIndent=0,s=e.input.charCodeAt(e.position);(!p||e.lineIndentf&&(f=e.lineIndent),i(s))d++;else{if(e.lineIndent