initial commit taken from gitlab.lrz.de

This commit is contained in:
privatereese
2018-08-24 18:09:42 +02:00
parent ae54ed4c48
commit fc05486403
28494 changed files with 2159823 additions and 0 deletions

105
node_modules/jest-jasmine2/build/assert_support.js generated vendored Normal file
View File

@@ -0,0 +1,105 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jestMatcherUtils = require('jest-matcher-utils');
var _chalk = require('chalk');
var _chalk2 = _interopRequireDefault(_chalk);
var _jestDiff = require('jest-diff');
var _jestDiff2 = _interopRequireDefault(_jestDiff);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const assertOperatorsMap = {
'!=': 'notEqual',
'!==': 'notStrictEqual',
'==': 'equal',
'===': 'strictEqual'
};
const humanReadableOperators = {
deepEqual: 'to deeply equal',
deepStrictEqual: 'to deeply and strictly equal',
equal: 'to be equal',
notDeepEqual: 'not to deeply equal',
notDeepStrictEqual: 'not to deeply and strictly equal',
notEqual: 'to not be equal',
notStrictEqual: 'not be strictly equal',
strictEqual: 'to strictly be equal'
};
const getOperatorName = (operator, stack) => {
if (typeof operator === 'string') {
return assertOperatorsMap[operator] || operator;
}
if (stack.match('.doesNotThrow')) {
return 'doesNotThrow';
}
if (stack.match('.throws')) {
return 'throws';
}
return '';
};
const operatorMessage = operator => {
const niceOperatorName = getOperatorName(operator, '');
// $FlowFixMe: we default to the operator itself, so holes in the map doesn't matter
const humanReadableOperator = humanReadableOperators[niceOperatorName];
return typeof operator === 'string' ? `${humanReadableOperator || niceOperatorName} to:\n` : '';
};
const assertThrowingMatcherHint = operatorName => {
return _chalk2.default.dim('assert') + _chalk2.default.dim('.' + operatorName + '(') + _chalk2.default.red('function') + _chalk2.default.dim(')');
};
const assertMatcherHint = (operator, operatorName) => {
let message = _chalk2.default.dim('assert') + _chalk2.default.dim('.' + operatorName + '(') + _chalk2.default.red('received') + _chalk2.default.dim(', ') + _chalk2.default.green('expected') + _chalk2.default.dim(')');
if (operator === '==') {
message += ' or ' + _chalk2.default.dim('assert') + _chalk2.default.dim('(') + _chalk2.default.red('received') + _chalk2.default.dim(') ');
}
return message;
};
function assertionErrorMessage(error, options) {
const expected = error.expected,
actual = error.actual,
generatedMessage = error.generatedMessage,
message = error.message,
operator = error.operator,
stack = error.stack;
const diffString = (0, _jestDiff2.default)(expected, actual, options);
const hasCustomMessage = !generatedMessage;
const operatorName = getOperatorName(operator, stack);
const trimmedStack = stack.replace(message, '').replace(/AssertionError(.*)/g, '');
if (operatorName === 'doesNotThrow') {
return assertThrowingMatcherHint(operatorName) + '\n\n' + _chalk2.default.reset(`Expected the function not to throw an error.\n`) + _chalk2.default.reset(`Instead, it threw:\n`) + ` ${(0, _jestMatcherUtils.printReceived)(actual)}` + _chalk2.default.reset(hasCustomMessage ? '\n\nMessage:\n ' + message : '') + trimmedStack;
}
if (operatorName === 'throws') {
return assertThrowingMatcherHint(operatorName) + '\n\n' + _chalk2.default.reset(`Expected the function to throw an error.\n`) + _chalk2.default.reset(`But it didn't throw anything.`) + _chalk2.default.reset(hasCustomMessage ? '\n\nMessage:\n ' + message : '') + trimmedStack;
}
return assertMatcherHint(operator, operatorName) + '\n\n' + _chalk2.default.reset(`Expected value ${operatorMessage(operator)}`) + ` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` + _chalk2.default.reset(`Received:\n`) + ` ${(0, _jestMatcherUtils.printReceived)(actual)}` + _chalk2.default.reset(hasCustomMessage ? '\n\nMessage:\n ' + message : '') + (diffString ? `\n\nDifference:\n\n${diffString}` : '') + trimmedStack;
}
exports.default = assertionErrorMessage;

16
node_modules/jest-jasmine2/build/expectation_failed.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
class ExpectationFailed extends Error {}
exports.default = ExpectationFailed;

View File

@@ -0,0 +1,68 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = expectationResultFactory;
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
function messageFormatter(_ref) {
let error = _ref.error,
message = _ref.message,
passed = _ref.passed;
if (passed) {
return 'Passed.';
}
if (message) {
return message;
}
if (!error) {
return '';
}
return error.message && error.name ? `${error.name}: ${error.message}` : `${error.toString()} thrown`;
}
function stackFormatter(options, errorMessage) {
if (options.passed) {
return '';
}
var _ref2 = options.error || new Error(errorMessage);
const stack = _ref2.stack;
return stack;
}
function expectationResultFactory(options) {
const message = messageFormatter(options);
const stack = stackFormatter(options, message);
if (options.passed) {
return {
error: options.error,
matcherName: options.matcherName,
message,
passed: options.passed,
stack
};
}
return {
actual: options.actual,
error: options.error,
expected: options.expected,
matcherName: options.matcherName,
message,
passed: options.passed,
stack
};
}

189
node_modules/jest-jasmine2/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,189 @@
'use strict';
let jasmine2 = (() => {
var _ref = _asyncToGenerator(function* (globalConfig, config, environment, runtime, testPath) {
const reporter = new _reporter2.default(globalConfig, config, environment, testPath);
const jasmineFactory = runtime.requireInternalModule(JASMINE);
const jasmine = jasmineFactory.create({
process,
testPath
});
const env = jasmine.getEnv();
const jasmineInterface = jasmineFactory.interface(jasmine, env);
Object.assign(environment.global, jasmineInterface);
env.addReporter(jasmineInterface.jsApiReporter);
// TODO: Remove config option if V8 exposes some way of getting location of caller
// in a future version
if (config.testLocationInResults === true) {
const originalIt = environment.global.it;
environment.global.it = function () {
const stack = (0, _jestUtil.getCallsite)(1, runtime.getSourceMaps());
const it = originalIt.apply(undefined, arguments);
it.result.__callsite = stack;
return it;
};
}
(0, _jasmine_async.install)(environment.global);
environment.global.test = environment.global.it;
environment.global.it.only = environment.global.fit;
environment.global.it.skip = environment.global.xit;
environment.global.xtest = environment.global.xit;
environment.global.describe.skip = environment.global.xdescribe;
environment.global.describe.only = environment.global.fdescribe;
if (config.timers === 'fake') {
environment.fakeTimers.useFakeTimers();
}
env.beforeEach(function () {
if (config.resetModules) {
runtime.resetModules();
}
if (config.clearMocks) {
runtime.clearAllMocks();
}
if (config.resetMocks) {
runtime.resetAllMocks();
if (config.timers === 'fake') {
environment.fakeTimers.useFakeTimers();
}
}
if (config.restoreMocks) {
runtime.restoreAllMocks();
}
});
env.addReporter(reporter);
runtime.requireInternalModule(_path2.default.resolve(__dirname, './jest_expect.js')).default({
expand: globalConfig.expand
});
const snapshotState = runtime.requireInternalModule(_path2.default.resolve(__dirname, './setup_jest_globals.js')).default({
config,
globalConfig,
localRequire: runtime.requireModule.bind(runtime),
testPath
});
if (config.setupTestFrameworkScriptFile) {
runtime.requireModule(config.setupTestFrameworkScriptFile);
}
runtime.requireInternalModule(require.resolve('source-map-support'), 'source-map-support').install({
environment: 'node',
handleUncaughtExceptions: false,
retrieveSourceMap: function (source) {
const sourceMaps = runtime.getSourceMaps();
const sourceMapSource = sourceMaps && sourceMaps[source];
if (sourceMapSource) {
try {
return {
map: JSON.parse(_gracefulFs2.default.readFileSync(sourceMapSource)),
url: source
};
} catch (e) {}
}
return null;
}
});
if (globalConfig.enabledTestsMap) {
env.specFilter = function (spec) {
const suiteMap = globalConfig.enabledTestsMap && globalConfig.enabledTestsMap[spec.result.testPath];
return suiteMap && suiteMap[spec.result.fullName];
};
} else if (globalConfig.testNamePattern) {
const testNameRegex = new RegExp(globalConfig.testNamePattern, 'i');
env.specFilter = function (spec) {
return testNameRegex.test(spec.getFullName());
};
}
runtime.requireModule(testPath);
yield env.execute();
return reporter.getResults().then(function (results) {
return addSnapshotData(results, snapshotState);
});
});
return function jasmine2(_x, _x2, _x3, _x4, _x5) {
return _ref.apply(this, arguments);
};
})();
var _path = require('path');
var _path2 = _interopRequireDefault(_path);
var _gracefulFs = require('graceful-fs');
var _gracefulFs2 = _interopRequireDefault(_gracefulFs);
var _jestUtil = require('jest-util');
var _reporter = require('./reporter');
var _reporter2 = _interopRequireDefault(_reporter);
var _jasmine_async = require('./jasmine_async');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
// eslint-disable-next-line import/no-extraneous-dependencies
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const JASMINE = require.resolve('./jasmine/jasmine_light.js');
const addSnapshotData = (results, snapshotState) => {
results.testResults.forEach((_ref2) => {
let fullName = _ref2.fullName,
status = _ref2.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 uncheckedCount = snapshotState.getUncheckedCount();
const uncheckedKeys = snapshotState.getUncheckedKeys();
if (uncheckedCount) {
snapshotState.removeUncheckedKeys();
}
const status = snapshotState.save();
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;
// Copy the array to prevent memory leaks
results.snapshot.uncheckedKeys = Array.from(uncheckedKeys);
return results;
};
module.exports = jasmine2;

524
node_modules/jest-jasmine2/build/jasmine/Env.js generated vendored Normal file
View File

@@ -0,0 +1,524 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (j$) {
function Env(options) {
options = options || {};
const self = this;
let totalSpecsDefined = 0;
let catchExceptions = true;
const realSetTimeout = global.setTimeout;
const realClearTimeout = global.clearTimeout;
const runnableResources = {};
let currentSpec = null;
const currentlyExecutingSuites = [];
let currentDeclarationSuite = null;
let throwOnExpectationFailure = false;
let random = false;
let seed = null;
const currentSuite = function () {
return currentlyExecutingSuites[currentlyExecutingSuites.length - 1];
};
const currentRunnable = function () {
return currentSpec || currentSuite();
};
const reporter = new j$.ReportDispatcher(['jasmineStarted', 'jasmineDone', 'suiteStarted', 'suiteDone', 'specStarted', 'specDone']);
this.specFilter = function () {
return true;
};
let nextSpecId = 0;
const getNextSpecId = function () {
return 'spec' + nextSpecId++;
};
let nextSuiteId = 0;
const getNextSuiteId = function () {
return 'suite' + nextSuiteId++;
};
const defaultResourcesForRunnable = function (id, parentRunnableId) {
const resources = { spies: [] };
runnableResources[id] = resources;
};
const clearResourcesForRunnable = function (id) {
spyRegistry.clearSpies();
delete runnableResources[id];
};
const beforeAndAfterFns = function (suite) {
return function () {
let afters = [];
let befores = [];
while (suite) {
befores = befores.concat(suite.beforeFns);
afters = afters.concat(suite.afterFns);
suite = suite.parentSuite;
}
return {
befores: befores.reverse(),
afters
};
};
};
const getSpecName = function (spec, suite) {
const fullName = [spec.description];
const suiteFullName = suite.getFullName();
if (suiteFullName !== '') {
fullName.unshift(suiteFullName);
}
return fullName.join(' ');
};
this.catchExceptions = function (value) {
catchExceptions = !!value;
return catchExceptions;
};
this.catchingExceptions = function () {
return 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;
};
function queueRunnerFactory(options) {
options.clearTimeout = realClearTimeout;
options.fail = self.fail;
options.setTimeout = realSetTimeout;
return (0, _queue_runner2.default)(options);
}
const topSuite = new j$.Suite({
id: getNextSuiteId(),
getTestPath() {
return j$.testPath;
}
});
defaultResourcesForRunnable(topSuite.id);
currentDeclarationSuite = topSuite;
this.topSuite = function () {
return topSuite;
};
this.execute = (() => {
var _ref = _asyncToGenerator(function* (runnablesToRun) {
if (!runnablesToRun) {
if (focusedRunnables.length) {
runnablesToRun = focusedRunnables;
} else {
runnablesToRun = [topSuite.id];
}
}
const uncaught = function (err) {
if (currentSpec) {
currentSpec.onException(err);
currentSpec.cancel();
} else {
console.error('Unhandled error');
console.error(err.stack);
}
};
// Need to ensure we are the only ones handling these exceptions.
const oldListenersException = process.listeners('uncaughtException').slice();
const oldListenersRejection = process.listeners('unhandledRejection').slice();
j$.process.removeAllListeners('uncaughtException');
j$.process.removeAllListeners('unhandledRejection');
j$.process.on('uncaughtException', uncaught);
j$.process.on('unhandledRejection', uncaught);
reporter.jasmineStarted({ totalSpecsDefined });
currentlyExecutingSuites.push(topSuite);
yield (0, _tree_processor2.default)({
nodeComplete(suite) {
if (!suite.disabled) {
clearResourcesForRunnable(suite.id);
}
currentlyExecutingSuites.pop();
reporter.suiteDone(suite.getResult());
},
nodeStart(suite) {
currentlyExecutingSuites.push(suite);
defaultResourcesForRunnable(suite.id, suite.parentSuite.id);
reporter.suiteStarted(suite.result);
},
queueRunnerFactory,
runnableIds: runnablesToRun,
tree: topSuite
});
clearResourcesForRunnable(topSuite.id);
currentlyExecutingSuites.pop();
reporter.jasmineDone({
failedExpectations: topSuite.result.failedExpectations
});
j$.process.removeListener('uncaughtException', uncaught);
j$.process.removeListener('unhandledRejection', uncaught);
// restore previous exception handlers
oldListenersException.forEach(function (listener) {
j$.process.on('uncaughtException', listener);
});
oldListenersRejection.forEach(function (listener) {
j$.process.on('unhandledRejection', listener);
});
});
return function (_x) {
return _ref.apply(this, arguments);
};
})();
this.addReporter = function (reporterToAdd) {
reporter.addReporter(reporterToAdd);
};
this.provideFallbackReporter = function (reporterToAdd) {
reporter.provideFallbackReporter(reporterToAdd);
};
this.clearReporters = function () {
reporter.clearReporters();
};
const spyRegistry = new j$.SpyRegistry({
currentSpies() {
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);
};
const suiteFactory = function (description) {
const suite = new j$.Suite({
id: getNextSuiteId(),
description,
parentSuite: currentDeclarationSuite,
throwOnExpectationFailure,
getTestPath() {
return j$.testPath;
}
});
return suite;
};
this.describe = function (description, specDefinitions) {
const 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) {
const suite = suiteFactory(description);
suite.pend();
addSpecsToSuite(suite, specDefinitions);
return suite;
};
const focusedRunnables = [];
this.fdescribe = function (description, specDefinitions) {
const suite = suiteFactory(description);
suite.isFocused = true;
focusedRunnables.push(suite.id);
unfocusAncestor();
addSpecsToSuite(suite, specDefinitions);
return suite;
};
function addSpecsToSuite(suite, specDefinitions) {
const parentSuite = currentDeclarationSuite;
parentSuite.addChild(suite);
currentDeclarationSuite = suite;
let declarationError = null;
try {
specDefinitions.call(suite);
} catch (e) {
declarationError = e;
}
if (declarationError) {
self.it('encountered a declaration exception', () => {
throw declarationError;
});
}
currentDeclarationSuite = parentSuite;
}
function findFocusedAncestor(suite) {
while (suite) {
if (suite.isFocused) {
return suite.id;
}
suite = suite.parentSuite;
}
return null;
}
function unfocusAncestor() {
const focusedAncestor = findFocusedAncestor(currentDeclarationSuite);
if (focusedAncestor) {
for (let i = 0; i < focusedRunnables.length; i++) {
if (focusedRunnables[i] === focusedAncestor) {
focusedRunnables.splice(i, 1);
break;
}
}
}
}
const specFactory = function (description, fn, suite, timeout) {
totalSpecsDefined++;
const spec = new j$.Spec({
id: getNextSpecId(),
beforeAndAfterFns: beforeAndAfterFns(suite),
resultCallback: specResultCallback,
getSpecName(spec) {
return getSpecName(spec, suite);
},
getTestPath() {
return j$.testPath;
},
onStart: specStarted,
description,
queueRunnerFactory,
userContext() {
return suite.clonedSharedUserContext();
},
queueableFn: {
fn,
timeout() {
return timeout || j$.DEFAULT_TIMEOUT_INTERVAL;
}
},
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) {
const spec = specFactory(description, fn, currentDeclarationSuite, timeout);
if (currentDeclarationSuite.markedPending) {
spec.pend();
}
// When a test is defined inside another, jasmine will not run it.
// This check throws an error to warn the user about the edge-case.
if (currentSpec !== null) {
throw new Error('Tests cannot be nested. Test `' + spec.description + '` cannot run because it is nested within `' + currentSpec.description + '`.');
}
currentDeclarationSuite.addChild(spec);
return spec;
};
this.xit = function () {
const spec = this.it.apply(this, arguments);
spec.pend('Temporarily disabled with xit');
return spec;
};
this.fit = function (description, fn, timeout) {
const spec = specFactory(description, fn, currentDeclarationSuite, timeout);
currentDeclarationSuite.addChild(spec);
focusedRunnables.push(spec.id);
unfocusAncestor();
return spec;
};
this.beforeEach = function (beforeEachFunction, timeout) {
currentDeclarationSuite.beforeEach({
fn: beforeEachFunction,
timeout() {
return timeout || j$.DEFAULT_TIMEOUT_INTERVAL;
}
});
};
this.beforeAll = function (beforeAllFunction, timeout) {
currentDeclarationSuite.beforeAll({
fn: beforeAllFunction,
timeout() {
return timeout || j$.DEFAULT_TIMEOUT_INTERVAL;
}
});
};
this.afterEach = function (afterEachFunction, timeout) {
currentDeclarationSuite.afterEach({
fn: afterEachFunction,
timeout() {
return timeout || j$.DEFAULT_TIMEOUT_INTERVAL;
}
});
};
this.afterAll = function (afterAllFunction, timeout) {
currentDeclarationSuite.afterAll({
fn: afterAllFunction,
timeout() {
return timeout || j$.DEFAULT_TIMEOUT_INTERVAL;
}
});
};
this.pending = function (message) {
let fullMessage = j$.Spec.pendingSpecExceptionMessage;
if (message) {
fullMessage += message;
}
throw fullMessage;
};
this.fail = function (error) {
let message = 'Failed';
if (error) {
message += ': ';
message += error.message || error;
}
currentRunnable().addExpectationResult(false, {
matcherName: '',
passed: false,
expected: '',
actual: '',
message,
error: error && error.message ? error : null
});
};
}
return Env;
};
var _queue_runner = require('../queue_runner');
var _queue_runner2 = _interopRequireDefault(_queue_runner);
var _tree_processor = require('../tree_processor');
var _tree_processor2 = _interopRequireDefault(_tree_processor);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// This file is a heavily modified fork of Jasmine. Original license:
/*
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.
*/
/* eslint-disable sort-keys */
// Try getting the real promise object from the context, if available. Someone
// could have overridden it in a test. Async functions return it implicitly.
// eslint-disable-next-line no-unused-vars
const Promise = global[Symbol.for('jest-native-promise')] || global.Promise;

208
node_modules/jest-jasmine2/build/jasmine/Spec.js generated vendored Normal file
View File

@@ -0,0 +1,208 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Spec;
var _expectation_failed = require('../expectation_failed');
var _expectation_failed2 = _interopRequireDefault(_expectation_failed);
var _expectation_result_factory = require('../expectation_result_factory');
var _expectation_result_factory2 = _interopRequireDefault(_expectation_result_factory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// This file is a heavily modified fork of Jasmine. Original license:
/*
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.
*/
/* eslint-disable sort-keys */
function Spec(attrs) {
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.queueRunnerFactory = attrs.queueRunnerFactory || function () {};
this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
this.result = {
id: this.id,
description: this.description,
fullName: this.getFullName(),
failedExpectations: [],
passedExpectations: [],
pendingReason: '',
testPath: attrs.getTestPath()
};
}
Spec.prototype.addExpectationResult = function (passed, data, isError) {
const expectationResult = (0, _expectation_result_factory2.default)(data);
if (passed) {
this.result.passedExpectations.push(expectationResult);
} else {
this.result.failedExpectations.push(expectationResult);
if (this.throwOnExpectationFailure && !isError) {
throw new _expectation_failed2.default();
}
}
};
Spec.prototype.execute = function (onComplete, enabled) {
const self = this;
this.onStart(this);
if (!this.isExecutable() || this.markedPending || enabled === false) {
complete(enabled);
return;
}
const fns = this.beforeAndAfterFns();
const allFns = fns.befores.concat(this.queueableFn).concat(fns.afters);
this.currentRun = this.queueRunnerFactory({
queueableFns: allFns,
onException() {
self.onException.apply(self, arguments);
},
userContext: this.userContext()
});
this.currentRun.then(() => complete(true));
function complete(enabledAgain) {
self.result.status = self.status(enabledAgain);
self.resultCallback(self.result);
if (onComplete) {
onComplete();
}
}
};
Spec.prototype.cancel = function cancel() {
if (this.currentRun) {
this.currentRun.cancel();
}
};
Spec.prototype.onException = function onException(error) {
if (Spec.isPendingSpecException(error)) {
this.pend(extractCustomPendingMessage(error));
return;
}
if (error instanceof _expectation_failed2.default) {
return;
}
if (error instanceof require('assert').AssertionError) {
const assertionErrorMessage = require('../assert_support').default;
error = assertionErrorMessage(error, { expand: this.expand });
}
this.addExpectationResult(false, {
matcherName: '',
passed: false,
expected: '',
actual: '',
error
}, 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);
};
const extractCustomPendingMessage = function (e) {
const fullMessage = e.toString();
const boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage);
const 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);
};

222
node_modules/jest-jasmine2/build/jasmine/Suite.js generated vendored Normal file
View File

@@ -0,0 +1,222 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Suite;
var _expectation_failed = require('../expectation_failed');
var _expectation_failed2 = _interopRequireDefault(_expectation_failed);
var _expectation_result_factory = require('../expectation_result_factory');
var _expectation_result_factory2 = _interopRequireDefault(_expectation_result_factory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// This file is a heavily modified fork of Jasmine. Original license:
/*
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.
*/
/* eslint-disable sort-keys */
function Suite(attrs) {
this.id = attrs.id;
this.parentSuite = attrs.parentSuite;
this.description = convertDescriptorToString(attrs.description);
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: [],
testPath: attrs.getTestPath()
};
}
Suite.prototype.getFullName = function () {
const fullName = [];
for (let 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.unshift(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 = {};
}
return this.sharedContext;
};
Suite.prototype.clonedSharedUserContext = function () {
return this.sharedUserContext();
};
Suite.prototype.onException = function () {
if (arguments[0] instanceof _expectation_failed2.default) {
return;
}
if (isAfterAll(this.children)) {
const data = {
matcherName: '',
passed: false,
expected: '',
actual: '',
error: arguments[0]
};
this.result.failedExpectations.push((0, _expectation_result_factory2.default)(data));
} else {
for (let i = 0; i < this.children.length; i++) {
const child = this.children[i];
child.onException.apply(child, arguments);
}
}
};
Suite.prototype.addExpectationResult = function () {
if (isAfterAll(this.children) && isFailure(arguments)) {
const data = arguments[1];
this.result.failedExpectations.push((0, _expectation_result_factory2.default)(data));
if (this.throwOnExpectationFailure) {
throw new _expectation_failed2.default();
}
} else {
for (let i = 0; i < this.children.length; i++) {
const child = this.children[i];
try {
child.addExpectationResult.apply(child, arguments);
} catch (e) {
// keep going
}
}
}
};
function convertDescriptorToString(descriptor) {
if (typeof descriptor === 'string' || typeof descriptor === 'number' || descriptor === undefined) {
return descriptor;
}
if (typeof descriptor !== 'function') {
throw new Error('describe expects a class, function, number, or string.');
}
if (descriptor.name !== undefined) {
return descriptor.name;
}
const stringified = descriptor.toString();
const typeDescriptorMatch = stringified.match(/class|function/);
const indexOfNameSpace = typeDescriptorMatch.index + typeDescriptorMatch[0].length;
const indexOfNameAfterSpace = stringified.search(/\(|\{/, indexOfNameSpace);
const name = stringified.substring(indexOfNameSpace, indexOfNameAfterSpace);
return name.trim();
}
function isAfterAll(children) {
return children && children[0].result.status;
}
function isFailure(args) {
return !args[0];
}

59
node_modules/jest-jasmine2/build/jasmine/Timer.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Timer;
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// This file is a heavily modified fork of Jasmine. Original license:
/*
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.
*/
/* eslint-disable sort-keys */
const defaultNow = function (Date) {
return function () {
return new Date().getTime();
};
}(Date);
function Timer(options) {
options = options || {};
const now = options.now || defaultNow;
let startTime;
this.start = function () {
startTime = now();
};
this.elapsed = function () {
return now() - startTime;
};
}

View File

@@ -0,0 +1,85 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// This file is a heavily modified fork of Jasmine. Original license:
/*
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.
*/
/* eslint-disable sort-keys */
function CallTracker() {
let calls = [];
this.track = function (context) {
calls.push(context);
};
this.any = function () {
return !!calls.length;
};
this.count = function () {
return calls.length;
};
this.argsFor = function (index) {
const call = calls[index];
return call ? call.args : [];
};
this.all = function () {
return calls;
};
this.allArgs = function () {
const callArgs = [];
for (let 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 = [];
};
}
exports.default = CallTracker;

85
node_modules/jest-jasmine2/build/jasmine/create_spy.js generated vendored Normal file
View File

@@ -0,0 +1,85 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _call_tracker = require('./call_tracker');
var _call_tracker2 = _interopRequireDefault(_call_tracker);
var _spy_strategy = require('./spy_strategy');
var _spy_strategy2 = _interopRequireDefault(_spy_strategy);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// This file is a heavily modified fork of Jasmine. Original license:
/*
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.
*/
/* eslint-disable sort-keys */
function createSpy(name, originalFn) {
const spyStrategy = new _spy_strategy2.default({
name,
fn: originalFn,
getSpy() {
return spy;
}
});
const callTracker = new _call_tracker2.default();
const spy = function () {
const callData = {
object: this,
args: Array.prototype.slice.apply(arguments)
};
callTracker.track(callData);
const returnValue = spyStrategy.exec.apply(this, arguments);
callData.returnValue = returnValue;
return returnValue;
};
for (const 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;
}
exports.default = createSpy;

View File

@@ -0,0 +1,156 @@
'use strict';
var _create_spy = require('./create_spy');
var _create_spy2 = _interopRequireDefault(_create_spy);
var _Env = require('./Env');
var _Env2 = _interopRequireDefault(_Env);
var _js_api_reporter = require('./js_api_reporter');
var _js_api_reporter2 = _interopRequireDefault(_js_api_reporter);
var _report_dispatcher = require('./report_dispatcher');
var _report_dispatcher2 = _interopRequireDefault(_report_dispatcher);
var _Spec = require('./Spec');
var _Spec2 = _interopRequireDefault(_Spec);
var _spy_registry = require('./spy_registry');
var _spy_registry2 = _interopRequireDefault(_spy_registry);
var _Suite = require('./Suite');
var _Suite2 = _interopRequireDefault(_Suite);
var _Timer = require('./Timer');
var _Timer2 = _interopRequireDefault(_Timer);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.create = function (createOptions) {
const j$ = Object.assign({}, createOptions);
j$.DEFAULT_TIMEOUT_INTERVAL = 5000;
j$.getEnv = function (options) {
const env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options);
//jasmine. singletons in here (setTimeout blah blah).
return env;
};
j$.createSpy = _create_spy2.default;
j$.Env = (0, _Env2.default)(j$);
j$.JsApiReporter = _js_api_reporter2.default;
j$.ReportDispatcher = _report_dispatcher2.default;
j$.Spec = _Spec2.default;
j$.SpyRegistry = _spy_registry2.default;
j$.Suite = _Suite2.default;
j$.Timer = _Timer2.default;
j$.version = '2.5.2-light';
return j$;
};
// Interface is a reserved word in strict mode, so can't export it as ESM
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// This file is a heavily modified fork of Jasmine. Original license:
/*
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.
*/
/* eslint-disable sort-keys */
exports.interface = function (jasmine, env) {
const jasmineInterface = {
describe(description, specDefinitions) {
return env.describe(description, specDefinitions);
},
xdescribe(description, specDefinitions) {
return env.xdescribe(description, specDefinitions);
},
fdescribe(description, specDefinitions) {
return env.fdescribe(description, specDefinitions);
},
it() {
return env.it.apply(env, arguments);
},
xit() {
return env.xit.apply(env, arguments);
},
fit() {
return env.fit.apply(env, arguments);
},
beforeEach() {
return env.beforeEach.apply(env, arguments);
},
afterEach() {
return env.afterEach.apply(env, arguments);
},
beforeAll() {
return env.beforeAll.apply(env, arguments);
},
afterAll() {
return env.afterAll.apply(env, arguments);
},
pending() {
return env.pending.apply(env, arguments);
},
fail() {
return env.fail.apply(env, arguments);
},
spyOn(obj, methodName, accessType) {
return env.spyOn(obj, methodName, accessType);
},
jsApiReporter: new jasmine.JsApiReporter({
timer: new jasmine.Timer()
}),
jasmine
};
return jasmineInterface;
};

View File

@@ -0,0 +1,115 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = JsApiReporter;
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// This file is a heavily modified fork of Jasmine. Original license:
/*
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.
*/
/* eslint-disable sort-keys */
const noopTimer = {
start() {},
elapsed() {
return 0;
}
};
function JsApiReporter(options) {
const timer = options.timer || noopTimer;
let status = 'loaded';
this.started = false;
this.finished = false;
this.runDetails = {};
this.jasmineStarted = function () {
this.started = true;
status = 'started';
timer.start();
};
let executionTime;
this.jasmineDone = function (runDetails) {
this.finished = true;
this.runDetails = runDetails;
executionTime = timer.elapsed();
status = 'done';
};
this.status = function () {
return status;
};
const suites = [];
const 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;
};
const 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;
};
}

View File

@@ -0,0 +1,80 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = ReportDispatcher;
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// This file is a heavily modified fork of Jasmine. Original license:
/*
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.
*/
/* eslint-disable sort-keys */
function ReportDispatcher(methods) {
const dispatchedMethods = methods || [];
for (let i = 0; i < dispatchedMethods.length; i++) {
const method = dispatchedMethods[i];
this[method] = function (m) {
return function () {
dispatch(m, arguments);
};
}(method);
}
let reporters = [];
let 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 (let i = 0; i < reporters.length; i++) {
const reporter = reporters[i];
if (reporter[method]) {
reporter[method].apply(reporter, args);
}
}
}
}

View File

@@ -0,0 +1,209 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = SpyRegistry;
var _call_tracker = require('./call_tracker');
var _call_tracker2 = _interopRequireDefault(_call_tracker);
var _create_spy = require('./create_spy');
var _create_spy2 = _interopRequireDefault(_create_spy);
var _spy_strategy = require('./spy_strategy');
var _spy_strategy2 = _interopRequireDefault(_spy_strategy);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const formatErrorMsg = (domain, usage) => {
const usageDefinition = usage ? '\nUsage: ' + usage : '';
return msg => domain + ' : ' + msg + usageDefinition;
}; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// This file is a heavily modified fork of Jasmine. Original license:
/*
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.
*/
function isSpy(putativeSpy) {
if (!putativeSpy) {
return false;
}
return putativeSpy.and instanceof _spy_strategy2.default && putativeSpy.calls instanceof _call_tracker2.default;
}
const getErrorMsg = formatErrorMsg('<spyOn>', 'spyOn(<object>, <methodName>)');
function SpyRegistry(options) {
options = options || {};
const currentSpies = options.currentSpies || function () {
return [];
};
this.allowRespy = function (allow) {
this.respy = allow;
};
this.spyOn = function (obj, methodName, accessType) {
if (accessType) {
return this._spyOnProperty(obj, methodName, accessType);
}
if (obj === void 0) {
throw new Error(getErrorMsg('could not find an object to spy upon for ' + methodName + '()'));
}
if (methodName === void 0) {
throw new Error(getErrorMsg('No method name supplied'));
}
if (obj[methodName] === void 0) {
throw new Error(getErrorMsg(methodName + '() method does not exist'));
}
if (obj[methodName] && isSpy(obj[methodName])) {
if (this.respy) {
return obj[methodName];
} else {
throw new Error(getErrorMsg(methodName + ' has already been spied upon'));
}
}
let 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'));
}
const originalMethod = obj[methodName];
const spiedMethod = (0, _create_spy2.default)(methodName, originalMethod);
let 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._spyOnProperty = function (obj, propertyName) {
let accessType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'get';
if (!obj) {
throw new Error(getErrorMsg('could not find an object to spy upon for ' + propertyName));
}
if (!propertyName) {
throw new Error(getErrorMsg('No property name supplied'));
}
let descriptor;
try {
descriptor = Object.getOwnPropertyDescriptor(obj, propertyName);
} catch (e) {
// IE 8 doesn't support `definePropery` on non-DOM nodes
}
if (!descriptor) {
throw new Error(getErrorMsg(propertyName + ' property does not exist'));
}
if (!descriptor.configurable) {
throw new Error(getErrorMsg(propertyName + ' is not declared configurable'));
}
if (!descriptor[accessType]) {
throw new Error(getErrorMsg('Property ' + propertyName + ' does not have access type ' + accessType));
}
if (obj[propertyName] && isSpy(obj[propertyName])) {
if (this.respy) {
return obj[propertyName];
} else {
throw new Error(getErrorMsg(propertyName + ' has already been spied upon'));
}
}
const originalDescriptor = descriptor;
const spiedProperty = (0, _create_spy2.default)(propertyName, descriptor[accessType]);
let restoreStrategy;
if (Object.prototype.hasOwnProperty.call(obj, propertyName)) {
restoreStrategy = function () {
Object.defineProperty(obj, propertyName, originalDescriptor);
};
} else {
restoreStrategy = function () {
delete obj[propertyName];
};
}
currentSpies().push({
restoreObjectToOriginalState: restoreStrategy
});
const spiedDescriptor = Object.assign({}, descriptor, {
[accessType]: spiedProperty
});
Object.defineProperty(obj, propertyName, spiedDescriptor);
return spiedProperty;
};
this.clearSpies = function () {
const spies = currentSpies();
for (let i = spies.length - 1; i >= 0; i--) {
const spyEntry = spies[i];
spyEntry.restoreObjectToOriginalState();
}
};
}

View File

@@ -0,0 +1,96 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = SpyStrategy;
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// This file is a heavily modified fork of Jasmine. Original license:
/*
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.
*/
/* eslint-disable sort-keys */
function SpyStrategy(options) {
options = options || {};
const identity = options.name || 'unknown';
const originalFn = options.fn || function () {};
const getSpy = options.getSpy || function () {};
let 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 () {
const values = Array.prototype.slice.call(arguments);
plan = function () {
return values.shift();
};
return getSpy();
};
this.throwError = function (something) {
const error = something instanceof Error ? something : new Error(something);
plan = function () {
throw error;
};
return getSpy();
};
this.callFake = function (fn) {
if (typeof fn !== 'function') {
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();
};
}

132
node_modules/jest-jasmine2/build/jasmine_async.js generated vendored Normal file
View File

@@ -0,0 +1,132 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.install = install;
var _isGeneratorFn = require('is-generator-fn');
var _isGeneratorFn2 = _interopRequireDefault(_isGeneratorFn);
var _co = require('co');
var _co2 = _interopRequireDefault(_co);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isPromise(obj) {
return obj && typeof obj.then === 'function';
} /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
/**
* This module adds ability to test async promise code with jasmine by
* returning a promise from `it/test` and `before/afterEach/All` blocks.
*/
function promisifyLifeCycleFunction(originalFn, env) {
return function (fn, timeout) {
if (!fn) {
return originalFn.call(env);
}
const hasDoneCallback = fn.length > 0;
if (hasDoneCallback) {
// Jasmine will handle it
return originalFn.call(env, fn, timeout);
}
// We make *all* functions async and run `done` right away if they
// didn't return a promise.
const asyncFn = function (done) {
const wrappedFn = (0, _isGeneratorFn2.default)(fn) ? _co2.default.wrap(fn) : fn;
const returnValue = wrappedFn.call({});
if (isPromise(returnValue)) {
returnValue.then(done.bind(null, null), done.fail);
} else {
done();
}
};
return originalFn.call(env, asyncFn, timeout);
};
}
// Similar to promisifyLifeCycleFunction but throws an error
// when the return value is neither a Promise nor `undefined`
function promisifyIt(originalFn, env) {
return function (specName, fn, timeout) {
if (!fn) {
const spec = originalFn.call(env, specName);
spec.pend('not implemented');
return spec;
}
const hasDoneCallback = fn.length > 0;
if (hasDoneCallback) {
return originalFn.call(env, specName, fn, timeout);
}
const asyncFn = function (done) {
const wrappedFn = (0, _isGeneratorFn2.default)(fn) ? _co2.default.wrap(fn) : fn;
const returnValue = wrappedFn.call({});
if (isPromise(returnValue)) {
returnValue.then(done.bind(null, null), done.fail);
} else if (returnValue === undefined) {
done();
} else {
done.fail(new Error('Jest: `it` and `test` must return either a Promise or undefined.'));
}
};
return originalFn.call(env, specName, asyncFn, timeout);
};
}
function makeConcurrent(originalFn, env) {
return function (specName, fn, timeout) {
if (env != null && !env.specFilter({ getFullName: () => specName || '' })) {
return originalFn.call(env, specName, () => Promise.resolve(), timeout);
}
let promise;
try {
promise = fn();
if (!isPromise(promise)) {
throw new Error(`Jest: concurrent test "${specName}" must return a Promise.`);
}
} catch (error) {
return originalFn.call(env, specName, () => Promise.reject(error));
}
return originalFn.call(env, specName, () => promise, timeout);
};
}
function install(global) {
const jasmine = global.jasmine;
const env = jasmine.getEnv();
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);
}

54
node_modules/jest-jasmine2/build/jest_expect.js generated vendored Normal file
View File

@@ -0,0 +1,54 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _expect = require('expect');
var _expect2 = _interopRequireDefault(_expect);
var _jestSnapshot = require('jest-snapshot');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = config => {
global.expect = _expect2.default;
_expect2.default.setState({ expand: config.expand });
_expect2.default.extend({
toMatchSnapshot: _jestSnapshot.toMatchSnapshot,
toThrowErrorMatchingSnapshot: _jestSnapshot.toThrowErrorMatchingSnapshot
});
_expect2.default.addSnapshotSerializer = _jestSnapshot.addSerializer;
const jasmine = global.jasmine;
jasmine.anything = _expect2.default.anything;
jasmine.any = _expect2.default.any;
jasmine.objectContaining = _expect2.default.objectContaining;
jasmine.arrayContaining = _expect2.default.arrayContaining;
jasmine.stringMatching = _expect2.default.stringMatching;
jasmine.addMatchers = jasmineMatchersObject => {
const jestMatchersObject = Object.create(null);
Object.keys(jasmineMatchersObject).forEach(name => {
jestMatchersObject[name] = function () {
// use "expect.extend" if you need to use equality testers (via this.equal)
const result = jasmineMatchersObject[name](null, 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);
};
});
const expect = global.expect;
expect.extend(jestMatchersObject);
};
}; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

78
node_modules/jest-jasmine2/build/p_cancelable.js generated vendored Normal file
View File

@@ -0,0 +1,78 @@
'use strict';
// Try getting the real promise object from the context, if available. Someone
// could have overridden it in a test.
const Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
class CancelError extends Error {
constructor() {
super('Promise was canceled');
this.name = 'CancelError';
}
}
class PCancelable {
static fn(fn) {
return function () {
const args = [].slice.apply(arguments);
return new PCancelable((onCancel, resolve, reject) => {
args.unshift(onCancel);
fn.apply(null, args).then(resolve, reject);
});
};
}
constructor(executor) {
this._pending = true;
this._canceled = false;
this._promise = new Promise((resolve, reject) => {
this._reject = reject;
return executor(fn => {
this._cancel = fn;
}, val => {
this._pending = false;
resolve(val);
}, err => {
this._pending = false;
reject(err);
});
});
}
then() {
return this._promise.then.apply(this._promise, arguments);
}
catch() {
return this._promise.catch.apply(this._promise, arguments);
}
cancel() {
if (!this._pending || this._canceled) {
return;
}
if (typeof this._cancel === 'function') {
try {
this._cancel();
} catch (err) {
this._reject(err);
}
}
this._canceled = true;
this._reject(new CancelError());
}
get canceled() {
return this._canceled;
}
}
Object.setPrototypeOf(PCancelable.prototype, Promise.prototype);
module.exports = PCancelable;
module.exports.CancelError = CancelError;

33
node_modules/jest-jasmine2/build/p_timeout.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = pTimeout;
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
// Try getting the real promise object from the context, if available. Someone
// could have overridden it in a test.
const Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
// A specialized version of `p-timeout` that does not touch globals.
// It does not throw on timeout.
function pTimeout(promise, ms, clearTimeout, setTimeout, onTimeout) {
return new Promise((resolve, reject) => {
const timer = setTimeout(() => resolve(onTimeout()), ms);
promise.then(val => {
clearTimeout(timer);
resolve(val);
}, err => {
clearTimeout(timer);
reject(err);
});
});
}

80
node_modules/jest-jasmine2/build/queue_runner.js generated vendored Normal file
View File

@@ -0,0 +1,80 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = queueRunner;
var _p_cancelable = require('./p_cancelable');
var _p_cancelable2 = _interopRequireDefault(_p_cancelable);
var _p_timeout = require('./p_timeout');
var _p_timeout2 = _interopRequireDefault(_p_timeout);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
// Try getting the real promise object from the context, if available. Someone
const Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
function queueRunner(options) {
const token = new _p_cancelable2.default((onCancel, resolve) => {
onCancel(resolve);
});
const mapper = (_ref) => {
let fn = _ref.fn,
timeout = _ref.timeout;
let promise = new Promise(resolve => {
const next = function (err) {
if (err) {
options.fail.apply(null, arguments);
}
resolve();
};
next.fail = function () {
options.fail.apply(null, arguments);
resolve();
};
try {
fn.call(options.userContext, next);
} catch (e) {
options.onException(e);
resolve();
}
});
promise = Promise.race([promise, token]);
if (!timeout) {
return promise;
}
const timeoutMs = timeout();
return (0, _p_timeout2.default)(promise, timeoutMs, options.clearTimeout, options.setTimeout, () => {
const error = new Error('Timeout - Async callback was not invoked within the ' + timeoutMs + 'ms timeout specified by jest.setTimeout.');
options.onException(error);
});
};
const result = options.queueableFns.reduce((promise, fn) => promise.then(() => mapper(fn)), Promise.resolve());
return {
cancel: token.cancel.bind(token),
catch: result.catch.bind(result),
then: result.then.bind(result)
};
}

131
node_modules/jest-jasmine2/build/reporter.js generated vendored Normal file
View File

@@ -0,0 +1,131 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jestMessageUtil = require('jest-message-util');
// Try getting the real promise object from the context, if available. Someone
// could have overridden it in a test.
const Promise = global[Symbol.for('jest-native-promise')] || global.Promise; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
class Jasmine2Reporter {
constructor(globalConfig, config, environment, testPath) {
this._globalConfig = globalConfig;
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: (0, _jestMessageUtil.formatResultsErrors)(testResults, this._config, this._globalConfig, 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);
}
getResults() {
return this._resultsPromise;
}
_addMissingMessageToStack(stack, message) {
// Some errors (e.g. Angular injection error) don't prepend error.message
// to stack, instead the first line of the stack is just plain 'Error'
const ERROR_REGEX = /^Error\s*\n/;
if (stack && message && ERROR_REGEX.test(stack) && stack.indexOf(message) === -1) {
return message + stack.replace(ERROR_REGEX, '\n');
}
return stack;
}
_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 location = specResult.__callsite ? {
column: specResult.__callsite.getColumnNumber(),
// $FlowFixMe: https://github.com/facebook/flow/issues/5213
line: specResult.__callsite.getLineNumber()
} : null;
const results = {
ancestorTitles,
duration,
failureMessages: [],
fullName: specResult.fullName,
location,
numPassingAsserts: 0, // Jasmine2 only returns an array of failed asserts.
status,
title: specResult.description
};
specResult.failedExpectations.forEach(failed => {
const message = !failed.matcherName && failed.stack ? this._addMissingMessageToStack(failed.stack, failed.message) : failed.message || '';
results.failureMessages.push(message);
});
return results;
}
}
exports.default = Jasmine2Reporter;

110
node_modules/jest-jasmine2/build/setup_jest_globals.js generated vendored Normal file
View File

@@ -0,0 +1,110 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _expect = require('expect');
var _jestSnapshot = require('jest-snapshot');
// 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.
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const addSuppressedErrors = result => {
var _getState = (0, _expect.getState)();
const suppressedErrors = _getState.suppressedErrors;
(0, _expect.setState)({ suppressedErrors: [] });
if (suppressedErrors.length) {
result.status = 'failed';
result.failedExpectations = suppressedErrors.map(error => ({
actual: '',
// passing error for custom test reporters
error,
expected: '',
message: error.message,
passed: false,
stack: error.stack
}));
}
};
const addAssertionErrors = result => {
const assertionErrors = (0, _expect.extractExpectedAssertionsErrors)();
if (assertionErrors.length) {
const jasmineErrors = assertionErrors.map((_ref) => {
let actual = _ref.actual,
error = _ref.error,
expected = _ref.expected;
return {
actual,
expected,
message: error.stack,
passed: false
};
});
result.status = 'failed';
result.failedExpectations = result.failedExpectations.concat(jasmineErrors);
}
};
const patchJasmine = () => {
global.jasmine.Spec = (realSpec => {
const Spec = function Spec(attr) {
const resultCallback = attr.resultCallback;
attr.resultCallback = function (result) {
addSuppressedErrors(result);
addAssertionErrors(result);
resultCallback.call(attr, result);
};
const onStart = attr.onStart;
attr.onStart = context => {
(0, _expect.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);
};
exports.default = (_ref2) => {
let config = _ref2.config,
globalConfig = _ref2.globalConfig,
localRequire = _ref2.localRequire,
testPath = _ref2.testPath;
// Jest tests snapshotSerializers in order preceding built-in serializers.
// Therefore, add in reverse because the last added is the first tested.
config.snapshotSerializers.concat().reverse().forEach(path => {
(0, _jestSnapshot.addSerializer)(localRequire(path));
});
patchJasmine();
const expand = globalConfig.expand,
updateSnapshot = globalConfig.updateSnapshot;
const snapshotState = new _jestSnapshot.SnapshotState(testPath, { expand, updateSnapshot });
(0, _expect.setState)({ snapshotState, testPath });
// Return it back to the outer scope (test runner outside the VM).
return snapshotState;
};

76
node_modules/jest-jasmine2/build/tree_processor.js generated vendored Normal file
View File

@@ -0,0 +1,76 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = treeProcessor;
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
// Try getting the real promise object from the context, if available. Someone
// could have overridden it in a test. Async functions return it implicitly.
// eslint-disable-next-line no-unused-vars
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
function treeProcessor(options) {
const nodeComplete = options.nodeComplete,
nodeStart = options.nodeStart,
queueRunnerFactory = options.queueRunnerFactory,
runnableIds = options.runnableIds,
tree = options.tree;
function isEnabled(node, parentEnabled) {
return parentEnabled || runnableIds.indexOf(node.id) !== -1;
}
return queueRunnerFactory({
onException: error => tree.onException(error),
queueableFns: wrapChildren(tree, isEnabled(tree, false)),
userContext: tree.sharedUserContext()
});
function executeNode(node, parentEnabled) {
const enabled = isEnabled(node, parentEnabled);
if (!node.children) {
return {
fn(done) {
node.execute(done, enabled);
}
};
}
return {
fn(done) {
return _asyncToGenerator(function* () {
nodeStart(node);
yield queueRunnerFactory({
onException: function (error) {
return node.onException(error);
},
queueableFns: wrapChildren(node, enabled),
userContext: node.sharedUserContext()
});
nodeComplete(node);
done();
})();
}
};
}
function wrapChildren(node, enabled) {
if (!node.children) {
throw new Error('`node.children` is not defined.');
}
const children = node.children.map(child => executeNode(child, enabled));
return node.beforeAllFns.concat(children).concat(node.afterAllFns);
}
}