initial status
This commit is contained in:
25
node_modules/cypress/README.md
generated
vendored
Normal file
25
node_modules/cypress/README.md
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# Cypress
|
||||
|
||||
Fast, easy and reliable testing for anything that runs in a browser.
|
||||
|
||||
## What is this?
|
||||
|
||||
[Cypress](https://www.cypress.io/) comes packaged as an `npm` module, which is all you need to get started testing.
|
||||
|
||||
After installing you'll be able to:
|
||||
|
||||
- Open Cypress from the CLI
|
||||
- Run Cypress from the CLI
|
||||
- `require` Cypress as a module
|
||||
|
||||
## Install
|
||||
|
||||
Please check our [system requirements](https://on.cypress.io/installing-cypress).
|
||||
|
||||
```sh
|
||||
npm install --save-dev cypress
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
Please [visit our documentation](https://on.cypress.io/cli) for a full list of commands and examples.
|
3
node_modules/cypress/bin/cypress
generated
vendored
Normal file
3
node_modules/cypress/bin/cypress
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require('../lib/cli').init()
|
36
node_modules/cypress/index.js
generated
vendored
Normal file
36
node_modules/cypress/index.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
const minimist = require('minimist');
|
||||
|
||||
const debug = require('debug')('cypress:cli');
|
||||
|
||||
const args = minimist(process.argv.slice(2));
|
||||
|
||||
const util = require('./lib/util'); // we're being used from the command line
|
||||
|
||||
|
||||
switch (args.exec) {
|
||||
case 'install':
|
||||
debug('installing Cypress from NPM');
|
||||
|
||||
require('./lib/tasks/install').start({
|
||||
force: args.force
|
||||
}).catch(util.logErrorExit1);
|
||||
|
||||
break;
|
||||
|
||||
case 'verify':
|
||||
// for simple testing in the monorepo
|
||||
debug('verifying Cypress');
|
||||
|
||||
require('./lib/tasks/verify').start({
|
||||
force: true
|
||||
}) // always force verification
|
||||
.catch(util.logErrorExit1);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
debug('exporting Cypress module interface');
|
||||
module.exports = require('./lib/cypress');
|
||||
}
|
72
node_modules/cypress/lib/VerboseRenderer.js
generated
vendored
Normal file
72
node_modules/cypress/lib/VerboseRenderer.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
|
||||
// Vendored from @cypress/listr-verbose-renderer
|
||||
const figures = require('figures');
|
||||
|
||||
const cliCursor = require('cli-cursor');
|
||||
|
||||
const chalk = require('chalk');
|
||||
|
||||
const dayjs = require('dayjs');
|
||||
|
||||
const formattedLog = (options, output) => {
|
||||
const timestamp = dayjs().format(options.dateFormat); // eslint-disable-next-line no-console
|
||||
|
||||
console.log(`${chalk.dim(`[${timestamp}]`)} ${output}`);
|
||||
};
|
||||
|
||||
const renderHelper = (task, event, options) => {
|
||||
const log = formattedLog.bind(undefined, options);
|
||||
|
||||
if (event.type === 'STATE') {
|
||||
const message = task.isPending() ? 'started' : task.state;
|
||||
log(`${task.title} [${message}]`);
|
||||
|
||||
if (task.isSkipped() && task.output) {
|
||||
log(`${figures.arrowRight} ${task.output}`);
|
||||
}
|
||||
} else if (event.type === 'TITLE') {
|
||||
log(`${task.title} [title changed]`);
|
||||
}
|
||||
};
|
||||
|
||||
const render = (tasks, options) => {
|
||||
for (const task of tasks) {
|
||||
task.subscribe(event => {
|
||||
if (event.type === 'SUBTASKS') {
|
||||
render(task.subtasks, options);
|
||||
return;
|
||||
}
|
||||
|
||||
renderHelper(task, event, options);
|
||||
}, err => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
class VerboseRenderer {
|
||||
constructor(tasks, options) {
|
||||
this._tasks = tasks;
|
||||
this._options = Object.assign({
|
||||
dateFormat: 'HH:mm:ss'
|
||||
}, options);
|
||||
}
|
||||
|
||||
static get nonTTY() {
|
||||
return true;
|
||||
}
|
||||
|
||||
render() {
|
||||
cliCursor.hide();
|
||||
render(this._tasks, this._options);
|
||||
}
|
||||
|
||||
end() {
|
||||
cliCursor.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = VerboseRenderer;
|
426
node_modules/cypress/lib/cli.js
generated
vendored
Normal file
426
node_modules/cypress/lib/cli.js
generated
vendored
Normal file
@@ -0,0 +1,426 @@
|
||||
"use strict";
|
||||
|
||||
// @ts-check
|
||||
const _ = require('lodash');
|
||||
|
||||
const R = require('ramda');
|
||||
|
||||
const commander = require('commander');
|
||||
|
||||
const {
|
||||
stripIndent
|
||||
} = require('common-tags');
|
||||
|
||||
const logSymbols = require('log-symbols');
|
||||
|
||||
const debug = require('debug')('cypress:cli:cli');
|
||||
|
||||
const util = require('./util');
|
||||
|
||||
const logger = require('./logger');
|
||||
|
||||
const errors = require('./errors');
|
||||
|
||||
const cache = require('./tasks/cache'); // patch "commander" method called when a user passed an unknown option
|
||||
// we want to print help for the current command and exit with an error
|
||||
|
||||
|
||||
function unknownOption(flag, type = 'option') {
|
||||
if (this._allowUnknownOption) return;
|
||||
logger.error();
|
||||
logger.error(` error: unknown ${type}:`, flag);
|
||||
logger.error();
|
||||
this.outputHelp();
|
||||
util.exit(1);
|
||||
}
|
||||
|
||||
commander.Command.prototype.unknownOption = unknownOption;
|
||||
|
||||
const coerceFalseOrString = arg => {
|
||||
return arg !== 'false' ? arg : false;
|
||||
};
|
||||
|
||||
const coerceFalse = arg => {
|
||||
return arg !== 'false';
|
||||
};
|
||||
|
||||
const coerceAnyStringToInt = arg => {
|
||||
return typeof arg === 'string' ? parseInt(arg) : arg;
|
||||
};
|
||||
|
||||
const spaceDelimitedArgsMsg = (flag, args) => {
|
||||
let msg = `
|
||||
${logSymbols.warning} Warning: It looks like you're passing --${flag} a space-separated list of arguments:
|
||||
|
||||
"${args.join(' ')}"
|
||||
|
||||
This will work, but it's not recommended.
|
||||
|
||||
If you are trying to pass multiple arguments, separate them with commas instead:
|
||||
cypress run --${flag} arg1,arg2,arg3
|
||||
`;
|
||||
|
||||
if (flag === 'spec') {
|
||||
msg += `
|
||||
The most common cause of this warning is using an unescaped glob pattern. If you are
|
||||
trying to pass a glob pattern, escape it using quotes:
|
||||
cypress run --spec "**/*.spec.js"
|
||||
`;
|
||||
}
|
||||
|
||||
logger.log();
|
||||
logger.warn(stripIndent(msg));
|
||||
logger.log();
|
||||
};
|
||||
|
||||
const parseVariableOpts = (fnArgs, args) => {
|
||||
const [opts, unknownArgs] = fnArgs;
|
||||
|
||||
if (unknownArgs && unknownArgs.length && (opts.spec || opts.tag)) {
|
||||
// this will capture space-delimited args after
|
||||
// flags that could have possible multiple args
|
||||
// but before the next option
|
||||
// --spec spec1 spec2 or --tag foo bar
|
||||
const multiArgFlags = _.compact([opts.spec ? 'spec' : opts.spec, opts.tag ? 'tag' : opts.tag]);
|
||||
|
||||
_.forEach(multiArgFlags, flag => {
|
||||
const argIndex = _.indexOf(args, `--${flag}`) + 2;
|
||||
|
||||
const nextOptOffset = _.findIndex(_.slice(args, argIndex), arg => {
|
||||
return _.startsWith(arg, '--');
|
||||
});
|
||||
|
||||
const endIndex = nextOptOffset !== -1 ? argIndex + nextOptOffset : args.length;
|
||||
|
||||
const maybeArgs = _.slice(args, argIndex, endIndex);
|
||||
|
||||
const extraArgs = _.intersection(maybeArgs, unknownArgs);
|
||||
|
||||
if (extraArgs.length) {
|
||||
opts[flag] = [opts[flag]].concat(extraArgs);
|
||||
spaceDelimitedArgsMsg(flag, opts[flag]);
|
||||
opts[flag] = opts[flag].join(',');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
debug('variable-length opts parsed %o', {
|
||||
args,
|
||||
opts
|
||||
});
|
||||
return util.parseOpts(opts);
|
||||
};
|
||||
|
||||
const descriptions = {
|
||||
browserOpenMode: 'path to a custom browser to be added to the list of available browsers in Cypress',
|
||||
browserRunMode: 'runs Cypress in the browser with the given name. if a filesystem path is supplied, Cypress will attempt to use the browser at that path.',
|
||||
cacheClear: 'delete all cached binaries',
|
||||
cachePrune: 'deletes all cached binaries except for the version currently in use',
|
||||
cacheList: 'list cached binary versions',
|
||||
cachePath: 'print the path to the binary cache',
|
||||
cacheSize: 'Used with the list command to show the sizes of the cached folders',
|
||||
ciBuildId: 'the unique identifier for a run on your CI provider. typically a "BUILD_ID" env var. this value is automatically detected for most CI providers',
|
||||
config: 'sets configuration values. separate multiple values with a comma. overrides any value in cypress.json.',
|
||||
configFile: 'path to JSON file where configuration values are set. defaults to "cypress.json". pass "false" to disable.',
|
||||
detached: 'runs Cypress application in detached mode',
|
||||
dev: 'runs cypress in development and bypasses binary check',
|
||||
env: 'sets environment variables. separate multiple values with a comma. overrides any value in cypress.json or cypress.env.json',
|
||||
exit: 'keep the browser open after tests finish',
|
||||
forceInstall: 'force install the Cypress binary',
|
||||
global: 'force Cypress into global mode as if its globally installed',
|
||||
group: 'a named group for recorded runs in the Cypress Dashboard',
|
||||
headed: 'displays the browser instead of running headlessly',
|
||||
headless: 'hide the browser instead of running headed (default for cypress run)',
|
||||
key: 'your secret Record Key. you can omit this if you set a CYPRESS_RECORD_KEY environment variable.',
|
||||
parallel: 'enables concurrent runs and automatic load balancing of specs across multiple machines or processes',
|
||||
port: 'runs Cypress on a specific port. overrides any value in cypress.json.',
|
||||
project: 'path to the project',
|
||||
quiet: 'run quietly, using only the configured reporter',
|
||||
record: 'records the run. sends test results, screenshots and videos to your Cypress Dashboard.',
|
||||
reporter: 'runs a specific mocha reporter. pass a path to use a custom reporter. defaults to "spec"',
|
||||
reporterOptions: 'options for the mocha reporter. defaults to "null"',
|
||||
spec: 'runs specific spec file(s). defaults to "all"',
|
||||
tag: 'named tag(s) for recorded runs in the Cypress Dashboard',
|
||||
version: 'prints Cypress version'
|
||||
};
|
||||
const knownCommands = ['cache', 'help', '-h', '--help', 'install', 'open', 'run', 'open-ct', 'run-ct', 'verify', '-v', '--version', 'version', 'info'];
|
||||
|
||||
const text = description => {
|
||||
if (!descriptions[description]) {
|
||||
throw new Error(`Could not find description for: ${description}`);
|
||||
}
|
||||
|
||||
return descriptions[description];
|
||||
};
|
||||
|
||||
function includesVersion(args) {
|
||||
return _.includes(args, 'version') || _.includes(args, '--version') || _.includes(args, '-v');
|
||||
}
|
||||
|
||||
function showVersions(args) {
|
||||
debug('printing Cypress version');
|
||||
debug('additional arguments %o', args);
|
||||
const versionParser = commander.option('--component <package|binary|electron|node>', 'component to report version for').allowUnknownOption(true);
|
||||
const parsed = versionParser.parse(args);
|
||||
const parsedOptions = {
|
||||
component: parsed.component
|
||||
};
|
||||
debug('parsed version arguments %o', parsedOptions);
|
||||
|
||||
const reportAllVersions = versions => {
|
||||
logger.always('Cypress package version:', versions.package);
|
||||
logger.always('Cypress binary version:', versions.binary);
|
||||
logger.always('Electron version:', versions.electronVersion);
|
||||
logger.always('Bundled Node version:', versions.electronNodeVersion);
|
||||
};
|
||||
|
||||
const reportComponentVersion = (componentName, versions) => {
|
||||
const names = {
|
||||
package: 'package',
|
||||
binary: 'binary',
|
||||
electron: 'electronVersion',
|
||||
node: 'electronNodeVersion'
|
||||
};
|
||||
|
||||
if (!names[componentName]) {
|
||||
throw new Error(`Unknown component name "${componentName}"`);
|
||||
}
|
||||
|
||||
const name = names[componentName];
|
||||
|
||||
if (!versions[name]) {
|
||||
throw new Error(`Cannot find version for component "${componentName}" under property "${name}"`);
|
||||
}
|
||||
|
||||
const version = versions[name];
|
||||
logger.always(version);
|
||||
};
|
||||
|
||||
const defaultVersions = {
|
||||
package: undefined,
|
||||
binary: undefined,
|
||||
electronVersion: undefined,
|
||||
electronNodeVersion: undefined
|
||||
};
|
||||
return require('./exec/versions').getVersions().then((versions = defaultVersions) => {
|
||||
if (parsedOptions.component) {
|
||||
reportComponentVersion(parsedOptions.component, versions);
|
||||
} else {
|
||||
reportAllVersions(versions);
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
}).catch(util.logErrorExit1);
|
||||
}
|
||||
|
||||
const createProgram = () => {
|
||||
const program = new commander.Command(); // bug in commander not printing name
|
||||
// in usage help docs
|
||||
|
||||
program._name = 'cypress';
|
||||
program.usage('<command> [options]');
|
||||
return program;
|
||||
};
|
||||
|
||||
const addCypressRunCommand = program => {
|
||||
return program.command('run').usage('[options]').description('Runs Cypress tests from the CLI without the GUI').option('-b, --browser <browser-name-or-path>', text('browserRunMode')).option('--ci-build-id <id>', text('ciBuildId')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('-e, --env <env>', text('env')).option('--group <name>', text('group')).option('-k, --key <record-key>', text('key')).option('--headed', text('headed')).option('--headless', text('headless')).option('--no-exit', text('exit')).option('--parallel', text('parallel')).option('-p, --port <port>', text('port')).option('-P, --project <project-path>', text('project')).option('-q, --quiet', text('quiet')).option('--record [bool]', text('record'), coerceFalse).option('-r, --reporter <reporter>', text('reporter')).option('-o, --reporter-options <reporter-options>', text('reporterOptions')).option('-s, --spec <spec>', text('spec')).option('-t, --tag <tag>', text('tag')).option('--dev', text('dev'), coerceFalse);
|
||||
};
|
||||
/**
|
||||
* Casts known command line options for "cypress run" to their intended type.
|
||||
* For example if the user passes "--port 5005" the ".port" property should be
|
||||
* a number 5005 and not a string "5005".
|
||||
*
|
||||
* Returns a clone of the original object.
|
||||
*/
|
||||
|
||||
|
||||
const castCypressRunOptions = opts => {
|
||||
// only properties that have type "string | false" in our TS definition
|
||||
// require special handling, because CLI parsing takes care of purely
|
||||
// boolean arguments
|
||||
const result = R.evolve({
|
||||
port: coerceAnyStringToInt,
|
||||
configFile: coerceFalseOrString
|
||||
})(opts);
|
||||
return result;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Parses `cypress run` command line option array into an object
|
||||
* with options that you can feed into a `cypress.run()` module API call.
|
||||
* @example
|
||||
* const options = parseRunCommand(['cypress', 'run', '--browser', 'chrome'])
|
||||
* // options is {browser: 'chrome'}
|
||||
*/
|
||||
parseRunCommand(args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!Array.isArray(args)) {
|
||||
return reject(new Error('Expected array of arguments'));
|
||||
} // make a copy of the input arguments array
|
||||
// and add placeholders where "node ..." would usually be
|
||||
// also remove "cypress" keyword at the start if present
|
||||
|
||||
|
||||
const cliArgs = args[0] === 'cypress' ? [...args.slice(1)] : [...args];
|
||||
cliArgs.unshift(null, null);
|
||||
debug('creating program parser');
|
||||
const program = createProgram();
|
||||
addCypressRunCommand(program).action((...fnArgs) => {
|
||||
debug('parsed Cypress run %o', fnArgs);
|
||||
const options = parseVariableOpts(fnArgs, cliArgs);
|
||||
debug('parsed options %o', options);
|
||||
const casted = castCypressRunOptions(options);
|
||||
debug('casted options %o', casted);
|
||||
resolve(casted);
|
||||
});
|
||||
debug('parsing args: %o', cliArgs);
|
||||
program.parse(cliArgs);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Parses the command line and kicks off Cypress process.
|
||||
*/
|
||||
init(args) {
|
||||
if (!args) {
|
||||
args = process.argv;
|
||||
}
|
||||
|
||||
const {
|
||||
CYPRESS_INTERNAL_ENV
|
||||
} = process.env;
|
||||
|
||||
if (!util.isValidCypressInternalEnvValue(CYPRESS_INTERNAL_ENV)) {
|
||||
debug('invalid CYPRESS_INTERNAL_ENV value', CYPRESS_INTERNAL_ENV);
|
||||
return errors.exitWithError(errors.errors.invalidCypressEnv)(`CYPRESS_INTERNAL_ENV=${CYPRESS_INTERNAL_ENV}`);
|
||||
}
|
||||
|
||||
if (util.isNonProductionCypressInternalEnvValue(CYPRESS_INTERNAL_ENV)) {
|
||||
debug('non-production CYPRESS_INTERNAL_ENV value', CYPRESS_INTERNAL_ENV);
|
||||
let msg = `
|
||||
${logSymbols.warning} Warning: It looks like you're passing CYPRESS_INTERNAL_ENV=${CYPRESS_INTERNAL_ENV}
|
||||
|
||||
The environment variable "CYPRESS_INTERNAL_ENV" is reserved and should only be used internally.
|
||||
|
||||
Unset the "CYPRESS_INTERNAL_ENV" environment variable and run Cypress again.
|
||||
`;
|
||||
logger.log();
|
||||
logger.warn(stripIndent(msg));
|
||||
logger.log();
|
||||
}
|
||||
|
||||
const program = createProgram();
|
||||
program.command('help').description('Shows CLI help and exits').action(() => {
|
||||
program.help();
|
||||
});
|
||||
program.option('-v, --version', text('version')).command('version').description(text('version')).action(() => {
|
||||
showVersions(args);
|
||||
});
|
||||
program.command('open').usage('[options]').description('Opens Cypress in the interactive GUI.').option('-b, --browser <browser-path>', text('browserOpenMode')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('-d, --detached [bool]', text('detached'), coerceFalse).option('-e, --env <env>', text('env')).option('--global', text('global')).option('-p, --port <port>', text('port')).option('-P, --project <project-path>', text('project')).option('--dev', text('dev'), coerceFalse).action(opts => {
|
||||
debug('opening Cypress');
|
||||
|
||||
require('./exec/open').start(util.parseOpts(opts)).catch(util.logErrorExit1);
|
||||
});
|
||||
addCypressRunCommand(program).action((...fnArgs) => {
|
||||
debug('running Cypress with args %o', fnArgs);
|
||||
|
||||
require('./exec/run').start(parseVariableOpts(fnArgs, args)).then(util.exit).catch(util.logErrorExit1);
|
||||
});
|
||||
program.command('open-ct').usage('[options]').description('Opens Cypress component testing interactive mode.').option('-b, --browser <browser-path>', text('browserOpenMode')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('-d, --detached [bool]', text('detached'), coerceFalse).option('-e, --env <env>', text('env')).option('--global', text('global')).option('-p, --port <port>', text('port')).option('-P, --project <project-path>', text('project')).option('--dev', text('dev'), coerceFalse).action(opts => {
|
||||
debug('opening Cypress');
|
||||
|
||||
require('./exec/open').start({ ...util.parseOpts(opts),
|
||||
testingType: 'component'
|
||||
}).catch(util.logErrorExit1);
|
||||
});
|
||||
program.command('run-ct').usage('[options]').description('Runs all Cypress Component Testing suites').option('-b, --browser <browser-name-or-path>', text('browserRunMode')).option('--ci-build-id <id>', text('ciBuildId')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('-e, --env <env>', text('env')).option('--group <name>', text('group')).option('-k, --key <record-key>', text('key')).option('--headed', text('headed')).option('--headless', text('headless')).option('--no-exit', text('exit')).option('--parallel', text('parallel')).option('-p, --port <port>', text('port')).option('-P, --project <project-path>', text('project')).option('-q, --quiet', text('quiet')).option('--record [bool]', text('record'), coerceFalse).option('-r, --reporter <reporter>', text('reporter')).option('-o, --reporter-options <reporter-options>', text('reporterOptions')).option('-s, --spec <spec>', text('spec')).option('-t, --tag <tag>', text('tag')).option('--dev', text('dev'), coerceFalse).action(opts => {
|
||||
debug('running Cypress run-ct');
|
||||
|
||||
require('./exec/run').start({ ...util.parseOpts(opts),
|
||||
testingType: 'component'
|
||||
}).then(util.exit).catch(util.logErrorExit1);
|
||||
});
|
||||
program.command('install').usage('[options]').description('Installs the Cypress executable matching this package\'s version').option('-f, --force', text('forceInstall')).action(opts => {
|
||||
require('./tasks/install').start(util.parseOpts(opts)).catch(util.logErrorExit1);
|
||||
});
|
||||
program.command('verify').usage('[options]').description('Verifies that Cypress is installed correctly and executable').option('--dev', text('dev'), coerceFalse).action(opts => {
|
||||
const defaultOpts = {
|
||||
force: true,
|
||||
welcomeMessage: false
|
||||
};
|
||||
const parsedOpts = util.parseOpts(opts);
|
||||
|
||||
const options = _.extend(parsedOpts, defaultOpts);
|
||||
|
||||
require('./tasks/verify').start(options).catch(util.logErrorExit1);
|
||||
});
|
||||
program.command('cache').usage('[command]').description('Manages the Cypress binary cache').option('list', text('cacheList')).option('path', text('cachePath')).option('clear', text('cacheClear')).option('prune', text('cachePrune')).option('--size', text('cacheSize')).action(function (opts, args) {
|
||||
if (!args || !args.length) {
|
||||
this.outputHelp();
|
||||
util.exit(1);
|
||||
}
|
||||
|
||||
const [command] = args;
|
||||
|
||||
if (!_.includes(['list', 'path', 'clear', 'prune'], command)) {
|
||||
unknownOption.call(this, `cache ${command}`, 'command');
|
||||
}
|
||||
|
||||
if (command === 'list') {
|
||||
debug('cache command %o', {
|
||||
command,
|
||||
size: opts.size
|
||||
});
|
||||
return cache.list(opts.size).catch({
|
||||
code: 'ENOENT'
|
||||
}, () => {
|
||||
logger.always('No cached binary versions were found.');
|
||||
process.exit(0);
|
||||
}).catch(e => {
|
||||
debug('cache list command failed with "%s"', e.message);
|
||||
util.logErrorExit1(e);
|
||||
});
|
||||
}
|
||||
|
||||
cache[command]();
|
||||
});
|
||||
program.command('info').usage('[command]').description('Prints Cypress and system information').option('--dev', text('dev'), coerceFalse).action(opts => {
|
||||
require('./exec/info').start(opts).then(util.exit).catch(util.logErrorExit1);
|
||||
});
|
||||
debug('cli starts with arguments %j', args);
|
||||
util.printNodeOptions(); // if there are no arguments
|
||||
|
||||
if (args.length <= 2) {
|
||||
debug('printing help');
|
||||
program.help(); // exits
|
||||
}
|
||||
|
||||
const firstCommand = args[2];
|
||||
|
||||
if (!_.includes(knownCommands, firstCommand)) {
|
||||
debug('unknown command %s', firstCommand);
|
||||
logger.error('Unknown command', `"${firstCommand}"`);
|
||||
program.outputHelp();
|
||||
return util.exit(1);
|
||||
}
|
||||
|
||||
if (includesVersion(args)) {
|
||||
// commander 2.11.0 changes behavior
|
||||
// and now does not understand top level options
|
||||
// .option('-v, --version').command('version')
|
||||
// so we have to manually catch '-v, --version'
|
||||
return showVersions(args);
|
||||
}
|
||||
|
||||
debug('program parsing arguments');
|
||||
return program.parse(args);
|
||||
}
|
||||
|
||||
}; // @ts-ignore
|
||||
|
||||
if (!module.parent) {
|
||||
logger.error('This CLI module should be required from another Node module');
|
||||
logger.error('and not executed directly');
|
||||
process.exit(-1);
|
||||
}
|
75
node_modules/cypress/lib/cypress.js
generated
vendored
Normal file
75
node_modules/cypress/lib/cypress.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
|
||||
// https://github.com/cypress-io/cypress/issues/316
|
||||
const Promise = require('bluebird');
|
||||
|
||||
const tmp = Promise.promisifyAll(require('tmp'));
|
||||
|
||||
const fs = require('./fs');
|
||||
|
||||
const open = require('./exec/open');
|
||||
|
||||
const run = require('./exec/run');
|
||||
|
||||
const util = require('./util');
|
||||
|
||||
const cli = require('./cli');
|
||||
|
||||
const cypressModuleApi = {
|
||||
/**
|
||||
* Opens Cypress GUI
|
||||
* @see https://on.cypress.io/module-api#cypress-open
|
||||
*/
|
||||
open(options = {}) {
|
||||
options = util.normalizeModuleOptions(options);
|
||||
return open.start(options);
|
||||
},
|
||||
|
||||
/**
|
||||
* Runs Cypress tests in the current project
|
||||
* @see https://on.cypress.io/module-api#cypress-run
|
||||
*/
|
||||
run(options = {}) {
|
||||
if (!run.isValidProject(options.project)) {
|
||||
return Promise.reject(new Error(`Invalid project path parameter: ${options.project}`));
|
||||
}
|
||||
|
||||
options = util.normalizeModuleOptions(options);
|
||||
return tmp.fileAsync().then(outputPath => {
|
||||
options.outputPath = outputPath;
|
||||
return run.start(options).then(failedTests => {
|
||||
return fs.readJsonAsync(outputPath, {
|
||||
throws: false
|
||||
}).then(output => {
|
||||
if (!output) {
|
||||
return {
|
||||
status: 'failed',
|
||||
failures: failedTests,
|
||||
message: 'Could not find Cypress test run results'
|
||||
};
|
||||
}
|
||||
|
||||
return output;
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
cli: {
|
||||
/**
|
||||
* Parses CLI arguments into an object that you can pass to "cypress.run"
|
||||
* @example
|
||||
* const cypress = require('cypress')
|
||||
* const cli = ['cypress', 'run', '--browser', 'firefox']
|
||||
* const options = await cypress.cli.parseRunArguments(cli)
|
||||
* // options is {browser: 'firefox'}
|
||||
* await cypress.run(options)
|
||||
* @see https://on.cypress.io/module-api
|
||||
*/
|
||||
parseRunArguments(args) {
|
||||
return cli.parseRunCommand(args);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
module.exports = cypressModuleApi;
|
392
node_modules/cypress/lib/errors.js
generated
vendored
Normal file
392
node_modules/cypress/lib/errors.js
generated
vendored
Normal file
@@ -0,0 +1,392 @@
|
||||
"use strict";
|
||||
|
||||
const chalk = require('chalk');
|
||||
|
||||
const {
|
||||
stripIndent,
|
||||
stripIndents
|
||||
} = require('common-tags');
|
||||
|
||||
const {
|
||||
merge
|
||||
} = require('ramda');
|
||||
|
||||
const la = require('lazy-ass');
|
||||
|
||||
const is = require('check-more-types');
|
||||
|
||||
const util = require('./util');
|
||||
|
||||
const state = require('./tasks/state');
|
||||
|
||||
const docsUrl = 'https://on.cypress.io';
|
||||
const requiredDependenciesUrl = `${docsUrl}/required-dependencies`;
|
||||
const runDocumentationUrl = `${docsUrl}/cypress-run`; // TODO it would be nice if all error objects could be enforced via types
|
||||
// to only have description + solution properties
|
||||
|
||||
const hr = '----------';
|
||||
const genericErrorSolution = stripIndent`
|
||||
Search for an existing issue or open a GitHub issue at
|
||||
|
||||
${chalk.blue(util.issuesUrl)}
|
||||
`; // common errors Cypress application can encounter
|
||||
|
||||
const unknownError = {
|
||||
description: 'Unknown Cypress CLI error',
|
||||
solution: genericErrorSolution
|
||||
};
|
||||
const invalidRunProjectPath = {
|
||||
description: 'Invalid --project path',
|
||||
solution: stripIndent`
|
||||
Please provide a valid project path.
|
||||
|
||||
Learn more about ${chalk.cyan('cypress run')} at:
|
||||
|
||||
${chalk.blue(runDocumentationUrl)}
|
||||
`
|
||||
};
|
||||
const failedDownload = {
|
||||
description: 'The Cypress App could not be downloaded.',
|
||||
solution: stripIndent`
|
||||
Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration
|
||||
|
||||
Otherwise, please check network connectivity and try again:`
|
||||
};
|
||||
const failedUnzip = {
|
||||
description: 'The Cypress App could not be unzipped.',
|
||||
solution: genericErrorSolution
|
||||
};
|
||||
|
||||
const missingApp = binaryDir => {
|
||||
return {
|
||||
description: `No version of Cypress is installed in: ${chalk.cyan(binaryDir)}`,
|
||||
solution: stripIndent`
|
||||
\nPlease reinstall Cypress by running: ${chalk.cyan('cypress install')}
|
||||
`
|
||||
};
|
||||
};
|
||||
|
||||
const binaryNotExecutable = executable => {
|
||||
return {
|
||||
description: `Cypress cannot run because this binary file does not have executable permissions here:\n\n${executable}`,
|
||||
solution: stripIndent`\n
|
||||
Reasons this may happen:
|
||||
|
||||
- node was installed as 'root' or with 'sudo'
|
||||
- the cypress npm package as 'root' or with 'sudo'
|
||||
|
||||
Please check that you have the appropriate user permissions.
|
||||
|
||||
You can also try clearing the cache with 'cypress cache clear' and reinstalling.
|
||||
`
|
||||
};
|
||||
};
|
||||
|
||||
const notInstalledCI = executable => {
|
||||
return {
|
||||
description: 'The cypress npm package is installed, but the Cypress binary is missing.',
|
||||
solution: stripIndent`\n
|
||||
We expected the binary to be installed here: ${chalk.cyan(executable)}
|
||||
|
||||
Reasons it may be missing:
|
||||
|
||||
- You're caching 'node_modules' but are not caching this path: ${util.getCacheDir()}
|
||||
- You ran 'npm install' at an earlier build step but did not persist: ${util.getCacheDir()}
|
||||
|
||||
Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.
|
||||
|
||||
Alternatively, you can run 'cypress install' to download the binary again.
|
||||
|
||||
${chalk.blue('https://on.cypress.io/not-installed-ci-error')}
|
||||
`
|
||||
};
|
||||
};
|
||||
|
||||
const nonZeroExitCodeXvfb = {
|
||||
description: 'Xvfb exited with a non zero exit code.',
|
||||
solution: stripIndent`
|
||||
There was a problem spawning Xvfb.
|
||||
|
||||
This is likely a problem with your system, permissions, or installation of Xvfb.
|
||||
`
|
||||
};
|
||||
const missingXvfb = {
|
||||
description: 'Your system is missing the dependency: Xvfb',
|
||||
solution: stripIndent`
|
||||
Install Xvfb and run Cypress again.
|
||||
|
||||
Read our documentation on dependencies for more information:
|
||||
|
||||
${chalk.blue(requiredDependenciesUrl)}
|
||||
|
||||
If you are using Docker, we provide containers with all required dependencies installed.
|
||||
`
|
||||
};
|
||||
|
||||
const smokeTestFailure = (smokeTestCommand, timedOut) => {
|
||||
return {
|
||||
description: `Cypress verification ${timedOut ? 'timed out' : 'failed'}.`,
|
||||
solution: stripIndent`
|
||||
This command failed with the following output:
|
||||
|
||||
${smokeTestCommand}
|
||||
|
||||
`
|
||||
};
|
||||
};
|
||||
|
||||
const invalidSmokeTestDisplayError = {
|
||||
code: 'INVALID_SMOKE_TEST_DISPLAY_ERROR',
|
||||
description: 'Cypress verification failed.',
|
||||
|
||||
solution(msg) {
|
||||
return stripIndent`
|
||||
Cypress failed to start after spawning a new Xvfb server.
|
||||
|
||||
The error logs we received were:
|
||||
|
||||
${hr}
|
||||
|
||||
${msg}
|
||||
|
||||
${hr}
|
||||
|
||||
This may be due to a missing library or dependency. ${chalk.blue(requiredDependenciesUrl)}
|
||||
|
||||
Please refer to the error above for more detail.
|
||||
`;
|
||||
}
|
||||
|
||||
};
|
||||
const missingDependency = {
|
||||
description: 'Cypress failed to start.',
|
||||
// this message is too Linux specific
|
||||
solution: stripIndent`
|
||||
This may be due to a missing library or dependency. ${chalk.blue(requiredDependenciesUrl)}
|
||||
|
||||
Please refer to the error below for more details.
|
||||
`
|
||||
};
|
||||
const invalidCacheDirectory = {
|
||||
description: 'Cypress cannot write to the cache directory due to file permissions',
|
||||
solution: stripIndent`
|
||||
See discussion and possible solutions at
|
||||
${chalk.blue(util.getGitHubIssueUrl(1281))}
|
||||
`
|
||||
};
|
||||
const versionMismatch = {
|
||||
description: 'Installed version does not match package version.',
|
||||
solution: 'Install Cypress and verify app again'
|
||||
};
|
||||
const incompatibleHeadlessFlags = {
|
||||
description: '`--headed` and `--headless` cannot both be passed.',
|
||||
solution: 'Either pass `--headed` or `--headless`, but not both.'
|
||||
};
|
||||
const solutionUnknown = stripIndent`
|
||||
Please search Cypress documentation for possible solutions:
|
||||
|
||||
${chalk.blue(docsUrl)}
|
||||
|
||||
Check if there is a GitHub issue describing this crash:
|
||||
|
||||
${chalk.blue(util.issuesUrl)}
|
||||
|
||||
Consider opening a new issue.
|
||||
`;
|
||||
const unexpected = {
|
||||
description: 'An unexpected error occurred while verifying the Cypress executable.',
|
||||
solution: solutionUnknown
|
||||
};
|
||||
const invalidCypressEnv = {
|
||||
description: chalk.red('The environment variable with the reserved name "CYPRESS_INTERNAL_ENV" is set.'),
|
||||
solution: chalk.red('Unset the "CYPRESS_INTERNAL_ENV" environment variable and run Cypress again.'),
|
||||
exitCode: 11
|
||||
};
|
||||
const invalidTestingType = {
|
||||
description: 'Invalid testingType',
|
||||
solution: `Please provide a valid testingType. Valid test types are ${chalk.cyan('\'e2e\'')} and ${chalk.cyan('\'component\'')}.`
|
||||
};
|
||||
/**
|
||||
* This error happens when CLI detects that the child Test Runner process
|
||||
* was killed with a signal, like SIGBUS
|
||||
* @see https://github.com/cypress-io/cypress/issues/5808
|
||||
* @param {'close'|'event'} eventName Child close event name
|
||||
* @param {string} signal Signal that closed the child process, like "SIGBUS"
|
||||
*/
|
||||
|
||||
const childProcessKilled = (eventName, signal) => {
|
||||
return {
|
||||
description: `The Test Runner unexpectedly exited via a ${chalk.cyan(eventName)} event with signal ${chalk.cyan(signal)}`,
|
||||
solution: solutionUnknown
|
||||
};
|
||||
};
|
||||
|
||||
const CYPRESS_RUN_BINARY = {
|
||||
notValid: value => {
|
||||
const properFormat = `**/${state.getPlatformExecutable()}`;
|
||||
return {
|
||||
description: `Could not run binary set by environment variable: CYPRESS_RUN_BINARY=${value}`,
|
||||
solution: `Ensure the environment variable is a path to the Cypress binary, matching ${properFormat}`
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
function addPlatformInformation(info) {
|
||||
return util.getPlatformInfo().then(platform => {
|
||||
return merge(info, {
|
||||
platform
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Given an error object (see the errors above), forms error message text with details,
|
||||
* then resolves with Error instance you can throw or reject with.
|
||||
* @param {object} errorObject
|
||||
* @returns {Promise<Error>} resolves with an Error
|
||||
* @example
|
||||
```js
|
||||
// inside a Promise with "resolve" and "reject"
|
||||
const errorObject = childProcessKilled('exit', 'SIGKILL')
|
||||
return getError(errorObject).then(reject)
|
||||
```
|
||||
*/
|
||||
|
||||
|
||||
function getError(errorObject) {
|
||||
return formErrorText(errorObject).then(errorMessage => {
|
||||
const err = new Error(errorMessage);
|
||||
err.known = true;
|
||||
return err;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Forms nice error message with error and platform information,
|
||||
* and if possible a way to solve it. Resolves with a string.
|
||||
*/
|
||||
|
||||
|
||||
function formErrorText(info, msg, prevMessage) {
|
||||
return addPlatformInformation(info).then(obj => {
|
||||
const formatted = [];
|
||||
|
||||
function add(msg) {
|
||||
formatted.push(stripIndents(msg));
|
||||
}
|
||||
|
||||
la(is.unemptyString(obj.description), 'expected error description to be text', obj.description); // assuming that if there the solution is a function it will handle
|
||||
// error message and (optional previous error message)
|
||||
|
||||
if (is.fn(obj.solution)) {
|
||||
const text = obj.solution(msg, prevMessage);
|
||||
la(is.unemptyString(text), 'expected solution to be text', text);
|
||||
add(`
|
||||
${obj.description}
|
||||
|
||||
${text}
|
||||
|
||||
`);
|
||||
} else {
|
||||
la(is.unemptyString(obj.solution), 'expected error solution to be text', obj.solution);
|
||||
add(`
|
||||
${obj.description}
|
||||
|
||||
${obj.solution}
|
||||
|
||||
`);
|
||||
|
||||
if (msg) {
|
||||
add(`
|
||||
${hr}
|
||||
|
||||
${msg}
|
||||
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
add(`
|
||||
${hr}
|
||||
|
||||
${obj.platform}
|
||||
`);
|
||||
|
||||
if (obj.footer) {
|
||||
add(`
|
||||
|
||||
${hr}
|
||||
|
||||
${obj.footer}
|
||||
`);
|
||||
}
|
||||
|
||||
return formatted.join('\n\n');
|
||||
});
|
||||
}
|
||||
|
||||
const raise = info => {
|
||||
return text => {
|
||||
const err = new Error(text);
|
||||
|
||||
if (info.code) {
|
||||
err.code = info.code;
|
||||
}
|
||||
|
||||
err.known = true;
|
||||
throw err;
|
||||
};
|
||||
};
|
||||
|
||||
const throwFormErrorText = info => {
|
||||
return (msg, prevMessage) => {
|
||||
return formErrorText(info, msg, prevMessage).then(raise(info));
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Forms full error message with error and OS details, prints to the error output
|
||||
* and then exits the process.
|
||||
* @param {ErrorInformation} info Error information {description, solution}
|
||||
* @example return exitWithError(errors.invalidCypressEnv)('foo')
|
||||
*/
|
||||
|
||||
|
||||
const exitWithError = info => {
|
||||
return msg => {
|
||||
return formErrorText(info, msg).then(text => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(text);
|
||||
process.exit(info.exitCode || 1);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
raise,
|
||||
exitWithError,
|
||||
// formError,
|
||||
formErrorText,
|
||||
throwFormErrorText,
|
||||
getError,
|
||||
hr,
|
||||
errors: {
|
||||
unknownError,
|
||||
nonZeroExitCodeXvfb,
|
||||
missingXvfb,
|
||||
missingApp,
|
||||
notInstalledCI,
|
||||
missingDependency,
|
||||
invalidSmokeTestDisplayError,
|
||||
versionMismatch,
|
||||
binaryNotExecutable,
|
||||
unexpected,
|
||||
failedDownload,
|
||||
failedUnzip,
|
||||
invalidCypressEnv,
|
||||
invalidCacheDirectory,
|
||||
CYPRESS_RUN_BINARY,
|
||||
smokeTestFailure,
|
||||
childProcessKilled,
|
||||
incompatibleHeadlessFlags,
|
||||
invalidRunProjectPath,
|
||||
invalidTestingType
|
||||
}
|
||||
};
|
96
node_modules/cypress/lib/exec/info.js
generated
vendored
Normal file
96
node_modules/cypress/lib/exec/info.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
|
||||
/* eslint-disable no-console */
|
||||
const spawn = require('./spawn');
|
||||
|
||||
const util = require('../util');
|
||||
|
||||
const state = require('../tasks/state');
|
||||
|
||||
const os = require('os');
|
||||
|
||||
const chalk = require('chalk');
|
||||
|
||||
const prettyBytes = require('pretty-bytes');
|
||||
|
||||
const _ = require('lodash');
|
||||
|
||||
const R = require('ramda'); // color for numbers and show values
|
||||
|
||||
|
||||
const g = chalk.green; // color for paths
|
||||
|
||||
const p = chalk.cyan; // urls
|
||||
|
||||
const link = chalk.blue.underline; // to be exported
|
||||
|
||||
const methods = {};
|
||||
|
||||
methods.findProxyEnvironmentVariables = () => {
|
||||
return _.pick(process.env, ['HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY']);
|
||||
};
|
||||
|
||||
const maskSensitiveVariables = R.evolve({
|
||||
CYPRESS_RECORD_KEY: R.always('<redacted>')
|
||||
});
|
||||
|
||||
methods.findCypressEnvironmentVariables = () => {
|
||||
const isCyVariable = (val, key) => key.startsWith('CYPRESS_');
|
||||
|
||||
return R.pickBy(isCyVariable)(process.env);
|
||||
};
|
||||
|
||||
const formatCypressVariables = () => {
|
||||
const vars = methods.findCypressEnvironmentVariables();
|
||||
return maskSensitiveVariables(vars);
|
||||
};
|
||||
|
||||
methods.start = (options = {}) => {
|
||||
const args = ['--mode=info'];
|
||||
return spawn.start(args, {
|
||||
dev: options.dev
|
||||
}).then(() => {
|
||||
console.log();
|
||||
const proxyVars = methods.findProxyEnvironmentVariables();
|
||||
|
||||
if (_.isEmpty(proxyVars)) {
|
||||
console.log('Proxy Settings: none detected');
|
||||
} else {
|
||||
console.log('Proxy Settings:');
|
||||
|
||||
_.forEach(proxyVars, (value, key) => {
|
||||
console.log('%s: %s', key, g(value));
|
||||
});
|
||||
|
||||
console.log();
|
||||
console.log('Learn More: %s', link('https://on.cypress.io/proxy-configuration'));
|
||||
console.log();
|
||||
}
|
||||
}).then(() => {
|
||||
const cyVars = formatCypressVariables();
|
||||
|
||||
if (_.isEmpty(cyVars)) {
|
||||
console.log('Environment Variables: none detected');
|
||||
} else {
|
||||
console.log('Environment Variables:');
|
||||
|
||||
_.forEach(cyVars, (value, key) => {
|
||||
console.log('%s: %s', key, g(value));
|
||||
});
|
||||
}
|
||||
}).then(() => {
|
||||
console.log();
|
||||
console.log('Application Data:', p(util.getApplicationDataFolder()));
|
||||
console.log('Browser Profiles:', p(util.getApplicationDataFolder('browsers')));
|
||||
console.log('Binary Caches: %s', p(state.getCacheDir()));
|
||||
}).then(() => {
|
||||
console.log();
|
||||
return util.getOsVersionAsync().then(osVersion => {
|
||||
console.log('Cypress Version: %s', g(util.pkgVersion()));
|
||||
console.log('System Platform: %s (%s)', g(os.platform()), g(osVersion));
|
||||
console.log('System Memory: %s free %s', g(prettyBytes(os.totalmem())), g(prettyBytes(os.freemem())));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = methods;
|
66
node_modules/cypress/lib/exec/open.js
generated
vendored
Normal file
66
node_modules/cypress/lib/exec/open.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
|
||||
const debug = require('debug')('cypress:cli');
|
||||
|
||||
const util = require('../util');
|
||||
|
||||
const spawn = require('./spawn');
|
||||
|
||||
const verify = require('../tasks/verify');
|
||||
|
||||
const {
|
||||
processTestingType
|
||||
} = require('./shared');
|
||||
|
||||
module.exports = {
|
||||
start(options = {}) {
|
||||
if (!util.isInstalledGlobally() && !options.global && !options.project) {
|
||||
options.project = process.cwd();
|
||||
}
|
||||
|
||||
const args = [];
|
||||
|
||||
if (options.config) {
|
||||
args.push('--config', options.config);
|
||||
}
|
||||
|
||||
if (options.configFile !== undefined) {
|
||||
args.push('--config-file', options.configFile);
|
||||
}
|
||||
|
||||
if (options.browser) {
|
||||
args.push('--browser', options.browser);
|
||||
}
|
||||
|
||||
if (options.env) {
|
||||
args.push('--env', options.env);
|
||||
}
|
||||
|
||||
if (options.port) {
|
||||
args.push('--port', options.port);
|
||||
}
|
||||
|
||||
if (options.project) {
|
||||
args.push('--project', options.project);
|
||||
}
|
||||
|
||||
args.push(...processTestingType(options.testingType));
|
||||
debug('opening from options %j', options);
|
||||
debug('command line arguments %j', args);
|
||||
|
||||
function open() {
|
||||
return spawn.start(args, {
|
||||
dev: options.dev,
|
||||
detached: Boolean(options.detached),
|
||||
stdio: 'inherit'
|
||||
});
|
||||
}
|
||||
|
||||
if (options.dev) {
|
||||
return open();
|
||||
}
|
||||
|
||||
return verify.start().then(open);
|
||||
}
|
||||
|
||||
};
|
200
node_modules/cypress/lib/exec/run.js
generated
vendored
Normal file
200
node_modules/cypress/lib/exec/run.js
generated
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
"use strict";
|
||||
|
||||
const _ = require('lodash');
|
||||
|
||||
const debug = require('debug')('cypress:cli:run');
|
||||
|
||||
const util = require('../util');
|
||||
|
||||
const spawn = require('./spawn');
|
||||
|
||||
const verify = require('../tasks/verify');
|
||||
|
||||
const {
|
||||
exitWithError,
|
||||
errors
|
||||
} = require('../errors');
|
||||
|
||||
const {
|
||||
processTestingType,
|
||||
throwInvalidOptionError
|
||||
} = require('./shared');
|
||||
/**
|
||||
* Typically a user passes a string path to the project.
|
||||
* But "cypress open" allows using `false` to open in global mode,
|
||||
* and the user can accidentally execute `cypress run --project false`
|
||||
* which should be invalid.
|
||||
*/
|
||||
|
||||
|
||||
const isValidProject = v => {
|
||||
if (typeof v === 'boolean') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (v === '' || v === 'false' || v === 'true') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Maps options collected by the CLI
|
||||
* and forms list of CLI arguments to the server.
|
||||
*
|
||||
* Note: there is lightweight validation, with errors
|
||||
* thrown synchronously.
|
||||
*
|
||||
* @returns {string[]} list of CLI arguments
|
||||
*/
|
||||
|
||||
|
||||
const processRunOptions = (options = {}) => {
|
||||
debug('processing run options %o', options);
|
||||
|
||||
if (!isValidProject(options.project)) {
|
||||
debug('invalid project option %o', {
|
||||
project: options.project
|
||||
});
|
||||
return throwInvalidOptionError(errors.invalidRunProjectPath);
|
||||
}
|
||||
|
||||
const args = ['--run-project', options.project];
|
||||
|
||||
if (options.browser) {
|
||||
args.push('--browser', options.browser);
|
||||
}
|
||||
|
||||
if (options.ciBuildId) {
|
||||
args.push('--ci-build-id', options.ciBuildId);
|
||||
}
|
||||
|
||||
if (options.config) {
|
||||
args.push('--config', options.config);
|
||||
}
|
||||
|
||||
if (options.configFile !== undefined) {
|
||||
args.push('--config-file', options.configFile);
|
||||
}
|
||||
|
||||
if (options.env) {
|
||||
args.push('--env', options.env);
|
||||
}
|
||||
|
||||
if (options.exit === false) {
|
||||
args.push('--no-exit');
|
||||
}
|
||||
|
||||
if (options.group) {
|
||||
args.push('--group', options.group);
|
||||
}
|
||||
|
||||
if (options.headed) {
|
||||
args.push('--headed', options.headed);
|
||||
}
|
||||
|
||||
if (options.headless) {
|
||||
if (options.headed) {
|
||||
return throwInvalidOptionError(errors.incompatibleHeadlessFlags);
|
||||
}
|
||||
|
||||
args.push('--headed', !options.headless);
|
||||
} // if key is set use that - else attempt to find it by environment variable
|
||||
|
||||
|
||||
if (options.key == null) {
|
||||
debug('--key is not set, looking up environment variable CYPRESS_RECORD_KEY');
|
||||
options.key = util.getEnv('CYPRESS_RECORD_KEY');
|
||||
} // if we have a key assume we're in record mode
|
||||
|
||||
|
||||
if (options.key) {
|
||||
args.push('--key', options.key);
|
||||
}
|
||||
|
||||
if (options.outputPath) {
|
||||
args.push('--output-path', options.outputPath);
|
||||
}
|
||||
|
||||
if (options.parallel) {
|
||||
args.push('--parallel');
|
||||
}
|
||||
|
||||
if (options.port) {
|
||||
args.push('--port', options.port);
|
||||
}
|
||||
|
||||
if (options.quiet) {
|
||||
args.push('--quiet');
|
||||
} // if record is defined and we're not
|
||||
// already in ci mode, then send it up
|
||||
|
||||
|
||||
if (options.record != null) {
|
||||
args.push('--record', options.record);
|
||||
} // if we have a specific reporter push that into the args
|
||||
|
||||
|
||||
if (options.reporter) {
|
||||
args.push('--reporter', options.reporter);
|
||||
} // if we have a specific reporter push that into the args
|
||||
|
||||
|
||||
if (options.reporterOptions) {
|
||||
args.push('--reporter-options', options.reporterOptions);
|
||||
} // if we have specific spec(s) push that into the args
|
||||
|
||||
|
||||
if (options.spec) {
|
||||
args.push('--spec', options.spec);
|
||||
}
|
||||
|
||||
if (options.tag) {
|
||||
args.push('--tag', options.tag);
|
||||
}
|
||||
|
||||
args.push(...processTestingType(options.testingType));
|
||||
return args;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
processRunOptions,
|
||||
isValidProject,
|
||||
|
||||
// resolves with the number of failed tests
|
||||
start(options = {}) {
|
||||
_.defaults(options, {
|
||||
key: null,
|
||||
spec: null,
|
||||
reporter: null,
|
||||
reporterOptions: null,
|
||||
project: process.cwd()
|
||||
});
|
||||
|
||||
function run() {
|
||||
let args;
|
||||
|
||||
try {
|
||||
args = processRunOptions(options);
|
||||
} catch (err) {
|
||||
if (err.details) {
|
||||
return exitWithError(err.details)();
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
debug('run to spawn.start args %j', args);
|
||||
return spawn.start(args, {
|
||||
dev: options.dev
|
||||
});
|
||||
}
|
||||
|
||||
if (options.dev) {
|
||||
return run();
|
||||
}
|
||||
|
||||
return verify.start().then(run);
|
||||
}
|
||||
|
||||
};
|
50
node_modules/cypress/lib/exec/shared.js
generated
vendored
Normal file
50
node_modules/cypress/lib/exec/shared.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
errors
|
||||
} = require('../errors');
|
||||
/**
|
||||
* Throws an error with "details" property from
|
||||
* "errors" object.
|
||||
* @param {Object} details - Error details
|
||||
*/
|
||||
|
||||
|
||||
const throwInvalidOptionError = details => {
|
||||
if (!details) {
|
||||
details = errors.unknownError;
|
||||
} // throw this error synchronously, it will be caught later on and
|
||||
// the details will be propagated to the promise chain
|
||||
|
||||
|
||||
const err = new Error();
|
||||
err.details = details;
|
||||
throw err;
|
||||
};
|
||||
/**
|
||||
* Selects exec args based on the configured `testingType`
|
||||
* @param {string} testingType The type of tests being executed
|
||||
* @returns {string[]} The array of new exec arguments
|
||||
*/
|
||||
|
||||
|
||||
const processTestingType = testingType => {
|
||||
if (testingType) {
|
||||
if (testingType === 'e2e') {
|
||||
return ['--testing-type', 'e2e'];
|
||||
}
|
||||
|
||||
if (testingType === 'component') {
|
||||
return ['--testing-type', 'component'];
|
||||
}
|
||||
|
||||
return throwInvalidOptionError(errors.invalidTestingType);
|
||||
}
|
||||
|
||||
return [];
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
throwInvalidOptionError,
|
||||
processTestingType
|
||||
};
|
299
node_modules/cypress/lib/exec/spawn.js
generated
vendored
Normal file
299
node_modules/cypress/lib/exec/spawn.js
generated
vendored
Normal file
@@ -0,0 +1,299 @@
|
||||
"use strict";
|
||||
|
||||
const _ = require('lodash');
|
||||
|
||||
const os = require('os');
|
||||
|
||||
const cp = require('child_process');
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const Promise = require('bluebird');
|
||||
|
||||
const debug = require('debug')('cypress:cli');
|
||||
|
||||
const debugElectron = require('debug')('cypress:electron');
|
||||
|
||||
const util = require('../util');
|
||||
|
||||
const state = require('../tasks/state');
|
||||
|
||||
const xvfb = require('./xvfb');
|
||||
|
||||
const verify = require('../tasks/verify');
|
||||
|
||||
const errors = require('../errors');
|
||||
|
||||
const isXlibOrLibudevRe = /^(?:Xlib|libudev)/;
|
||||
const isHighSierraWarningRe = /\*\*\* WARNING/;
|
||||
const isRenderWorkerRe = /\.RenderWorker-/;
|
||||
const GARBAGE_WARNINGS = [isXlibOrLibudevRe, isHighSierraWarningRe, isRenderWorkerRe];
|
||||
|
||||
const isGarbageLineWarning = str => {
|
||||
return _.some(GARBAGE_WARNINGS, re => {
|
||||
return re.test(str);
|
||||
});
|
||||
};
|
||||
|
||||
function isPlatform(platform) {
|
||||
return os.platform() === platform;
|
||||
}
|
||||
|
||||
function needsStderrPiped(needsXvfb) {
|
||||
return _.some([isPlatform('darwin'), needsXvfb && isPlatform('linux'), util.isPossibleLinuxWithIncorrectDisplay()]);
|
||||
}
|
||||
|
||||
function needsEverythingPipedDirectly() {
|
||||
return isPlatform('win32');
|
||||
}
|
||||
|
||||
function getStdio(needsXvfb) {
|
||||
if (needsEverythingPipedDirectly()) {
|
||||
return 'pipe';
|
||||
} // https://github.com/cypress-io/cypress/issues/921
|
||||
// https://github.com/cypress-io/cypress/issues/1143
|
||||
// https://github.com/cypress-io/cypress/issues/1745
|
||||
|
||||
|
||||
if (needsStderrPiped(needsXvfb)) {
|
||||
// returning pipe here so we can massage stderr
|
||||
// and remove garbage from Xlib and libuv
|
||||
// due to starting the Xvfb process on linux
|
||||
return ['inherit', 'inherit', 'pipe'];
|
||||
}
|
||||
|
||||
return 'inherit';
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isGarbageLineWarning,
|
||||
|
||||
start(args, options = {}) {
|
||||
const needsXvfb = xvfb.isNeeded();
|
||||
let executable = state.getPathToExecutable(state.getBinaryDir());
|
||||
|
||||
if (util.getEnv('CYPRESS_RUN_BINARY')) {
|
||||
executable = path.resolve(util.getEnv('CYPRESS_RUN_BINARY'));
|
||||
}
|
||||
|
||||
debug('needs to start own Xvfb?', needsXvfb); // Always push cwd into the args
|
||||
// which additionally acts as a signal to the
|
||||
// binary that it was invoked through the NPM module
|
||||
|
||||
args = args || [];
|
||||
|
||||
if (typeof args === 'string') {
|
||||
args = [args];
|
||||
}
|
||||
|
||||
args = [...args, '--cwd', process.cwd()];
|
||||
|
||||
_.defaults(options, {
|
||||
dev: false,
|
||||
env: process.env,
|
||||
detached: false,
|
||||
stdio: getStdio(needsXvfb)
|
||||
});
|
||||
|
||||
const spawn = (overrides = {}) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
_.defaults(overrides, {
|
||||
onStderrData: false,
|
||||
electronLogging: false
|
||||
});
|
||||
|
||||
const {
|
||||
onStderrData,
|
||||
electronLogging
|
||||
} = overrides;
|
||||
const envOverrides = util.getEnvOverrides(options);
|
||||
const electronArgs = [];
|
||||
const node11WindowsFix = isPlatform('win32');
|
||||
|
||||
if (options.dev) {
|
||||
// if we're in dev then reset
|
||||
// the launch cmd to be 'npm run dev'
|
||||
executable = 'node';
|
||||
electronArgs.unshift(path.resolve(__dirname, '..', '..', '..', 'scripts', 'start.js'));
|
||||
debug('in dev mode the args became %o', args);
|
||||
}
|
||||
|
||||
if (!options.dev && verify.needsSandbox()) {
|
||||
electronArgs.push('--no-sandbox');
|
||||
} // strip dev out of child process options
|
||||
|
||||
|
||||
let stdioOptions = _.pick(options, 'env', 'detached', 'stdio'); // figure out if we're going to be force enabling or disabling colors.
|
||||
// also figure out whether we should force stdout and stderr into thinking
|
||||
// it is a tty as opposed to a pipe.
|
||||
|
||||
|
||||
stdioOptions.env = _.extend({}, stdioOptions.env, envOverrides);
|
||||
|
||||
if (node11WindowsFix) {
|
||||
stdioOptions = _.extend({}, stdioOptions, {
|
||||
windowsHide: false
|
||||
});
|
||||
}
|
||||
|
||||
if (electronLogging) {
|
||||
stdioOptions.env.ELECTRON_ENABLE_LOGGING = true;
|
||||
}
|
||||
|
||||
if (util.isPossibleLinuxWithIncorrectDisplay()) {
|
||||
// make sure we use the latest DISPLAY variable if any
|
||||
debug('passing DISPLAY', process.env.DISPLAY);
|
||||
stdioOptions.env.DISPLAY = process.env.DISPLAY;
|
||||
}
|
||||
|
||||
if (stdioOptions.env.ELECTRON_RUN_AS_NODE) {
|
||||
// Since we are running electron as node, we need to add an entry point file.
|
||||
const serverEntryPoint = path.join(state.getBinaryPkgPath(path.dirname(executable)), '..', 'index.js');
|
||||
args = [serverEntryPoint, ...args];
|
||||
} else {
|
||||
// Start arguments with "--" so Electron knows these are OUR
|
||||
// arguments and does not try to sanitize them. Otherwise on Windows
|
||||
// an url in one of the arguments crashes it :(
|
||||
// https://github.com/cypress-io/cypress/issues/5466
|
||||
args = [...electronArgs, '--', ...args];
|
||||
}
|
||||
|
||||
debug('spawning Cypress with executable: %s', executable);
|
||||
debug('spawn args %o %o', args, _.omit(stdioOptions, 'env'));
|
||||
const child = cp.spawn(executable, args, stdioOptions);
|
||||
|
||||
function resolveOn(event) {
|
||||
return function (code, signal) {
|
||||
debug('child event fired %o', {
|
||||
event,
|
||||
code,
|
||||
signal
|
||||
});
|
||||
|
||||
if (code === null) {
|
||||
const errorObject = errors.errors.childProcessKilled(event, signal);
|
||||
return errors.getError(errorObject).then(reject);
|
||||
}
|
||||
|
||||
resolve(code);
|
||||
};
|
||||
}
|
||||
|
||||
child.on('close', resolveOn('close'));
|
||||
child.on('exit', resolveOn('exit'));
|
||||
child.on('error', reject); // if stdio options is set to 'pipe', then
|
||||
// we should set up pipes:
|
||||
// process STDIN (read stream) => child STDIN (writeable)
|
||||
// child STDOUT => process STDOUT
|
||||
// child STDERR => process STDERR with additional filtering
|
||||
|
||||
if (child.stdin) {
|
||||
debug('piping process STDIN into child STDIN');
|
||||
process.stdin.pipe(child.stdin);
|
||||
}
|
||||
|
||||
if (child.stdout) {
|
||||
debug('piping child STDOUT to process STDOUT');
|
||||
child.stdout.pipe(process.stdout);
|
||||
} // if this is defined then we are manually piping for linux
|
||||
// to filter out the garbage
|
||||
|
||||
|
||||
if (child.stderr) {
|
||||
debug('piping child STDERR to process STDERR');
|
||||
child.stderr.on('data', data => {
|
||||
const str = data.toString(); // bail if this is warning line garbage
|
||||
|
||||
if (isGarbageLineWarning(str)) {
|
||||
return;
|
||||
} // if we have a callback and this explictly returns
|
||||
// false then bail
|
||||
|
||||
|
||||
if (onStderrData && onStderrData(str) === false) {
|
||||
return;
|
||||
} // else pass it along!
|
||||
|
||||
|
||||
process.stderr.write(data);
|
||||
});
|
||||
} // https://github.com/cypress-io/cypress/issues/1841
|
||||
// https://github.com/cypress-io/cypress/issues/5241
|
||||
// In some versions of node, it will throw on windows
|
||||
// when you close the parent process after piping
|
||||
// into the child process. unpiping does not seem
|
||||
// to have any effect. so we're just catching the
|
||||
// error here and not doing anything.
|
||||
|
||||
|
||||
process.stdin.on('error', err => {
|
||||
if (['EPIPE', 'ENOTCONN'].includes(err.code)) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw err;
|
||||
});
|
||||
|
||||
if (stdioOptions.detached) {
|
||||
child.unref();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const spawnInXvfb = () => {
|
||||
return xvfb.start().then(userFriendlySpawn).finally(xvfb.stop);
|
||||
};
|
||||
|
||||
const userFriendlySpawn = linuxWithDisplayEnv => {
|
||||
debug('spawning, should retry on display problem?', Boolean(linuxWithDisplayEnv));
|
||||
let brokenGtkDisplay;
|
||||
const overrides = {};
|
||||
|
||||
if (linuxWithDisplayEnv) {
|
||||
_.extend(overrides, {
|
||||
electronLogging: true,
|
||||
|
||||
onStderrData(str) {
|
||||
// if we receive a broken pipe anywhere
|
||||
// then we know that's why cypress exited early
|
||||
if (util.isBrokenGtkDisplay(str)) {
|
||||
brokenGtkDisplay = true;
|
||||
} // we should attempt to always slurp up
|
||||
// the stderr logs unless we've explicitly
|
||||
// enabled the electron debug logging
|
||||
|
||||
|
||||
if (!debugElectron.enabled) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
return spawn(overrides).then(code => {
|
||||
if (code !== 0 && brokenGtkDisplay) {
|
||||
util.logBrokenGtkDisplayWarning();
|
||||
return spawnInXvfb();
|
||||
}
|
||||
|
||||
return code;
|
||||
}) // we can format and handle an error message from the code above
|
||||
// prevent wrapping error again by using "known: undefined" filter
|
||||
.catch({
|
||||
known: undefined
|
||||
}, errors.throwFormErrorText(errors.errors.unexpected));
|
||||
};
|
||||
|
||||
if (needsXvfb) {
|
||||
return spawnInXvfb();
|
||||
} // if we are on linux and there's already a DISPLAY
|
||||
// set, then we may need to rerun cypress after
|
||||
// spawning our own Xvfb server
|
||||
|
||||
|
||||
const linuxWithDisplayEnv = util.isPossibleLinuxWithIncorrectDisplay();
|
||||
return userFriendlySpawn(linuxWithDisplayEnv);
|
||||
}
|
||||
|
||||
};
|
59
node_modules/cypress/lib/exec/versions.js
generated
vendored
Normal file
59
node_modules/cypress/lib/exec/versions.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
|
||||
const Promise = require('bluebird');
|
||||
|
||||
const debug = require('debug')('cypress:cli');
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const util = require('../util');
|
||||
|
||||
const state = require('../tasks/state');
|
||||
|
||||
const {
|
||||
throwFormErrorText,
|
||||
errors
|
||||
} = require('../errors');
|
||||
|
||||
const getVersions = () => {
|
||||
return Promise.try(() => {
|
||||
if (util.getEnv('CYPRESS_RUN_BINARY')) {
|
||||
let envBinaryPath = path.resolve(util.getEnv('CYPRESS_RUN_BINARY'));
|
||||
return state.parseRealPlatformBinaryFolderAsync(envBinaryPath).then(envBinaryDir => {
|
||||
if (!envBinaryDir) {
|
||||
return throwFormErrorText(errors.CYPRESS_RUN_BINARY.notValid(envBinaryPath))();
|
||||
}
|
||||
|
||||
debug('CYPRESS_RUN_BINARY has binaryDir:', envBinaryDir);
|
||||
return envBinaryDir;
|
||||
}).catch({
|
||||
code: 'ENOENT'
|
||||
}, err => {
|
||||
return throwFormErrorText(errors.CYPRESS_RUN_BINARY.notValid(envBinaryPath))(err.message);
|
||||
});
|
||||
}
|
||||
|
||||
return state.getBinaryDir();
|
||||
}).then(state.getBinaryPkgAsync).then(pkg => {
|
||||
const versions = {
|
||||
binary: state.getBinaryPkgVersion(pkg),
|
||||
electronVersion: state.getBinaryElectronVersion(pkg),
|
||||
electronNodeVersion: state.getBinaryElectronNodeVersion(pkg)
|
||||
};
|
||||
debug('binary versions %o', versions);
|
||||
return versions;
|
||||
}).then(binaryVersions => {
|
||||
const versions = {
|
||||
package: util.pkgVersion(),
|
||||
binary: binaryVersions.binary || 'not installed',
|
||||
electronVersion: binaryVersions.electronVersion || 'not found',
|
||||
electronNodeVersion: binaryVersions.electronNodeVersion || 'not found'
|
||||
};
|
||||
debug('combined versions %o', versions);
|
||||
return versions;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getVersions
|
||||
};
|
106
node_modules/cypress/lib/exec/xvfb.js
generated
vendored
Normal file
106
node_modules/cypress/lib/exec/xvfb.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
"use strict";
|
||||
|
||||
const os = require('os');
|
||||
|
||||
const Promise = require('bluebird');
|
||||
|
||||
const Xvfb = require('@cypress/xvfb');
|
||||
|
||||
const {
|
||||
stripIndent
|
||||
} = require('common-tags');
|
||||
|
||||
const Debug = require('debug');
|
||||
|
||||
const {
|
||||
throwFormErrorText,
|
||||
errors
|
||||
} = require('../errors');
|
||||
|
||||
const util = require('../util');
|
||||
|
||||
const debug = Debug('cypress:cli');
|
||||
const debugXvfb = Debug('cypress:xvfb');
|
||||
debug.Debug = debugXvfb.Debug = Debug;
|
||||
const xvfbOptions = {
|
||||
timeout: 30000,
|
||||
// milliseconds
|
||||
// need to explicitly define screen otherwise electron will crash
|
||||
// https://github.com/cypress-io/cypress/issues/6184
|
||||
xvfb_args: ['-screen', '0', '1280x1024x24'],
|
||||
|
||||
onStderrData(data) {
|
||||
if (debugXvfb.enabled) {
|
||||
debugXvfb(data.toString());
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
const xvfb = Promise.promisifyAll(new Xvfb(xvfbOptions));
|
||||
module.exports = {
|
||||
_debugXvfb: debugXvfb,
|
||||
// expose for testing
|
||||
_xvfb: xvfb,
|
||||
// expose for testing
|
||||
_xvfbOptions: xvfbOptions,
|
||||
|
||||
// expose for testing
|
||||
start() {
|
||||
debug('Starting Xvfb');
|
||||
return xvfb.startAsync().return(null).catch({
|
||||
nonZeroExitCode: true
|
||||
}, throwFormErrorText(errors.nonZeroExitCodeXvfb)).catch(err => {
|
||||
if (err.known) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
return throwFormErrorText(errors.missingXvfb)(err);
|
||||
});
|
||||
},
|
||||
|
||||
stop() {
|
||||
debug('Stopping Xvfb');
|
||||
return xvfb.stopAsync().return(null).catch(() => {// noop
|
||||
});
|
||||
},
|
||||
|
||||
isNeeded() {
|
||||
if (process.env.ELECTRON_RUN_AS_NODE) {
|
||||
debug('Environment variable ELECTRON_RUN_AS_NODE detected, xvfb is not needed');
|
||||
return false; // xvfb required for electron processes only.
|
||||
}
|
||||
|
||||
if (os.platform() !== 'linux') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (process.env.DISPLAY) {
|
||||
const issueUrl = util.getGitHubIssueUrl(4034);
|
||||
const message = stripIndent`
|
||||
DISPLAY environment variable is set to ${process.env.DISPLAY} on Linux
|
||||
Assuming this DISPLAY points at working X11 server,
|
||||
Cypress will not spawn own Xvfb
|
||||
|
||||
NOTE: if the X11 server is NOT working, Cypress will exit without explanation,
|
||||
see ${issueUrl}
|
||||
Solution: Unset the DISPLAY variable and try again:
|
||||
DISPLAY= npx cypress run ...
|
||||
`;
|
||||
debug(message);
|
||||
return false;
|
||||
}
|
||||
|
||||
debug('undefined DISPLAY environment variable');
|
||||
debug('Cypress will spawn its own Xvfb');
|
||||
return true;
|
||||
},
|
||||
|
||||
// async method, resolved with Boolean
|
||||
verify() {
|
||||
return xvfb.startAsync().return(true).catch(err => {
|
||||
debug('Could not verify xvfb: %s', err.message);
|
||||
return false;
|
||||
}).finally(xvfb.stopAsync);
|
||||
}
|
||||
|
||||
};
|
5
node_modules/cypress/lib/fs.js
generated
vendored
Normal file
5
node_modules/cypress/lib/fs.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const Promise = require('bluebird');
|
||||
|
||||
module.exports = Promise.promisifyAll(require('fs-extra'));
|
59
node_modules/cypress/lib/logger.js
generated
vendored
Normal file
59
node_modules/cypress/lib/logger.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
|
||||
const R = require('ramda');
|
||||
|
||||
const chalk = require('chalk');
|
||||
|
||||
let logs = [];
|
||||
|
||||
const logLevel = () => {
|
||||
return process.env.npm_config_loglevel || 'notice';
|
||||
};
|
||||
|
||||
const error = (...messages) => {
|
||||
logs.push(messages.join(' '));
|
||||
console.log(chalk.red(...messages)); // eslint-disable-line no-console
|
||||
};
|
||||
|
||||
const warn = (...messages) => {
|
||||
if (logLevel() === 'silent') return;
|
||||
logs.push(messages.join(' '));
|
||||
console.log(chalk.yellow(...messages)); // eslint-disable-line no-console
|
||||
};
|
||||
|
||||
const log = (...messages) => {
|
||||
if (logLevel() === 'silent' || logLevel() === 'warn') return;
|
||||
logs.push(messages.join(' '));
|
||||
console.log(...messages); // eslint-disable-line no-console
|
||||
};
|
||||
|
||||
const always = (...messages) => {
|
||||
logs.push(messages.join(' '));
|
||||
console.log(...messages); // eslint-disable-line no-console
|
||||
}; // splits long text into lines and calls log()
|
||||
// on each one to allow easy unit testing for specific message
|
||||
|
||||
|
||||
const logLines = text => {
|
||||
const lines = text.split('\n');
|
||||
R.forEach(log, lines);
|
||||
};
|
||||
|
||||
const print = () => {
|
||||
return logs.join('\n');
|
||||
};
|
||||
|
||||
const reset = () => {
|
||||
logs = [];
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
log,
|
||||
warn,
|
||||
error,
|
||||
always,
|
||||
logLines,
|
||||
print,
|
||||
reset,
|
||||
logLevel
|
||||
};
|
156
node_modules/cypress/lib/tasks/cache.js
generated
vendored
Normal file
156
node_modules/cypress/lib/tasks/cache.js
generated
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
"use strict";
|
||||
|
||||
const state = require('./state');
|
||||
|
||||
const logger = require('../logger');
|
||||
|
||||
const fs = require('../fs');
|
||||
|
||||
const util = require('../util');
|
||||
|
||||
const {
|
||||
join
|
||||
} = require('path');
|
||||
|
||||
const Table = require('cli-table3');
|
||||
|
||||
const dayjs = require('dayjs');
|
||||
|
||||
const relativeTime = require('dayjs/plugin/relativeTime');
|
||||
|
||||
const chalk = require('chalk');
|
||||
|
||||
const _ = require('lodash');
|
||||
|
||||
const getFolderSize = require('./get-folder-size');
|
||||
|
||||
const Bluebird = require('bluebird');
|
||||
|
||||
dayjs.extend(relativeTime); // output colors for the table
|
||||
|
||||
const colors = {
|
||||
titles: chalk.white,
|
||||
dates: chalk.cyan,
|
||||
values: chalk.green,
|
||||
size: chalk.gray
|
||||
};
|
||||
|
||||
const logCachePath = () => {
|
||||
logger.always(state.getCacheDir());
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const clear = () => {
|
||||
return fs.removeAsync(state.getCacheDir());
|
||||
};
|
||||
|
||||
const prune = () => {
|
||||
const cacheDir = state.getCacheDir();
|
||||
const currentVersion = util.pkgVersion();
|
||||
let deletedBinary = false;
|
||||
return fs.readdirAsync(cacheDir).then(versions => {
|
||||
return Bluebird.all(versions.map(version => {
|
||||
if (version !== currentVersion) {
|
||||
deletedBinary = true;
|
||||
const versionDir = join(cacheDir, version);
|
||||
return fs.removeAsync(versionDir);
|
||||
}
|
||||
}));
|
||||
}).then(() => {
|
||||
if (deletedBinary) {
|
||||
logger.always(`Deleted all binary caches except for the ${currentVersion} binary cache.`);
|
||||
} else {
|
||||
logger.always(`No binary caches found to prune.`);
|
||||
}
|
||||
}).catch({
|
||||
code: 'ENOENT'
|
||||
}, () => {
|
||||
logger.always(`No Cypress cache was found at ${cacheDir}. Nothing to prune.`);
|
||||
});
|
||||
};
|
||||
|
||||
const fileSizeInMB = size => {
|
||||
return `${(size / 1024 / 1024).toFixed(1)}MB`;
|
||||
};
|
||||
/**
|
||||
* Collects all cached versions, finds when each was used
|
||||
* and prints a table with results to the terminal
|
||||
*/
|
||||
|
||||
|
||||
const list = showSize => {
|
||||
return getCachedVersions(showSize).then(binaries => {
|
||||
const head = [colors.titles('version'), colors.titles('last used')];
|
||||
|
||||
if (showSize) {
|
||||
head.push(colors.titles('size'));
|
||||
}
|
||||
|
||||
const table = new Table({
|
||||
head
|
||||
});
|
||||
binaries.forEach(binary => {
|
||||
const versionString = colors.values(binary.version);
|
||||
const lastUsed = binary.accessed ? colors.dates(binary.accessed) : 'unknown';
|
||||
const row = [versionString, lastUsed];
|
||||
|
||||
if (showSize) {
|
||||
const size = colors.size(fileSizeInMB(binary.size));
|
||||
row.push(size);
|
||||
}
|
||||
|
||||
return table.push(row);
|
||||
});
|
||||
logger.always(table.toString());
|
||||
});
|
||||
};
|
||||
|
||||
const getCachedVersions = showSize => {
|
||||
const cacheDir = state.getCacheDir();
|
||||
return fs.readdirAsync(cacheDir).filter(util.isSemver).map(version => {
|
||||
return {
|
||||
version,
|
||||
folderPath: join(cacheDir, version)
|
||||
};
|
||||
}).mapSeries(binary => {
|
||||
// last access time on the folder is different from last access time
|
||||
// on the Cypress binary
|
||||
const binaryDir = state.getBinaryDir(binary.version);
|
||||
const executable = state.getPathToExecutable(binaryDir);
|
||||
return fs.statAsync(executable).then(stat => {
|
||||
const lastAccessedTime = _.get(stat, 'atime');
|
||||
|
||||
if (!lastAccessedTime) {
|
||||
// the test runner has never been opened
|
||||
// or could be a test simulating missing timestamp
|
||||
return binary;
|
||||
}
|
||||
|
||||
const accessed = dayjs(lastAccessedTime).fromNow();
|
||||
binary.accessed = accessed;
|
||||
return binary;
|
||||
}, e => {
|
||||
// could not find the binary or gets its stats
|
||||
return binary;
|
||||
});
|
||||
}).mapSeries(binary => {
|
||||
if (showSize) {
|
||||
const binaryDir = state.getBinaryDir(binary.version);
|
||||
return getFolderSize(binaryDir).then(size => {
|
||||
return { ...binary,
|
||||
size
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
return binary;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
path: logCachePath,
|
||||
clear,
|
||||
prune,
|
||||
list,
|
||||
getCachedVersions
|
||||
};
|
343
node_modules/cypress/lib/tasks/download.js
generated
vendored
Normal file
343
node_modules/cypress/lib/tasks/download.js
generated
vendored
Normal file
@@ -0,0 +1,343 @@
|
||||
"use strict";
|
||||
|
||||
const arch = require('arch');
|
||||
|
||||
const la = require('lazy-ass');
|
||||
|
||||
const is = require('check-more-types');
|
||||
|
||||
const os = require('os');
|
||||
|
||||
const url = require('url');
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const debug = require('debug')('cypress:cli');
|
||||
|
||||
const request = require('@cypress/request');
|
||||
|
||||
const Promise = require('bluebird');
|
||||
|
||||
const requestProgress = require('request-progress');
|
||||
|
||||
const {
|
||||
stripIndent
|
||||
} = require('common-tags');
|
||||
|
||||
const {
|
||||
throwFormErrorText,
|
||||
errors
|
||||
} = require('../errors');
|
||||
|
||||
const fs = require('../fs');
|
||||
|
||||
const util = require('../util');
|
||||
|
||||
const defaultBaseUrl = 'https://download.cypress.io/';
|
||||
|
||||
const getProxyUrl = () => {
|
||||
return process.env.HTTPS_PROXY || process.env.https_proxy || process.env.npm_config_https_proxy || process.env.HTTP_PROXY || process.env.http_proxy || process.env.npm_config_proxy || null;
|
||||
};
|
||||
|
||||
const getRealOsArch = () => {
|
||||
// os.arch() returns the arch for which this node was compiled
|
||||
// we want the operating system's arch instead: x64 or x86
|
||||
const osArch = arch();
|
||||
|
||||
if (osArch === 'x86') {
|
||||
// match process.platform output
|
||||
return 'ia32';
|
||||
}
|
||||
|
||||
return osArch;
|
||||
};
|
||||
|
||||
const getBaseUrl = () => {
|
||||
if (util.getEnv('CYPRESS_DOWNLOAD_MIRROR')) {
|
||||
let baseUrl = util.getEnv('CYPRESS_DOWNLOAD_MIRROR');
|
||||
|
||||
if (!baseUrl.endsWith('/')) {
|
||||
baseUrl += '/';
|
||||
}
|
||||
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
return defaultBaseUrl;
|
||||
};
|
||||
|
||||
const getCA = () => {
|
||||
return new Promise(resolve => {
|
||||
if (!util.getEnv('CYPRESS_DOWNLOAD_USE_CA')) {
|
||||
resolve();
|
||||
}
|
||||
|
||||
if (process.env.npm_config_ca) {
|
||||
resolve(process.env.npm_config_ca);
|
||||
} else if (process.env.npm_config_cafile) {
|
||||
fs.readFile(process.env.npm_config_cafile, 'utf8').then(cafileContent => {
|
||||
resolve(cafileContent);
|
||||
}).catch(() => {
|
||||
resolve();
|
||||
});
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const prepend = urlPath => {
|
||||
const endpoint = url.resolve(getBaseUrl(), urlPath);
|
||||
const platform = os.platform();
|
||||
const arch = getRealOsArch();
|
||||
return `${endpoint}?platform=${platform}&arch=${arch}`;
|
||||
};
|
||||
|
||||
const getUrl = version => {
|
||||
if (is.url(version)) {
|
||||
debug('version is already an url', version);
|
||||
return version;
|
||||
}
|
||||
|
||||
return version ? prepend(`desktop/${version}`) : prepend('desktop');
|
||||
};
|
||||
|
||||
const statusMessage = err => {
|
||||
return err.statusCode ? [err.statusCode, err.statusMessage].join(' - ') : err.toString();
|
||||
};
|
||||
|
||||
const prettyDownloadErr = (err, version) => {
|
||||
const msg = stripIndent`
|
||||
URL: ${getUrl(version)}
|
||||
${statusMessage(err)}
|
||||
`;
|
||||
debug(msg);
|
||||
return throwFormErrorText(errors.failedDownload)(msg);
|
||||
};
|
||||
/**
|
||||
* Checks checksum and file size for the given file. Allows both
|
||||
* values or just one of them to be checked.
|
||||
*/
|
||||
|
||||
|
||||
const verifyDownloadedFile = (filename, expectedSize, expectedChecksum) => {
|
||||
if (expectedSize && expectedChecksum) {
|
||||
debug('verifying checksum and file size');
|
||||
return Promise.join(util.getFileChecksum(filename), util.getFileSize(filename), (checksum, filesize) => {
|
||||
if (checksum === expectedChecksum && filesize === expectedSize) {
|
||||
debug('downloaded file has the expected checksum and size ✅');
|
||||
return;
|
||||
}
|
||||
|
||||
debug('raising error: checksum or file size mismatch');
|
||||
const text = stripIndent`
|
||||
Corrupted download
|
||||
|
||||
Expected downloaded file to have checksum: ${expectedChecksum}
|
||||
Computed checksum: ${checksum}
|
||||
|
||||
Expected downloaded file to have size: ${expectedSize}
|
||||
Computed size: ${filesize}
|
||||
`;
|
||||
debug(text);
|
||||
throw new Error(text);
|
||||
});
|
||||
}
|
||||
|
||||
if (expectedChecksum) {
|
||||
debug('only checking expected file checksum %d', expectedChecksum);
|
||||
return util.getFileChecksum(filename).then(checksum => {
|
||||
if (checksum === expectedChecksum) {
|
||||
debug('downloaded file has the expected checksum ✅');
|
||||
return;
|
||||
}
|
||||
|
||||
debug('raising error: file checksum mismatch');
|
||||
const text = stripIndent`
|
||||
Corrupted download
|
||||
|
||||
Expected downloaded file to have checksum: ${expectedChecksum}
|
||||
Computed checksum: ${checksum}
|
||||
`;
|
||||
throw new Error(text);
|
||||
});
|
||||
}
|
||||
|
||||
if (expectedSize) {
|
||||
// maybe we don't have a checksum, but at least CDN returns content length
|
||||
// which we can check against the file size
|
||||
debug('only checking expected file size %d', expectedSize);
|
||||
return util.getFileSize(filename).then(filesize => {
|
||||
if (filesize === expectedSize) {
|
||||
debug('downloaded file has the expected size ✅');
|
||||
return;
|
||||
}
|
||||
|
||||
debug('raising error: file size mismatch');
|
||||
const text = stripIndent`
|
||||
Corrupted download
|
||||
|
||||
Expected downloaded file to have size: ${expectedSize}
|
||||
Computed size: ${filesize}
|
||||
`;
|
||||
throw new Error(text);
|
||||
});
|
||||
}
|
||||
|
||||
debug('downloaded file lacks checksum or size to verify');
|
||||
return Promise.resolve();
|
||||
}; // downloads from given url
|
||||
// return an object with
|
||||
// {filename: ..., downloaded: true}
|
||||
|
||||
|
||||
const downloadFromUrl = ({
|
||||
url,
|
||||
downloadDestination,
|
||||
progress,
|
||||
ca
|
||||
}) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const proxy = getProxyUrl();
|
||||
debug('Downloading package', {
|
||||
url,
|
||||
proxy,
|
||||
downloadDestination
|
||||
});
|
||||
let redirectVersion;
|
||||
const reqOptions = {
|
||||
url,
|
||||
proxy,
|
||||
|
||||
followRedirect(response) {
|
||||
const version = response.headers['x-version'];
|
||||
debug('redirect version:', version);
|
||||
|
||||
if (version) {
|
||||
// set the version in options if we have one.
|
||||
// this insulates us from potential redirect
|
||||
// problems where version would be set to undefined.
|
||||
redirectVersion = version;
|
||||
} // yes redirect
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
if (ca) {
|
||||
debug('using custom CA details from npm config');
|
||||
reqOptions.agentOptions = {
|
||||
ca
|
||||
};
|
||||
}
|
||||
|
||||
const req = request(reqOptions); // closure
|
||||
|
||||
let started = null;
|
||||
let expectedSize;
|
||||
let expectedChecksum;
|
||||
requestProgress(req, {
|
||||
throttle: progress.throttle
|
||||
}).on('response', response => {
|
||||
// we have computed checksum and filesize during test runner binary build
|
||||
// and have set it on the S3 object as user meta data, available via
|
||||
// these custom headers "x-amz-meta-..."
|
||||
// see https://github.com/cypress-io/cypress/pull/4092
|
||||
expectedSize = response.headers['x-amz-meta-size'] || response.headers['content-length'];
|
||||
expectedChecksum = response.headers['x-amz-meta-checksum'];
|
||||
|
||||
if (expectedChecksum) {
|
||||
debug('expected checksum %s', expectedChecksum);
|
||||
}
|
||||
|
||||
if (expectedSize) {
|
||||
// convert from string (all Amazon custom headers are strings)
|
||||
expectedSize = Number(expectedSize);
|
||||
debug('expected file size %d', expectedSize);
|
||||
} // start counting now once we've gotten
|
||||
// response headers
|
||||
|
||||
|
||||
started = new Date(); // if our status code does not start with 200
|
||||
|
||||
if (!/^2/.test(response.statusCode)) {
|
||||
debug('response code %d', response.statusCode);
|
||||
const err = new Error(stripIndent`
|
||||
Failed downloading the Cypress binary.
|
||||
Response code: ${response.statusCode}
|
||||
Response message: ${response.statusMessage}
|
||||
`);
|
||||
reject(err);
|
||||
}
|
||||
}).on('error', reject).on('progress', state => {
|
||||
// total time we've elapsed
|
||||
// starting on our first progress notification
|
||||
const elapsed = new Date() - started; // request-progress sends a value between 0 and 1
|
||||
|
||||
const percentage = util.convertPercentToPercentage(state.percent);
|
||||
const eta = util.calculateEta(percentage, elapsed); // send up our percent and seconds remaining
|
||||
|
||||
progress.onProgress(percentage, util.secsRemaining(eta));
|
||||
}) // save this download here
|
||||
.pipe(fs.createWriteStream(downloadDestination)).on('finish', () => {
|
||||
debug('downloading finished');
|
||||
verifyDownloadedFile(downloadDestination, expectedSize, expectedChecksum).then(() => {
|
||||
return resolve(redirectVersion);
|
||||
}, reject);
|
||||
});
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Download Cypress.zip from external url to local file.
|
||||
* @param [string] version Could be "3.3.0" or full URL
|
||||
* @param [string] downloadDestination Local filename to save as
|
||||
*/
|
||||
|
||||
|
||||
const start = opts => {
|
||||
let {
|
||||
version,
|
||||
downloadDestination,
|
||||
progress
|
||||
} = opts;
|
||||
|
||||
if (!downloadDestination) {
|
||||
la(is.unemptyString(downloadDestination), 'missing download dir', opts);
|
||||
}
|
||||
|
||||
if (!progress) {
|
||||
progress = {
|
||||
onProgress: () => {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const url = getUrl(version);
|
||||
progress.throttle = 100;
|
||||
debug('needed Cypress version: %s', version);
|
||||
debug('source url %s', url);
|
||||
debug(`downloading cypress.zip to "${downloadDestination}"`); // ensure download dir exists
|
||||
|
||||
return fs.ensureDirAsync(path.dirname(downloadDestination)).then(() => {
|
||||
return getCA();
|
||||
}).then(ca => {
|
||||
return downloadFromUrl({
|
||||
url,
|
||||
downloadDestination,
|
||||
progress,
|
||||
ca
|
||||
});
|
||||
}).catch(err => {
|
||||
return prettyDownloadErr(err, version);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
start,
|
||||
getUrl,
|
||||
getProxyUrl,
|
||||
getCA
|
||||
};
|
41
node_modules/cypress/lib/tasks/get-folder-size.js
generated
vendored
Normal file
41
node_modules/cypress/lib/tasks/get-folder-size.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
const fs = require('../fs');
|
||||
|
||||
const {
|
||||
join
|
||||
} = require('path');
|
||||
|
||||
const Bluebird = require('bluebird');
|
||||
/**
|
||||
* Get the size of a folder or a file.
|
||||
*
|
||||
* This function returns the actual file size of the folder (size), not the allocated space on disk (size on disk).
|
||||
* For more details between the difference, check this link:
|
||||
* https://www.howtogeek.com/180369/why-is-there-a-big-difference-between-size-and-size-on-disk/
|
||||
*
|
||||
* @param {string} path path to the file or the folder.
|
||||
*/
|
||||
|
||||
|
||||
async function getSize(path) {
|
||||
const stat = await fs.lstat(path);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
const list = await fs.readdir(path);
|
||||
return Bluebird.resolve(list).reduce(async (prev, curr) => {
|
||||
const currPath = join(path, curr);
|
||||
const s = await fs.lstat(currPath);
|
||||
|
||||
if (s.isDirectory()) {
|
||||
return prev + (await getSize(currPath));
|
||||
}
|
||||
|
||||
return prev + s.size;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
return stat.size;
|
||||
}
|
||||
|
||||
module.exports = getSize;
|
449
node_modules/cypress/lib/tasks/install.js
generated
vendored
Normal file
449
node_modules/cypress/lib/tasks/install.js
generated
vendored
Normal file
@@ -0,0 +1,449 @@
|
||||
"use strict";
|
||||
|
||||
const _ = require('lodash');
|
||||
|
||||
const os = require('os');
|
||||
|
||||
const url = require('url');
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const chalk = require('chalk');
|
||||
|
||||
const debug = require('debug')('cypress:cli');
|
||||
|
||||
const {
|
||||
Listr
|
||||
} = require('listr2');
|
||||
|
||||
const Promise = require('bluebird');
|
||||
|
||||
const logSymbols = require('log-symbols');
|
||||
|
||||
const {
|
||||
stripIndent
|
||||
} = require('common-tags');
|
||||
|
||||
const fs = require('../fs');
|
||||
|
||||
const download = require('./download');
|
||||
|
||||
const util = require('../util');
|
||||
|
||||
const state = require('./state');
|
||||
|
||||
const unzip = require('./unzip');
|
||||
|
||||
const logger = require('../logger');
|
||||
|
||||
const {
|
||||
throwFormErrorText,
|
||||
errors
|
||||
} = require('../errors');
|
||||
|
||||
const verbose = require('../VerboseRenderer');
|
||||
|
||||
const getNpmArgv = () => {
|
||||
const json = process.env.npm_config_argv;
|
||||
|
||||
if (!json) {
|
||||
return;
|
||||
}
|
||||
|
||||
debug('found npm argv json %o', json);
|
||||
|
||||
try {
|
||||
return JSON.parse(json).original || [];
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
}; // attempt to discover the version specifier used to install Cypress
|
||||
// for example: "^5.0.0", "https://cdn.cypress.io/...", ...
|
||||
|
||||
|
||||
const getVersionSpecifier = (startDir = path.resolve(__dirname, '../..')) => {
|
||||
const argv = getNpmArgv();
|
||||
|
||||
if (argv) {
|
||||
const tgz = _.find(argv, t => t.endsWith('cypress.tgz'));
|
||||
|
||||
if (tgz) {
|
||||
return tgz;
|
||||
}
|
||||
}
|
||||
|
||||
const getVersionSpecifierFromPkg = dir => {
|
||||
debug('looking for versionSpecifier %o', {
|
||||
dir
|
||||
});
|
||||
|
||||
const tryParent = () => {
|
||||
const parentPath = path.resolve(dir, '..');
|
||||
|
||||
if (parentPath === dir) {
|
||||
debug('reached FS root with no versionSpecifier found');
|
||||
return;
|
||||
}
|
||||
|
||||
return getVersionSpecifierFromPkg(parentPath);
|
||||
};
|
||||
|
||||
return fs.readJSON(path.join(dir, 'package.json')).catch(() => ({})).then(pkg => {
|
||||
const specifier = _.chain(['dependencies', 'devDependencies', 'optionalDependencies']).map(prop => _.get(pkg, `${prop}.cypress`)).compact().first().value();
|
||||
|
||||
return specifier || tryParent();
|
||||
});
|
||||
}; // recurse through parent directories until package.json with `cypress` is found
|
||||
|
||||
|
||||
return getVersionSpecifierFromPkg(startDir).then(versionSpecifier => {
|
||||
debug('finished looking for versionSpecifier', {
|
||||
versionSpecifier
|
||||
});
|
||||
return versionSpecifier;
|
||||
});
|
||||
};
|
||||
|
||||
const betaNpmUrlRe = /^\/beta\/npm\/(?<version>[0-9.]+)\/(?<artifactSlug>[^/]+)\/cypress\.tgz$/; // convert a prerelease NPM package .tgz URL to the corresponding binary .zip URL
|
||||
|
||||
const getBinaryUrlFromPrereleaseNpmUrl = npmUrl => {
|
||||
let parsed;
|
||||
|
||||
try {
|
||||
parsed = url.parse(npmUrl);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
const matches = betaNpmUrlRe.exec(parsed.pathname);
|
||||
|
||||
if (parsed.hostname !== 'cdn.cypress.io' || !matches) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
version,
|
||||
artifactSlug
|
||||
} = matches.groups;
|
||||
parsed.pathname = `/beta/binary/${version}/${os.platform()}-${os.arch()}/${artifactSlug}/cypress.zip`;
|
||||
return parsed.format();
|
||||
};
|
||||
|
||||
const alreadyInstalledMsg = () => {
|
||||
if (!util.isPostInstall()) {
|
||||
logger.log(stripIndent`
|
||||
Skipping installation:
|
||||
|
||||
Pass the ${chalk.yellow('--force')} option if you'd like to reinstall anyway.
|
||||
`);
|
||||
}
|
||||
};
|
||||
|
||||
const displayCompletionMsg = () => {
|
||||
// check here to see if we are globally installed
|
||||
if (util.isInstalledGlobally()) {
|
||||
// if we are display a warning
|
||||
logger.log();
|
||||
logger.warn(stripIndent`
|
||||
${logSymbols.warning} Warning: It looks like you\'ve installed Cypress globally.
|
||||
|
||||
This will work, but it'\s not recommended.
|
||||
|
||||
The recommended way to install Cypress is as a devDependency per project.
|
||||
|
||||
You should probably run these commands:
|
||||
|
||||
- ${chalk.cyan('npm uninstall -g cypress')}
|
||||
- ${chalk.cyan('npm install --save-dev cypress')}
|
||||
`);
|
||||
return;
|
||||
}
|
||||
|
||||
logger.log();
|
||||
logger.log('You can now open Cypress by running:', chalk.cyan(path.join('node_modules', '.bin', 'cypress'), 'open'));
|
||||
logger.log();
|
||||
logger.log(chalk.grey('https://on.cypress.io/installing-cypress'));
|
||||
logger.log();
|
||||
};
|
||||
|
||||
const downloadAndUnzip = ({
|
||||
version,
|
||||
installDir,
|
||||
downloadDir
|
||||
}) => {
|
||||
const progress = {
|
||||
throttle: 100,
|
||||
onProgress: null
|
||||
};
|
||||
const downloadDestination = path.join(downloadDir, `cypress-${process.pid}.zip`);
|
||||
const rendererOptions = getRendererOptions(); // let the user know what version of cypress we're downloading!
|
||||
|
||||
logger.log(`Installing Cypress ${chalk.gray(`(version: ${version})`)}`);
|
||||
logger.log();
|
||||
const tasks = new Listr([{
|
||||
options: {
|
||||
title: util.titleize('Downloading Cypress')
|
||||
},
|
||||
task: (ctx, task) => {
|
||||
// as our download progresses indicate the status
|
||||
progress.onProgress = progessify(task, 'Downloading Cypress');
|
||||
return download.start({
|
||||
version,
|
||||
downloadDestination,
|
||||
progress
|
||||
}).then(redirectVersion => {
|
||||
if (redirectVersion) version = redirectVersion;
|
||||
debug(`finished downloading file: ${downloadDestination}`);
|
||||
}).then(() => {
|
||||
// save the download destination for unzipping
|
||||
util.setTaskTitle(task, util.titleize(chalk.green('Downloaded Cypress')), rendererOptions.renderer);
|
||||
});
|
||||
}
|
||||
}, unzipTask({
|
||||
progress,
|
||||
zipFilePath: downloadDestination,
|
||||
installDir,
|
||||
rendererOptions
|
||||
}), {
|
||||
options: {
|
||||
title: util.titleize('Finishing Installation')
|
||||
},
|
||||
task: (ctx, task) => {
|
||||
const cleanup = () => {
|
||||
debug('removing zip file %s', downloadDestination);
|
||||
return fs.removeAsync(downloadDestination);
|
||||
};
|
||||
|
||||
return cleanup().then(() => {
|
||||
debug('finished installation in', installDir);
|
||||
util.setTaskTitle(task, util.titleize(chalk.green('Finished Installation'), chalk.gray(installDir)), rendererOptions.renderer);
|
||||
});
|
||||
}
|
||||
}], {
|
||||
rendererOptions
|
||||
}); // start the tasks!
|
||||
|
||||
return Promise.resolve(tasks.run());
|
||||
};
|
||||
|
||||
const start = (options = {}) => {
|
||||
debug('installing with options %j', options);
|
||||
|
||||
_.defaults(options, {
|
||||
force: false
|
||||
});
|
||||
|
||||
const pkgVersion = util.pkgVersion();
|
||||
let needVersion = pkgVersion;
|
||||
let binaryUrlOverride;
|
||||
debug('version in package.json is', needVersion); // let this environment variable reset the binary version we need
|
||||
|
||||
if (util.getEnv('CYPRESS_INSTALL_BINARY')) {
|
||||
// because passed file paths are often double quoted
|
||||
// and might have extra whitespace around, be robust and trim the string
|
||||
const trimAndRemoveDoubleQuotes = true;
|
||||
const envVarVersion = util.getEnv('CYPRESS_INSTALL_BINARY', trimAndRemoveDoubleQuotes);
|
||||
debug('using environment variable CYPRESS_INSTALL_BINARY "%s"', envVarVersion);
|
||||
|
||||
if (envVarVersion === '0') {
|
||||
debug('environment variable CYPRESS_INSTALL_BINARY = 0, skipping install');
|
||||
logger.log(stripIndent`
|
||||
${chalk.yellow('Note:')} Skipping binary installation: Environment variable CYPRESS_INSTALL_BINARY = 0.`);
|
||||
logger.log();
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
binaryUrlOverride = envVarVersion;
|
||||
}
|
||||
|
||||
if (util.getEnv('CYPRESS_CACHE_FOLDER')) {
|
||||
const envCache = util.getEnv('CYPRESS_CACHE_FOLDER');
|
||||
logger.log(stripIndent`
|
||||
${chalk.yellow('Note:')} Overriding Cypress cache directory to: ${chalk.cyan(envCache)}
|
||||
|
||||
Previous installs of Cypress may not be found.
|
||||
`);
|
||||
logger.log();
|
||||
}
|
||||
|
||||
const installDir = state.getVersionDir(pkgVersion);
|
||||
const cacheDir = state.getCacheDir();
|
||||
const binaryDir = state.getBinaryDir(pkgVersion);
|
||||
return fs.ensureDirAsync(cacheDir).catch({
|
||||
code: 'EACCES'
|
||||
}, err => {
|
||||
return throwFormErrorText(errors.invalidCacheDirectory)(stripIndent`
|
||||
Failed to access ${chalk.cyan(cacheDir)}:
|
||||
|
||||
${err.message}
|
||||
`);
|
||||
}).then(() => {
|
||||
return Promise.all([state.getBinaryPkgAsync(binaryDir).then(state.getBinaryPkgVersion), getVersionSpecifier()]);
|
||||
}).then(([binaryVersion, versionSpecifier]) => {
|
||||
if (!binaryUrlOverride && versionSpecifier) {
|
||||
const computedBinaryUrl = getBinaryUrlFromPrereleaseNpmUrl(versionSpecifier);
|
||||
|
||||
if (computedBinaryUrl) {
|
||||
debug('computed binary url from version specifier %o', {
|
||||
computedBinaryUrl,
|
||||
needVersion
|
||||
});
|
||||
binaryUrlOverride = computedBinaryUrl;
|
||||
}
|
||||
}
|
||||
|
||||
needVersion = binaryUrlOverride || needVersion;
|
||||
debug('installed version is', binaryVersion, 'version needed is', needVersion);
|
||||
|
||||
if (!binaryVersion) {
|
||||
debug('no binary installed under cli version');
|
||||
return true;
|
||||
}
|
||||
|
||||
logger.log();
|
||||
logger.log(stripIndent`
|
||||
Cypress ${chalk.green(binaryVersion)} is installed in ${chalk.cyan(installDir)}
|
||||
`);
|
||||
logger.log();
|
||||
|
||||
if (options.force) {
|
||||
debug('performing force install over existing binary');
|
||||
return true;
|
||||
}
|
||||
|
||||
if (binaryVersion === needVersion || !util.isSemver(needVersion)) {
|
||||
// our version matches, tell the user this is a noop
|
||||
alreadyInstalledMsg();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}).then(shouldInstall => {
|
||||
// noop if we've been told not to download
|
||||
if (!shouldInstall) {
|
||||
debug('Not downloading or installing binary');
|
||||
return;
|
||||
}
|
||||
|
||||
if (needVersion !== pkgVersion) {
|
||||
logger.log(chalk.yellow(stripIndent`
|
||||
${logSymbols.warning} Warning: Forcing a binary version different than the default.
|
||||
|
||||
The CLI expected to install version: ${chalk.green(pkgVersion)}
|
||||
|
||||
Instead we will install version: ${chalk.green(needVersion)}
|
||||
|
||||
These versions may not work properly together.
|
||||
`));
|
||||
logger.log();
|
||||
} // see if version supplied is a path to a binary
|
||||
|
||||
|
||||
return fs.pathExistsAsync(needVersion).then(exists => {
|
||||
if (exists) {
|
||||
return path.extname(needVersion) === '.zip' ? needVersion : false;
|
||||
}
|
||||
|
||||
const possibleFile = util.formAbsolutePath(needVersion);
|
||||
debug('checking local file', possibleFile, 'cwd', process.cwd());
|
||||
return fs.pathExistsAsync(possibleFile).then(exists => {
|
||||
// if this exists return the path to it
|
||||
// else false
|
||||
if (exists && path.extname(possibleFile) === '.zip') {
|
||||
return possibleFile;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}).then(pathToLocalFile => {
|
||||
if (pathToLocalFile) {
|
||||
const absolutePath = path.resolve(needVersion);
|
||||
debug('found local file at', absolutePath);
|
||||
debug('skipping download');
|
||||
const rendererOptions = getRendererOptions();
|
||||
return new Listr([unzipTask({
|
||||
progress: {
|
||||
throttle: 100,
|
||||
onProgress: null
|
||||
},
|
||||
zipFilePath: absolutePath,
|
||||
installDir,
|
||||
rendererOptions
|
||||
})], {
|
||||
rendererOptions
|
||||
}).run();
|
||||
}
|
||||
|
||||
if (options.force) {
|
||||
debug('Cypress already installed at', installDir);
|
||||
debug('but the installation was forced');
|
||||
}
|
||||
|
||||
debug('preparing to download and unzip version ', needVersion, 'to path', installDir);
|
||||
const downloadDir = os.tmpdir();
|
||||
return downloadAndUnzip({
|
||||
version: needVersion,
|
||||
installDir,
|
||||
downloadDir
|
||||
});
|
||||
}) // delay 1 sec for UX, unless we are testing
|
||||
.then(() => {
|
||||
return Promise.delay(1000);
|
||||
}).then(displayCompletionMsg);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
start,
|
||||
_getVersionSpecifier: getVersionSpecifier,
|
||||
_getBinaryUrlFromPrereleaseNpmUrl: getBinaryUrlFromPrereleaseNpmUrl
|
||||
};
|
||||
|
||||
const unzipTask = ({
|
||||
zipFilePath,
|
||||
installDir,
|
||||
progress,
|
||||
rendererOptions
|
||||
}) => {
|
||||
return {
|
||||
options: {
|
||||
title: util.titleize('Unzipping Cypress')
|
||||
},
|
||||
task: (ctx, task) => {
|
||||
// as our unzip progresses indicate the status
|
||||
progress.onProgress = progessify(task, 'Unzipping Cypress');
|
||||
return unzip.start({
|
||||
zipFilePath,
|
||||
installDir,
|
||||
progress
|
||||
}).then(() => {
|
||||
util.setTaskTitle(task, util.titleize(chalk.green('Unzipped Cypress')), rendererOptions.renderer);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const progessify = (task, title) => {
|
||||
// return higher order function
|
||||
return (percentComplete, remaining) => {
|
||||
percentComplete = chalk.white(` ${percentComplete}%`); // pluralize seconds remaining
|
||||
|
||||
remaining = chalk.gray(`${remaining}s`);
|
||||
util.setTaskTitle(task, util.titleize(title, percentComplete, remaining), getRendererOptions().renderer);
|
||||
};
|
||||
}; // if we are running in CI then use
|
||||
// the verbose renderer else use
|
||||
// the default
|
||||
|
||||
|
||||
const getRendererOptions = () => {
|
||||
let renderer = util.isCi() ? verbose : 'default';
|
||||
|
||||
if (logger.logLevel() === 'silent') {
|
||||
renderer = 'silent';
|
||||
}
|
||||
|
||||
return {
|
||||
renderer
|
||||
};
|
||||
};
|
226
node_modules/cypress/lib/tasks/state.js
generated
vendored
Normal file
226
node_modules/cypress/lib/tasks/state.js
generated
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
"use strict";
|
||||
|
||||
const _ = require('lodash');
|
||||
|
||||
const os = require('os');
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const untildify = require('untildify');
|
||||
|
||||
const R = require('ramda');
|
||||
|
||||
const debug = require('debug')('cypress:cli');
|
||||
|
||||
const fs = require('../fs');
|
||||
|
||||
const util = require('../util');
|
||||
|
||||
const getPlatformExecutable = () => {
|
||||
const platform = os.platform();
|
||||
|
||||
switch (platform) {
|
||||
case 'darwin':
|
||||
return 'Contents/MacOS/Cypress';
|
||||
|
||||
case 'linux':
|
||||
return 'Cypress';
|
||||
|
||||
case 'win32':
|
||||
return 'Cypress.exe';
|
||||
// TODO handle this error using our standard
|
||||
|
||||
default:
|
||||
throw new Error(`Platform: "${platform}" is not supported.`);
|
||||
}
|
||||
};
|
||||
|
||||
const getPlatFormBinaryFolder = () => {
|
||||
const platform = os.platform();
|
||||
|
||||
switch (platform) {
|
||||
case 'darwin':
|
||||
return 'Cypress.app';
|
||||
|
||||
case 'linux':
|
||||
return 'Cypress';
|
||||
|
||||
case 'win32':
|
||||
return 'Cypress';
|
||||
// TODO handle this error using our standard
|
||||
|
||||
default:
|
||||
throw new Error(`Platform: "${platform}" is not supported.`);
|
||||
}
|
||||
};
|
||||
|
||||
const getBinaryPkgPath = binaryDir => {
|
||||
const platform = os.platform();
|
||||
|
||||
switch (platform) {
|
||||
case 'darwin':
|
||||
return path.join(binaryDir, 'Contents', 'Resources', 'app', 'package.json');
|
||||
|
||||
case 'linux':
|
||||
return path.join(binaryDir, 'resources', 'app', 'package.json');
|
||||
|
||||
case 'win32':
|
||||
return path.join(binaryDir, 'resources', 'app', 'package.json');
|
||||
// TODO handle this error using our standard
|
||||
|
||||
default:
|
||||
throw new Error(`Platform: "${platform}" is not supported.`);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Get path to binary directory
|
||||
*/
|
||||
|
||||
|
||||
const getBinaryDir = (version = util.pkgVersion()) => {
|
||||
return path.join(getVersionDir(version), getPlatFormBinaryFolder());
|
||||
};
|
||||
|
||||
const getVersionDir = (version = util.pkgVersion()) => {
|
||||
return path.join(getCacheDir(), version);
|
||||
};
|
||||
/**
|
||||
* When executing "npm postinstall" hook, the working directory is set to
|
||||
* "<current folder>/node_modules/cypress", which can be surprising when using relative paths.
|
||||
*/
|
||||
|
||||
|
||||
const isInstallingFromPostinstallHook = () => {
|
||||
// individual folders
|
||||
const cwdFolders = process.cwd().split(path.sep);
|
||||
const length = cwdFolders.length;
|
||||
return cwdFolders[length - 2] === 'node_modules' && cwdFolders[length - 1] === 'cypress';
|
||||
};
|
||||
|
||||
const getCacheDir = () => {
|
||||
let cache_directory = util.getCacheDir();
|
||||
|
||||
if (util.getEnv('CYPRESS_CACHE_FOLDER')) {
|
||||
const envVarCacheDir = untildify(util.getEnv('CYPRESS_CACHE_FOLDER'));
|
||||
debug('using environment variable CYPRESS_CACHE_FOLDER %s', envVarCacheDir);
|
||||
|
||||
if (!path.isAbsolute(envVarCacheDir) && isInstallingFromPostinstallHook()) {
|
||||
const packageRootFolder = path.join('..', '..', envVarCacheDir);
|
||||
cache_directory = path.resolve(packageRootFolder);
|
||||
debug('installing from postinstall hook, original root folder is %s', packageRootFolder);
|
||||
debug('and resolved cache directory is %s', cache_directory);
|
||||
} else {
|
||||
cache_directory = path.resolve(envVarCacheDir);
|
||||
}
|
||||
}
|
||||
|
||||
return cache_directory;
|
||||
};
|
||||
|
||||
const parseRealPlatformBinaryFolderAsync = binaryPath => {
|
||||
return fs.realpathAsync(binaryPath).then(realPath => {
|
||||
debug('CYPRESS_RUN_BINARY has realpath:', realPath);
|
||||
|
||||
if (!realPath.toString().endsWith(getPlatformExecutable())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (os.platform() === 'darwin') {
|
||||
return path.resolve(realPath, '..', '..', '..');
|
||||
}
|
||||
|
||||
return path.resolve(realPath, '..');
|
||||
});
|
||||
};
|
||||
|
||||
const getDistDir = () => {
|
||||
return path.join(__dirname, '..', '..', 'dist');
|
||||
};
|
||||
/**
|
||||
* Returns full filename to the file that keeps the Test Runner verification state as JSON text.
|
||||
* Note: the binary state file will be stored one level up from the given binary folder.
|
||||
* @param {string} binaryDir - full path to the folder holding the binary.
|
||||
*/
|
||||
|
||||
|
||||
const getBinaryStatePath = binaryDir => {
|
||||
return path.join(binaryDir, '..', 'binary_state.json');
|
||||
};
|
||||
|
||||
const getBinaryStateContentsAsync = binaryDir => {
|
||||
const fullPath = getBinaryStatePath(binaryDir);
|
||||
return fs.readJsonAsync(fullPath).catch({
|
||||
code: 'ENOENT'
|
||||
}, SyntaxError, () => {
|
||||
debug('could not read binary_state.json file at "%s"', fullPath);
|
||||
return {};
|
||||
});
|
||||
};
|
||||
|
||||
const getBinaryVerifiedAsync = binaryDir => {
|
||||
return getBinaryStateContentsAsync(binaryDir).tap(debug).get('verified');
|
||||
};
|
||||
|
||||
const clearBinaryStateAsync = binaryDir => {
|
||||
return fs.removeAsync(getBinaryStatePath(binaryDir));
|
||||
};
|
||||
/**
|
||||
* Writes the new binary status.
|
||||
* @param {boolean} verified The new test runner state after smoke test
|
||||
* @param {string} binaryDir Folder holding the binary
|
||||
* @returns {Promise<void>} returns a promise
|
||||
*/
|
||||
|
||||
|
||||
const writeBinaryVerifiedAsync = (verified, binaryDir) => {
|
||||
return getBinaryStateContentsAsync(binaryDir).then(contents => {
|
||||
return fs.outputJsonAsync(getBinaryStatePath(binaryDir), _.extend(contents, {
|
||||
verified
|
||||
}), {
|
||||
spaces: 2
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const getPathToExecutable = binaryDir => {
|
||||
return path.join(binaryDir, getPlatformExecutable());
|
||||
};
|
||||
/**
|
||||
* Resolves with an object read from the binary app package.json file.
|
||||
* If the file does not exist resolves with null
|
||||
*/
|
||||
|
||||
|
||||
const getBinaryPkgAsync = binaryDir => {
|
||||
const pathToPackageJson = getBinaryPkgPath(binaryDir);
|
||||
debug('Reading binary package.json from:', pathToPackageJson);
|
||||
return fs.pathExistsAsync(pathToPackageJson).then(exists => {
|
||||
if (!exists) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return fs.readJsonAsync(pathToPackageJson);
|
||||
});
|
||||
};
|
||||
|
||||
const getBinaryPkgVersion = R.propOr(null, 'version');
|
||||
const getBinaryElectronVersion = R.propOr(null, 'electronVersion');
|
||||
const getBinaryElectronNodeVersion = R.propOr(null, 'electronNodeVersion');
|
||||
module.exports = {
|
||||
getPathToExecutable,
|
||||
getPlatformExecutable,
|
||||
// those names start to sound like Java
|
||||
getBinaryElectronNodeVersion,
|
||||
getBinaryElectronVersion,
|
||||
getBinaryPkgVersion,
|
||||
getBinaryVerifiedAsync,
|
||||
getBinaryPkgAsync,
|
||||
getBinaryPkgPath,
|
||||
getBinaryDir,
|
||||
getCacheDir,
|
||||
clearBinaryStateAsync,
|
||||
writeBinaryVerifiedAsync,
|
||||
parseRealPlatformBinaryFolderAsync,
|
||||
getDistDir,
|
||||
getVersionDir
|
||||
};
|
226
node_modules/cypress/lib/tasks/unzip.js
generated
vendored
Normal file
226
node_modules/cypress/lib/tasks/unzip.js
generated
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
"use strict";
|
||||
|
||||
const _ = require('lodash');
|
||||
|
||||
const la = require('lazy-ass');
|
||||
|
||||
const is = require('check-more-types');
|
||||
|
||||
const cp = require('child_process');
|
||||
|
||||
const os = require('os');
|
||||
|
||||
const yauzl = require('yauzl');
|
||||
|
||||
const debug = require('debug')('cypress:cli:unzip');
|
||||
|
||||
const extract = require('extract-zip');
|
||||
|
||||
const Promise = require('bluebird');
|
||||
|
||||
const readline = require('readline');
|
||||
|
||||
const {
|
||||
throwFormErrorText,
|
||||
errors
|
||||
} = require('../errors');
|
||||
|
||||
const fs = require('../fs');
|
||||
|
||||
const util = require('../util');
|
||||
|
||||
const unzipTools = {
|
||||
extract
|
||||
}; // expose this function for simple testing
|
||||
|
||||
const unzip = ({
|
||||
zipFilePath,
|
||||
installDir,
|
||||
progress
|
||||
}) => {
|
||||
debug('unzipping from %s', zipFilePath);
|
||||
debug('into', installDir);
|
||||
|
||||
if (!zipFilePath) {
|
||||
throw new Error('Missing zip filename');
|
||||
}
|
||||
|
||||
const startTime = Date.now();
|
||||
let yauzlDoneTime = 0;
|
||||
return fs.ensureDirAsync(installDir).then(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return yauzl.open(zipFilePath, (err, zipFile) => {
|
||||
yauzlDoneTime = Date.now();
|
||||
|
||||
if (err) {
|
||||
debug('error using yauzl %s', err.message);
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
const total = zipFile.entryCount;
|
||||
debug('zipFile entries count', total);
|
||||
const started = new Date();
|
||||
let percent = 0;
|
||||
let count = 0;
|
||||
|
||||
const notify = percent => {
|
||||
const elapsed = +new Date() - +started;
|
||||
const eta = util.calculateEta(percent, elapsed);
|
||||
progress.onProgress(percent, util.secsRemaining(eta));
|
||||
};
|
||||
|
||||
const tick = () => {
|
||||
count += 1;
|
||||
percent = count / total * 100;
|
||||
const displayPercent = percent.toFixed(0);
|
||||
return notify(displayPercent);
|
||||
};
|
||||
|
||||
const unzipWithNode = () => {
|
||||
debug('unzipping with node.js (slow)');
|
||||
const opts = {
|
||||
dir: installDir,
|
||||
onEntry: tick
|
||||
};
|
||||
debug('calling Node extract tool %s %o', zipFilePath, opts);
|
||||
return unzipTools.extract(zipFilePath, opts).then(() => {
|
||||
debug('node unzip finished');
|
||||
return resolve();
|
||||
}).catch(err => {
|
||||
if (err) {
|
||||
debug('error %s', err.message);
|
||||
return reject(err);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const unzipFallback = _.once(unzipWithNode);
|
||||
|
||||
const unzipWithUnzipTool = () => {
|
||||
debug('unzipping via `unzip`');
|
||||
const inflatingRe = /inflating:/;
|
||||
const sp = cp.spawn('unzip', ['-o', zipFilePath, '-d', installDir]);
|
||||
sp.on('error', err => {
|
||||
debug('unzip tool error: %s', err.message);
|
||||
unzipFallback();
|
||||
});
|
||||
sp.on('close', code => {
|
||||
debug('unzip tool close with code %d', code);
|
||||
|
||||
if (code === 0) {
|
||||
percent = 100;
|
||||
notify(percent);
|
||||
return resolve();
|
||||
}
|
||||
|
||||
debug('`unzip` failed %o', {
|
||||
code
|
||||
});
|
||||
return unzipFallback();
|
||||
});
|
||||
sp.stdout.on('data', data => {
|
||||
if (inflatingRe.test(data)) {
|
||||
return tick();
|
||||
}
|
||||
});
|
||||
sp.stderr.on('data', data => {
|
||||
debug('`unzip` stderr %s', data);
|
||||
});
|
||||
}; // we attempt to first unzip with the native osx
|
||||
// ditto because its less likely to have problems
|
||||
// with corruption, symlinks, or icons causing failures
|
||||
// and can handle resource forks
|
||||
// http://automatica.com.au/2011/02/unzip-mac-os-x-zip-in-terminal/
|
||||
|
||||
|
||||
const unzipWithOsx = () => {
|
||||
debug('unzipping via `ditto`');
|
||||
const copyingFileRe = /^copying file/;
|
||||
const sp = cp.spawn('ditto', ['-xkV', zipFilePath, installDir]); // f-it just unzip with node
|
||||
|
||||
sp.on('error', err => {
|
||||
debug(err.message);
|
||||
unzipFallback();
|
||||
});
|
||||
sp.on('close', code => {
|
||||
if (code === 0) {
|
||||
// make sure we get to 100% on the progress bar
|
||||
// because reading in lines is not really accurate
|
||||
percent = 100;
|
||||
notify(percent);
|
||||
return resolve();
|
||||
}
|
||||
|
||||
debug('`ditto` failed %o', {
|
||||
code
|
||||
});
|
||||
return unzipFallback();
|
||||
});
|
||||
return readline.createInterface({
|
||||
input: sp.stderr
|
||||
}).on('line', line => {
|
||||
if (copyingFileRe.test(line)) {
|
||||
return tick();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
switch (os.platform()) {
|
||||
case 'darwin':
|
||||
return unzipWithOsx();
|
||||
|
||||
case 'linux':
|
||||
return unzipWithUnzipTool();
|
||||
|
||||
case 'win32':
|
||||
return unzipWithNode();
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
});
|
||||
}).tap(() => {
|
||||
debug('unzip completed %o', {
|
||||
yauzlMs: yauzlDoneTime - startTime,
|
||||
unzipMs: Date.now() - yauzlDoneTime
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const start = ({
|
||||
zipFilePath,
|
||||
installDir,
|
||||
progress
|
||||
}) => {
|
||||
la(is.unemptyString(installDir), 'missing installDir');
|
||||
|
||||
if (!progress) {
|
||||
progress = {
|
||||
onProgress: () => {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return fs.pathExists(installDir).then(exists => {
|
||||
if (exists) {
|
||||
debug('removing existing unzipped binary', installDir);
|
||||
return fs.removeAsync(installDir);
|
||||
}
|
||||
}).then(() => {
|
||||
return unzip({
|
||||
zipFilePath,
|
||||
installDir,
|
||||
progress
|
||||
});
|
||||
}).catch(throwFormErrorText(errors.failedUnzip));
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
start,
|
||||
utils: {
|
||||
unzip,
|
||||
unzipTools
|
||||
}
|
||||
};
|
349
node_modules/cypress/lib/tasks/verify.js
generated
vendored
Normal file
349
node_modules/cypress/lib/tasks/verify.js
generated
vendored
Normal file
@@ -0,0 +1,349 @@
|
||||
"use strict";
|
||||
|
||||
const _ = require('lodash');
|
||||
|
||||
const chalk = require('chalk');
|
||||
|
||||
const {
|
||||
Listr
|
||||
} = require('listr2');
|
||||
|
||||
const debug = require('debug')('cypress:cli');
|
||||
|
||||
const {
|
||||
stripIndent
|
||||
} = require('common-tags');
|
||||
|
||||
const Promise = require('bluebird');
|
||||
|
||||
const logSymbols = require('log-symbols');
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const os = require('os');
|
||||
|
||||
const verbose = require('../VerboseRenderer');
|
||||
|
||||
const {
|
||||
throwFormErrorText,
|
||||
errors
|
||||
} = require('../errors');
|
||||
|
||||
const util = require('../util');
|
||||
|
||||
const logger = require('../logger');
|
||||
|
||||
const xvfb = require('../exec/xvfb');
|
||||
|
||||
const state = require('./state');
|
||||
|
||||
const VERIFY_TEST_RUNNER_TIMEOUT_MS = 30000;
|
||||
|
||||
const checkExecutable = binaryDir => {
|
||||
const executable = state.getPathToExecutable(binaryDir);
|
||||
debug('checking if executable exists', executable);
|
||||
return util.isExecutableAsync(executable).then(isExecutable => {
|
||||
debug('Binary is executable? :', isExecutable);
|
||||
|
||||
if (!isExecutable) {
|
||||
return throwFormErrorText(errors.binaryNotExecutable(executable))();
|
||||
}
|
||||
}).catch({
|
||||
code: 'ENOENT'
|
||||
}, () => {
|
||||
if (util.isCi()) {
|
||||
return throwFormErrorText(errors.notInstalledCI(executable))();
|
||||
}
|
||||
|
||||
return throwFormErrorText(errors.missingApp(binaryDir))(stripIndent`
|
||||
Cypress executable not found at: ${chalk.cyan(executable)}
|
||||
`);
|
||||
});
|
||||
};
|
||||
|
||||
const runSmokeTest = (binaryDir, options) => {
|
||||
let executable = state.getPathToExecutable(binaryDir);
|
||||
|
||||
const onSmokeTestError = (smokeTestCommand, linuxWithDisplayEnv) => {
|
||||
return err => {
|
||||
debug('Smoke test failed:', err);
|
||||
let errMessage = err.stderr || err.message;
|
||||
debug('error message:', errMessage);
|
||||
|
||||
if (err.timedOut) {
|
||||
debug('error timedOut is true');
|
||||
return throwFormErrorText(errors.smokeTestFailure(smokeTestCommand, true))(errMessage);
|
||||
}
|
||||
|
||||
if (linuxWithDisplayEnv && util.isBrokenGtkDisplay(errMessage)) {
|
||||
util.logBrokenGtkDisplayWarning();
|
||||
return throwFormErrorText(errors.invalidSmokeTestDisplayError)(errMessage);
|
||||
}
|
||||
|
||||
return throwFormErrorText(errors.missingDependency)(errMessage);
|
||||
};
|
||||
};
|
||||
|
||||
const needsXvfb = xvfb.isNeeded();
|
||||
debug('needs Xvfb?', needsXvfb);
|
||||
/**
|
||||
* Spawn Cypress running smoke test to check if all operating system
|
||||
* dependencies are good.
|
||||
*/
|
||||
|
||||
const spawn = linuxWithDisplayEnv => {
|
||||
const random = _.random(0, 1000);
|
||||
|
||||
const args = ['--smoke-test', `--ping=${random}`];
|
||||
|
||||
if (needsSandbox()) {
|
||||
// electron requires --no-sandbox to run as root
|
||||
debug('disabling Electron sandbox');
|
||||
args.unshift('--no-sandbox');
|
||||
}
|
||||
|
||||
if (options.dev) {
|
||||
executable = 'node';
|
||||
args.unshift(path.resolve(__dirname, '..', '..', '..', 'scripts', 'start.js'));
|
||||
}
|
||||
|
||||
const smokeTestCommand = `${executable} ${args.join(' ')}`;
|
||||
debug('running smoke test');
|
||||
debug('using Cypress executable %s', executable);
|
||||
debug('smoke test command:', smokeTestCommand);
|
||||
debug('smoke test timeout %d ms', options.smokeTestTimeout);
|
||||
|
||||
const env = _.extend({}, process.env, {
|
||||
ELECTRON_ENABLE_LOGGING: true
|
||||
});
|
||||
|
||||
const stdioOptions = _.extend({}, {
|
||||
env,
|
||||
timeout: options.smokeTestTimeout
|
||||
});
|
||||
|
||||
return Promise.resolve(util.exec(executable, args, stdioOptions)).catch(onSmokeTestError(smokeTestCommand, linuxWithDisplayEnv)).then(result => {
|
||||
// TODO: when execa > 1.1 is released
|
||||
// change this to `result.all` for both stderr and stdout
|
||||
// use lodash to be robust during tests against null result or missing stdout
|
||||
const smokeTestStdout = _.get(result, 'stdout', '');
|
||||
|
||||
debug('smoke test stdout "%s"', smokeTestStdout);
|
||||
|
||||
if (!util.stdoutLineMatches(String(random), smokeTestStdout)) {
|
||||
debug('Smoke test failed because could not find %d in:', random, result);
|
||||
|
||||
const smokeTestStderr = _.get(result, 'stderr', '');
|
||||
|
||||
const errorText = smokeTestStderr || smokeTestStdout;
|
||||
return throwFormErrorText(errors.smokeTestFailure(smokeTestCommand, false))(errorText);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const spawnInXvfb = linuxWithDisplayEnv => {
|
||||
return xvfb.start().then(() => {
|
||||
return spawn(linuxWithDisplayEnv);
|
||||
}).finally(xvfb.stop);
|
||||
};
|
||||
|
||||
const userFriendlySpawn = linuxWithDisplayEnv => {
|
||||
debug('spawning, should retry on display problem?', Boolean(linuxWithDisplayEnv));
|
||||
return spawn(linuxWithDisplayEnv).catch({
|
||||
code: 'INVALID_SMOKE_TEST_DISPLAY_ERROR'
|
||||
}, () => {
|
||||
return spawnInXvfb(linuxWithDisplayEnv);
|
||||
});
|
||||
};
|
||||
|
||||
if (needsXvfb) {
|
||||
return spawnInXvfb();
|
||||
} // if we are on linux and there's already a DISPLAY
|
||||
// set, then we may need to rerun cypress after
|
||||
// spawning our own Xvfb server
|
||||
|
||||
|
||||
const linuxWithDisplayEnv = util.isPossibleLinuxWithIncorrectDisplay();
|
||||
return userFriendlySpawn(linuxWithDisplayEnv);
|
||||
};
|
||||
|
||||
function testBinary(version, binaryDir, options) {
|
||||
debug('running binary verification check', version); // if running from 'cypress verify', don't print this message
|
||||
|
||||
if (!options.force) {
|
||||
logger.log(stripIndent`
|
||||
It looks like this is your first time using Cypress: ${chalk.cyan(version)}
|
||||
`);
|
||||
}
|
||||
|
||||
logger.log(); // if we are running in CI then use
|
||||
// the verbose renderer else use
|
||||
// the default
|
||||
|
||||
let renderer = util.isCi() ? verbose : 'default';
|
||||
if (logger.logLevel() === 'silent') renderer = 'silent';
|
||||
const rendererOptions = {
|
||||
renderer
|
||||
};
|
||||
const tasks = new Listr([{
|
||||
options: {
|
||||
title: util.titleize('Verifying Cypress can run', chalk.gray(binaryDir))
|
||||
},
|
||||
task: (ctx, task) => {
|
||||
debug('clearing out the verified version');
|
||||
return state.clearBinaryStateAsync(binaryDir).then(() => {
|
||||
return Promise.all([runSmokeTest(binaryDir, options), Promise.resolve().delay(1500) // good user experience
|
||||
]);
|
||||
}).then(() => {
|
||||
debug('write verified: true');
|
||||
return state.writeBinaryVerifiedAsync(true, binaryDir);
|
||||
}).then(() => {
|
||||
util.setTaskTitle(task, util.titleize(chalk.green('Verified Cypress!'), chalk.gray(binaryDir)), rendererOptions.renderer);
|
||||
});
|
||||
}
|
||||
}], {
|
||||
rendererOptions
|
||||
});
|
||||
return tasks.run();
|
||||
}
|
||||
|
||||
const maybeVerify = (installedVersion, binaryDir, options) => {
|
||||
return state.getBinaryVerifiedAsync(binaryDir).then(isVerified => {
|
||||
debug('is Verified ?', isVerified);
|
||||
let shouldVerify = !isVerified; // force verify if options.force
|
||||
|
||||
if (options.force) {
|
||||
debug('force verify');
|
||||
shouldVerify = true;
|
||||
}
|
||||
|
||||
if (shouldVerify) {
|
||||
return testBinary(installedVersion, binaryDir, options).then(() => {
|
||||
if (options.welcomeMessage) {
|
||||
logger.log();
|
||||
logger.log('Opening Cypress...');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const start = (options = {}) => {
|
||||
debug('verifying Cypress app');
|
||||
const packageVersion = util.pkgVersion();
|
||||
let binaryDir = state.getBinaryDir(packageVersion);
|
||||
|
||||
_.defaults(options, {
|
||||
dev: false,
|
||||
force: false,
|
||||
welcomeMessage: true,
|
||||
smokeTestTimeout: VERIFY_TEST_RUNNER_TIMEOUT_MS
|
||||
});
|
||||
|
||||
if (options.dev) {
|
||||
return runSmokeTest('', options);
|
||||
}
|
||||
|
||||
const parseBinaryEnvVar = () => {
|
||||
const envBinaryPath = util.getEnv('CYPRESS_RUN_BINARY');
|
||||
debug('CYPRESS_RUN_BINARY exists, =', envBinaryPath);
|
||||
logger.log(stripIndent`
|
||||
${chalk.yellow('Note:')} You have set the environment variable:
|
||||
|
||||
${chalk.white('CYPRESS_RUN_BINARY=')}${chalk.cyan(envBinaryPath)}
|
||||
|
||||
This overrides the default Cypress binary path used.
|
||||
`);
|
||||
logger.log();
|
||||
return util.isExecutableAsync(envBinaryPath).then(isExecutable => {
|
||||
debug('CYPRESS_RUN_BINARY is executable? :', isExecutable);
|
||||
|
||||
if (!isExecutable) {
|
||||
return throwFormErrorText(errors.CYPRESS_RUN_BINARY.notValid(envBinaryPath))(stripIndent`
|
||||
The supplied binary path is not executable
|
||||
`);
|
||||
}
|
||||
}).then(() => {
|
||||
return state.parseRealPlatformBinaryFolderAsync(envBinaryPath);
|
||||
}).then(envBinaryDir => {
|
||||
if (!envBinaryDir) {
|
||||
return throwFormErrorText(errors.CYPRESS_RUN_BINARY.notValid(envBinaryPath))();
|
||||
}
|
||||
|
||||
debug('CYPRESS_RUN_BINARY has binaryDir:', envBinaryDir);
|
||||
binaryDir = envBinaryDir;
|
||||
}).catch({
|
||||
code: 'ENOENT'
|
||||
}, err => {
|
||||
return throwFormErrorText(errors.CYPRESS_RUN_BINARY.notValid(envBinaryPath))(err.message);
|
||||
});
|
||||
};
|
||||
|
||||
return Promise.try(() => {
|
||||
debug('checking environment variables');
|
||||
|
||||
if (util.getEnv('CYPRESS_RUN_BINARY')) {
|
||||
return parseBinaryEnvVar();
|
||||
}
|
||||
}).then(() => {
|
||||
return checkExecutable(binaryDir);
|
||||
}).tap(() => {
|
||||
return debug('binaryDir is ', binaryDir);
|
||||
}).then(() => {
|
||||
return state.getBinaryPkgAsync(binaryDir);
|
||||
}).then(pkg => {
|
||||
return state.getBinaryPkgVersion(pkg);
|
||||
}).then(binaryVersion => {
|
||||
if (!binaryVersion) {
|
||||
debug('no Cypress binary found for cli version ', packageVersion);
|
||||
return throwFormErrorText(errors.missingApp(binaryDir))(`
|
||||
Cannot read binary version from: ${chalk.cyan(state.getBinaryPkgPath(binaryDir))}
|
||||
`);
|
||||
}
|
||||
|
||||
debug(`Found binary version ${chalk.green(binaryVersion)} installed in: ${chalk.cyan(binaryDir)}`);
|
||||
|
||||
if (binaryVersion !== packageVersion) {
|
||||
// warn if we installed with CYPRESS_INSTALL_BINARY or changed version
|
||||
// in the package.json
|
||||
logger.log(`Found binary version ${chalk.green(binaryVersion)} installed in: ${chalk.cyan(binaryDir)}`);
|
||||
logger.log();
|
||||
logger.warn(stripIndent`
|
||||
|
||||
|
||||
${logSymbols.warning} Warning: Binary version ${chalk.green(binaryVersion)} does not match the expected package version ${chalk.green(packageVersion)}
|
||||
|
||||
These versions may not work properly together.
|
||||
`);
|
||||
logger.log();
|
||||
}
|
||||
|
||||
return maybeVerify(binaryVersion, binaryDir, options);
|
||||
}).catch(err => {
|
||||
if (err.known) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
return throwFormErrorText(errors.unexpected)(err.stack);
|
||||
});
|
||||
};
|
||||
|
||||
const isLinuxLike = () => os.platform() !== 'win32';
|
||||
/**
|
||||
* Returns true if running on a system where Electron needs "--no-sandbox" flag.
|
||||
* @see https://crbug.com/638180
|
||||
*
|
||||
* On Debian we had problems running in sandbox even for non-root users.
|
||||
* @see https://github.com/cypress-io/cypress/issues/5434
|
||||
* Seems there is a lot of discussion around this issue among Electron users
|
||||
* @see https://github.com/electron/electron/issues/17972
|
||||
*/
|
||||
|
||||
|
||||
const needsSandbox = () => isLinuxLike();
|
||||
|
||||
module.exports = {
|
||||
start,
|
||||
VERIFY_TEST_RUNNER_TIMEOUT_MS,
|
||||
needsSandbox
|
||||
};
|
480
node_modules/cypress/lib/util.js
generated
vendored
Normal file
480
node_modules/cypress/lib/util.js
generated
vendored
Normal file
@@ -0,0 +1,480 @@
|
||||
"use strict";
|
||||
|
||||
const _ = require('lodash');
|
||||
|
||||
const R = require('ramda');
|
||||
|
||||
const os = require('os');
|
||||
|
||||
const ospath = require('ospath');
|
||||
|
||||
const crypto = require('crypto');
|
||||
|
||||
const la = require('lazy-ass');
|
||||
|
||||
const is = require('check-more-types');
|
||||
|
||||
const tty = require('tty');
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const isCi = require('is-ci');
|
||||
|
||||
const execa = require('execa');
|
||||
|
||||
const getos = require('getos');
|
||||
|
||||
const chalk = require('chalk');
|
||||
|
||||
const Promise = require('bluebird');
|
||||
|
||||
const cachedir = require('cachedir');
|
||||
|
||||
const logSymbols = require('log-symbols');
|
||||
|
||||
const executable = require('executable');
|
||||
|
||||
const {
|
||||
stripIndent
|
||||
} = require('common-tags');
|
||||
|
||||
const supportsColor = require('supports-color');
|
||||
|
||||
const isInstalledGlobally = require('is-installed-globally');
|
||||
|
||||
const pkg = require(path.join(__dirname, '..', 'package.json'));
|
||||
|
||||
const logger = require('./logger');
|
||||
|
||||
const debug = require('debug')('cypress:cli');
|
||||
|
||||
const fs = require('./fs');
|
||||
|
||||
const issuesUrl = 'https://github.com/cypress-io/cypress/issues';
|
||||
const getosAsync = Promise.promisify(getos);
|
||||
/**
|
||||
* Returns SHA512 of a file
|
||||
*
|
||||
* Implementation lifted from https://github.com/sindresorhus/hasha
|
||||
* but without bringing that dependency (since hasha is Node v8+)
|
||||
*/
|
||||
|
||||
const getFileChecksum = filename => {
|
||||
la(is.unemptyString(filename), 'expected filename', filename);
|
||||
|
||||
const hashStream = () => {
|
||||
const s = crypto.createHash('sha512');
|
||||
s.setEncoding('hex');
|
||||
return s;
|
||||
};
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const stream = fs.createReadStream(filename);
|
||||
stream.on('error', reject).pipe(hashStream()).on('error', reject).on('finish', function () {
|
||||
resolve(this.read());
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const getFileSize = filename => {
|
||||
la(is.unemptyString(filename), 'expected filename', filename);
|
||||
return fs.statAsync(filename).get('size');
|
||||
};
|
||||
|
||||
const isBrokenGtkDisplayRe = /Gtk: cannot open display/;
|
||||
|
||||
const stringify = val => {
|
||||
return _.isObject(val) ? JSON.stringify(val) : val;
|
||||
};
|
||||
|
||||
function normalizeModuleOptions(options = {}) {
|
||||
return _.mapValues(options, stringify);
|
||||
}
|
||||
/**
|
||||
* Returns true if the platform is Linux. We do a lot of different
|
||||
* stuff on Linux (like Xvfb) and it helps to has readable code
|
||||
*/
|
||||
|
||||
|
||||
const isLinux = () => {
|
||||
return os.platform() === 'linux';
|
||||
};
|
||||
/**
|
||||
* If the DISPLAY variable is set incorrectly, when trying to spawn
|
||||
* Cypress executable we get an error like this:
|
||||
```
|
||||
[1005:0509/184205.663837:WARNING:browser_main_loop.cc(258)] Gtk: cannot open display: 99
|
||||
```
|
||||
*/
|
||||
|
||||
|
||||
const isBrokenGtkDisplay = str => {
|
||||
return isBrokenGtkDisplayRe.test(str);
|
||||
};
|
||||
|
||||
const isPossibleLinuxWithIncorrectDisplay = () => {
|
||||
return isLinux() && process.env.DISPLAY;
|
||||
};
|
||||
|
||||
const logBrokenGtkDisplayWarning = () => {
|
||||
debug('Cypress exited due to a broken gtk display because of a potential invalid DISPLAY env... retrying after starting Xvfb'); // if we get this error, we are on Linux and DISPLAY is set
|
||||
|
||||
logger.warn(stripIndent`
|
||||
|
||||
${logSymbols.warning} Warning: Cypress failed to start.
|
||||
|
||||
This is likely due to a misconfigured DISPLAY environment variable.
|
||||
|
||||
DISPLAY was set to: "${process.env.DISPLAY}"
|
||||
|
||||
Cypress will attempt to fix the problem and rerun.
|
||||
`);
|
||||
logger.warn();
|
||||
};
|
||||
|
||||
function stdoutLineMatches(expectedLine, stdout) {
|
||||
const lines = stdout.split('\n').map(R.trim);
|
||||
const lineMatches = R.equals(expectedLine);
|
||||
return lines.some(lineMatches);
|
||||
}
|
||||
/**
|
||||
* Confirms if given value is a valid CYPRESS_INTERNAL_ENV value. Undefined values
|
||||
* are valid, because the system can set the default one.
|
||||
*
|
||||
* @param {string} value
|
||||
* @example util.isValidCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
|
||||
*/
|
||||
|
||||
|
||||
function isValidCypressInternalEnvValue(value) {
|
||||
if (_.isUndefined(value)) {
|
||||
// will get default value
|
||||
return true;
|
||||
} // names of config environments, see "packages/server/config/app.yml"
|
||||
|
||||
|
||||
const names = ['development', 'test', 'staging', 'production'];
|
||||
return _.includes(names, value);
|
||||
}
|
||||
/**
|
||||
* Confirms if given value is a non-production CYPRESS_INTERNAL_ENV value.
|
||||
* Undefined values are valid, because the system can set the default one.
|
||||
*
|
||||
* @param {string} value
|
||||
* @example util.isNonProductionCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
|
||||
*/
|
||||
|
||||
|
||||
function isNonProductionCypressInternalEnvValue(value) {
|
||||
return !_.isUndefined(value) && value !== 'production';
|
||||
}
|
||||
/**
|
||||
* Prints NODE_OPTIONS using debug() module, but only
|
||||
* if DEBUG=cypress... is set
|
||||
*/
|
||||
|
||||
|
||||
function printNodeOptions(log = debug) {
|
||||
if (!log.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.env.NODE_OPTIONS) {
|
||||
log('NODE_OPTIONS=%s', process.env.NODE_OPTIONS);
|
||||
} else {
|
||||
log('NODE_OPTIONS is not set');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Removes double quote characters
|
||||
* from the start and end of the given string IF they are both present
|
||||
*
|
||||
* @param {string} str Input string
|
||||
* @returns {string} Trimmed string or the original string if there are no double quotes around it.
|
||||
* @example
|
||||
```
|
||||
dequote('"foo"')
|
||||
// returns string 'foo'
|
||||
dequote('foo')
|
||||
// returns string 'foo'
|
||||
```
|
||||
*/
|
||||
|
||||
|
||||
const dequote = str => {
|
||||
la(is.string(str), 'expected a string to remove double quotes', str);
|
||||
|
||||
if (str.length > 1 && str[0] === '"' && str[str.length - 1] === '"') {
|
||||
return str.substr(1, str.length - 2);
|
||||
}
|
||||
|
||||
return str;
|
||||
};
|
||||
|
||||
const parseOpts = opts => {
|
||||
opts = _.pick(opts, 'browser', 'cachePath', 'cacheList', 'cacheClear', 'cachePrune', 'ciBuildId', 'config', 'configFile', 'cypressVersion', 'destination', 'detached', 'dev', 'exit', 'env', 'force', 'global', 'group', 'headed', 'headless', 'key', 'path', 'parallel', 'port', 'project', 'quiet', 'reporter', 'reporterOptions', 'record', 'runProject', 'spec', 'tag');
|
||||
|
||||
if (opts.exit) {
|
||||
opts = _.omit(opts, 'exit');
|
||||
} // some options might be quoted - which leads to unexpected results
|
||||
// remove double quotes from certain options
|
||||
|
||||
|
||||
const removeQuotes = {
|
||||
group: dequote,
|
||||
ciBuildId: dequote
|
||||
};
|
||||
const cleanOpts = R.evolve(removeQuotes, opts);
|
||||
debug('parsed cli options %o', cleanOpts);
|
||||
return cleanOpts;
|
||||
};
|
||||
/**
|
||||
* Copy of packages/server/lib/browsers/utils.ts
|
||||
* because we need same functionality in CLI to show the path :(
|
||||
*/
|
||||
|
||||
|
||||
const getApplicationDataFolder = (...paths) => {
|
||||
const {
|
||||
env
|
||||
} = process; // allow overriding the app_data folder
|
||||
|
||||
const folder = env.CYPRESS_KONFIG_ENV || env.CYPRESS_INTERNAL_ENV || 'development';
|
||||
const PRODUCT_NAME = pkg.productName || pkg.name;
|
||||
const OS_DATA_PATH = ospath.data();
|
||||
const ELECTRON_APP_DATA_PATH = path.join(OS_DATA_PATH, PRODUCT_NAME);
|
||||
const p = path.join(ELECTRON_APP_DATA_PATH, 'cy', folder, ...paths);
|
||||
return p;
|
||||
};
|
||||
|
||||
const util = {
|
||||
normalizeModuleOptions,
|
||||
parseOpts,
|
||||
isValidCypressInternalEnvValue,
|
||||
isNonProductionCypressInternalEnvValue,
|
||||
printNodeOptions,
|
||||
|
||||
isCi() {
|
||||
return isCi;
|
||||
},
|
||||
|
||||
getEnvOverrides(options = {}) {
|
||||
return _.chain({}).extend(util.getEnvColors()).extend(util.getForceTty()).omitBy(_.isUndefined) // remove undefined values
|
||||
.mapValues(value => {
|
||||
// stringify to 1 or 0
|
||||
return value ? '1' : '0';
|
||||
}).extend(util.getOriginalNodeOptions(options)).value();
|
||||
},
|
||||
|
||||
getOriginalNodeOptions(options) {
|
||||
if (process.env.NODE_OPTIONS) {
|
||||
return {
|
||||
ORIGINAL_NODE_OPTIONS: process.env.NODE_OPTIONS
|
||||
};
|
||||
}
|
||||
|
||||
return {};
|
||||
},
|
||||
|
||||
getForceTty() {
|
||||
return {
|
||||
FORCE_STDIN_TTY: util.isTty(process.stdin.fd),
|
||||
FORCE_STDOUT_TTY: util.isTty(process.stdout.fd),
|
||||
FORCE_STDERR_TTY: util.isTty(process.stderr.fd)
|
||||
};
|
||||
},
|
||||
|
||||
getEnvColors() {
|
||||
const sc = util.supportsColor();
|
||||
return {
|
||||
FORCE_COLOR: sc,
|
||||
DEBUG_COLORS: sc,
|
||||
MOCHA_COLORS: sc ? true : undefined
|
||||
};
|
||||
},
|
||||
|
||||
isTty(fd) {
|
||||
return tty.isatty(fd);
|
||||
},
|
||||
|
||||
supportsColor() {
|
||||
// if we've been explictly told not to support
|
||||
// color then turn this off
|
||||
if (process.env.NO_COLOR) {
|
||||
return false;
|
||||
} // https://github.com/cypress-io/cypress/issues/1747
|
||||
// always return true in CI providers
|
||||
|
||||
|
||||
if (process.env.CI) {
|
||||
return true;
|
||||
} // ensure that both stdout and stderr support color
|
||||
|
||||
|
||||
return Boolean(supportsColor.stdout) && Boolean(supportsColor.stderr);
|
||||
},
|
||||
|
||||
cwd() {
|
||||
return process.cwd();
|
||||
},
|
||||
|
||||
pkgVersion() {
|
||||
return pkg.version;
|
||||
},
|
||||
|
||||
exit(code) {
|
||||
process.exit(code);
|
||||
},
|
||||
|
||||
logErrorExit1(err) {
|
||||
logger.error(err.message);
|
||||
process.exit(1);
|
||||
},
|
||||
|
||||
dequote,
|
||||
|
||||
titleize(...args) {
|
||||
// prepend first arg with space
|
||||
// and pad so that all messages line up
|
||||
args[0] = _.padEnd(` ${args[0]}`, 24); // get rid of any falsy values
|
||||
|
||||
args = _.compact(args);
|
||||
return chalk.blue(...args);
|
||||
},
|
||||
|
||||
calculateEta(percent, elapsed) {
|
||||
// returns the number of seconds remaining
|
||||
// if we're at 100% already just return 0
|
||||
if (percent === 100) {
|
||||
return 0;
|
||||
} // take the percentage and divide by one
|
||||
// and multiple that against elapsed
|
||||
// subtracting what's already elapsed
|
||||
|
||||
|
||||
return elapsed * (1 / (percent / 100)) - elapsed;
|
||||
},
|
||||
|
||||
convertPercentToPercentage(num) {
|
||||
// convert a percent with values between 0 and 1
|
||||
// with decimals, so that it is between 0 and 100
|
||||
// and has no decimal places
|
||||
return Math.round(_.isFinite(num) ? num * 100 : 0);
|
||||
},
|
||||
|
||||
secsRemaining(eta) {
|
||||
// calculate the seconds reminaing with no decimal places
|
||||
return (_.isFinite(eta) ? eta / 1000 : 0).toFixed(0);
|
||||
},
|
||||
|
||||
setTaskTitle(task, title, renderer) {
|
||||
// only update the renderer title when not running in CI
|
||||
if (renderer === 'default' && task.title !== title) {
|
||||
task.title = title;
|
||||
}
|
||||
},
|
||||
|
||||
isInstalledGlobally() {
|
||||
return isInstalledGlobally;
|
||||
},
|
||||
|
||||
isSemver(str) {
|
||||
return /^(\d+\.)?(\d+\.)?(\*|\d+)$/.test(str);
|
||||
},
|
||||
|
||||
isExecutableAsync(filePath) {
|
||||
return Promise.resolve(executable(filePath));
|
||||
},
|
||||
|
||||
isLinux,
|
||||
|
||||
getOsVersionAsync() {
|
||||
return Promise.try(() => {
|
||||
if (isLinux()) {
|
||||
return getosAsync().then(osInfo => {
|
||||
return [osInfo.dist, osInfo.release].join(' - ');
|
||||
}).catch(() => {
|
||||
return os.release();
|
||||
});
|
||||
}
|
||||
|
||||
return os.release();
|
||||
});
|
||||
},
|
||||
|
||||
getPlatformInfo() {
|
||||
return util.getOsVersionAsync().then(version => {
|
||||
return stripIndent`
|
||||
Platform: ${os.platform()} (${version})
|
||||
Cypress Version: ${util.pkgVersion()}
|
||||
`;
|
||||
});
|
||||
},
|
||||
|
||||
// attention:
|
||||
// when passing relative path to NPM post install hook, the current working
|
||||
// directory is set to the `node_modules/cypress` folder
|
||||
// the user is probably passing relative path with respect to root package folder
|
||||
formAbsolutePath(filename) {
|
||||
if (path.isAbsolute(filename)) {
|
||||
return filename;
|
||||
}
|
||||
|
||||
return path.join(process.cwd(), '..', '..', filename);
|
||||
},
|
||||
|
||||
getEnv(varName, trim) {
|
||||
la(is.unemptyString(varName), 'expected environment variable name, not', varName);
|
||||
const configVarName = `npm_config_${varName}`;
|
||||
const packageConfigVarName = `npm_package_config_${varName}`;
|
||||
let result;
|
||||
|
||||
if (process.env.hasOwnProperty(varName)) {
|
||||
debug(`Using ${varName} from environment variable`);
|
||||
result = process.env[varName];
|
||||
} else if (process.env.hasOwnProperty(configVarName)) {
|
||||
debug(`Using ${varName} from npm config`);
|
||||
result = process.env[configVarName];
|
||||
} else if (process.env.hasOwnProperty(packageConfigVarName)) {
|
||||
debug(`Using ${varName} from package.json config`);
|
||||
result = process.env[packageConfigVarName];
|
||||
} // environment variables are often set double quotes to escape characters
|
||||
// and on Windows it can lead to weird things: for example
|
||||
// set FOO="C:\foo.txt" && node -e "console.log('>>>%s<<<', process.env.FOO)"
|
||||
// will print
|
||||
// >>>"C:\foo.txt" <<<
|
||||
// see https://github.com/cypress-io/cypress/issues/4506#issuecomment-506029942
|
||||
// so for sanity sake we should first trim whitespace characters and remove
|
||||
// double quotes around environment strings if the caller is expected to
|
||||
// use this environment string as a file path
|
||||
|
||||
|
||||
return trim ? dequote(_.trim(result)) : result;
|
||||
},
|
||||
|
||||
getCacheDir() {
|
||||
return cachedir('Cypress');
|
||||
},
|
||||
|
||||
isPostInstall() {
|
||||
return process.env.npm_lifecycle_event === 'postinstall';
|
||||
},
|
||||
|
||||
exec: execa,
|
||||
stdoutLineMatches,
|
||||
issuesUrl,
|
||||
isBrokenGtkDisplay,
|
||||
logBrokenGtkDisplayWarning,
|
||||
isPossibleLinuxWithIncorrectDisplay,
|
||||
|
||||
getGitHubIssueUrl(number) {
|
||||
la(is.positive(number), 'github issue should be a positive number', number);
|
||||
la(_.isInteger(number), 'github issue should be an integer', number);
|
||||
return `${issuesUrl}/${number}`;
|
||||
},
|
||||
|
||||
getFileChecksum,
|
||||
getFileSize,
|
||||
getApplicationDataFolder
|
||||
};
|
||||
module.exports = util;
|
15
node_modules/cypress/node_modules/.bin/extract-zip
generated
vendored
Normal file
15
node_modules/cypress/node_modules/.bin/extract-zip
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../../../extract-zip/cli.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../../../extract-zip/cli.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
7
node_modules/cypress/node_modules/.bin/extract-zip.cmd
generated
vendored
Normal file
7
node_modules/cypress/node_modules/.bin/extract-zip.cmd
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\..\..\extract-zip\cli.js" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\..\..\extract-zip\cli.js" %*
|
||||
)
|
15
node_modules/cypress/node_modules/.bin/is-ci
generated
vendored
Normal file
15
node_modules/cypress/node_modules/.bin/is-ci
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../../../is-ci/bin.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../../../is-ci/bin.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
7
node_modules/cypress/node_modules/.bin/is-ci.cmd
generated
vendored
Normal file
7
node_modules/cypress/node_modules/.bin/is-ci.cmd
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\..\..\is-ci\bin.js" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\..\..\is-ci\bin.js" %*
|
||||
)
|
415
node_modules/cypress/node_modules/chalk/index.d.ts
generated
vendored
Normal file
415
node_modules/cypress/node_modules/chalk/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,415 @@
|
||||
/**
|
||||
Basic foreground colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type ForegroundColor =
|
||||
| 'black'
|
||||
| 'red'
|
||||
| 'green'
|
||||
| 'yellow'
|
||||
| 'blue'
|
||||
| 'magenta'
|
||||
| 'cyan'
|
||||
| 'white'
|
||||
| 'gray'
|
||||
| 'grey'
|
||||
| 'blackBright'
|
||||
| 'redBright'
|
||||
| 'greenBright'
|
||||
| 'yellowBright'
|
||||
| 'blueBright'
|
||||
| 'magentaBright'
|
||||
| 'cyanBright'
|
||||
| 'whiteBright';
|
||||
|
||||
/**
|
||||
Basic background colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type BackgroundColor =
|
||||
| 'bgBlack'
|
||||
| 'bgRed'
|
||||
| 'bgGreen'
|
||||
| 'bgYellow'
|
||||
| 'bgBlue'
|
||||
| 'bgMagenta'
|
||||
| 'bgCyan'
|
||||
| 'bgWhite'
|
||||
| 'bgGray'
|
||||
| 'bgGrey'
|
||||
| 'bgBlackBright'
|
||||
| 'bgRedBright'
|
||||
| 'bgGreenBright'
|
||||
| 'bgYellowBright'
|
||||
| 'bgBlueBright'
|
||||
| 'bgMagentaBright'
|
||||
| 'bgCyanBright'
|
||||
| 'bgWhiteBright';
|
||||
|
||||
/**
|
||||
Basic colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type Color = ForegroundColor | BackgroundColor;
|
||||
|
||||
declare type Modifiers =
|
||||
| 'reset'
|
||||
| 'bold'
|
||||
| 'dim'
|
||||
| 'italic'
|
||||
| 'underline'
|
||||
| 'inverse'
|
||||
| 'hidden'
|
||||
| 'strikethrough'
|
||||
| 'visible';
|
||||
|
||||
declare namespace chalk {
|
||||
/**
|
||||
Levels:
|
||||
- `0` - All colors disabled.
|
||||
- `1` - Basic 16 colors support.
|
||||
- `2` - ANSI 256 colors support.
|
||||
- `3` - Truecolor 16 million colors support.
|
||||
*/
|
||||
type Level = 0 | 1 | 2 | 3;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
Specify the color support for Chalk.
|
||||
|
||||
By default, color support is automatically detected based on the environment.
|
||||
|
||||
Levels:
|
||||
- `0` - All colors disabled.
|
||||
- `1` - Basic 16 colors support.
|
||||
- `2` - ANSI 256 colors support.
|
||||
- `3` - Truecolor 16 million colors support.
|
||||
*/
|
||||
level?: Level;
|
||||
}
|
||||
|
||||
/**
|
||||
Return a new Chalk instance.
|
||||
*/
|
||||
type Instance = new (options?: Options) => Chalk;
|
||||
|
||||
/**
|
||||
Detect whether the terminal supports color.
|
||||
*/
|
||||
interface ColorSupport {
|
||||
/**
|
||||
The color level used by Chalk.
|
||||
*/
|
||||
level: Level;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports basic 16 colors.
|
||||
*/
|
||||
hasBasic: boolean;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports ANSI 256 colors.
|
||||
*/
|
||||
has256: boolean;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports Truecolor 16 million colors.
|
||||
*/
|
||||
has16m: boolean;
|
||||
}
|
||||
|
||||
interface ChalkFunction {
|
||||
/**
|
||||
Use a template string.
|
||||
|
||||
@remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341))
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
```
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`)
|
||||
```
|
||||
*/
|
||||
(text: TemplateStringsArray, ...placeholders: unknown[]): string;
|
||||
|
||||
(...text: unknown[]): string;
|
||||
}
|
||||
|
||||
interface Chalk extends ChalkFunction {
|
||||
/**
|
||||
Return a new Chalk instance.
|
||||
*/
|
||||
Instance: Instance;
|
||||
|
||||
/**
|
||||
The color support for Chalk.
|
||||
|
||||
By default, color support is automatically detected based on the environment.
|
||||
|
||||
Levels:
|
||||
- `0` - All colors disabled.
|
||||
- `1` - Basic 16 colors support.
|
||||
- `2` - ANSI 256 colors support.
|
||||
- `3` - Truecolor 16 million colors support.
|
||||
*/
|
||||
level: Level;
|
||||
|
||||
/**
|
||||
Use HEX value to set text color.
|
||||
|
||||
@param color - Hexadecimal value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.hex('#DEADED');
|
||||
```
|
||||
*/
|
||||
hex(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use keyword color value to set text color.
|
||||
|
||||
@param color - Keyword value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.keyword('orange');
|
||||
```
|
||||
*/
|
||||
keyword(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use RGB values to set text color.
|
||||
*/
|
||||
rgb(red: number, green: number, blue: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSL values to set text color.
|
||||
*/
|
||||
hsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSV values to set text color.
|
||||
*/
|
||||
hsv(hue: number, saturation: number, value: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HWB values to set text color.
|
||||
*/
|
||||
hwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
|
||||
|
||||
30 <= code && code < 38 || 90 <= code && code < 98
|
||||
For example, 31 for red, 91 for redBright.
|
||||
*/
|
||||
ansi(code: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||
*/
|
||||
ansi256(index: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HEX value to set background color.
|
||||
|
||||
@param color - Hexadecimal value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.bgHex('#DEADED');
|
||||
```
|
||||
*/
|
||||
bgHex(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use keyword color value to set background color.
|
||||
|
||||
@param color - Keyword value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.bgKeyword('orange');
|
||||
```
|
||||
*/
|
||||
bgKeyword(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use RGB values to set background color.
|
||||
*/
|
||||
bgRgb(red: number, green: number, blue: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSL values to set background color.
|
||||
*/
|
||||
bgHsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSV values to set background color.
|
||||
*/
|
||||
bgHsv(hue: number, saturation: number, value: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HWB values to set background color.
|
||||
*/
|
||||
bgHwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
|
||||
|
||||
30 <= code && code < 38 || 90 <= code && code < 98
|
||||
For example, 31 for red, 91 for redBright.
|
||||
Use the foreground code, not the background code (for example, not 41, nor 101).
|
||||
*/
|
||||
bgAnsi(code: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
|
||||
*/
|
||||
bgAnsi256(index: number): Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Resets the current color chain.
|
||||
*/
|
||||
readonly reset: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text bold.
|
||||
*/
|
||||
readonly bold: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Emitting only a small amount of light.
|
||||
*/
|
||||
readonly dim: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text italic. (Not widely supported)
|
||||
*/
|
||||
readonly italic: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text underline. (Not widely supported)
|
||||
*/
|
||||
readonly underline: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Inverse background and foreground colors.
|
||||
*/
|
||||
readonly inverse: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Prints the text, but makes it invisible.
|
||||
*/
|
||||
readonly hidden: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Puts a horizontal line through the center of the text. (Not widely supported)
|
||||
*/
|
||||
readonly strikethrough: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Prints the text only when Chalk has a color support level > 0.
|
||||
Can be useful for things that are purely cosmetic.
|
||||
*/
|
||||
readonly visible: Chalk;
|
||||
|
||||
readonly black: Chalk;
|
||||
readonly red: Chalk;
|
||||
readonly green: Chalk;
|
||||
readonly yellow: Chalk;
|
||||
readonly blue: Chalk;
|
||||
readonly magenta: Chalk;
|
||||
readonly cyan: Chalk;
|
||||
readonly white: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly gray: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly grey: Chalk;
|
||||
|
||||
readonly blackBright: Chalk;
|
||||
readonly redBright: Chalk;
|
||||
readonly greenBright: Chalk;
|
||||
readonly yellowBright: Chalk;
|
||||
readonly blueBright: Chalk;
|
||||
readonly magentaBright: Chalk;
|
||||
readonly cyanBright: Chalk;
|
||||
readonly whiteBright: Chalk;
|
||||
|
||||
readonly bgBlack: Chalk;
|
||||
readonly bgRed: Chalk;
|
||||
readonly bgGreen: Chalk;
|
||||
readonly bgYellow: Chalk;
|
||||
readonly bgBlue: Chalk;
|
||||
readonly bgMagenta: Chalk;
|
||||
readonly bgCyan: Chalk;
|
||||
readonly bgWhite: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGray: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGrey: Chalk;
|
||||
|
||||
readonly bgBlackBright: Chalk;
|
||||
readonly bgRedBright: Chalk;
|
||||
readonly bgGreenBright: Chalk;
|
||||
readonly bgYellowBright: Chalk;
|
||||
readonly bgBlueBright: Chalk;
|
||||
readonly bgMagentaBright: Chalk;
|
||||
readonly bgCyanBright: Chalk;
|
||||
readonly bgWhiteBright: Chalk;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Main Chalk object that allows to chain styles together.
|
||||
Call the last one as a method with a string argument.
|
||||
Order doesn't matter, and later styles take precedent in case of a conflict.
|
||||
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
*/
|
||||
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
|
||||
supportsColor: chalk.ColorSupport | false;
|
||||
Level: chalk.Level;
|
||||
Color: Color;
|
||||
ForegroundColor: ForegroundColor;
|
||||
BackgroundColor: BackgroundColor;
|
||||
Modifiers: Modifiers;
|
||||
stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false};
|
||||
};
|
||||
|
||||
export = chalk;
|
9
node_modules/cypress/node_modules/chalk/license
generated
vendored
Normal file
9
node_modules/cypress/node_modules/chalk/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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.
|
5
node_modules/cypress/node_modules/chalk/node_modules/supports-color/browser.js
generated
vendored
Normal file
5
node_modules/cypress/node_modules/chalk/node_modules/supports-color/browser.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
stdout: false,
|
||||
stderr: false
|
||||
};
|
135
node_modules/cypress/node_modules/chalk/node_modules/supports-color/index.js
generated
vendored
Normal file
135
node_modules/cypress/node_modules/chalk/node_modules/supports-color/index.js
generated
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
'use strict';
|
||||
const os = require('os');
|
||||
const tty = require('tty');
|
||||
const hasFlag = require('has-flag');
|
||||
|
||||
const {env} = process;
|
||||
|
||||
let forceColor;
|
||||
if (hasFlag('no-color') ||
|
||||
hasFlag('no-colors') ||
|
||||
hasFlag('color=false') ||
|
||||
hasFlag('color=never')) {
|
||||
forceColor = 0;
|
||||
} else if (hasFlag('color') ||
|
||||
hasFlag('colors') ||
|
||||
hasFlag('color=true') ||
|
||||
hasFlag('color=always')) {
|
||||
forceColor = 1;
|
||||
}
|
||||
|
||||
if ('FORCE_COLOR' in env) {
|
||||
if (env.FORCE_COLOR === 'true') {
|
||||
forceColor = 1;
|
||||
} else if (env.FORCE_COLOR === 'false') {
|
||||
forceColor = 0;
|
||||
} else {
|
||||
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
||||
}
|
||||
}
|
||||
|
||||
function translateLevel(level) {
|
||||
if (level === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return {
|
||||
level,
|
||||
hasBasic: true,
|
||||
has256: level >= 2,
|
||||
has16m: level >= 3
|
||||
};
|
||||
}
|
||||
|
||||
function supportsColor(haveStream, streamIsTTY) {
|
||||
if (forceColor === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (hasFlag('color=16m') ||
|
||||
hasFlag('color=full') ||
|
||||
hasFlag('color=truecolor')) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (hasFlag('color=256')) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const min = forceColor || 0;
|
||||
|
||||
if (env.TERM === 'dumb') {
|
||||
return min;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
||||
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
||||
const osRelease = os.release().split('.');
|
||||
if (
|
||||
Number(osRelease[0]) >= 10 &&
|
||||
Number(osRelease[2]) >= 10586
|
||||
) {
|
||||
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ('CI' in env) {
|
||||
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
if ('TEAMCITY_VERSION' in env) {
|
||||
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
||||
}
|
||||
|
||||
if (env.COLORTERM === 'truecolor') {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if ('TERM_PROGRAM' in env) {
|
||||
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
||||
|
||||
switch (env.TERM_PROGRAM) {
|
||||
case 'iTerm.app':
|
||||
return version >= 3 ? 3 : 2;
|
||||
case 'Apple_Terminal':
|
||||
return 2;
|
||||
// No default
|
||||
}
|
||||
}
|
||||
|
||||
if (/-256(color)?$/i.test(env.TERM)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ('COLORTERM' in env) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
function getSupportLevel(stream) {
|
||||
const level = supportsColor(stream, stream && stream.isTTY);
|
||||
return translateLevel(level);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
supportsColor: getSupportLevel,
|
||||
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
||||
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
||||
};
|
9
node_modules/cypress/node_modules/chalk/node_modules/supports-color/license
generated
vendored
Normal file
9
node_modules/cypress/node_modules/chalk/node_modules/supports-color/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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.
|
53
node_modules/cypress/node_modules/chalk/node_modules/supports-color/package.json
generated
vendored
Normal file
53
node_modules/cypress/node_modules/chalk/node_modules/supports-color/package.json
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "supports-color",
|
||||
"version": "7.2.0",
|
||||
"description": "Detect whether a terminal supports color",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/supports-color",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"browser.js"
|
||||
],
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"ansi",
|
||||
"styles",
|
||||
"tty",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"support",
|
||||
"supports",
|
||||
"capability",
|
||||
"detect",
|
||||
"truecolor",
|
||||
"16m"
|
||||
],
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"import-fresh": "^3.0.0",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"browser": "browser.js"
|
||||
}
|
76
node_modules/cypress/node_modules/chalk/node_modules/supports-color/readme.md
generated
vendored
Normal file
76
node_modules/cypress/node_modules/chalk/node_modules/supports-color/readme.md
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
# supports-color [](https://travis-ci.org/chalk/supports-color)
|
||||
|
||||
> Detect whether a terminal supports color
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install supports-color
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const supportsColor = require('supports-color');
|
||||
|
||||
if (supportsColor.stdout) {
|
||||
console.log('Terminal stdout supports color');
|
||||
}
|
||||
|
||||
if (supportsColor.stdout.has256) {
|
||||
console.log('Terminal stdout supports 256 colors');
|
||||
}
|
||||
|
||||
if (supportsColor.stderr.has16m) {
|
||||
console.log('Terminal stderr supports 16 million colors (truecolor)');
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
|
||||
|
||||
The `stdout`/`stderr` objects 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`: Truecolor support (16 million colors)
|
||||
|
||||
|
||||
## Info
|
||||
|
||||
It obeys the `--color` and `--no-color` CLI flags.
|
||||
|
||||
For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
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
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-supports-color?utm_source=npm-supports-color&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
---
|
68
node_modules/cypress/node_modules/chalk/package.json
generated
vendored
Normal file
68
node_modules/cypress/node_modules/chalk/package.json
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"name": "chalk",
|
||||
"version": "4.1.2",
|
||||
"description": "Terminal string styling done right",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/chalk",
|
||||
"funding": "https://github.com/chalk/chalk?sponsor=1",
|
||||
"main": "source",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava && tsd",
|
||||
"bench": "matcha benchmark.js"
|
||||
},
|
||||
"files": [
|
||||
"source",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"str",
|
||||
"ansi",
|
||||
"style",
|
||||
"styles",
|
||||
"tty",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"coveralls": "^3.0.7",
|
||||
"execa": "^4.0.0",
|
||||
"import-fresh": "^3.1.0",
|
||||
"matcha": "^0.7.0",
|
||||
"nyc": "^15.0.0",
|
||||
"resolve-from": "^5.0.0",
|
||||
"tsd": "^0.7.4",
|
||||
"xo": "^0.28.2"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"unicorn/prefer-string-slice": "off",
|
||||
"unicorn/prefer-includes": "off",
|
||||
"@typescript-eslint/member-ordering": "off",
|
||||
"no-redeclare": "off",
|
||||
"unicorn/string-content": "off",
|
||||
"unicorn/better-regex": "off"
|
||||
}
|
||||
}
|
||||
}
|
341
node_modules/cypress/node_modules/chalk/readme.md
generated
vendored
Normal file
341
node_modules/cypress/node_modules/chalk/readme.md
generated
vendored
Normal file
@@ -0,0 +1,341 @@
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img width="320" src="media/logo.svg" alt="Chalk">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
> Terminal string styling done right
|
||||
|
||||
[](https://travis-ci.org/chalk/chalk) [](https://coveralls.io/github/chalk/chalk?branch=master) [](https://www.npmjs.com/package/chalk?activeTab=dependents) [](https://www.npmjs.com/package/chalk) [](https://www.youtube.com/watch?v=9auOCbH5Ns4) [](https://github.com/xojs/xo)  [](https://repl.it/github/chalk/chalk)
|
||||
|
||||
<img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||
|
||||
<br>
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<p>
|
||||
<p>
|
||||
<sup>
|
||||
Sindre Sorhus' open source work is supported by the community on <a href="https://github.com/sponsors/sindresorhus">GitHub Sponsors</a> and <a href="https://stakes.social/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15">Dev</a>
|
||||
</sup>
|
||||
</p>
|
||||
<sup>Special thanks to:</sup>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://standardresume.co/tech">
|
||||
<img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="160"/>
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://retool.com/?utm_campaign=sindresorhus">
|
||||
<img src="https://sindresorhus.com/assets/thanks/retool-logo.svg" width="230"/>
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://doppler.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=chalk&utm_source=github">
|
||||
<div>
|
||||
<img src="https://dashboard.doppler.com/imgs/logo-long.svg" width="240" alt="Doppler">
|
||||
</div>
|
||||
<b>All your environment variables, in one place</b>
|
||||
<div>
|
||||
<span>Stop struggling with scattered API keys, hacking together home-brewed tools,</span>
|
||||
<br>
|
||||
<span>and avoiding access controls. Keep your team and servers in sync with Doppler.</span>
|
||||
</div>
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://uibakery.io/?utm_source=chalk&utm_medium=sponsor&utm_campaign=github">
|
||||
<div>
|
||||
<img src="https://sindresorhus.com/assets/thanks/uibakery-logo.jpg" width="270" alt="UI Bakery">
|
||||
</div>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
<br>
|
||||
|
||||
## Highlights
|
||||
|
||||
- Expressive API
|
||||
- Highly performant
|
||||
- Ability to nest styles
|
||||
- [256/Truecolor color support](#256-and-truecolor-color-support)
|
||||
- Auto-detects color support
|
||||
- Doesn't extend `String.prototype`
|
||||
- Clean and focused
|
||||
- Actively maintained
|
||||
- [Used by ~50,000 packages](https://www.npmjs.com/browse/depended/chalk) as of January 1, 2020
|
||||
|
||||
## Install
|
||||
|
||||
```console
|
||||
$ npm install chalk
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
console.log(chalk.blue('Hello world!'));
|
||||
```
|
||||
|
||||
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
const log = console.log;
|
||||
|
||||
// Combine styled and normal strings
|
||||
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
|
||||
|
||||
// Compose multiple styles using the chainable API
|
||||
log(chalk.blue.bgRed.bold('Hello world!'));
|
||||
|
||||
// Pass in multiple arguments
|
||||
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
|
||||
|
||||
// Nest styles
|
||||
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
|
||||
|
||||
// Nest styles of the same type even (color, underline, background)
|
||||
log(chalk.green(
|
||||
'I am a green line ' +
|
||||
chalk.blue.underline.bold('with a blue substring') +
|
||||
' that becomes green again!'
|
||||
));
|
||||
|
||||
// ES2015 template literal
|
||||
log(`
|
||||
CPU: ${chalk.red('90%')}
|
||||
RAM: ${chalk.green('40%')}
|
||||
DISK: ${chalk.yellow('70%')}
|
||||
`);
|
||||
|
||||
// ES2015 tagged template literal
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
|
||||
// Use RGB colors in terminal emulators that support it.
|
||||
log(chalk.keyword('orange')('Yay for orange colored text!'));
|
||||
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
|
||||
log(chalk.hex('#DEADED').bold('Bold gray!'));
|
||||
```
|
||||
|
||||
Easily define your own themes:
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const error = chalk.bold.red;
|
||||
const warning = chalk.keyword('orange');
|
||||
|
||||
console.log(error('Error!'));
|
||||
console.log(warning('Warning!'));
|
||||
```
|
||||
|
||||
Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
|
||||
|
||||
```js
|
||||
const name = 'Sindre';
|
||||
console.log(chalk.green('Hello %s'), name);
|
||||
//=> 'Hello Sindre'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### chalk.`<style>[.<style>...](string, [string...])`
|
||||
|
||||
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||
|
||||
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
|
||||
Multiple arguments will be separated by space.
|
||||
|
||||
### chalk.level
|
||||
|
||||
Specifies the level of color support.
|
||||
|
||||
Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
|
||||
|
||||
If you need to change this in a reusable module, create a new instance:
|
||||
|
||||
```js
|
||||
const ctx = new chalk.Instance({level: 0});
|
||||
```
|
||||
|
||||
| Level | Description |
|
||||
| :---: | :--- |
|
||||
| `0` | All colors disabled |
|
||||
| `1` | Basic color support (16 colors) |
|
||||
| `2` | 256 color support |
|
||||
| `3` | Truecolor support (16 million colors) |
|
||||
|
||||
### chalk.supportsColor
|
||||
|
||||
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
||||
|
||||
### chalk.stderr and chalk.stderr.supportsColor
|
||||
|
||||
`chalk.stderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `chalk.supportsColor` apply to this too. `chalk.stderr.supportsColor` is exposed for convenience.
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset` - Resets the current color chain.
|
||||
- `bold` - Make text bold.
|
||||
- `dim` - Emitting only a small amount of light.
|
||||
- `italic` - Make text italic. *(Not widely supported)*
|
||||
- `underline` - Make text underline. *(Not widely supported)*
|
||||
- `inverse`- Inverse background and foreground colors.
|
||||
- `hidden` - Prints the text, but makes it invisible.
|
||||
- `strikethrough` - Puts a horizontal line through the center of the text. *(Not widely supported)*
|
||||
- `visible`- Prints the text only when Chalk has a color level > 0. Can be useful for things that are purely cosmetic.
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `blackBright` (alias: `gray`, `grey`)
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
## Tagged template literal
|
||||
|
||||
Chalk can be used as a [tagged template literal](https://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const miles = 18;
|
||||
const calculateFeet = miles => miles * 5280;
|
||||
|
||||
console.log(chalk`
|
||||
There are {bold 5280 feet} in a mile.
|
||||
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
|
||||
`);
|
||||
```
|
||||
|
||||
Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
|
||||
|
||||
Template styles are chained exactly like normal Chalk styles. The following three statements are equivalent:
|
||||
|
||||
```js
|
||||
console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
|
||||
console.log(chalk.bold.rgb(10, 100, 200)`Hello!`);
|
||||
console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
|
||||
```
|
||||
|
||||
Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
|
||||
|
||||
All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
|
||||
|
||||
## 256 and Truecolor color support
|
||||
|
||||
Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
|
||||
|
||||
Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
|
||||
|
||||
Examples:
|
||||
|
||||
- `chalk.hex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.keyword('orange')('Some orange text')`
|
||||
- `chalk.rgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
|
||||
|
||||
- `chalk.bgHex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.bgKeyword('orange')('Some orange text')`
|
||||
- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
The following color models can be used:
|
||||
|
||||
- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
|
||||
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
|
||||
- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
|
||||
- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
|
||||
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
|
||||
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
|
||||
- [`ansi`](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) - Example: `chalk.ansi(31).bgAnsi(93)('red on yellowBright')`
|
||||
- [`ansi256`](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) - Example: `chalk.bgAnsi256(194)('Honeydew, more or less')`
|
||||
|
||||
## Windows
|
||||
|
||||
If you're on Windows, do yourself a favor and use [Windows Terminal](https://github.com/microsoft/terminal) instead of `cmd.exe`.
|
||||
|
||||
## Origin story
|
||||
|
||||
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
|
||||
|
||||
## chalk for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of chalk and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-chalk?utm_source=npm-chalk&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
## Related
|
||||
|
||||
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
|
||||
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
|
||||
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
|
||||
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
|
||||
- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
|
||||
- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
|
||||
- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
|
||||
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
|
||||
- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
229
node_modules/cypress/node_modules/chalk/source/index.js
generated
vendored
Normal file
229
node_modules/cypress/node_modules/chalk/source/index.js
generated
vendored
Normal file
@@ -0,0 +1,229 @@
|
||||
'use strict';
|
||||
const ansiStyles = require('ansi-styles');
|
||||
const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');
|
||||
const {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
} = require('./util');
|
||||
|
||||
const {isArray} = Array;
|
||||
|
||||
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
||||
const levelMapping = [
|
||||
'ansi',
|
||||
'ansi',
|
||||
'ansi256',
|
||||
'ansi16m'
|
||||
];
|
||||
|
||||
const styles = Object.create(null);
|
||||
|
||||
const applyOptions = (object, options = {}) => {
|
||||
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
||||
throw new Error('The `level` option should be an integer from 0 to 3');
|
||||
}
|
||||
|
||||
// Detect level if not set manually
|
||||
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
||||
object.level = options.level === undefined ? colorLevel : options.level;
|
||||
};
|
||||
|
||||
class ChalkClass {
|
||||
constructor(options) {
|
||||
// eslint-disable-next-line no-constructor-return
|
||||
return chalkFactory(options);
|
||||
}
|
||||
}
|
||||
|
||||
const chalkFactory = options => {
|
||||
const chalk = {};
|
||||
applyOptions(chalk, options);
|
||||
|
||||
chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
|
||||
|
||||
Object.setPrototypeOf(chalk, Chalk.prototype);
|
||||
Object.setPrototypeOf(chalk.template, chalk);
|
||||
|
||||
chalk.template.constructor = () => {
|
||||
throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
|
||||
};
|
||||
|
||||
chalk.template.Instance = ChalkClass;
|
||||
|
||||
return chalk.template;
|
||||
};
|
||||
|
||||
function Chalk(options) {
|
||||
return chalkFactory(options);
|
||||
}
|
||||
|
||||
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
||||
styles[styleName] = {
|
||||
get() {
|
||||
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
||||
Object.defineProperty(this, styleName, {value: builder});
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
styles.visible = {
|
||||
get() {
|
||||
const builder = createBuilder(this, this._styler, true);
|
||||
Object.defineProperty(this, 'visible', {value: builder});
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
|
||||
const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
|
||||
|
||||
for (const model of usedModels) {
|
||||
styles[model] = {
|
||||
get() {
|
||||
const {level} = this;
|
||||
return function (...arguments_) {
|
||||
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
||||
return createBuilder(this, styler, this._isEmpty);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
for (const model of usedModels) {
|
||||
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
||||
styles[bgModel] = {
|
||||
get() {
|
||||
const {level} = this;
|
||||
return function (...arguments_) {
|
||||
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
||||
return createBuilder(this, styler, this._isEmpty);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const proto = Object.defineProperties(() => {}, {
|
||||
...styles,
|
||||
level: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
return this._generator.level;
|
||||
},
|
||||
set(level) {
|
||||
this._generator.level = level;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const createStyler = (open, close, parent) => {
|
||||
let openAll;
|
||||
let closeAll;
|
||||
if (parent === undefined) {
|
||||
openAll = open;
|
||||
closeAll = close;
|
||||
} else {
|
||||
openAll = parent.openAll + open;
|
||||
closeAll = close + parent.closeAll;
|
||||
}
|
||||
|
||||
return {
|
||||
open,
|
||||
close,
|
||||
openAll,
|
||||
closeAll,
|
||||
parent
|
||||
};
|
||||
};
|
||||
|
||||
const createBuilder = (self, _styler, _isEmpty) => {
|
||||
const builder = (...arguments_) => {
|
||||
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
||||
// Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
|
||||
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
||||
}
|
||||
|
||||
// Single argument is hot path, implicit coercion is faster than anything
|
||||
// eslint-disable-next-line no-implicit-coercion
|
||||
return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
||||
};
|
||||
|
||||
// We alter the prototype because we must return a function, but there is
|
||||
// no way to create a function with a different prototype
|
||||
Object.setPrototypeOf(builder, proto);
|
||||
|
||||
builder._generator = self;
|
||||
builder._styler = _styler;
|
||||
builder._isEmpty = _isEmpty;
|
||||
|
||||
return builder;
|
||||
};
|
||||
|
||||
const applyStyle = (self, string) => {
|
||||
if (self.level <= 0 || !string) {
|
||||
return self._isEmpty ? '' : string;
|
||||
}
|
||||
|
||||
let styler = self._styler;
|
||||
|
||||
if (styler === undefined) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const {openAll, closeAll} = styler;
|
||||
if (string.indexOf('\u001B') !== -1) {
|
||||
while (styler !== undefined) {
|
||||
// Replace any instances already present with a re-opening code
|
||||
// otherwise only the part of the string until said closing code
|
||||
// will be colored, and the rest will simply be 'plain'.
|
||||
string = stringReplaceAll(string, styler.close, styler.open);
|
||||
|
||||
styler = styler.parent;
|
||||
}
|
||||
}
|
||||
|
||||
// We can move both next actions out of loop, because remaining actions in loop won't have
|
||||
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
|
||||
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
|
||||
const lfIndex = string.indexOf('\n');
|
||||
if (lfIndex !== -1) {
|
||||
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
||||
}
|
||||
|
||||
return openAll + string + closeAll;
|
||||
};
|
||||
|
||||
let template;
|
||||
const chalkTag = (chalk, ...strings) => {
|
||||
const [firstString] = strings;
|
||||
|
||||
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
||||
// If chalk() was called by itself or with a string,
|
||||
// return the string itself as a string.
|
||||
return strings.join(' ');
|
||||
}
|
||||
|
||||
const arguments_ = strings.slice(1);
|
||||
const parts = [firstString.raw[0]];
|
||||
|
||||
for (let i = 1; i < firstString.length; i++) {
|
||||
parts.push(
|
||||
String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
|
||||
String(firstString.raw[i])
|
||||
);
|
||||
}
|
||||
|
||||
if (template === undefined) {
|
||||
template = require('./templates');
|
||||
}
|
||||
|
||||
return template(chalk, parts.join(''));
|
||||
};
|
||||
|
||||
Object.defineProperties(Chalk.prototype, styles);
|
||||
|
||||
const chalk = Chalk(); // eslint-disable-line new-cap
|
||||
chalk.supportsColor = stdoutColor;
|
||||
chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
|
||||
chalk.stderr.supportsColor = stderrColor;
|
||||
|
||||
module.exports = chalk;
|
134
node_modules/cypress/node_modules/chalk/source/templates.js
generated
vendored
Normal file
134
node_modules/cypress/node_modules/chalk/source/templates.js
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
'use strict';
|
||||
const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
||||
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
||||
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
||||
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
|
||||
|
||||
const ESCAPES = new Map([
|
||||
['n', '\n'],
|
||||
['r', '\r'],
|
||||
['t', '\t'],
|
||||
['b', '\b'],
|
||||
['f', '\f'],
|
||||
['v', '\v'],
|
||||
['0', '\0'],
|
||||
['\\', '\\'],
|
||||
['e', '\u001B'],
|
||||
['a', '\u0007']
|
||||
]);
|
||||
|
||||
function unescape(c) {
|
||||
const u = c[0] === 'u';
|
||||
const bracket = c[1] === '{';
|
||||
|
||||
if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
|
||||
return String.fromCharCode(parseInt(c.slice(1), 16));
|
||||
}
|
||||
|
||||
if (u && bracket) {
|
||||
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
||||
}
|
||||
|
||||
return ESCAPES.get(c) || c;
|
||||
}
|
||||
|
||||
function parseArguments(name, arguments_) {
|
||||
const results = [];
|
||||
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
||||
let matches;
|
||||
|
||||
for (const chunk of chunks) {
|
||||
const number = Number(chunk);
|
||||
if (!Number.isNaN(number)) {
|
||||
results.push(number);
|
||||
} else if ((matches = chunk.match(STRING_REGEX))) {
|
||||
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
||||
} else {
|
||||
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function parseStyle(style) {
|
||||
STYLE_REGEX.lastIndex = 0;
|
||||
|
||||
const results = [];
|
||||
let matches;
|
||||
|
||||
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
||||
const name = matches[1];
|
||||
|
||||
if (matches[2]) {
|
||||
const args = parseArguments(name, matches[2]);
|
||||
results.push([name].concat(args));
|
||||
} else {
|
||||
results.push([name]);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function buildStyle(chalk, styles) {
|
||||
const enabled = {};
|
||||
|
||||
for (const layer of styles) {
|
||||
for (const style of layer.styles) {
|
||||
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
let current = chalk;
|
||||
for (const [styleName, styles] of Object.entries(enabled)) {
|
||||
if (!Array.isArray(styles)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(styleName in current)) {
|
||||
throw new Error(`Unknown Chalk style: ${styleName}`);
|
||||
}
|
||||
|
||||
current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
module.exports = (chalk, temporary) => {
|
||||
const styles = [];
|
||||
const chunks = [];
|
||||
let chunk = [];
|
||||
|
||||
// eslint-disable-next-line max-params
|
||||
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
||||
if (escapeCharacter) {
|
||||
chunk.push(unescape(escapeCharacter));
|
||||
} else if (style) {
|
||||
const string = chunk.join('');
|
||||
chunk = [];
|
||||
chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
|
||||
styles.push({inverse, styles: parseStyle(style)});
|
||||
} else if (close) {
|
||||
if (styles.length === 0) {
|
||||
throw new Error('Found extraneous } in Chalk template literal');
|
||||
}
|
||||
|
||||
chunks.push(buildStyle(chalk, styles)(chunk.join('')));
|
||||
chunk = [];
|
||||
styles.pop();
|
||||
} else {
|
||||
chunk.push(character);
|
||||
}
|
||||
});
|
||||
|
||||
chunks.push(chunk.join(''));
|
||||
|
||||
if (styles.length > 0) {
|
||||
const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
|
||||
throw new Error(errMessage);
|
||||
}
|
||||
|
||||
return chunks.join('');
|
||||
};
|
39
node_modules/cypress/node_modules/chalk/source/util.js
generated
vendored
Normal file
39
node_modules/cypress/node_modules/chalk/source/util.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
const stringReplaceAll = (string, substring, replacer) => {
|
||||
let index = string.indexOf(substring);
|
||||
if (index === -1) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const substringLength = substring.length;
|
||||
let endIndex = 0;
|
||||
let returnValue = '';
|
||||
do {
|
||||
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
||||
endIndex = index + substringLength;
|
||||
index = string.indexOf(substring, endIndex);
|
||||
} while (index !== -1);
|
||||
|
||||
returnValue += string.substr(endIndex);
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
|
||||
let endIndex = 0;
|
||||
let returnValue = '';
|
||||
do {
|
||||
const gotCR = string[index - 1] === '\r';
|
||||
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
|
||||
endIndex = index + 1;
|
||||
index = string.indexOf('\n', endIndex);
|
||||
} while (index !== -1);
|
||||
|
||||
returnValue += string.substr(endIndex);
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
};
|
19
node_modules/cypress/node_modules/debug/LICENSE
generated
vendored
Normal file
19
node_modules/cypress/node_modules/debug/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the 'Software'), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
455
node_modules/cypress/node_modules/debug/README.md
generated
vendored
Normal file
455
node_modules/cypress/node_modules/debug/README.md
generated
vendored
Normal file
@@ -0,0 +1,455 @@
|
||||
# debug
|
||||
[](https://travis-ci.org/visionmedia/debug) [](https://coveralls.io/github/visionmedia/debug?branch=master) [](https://visionmedia-community-slackin.now.sh/) [](#backers)
|
||||
[](#sponsors)
|
||||
|
||||
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
|
||||
|
||||
A tiny JavaScript debugging utility modelled after Node.js core's debugging
|
||||
technique. Works in Node.js and web browsers.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install debug
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
|
||||
|
||||
Example [_app.js_](./examples/node/app.js):
|
||||
|
||||
```js
|
||||
var debug = require('debug')('http')
|
||||
, http = require('http')
|
||||
, name = 'My App';
|
||||
|
||||
// fake app
|
||||
|
||||
debug('booting %o', name);
|
||||
|
||||
http.createServer(function(req, res){
|
||||
debug(req.method + ' ' + req.url);
|
||||
res.end('hello\n');
|
||||
}).listen(3000, function(){
|
||||
debug('listening');
|
||||
});
|
||||
|
||||
// fake worker of some kind
|
||||
|
||||
require('./worker');
|
||||
```
|
||||
|
||||
Example [_worker.js_](./examples/node/worker.js):
|
||||
|
||||
```js
|
||||
var a = require('debug')('worker:a')
|
||||
, b = require('debug')('worker:b');
|
||||
|
||||
function work() {
|
||||
a('doing lots of uninteresting work');
|
||||
setTimeout(work, Math.random() * 1000);
|
||||
}
|
||||
|
||||
work();
|
||||
|
||||
function workb() {
|
||||
b('doing some work');
|
||||
setTimeout(workb, Math.random() * 2000);
|
||||
}
|
||||
|
||||
workb();
|
||||
```
|
||||
|
||||
The `DEBUG` environment variable is then used to enable these based on space or
|
||||
comma-delimited names.
|
||||
|
||||
Here are some examples:
|
||||
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png">
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
|
||||
|
||||
#### Windows command prompt notes
|
||||
|
||||
##### CMD
|
||||
|
||||
On Windows the environment variable is set using the `set` command.
|
||||
|
||||
```cmd
|
||||
set DEBUG=*,-not_this
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```cmd
|
||||
set DEBUG=* & node app.js
|
||||
```
|
||||
|
||||
##### PowerShell (VS Code default)
|
||||
|
||||
PowerShell uses different syntax to set environment variables.
|
||||
|
||||
```cmd
|
||||
$env:DEBUG = "*,-not_this"
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```cmd
|
||||
$env:DEBUG='app';node app.js
|
||||
```
|
||||
|
||||
Then, run the program to be debugged as usual.
|
||||
|
||||
npm script example:
|
||||
```js
|
||||
"windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
|
||||
```
|
||||
|
||||
## Namespace Colors
|
||||
|
||||
Every debug instance has a color generated for it based on its namespace name.
|
||||
This helps when visually parsing the debug output to identify which debug instance
|
||||
a debug line belongs to.
|
||||
|
||||
#### Node.js
|
||||
|
||||
In Node.js, colors are enabled when stderr is a TTY. You also _should_ install
|
||||
the [`supports-color`](https://npmjs.org/supports-color) module alongside debug,
|
||||
otherwise debug will only use a small handful of basic colors.
|
||||
|
||||
<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png">
|
||||
|
||||
#### Web Browser
|
||||
|
||||
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||
option. These are WebKit web inspectors, Firefox ([since version
|
||||
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||
and the Firebug plugin for Firefox (any version).
|
||||
|
||||
<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png">
|
||||
|
||||
|
||||
## Millisecond diff
|
||||
|
||||
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||
|
||||
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
|
||||
|
||||
When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:
|
||||
|
||||
<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png">
|
||||
|
||||
|
||||
## Conventions
|
||||
|
||||
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
|
||||
|
||||
## Wildcards
|
||||
|
||||
The `*` character may be used as a wildcard. Suppose for example your library has
|
||||
debuggers named "connect:bodyParser", "connect:compress", "connect:session",
|
||||
instead of listing all three with
|
||||
`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
|
||||
`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||
|
||||
You can also exclude specific debuggers by prefixing them with a "-" character.
|
||||
For example, `DEBUG=*,-connect:*` would include all debuggers except those
|
||||
starting with "connect:".
|
||||
|
||||
## Environment Variables
|
||||
|
||||
When running through Node.js, you can set a few environment variables that will
|
||||
change the behavior of the debug logging:
|
||||
|
||||
| Name | Purpose |
|
||||
|-----------|-------------------------------------------------|
|
||||
| `DEBUG` | Enables/disables specific debugging namespaces. |
|
||||
| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |
|
||||
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
|
||||
| `DEBUG_DEPTH` | Object inspection depth. |
|
||||
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
|
||||
|
||||
|
||||
__Note:__ The environment variables beginning with `DEBUG_` end up being
|
||||
converted into an Options object that gets used with `%o`/`%O` formatters.
|
||||
See the Node.js documentation for
|
||||
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||
for the complete list.
|
||||
|
||||
## Formatters
|
||||
|
||||
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.
|
||||
Below are the officially supported formatters:
|
||||
|
||||
| Formatter | Representation |
|
||||
|-----------|----------------|
|
||||
| `%O` | Pretty-print an Object on multiple lines. |
|
||||
| `%o` | Pretty-print an Object all on a single line. |
|
||||
| `%s` | String. |
|
||||
| `%d` | Number (both integer and float). |
|
||||
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
|
||||
| `%%` | Single percent sign ('%'). This does not consume an argument. |
|
||||
|
||||
|
||||
### Custom formatters
|
||||
|
||||
You can add custom formatters by extending the `debug.formatters` object.
|
||||
For example, if you wanted to add support for rendering a Buffer as hex with
|
||||
`%h`, you could do something like:
|
||||
|
||||
```js
|
||||
const createDebug = require('debug')
|
||||
createDebug.formatters.h = (v) => {
|
||||
return v.toString('hex')
|
||||
}
|
||||
|
||||
// …elsewhere
|
||||
const debug = createDebug('foo')
|
||||
debug('this is hex: %h', new Buffer('hello world'))
|
||||
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
|
||||
```
|
||||
|
||||
|
||||
## Browser Support
|
||||
|
||||
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
|
||||
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
|
||||
if you don't want to build it yourself.
|
||||
|
||||
Debug's enable state is currently persisted by `localStorage`.
|
||||
Consider the situation shown below where you have `worker:a` and `worker:b`,
|
||||
and wish to debug both. You can enable this using `localStorage.debug`:
|
||||
|
||||
```js
|
||||
localStorage.debug = 'worker:*'
|
||||
```
|
||||
|
||||
And then refresh the page.
|
||||
|
||||
```js
|
||||
a = debug('worker:a');
|
||||
b = debug('worker:b');
|
||||
|
||||
setInterval(function(){
|
||||
a('doing some work');
|
||||
}, 1000);
|
||||
|
||||
setInterval(function(){
|
||||
b('doing some work');
|
||||
}, 1200);
|
||||
```
|
||||
|
||||
|
||||
## Output streams
|
||||
|
||||
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
|
||||
|
||||
Example [_stdout.js_](./examples/node/stdout.js):
|
||||
|
||||
```js
|
||||
var debug = require('debug');
|
||||
var error = debug('app:error');
|
||||
|
||||
// by default stderr is used
|
||||
error('goes to stderr!');
|
||||
|
||||
var log = debug('app:log');
|
||||
// set this namespace to log via console.log
|
||||
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||
log('goes to stdout');
|
||||
error('still goes to stderr!');
|
||||
|
||||
// set all output to go via console.info
|
||||
// overrides all per-namespace log settings
|
||||
debug.log = console.info.bind(console);
|
||||
error('now goes to stdout via console.info');
|
||||
log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
## Extend
|
||||
You can simply extend debugger
|
||||
```js
|
||||
const log = require('debug')('auth');
|
||||
|
||||
//creates new debug instance with extended namespace
|
||||
const logSign = log.extend('sign');
|
||||
const logLogin = log.extend('login');
|
||||
|
||||
log('hello'); // auth hello
|
||||
logSign('hello'); //auth:sign hello
|
||||
logLogin('hello'); //auth:login hello
|
||||
```
|
||||
|
||||
## Set dynamically
|
||||
|
||||
You can also enable debug dynamically by calling the `enable()` method :
|
||||
|
||||
```js
|
||||
let debug = require('debug');
|
||||
|
||||
console.log(1, debug.enabled('test'));
|
||||
|
||||
debug.enable('test');
|
||||
console.log(2, debug.enabled('test'));
|
||||
|
||||
debug.disable();
|
||||
console.log(3, debug.enabled('test'));
|
||||
|
||||
```
|
||||
|
||||
print :
|
||||
```
|
||||
1 false
|
||||
2 true
|
||||
3 false
|
||||
```
|
||||
|
||||
Usage :
|
||||
`enable(namespaces)`
|
||||
`namespaces` can include modes separated by a colon and wildcards.
|
||||
|
||||
Note that calling `enable()` completely overrides previously set DEBUG variable :
|
||||
|
||||
```
|
||||
$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
|
||||
=> false
|
||||
```
|
||||
|
||||
`disable()`
|
||||
|
||||
Will disable all namespaces. The functions returns the namespaces currently
|
||||
enabled (and skipped). This can be useful if you want to disable debugging
|
||||
temporarily without knowing what was enabled to begin with.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
let debug = require('debug');
|
||||
debug.enable('foo:*,-foo:bar');
|
||||
let namespaces = debug.disable();
|
||||
debug.enable(namespaces);
|
||||
```
|
||||
|
||||
Note: There is no guarantee that the string will be identical to the initial
|
||||
enable string, but semantically they will be identical.
|
||||
|
||||
## Checking whether a debug target is enabled
|
||||
|
||||
After you've created a debug instance, you can determine whether or not it is
|
||||
enabled by checking the `enabled` property:
|
||||
|
||||
```javascript
|
||||
const debug = require('debug')('http');
|
||||
|
||||
if (debug.enabled) {
|
||||
// do stuff...
|
||||
}
|
||||
```
|
||||
|
||||
You can also manually toggle this property to force the debug instance to be
|
||||
enabled or disabled.
|
||||
|
||||
|
||||
## Authors
|
||||
|
||||
- TJ Holowaychuk
|
||||
- Nathan Rajlich
|
||||
- Andrew Rhyne
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
|
||||
|
||||
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
59
node_modules/cypress/node_modules/debug/package.json
generated
vendored
Normal file
59
node_modules/cypress/node_modules/debug/package.json
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"name": "debug",
|
||||
"version": "4.3.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/debug.git"
|
||||
},
|
||||
"description": "small debugging utility",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"files": [
|
||||
"src",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"contributors": [
|
||||
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
|
||||
"Andrew Rhyne <rhyneandrew@gmail.com>",
|
||||
"Josh Junon <josh@junon.me>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"lint": "xo",
|
||||
"test": "npm run test:node && npm run test:browser && npm run lint",
|
||||
"test:node": "istanbul cover _mocha -- test.js",
|
||||
"test:browser": "karma start --single-run",
|
||||
"test:coverage": "cat ./coverage/lcov.info | coveralls"
|
||||
},
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"brfs": "^2.0.1",
|
||||
"browserify": "^16.2.3",
|
||||
"coveralls": "^3.0.2",
|
||||
"istanbul": "^0.4.5",
|
||||
"karma": "^3.1.4",
|
||||
"karma-browserify": "^6.0.0",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"mocha": "^5.2.0",
|
||||
"mocha-lcov-reporter": "^1.2.0",
|
||||
"xo": "^0.23.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"main": "./src/index.js",
|
||||
"browser": "./src/browser.js",
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
}
|
||||
}
|
269
node_modules/cypress/node_modules/debug/src/browser.js
generated
vendored
Normal file
269
node_modules/cypress/node_modules/debug/src/browser.js
generated
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
/* eslint-env browser */
|
||||
|
||||
/**
|
||||
* This is the web browser implementation of `debug()`.
|
||||
*/
|
||||
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
exports.storage = localstorage();
|
||||
exports.destroy = (() => {
|
||||
let warned = false;
|
||||
|
||||
return () => {
|
||||
if (!warned) {
|
||||
warned = true;
|
||||
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [
|
||||
'#0000CC',
|
||||
'#0000FF',
|
||||
'#0033CC',
|
||||
'#0033FF',
|
||||
'#0066CC',
|
||||
'#0066FF',
|
||||
'#0099CC',
|
||||
'#0099FF',
|
||||
'#00CC00',
|
||||
'#00CC33',
|
||||
'#00CC66',
|
||||
'#00CC99',
|
||||
'#00CCCC',
|
||||
'#00CCFF',
|
||||
'#3300CC',
|
||||
'#3300FF',
|
||||
'#3333CC',
|
||||
'#3333FF',
|
||||
'#3366CC',
|
||||
'#3366FF',
|
||||
'#3399CC',
|
||||
'#3399FF',
|
||||
'#33CC00',
|
||||
'#33CC33',
|
||||
'#33CC66',
|
||||
'#33CC99',
|
||||
'#33CCCC',
|
||||
'#33CCFF',
|
||||
'#6600CC',
|
||||
'#6600FF',
|
||||
'#6633CC',
|
||||
'#6633FF',
|
||||
'#66CC00',
|
||||
'#66CC33',
|
||||
'#9900CC',
|
||||
'#9900FF',
|
||||
'#9933CC',
|
||||
'#9933FF',
|
||||
'#99CC00',
|
||||
'#99CC33',
|
||||
'#CC0000',
|
||||
'#CC0033',
|
||||
'#CC0066',
|
||||
'#CC0099',
|
||||
'#CC00CC',
|
||||
'#CC00FF',
|
||||
'#CC3300',
|
||||
'#CC3333',
|
||||
'#CC3366',
|
||||
'#CC3399',
|
||||
'#CC33CC',
|
||||
'#CC33FF',
|
||||
'#CC6600',
|
||||
'#CC6633',
|
||||
'#CC9900',
|
||||
'#CC9933',
|
||||
'#CCCC00',
|
||||
'#CCCC33',
|
||||
'#FF0000',
|
||||
'#FF0033',
|
||||
'#FF0066',
|
||||
'#FF0099',
|
||||
'#FF00CC',
|
||||
'#FF00FF',
|
||||
'#FF3300',
|
||||
'#FF3333',
|
||||
'#FF3366',
|
||||
'#FF3399',
|
||||
'#FF33CC',
|
||||
'#FF33FF',
|
||||
'#FF6600',
|
||||
'#FF6633',
|
||||
'#FF9900',
|
||||
'#FF9933',
|
||||
'#FFCC00',
|
||||
'#FFCC33'
|
||||
];
|
||||
|
||||
/**
|
||||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||
* and the Firebug extension (any Firefox version) are known
|
||||
* to support "%c" CSS customizations.
|
||||
*
|
||||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function useColors() {
|
||||
// NB: In an Electron preload script, document will be defined but not fully
|
||||
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||||
// explicitly
|
||||
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Internet Explorer and Edge do not support colors.
|
||||
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||||
// Is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||||
// Is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
||||
// Double check webkit in userAgent just in case we are in a worker
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||||
}
|
||||
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
args[0] = (this.useColors ? '%c' : '') +
|
||||
this.namespace +
|
||||
(this.useColors ? ' %c' : ' ') +
|
||||
args[0] +
|
||||
(this.useColors ? '%c ' : ' ') +
|
||||
'+' + module.exports.humanize(this.diff);
|
||||
|
||||
if (!this.useColors) {
|
||||
return;
|
||||
}
|
||||
|
||||
const c = 'color: ' + this.color;
|
||||
args.splice(1, 0, c, 'color: inherit');
|
||||
|
||||
// The final "%c" is somewhat tricky, because there could be other
|
||||
// arguments passed either before or after the %c, so we need to
|
||||
// figure out the correct index to insert the CSS into
|
||||
let index = 0;
|
||||
let lastC = 0;
|
||||
args[0].replace(/%[a-zA-Z%]/g, match => {
|
||||
if (match === '%%') {
|
||||
return;
|
||||
}
|
||||
index++;
|
||||
if (match === '%c') {
|
||||
// We only are interested in the *last* %c
|
||||
// (the user may have provided their own)
|
||||
lastC = index;
|
||||
}
|
||||
});
|
||||
|
||||
args.splice(lastC, 0, c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.debug()` when available.
|
||||
* No-op when `console.debug` is not a "function".
|
||||
* If `console.debug` is not available, falls back
|
||||
* to `console.log`.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
exports.log = console.debug || console.log || (() => {});
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
function save(namespaces) {
|
||||
try {
|
||||
if (namespaces) {
|
||||
exports.storage.setItem('debug', namespaces);
|
||||
} else {
|
||||
exports.storage.removeItem('debug');
|
||||
}
|
||||
} catch (error) {
|
||||
// Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
function load() {
|
||||
let r;
|
||||
try {
|
||||
r = exports.storage.getItem('debug');
|
||||
} catch (error) {
|
||||
// Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
}
|
||||
|
||||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||||
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||||
r = process.env.DEBUG;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Localstorage attempts to return the localstorage.
|
||||
*
|
||||
* This is necessary because safari throws
|
||||
* when a user disables cookies/localstorage
|
||||
* and you attempt to access it.
|
||||
*
|
||||
* @return {LocalStorage}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function localstorage() {
|
||||
try {
|
||||
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
||||
// The Browser also has localStorage in the global context.
|
||||
return localStorage;
|
||||
} catch (error) {
|
||||
// Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = require('./common')(exports);
|
||||
|
||||
const {formatters} = module.exports;
|
||||
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
formatters.j = function (v) {
|
||||
try {
|
||||
return JSON.stringify(v);
|
||||
} catch (error) {
|
||||
return '[UnexpectedJSONParseError]: ' + error.message;
|
||||
}
|
||||
};
|
274
node_modules/cypress/node_modules/debug/src/common.js
generated
vendored
Normal file
274
node_modules/cypress/node_modules/debug/src/common.js
generated
vendored
Normal file
@@ -0,0 +1,274 @@
|
||||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*/
|
||||
|
||||
function setup(env) {
|
||||
createDebug.debug = createDebug;
|
||||
createDebug.default = createDebug;
|
||||
createDebug.coerce = coerce;
|
||||
createDebug.disable = disable;
|
||||
createDebug.enable = enable;
|
||||
createDebug.enabled = enabled;
|
||||
createDebug.humanize = require('ms');
|
||||
createDebug.destroy = destroy;
|
||||
|
||||
Object.keys(env).forEach(key => {
|
||||
createDebug[key] = env[key];
|
||||
});
|
||||
|
||||
/**
|
||||
* The currently active debug mode names, and names to skip.
|
||||
*/
|
||||
|
||||
createDebug.names = [];
|
||||
createDebug.skips = [];
|
||||
|
||||
/**
|
||||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||
*
|
||||
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||||
*/
|
||||
createDebug.formatters = {};
|
||||
|
||||
/**
|
||||
* Selects a color for a debug namespace
|
||||
* @param {String} namespace The namespace string for the for the debug instance to be colored
|
||||
* @return {Number|String} An ANSI color code for the given namespace
|
||||
* @api private
|
||||
*/
|
||||
function selectColor(namespace) {
|
||||
let hash = 0;
|
||||
|
||||
for (let i = 0; i < namespace.length; i++) {
|
||||
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
|
||||
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
||||
}
|
||||
createDebug.selectColor = selectColor;
|
||||
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
function createDebug(namespace) {
|
||||
let prevTime;
|
||||
let enableOverride = null;
|
||||
let namespacesCache;
|
||||
let enabledCache;
|
||||
|
||||
function debug(...args) {
|
||||
// Disabled?
|
||||
if (!debug.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const self = debug;
|
||||
|
||||
// Set `diff` timestamp
|
||||
const curr = Number(new Date());
|
||||
const ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
|
||||
args[0] = createDebug.coerce(args[0]);
|
||||
|
||||
if (typeof args[0] !== 'string') {
|
||||
// Anything else let's inspect with %O
|
||||
args.unshift('%O');
|
||||
}
|
||||
|
||||
// Apply any `formatters` transformations
|
||||
let index = 0;
|
||||
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
||||
// If we encounter an escaped % then don't increase the array index
|
||||
if (match === '%%') {
|
||||
return '%';
|
||||
}
|
||||
index++;
|
||||
const formatter = createDebug.formatters[format];
|
||||
if (typeof formatter === 'function') {
|
||||
const val = args[index];
|
||||
match = formatter.call(self, val);
|
||||
|
||||
// Now we need to remove `args[index]` since it's inlined in the `format`
|
||||
args.splice(index, 1);
|
||||
index--;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
|
||||
// Apply env-specific formatting (colors, etc.)
|
||||
createDebug.formatArgs.call(self, args);
|
||||
|
||||
const logFn = self.log || createDebug.log;
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
|
||||
debug.namespace = namespace;
|
||||
debug.useColors = createDebug.useColors();
|
||||
debug.color = createDebug.selectColor(namespace);
|
||||
debug.extend = extend;
|
||||
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
||||
|
||||
Object.defineProperty(debug, 'enabled', {
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
get: () => {
|
||||
if (enableOverride !== null) {
|
||||
return enableOverride;
|
||||
}
|
||||
if (namespacesCache !== createDebug.namespaces) {
|
||||
namespacesCache = createDebug.namespaces;
|
||||
enabledCache = createDebug.enabled(namespace);
|
||||
}
|
||||
|
||||
return enabledCache;
|
||||
},
|
||||
set: v => {
|
||||
enableOverride = v;
|
||||
}
|
||||
});
|
||||
|
||||
// Env-specific initialization logic for debug instances
|
||||
if (typeof createDebug.init === 'function') {
|
||||
createDebug.init(debug);
|
||||
}
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
function extend(namespace, delimiter) {
|
||||
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
||||
newDebug.log = this.log;
|
||||
return newDebug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
* separated by a colon and wildcards.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
function enable(namespaces) {
|
||||
createDebug.save(namespaces);
|
||||
createDebug.namespaces = namespaces;
|
||||
|
||||
createDebug.names = [];
|
||||
createDebug.skips = [];
|
||||
|
||||
let i;
|
||||
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
||||
const len = split.length;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (!split[i]) {
|
||||
// ignore empty strings
|
||||
continue;
|
||||
}
|
||||
|
||||
namespaces = split[i].replace(/\*/g, '.*?');
|
||||
|
||||
if (namespaces[0] === '-') {
|
||||
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||
} else {
|
||||
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @return {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
function disable() {
|
||||
const namespaces = [
|
||||
...createDebug.names.map(toNamespace),
|
||||
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
||||
].join(',');
|
||||
createDebug.enable('');
|
||||
return namespaces;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
function enabled(name) {
|
||||
if (name[name.length - 1] === '*') {
|
||||
return true;
|
||||
}
|
||||
|
||||
let i;
|
||||
let len;
|
||||
|
||||
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
||||
if (createDebug.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
||||
if (createDebug.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert regexp to namespace
|
||||
*
|
||||
* @param {RegExp} regxep
|
||||
* @return {String} namespace
|
||||
* @api private
|
||||
*/
|
||||
function toNamespace(regexp) {
|
||||
return regexp.toString()
|
||||
.substring(2, regexp.toString().length - 2)
|
||||
.replace(/\.\*\?$/, '*');
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
function coerce(val) {
|
||||
if (val instanceof Error) {
|
||||
return val.stack || val.message;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* XXX DO NOT USE. This is a temporary stub function.
|
||||
* XXX It WILL be removed in the next major release.
|
||||
*/
|
||||
function destroy() {
|
||||
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
||||
}
|
||||
|
||||
createDebug.enable(createDebug.load());
|
||||
|
||||
return createDebug;
|
||||
}
|
||||
|
||||
module.exports = setup;
|
10
node_modules/cypress/node_modules/debug/src/index.js
generated
vendored
Normal file
10
node_modules/cypress/node_modules/debug/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Detect Electron renderer / nwjs process, which is node, but we should
|
||||
* treat as a browser.
|
||||
*/
|
||||
|
||||
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
||||
module.exports = require('./browser.js');
|
||||
} else {
|
||||
module.exports = require('./node.js');
|
||||
}
|
263
node_modules/cypress/node_modules/debug/src/node.js
generated
vendored
Normal file
263
node_modules/cypress/node_modules/debug/src/node.js
generated
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
const tty = require('tty');
|
||||
const util = require('util');
|
||||
|
||||
/**
|
||||
* This is the Node.js implementation of `debug()`.
|
||||
*/
|
||||
|
||||
exports.init = init;
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
exports.destroy = util.deprecate(
|
||||
() => {},
|
||||
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
||||
);
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||
|
||||
try {
|
||||
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
const supportsColor = require('supports-color');
|
||||
|
||||
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
||||
exports.colors = [
|
||||
20,
|
||||
21,
|
||||
26,
|
||||
27,
|
||||
32,
|
||||
33,
|
||||
38,
|
||||
39,
|
||||
40,
|
||||
41,
|
||||
42,
|
||||
43,
|
||||
44,
|
||||
45,
|
||||
56,
|
||||
57,
|
||||
62,
|
||||
63,
|
||||
68,
|
||||
69,
|
||||
74,
|
||||
75,
|
||||
76,
|
||||
77,
|
||||
78,
|
||||
79,
|
||||
80,
|
||||
81,
|
||||
92,
|
||||
93,
|
||||
98,
|
||||
99,
|
||||
112,
|
||||
113,
|
||||
128,
|
||||
129,
|
||||
134,
|
||||
135,
|
||||
148,
|
||||
149,
|
||||
160,
|
||||
161,
|
||||
162,
|
||||
163,
|
||||
164,
|
||||
165,
|
||||
166,
|
||||
167,
|
||||
168,
|
||||
169,
|
||||
170,
|
||||
171,
|
||||
172,
|
||||
173,
|
||||
178,
|
||||
179,
|
||||
184,
|
||||
185,
|
||||
196,
|
||||
197,
|
||||
198,
|
||||
199,
|
||||
200,
|
||||
201,
|
||||
202,
|
||||
203,
|
||||
204,
|
||||
205,
|
||||
206,
|
||||
207,
|
||||
208,
|
||||
209,
|
||||
214,
|
||||
215,
|
||||
220,
|
||||
221
|
||||
];
|
||||
}
|
||||
} catch (error) {
|
||||
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
||||
}
|
||||
|
||||
/**
|
||||
* Build up the default `inspectOpts` object from the environment variables.
|
||||
*
|
||||
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||||
*/
|
||||
|
||||
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
||||
return /^debug_/i.test(key);
|
||||
}).reduce((obj, key) => {
|
||||
// Camel-case
|
||||
const prop = key
|
||||
.substring(6)
|
||||
.toLowerCase()
|
||||
.replace(/_([a-z])/g, (_, k) => {
|
||||
return k.toUpperCase();
|
||||
});
|
||||
|
||||
// Coerce string value into JS value
|
||||
let val = process.env[key];
|
||||
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
||||
val = true;
|
||||
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
||||
val = false;
|
||||
} else if (val === 'null') {
|
||||
val = null;
|
||||
} else {
|
||||
val = Number(val);
|
||||
}
|
||||
|
||||
obj[prop] = val;
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
/**
|
||||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
return 'colors' in exports.inspectOpts ?
|
||||
Boolean(exports.inspectOpts.colors) :
|
||||
tty.isatty(process.stderr.fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds ANSI color escape codes if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
const {namespace: name, useColors} = this;
|
||||
|
||||
if (useColors) {
|
||||
const c = this.color;
|
||||
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
||||
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
||||
|
||||
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||||
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
||||
} else {
|
||||
args[0] = getDate() + name + ' ' + args[0];
|
||||
}
|
||||
}
|
||||
|
||||
function getDate() {
|
||||
if (exports.inspectOpts.hideDate) {
|
||||
return '';
|
||||
}
|
||||
return new Date().toISOString() + ' ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
||||
*/
|
||||
|
||||
function log(...args) {
|
||||
return process.stderr.write(util.format(...args) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
function save(namespaces) {
|
||||
if (namespaces) {
|
||||
process.env.DEBUG = namespaces;
|
||||
} else {
|
||||
// If you set a process.env field to null or undefined, it gets cast to the
|
||||
// string 'null' or 'undefined'. Just delete instead.
|
||||
delete process.env.DEBUG;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
return process.env.DEBUG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init logic for `debug` instances.
|
||||
*
|
||||
* Create a new `inspectOpts` object in case `useColors` is set
|
||||
* differently for a particular `debug` instance.
|
||||
*/
|
||||
|
||||
function init(debug) {
|
||||
debug.inspectOpts = {};
|
||||
|
||||
const keys = Object.keys(exports.inspectOpts);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = require('./common')(exports);
|
||||
|
||||
const {formatters} = module.exports;
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, all on a single line.
|
||||
*/
|
||||
|
||||
formatters.o = function (v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts)
|
||||
.split('\n')
|
||||
.map(str => str.trim())
|
||||
.join(' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
||||
*/
|
||||
|
||||
formatters.O = function (v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts);
|
||||
};
|
162
node_modules/cypress/node_modules/ms/index.js
generated
vendored
Normal file
162
node_modules/cypress/node_modules/ms/index.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* Helpers.
|
||||
*/
|
||||
|
||||
var s = 1000;
|
||||
var m = s * 60;
|
||||
var h = m * 60;
|
||||
var d = h * 24;
|
||||
var w = d * 7;
|
||||
var y = d * 365.25;
|
||||
|
||||
/**
|
||||
* Parse or format the given `val`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `long` verbose formatting [false]
|
||||
*
|
||||
* @param {String|Number} val
|
||||
* @param {Object} [options]
|
||||
* @throws {Error} throw an error if val is not a non-empty string or a number
|
||||
* @return {String|Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(val, options) {
|
||||
options = options || {};
|
||||
var type = typeof val;
|
||||
if (type === 'string' && val.length > 0) {
|
||||
return parse(val);
|
||||
} else if (type === 'number' && isFinite(val)) {
|
||||
return options.long ? fmtLong(val) : fmtShort(val);
|
||||
}
|
||||
throw new Error(
|
||||
'val is not a non-empty string or a valid number. val=' +
|
||||
JSON.stringify(val)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `str` and return milliseconds.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parse(str) {
|
||||
str = String(str);
|
||||
if (str.length > 100) {
|
||||
return;
|
||||
}
|
||||
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
||||
str
|
||||
);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
var n = parseFloat(match[1]);
|
||||
var type = (match[2] || 'ms').toLowerCase();
|
||||
switch (type) {
|
||||
case 'years':
|
||||
case 'year':
|
||||
case 'yrs':
|
||||
case 'yr':
|
||||
case 'y':
|
||||
return n * y;
|
||||
case 'weeks':
|
||||
case 'week':
|
||||
case 'w':
|
||||
return n * w;
|
||||
case 'days':
|
||||
case 'day':
|
||||
case 'd':
|
||||
return n * d;
|
||||
case 'hours':
|
||||
case 'hour':
|
||||
case 'hrs':
|
||||
case 'hr':
|
||||
case 'h':
|
||||
return n * h;
|
||||
case 'minutes':
|
||||
case 'minute':
|
||||
case 'mins':
|
||||
case 'min':
|
||||
case 'm':
|
||||
return n * m;
|
||||
case 'seconds':
|
||||
case 'second':
|
||||
case 'secs':
|
||||
case 'sec':
|
||||
case 's':
|
||||
return n * s;
|
||||
case 'milliseconds':
|
||||
case 'millisecond':
|
||||
case 'msecs':
|
||||
case 'msec':
|
||||
case 'ms':
|
||||
return n;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Short format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtShort(ms) {
|
||||
var msAbs = Math.abs(ms);
|
||||
if (msAbs >= d) {
|
||||
return Math.round(ms / d) + 'd';
|
||||
}
|
||||
if (msAbs >= h) {
|
||||
return Math.round(ms / h) + 'h';
|
||||
}
|
||||
if (msAbs >= m) {
|
||||
return Math.round(ms / m) + 'm';
|
||||
}
|
||||
if (msAbs >= s) {
|
||||
return Math.round(ms / s) + 's';
|
||||
}
|
||||
return ms + 'ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Long format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtLong(ms) {
|
||||
var msAbs = Math.abs(ms);
|
||||
if (msAbs >= d) {
|
||||
return plural(ms, msAbs, d, 'day');
|
||||
}
|
||||
if (msAbs >= h) {
|
||||
return plural(ms, msAbs, h, 'hour');
|
||||
}
|
||||
if (msAbs >= m) {
|
||||
return plural(ms, msAbs, m, 'minute');
|
||||
}
|
||||
if (msAbs >= s) {
|
||||
return plural(ms, msAbs, s, 'second');
|
||||
}
|
||||
return ms + ' ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluralization helper.
|
||||
*/
|
||||
|
||||
function plural(ms, msAbs, n, name) {
|
||||
var isPlural = msAbs >= n * 1.5;
|
||||
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
||||
}
|
21
node_modules/cypress/node_modules/ms/license.md
generated
vendored
Normal file
21
node_modules/cypress/node_modules/ms/license.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Zeit, Inc.
|
||||
|
||||
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.
|
37
node_modules/cypress/node_modules/ms/package.json
generated
vendored
Normal file
37
node_modules/cypress/node_modules/ms/package.json
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "ms",
|
||||
"version": "2.1.2",
|
||||
"description": "Tiny millisecond conversion utility",
|
||||
"repository": "zeit/ms",
|
||||
"main": "./index",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"precommit": "lint-staged",
|
||||
"lint": "eslint lib/* bin/*",
|
||||
"test": "mocha tests.js"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "eslint:recommended",
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"npm run lint",
|
||||
"prettier --single-quote --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"eslint": "4.12.1",
|
||||
"expect.js": "0.3.1",
|
||||
"husky": "0.14.3",
|
||||
"lint-staged": "5.0.0",
|
||||
"mocha": "4.0.1"
|
||||
}
|
||||
}
|
60
node_modules/cypress/node_modules/ms/readme.md
generated
vendored
Normal file
60
node_modules/cypress/node_modules/ms/readme.md
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# ms
|
||||
|
||||
[](https://travis-ci.org/zeit/ms)
|
||||
[](https://spectrum.chat/zeit)
|
||||
|
||||
Use this package to easily convert various time formats to milliseconds.
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
ms('2 days') // 172800000
|
||||
ms('1d') // 86400000
|
||||
ms('10h') // 36000000
|
||||
ms('2.5 hrs') // 9000000
|
||||
ms('2h') // 7200000
|
||||
ms('1m') // 60000
|
||||
ms('5s') // 5000
|
||||
ms('1y') // 31557600000
|
||||
ms('100') // 100
|
||||
ms('-3 days') // -259200000
|
||||
ms('-1h') // -3600000
|
||||
ms('-200') // -200
|
||||
```
|
||||
|
||||
### Convert from Milliseconds
|
||||
|
||||
```js
|
||||
ms(60000) // "1m"
|
||||
ms(2 * 60000) // "2m"
|
||||
ms(-3 * 60000) // "-3m"
|
||||
ms(ms('10 hours')) // "10h"
|
||||
```
|
||||
|
||||
### Time Format Written-Out
|
||||
|
||||
```js
|
||||
ms(60000, { long: true }) // "1 minute"
|
||||
ms(2 * 60000, { long: true }) // "2 minutes"
|
||||
ms(-3 * 60000, { long: true }) // "-3 minutes"
|
||||
ms(ms('10 hours'), { long: true }) // "10 hours"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Works both in [Node.js](https://nodejs.org) and in the browser
|
||||
- If a number is supplied to `ms`, a string with a unit is returned
|
||||
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
|
||||
- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
|
||||
|
||||
## Related Packages
|
||||
|
||||
- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
|
||||
|
||||
## Caught a Bug?
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
||||
2. Link the package to the global module directory: `npm link`
|
||||
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
|
||||
|
||||
As always, you can run the tests using: `npm test`
|
24
node_modules/cypress/node_modules/supports-color/browser.js
generated
vendored
Normal file
24
node_modules/cypress/node_modules/supports-color/browser.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/* eslint-env browser */
|
||||
'use strict';
|
||||
|
||||
function getChromeVersion() {
|
||||
const matches = /(Chrome|Chromium)\/(?<chromeVersion>\d+)\./.exec(navigator.userAgent);
|
||||
|
||||
if (!matches) {
|
||||
return;
|
||||
}
|
||||
|
||||
return Number.parseInt(matches.groups.chromeVersion, 10);
|
||||
}
|
||||
|
||||
const colorSupport = getChromeVersion() >= 69 ? {
|
||||
level: 1,
|
||||
hasBasic: true,
|
||||
has256: false,
|
||||
has16m: false
|
||||
} : false;
|
||||
|
||||
module.exports = {
|
||||
stdout: colorSupport,
|
||||
stderr: colorSupport
|
||||
};
|
152
node_modules/cypress/node_modules/supports-color/index.js
generated
vendored
Normal file
152
node_modules/cypress/node_modules/supports-color/index.js
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
'use strict';
|
||||
const os = require('os');
|
||||
const tty = require('tty');
|
||||
const hasFlag = require('has-flag');
|
||||
|
||||
const {env} = process;
|
||||
|
||||
let flagForceColor;
|
||||
if (hasFlag('no-color') ||
|
||||
hasFlag('no-colors') ||
|
||||
hasFlag('color=false') ||
|
||||
hasFlag('color=never')) {
|
||||
flagForceColor = 0;
|
||||
} else if (hasFlag('color') ||
|
||||
hasFlag('colors') ||
|
||||
hasFlag('color=true') ||
|
||||
hasFlag('color=always')) {
|
||||
flagForceColor = 1;
|
||||
}
|
||||
|
||||
function envForceColor() {
|
||||
if ('FORCE_COLOR' in env) {
|
||||
if (env.FORCE_COLOR === 'true') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (env.FORCE_COLOR === 'false') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
||||
}
|
||||
}
|
||||
|
||||
function translateLevel(level) {
|
||||
if (level === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return {
|
||||
level,
|
||||
hasBasic: true,
|
||||
has256: level >= 2,
|
||||
has16m: level >= 3
|
||||
};
|
||||
}
|
||||
|
||||
function supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
||||
const noFlagForceColor = envForceColor();
|
||||
if (noFlagForceColor !== undefined) {
|
||||
flagForceColor = noFlagForceColor;
|
||||
}
|
||||
|
||||
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
||||
|
||||
if (forceColor === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sniffFlags) {
|
||||
if (hasFlag('color=16m') ||
|
||||
hasFlag('color=full') ||
|
||||
hasFlag('color=truecolor')) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (hasFlag('color=256')) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const min = forceColor || 0;
|
||||
|
||||
if (env.TERM === 'dumb') {
|
||||
return min;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
||||
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
||||
const osRelease = os.release().split('.');
|
||||
if (
|
||||
Number(osRelease[0]) >= 10 &&
|
||||
Number(osRelease[2]) >= 10586
|
||||
) {
|
||||
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ('CI' in env) {
|
||||
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
if ('TEAMCITY_VERSION' in env) {
|
||||
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
||||
}
|
||||
|
||||
if (env.COLORTERM === 'truecolor') {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if ('TERM_PROGRAM' in env) {
|
||||
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
||||
|
||||
switch (env.TERM_PROGRAM) {
|
||||
case 'iTerm.app':
|
||||
return version >= 3 ? 3 : 2;
|
||||
case 'Apple_Terminal':
|
||||
return 2;
|
||||
// No default
|
||||
}
|
||||
}
|
||||
|
||||
if (/-256(color)?$/i.test(env.TERM)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ('COLORTERM' in env) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
function getSupportLevel(stream, options = {}) {
|
||||
const level = supportsColor(stream, {
|
||||
streamIsTTY: stream && stream.isTTY,
|
||||
...options
|
||||
});
|
||||
|
||||
return translateLevel(level);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
supportsColor: getSupportLevel,
|
||||
stdout: getSupportLevel({isTTY: tty.isatty(1)}),
|
||||
stderr: getSupportLevel({isTTY: tty.isatty(2)})
|
||||
};
|
9
node_modules/cypress/node_modules/supports-color/license
generated
vendored
Normal file
9
node_modules/cypress/node_modules/supports-color/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
58
node_modules/cypress/node_modules/supports-color/package.json
generated
vendored
Normal file
58
node_modules/cypress/node_modules/supports-color/package.json
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "supports-color",
|
||||
"version": "8.1.1",
|
||||
"description": "Detect whether a terminal supports color",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/supports-color",
|
||||
"funding": "https://github.com/chalk/supports-color?sponsor=1",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"browser.js"
|
||||
],
|
||||
"exports": {
|
||||
"node": "./index.js",
|
||||
"default": "./browser.js"
|
||||
},
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"ansi",
|
||||
"styles",
|
||||
"tty",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"support",
|
||||
"supports",
|
||||
"capability",
|
||||
"detect",
|
||||
"truecolor",
|
||||
"16m"
|
||||
],
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"import-fresh": "^3.2.2",
|
||||
"xo": "^0.35.0"
|
||||
},
|
||||
"browser": "browser.js"
|
||||
}
|
77
node_modules/cypress/node_modules/supports-color/readme.md
generated
vendored
Normal file
77
node_modules/cypress/node_modules/supports-color/readme.md
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
# supports-color
|
||||
|
||||
> Detect whether a terminal supports color
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install supports-color
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const supportsColor = require('supports-color');
|
||||
|
||||
if (supportsColor.stdout) {
|
||||
console.log('Terminal stdout supports color');
|
||||
}
|
||||
|
||||
if (supportsColor.stdout.has256) {
|
||||
console.log('Terminal stdout supports 256 colors');
|
||||
}
|
||||
|
||||
if (supportsColor.stderr.has16m) {
|
||||
console.log('Terminal stderr supports 16 million colors (truecolor)');
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
|
||||
|
||||
The `stdout`/`stderr` objects 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`: Truecolor support (16 million colors)
|
||||
|
||||
### `require('supports-color').supportsColor(stream, options?)`
|
||||
|
||||
Additionally, `supports-color` exposes the `.supportsColor()` function that takes an arbitrary write stream (e.g. `process.stdout`) and an optional options object to (re-)evaluate color support for an arbitrary stream.
|
||||
|
||||
For example, `require('supports-color').stdout` is the equivalent of `require('supports-color').supportsColor(process.stdout)`.
|
||||
|
||||
The options object supports a single boolean property `sniffFlags`. By default it is `true`, which instructs `supportsColor()` to sniff `process.argv` for the multitude of `--color` flags (see _Info_ below). If `false`, then `process.argv` is not considered when determining color support.
|
||||
|
||||
## Info
|
||||
|
||||
It obeys the `--color` and `--no-color` CLI flags.
|
||||
|
||||
For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
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
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-supports-color?utm_source=npm-supports-color&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
---
|
91
node_modules/cypress/package.json
generated
vendored
Normal file
91
node_modules/cypress/package.json
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"name": "cypress",
|
||||
"version": "8.3.0",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"postinstall": "node index.js --exec install",
|
||||
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cypress/request": "^2.88.5",
|
||||
"@cypress/xvfb": "^1.2.4",
|
||||
"@types/node": "^14.14.31",
|
||||
"@types/sinonjs__fake-timers": "^6.0.2",
|
||||
"@types/sizzle": "^2.3.2",
|
||||
"arch": "^2.2.0",
|
||||
"blob-util": "^2.0.2",
|
||||
"bluebird": "^3.7.2",
|
||||
"cachedir": "^2.3.0",
|
||||
"chalk": "^4.1.0",
|
||||
"check-more-types": "^2.24.0",
|
||||
"cli-cursor": "^3.1.0",
|
||||
"cli-table3": "~0.6.0",
|
||||
"commander": "^5.1.0",
|
||||
"common-tags": "^1.8.0",
|
||||
"dayjs": "^1.10.4",
|
||||
"debug": "^4.3.2",
|
||||
"enquirer": "^2.3.6",
|
||||
"eventemitter2": "^6.4.3",
|
||||
"execa": "4.1.0",
|
||||
"executable": "^4.1.1",
|
||||
"extract-zip": "2.0.1",
|
||||
"figures": "^3.2.0",
|
||||
"fs-extra": "^9.1.0",
|
||||
"getos": "^3.2.1",
|
||||
"is-ci": "^3.0.0",
|
||||
"is-installed-globally": "~0.4.0",
|
||||
"lazy-ass": "^1.6.0",
|
||||
"listr2": "^3.8.3",
|
||||
"lodash": "^4.17.21",
|
||||
"log-symbols": "^4.0.0",
|
||||
"minimist": "^1.2.5",
|
||||
"ospath": "^1.2.2",
|
||||
"pretty-bytes": "^5.6.0",
|
||||
"ramda": "~0.27.1",
|
||||
"request-progress": "^3.0.0",
|
||||
"supports-color": "^8.1.1",
|
||||
"tmp": "~0.2.1",
|
||||
"untildify": "^4.0.0",
|
||||
"url": "^0.11.0",
|
||||
"yauzl": "^2.10.0"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"lib",
|
||||
"index.js",
|
||||
"types/**/*.d.ts",
|
||||
"types/net-stubbing.ts"
|
||||
],
|
||||
"bin": {
|
||||
"cypress": "bin/cypress"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"types": "types",
|
||||
"description": "Cypress.io end to end testing tool",
|
||||
"homepage": "https://github.com/cypress-io/cypress",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cypress-io/cypress/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cypress-io/cypress.git"
|
||||
},
|
||||
"keywords": [
|
||||
"automation",
|
||||
"browser",
|
||||
"cypress",
|
||||
"cypress.io",
|
||||
"e2e",
|
||||
"end-to-end",
|
||||
"integration",
|
||||
"mocks",
|
||||
"runner",
|
||||
"spies",
|
||||
"stubs",
|
||||
"test",
|
||||
"testing"
|
||||
]
|
||||
}
|
1261
node_modules/cypress/types/bluebird/index.d.ts
generated
vendored
Normal file
1261
node_modules/cypress/types/bluebird/index.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2587
node_modules/cypress/types/chai-jquery/index.d.ts
generated
vendored
Normal file
2587
node_modules/cypress/types/chai-jquery/index.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1954
node_modules/cypress/types/chai/index.d.ts
generated
vendored
Normal file
1954
node_modules/cypress/types/chai/index.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
13
node_modules/cypress/types/cy-blob-util.d.ts
generated
vendored
Normal file
13
node_modules/cypress/types/cy-blob-util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// Shim definition to export a namespace. Cypress is actually a global module
|
||||
// so import/export isn't allowed there. We import here and define a global module
|
||||
// so that Cypress can get and use the Blob type
|
||||
|
||||
// tslint:disable-next-line:no-implicit-dependencies
|
||||
import * as blobUtil from 'blob-util'
|
||||
|
||||
export = BlobUtil
|
||||
export as namespace BlobUtil
|
||||
|
||||
declare namespace BlobUtil {
|
||||
type BlobUtilStatic = typeof blobUtil
|
||||
}
|
11
node_modules/cypress/types/cy-bluebird.d.ts
generated
vendored
Normal file
11
node_modules/cypress/types/cy-bluebird.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// Shim definition to export a namespace. Cypress is actually a global module
|
||||
// so import/export isn't allowed there. We import here and define a global module
|
||||
// so that Cypress can get and use the Blob type
|
||||
import BluebirdStatic = require('./bluebird')
|
||||
|
||||
export = Bluebird
|
||||
export as namespace Bluebird
|
||||
|
||||
declare namespace Bluebird {
|
||||
type BluebirdStatic = typeof BluebirdStatic
|
||||
}
|
10
node_modules/cypress/types/cy-chai.d.ts
generated
vendored
Normal file
10
node_modules/cypress/types/cy-chai.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
// Shim definition to export a namespace. Cypress is actually a global module
|
||||
// so import/export isn't allowed there. We import here and define a global module
|
||||
/// <reference path="./chai/index.d.ts" />
|
||||
declare namespace Chai {
|
||||
interface Include {
|
||||
html(html: string): Assertion
|
||||
text(text: string): Assertion
|
||||
value(text: string): Assertion
|
||||
}
|
||||
}
|
13
node_modules/cypress/types/cy-http.d.ts
generated
vendored
Normal file
13
node_modules/cypress/types/cy-http.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* This file should be deleted as soon as the serever
|
||||
* TODO: delete this file when ResolvedDevServerConfig.server is converted to closeServer
|
||||
*/
|
||||
|
||||
/// <reference types="node" />
|
||||
import * as cyUtilsHttp from 'http'
|
||||
export = cyUtilsHttp
|
||||
/**
|
||||
* namespace created to bridge nodeJs.http typings so that
|
||||
* we can type http Server in CT
|
||||
*/
|
||||
export as namespace cyUtilsHttp
|
96
node_modules/cypress/types/cy-minimatch.d.ts
generated
vendored
Normal file
96
node_modules/cypress/types/cy-minimatch.d.ts
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
// I was trying to avoid relying on "import" of actual module from "minimatch"
|
||||
// because it would not work in test project, and the only reliable way
|
||||
// to get around type errors finally was to copy the minimal minimatch function
|
||||
// definition from "minimatch/index.d.ts" here and just keep it in our code
|
||||
|
||||
export = Minimatch
|
||||
export as namespace Minimatch
|
||||
|
||||
interface MinimatchOptions {
|
||||
/**
|
||||
* Dump a ton of stuff to stderr.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
debug?: boolean
|
||||
|
||||
/**
|
||||
* Do not expand {a,b} and {1..3} brace sets.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
nobrace?: boolean
|
||||
|
||||
/**
|
||||
* Disable ** matching against multiple folder names.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
noglobstar?: boolean
|
||||
|
||||
/**
|
||||
* Allow patterns to match filenames starting with a period,
|
||||
* even if the pattern does not explicitly have a period in that spot.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
dot?: boolean
|
||||
|
||||
/**
|
||||
* Disable "extglob" style patterns like +(a|b).
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
noext?: boolean
|
||||
|
||||
/**
|
||||
* Perform a case-insensitive match.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
nocase?: boolean
|
||||
|
||||
/**
|
||||
* When a match is not found by minimatch.match,
|
||||
* return a list containing the pattern itself if this option is set.
|
||||
* Otherwise, an empty list is returned if there are no matches.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
nonull?: boolean
|
||||
|
||||
/**
|
||||
* If set, then patterns without slashes will be matched against
|
||||
* the basename of the path if it contains slashes.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
matchBase?: boolean
|
||||
|
||||
/**
|
||||
* Suppress the behavior of treating #
|
||||
* at the start of a pattern as a comment.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
nocomment?: boolean
|
||||
|
||||
/**
|
||||
* Suppress the behavior of treating a leading ! character as negation.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
nonegate?: boolean
|
||||
|
||||
/**
|
||||
* Returns from negate expressions the same as if they were not negated.
|
||||
* (Ie, true on a hit, false on a miss.)
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
flipNegate?: boolean
|
||||
}
|
||||
|
||||
declare namespace Minimatch {
|
||||
function minimatch(target: string, pattern: string, options?: MinimatchOptions): boolean
|
||||
}
|
29
node_modules/cypress/types/cypress-eventemitter.d.ts
generated
vendored
Normal file
29
node_modules/cypress/types/cypress-eventemitter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// Cypress, cy, Log inherits EventEmitter.
|
||||
type EventEmitter2 = import("eventemitter2").EventEmitter2
|
||||
|
||||
interface EventEmitter extends EventEmitter2 {
|
||||
proxyTo: (cy: Cypress.cy) => null
|
||||
emitMap: (eventName: string, args: any[]) => Array<(...args: any[]) => any>
|
||||
emitThen: (eventName: string, args: any[]) => Bluebird.BluebirdStatic
|
||||
}
|
||||
|
||||
// Copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/events.d.ts
|
||||
// to avoid type conflict.
|
||||
interface NodeEventEmitter {
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
removeListener(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
off(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
removeAllListeners(event?: string | symbol): this
|
||||
setMaxListeners(n: number): this
|
||||
getMaxListeners(): number
|
||||
listeners(event: string | symbol): Array<(...args: any[]) => void>
|
||||
rawListeners(event: string | symbol): Array<(...args: any[]) => void>
|
||||
emit(event: string | symbol, ...args: any[]): boolean
|
||||
listenerCount(type: string | symbol): number
|
||||
// Added in Node 6...
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
eventNames(): Array<string | symbol>
|
||||
}
|
3
node_modules/cypress/types/cypress-expect.d.ts
generated
vendored
Normal file
3
node_modules/cypress/types/cypress-expect.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
// Cypress adds chai expect and assert to global
|
||||
declare const expect: Chai.ExpectStatic
|
||||
declare const assert: Chai.AssertStatic
|
22
node_modules/cypress/types/cypress-global-vars.d.ts
generated
vendored
Normal file
22
node_modules/cypress/types/cypress-global-vars.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Global variables `cy` added by Cypress with all API commands.
|
||||
* @see https://on.cypress.io/api
|
||||
*
|
||||
```
|
||||
cy.get('button').click()
|
||||
cy.get('.result').contains('Expected text')
|
||||
```
|
||||
*/
|
||||
declare const cy: Cypress.cy & EventEmitter
|
||||
|
||||
/**
|
||||
* Global variable `Cypress` holds common utilities and constants.
|
||||
* @see https://on.cypress.io/api
|
||||
*
|
||||
```
|
||||
Cypress.config("pageLoadTimeout") // => 60000
|
||||
Cypress.version // => "1.4.0"
|
||||
Cypress._ // => Lodash _
|
||||
```
|
||||
*/
|
||||
declare const Cypress: Cypress.Cypress & EventEmitter
|
385
node_modules/cypress/types/cypress-npm-api.d.ts
generated
vendored
Normal file
385
node_modules/cypress/types/cypress-npm-api.d.ts
generated
vendored
Normal file
@@ -0,0 +1,385 @@
|
||||
//
|
||||
// Cypress NPM api type declarations
|
||||
// https://on.cypress.io/module-api
|
||||
// https://github.com/cypress-io/cypress/issues/2141
|
||||
//
|
||||
// in the future the NPM module itself will be in TypeScript
|
||||
// but for now describe it as an ambient module
|
||||
|
||||
declare namespace CypressCommandLine {
|
||||
type HookName = 'before' | 'beforeEach' | 'afterEach' | 'after'
|
||||
|
||||
interface TestError {
|
||||
name: string
|
||||
message: string
|
||||
stack: string
|
||||
}
|
||||
/**
|
||||
* All options that one can pass to "cypress.run"
|
||||
* @see https://on.cypress.io/module-api#cypress-run
|
||||
* @example
|
||||
```
|
||||
const cypress = require('cypress')
|
||||
cypress.run({
|
||||
reporter: 'junit',
|
||||
browser: 'chrome',
|
||||
config: {
|
||||
baseUrl: 'http://localhost:8080',
|
||||
chromeWebSecurity: false,
|
||||
},
|
||||
env: {
|
||||
foo: 'bar',
|
||||
baz: 'quux',
|
||||
}
|
||||
})
|
||||
```
|
||||
*/
|
||||
interface CypressRunOptions extends CypressCommonOptions {
|
||||
/**
|
||||
* Specify different browser to run tests in, either by name or by filesystem path
|
||||
*/
|
||||
browser: string
|
||||
/**
|
||||
* Specify a unique identifier for a run to enable grouping or parallelization
|
||||
*/
|
||||
ciBuildId: string
|
||||
/**
|
||||
* Group recorded tests together under a single run name
|
||||
*/
|
||||
group: string
|
||||
/**
|
||||
* Tag string for the recorded run, like "production,nightly"
|
||||
*/
|
||||
tag: string
|
||||
/**
|
||||
* Display the browser instead of running headlessly
|
||||
*/
|
||||
headed: boolean
|
||||
/**
|
||||
* Hide the browser instead of running headed
|
||||
*/
|
||||
headless: boolean
|
||||
/**
|
||||
* Specify your secret record key
|
||||
*/
|
||||
key: string
|
||||
/**
|
||||
* Keep Cypress open after all tests run
|
||||
*/
|
||||
noExit: boolean
|
||||
/**
|
||||
* Run recorded specs in parallel across multiple machines
|
||||
*/
|
||||
parallel: boolean
|
||||
/**
|
||||
* Override default port
|
||||
*/
|
||||
port: number
|
||||
/**
|
||||
* Run quietly, using only the configured reporter
|
||||
*/
|
||||
quiet: boolean
|
||||
/**
|
||||
* Whether to record the test run
|
||||
*/
|
||||
record: boolean
|
||||
/**
|
||||
* Specify a mocha reporter
|
||||
*/
|
||||
reporter: string
|
||||
/**
|
||||
* Specify mocha reporter options
|
||||
*/
|
||||
reporterOptions: any
|
||||
/**
|
||||
* Specify the specs to run
|
||||
*/
|
||||
spec: string
|
||||
}
|
||||
|
||||
/**
|
||||
* All options that one can pass to "cypress.open"
|
||||
* @see https://on.cypress.io/module-api#cypress-open
|
||||
* @example
|
||||
```
|
||||
const cypress = require('cypress')
|
||||
cypress.open({
|
||||
env: {
|
||||
username: 'Joe Doe',
|
||||
email: 'joe@acme.co'
|
||||
},
|
||||
project: '~/demos/my-project'
|
||||
})
|
||||
```
|
||||
*/
|
||||
interface CypressOpenOptions extends CypressCommonOptions {
|
||||
/**
|
||||
* Specify a filesystem path to a custom browser
|
||||
*/
|
||||
browser: string
|
||||
/**
|
||||
* Open Cypress in detached mode
|
||||
*/
|
||||
detached: boolean
|
||||
/**
|
||||
* Run in global mode
|
||||
*/
|
||||
global: boolean
|
||||
/**
|
||||
* Override default port
|
||||
*/
|
||||
port: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Options available for `cypress.open` and `cypress.run`
|
||||
*/
|
||||
interface CypressCommonOptions {
|
||||
/**
|
||||
* Specify configuration
|
||||
*/
|
||||
config: Cypress.ConfigOptions
|
||||
/**
|
||||
* Path to the config file to be used.
|
||||
*
|
||||
* If `false` is passed, no config file will be used.
|
||||
*
|
||||
* @default "cypress.json"
|
||||
*/
|
||||
configFile: string | false
|
||||
/**
|
||||
* Specify environment variables.
|
||||
* TODO: isn't this duplicate of config.env?!
|
||||
*/
|
||||
env: object
|
||||
/**
|
||||
* Path to a specific project
|
||||
*/
|
||||
project: string
|
||||
/**
|
||||
* Specify the type of tests to execute.
|
||||
* @default "e2e"
|
||||
*/
|
||||
testingType: Cypress.TestingType
|
||||
}
|
||||
|
||||
// small utility types to better express meaning of other types
|
||||
type dateTimeISO = string
|
||||
type ms = number
|
||||
type pixels = number
|
||||
|
||||
/**
|
||||
* Cypress single test result
|
||||
*/
|
||||
interface TestResult {
|
||||
title: string[]
|
||||
state: string
|
||||
body: string
|
||||
/**
|
||||
* Error string as it's presented in console if the test fails
|
||||
*/
|
||||
displayError: string | null
|
||||
attempts: AttemptResult[]
|
||||
}
|
||||
|
||||
interface AttemptResult {
|
||||
state: string
|
||||
error: TestError | null
|
||||
startedAt: dateTimeISO
|
||||
duration: ms
|
||||
videoTimestamp: ms
|
||||
screenshots: ScreenshotInformation[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about a single "before", "beforeEach", "afterEach" and "after" hook.
|
||||
*/
|
||||
interface HookInformation {
|
||||
hookName: HookName
|
||||
title: string[]
|
||||
body: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about a single screenshot.
|
||||
*/
|
||||
interface ScreenshotInformation {
|
||||
name: string
|
||||
takenAt: dateTimeISO
|
||||
/**
|
||||
* Absolute path to the saved image
|
||||
*/
|
||||
path: string
|
||||
height: pixels
|
||||
width: pixels
|
||||
}
|
||||
|
||||
/**
|
||||
* Cypress test run result for a single spec.
|
||||
*/
|
||||
interface RunResult {
|
||||
/**
|
||||
* Accurate test results collected by Cypress.
|
||||
*/
|
||||
stats: {
|
||||
suites: number
|
||||
tests: number
|
||||
passes: number
|
||||
pending: number
|
||||
skipped: number
|
||||
failures: number
|
||||
startedAt: dateTimeISO
|
||||
endedAt: dateTimeISO
|
||||
duration: ms
|
||||
}
|
||||
/**
|
||||
* Reporter name like "spec"
|
||||
*/
|
||||
reporter: string
|
||||
/**
|
||||
* This is controlled by the reporter, and Cypress cannot guarantee
|
||||
* the properties. Usually this object has suites, tests, passes, etc
|
||||
*/
|
||||
reporterStats: object
|
||||
hooks: HookInformation[]
|
||||
tests: TestResult[]
|
||||
error: string | null
|
||||
video: string | null
|
||||
/**
|
||||
* information about the spec test file.
|
||||
*/
|
||||
spec: {
|
||||
/**
|
||||
* filename like "spec.js"
|
||||
*/
|
||||
name: string
|
||||
/**
|
||||
* name relative to the project root, like "cypress/integration/spec.js"
|
||||
*/
|
||||
relative: string
|
||||
/**
|
||||
* resolved filename of the spec
|
||||
*/
|
||||
absolute: string
|
||||
}
|
||||
shouldUploadVideo: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Results returned by the test run.
|
||||
* @see https://on.cypress.io/module-api
|
||||
*/
|
||||
interface CypressRunResult {
|
||||
status: 'finished'
|
||||
startedTestsAt: dateTimeISO
|
||||
endedTestsAt: dateTimeISO
|
||||
totalDuration: ms
|
||||
totalSuites: number
|
||||
totalTests: number
|
||||
totalFailed: number
|
||||
totalPassed: number
|
||||
totalPending: number
|
||||
totalSkipped: number
|
||||
/**
|
||||
* If Cypress test run is being recorded, full url will be provided.
|
||||
* @see https://on.cypress.io/dashboard-introduction
|
||||
*/
|
||||
runUrl?: string
|
||||
runs: RunResult[]
|
||||
browserPath: string
|
||||
browserName: string
|
||||
browserVersion: string
|
||||
osName: string
|
||||
osVersion: string
|
||||
cypressVersion: string
|
||||
config: Cypress.ResolvedConfigOptions
|
||||
}
|
||||
|
||||
/**
|
||||
* If Cypress fails to run at all (for example, if there are no spec files to run),
|
||||
* then it will return a CypressFailedRunResult. Check the failures attribute.
|
||||
* @example
|
||||
```
|
||||
const result = await cypress.run()
|
||||
if (result.status === 'failed') {
|
||||
console.error('failures %d', result.failures)
|
||||
console.error(result.message)
|
||||
process.exit(result.failures)
|
||||
}
|
||||
```
|
||||
*
|
||||
**/
|
||||
interface CypressFailedRunResult {
|
||||
status: 'failed'
|
||||
failures: number
|
||||
message: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Methods allow parsing given CLI arguments the same way Cypress CLI does it.
|
||||
*/
|
||||
interface CypressCliParser {
|
||||
/**
|
||||
* Parses the given array of string arguments to "cypress run"
|
||||
* just like Cypress CLI does it.
|
||||
* @see https://on.cypress.io/module-api
|
||||
* @example
|
||||
* const cypress = require('cypress')
|
||||
* const args = ['cypress', 'run', '--browser', 'chrome']
|
||||
* const options = await cypress.cli.parseRunArguments(args)
|
||||
* // options is {browser: 'chrome'}
|
||||
* // pass the options to cypress.run()
|
||||
* const results = await cypress.run(options)
|
||||
*/
|
||||
parseRunArguments(args: string[]): Promise<Partial<CypressRunOptions>>
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'cypress' {
|
||||
/**
|
||||
* Cypress NPM module interface.
|
||||
* @see https://on.cypress.io/module-api
|
||||
* @example
|
||||
```
|
||||
const cypress = require('cypress')
|
||||
cypress.run().then(results => ...)
|
||||
```
|
||||
*/
|
||||
interface CypressNpmApi {
|
||||
/**
|
||||
* Execute a headless Cypress test run.
|
||||
* @see https://on.cypress.io/module-api#cypress-run
|
||||
* @example
|
||||
```
|
||||
const cypress = require('cypress')
|
||||
// runs all spec files matching a wildcard
|
||||
cypress.run({
|
||||
spec: 'cypress/integration/admin*-spec.js'
|
||||
}).then(results => {
|
||||
if (results.status === 'failed') {
|
||||
// Cypress could not run
|
||||
} else {
|
||||
// inspect results object
|
||||
}
|
||||
})
|
||||
```
|
||||
*/
|
||||
run(options?: Partial<CypressCommandLine.CypressRunOptions>): Promise<CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult>
|
||||
/**
|
||||
* Opens Cypress GUI. Resolves with void when the
|
||||
* GUI is closed.
|
||||
* @see https://on.cypress.io/module-api#cypress-open
|
||||
*/
|
||||
open(options?: Partial<CypressCommandLine.CypressOpenOptions>): Promise<void>
|
||||
|
||||
/**
|
||||
* Utility functions for parsing CLI arguments the same way
|
||||
* Cypress does
|
||||
*/
|
||||
cli: CypressCommandLine.CypressCliParser
|
||||
}
|
||||
|
||||
// export Cypress NPM module interface
|
||||
const cypress: CypressNpmApi
|
||||
export = cypress
|
||||
}
|
2
node_modules/cypress/types/cypress-type-helpers.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/cypress-type-helpers.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// type helpers
|
||||
type Nullable<T> = T | null
|
5702
node_modules/cypress/types/cypress.d.ts
generated
vendored
Normal file
5702
node_modules/cypress/types/cypress.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
33
node_modules/cypress/types/index.d.ts
generated
vendored
Normal file
33
node_modules/cypress/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
// Project: https://www.cypress.io
|
||||
// GitHub: https://github.com/cypress-io/cypress
|
||||
// Definitions by: Gert Hengeveld <https://github.com/ghengeveld>
|
||||
// Mike Woudenberg <https://github.com/mikewoudenberg>
|
||||
// Robbert van Markus <https://github.com/rvanmarkus>
|
||||
// Nicholas Boll <https://github.com/nicholasboll>
|
||||
// TypeScript Version: 3.4
|
||||
// Updated by the Cypress team: https://www.cypress.io/about/
|
||||
|
||||
/// <reference path="./cy-blob-util.d.ts" />
|
||||
/// <reference path="./cy-bluebird.d.ts" />
|
||||
/// <reference path="./cy-minimatch.d.ts" />
|
||||
/// <reference path="./cy-chai.d.ts" />
|
||||
/// <reference path="./lodash/index.d.ts" />
|
||||
/// <reference path="./sinon/index.d.ts" />
|
||||
/// <reference path="./sinon-chai/index.d.ts" />
|
||||
/// <reference path="./mocha/index.d.ts" />
|
||||
/// <reference path="./jquery/index.d.ts" />
|
||||
/// <reference path="./chai-jquery/index.d.ts" />
|
||||
|
||||
// jQuery includes dependency "sizzle" that provides types
|
||||
// so we include it too in "node_modules/sizzle".
|
||||
// This way jQuery can load it using 'reference types="sizzle"' directive
|
||||
|
||||
// load ambient declaration for "cypress" NPM module
|
||||
// hmm, how to load it better?
|
||||
/// <reference path="./cypress-npm-api.d.ts" />
|
||||
|
||||
/// <reference path="./net-stubbing.ts" />
|
||||
/// <reference path="./cypress.d.ts" />
|
||||
/// <reference path="./cypress-global-vars.d.ts" />
|
||||
/// <reference path="./cypress-type-helpers.d.ts" />
|
||||
/// <reference path="./cypress-expect.d.ts" />
|
12942
node_modules/cypress/types/jquery/JQuery.d.ts
generated
vendored
Normal file
12942
node_modules/cypress/types/jquery/JQuery.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
13521
node_modules/cypress/types/jquery/JQueryStatic.d.ts
generated
vendored
Normal file
13521
node_modules/cypress/types/jquery/JQueryStatic.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
34
node_modules/cypress/types/jquery/index.d.ts
generated
vendored
Normal file
34
node_modules/cypress/types/jquery/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// Type definitions for jquery 3.3
|
||||
// Project: https://jquery.com
|
||||
// Definitions by: Leonard Thieu <https://github.com/leonard-thieu>
|
||||
// Boris Yankov <https://github.com/borisyankov>
|
||||
// Christian Hoffmeister <https://github.com/choffmeister>
|
||||
// Steve Fenton <https://github.com/Steve-Fenton>
|
||||
// Diullei Gomes <https://github.com/Diullei>
|
||||
// Tass Iliopoulos <https://github.com/tasoili>
|
||||
// Jason Swearingen <https://github.com/jasons-novaleaf>
|
||||
// Sean Hill <https://github.com/seanski>
|
||||
// Guus Goossens <https://github.com/Guuz>
|
||||
// Kelly Summerlin <https://github.com/ksummerlin>
|
||||
// Basarat Ali Syed <https://github.com/basarat>
|
||||
// Nicholas Wolverson <https://github.com/nwolverson>
|
||||
// Derek Cicerone <https://github.com/derekcicerone>
|
||||
// Andrew Gaspar <https://github.com/AndrewGaspar>
|
||||
// Seikichi Kondo <https://github.com/seikichi>
|
||||
// Benjamin Jackman <https://github.com/benjaminjackman>
|
||||
// Poul Sorensen <https://github.com/s093294>
|
||||
// Josh Strobl <https://github.com/JoshStrobl>
|
||||
// John Reilly <https://github.com/johnnyreilly>
|
||||
// Dick van den Brink <https://github.com/DickvdBrink>
|
||||
// Thomas Schulz <https://github.com/King2500>
|
||||
// Terry Mun <https://github.com/terrymun>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="sizzle" />
|
||||
/// <reference path="JQueryStatic.d.ts" />
|
||||
/// <reference path="JQuery.d.ts" />
|
||||
/// <reference path="misc.d.ts" />
|
||||
/// <reference path="legacy.d.ts" />
|
||||
|
||||
export = jQuery;
|
204
node_modules/cypress/types/jquery/legacy.d.ts
generated
vendored
Normal file
204
node_modules/cypress/types/jquery/legacy.d.ts
generated
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryCallback extends JQuery.Callbacks { }
|
||||
interface JQueryDeferred<T> extends JQuery.Deferred<T> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryEventConstructor extends JQuery.EventStatic { }
|
||||
interface JQueryDeferred<T> extends JQuery.Deferred<T> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryAjaxSettings extends JQuery.AjaxSettings { }
|
||||
interface JQueryAnimationOptions extends JQuery.EffectsOptions<Element> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryCoordinates extends JQuery.Coordinates { }
|
||||
interface JQueryGenericPromise<T> extends JQuery.Thenable<T> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryXHR extends JQuery.jqXHR { }
|
||||
interface JQueryPromise<T> extends JQuery.Promise<T> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQuerySerializeArrayElement extends JQuery.NameValuePair { }
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated since 1.9. See \`{@link https://api.jquery.com/jQuery.support/ }\`.
|
||||
*/
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQuerySupport extends JQuery.PlainObject { }
|
||||
|
||||
// Legacy types that are not represented in the current type definitions are marked deprecated.
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Deferred.Callback }\` or \`{@link JQuery.Deferred.CallbackBase }\`.
|
||||
*/
|
||||
interface JQueryPromiseCallback<T> {
|
||||
// tslint:disable-next-line:callable-types
|
||||
(value?: T, ...args: any[]): void;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQueryStatic.param JQueryStatic['param']}\`.
|
||||
*/
|
||||
interface JQueryParam {
|
||||
/**
|
||||
* Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.
|
||||
* @param obj An array or object to serialize.
|
||||
* @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization.
|
||||
*/
|
||||
// tslint:disable-next-line:callable-types
|
||||
(obj: any, traditional?: boolean): string;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface BaseJQueryEventObject extends Event {
|
||||
/**
|
||||
* The current DOM element within the event bubbling phase.
|
||||
* @see \`{@link https://api.jquery.com/event.currentTarget/ }\`
|
||||
*/
|
||||
currentTarget: Element;
|
||||
/**
|
||||
* An optional object of data passed to an event method when the current executing handler is bound.
|
||||
* @see \`{@link https://api.jquery.com/event.data/ }\`
|
||||
*/
|
||||
data: any;
|
||||
/**
|
||||
* The element where the currently-called jQuery event handler was attached.
|
||||
* @see \`{@link https://api.jquery.com/event.delegateTarget/ }\`
|
||||
*/
|
||||
delegateTarget: Element;
|
||||
/**
|
||||
* Returns whether event.preventDefault() was ever called on this event object.
|
||||
* @see \`{@link https://api.jquery.com/event.isDefaultPrevented/ }\`
|
||||
*/
|
||||
isDefaultPrevented(): boolean;
|
||||
/**
|
||||
* Returns whether event.stopImmediatePropagation() was ever called on this event object.
|
||||
* @see \`{@link https://api.jquery.com/event.isImmediatePropagationStopped/ }\`
|
||||
*/
|
||||
isImmediatePropagationStopped(): boolean;
|
||||
/**
|
||||
* Returns whether event.stopPropagation() was ever called on this event object.
|
||||
* @see \`{@link https://api.jquery.com/event.isPropagationStopped/ }\`
|
||||
*/
|
||||
isPropagationStopped(): boolean;
|
||||
/**
|
||||
* The namespace specified when the event was triggered.
|
||||
* @see \`{@link https://api.jquery.com/event.namespace/ }\`
|
||||
*/
|
||||
namespace: string;
|
||||
/**
|
||||
* The browser's original Event object.
|
||||
* @see \`{@link https://api.jquery.com/category/events/event-object/ }\`
|
||||
*/
|
||||
originalEvent: Event;
|
||||
/**
|
||||
* If this method is called, the default action of the event will not be triggered.
|
||||
* @see \`{@link https://api.jquery.com/event.preventDefault/ }\`
|
||||
*/
|
||||
preventDefault(): any;
|
||||
/**
|
||||
* The other DOM element involved in the event, if any.
|
||||
* @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
|
||||
*/
|
||||
relatedTarget: Element;
|
||||
/**
|
||||
* The last value returned by an event handler that was triggered by this event, unless the value was undefined.
|
||||
* @see \`{@link https://api.jquery.com/event.result/ }\`
|
||||
*/
|
||||
result: any;
|
||||
/**
|
||||
* Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.
|
||||
* @see \`{@link https://api.jquery.com/event.stopImmediatePropagation/ }\`
|
||||
*/
|
||||
stopImmediatePropagation(): void;
|
||||
/**
|
||||
* Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
|
||||
* @see \`{@link https://api.jquery.com/event.stopPropagation/ }\`
|
||||
*/
|
||||
stopPropagation(): void;
|
||||
/**
|
||||
* The DOM element that initiated the event.
|
||||
* @see \`{@link https://api.jquery.com/event.target/ }\`
|
||||
*/
|
||||
target: Element;
|
||||
/**
|
||||
* The mouse position relative to the left edge of the document.
|
||||
* @see \`{@link https://api.jquery.com/event.pageX/ }\`
|
||||
*/
|
||||
pageX: number;
|
||||
/**
|
||||
* The mouse position relative to the top edge of the document.
|
||||
* @see \`{@link https://api.jquery.com/event.pageY/ }\`
|
||||
*/
|
||||
pageY: number;
|
||||
/**
|
||||
* For key or mouse events, this property indicates the specific key or button that was pressed.
|
||||
* @see \`{@link https://api.jquery.com/event.which/ }\`
|
||||
*/
|
||||
which: number;
|
||||
/**
|
||||
* Indicates whether the META key was pressed when the event fired.
|
||||
* @see \`{@link https://api.jquery.com/event.metaKey/ }\`
|
||||
*/
|
||||
metaKey: boolean;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface JQueryInputEventObject extends BaseJQueryEventObject {
|
||||
altKey: boolean;
|
||||
ctrlKey: boolean;
|
||||
metaKey: boolean;
|
||||
shiftKey: boolean;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface JQueryMouseEventObject extends JQueryInputEventObject {
|
||||
button: number;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
offsetX: number;
|
||||
offsetY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface JQueryKeyEventObject extends JQueryInputEventObject {
|
||||
/** @deprecated */
|
||||
char: string;
|
||||
/** @deprecated */
|
||||
charCode: number;
|
||||
key: string;
|
||||
/** @deprecated */
|
||||
keyCode: number;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject { }
|
||||
/**
|
||||
* @deprecated Deprecated.
|
||||
*/
|
||||
interface JQueryPromiseOperator<T, U> {
|
||||
// tslint:disable-next-line:callable-types
|
||||
(callback1: JQuery.TypeOrArray<JQueryPromiseCallback<T>>,
|
||||
...callbacksN: Array<JQuery.TypeOrArray<JQueryPromiseCallback<any>>>): JQueryPromise<U>;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Internal. See \`{@link https://github.com/jquery/api.jquery.com/issues/912 }\`.
|
||||
*/
|
||||
interface JQueryEasingFunction {
|
||||
// tslint:disable-next-line:callable-types
|
||||
(percent: number): number;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Internal. See \`{@link https://github.com/jquery/api.jquery.com/issues/912 }\`.
|
||||
*/
|
||||
interface JQueryEasingFunctions {
|
||||
[name: string]: JQueryEasingFunction;
|
||||
linear: JQueryEasingFunction;
|
||||
swing: JQueryEasingFunction;
|
||||
}
|
6661
node_modules/cypress/types/jquery/misc.d.ts
generated
vendored
Normal file
6661
node_modules/cypress/types/jquery/misc.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/cypress/types/lodash/add.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/add.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { add } from "./index";
|
||||
export = add;
|
2
node_modules/cypress/types/lodash/after.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/after.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { after } from "./index";
|
||||
export = after;
|
2
node_modules/cypress/types/lodash/ary.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/ary.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { ary } from "./index";
|
||||
export = ary;
|
2
node_modules/cypress/types/lodash/assign.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/assign.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { assign } from "./index";
|
||||
export = assign;
|
2
node_modules/cypress/types/lodash/assignIn.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/assignIn.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { assignIn } from "./index";
|
||||
export = assignIn;
|
2
node_modules/cypress/types/lodash/assignInWith.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/assignInWith.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { assignInWith } from "./index";
|
||||
export = assignInWith;
|
2
node_modules/cypress/types/lodash/assignWith.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/assignWith.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { assignWith } from "./index";
|
||||
export = assignWith;
|
2
node_modules/cypress/types/lodash/at.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/at.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { at } from "./index";
|
||||
export = at;
|
2
node_modules/cypress/types/lodash/attempt.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/attempt.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { attempt } from "./index";
|
||||
export = attempt;
|
2
node_modules/cypress/types/lodash/before.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/before.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { before } from "./index";
|
||||
export = before;
|
2
node_modules/cypress/types/lodash/bind.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/bind.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { bind } from "./index";
|
||||
export = bind;
|
2
node_modules/cypress/types/lodash/bindAll.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/bindAll.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { bindAll } from "./index";
|
||||
export = bindAll;
|
2
node_modules/cypress/types/lodash/bindKey.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/bindKey.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { bindKey } from "./index";
|
||||
export = bindKey;
|
2
node_modules/cypress/types/lodash/camelCase.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/camelCase.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { camelCase } from "./index";
|
||||
export = camelCase;
|
2
node_modules/cypress/types/lodash/capitalize.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/capitalize.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { capitalize } from "./index";
|
||||
export = capitalize;
|
2
node_modules/cypress/types/lodash/castArray.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/castArray.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { castArray } from "./index";
|
||||
export = castArray;
|
2
node_modules/cypress/types/lodash/ceil.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/ceil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { ceil } from "./index";
|
||||
export = ceil;
|
2
node_modules/cypress/types/lodash/chain.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/chain.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { chain } from "./index";
|
||||
export = chain;
|
2
node_modules/cypress/types/lodash/chunk.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/chunk.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { chunk } from "./index";
|
||||
export = chunk;
|
2
node_modules/cypress/types/lodash/clamp.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/clamp.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { clamp } from "./index";
|
||||
export = clamp;
|
2
node_modules/cypress/types/lodash/clone.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/clone.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { clone } from "./index";
|
||||
export = clone;
|
2
node_modules/cypress/types/lodash/cloneDeep.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/cloneDeep.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { cloneDeep } from "./index";
|
||||
export = cloneDeep;
|
2
node_modules/cypress/types/lodash/cloneDeepWith.d.ts
generated
vendored
Normal file
2
node_modules/cypress/types/lodash/cloneDeepWith.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { cloneDeepWith } from "./index";
|
||||
export = cloneDeepWith;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user