diff --git a/node_modules/@actions/core/lib/command.d.ts b/node_modules/@actions/core/lib/command.d.ts index 51b8f116d..94d5e449c 100644 --- a/node_modules/@actions/core/lib/command.d.ts +++ b/node_modules/@actions/core/lib/command.d.ts @@ -1,5 +1,5 @@ interface CommandProperties { - [key: string]: string; + [key: string]: any; } /** * Commands @@ -11,6 +11,11 @@ interface CommandProperties { * ::warning::This is the message * ::set-env name=MY_VAR::some value */ -export declare function issueCommand(command: string, properties: CommandProperties, message: string): void; +export declare function issueCommand(command: string, properties: CommandProperties, message: any): void; export declare function issue(name: string, message?: string): void; +/** + * Sanitizes an input into a string so it can be passed into issueCommand safely + * @param input input to sanitize into a string + */ +export declare function toCommandValue(input: any): string; export {}; diff --git a/node_modules/@actions/core/lib/command.js b/node_modules/@actions/core/lib/command.js index eeef233ee..af28d2b11 100644 --- a/node_modules/@actions/core/lib/command.js +++ b/node_modules/@actions/core/lib/command.js @@ -61,14 +61,28 @@ class Command { return cmdStr; } } +/** + * Sanitizes an input into a string so it can be passed into issueCommand safely + * @param input input to sanitize into a string + */ +function toCommandValue(input) { + if (input === null || input === undefined) { + return ''; + } + else if (typeof input === 'string' || input instanceof String) { + return input; + } + return JSON.stringify(input); +} +exports.toCommandValue = toCommandValue; function escapeData(s) { - return (s || '') + return toCommandValue(s) .replace(/%/g, '%25') .replace(/\r/g, '%0D') .replace(/\n/g, '%0A'); } function escapeProperty(s) { - return (s || '') + return toCommandValue(s) .replace(/%/g, '%25') .replace(/\r/g, '%0D') .replace(/\n/g, '%0A') diff --git a/node_modules/@actions/core/lib/command.js.map b/node_modules/@actions/core/lib/command.js.map index 00a9861e6..ae755652c 100644 --- a/node_modules/@actions/core/lib/command.js.map +++ b/node_modules/@actions/core/lib/command.js.map @@ -1 +1 @@ -{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;SACb,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAS;IAC/B,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;SACb,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"} \ No newline at end of file +{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AAWxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC;AAED,SAAS,UAAU,CAAC,CAAM;IACxB,OAAO,cAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,cAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"} \ No newline at end of file diff --git a/node_modules/@actions/core/lib/core.d.ts b/node_modules/@actions/core/lib/core.d.ts index 8fcc31bae..8bb5093c5 100644 --- a/node_modules/@actions/core/lib/core.d.ts +++ b/node_modules/@actions/core/lib/core.d.ts @@ -21,9 +21,9 @@ export declare enum ExitCode { /** * Sets env variable for this action and future actions in the job * @param name the name of the variable to set - * @param val the value of the variable + * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify */ -export declare function exportVariable(name: string, val: string): void; +export declare function exportVariable(name: string, val: any): void; /** * Registers a secret which will get masked from logs * @param secret value of the secret @@ -46,15 +46,21 @@ export declare function getInput(name: string, options?: InputOptions): string; * Sets the value of an output. * * @param name name of the output to set - * @param value value to store + * @param value value to store. Non-string values will be converted to a string via JSON.stringify */ -export declare function setOutput(name: string, value: string): void; +export declare function setOutput(name: string, value: any): void; +/** + * Enables or disables the echoing of commands into stdout for the rest of the step. + * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. + * + */ +export declare function setCommandEcho(enabled: boolean): void; /** * Sets the action status to failed. * When the action exits it will be with an exit code of 1 * @param message add error issue message */ -export declare function setFailed(message: string): void; +export declare function setFailed(message: string | Error): void; /** * Gets whether Actions Step Debug is on or not */ @@ -66,14 +72,14 @@ export declare function isDebug(): boolean; export declare function debug(message: string): void; /** * Adds an error issue - * @param message error issue message + * @param message error issue message. Errors will be converted to string via toString() */ -export declare function error(message: string): void; +export declare function error(message: string | Error): void; /** * Adds an warning issue - * @param message warning issue message + * @param message warning issue message. Errors will be converted to string via toString() */ -export declare function warning(message: string): void; +export declare function warning(message: string | Error): void; /** * Writes info to log with console.log. * @param message info message @@ -104,9 +110,9 @@ export declare function group(name: string, fn: () => Promise): Promise * Saves state for current action, the state can only be retrieved by this action's post job execution. * * @param name name of the state to store - * @param value value to store + * @param value value to store. Non-string values will be converted to a string via JSON.stringify */ -export declare function saveState(name: string, value: string): void; +export declare function saveState(name: string, value: any): void; /** * Gets the value of an state set by this action's main execution. * diff --git a/node_modules/@actions/core/lib/core.js b/node_modules/@actions/core/lib/core.js index b7ec8ab45..c838f4e20 100644 --- a/node_modules/@actions/core/lib/core.js +++ b/node_modules/@actions/core/lib/core.js @@ -39,11 +39,13 @@ var ExitCode; /** * Sets env variable for this action and future actions in the job * @param name the name of the variable to set - * @param val the value of the variable + * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any function exportVariable(name, val) { - process.env[name] = val; - command_1.issueCommand('set-env', { name }, val); + const convertedVal = command_1.toCommandValue(val); + process.env[name] = convertedVal; + command_1.issueCommand('set-env', { name }, convertedVal); } exports.exportVariable = exportVariable; /** @@ -82,12 +84,22 @@ exports.getInput = getInput; * Sets the value of an output. * * @param name name of the output to set - * @param value value to store + * @param value value to store. Non-string values will be converted to a string via JSON.stringify */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any function setOutput(name, value) { command_1.issueCommand('set-output', { name }, value); } exports.setOutput = setOutput; +/** + * Enables or disables the echoing of commands into stdout for the rest of the step. + * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. + * + */ +function setCommandEcho(enabled) { + command_1.issue('echo', enabled ? 'on' : 'off'); +} +exports.setCommandEcho = setCommandEcho; //----------------------------------------------------------------------- // Results //----------------------------------------------------------------------- @@ -121,18 +133,18 @@ function debug(message) { exports.debug = debug; /** * Adds an error issue - * @param message error issue message + * @param message error issue message. Errors will be converted to string via toString() */ function error(message) { - command_1.issue('error', message); + command_1.issue('error', message instanceof Error ? message.toString() : message); } exports.error = error; /** * Adds an warning issue - * @param message warning issue message + * @param message warning issue message. Errors will be converted to string via toString() */ function warning(message) { - command_1.issue('warning', message); + command_1.issue('warning', message instanceof Error ? message.toString() : message); } exports.warning = warning; /** @@ -190,8 +202,9 @@ exports.group = group; * Saves state for current action, the state can only be retrieved by this action's post job execution. * * @param name name of the state to store - * @param value value to store + * @param value value to store. Non-string values will be converted to a string via JSON.stringify */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any function saveState(name, value) { command_1.issueCommand('save-state', { name }, value); } diff --git a/node_modules/@actions/core/lib/core.js.map b/node_modules/@actions/core/lib/core.js.map index fb93bd383..68e9f313f 100644 --- a/node_modules/@actions/core/lib/core.js.map +++ b/node_modules/@actions/core/lib/core.js.map @@ -1 +1 @@ -{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAE7C,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IACnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAHD,8BAGC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,GAAG,CAAA;AAC5C,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,eAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACzB,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,eAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"} \ No newline at end of file +{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6D;AAE7D,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,8DAA8D;AAC9D,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAQ;IACnD,MAAM,YAAY,GAAG,wBAAc,CAAC,GAAG,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAA;IAChC,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,YAAY,CAAC,CAAA;AAC/C,CAAC;AAJD,wCAIC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,OAAgB;IAC7C,eAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AACvC,CAAC;AAFD,wCAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAuB;IAC/C,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IAEnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAJD,8BAIC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,GAAG,CAAA;AAC5C,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAuB;IAC3C,eAAK,CAAC,OAAO,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AACzE,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAuB;IAC7C,eAAK,CAAC,SAAS,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AAC3E,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"} \ No newline at end of file diff --git a/node_modules/@actions/core/package.json b/node_modules/@actions/core/package.json index d7c327788..0908da5b3 100644 --- a/node_modules/@actions/core/package.json +++ b/node_modules/@actions/core/package.json @@ -1,33 +1,33 @@ { "_args": [ [ - "@actions/core@1.2.3", - "/home/runner/work/readable-readme/readable-readme" + "@actions/core@1.2.4", + "/workspace/readable-readme" ] ], - "_from": "@actions/core@1.2.3", - "_id": "@actions/core@1.2.3", + "_from": "@actions/core@1.2.4", + "_id": "@actions/core@1.2.4", "_inBundle": false, - "_integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w==", + "_integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==", "_location": "/@actions/core", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "@actions/core@1.2.3", + "raw": "@actions/core@1.2.4", "name": "@actions/core", "escapedName": "@actions%2fcore", "scope": "@actions", - "rawSpec": "1.2.3", + "rawSpec": "1.2.4", "saveSpec": null, - "fetchSpec": "1.2.3" + "fetchSpec": "1.2.4" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.3.tgz", - "_spec": "1.2.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz", + "_spec": "1.2.4", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/actions/toolkit/issues" }, @@ -65,5 +65,5 @@ "tsc": "tsc" }, "types": "lib/core.d.ts", - "version": "1.2.3" + "version": "1.2.4" } diff --git a/node_modules/@actions/github/README.md b/node_modules/@actions/github/README.md index d6cf49b1e..02e9be077 100644 --- a/node_modules/@actions/github/README.md +++ b/node_modules/@actions/github/README.md @@ -4,7 +4,7 @@ ## Usage -Returns an authenticated Octokit client that follows the machine [proxy settings](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners#using-a-proxy-server-with-self-hosted-runners). See https://octokit.github.io/rest.js for the API. +Returns an authenticated Octokit client that follows the machine [proxy settings](https://help.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners) and correctly sets GHES base urls. See https://octokit.github.io/rest.js for the API. ```js const github = require('@actions/github'); @@ -17,7 +17,10 @@ async function run() { // https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token#about-the-github_token-secret const myToken = core.getInput('myToken'); - const octokit = new github.GitHub(myToken); + const octokit = github.getOctokit(myToken) + + // You can also pass in additional options as a second parameter to getOctokit + // const octokit = github.getOctokit(myToken, {userAgent: "MyActionVersion1"}); const { data: pullRequest } = await octokit.pulls.get({ owner: 'octokit', @@ -34,8 +37,6 @@ async function run() { run(); ``` -You can pass client options, as specified by [Octokit](https://octokit.github.io/rest.js/), as a second argument to the `GitHub` constructor. - You can also make GraphQL requests. See https://github.com/octokit/graphql.js for the API. ```js @@ -72,3 +73,25 @@ if (github.context.eventName === 'push') { core.info(`The head commit is: ${pushPayload.head}`) } ``` + +## Extending the Octokit instance +`@octokit/core` now supports the [plugin architecture](https://github.com/octokit/core.js#plugins). You can extend the GitHub instance using plugins. + +For example, using the `@octokit/plugin-enterprise-server` you can now access enterprise admin apis on GHES instances. + +```ts +import { GitHub, getOctokitOptions } from '@actions/github/lib/utils' +import { enterpriseServer220Admin } from '@octokit/plugin-enterprise-server' + +const octokit = GitHub.plugin(enterpriseServer220Admin) +// or override some of the default values as well +// const octokit = GitHub.plugin(enterpriseServer220Admin).defaults({userAgent: "MyNewUserAgent"}) + +const myToken = core.getInput('myToken'); +const myOctokit = new octokit(getOctokitOptions(token)) +// Create a new user +myOctokit.enterpriseAdmin.createUser({ + login: "testuser", + email: "testuser@test.com", +}); +``` diff --git a/node_modules/@actions/github/lib/context.d.ts b/node_modules/@actions/github/lib/context.d.ts index 434fdb124..daab690c7 100644 --- a/node_modules/@actions/github/lib/context.d.ts +++ b/node_modules/@actions/github/lib/context.d.ts @@ -10,6 +10,9 @@ export declare class Context { workflow: string; action: string; actor: string; + job: string; + runNumber: number; + runId: number; /** * Hydrate the context from the environment */ diff --git a/node_modules/@actions/github/lib/context.js b/node_modules/@actions/github/lib/context.js index 25ceea5a6..dd4d10a06 100644 --- a/node_modules/@actions/github/lib/context.js +++ b/node_modules/@actions/github/lib/context.js @@ -1,5 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.Context = void 0; const fs_1 = require("fs"); const os_1 = require("os"); class Context { @@ -23,6 +24,9 @@ class Context { this.workflow = process.env.GITHUB_WORKFLOW; this.action = process.env.GITHUB_ACTION; this.actor = process.env.GITHUB_ACTOR; + this.job = process.env.GITHUB_JOB; + this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10); + this.runId = parseInt(process.env.GITHUB_RUN_ID, 10); } get issue() { const payload = this.payload; diff --git a/node_modules/@actions/github/lib/context.js.map b/node_modules/@actions/github/lib/context.js.map index d05ca0d36..9c4eafe1a 100644 --- a/node_modules/@actions/github/lib/context.js.map +++ b/node_modules/@actions/github/lib/context.js.map @@ -1 +1 @@ -{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;AAEA,2BAA2C;AAC3C,2BAAsB;AAEtB,MAAa,OAAO;IAalB;;OAEG;IACH;QACE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACjB,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,IAAI,eAAU,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE;gBAC7C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CACvB,iBAAY,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAChE,CAAA;aACF;iBAAM;gBACL,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAA;gBAC1C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,IAAI,kBAAkB,QAAG,EAAE,CAAC,CAAA;aACvE;SACF;QACD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,iBAA2B,CAAA;QACxD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAyB,CAAA;QACrD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAuB,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAsB,CAAA;IACjD,CAAC;IAED,IAAI,KAAK;QACP,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAE5B,uCACK,IAAI,CAAC,IAAI,KACZ,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,CAAC,MAAM,IAClE;IACH,CAAC;IAED,IAAI,IAAI;QACN,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC9D,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,CAAA;SACrB;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC3B,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK;gBAC1C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI;aACnC,CAAA;SACF;QAED,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAA;IACH,CAAC;CACF;AA9DD,0BA8DC"} \ No newline at end of file +{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;AAEA,2BAA2C;AAC3C,2BAAsB;AAEtB,MAAa,OAAO;IAgBlB;;OAEG;IACH;QACE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACjB,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,IAAI,eAAU,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE;gBAC7C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CACvB,iBAAY,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAChE,CAAA;aACF;iBAAM;gBACL,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAA;gBAC1C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,IAAI,kBAAkB,QAAG,EAAE,CAAC,CAAA;aACvE;SACF;QACD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,iBAA2B,CAAA;QACxD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAyB,CAAA;QACrD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAuB,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAsB,CAAA;QAC/C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,iBAA2B,EAAE,EAAE,CAAC,CAAA;QACtE,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAuB,EAAE,EAAE,CAAC,CAAA;IAChE,CAAC;IAED,IAAI,KAAK;QACP,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAE5B,uCACK,IAAI,CAAC,IAAI,KACZ,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,CAAC,MAAM,IAClE;IACH,CAAC;IAED,IAAI,IAAI;QACN,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC9D,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,CAAA;SACrB;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC3B,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK;gBAC1C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI;aACnC,CAAA;SACF;QAED,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAA;IACH,CAAC;CACF;AApED,0BAoEC"} \ No newline at end of file diff --git a/node_modules/@actions/github/lib/github.d.ts b/node_modules/@actions/github/lib/github.d.ts index c868122d4..90c3b985d 100644 --- a/node_modules/@actions/github/lib/github.d.ts +++ b/node_modules/@actions/github/lib/github.d.ts @@ -1,25 +1,11 @@ -import { graphql as GraphQL } from '@octokit/graphql/dist-types/types'; -import { Octokit } from '@octokit/rest'; import * as Context from './context'; +import { GitHub } from './utils'; +import { OctokitOptions } from '@octokit/core/dist-types/types'; export declare const context: Context.Context; -export declare class GitHub extends Octokit { - graphql: GraphQL; - /** - * Sets up the REST client and GraphQL client with auth and proxy support. - * The parameter `token` or `opts.auth` must be supplied. The GraphQL client - * authorization is not setup when `opts.auth` is a function or object. - * - * @param token Auth token - * @param opts Octokit options - */ - constructor(token: string, opts?: Omit); - constructor(opts: Octokit.Options); - /** - * Disambiguates the constructor overload parameters - */ - private static disambiguate; - private static getOctokitOptions; - private static getGraphQL; - private static getAuthString; - private static getProxyAgent; -} +/** + * Returns a hydrated octokit ready to use for GitHub Actions + * + * @param token the repo PAT or GITHUB_TOKEN + * @param options other options to set + */ +export declare function getOctokit(token: string, options?: OctokitOptions): InstanceType; diff --git a/node_modules/@actions/github/lib/github.js b/node_modules/@actions/github/lib/github.js index ee4e72f1d..e30e81ec6 100644 --- a/node_modules/@actions/github/lib/github.js +++ b/node_modules/@actions/github/lib/github.js @@ -1,91 +1,36 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); -// Originally pulled from https://github.com/JasonEtco/actions-toolkit/blob/master/src/github.ts -const graphql_1 = require("@octokit/graphql"); -const rest_1 = require("@octokit/rest"); +exports.getOctokit = exports.context = void 0; const Context = __importStar(require("./context")); -const httpClient = __importStar(require("@actions/http-client")); -// We need this in order to extend Octokit -rest_1.Octokit.prototype = new rest_1.Octokit(); +const utils_1 = require("./utils"); exports.context = new Context.Context(); -class GitHub extends rest_1.Octokit { - constructor(token, opts) { - super(GitHub.getOctokitOptions(GitHub.disambiguate(token, opts))); - this.graphql = GitHub.getGraphQL(GitHub.disambiguate(token, opts)); - } - /** - * Disambiguates the constructor overload parameters - */ - static disambiguate(token, opts) { - return [ - typeof token === 'string' ? token : '', - typeof token === 'object' ? token : opts || {} - ]; - } - static getOctokitOptions(args) { - const token = args[0]; - const options = Object.assign({}, args[1]); // Shallow clone - don't mutate the object provided by the caller - // Auth - const auth = GitHub.getAuthString(token, options); - if (auth) { - options.auth = auth; - } - // Proxy - const agent = GitHub.getProxyAgent(options); - if (agent) { - // Shallow clone - don't mutate the object provided by the caller - options.request = options.request ? Object.assign({}, options.request) : {}; - // Set the agent - options.request.agent = agent; - } - return options; - } - static getGraphQL(args) { - const defaults = {}; - const token = args[0]; - const options = args[1]; - // Authorization - const auth = this.getAuthString(token, options); - if (auth) { - defaults.headers = { - authorization: auth - }; - } - // Proxy - const agent = GitHub.getProxyAgent(options); - if (agent) { - defaults.request = { agent }; - } - return graphql_1.graphql.defaults(defaults); - } - static getAuthString(token, options) { - // Validate args - if (!token && !options.auth) { - throw new Error('Parameter token or opts.auth is required'); - } - else if (token && options.auth) { - throw new Error('Parameters token and opts.auth may not both be specified'); - } - return typeof options.auth === 'string' ? options.auth : `token ${token}`; - } - static getProxyAgent(options) { - var _a; - if (!((_a = options.request) === null || _a === void 0 ? void 0 : _a.agent)) { - const serverUrl = 'https://api.github.com'; - if (httpClient.getProxyUrl(serverUrl)) { - const hc = new httpClient.HttpClient(); - return hc.getAgent(serverUrl); - } - } - return undefined; - } +/** + * Returns a hydrated octokit ready to use for GitHub Actions + * + * @param token the repo PAT or GITHUB_TOKEN + * @param options other options to set + */ +function getOctokit(token, options) { + return new utils_1.GitHub(utils_1.getOctokitOptions(token, options)); } -exports.GitHub = GitHub; +exports.getOctokit = getOctokit; //# sourceMappingURL=github.js.map \ No newline at end of file diff --git a/node_modules/@actions/github/lib/github.js.map b/node_modules/@actions/github/lib/github.js.map index 5afe3449c..717d03e85 100644 --- a/node_modules/@actions/github/lib/github.js.map +++ b/node_modules/@actions/github/lib/github.js.map @@ -1 +1 @@ -{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gGAAgG;AAChG,8CAAwC;AAUxC,wCAAqC;AACrC,mDAAoC;AAEpC,iEAAkD;AAElD,0CAA0C;AAC1C,cAAO,CAAC,SAAS,GAAG,IAAI,cAAO,EAAE,CAAA;AAEpB,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C,MAAa,MAAO,SAAQ,cAAO;IAiBjC,YAAY,KAA+B,EAAE,IAAsB;QACjE,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;QAEjE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;IACpE,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,YAAY,CACzB,KAA+B,EAC/B,IAAsB;QAEtB,OAAO;YACL,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YACtC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE;SAC/C,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,iBAAiB,CAC9B,IAA+B;QAE/B,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACrB,MAAM,OAAO,qBAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,iEAAiE;QAE9F,OAAO;QACP,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACjD,IAAI,IAAI,EAAE;YACR,OAAO,CAAC,IAAI,GAAG,IAAI,CAAA;SACpB;QAED,QAAQ;QACR,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;QAC3C,IAAI,KAAK,EAAE;YACT,iEAAiE;YACjE,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAA;YAE7D,gBAAgB;YAChB,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;SAC9B;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;IAEO,MAAM,CAAC,UAAU,CAAC,IAA+B;QACvD,MAAM,QAAQ,GAA6B,EAAE,CAAA;QAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACrB,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QAEvB,gBAAgB;QAChB,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAC/C,IAAI,IAAI,EAAE;YACR,QAAQ,CAAC,OAAO,GAAG;gBACjB,aAAa,EAAE,IAAI;aACpB,CAAA;SACF;QAED,QAAQ;QACR,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;QAC3C,IAAI,KAAK,EAAE;YACT,QAAQ,CAAC,OAAO,GAAG,EAAC,KAAK,EAAC,CAAA;SAC3B;QAED,OAAO,iBAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACnC,CAAC;IAEO,MAAM,CAAC,aAAa,CAC1B,KAAa,EACb,OAAwB;QAExB,gBAAgB;QAChB,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;SAC5D;aAAM,IAAI,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE;YAChC,MAAM,IAAI,KAAK,CACb,0DAA0D,CAC3D,CAAA;SACF;QAED,OAAO,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,KAAK,EAAE,CAAA;IAC3E,CAAC;IAEO,MAAM,CAAC,aAAa,CAC1B,OAAwB;;QAExB,IAAI,QAAC,OAAO,CAAC,OAAO,0CAAE,KAAK,CAAA,EAAE;YAC3B,MAAM,SAAS,GAAG,wBAAwB,CAAA;YAC1C,IAAI,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE;gBACrC,MAAM,EAAE,GAAG,IAAI,UAAU,CAAC,UAAU,EAAE,CAAA;gBACtC,OAAO,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;aAC9B;SACF;QAED,OAAO,SAAS,CAAA;IAClB,CAAC;CACF;AAhHD,wBAgHC"} \ No newline at end of file +{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;AACpC,mCAAiD;AAKpC,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C;;;;;GAKG;AACH,SAAgB,UAAU,CACxB,KAAa,EACb,OAAwB;IAExB,OAAO,IAAI,cAAM,CAAC,yBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AACtD,CAAC;AALD,gCAKC"} \ No newline at end of file diff --git a/node_modules/@actions/github/lib/interfaces.d.ts b/node_modules/@actions/github/lib/interfaces.d.ts index 23788cced..f81033325 100644 --- a/node_modules/@actions/github/lib/interfaces.d.ts +++ b/node_modules/@actions/github/lib/interfaces.d.ts @@ -33,4 +33,8 @@ export interface WebhookPayload { id: number; [key: string]: any; }; + comment?: { + id: number; + [key: string]: any; + }; } diff --git a/node_modules/@actions/github/lib/internal/utils.d.ts b/node_modules/@actions/github/lib/internal/utils.d.ts new file mode 100644 index 000000000..5790d91f0 --- /dev/null +++ b/node_modules/@actions/github/lib/internal/utils.d.ts @@ -0,0 +1,6 @@ +/// +import * as http from 'http'; +import { OctokitOptions } from '@octokit/core/dist-types/types'; +export declare function getAuthString(token: string, options: OctokitOptions): string | undefined; +export declare function getProxyAgent(destinationUrl: string): http.Agent; +export declare function getApiBaseUrl(): string; diff --git a/node_modules/@actions/github/lib/internal/utils.js b/node_modules/@actions/github/lib/internal/utils.js new file mode 100644 index 000000000..197a441e2 --- /dev/null +++ b/node_modules/@actions/github/lib/internal/utils.js @@ -0,0 +1,43 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0; +const httpClient = __importStar(require("@actions/http-client")); +function getAuthString(token, options) { + if (!token && !options.auth) { + throw new Error('Parameter token or opts.auth is required'); + } + else if (token && options.auth) { + throw new Error('Parameters token and opts.auth may not both be specified'); + } + return typeof options.auth === 'string' ? options.auth : `token ${token}`; +} +exports.getAuthString = getAuthString; +function getProxyAgent(destinationUrl) { + const hc = new httpClient.HttpClient(); + return hc.getAgent(destinationUrl); +} +exports.getProxyAgent = getProxyAgent; +function getApiBaseUrl() { + return process.env['GITHUB_API_URL'] || 'https://api.github.com'; +} +exports.getApiBaseUrl = getApiBaseUrl; +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@actions/github/lib/internal/utils.js.map b/node_modules/@actions/github/lib/internal/utils.js.map new file mode 100644 index 000000000..f1f519d5f --- /dev/null +++ b/node_modules/@actions/github/lib/internal/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/internal/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,iEAAkD;AAGlD,SAAgB,aAAa,CAC3B,KAAa,EACb,OAAuB;IAEvB,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;SAAM,IAAI,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAA;KAC5E;IAED,OAAO,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,KAAK,EAAE,CAAA;AAC3E,CAAC;AAXD,sCAWC;AAED,SAAgB,aAAa,CAAC,cAAsB;IAClD,MAAM,EAAE,GAAG,IAAI,UAAU,CAAC,UAAU,EAAE,CAAA;IACtC,OAAO,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;AACpC,CAAC;AAHD,sCAGC;AAED,SAAgB,aAAa;IAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,wBAAwB,CAAA;AAClE,CAAC;AAFD,sCAEC"} \ No newline at end of file diff --git a/node_modules/@actions/github/lib/utils.d.ts b/node_modules/@actions/github/lib/utils.d.ts new file mode 100644 index 000000000..0015a35fd --- /dev/null +++ b/node_modules/@actions/github/lib/utils.d.ts @@ -0,0 +1,21 @@ +import * as Context from './context'; +import { Octokit } from '@octokit/core'; +import { OctokitOptions } from '@octokit/core/dist-types/types'; +export declare const context: Context.Context; +export declare const GitHub: (new (...args: any[]) => { + [x: string]: any; +}) & { + new (...args: any[]): { + [x: string]: any; + }; + plugins: any[]; +} & typeof Octokit & import("@octokit/core/dist-types/types").Constructor; +/** + * Convience function to correctly format Octokit Options to pass into the constructor. + * + * @param token the repo PAT or GITHUB_TOKEN + * @param options other options to set + */ +export declare function getOctokitOptions(token: string, options?: OctokitOptions): OctokitOptions; diff --git a/node_modules/@actions/github/lib/utils.js b/node_modules/@actions/github/lib/utils.js new file mode 100644 index 000000000..b066c225c --- /dev/null +++ b/node_modules/@actions/github/lib/utils.js @@ -0,0 +1,54 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getOctokitOptions = exports.GitHub = exports.context = void 0; +const Context = __importStar(require("./context")); +const Utils = __importStar(require("./internal/utils")); +// octokit + plugins +const core_1 = require("@octokit/core"); +const plugin_rest_endpoint_methods_1 = require("@octokit/plugin-rest-endpoint-methods"); +const plugin_paginate_rest_1 = require("@octokit/plugin-paginate-rest"); +exports.context = new Context.Context(); +const baseUrl = Utils.getApiBaseUrl(); +const defaults = { + baseUrl, + request: { + agent: Utils.getProxyAgent(baseUrl) + } +}; +exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(defaults); +/** + * Convience function to correctly format Octokit Options to pass into the constructor. + * + * @param token the repo PAT or GITHUB_TOKEN + * @param options other options to set + */ +function getOctokitOptions(token, options) { + const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller + // Auth + const auth = Utils.getAuthString(token, opts); + if (auth) { + opts.auth = auth; + } + return opts; +} +exports.getOctokitOptions = getOctokitOptions; +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@actions/github/lib/utils.js.map b/node_modules/@actions/github/lib/utils.js.map new file mode 100644 index 000000000..3a6f6b427 --- /dev/null +++ b/node_modules/@actions/github/lib/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;AACpC,wDAAyC;AAEzC,oBAAoB;AACpB,wCAAqC;AAErC,wFAAyE;AACzE,wEAA0D;AAE7C,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,EAAE,CAAA;AACrC,MAAM,QAAQ,GAAG;IACf,OAAO;IACP,OAAO,EAAE;QACP,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC;KACpC;CACF,CAAA;AAEY,QAAA,MAAM,GAAG,cAAO,CAAC,MAAM,CAClC,kDAAmB,EACnB,mCAAY,CACb,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAEpB;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,KAAa,EACb,OAAwB;IAExB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,IAAI,EAAE,CAAC,CAAA,CAAC,iEAAiE;IAE/G,OAAO;IACP,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAC7C,IAAI,IAAI,EAAE;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;KACjB;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAbD,8CAaC"} \ No newline at end of file diff --git a/node_modules/@actions/github/package.json b/node_modules/@actions/github/package.json index f17de2d34..8cf79e307 100644 --- a/node_modules/@actions/github/package.json +++ b/node_modules/@actions/github/package.json @@ -1,44 +1,43 @@ { - "_args": [ - [ - "@actions/github@2.1.1", - "/home/runner/work/readable-readme/readable-readme" - ] - ], - "_from": "@actions/github@2.1.1", - "_id": "@actions/github@2.1.1", + "_from": "@actions/github@^4.0.0", + "_id": "@actions/github@4.0.0", "_inBundle": false, - "_integrity": "sha512-kAgTGUx7yf5KQCndVeHSwCNZuDBvPyxm5xKTswW2lofugeuC1AZX73nUUVDNaysnM9aKFMHv9YCdVJbg7syEyA==", + "_integrity": "sha512-Ej/Y2E+VV6sR9X7pWL5F3VgEWrABaT292DRqRU6R4hnQjPtC/zD3nagxVdXWiRQvYDh8kHXo7IDmG42eJ/dOMA==", "_location": "/@actions/github", "_phantomChildren": {}, "_requested": { - "type": "version", + "type": "range", "registry": true, - "raw": "@actions/github@2.1.1", + "raw": "@actions/github@^4.0.0", "name": "@actions/github", "escapedName": "@actions%2fgithub", "scope": "@actions", - "rawSpec": "2.1.1", + "rawSpec": "^4.0.0", "saveSpec": null, - "fetchSpec": "2.1.1" + "fetchSpec": "^4.0.0" }, "_requiredBy": [ + "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/@actions/github/-/github-2.1.1.tgz", - "_spec": "2.1.1", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_resolved": "https://registry.npmjs.org/@actions/github/-/github-4.0.0.tgz", + "_shasum": "d520483151a2bf5d2dc9cd0f20f9ac3a2e458816", + "_spec": "@actions/github@^4.0.0", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/actions/toolkit/issues" }, + "bundleDependencies": false, "dependencies": { - "@actions/http-client": "^1.0.3", - "@octokit/graphql": "^4.3.1", - "@octokit/rest": "^16.43.1" + "@actions/http-client": "^1.0.8", + "@octokit/core": "^3.0.0", + "@octokit/plugin-paginate-rest": "^2.2.3", + "@octokit/plugin-rest-endpoint-methods": "^4.0.0" }, + "deprecated": false, "description": "Actions github lib", "devDependencies": { - "jest": "^24.7.1", + "jest": "^25.1.0", "proxy": "^1.0.1" }, "directories": { @@ -46,7 +45,8 @@ "test": "__tests__" }, "files": [ - "lib" + "lib", + "!.DS_Store" ], "homepage": "https://github.com/actions/toolkit/tree/master/packages/github", "keywords": [ @@ -73,5 +73,5 @@ "tsc": "tsc" }, "types": "lib/github.d.ts", - "version": "2.1.1" + "version": "4.0.0" } diff --git a/node_modules/@actions/http-client/RELEASES.md b/node_modules/@actions/http-client/RELEASES.md index c8040ed3d..79f9a5819 100644 --- a/node_modules/@actions/http-client/RELEASES.md +++ b/node_modules/@actions/http-client/RELEASES.md @@ -1,5 +1,8 @@ ## Releases +## 1.0.7 +Update NPM dependencies and add 429 to the list of HttpCodes + ## 1.0.6 Automatically sends Content-Type and Accept application/json headers for \Json() helper methods if not set in the client or parameters. diff --git a/node_modules/@actions/http-client/auth.js b/node_modules/@actions/http-client/auth.js index 98d22d66d..67a58aa78 100644 --- a/node_modules/@actions/http-client/auth.js +++ b/node_modules/@actions/http-client/auth.js @@ -6,7 +6,9 @@ class BasicCredentialHandler { this.password = password; } prepareRequest(options) { - options.headers['Authorization'] = 'Basic ' + Buffer.from(this.username + ':' + this.password).toString('base64'); + options.headers['Authorization'] = + 'Basic ' + + Buffer.from(this.username + ':' + this.password).toString('base64'); } // This handler cannot handle 401 canHandleAuthentication(response) { @@ -42,7 +44,8 @@ class PersonalAccessTokenCredentialHandler { // currently implements pre-authorization // TODO: support preAuth = false where it hooks on 401 prepareRequest(options) { - options.headers['Authorization'] = 'Basic ' + Buffer.from('PAT:' + this.token).toString('base64'); + options.headers['Authorization'] = + 'Basic ' + Buffer.from('PAT:' + this.token).toString('base64'); } // This handler cannot handle 401 canHandleAuthentication(response) { diff --git a/node_modules/@actions/http-client/index.d.ts b/node_modules/@actions/http-client/index.d.ts index 2bbcc6a1e..7cdc11554 100644 --- a/node_modules/@actions/http-client/index.d.ts +++ b/node_modules/@actions/http-client/index.d.ts @@ -1,5 +1,5 @@ /// -import http = require("http"); +import http = require('http'); import ifm = require('./interfaces'); export declare enum HttpCodes { OK = 200, @@ -23,6 +23,7 @@ export declare enum HttpCodes { RequestTimeout = 408, Conflict = 409, Gone = 410, + TooManyRequests = 429, InternalServerError = 500, NotImplemented = 501, BadGateway = 502, diff --git a/node_modules/@actions/http-client/index.js b/node_modules/@actions/http-client/index.js index 7e553a6f3..e1930da87 100644 --- a/node_modules/@actions/http-client/index.js +++ b/node_modules/@actions/http-client/index.js @@ -28,6 +28,7 @@ var HttpCodes; HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; + HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; @@ -52,8 +53,18 @@ function getProxyUrl(serverUrl) { return proxyUrl ? proxyUrl.href : ''; } exports.getProxyUrl = getProxyUrl; -const HttpRedirectCodes = [HttpCodes.MovedPermanently, HttpCodes.ResourceMoved, HttpCodes.SeeOther, HttpCodes.TemporaryRedirect, HttpCodes.PermanentRedirect]; -const HttpResponseRetryCodes = [HttpCodes.BadGateway, HttpCodes.ServiceUnavailable, HttpCodes.GatewayTimeout]; +const HttpRedirectCodes = [ + HttpCodes.MovedPermanently, + HttpCodes.ResourceMoved, + HttpCodes.SeeOther, + HttpCodes.TemporaryRedirect, + HttpCodes.PermanentRedirect +]; +const HttpResponseRetryCodes = [ + HttpCodes.BadGateway, + HttpCodes.ServiceUnavailable, + HttpCodes.GatewayTimeout +]; const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; const ExponentialBackoffCeiling = 10; const ExponentialBackoffTimeSlice = 5; @@ -178,18 +189,22 @@ class HttpClient { */ async request(verb, requestUrl, data, headers) { if (this._disposed) { - throw new Error("Client has already been disposed."); + throw new Error('Client has already been disposed.'); } let parsedUrl = url.parse(requestUrl); let info = this._prepareRequest(verb, parsedUrl, headers); // Only perform retries on reads since writes may not be idempotent. - let maxTries = (this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1) ? this._maxRetries + 1 : 1; + let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1 + ? this._maxRetries + 1 + : 1; let numTries = 0; let response; while (numTries < maxTries) { response = await this.requestRaw(info, data); // Check if it's an authentication challenge - if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) { + if (response && + response.message && + response.message.statusCode === HttpCodes.Unauthorized) { let authenticationHandler; for (let i = 0; i < this.handlers.length; i++) { if (this.handlers[i].canHandleAuthentication(response)) { @@ -207,21 +222,32 @@ class HttpClient { } } let redirectsRemaining = this._maxRedirects; - while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 - && this._allowRedirects - && redirectsRemaining > 0) { - const redirectUrl = response.message.headers["location"]; + while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 && + this._allowRedirects && + redirectsRemaining > 0) { + const redirectUrl = response.message.headers['location']; if (!redirectUrl) { // if there's no location to redirect to, we won't break; } let parsedRedirectUrl = url.parse(redirectUrl); - if (parsedUrl.protocol == 'https:' && parsedUrl.protocol != parsedRedirectUrl.protocol && !this._allowRedirectDowngrade) { - throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true."); + if (parsedUrl.protocol == 'https:' && + parsedUrl.protocol != parsedRedirectUrl.protocol && + !this._allowRedirectDowngrade) { + throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.'); } // we need to finish reading the response before reassigning response // which will leak the open socket. await response.readBody(); + // strip authorization header if redirected to a different hostname + if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { + for (let header in headers) { + // header names are case insensitive + if (header.toLowerCase() === 'authorization') { + delete headers[header]; + } + } + } // let's make the request with the new redirectUrl info = this._prepareRequest(verb, parsedRedirectUrl, headers); response = await this.requestRaw(info, data); @@ -272,8 +298,8 @@ class HttpClient { */ requestRawWithCallback(info, data, onResult) { let socket; - if (typeof (data) === 'string') { - info.options.headers["Content-Length"] = Buffer.byteLength(data, 'utf8'); + if (typeof data === 'string') { + info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); } let callbackCalled = false; let handleResult = (err, res) => { @@ -286,7 +312,7 @@ class HttpClient { let res = new HttpClientResponse(msg); handleResult(null, res); }); - req.on('socket', (sock) => { + req.on('socket', sock => { socket = sock; }); // If we ever get disconnected, we want the socket to timeout eventually @@ -301,10 +327,10 @@ class HttpClient { // res should have headers handleResult(err, null); }); - if (data && typeof (data) === 'string') { + if (data && typeof data === 'string') { req.write(data, 'utf8'); } - if (data && typeof (data) !== 'string') { + if (data && typeof data !== 'string') { data.on('close', function () { req.end(); }); @@ -331,31 +357,34 @@ class HttpClient { const defaultPort = usingSsl ? 443 : 80; info.options = {}; info.options.host = info.parsedUrl.hostname; - info.options.port = info.parsedUrl.port ? parseInt(info.parsedUrl.port) : defaultPort; - info.options.path = (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); + info.options.port = info.parsedUrl.port + ? parseInt(info.parsedUrl.port) + : defaultPort; + info.options.path = + (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); info.options.method = method; info.options.headers = this._mergeHeaders(headers); if (this.userAgent != null) { - info.options.headers["user-agent"] = this.userAgent; + info.options.headers['user-agent'] = this.userAgent; } info.options.agent = this._getAgent(info.parsedUrl); // gives handlers an opportunity to participate if (this.handlers) { - this.handlers.forEach((handler) => { + this.handlers.forEach(handler => { handler.prepareRequest(info.options); }); } return info; } _mergeHeaders(headers) { - const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); if (this.requestOptions && this.requestOptions.headers) { return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); } return lowercaseKeys(headers || {}); } _getExistingOrDefaultHeader(additionalHeaders, header, _default) { - const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); let clientHeader; if (this.requestOptions && this.requestOptions.headers) { clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; @@ -393,7 +422,7 @@ class HttpClient { proxyAuth: proxyUrl.auth, host: proxyUrl.hostname, port: proxyUrl.port - }, + } }; let tunnelAgent; const overHttps = proxyUrl.protocol === 'https:'; @@ -420,7 +449,9 @@ class HttpClient { // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options // we have to cast it to any and change it directly - agent.options = Object.assign(agent.options || {}, { rejectUnauthorized: false }); + agent.options = Object.assign(agent.options || {}, { + rejectUnauthorized: false + }); } return agent; } @@ -481,7 +512,7 @@ class HttpClient { msg = contents; } else { - msg = "Failed request: (" + statusCode + ")"; + msg = 'Failed request: (' + statusCode + ')'; } let err = new Error(msg); // attach statusCode and body obj (if available) to the error object diff --git a/node_modules/@actions/http-client/interfaces.d.ts b/node_modules/@actions/http-client/interfaces.d.ts index 7e3fc3f06..0b348dc01 100644 --- a/node_modules/@actions/http-client/interfaces.d.ts +++ b/node_modules/@actions/http-client/interfaces.d.ts @@ -1,6 +1,6 @@ /// -import http = require("http"); -import url = require("url"); +import http = require('http'); +import url = require('url'); export interface IHeaders { [key: string]: any; } diff --git a/node_modules/@actions/http-client/interfaces.js b/node_modules/@actions/http-client/interfaces.js index 04363ad2b..c8ad2e549 100644 --- a/node_modules/@actions/http-client/interfaces.js +++ b/node_modules/@actions/http-client/interfaces.js @@ -1,3 +1,2 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -; diff --git a/node_modules/@actions/http-client/package.json b/node_modules/@actions/http-client/package.json index 372b9aae2..1880c0379 100644 --- a/node_modules/@actions/http-client/package.json +++ b/node_modules/@actions/http-client/package.json @@ -1,33 +1,33 @@ { "_args": [ [ - "@actions/http-client@1.0.6", - "/home/runner/work/readable-readme/readable-readme" + "@actions/http-client@1.0.8", + "/workspace/readable-readme" ] ], - "_from": "@actions/http-client@1.0.6", - "_id": "@actions/http-client@1.0.6", + "_from": "@actions/http-client@1.0.8", + "_id": "@actions/http-client@1.0.8", "_inBundle": false, - "_integrity": "sha512-LGmio4w98UyGX33b/W6V6Nx/sQHRXZ859YlMkn36wPsXPB82u8xTVlA/Dq2DXrm6lEq9RVmisRJa1c+HETAIJA==", + "_integrity": "sha512-G4JjJ6f9Hb3Zvejj+ewLLKLf99ZC+9v+yCxoYf9vSyH+WkzPLB2LuUtRMGNkooMqdugGBFStIKXOuvH1W+EctA==", "_location": "/@actions/http-client", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "@actions/http-client@1.0.6", + "raw": "@actions/http-client@1.0.8", "name": "@actions/http-client", "escapedName": "@actions%2fhttp-client", "scope": "@actions", - "rawSpec": "1.0.6", + "rawSpec": "1.0.8", "saveSpec": null, - "fetchSpec": "1.0.6" + "fetchSpec": "1.0.8" }, "_requiredBy": [ "/@actions/github" ], - "_resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.6.tgz", - "_spec": "1.0.6", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.8.tgz", + "_spec": "1.0.8", + "_where": "/workspace/readable-readme", "author": { "name": "GitHub, Inc." }, @@ -39,12 +39,13 @@ }, "description": "Actions Http Client", "devDependencies": { - "@types/jest": "^24.0.25", - "@types/node": "^12.12.24", - "jest": "^24.9.0", + "@types/jest": "^25.1.4", + "@types/node": "^12.12.31", + "jest": "^25.1.0", + "prettier": "^2.0.4", "proxy": "^1.0.1", - "ts-jest": "^24.3.0", - "typescript": "^3.7.4" + "ts-jest": "^25.2.1", + "typescript": "^3.8.3" }, "homepage": "https://github.com/actions/http-client#readme", "keywords": [ @@ -59,8 +60,11 @@ "url": "git+https://github.com/actions/http-client.git" }, "scripts": { + "audit-check": "npm audit --audit-level=moderate", "build": "rm -Rf ./_out && tsc && cp package*.json ./_out && cp *.md ./_out && cp LICENSE ./_out && cp actions.png ./_out", + "format": "prettier --write *.ts && prettier --write **/*.ts", + "format-check": "prettier --check *.ts && prettier --check **/*.ts", "test": "jest" }, - "version": "1.0.6" + "version": "1.0.8" } diff --git a/node_modules/@actions/http-client/proxy.js b/node_modules/@actions/http-client/proxy.js index 7233779e4..06936b392 100644 --- a/node_modules/@actions/http-client/proxy.js +++ b/node_modules/@actions/http-client/proxy.js @@ -9,12 +9,10 @@ function getProxyUrl(reqUrl) { } let proxyVar; if (usingSsl) { - proxyVar = process.env["https_proxy"] || - process.env["HTTPS_PROXY"]; + proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY']; } else { - proxyVar = process.env["http_proxy"] || - process.env["HTTP_PROXY"]; + proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY']; } if (proxyVar) { proxyUrl = url.parse(proxyVar); @@ -26,7 +24,7 @@ function checkBypass(reqUrl) { if (!reqUrl.hostname) { return false; } - let noProxy = process.env["no_proxy"] || process.env["NO_PROXY"] || ''; + let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; if (!noProxy) { return false; } @@ -47,7 +45,10 @@ function checkBypass(reqUrl) { upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); } // Compare request host against noproxy - for (let upperNoProxyItem of noProxy.split(',').map(x => x.trim().toUpperCase()).filter(x => x)) { + for (let upperNoProxyItem of noProxy + .split(',') + .map(x => x.trim().toUpperCase()) + .filter(x => x)) { if (upperReqHosts.some(x => x === upperNoProxyItem)) { return true; } diff --git a/node_modules/@babel/code-frame/package.json b/node_modules/@babel/code-frame/package.json index 2303a1222..425ee4432 100644 --- a/node_modules/@babel/code-frame/package.json +++ b/node_modules/@babel/code-frame/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/code-frame@7.5.5", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,13 +27,19 @@ "/@babel/core", "/@babel/template", "/@babel/traverse", + "/@jest/test-sequencer/jest-message-util", "/jest-circus/jest-message-util", + "/jest-config/jest-message-util", + "/jest-jasmine2/jest-message-util", "/jest-message-util", + "/jest-runner/jest-message-util", + "/jest-runtime/jest-message-util", + "/parse-json", "/tslint" ], "_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", "_spec": "7.5.5", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/core/node_modules/debug/package.json b/node_modules/@babel/core/node_modules/debug/package.json index de0c4058c..44eb4703c 100644 --- a/node_modules/@babel/core/node_modules/debug/package.json +++ b/node_modules/@babel/core/node_modules/debug/package.json @@ -2,7 +2,7 @@ "_args": [ [ "debug@4.1.1", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "_spec": "4.1.1", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" diff --git a/node_modules/@babel/core/node_modules/ms/package.json b/node_modules/@babel/core/node_modules/ms/package.json index b09fefd66..9a671ba06 100644 --- a/node_modules/@babel/core/node_modules/ms/package.json +++ b/node_modules/@babel/core/node_modules/ms/package.json @@ -2,7 +2,7 @@ "_args": [ [ "ms@2.1.2", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "_spec": "2.1.2", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/zeit/ms/issues" }, diff --git a/node_modules/@babel/core/node_modules/semver/package.json b/node_modules/@babel/core/node_modules/semver/package.json index e05349638..eb1f32a3b 100644 --- a/node_modules/@babel/core/node_modules/semver/package.json +++ b/node_modules/@babel/core/node_modules/semver/package.json @@ -2,7 +2,7 @@ "_args": [ [ "semver@5.7.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,9 +27,9 @@ ], "_resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", "_spec": "5.7.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "bin": { - "semver": "./bin/semver" + "semver": "bin/semver" }, "bugs": { "url": "https://github.com/npm/node-semver/issues" diff --git a/node_modules/@babel/core/node_modules/source-map/package.json b/node_modules/@babel/core/node_modules/source-map/package.json index 6141fcae5..e862ad389 100644 --- a/node_modules/@babel/core/node_modules/source-map/package.json +++ b/node_modules/@babel/core/node_modules/source-map/package.json @@ -2,7 +2,7 @@ "_args": [ [ "source-map@0.5.7", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "_spec": "0.5.7", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Nick Fitzgerald", "email": "nfitzgerald@mozilla.com" diff --git a/node_modules/@babel/core/package.json b/node_modules/@babel/core/package.json index 53f4647cb..5966b6591 100644 --- a/node_modules/@babel/core/package.json +++ b/node_modules/@babel/core/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/core@7.5.5", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -24,13 +24,16 @@ "fetchSpec": "7.5.5" }, "_requiredBy": [ + "/@jest/core/jest-config", "/@jest/transform", - "/jest-circus/@jest/transform", - "/jest-config" + "/jest-config", + "/jest-config/@jest/transform", + "/jest-runtime/@jest/transform", + "/jest/jest-config" ], "_resolved": "https://registry.npmjs.org/@babel/core/-/core-7.5.5.tgz", "_spec": "7.5.5", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/generator/node_modules/source-map/package.json b/node_modules/@babel/generator/node_modules/source-map/package.json index 1ba9ffe7d..fa4c1550e 100644 --- a/node_modules/@babel/generator/node_modules/source-map/package.json +++ b/node_modules/@babel/generator/node_modules/source-map/package.json @@ -2,7 +2,7 @@ "_args": [ [ "source-map@0.5.7", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "_spec": "0.5.7", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Nick Fitzgerald", "email": "nfitzgerald@mozilla.com" diff --git a/node_modules/@babel/generator/package.json b/node_modules/@babel/generator/package.json index 107e6cced..914de4e9a 100644 --- a/node_modules/@babel/generator/package.json +++ b/node_modules/@babel/generator/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/generator@7.5.5", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -29,7 +29,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.5.5.tgz", "_spec": "7.5.5", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-function-name/package.json b/node_modules/@babel/helper-function-name/package.json index 63f228c55..387bae378 100644 --- a/node_modules/@babel/helper-function-name/package.json +++ b/node_modules/@babel/helper-function-name/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-function-name@7.1.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz", "_spec": "7.1.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/helper-get-function-arity": "^7.0.0", "@babel/template": "^7.1.0", diff --git a/node_modules/@babel/helper-get-function-arity/package.json b/node_modules/@babel/helper-get-function-arity/package.json index 54311d87e..7bb23ea7b 100644 --- a/node_modules/@babel/helper-get-function-arity/package.json +++ b/node_modules/@babel/helper-get-function-arity/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-get-function-arity@7.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz", "_spec": "7.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/types": "^7.0.0" }, diff --git a/node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/package.json b/node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/package.json index 0d770aa0b..7067c01e6 100644 --- a/node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/package.json +++ b/node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/types@7.9.0", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.0.tgz", "_spec": "7.9.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-member-expression-to-functions/package.json b/node_modules/@babel/helper-member-expression-to-functions/package.json index 3db2dd708..293285eb6 100644 --- a/node_modules/@babel/helper-member-expression-to-functions/package.json +++ b/node_modules/@babel/helper-member-expression-to-functions/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-member-expression-to-functions@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -13,7 +13,7 @@ "_location": "/@babel/helper-member-expression-to-functions", "_phantomChildren": { "@babel/helper-validator-identifier": "7.9.0", - "lodash": "4.17.15", + "lodash": "4.17.19", "to-fast-properties": "2.0.0" }, "_requested": { @@ -32,7 +32,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Justin Ridgewell", "email": "justin@ridgewell.name" diff --git a/node_modules/@babel/helper-module-imports/node_modules/@babel/types/package.json b/node_modules/@babel/helper-module-imports/node_modules/@babel/types/package.json index 36a09ec31..3ea622ab6 100644 --- a/node_modules/@babel/helper-module-imports/node_modules/@babel/types/package.json +++ b/node_modules/@babel/helper-module-imports/node_modules/@babel/types/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/types@7.9.0", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.0.tgz", "_spec": "7.9.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-module-imports/package.json b/node_modules/@babel/helper-module-imports/package.json index 0f5d6db4f..6568dd2ff 100644 --- a/node_modules/@babel/helper-module-imports/package.json +++ b/node_modules/@babel/helper-module-imports/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-module-imports@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -13,7 +13,7 @@ "_location": "/@babel/helper-module-imports", "_phantomChildren": { "@babel/helper-validator-identifier": "7.9.0", - "lodash": "4.17.15", + "lodash": "4.17.19", "to-fast-properties": "2.0.0" }, "_requested": { @@ -32,7 +32,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/helper-module-transforms/node_modules/@babel/code-frame/package.json b/node_modules/@babel/helper-module-transforms/node_modules/@babel/code-frame/package.json index 1a18f9111..f7286ba91 100644 --- a/node_modules/@babel/helper-module-transforms/node_modules/@babel/code-frame/package.json +++ b/node_modules/@babel/helper-module-transforms/node_modules/@babel/code-frame/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/code-frame@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-module-transforms/node_modules/@babel/helper-split-export-declaration/package.json b/node_modules/@babel/helper-module-transforms/node_modules/@babel/helper-split-export-declaration/package.json index 856f5eec8..a835fe4fe 100644 --- a/node_modules/@babel/helper-module-transforms/node_modules/@babel/helper-split-export-declaration/package.json +++ b/node_modules/@babel/helper-module-transforms/node_modules/@babel/helper-split-export-declaration/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-split-export-declaration@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/types": "^7.8.3" }, diff --git a/node_modules/@babel/helper-module-transforms/node_modules/@babel/highlight/package.json b/node_modules/@babel/helper-module-transforms/node_modules/@babel/highlight/package.json index 2da9fa89a..7640887b0 100644 --- a/node_modules/@babel/helper-module-transforms/node_modules/@babel/highlight/package.json +++ b/node_modules/@babel/helper-module-transforms/node_modules/@babel/highlight/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/highlight@7.9.0", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", "_spec": "7.9.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "suchipi", "email": "me@suchipi.com" diff --git a/node_modules/@babel/helper-module-transforms/node_modules/@babel/parser/package.json b/node_modules/@babel/helper-module-transforms/node_modules/@babel/parser/package.json index 4d3c12ba6..51531ca76 100644 --- a/node_modules/@babel/helper-module-transforms/node_modules/@babel/parser/package.json +++ b/node_modules/@babel/helper-module-transforms/node_modules/@babel/parser/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/parser@7.9.4", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.4.tgz", "_spec": "7.9.4", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-module-transforms/node_modules/@babel/template/package.json b/node_modules/@babel/helper-module-transforms/node_modules/@babel/template/package.json index a4b748b27..7e40ca4ac 100644 --- a/node_modules/@babel/helper-module-transforms/node_modules/@babel/template/package.json +++ b/node_modules/@babel/helper-module-transforms/node_modules/@babel/template/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/template@7.8.6", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", "_spec": "7.8.6", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-module-transforms/node_modules/@babel/types/package.json b/node_modules/@babel/helper-module-transforms/node_modules/@babel/types/package.json index 4cb97bd13..ffcda84a3 100644 --- a/node_modules/@babel/helper-module-transforms/node_modules/@babel/types/package.json +++ b/node_modules/@babel/helper-module-transforms/node_modules/@babel/types/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/types@7.9.0", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -30,7 +30,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.0.tgz", "_spec": "7.9.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-module-transforms/package.json b/node_modules/@babel/helper-module-transforms/package.json index 4aa76af9a..7515765fc 100644 --- a/node_modules/@babel/helper-module-transforms/package.json +++ b/node_modules/@babel/helper-module-transforms/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-module-transforms@7.9.0", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -15,7 +15,7 @@ "@babel/helper-validator-identifier": "7.9.0", "chalk": "2.4.2", "js-tokens": "4.0.0", - "lodash": "4.17.15", + "lodash": "4.17.19", "to-fast-properties": "2.0.0" }, "_requested": { @@ -34,7 +34,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.9.0.tgz", "_spec": "7.9.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/helper-optimise-call-expression/node_modules/@babel/types/package.json b/node_modules/@babel/helper-optimise-call-expression/node_modules/@babel/types/package.json index e85d46bfb..0789cf604 100644 --- a/node_modules/@babel/helper-optimise-call-expression/node_modules/@babel/types/package.json +++ b/node_modules/@babel/helper-optimise-call-expression/node_modules/@babel/types/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/types@7.9.0", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.0.tgz", "_spec": "7.9.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-optimise-call-expression/package.json b/node_modules/@babel/helper-optimise-call-expression/package.json index c1142ceaa..5e81ca487 100644 --- a/node_modules/@babel/helper-optimise-call-expression/package.json +++ b/node_modules/@babel/helper-optimise-call-expression/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-optimise-call-expression@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -13,7 +13,7 @@ "_location": "/@babel/helper-optimise-call-expression", "_phantomChildren": { "@babel/helper-validator-identifier": "7.9.0", - "lodash": "4.17.15", + "lodash": "4.17.19", "to-fast-properties": "2.0.0" }, "_requested": { @@ -32,7 +32,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/types": "^7.8.3" }, diff --git a/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/helper-plugin-utils/package.json index c5c8ecec3..88e64124d 100644 --- a/node_modules/@babel/helper-plugin-utils/package.json +++ b/node_modules/@babel/helper-plugin-utils/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-plugin-utils@7.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -24,12 +24,11 @@ "fetchSpec": "7.0.0" }, "_requiredBy": [ - "/babel-plugin-istanbul", - "/jest-circus/babel-plugin-istanbul" + "/babel-plugin-istanbul" ], "_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz", "_spec": "7.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/helper-replace-supers/node_modules/@babel/code-frame/package.json b/node_modules/@babel/helper-replace-supers/node_modules/@babel/code-frame/package.json index 59ab39f94..5faf5dd08 100644 --- a/node_modules/@babel/helper-replace-supers/node_modules/@babel/code-frame/package.json +++ b/node_modules/@babel/helper-replace-supers/node_modules/@babel/code-frame/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/code-frame@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -29,7 +29,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-replace-supers/node_modules/@babel/generator/package.json b/node_modules/@babel/helper-replace-supers/node_modules/@babel/generator/package.json index 0fa6c82de..ee946478f 100644 --- a/node_modules/@babel/helper-replace-supers/node_modules/@babel/generator/package.json +++ b/node_modules/@babel/helper-replace-supers/node_modules/@babel/generator/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/generator@7.9.4", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.9.4.tgz", "_spec": "7.9.4", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-function-name/package.json b/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-function-name/package.json index 41b938f03..1c2911284 100644 --- a/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-function-name/package.json +++ b/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-function-name/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-function-name@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/helper-get-function-arity": "^7.8.3", "@babel/template": "^7.8.3", diff --git a/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-get-function-arity/package.json b/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-get-function-arity/package.json index 0963a46a7..9b7d37c45 100644 --- a/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-get-function-arity/package.json +++ b/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-get-function-arity/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-get-function-arity@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/types": "^7.8.3" }, diff --git a/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-split-export-declaration/package.json b/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-split-export-declaration/package.json index 685d01b86..7f63a7aec 100644 --- a/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-split-export-declaration/package.json +++ b/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-split-export-declaration/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-split-export-declaration@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/types": "^7.8.3" }, diff --git a/node_modules/@babel/helper-replace-supers/node_modules/@babel/highlight/package.json b/node_modules/@babel/helper-replace-supers/node_modules/@babel/highlight/package.json index a67cb43e1..2d7a5693e 100644 --- a/node_modules/@babel/helper-replace-supers/node_modules/@babel/highlight/package.json +++ b/node_modules/@babel/helper-replace-supers/node_modules/@babel/highlight/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/highlight@7.9.0", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", "_spec": "7.9.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "suchipi", "email": "me@suchipi.com" diff --git a/node_modules/@babel/helper-replace-supers/node_modules/@babel/parser/package.json b/node_modules/@babel/helper-replace-supers/node_modules/@babel/parser/package.json index effffbd6d..14f62f5fa 100644 --- a/node_modules/@babel/helper-replace-supers/node_modules/@babel/parser/package.json +++ b/node_modules/@babel/helper-replace-supers/node_modules/@babel/parser/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/parser@7.9.4", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -29,7 +29,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.4.tgz", "_spec": "7.9.4", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-replace-supers/node_modules/@babel/template/package.json b/node_modules/@babel/helper-replace-supers/node_modules/@babel/template/package.json index 340c5128e..326a8d2c7 100644 --- a/node_modules/@babel/helper-replace-supers/node_modules/@babel/template/package.json +++ b/node_modules/@babel/helper-replace-supers/node_modules/@babel/template/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/template@7.8.6", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", "_spec": "7.8.6", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-replace-supers/node_modules/@babel/traverse/package.json b/node_modules/@babel/helper-replace-supers/node_modules/@babel/traverse/package.json index e5c322352..6a9e1fddd 100644 --- a/node_modules/@babel/helper-replace-supers/node_modules/@babel/traverse/package.json +++ b/node_modules/@babel/helper-replace-supers/node_modules/@babel/traverse/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/traverse@7.9.0", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.9.0.tgz", "_spec": "7.9.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-replace-supers/node_modules/@babel/types/package.json b/node_modules/@babel/helper-replace-supers/node_modules/@babel/types/package.json index 02771cc07..fd9f85f1c 100644 --- a/node_modules/@babel/helper-replace-supers/node_modules/@babel/types/package.json +++ b/node_modules/@babel/helper-replace-supers/node_modules/@babel/types/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/types@7.9.0", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -34,7 +34,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.0.tgz", "_spec": "7.9.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-replace-supers/node_modules/debug/package.json b/node_modules/@babel/helper-replace-supers/node_modules/debug/package.json index d4cf12872..470e1883e 100644 --- a/node_modules/@babel/helper-replace-supers/node_modules/debug/package.json +++ b/node_modules/@babel/helper-replace-supers/node_modules/debug/package.json @@ -2,7 +2,7 @@ "_args": [ [ "debug@4.1.1", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "_spec": "4.1.1", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" diff --git a/node_modules/@babel/helper-replace-supers/node_modules/ms/package.json b/node_modules/@babel/helper-replace-supers/node_modules/ms/package.json index 249ff5299..c9790248d 100644 --- a/node_modules/@babel/helper-replace-supers/node_modules/ms/package.json +++ b/node_modules/@babel/helper-replace-supers/node_modules/ms/package.json @@ -2,7 +2,7 @@ "_args": [ [ "ms@2.1.2", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "_spec": "2.1.2", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/zeit/ms/issues" }, diff --git a/node_modules/@babel/helper-replace-supers/node_modules/source-map/package.json b/node_modules/@babel/helper-replace-supers/node_modules/source-map/package.json index 7830cd79e..93406f447 100644 --- a/node_modules/@babel/helper-replace-supers/node_modules/source-map/package.json +++ b/node_modules/@babel/helper-replace-supers/node_modules/source-map/package.json @@ -2,7 +2,7 @@ "_args": [ [ "source-map@0.5.7", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "_spec": "0.5.7", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Nick Fitzgerald", "email": "nfitzgerald@mozilla.com" diff --git a/node_modules/@babel/helper-replace-supers/package.json b/node_modules/@babel/helper-replace-supers/package.json index 3b5fe94be..433f7f422 100644 --- a/node_modules/@babel/helper-replace-supers/package.json +++ b/node_modules/@babel/helper-replace-supers/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-replace-supers@7.8.6", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -17,7 +17,7 @@ "globals": "11.12.0", "js-tokens": "4.0.0", "jsesc": "2.5.2", - "lodash": "4.17.15", + "lodash": "4.17.19", "to-fast-properties": "2.0.0" }, "_requested": { @@ -36,7 +36,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.8.6.tgz", "_spec": "7.8.6", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/helper-member-expression-to-functions": "^7.8.3", "@babel/helper-optimise-call-expression": "^7.8.3", diff --git a/node_modules/@babel/helper-simple-access/node_modules/@babel/code-frame/package.json b/node_modules/@babel/helper-simple-access/node_modules/@babel/code-frame/package.json index 47c818bc9..1a91acff1 100644 --- a/node_modules/@babel/helper-simple-access/node_modules/@babel/code-frame/package.json +++ b/node_modules/@babel/helper-simple-access/node_modules/@babel/code-frame/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/code-frame@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-simple-access/node_modules/@babel/highlight/package.json b/node_modules/@babel/helper-simple-access/node_modules/@babel/highlight/package.json index c4f518d6f..d95b69b69 100644 --- a/node_modules/@babel/helper-simple-access/node_modules/@babel/highlight/package.json +++ b/node_modules/@babel/helper-simple-access/node_modules/@babel/highlight/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/highlight@7.9.0", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", "_spec": "7.9.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "suchipi", "email": "me@suchipi.com" diff --git a/node_modules/@babel/helper-simple-access/node_modules/@babel/parser/package.json b/node_modules/@babel/helper-simple-access/node_modules/@babel/parser/package.json index 084692327..e00125c04 100644 --- a/node_modules/@babel/helper-simple-access/node_modules/@babel/parser/package.json +++ b/node_modules/@babel/helper-simple-access/node_modules/@babel/parser/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/parser@7.9.4", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.4.tgz", "_spec": "7.9.4", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-simple-access/node_modules/@babel/template/package.json b/node_modules/@babel/helper-simple-access/node_modules/@babel/template/package.json index 08e479fec..cba8ed184 100644 --- a/node_modules/@babel/helper-simple-access/node_modules/@babel/template/package.json +++ b/node_modules/@babel/helper-simple-access/node_modules/@babel/template/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/template@7.8.6", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", "_spec": "7.8.6", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-simple-access/node_modules/@babel/types/package.json b/node_modules/@babel/helper-simple-access/node_modules/@babel/types/package.json index c2ed2b130..71bea03f7 100644 --- a/node_modules/@babel/helper-simple-access/node_modules/@babel/types/package.json +++ b/node_modules/@babel/helper-simple-access/node_modules/@babel/types/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/types@7.9.0", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -29,7 +29,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.0.tgz", "_spec": "7.9.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/helper-simple-access/package.json b/node_modules/@babel/helper-simple-access/package.json index 1c3df67e2..8c4ae8f43 100644 --- a/node_modules/@babel/helper-simple-access/package.json +++ b/node_modules/@babel/helper-simple-access/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-simple-access@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -15,7 +15,7 @@ "@babel/helper-validator-identifier": "7.9.0", "chalk": "2.4.2", "js-tokens": "4.0.0", - "lodash": "4.17.15", + "lodash": "4.17.19", "to-fast-properties": "2.0.0" }, "_requested": { @@ -34,7 +34,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/helper-split-export-declaration/package.json b/node_modules/@babel/helper-split-export-declaration/package.json index 0a10c2c8a..2b65d2a32 100644 --- a/node_modules/@babel/helper-split-export-declaration/package.json +++ b/node_modules/@babel/helper-split-export-declaration/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-split-export-declaration@7.4.4", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz", "_spec": "7.4.4", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/types": "^7.4.4" }, diff --git a/node_modules/@babel/helper-validator-identifier/package.json b/node_modules/@babel/helper-validator-identifier/package.json index 9d6ca0b93..8fe57ea28 100644 --- a/node_modules/@babel/helper-validator-identifier/package.json +++ b/node_modules/@babel/helper-validator-identifier/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-validator-identifier@7.9.0", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -38,7 +38,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.0.tgz", "_spec": "7.9.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "description": "Validate identifier/keywords name", "devDependencies": { "charcodes": "^0.2.0", diff --git a/node_modules/@babel/helpers/package.json b/node_modules/@babel/helpers/package.json index a8eedb384..573607cc2 100644 --- a/node_modules/@babel/helpers/package.json +++ b/node_modules/@babel/helpers/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helpers@7.5.5", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.5.5.tgz", "_spec": "7.5.5", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/highlight/package.json b/node_modules/@babel/highlight/package.json index f86b82965..a3d0ca748 100644 --- a/node_modules/@babel/highlight/package.json +++ b/node_modules/@babel/highlight/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/highlight@7.5.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", "_spec": "7.5.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "suchipi", "email": "me@suchipi.com" diff --git a/node_modules/@babel/parser/package.json b/node_modules/@babel/parser/package.json index 82468a314..84c17087d 100644 --- a/node_modules/@babel/parser/package.json +++ b/node_modules/@babel/parser/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/parser@7.5.5", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -32,13 +32,13 @@ ], "_resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.5.5.tgz", "_spec": "7.5.5", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" }, "bin": { - "parser": "./bin/babel-parser.js" + "parser": "bin/babel-parser.js" }, "description": "A JavaScript parser", "devDependencies": { diff --git a/node_modules/@babel/plugin-syntax-async-generators/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/plugin-syntax-async-generators/node_modules/@babel/helper-plugin-utils/package.json index 169ca7675..3b6ca805a 100644 --- a/node_modules/@babel/plugin-syntax-async-generators/node_modules/@babel/helper-plugin-utils/package.json +++ b/node_modules/@babel/plugin-syntax-async-generators/node_modules/@babel/helper-plugin-utils/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-plugin-utils@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/plugin-syntax-async-generators/package.json b/node_modules/@babel/plugin-syntax-async-generators/package.json index 3516971c7..d69ddb2aa 100644 --- a/node_modules/@babel/plugin-syntax-async-generators/package.json +++ b/node_modules/@babel/plugin-syntax-async-generators/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/plugin-syntax-async-generators@7.8.4", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", "_spec": "7.8.4", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, diff --git a/node_modules/@babel/plugin-syntax-bigint/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/plugin-syntax-bigint/node_modules/@babel/helper-plugin-utils/package.json index cc6aef8aa..bdb9f2b83 100644 --- a/node_modules/@babel/plugin-syntax-bigint/node_modules/@babel/helper-plugin-utils/package.json +++ b/node_modules/@babel/plugin-syntax-bigint/node_modules/@babel/helper-plugin-utils/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-plugin-utils@7.8.3", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/plugin-syntax-bigint/package.json b/node_modules/@babel/plugin-syntax-bigint/package.json index 553ad497f..011e7789a 100644 --- a/node_modules/@babel/plugin-syntax-bigint/package.json +++ b/node_modules/@babel/plugin-syntax-bigint/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/plugin-syntax-bigint@7.8.3", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -24,11 +24,11 @@ "fetchSpec": "7.8.3" }, "_requiredBy": [ - "/babel-preset-jest" + "/babel-preset-current-node-syntax" ], "_resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, diff --git a/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/package.json index a419d485a..98bf57f31 100644 --- a/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/package.json +++ b/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-plugin-utils@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/plugin-syntax-class-properties/package.json b/node_modules/@babel/plugin-syntax-class-properties/package.json index 07467b535..896463cad 100644 --- a/node_modules/@babel/plugin-syntax-class-properties/package.json +++ b/node_modules/@babel/plugin-syntax-class-properties/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/plugin-syntax-class-properties@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/helper-plugin-utils": "^7.8.3" }, diff --git a/node_modules/@babel/plugin-syntax-json-strings/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/plugin-syntax-json-strings/node_modules/@babel/helper-plugin-utils/package.json index 4b929d6a2..ecc4c7a20 100644 --- a/node_modules/@babel/plugin-syntax-json-strings/node_modules/@babel/helper-plugin-utils/package.json +++ b/node_modules/@babel/plugin-syntax-json-strings/node_modules/@babel/helper-plugin-utils/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-plugin-utils@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/plugin-syntax-json-strings/package.json b/node_modules/@babel/plugin-syntax-json-strings/package.json index 85edd5c7e..8b48037a2 100644 --- a/node_modules/@babel/plugin-syntax-json-strings/package.json +++ b/node_modules/@babel/plugin-syntax-json-strings/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/plugin-syntax-json-strings@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, diff --git a/node_modules/@babel/plugin-syntax-logical-assignment-operators/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/plugin-syntax-logical-assignment-operators/node_modules/@babel/helper-plugin-utils/package.json index 29df86679..29c19e8d5 100644 --- a/node_modules/@babel/plugin-syntax-logical-assignment-operators/node_modules/@babel/helper-plugin-utils/package.json +++ b/node_modules/@babel/plugin-syntax-logical-assignment-operators/node_modules/@babel/helper-plugin-utils/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-plugin-utils@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/plugin-syntax-logical-assignment-operators/package.json b/node_modules/@babel/plugin-syntax-logical-assignment-operators/package.json index 087f96c50..164d5cc0f 100644 --- a/node_modules/@babel/plugin-syntax-logical-assignment-operators/package.json +++ b/node_modules/@babel/plugin-syntax-logical-assignment-operators/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/plugin-syntax-logical-assignment-operators@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/helper-plugin-utils": "^7.8.3" }, diff --git a/node_modules/@babel/plugin-syntax-nullish-coalescing-operator/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/plugin-syntax-nullish-coalescing-operator/node_modules/@babel/helper-plugin-utils/package.json index 5c075a997..225dd39e9 100644 --- a/node_modules/@babel/plugin-syntax-nullish-coalescing-operator/node_modules/@babel/helper-plugin-utils/package.json +++ b/node_modules/@babel/plugin-syntax-nullish-coalescing-operator/node_modules/@babel/helper-plugin-utils/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-plugin-utils@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/plugin-syntax-nullish-coalescing-operator/package.json b/node_modules/@babel/plugin-syntax-nullish-coalescing-operator/package.json index 840920d2a..94a114457 100644 --- a/node_modules/@babel/plugin-syntax-nullish-coalescing-operator/package.json +++ b/node_modules/@babel/plugin-syntax-nullish-coalescing-operator/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/plugin-syntax-nullish-coalescing-operator@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, diff --git a/node_modules/@babel/plugin-syntax-numeric-separator/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/plugin-syntax-numeric-separator/node_modules/@babel/helper-plugin-utils/package.json index 7ab08f3bc..971c48411 100644 --- a/node_modules/@babel/plugin-syntax-numeric-separator/node_modules/@babel/helper-plugin-utils/package.json +++ b/node_modules/@babel/plugin-syntax-numeric-separator/node_modules/@babel/helper-plugin-utils/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-plugin-utils@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/plugin-syntax-numeric-separator/package.json b/node_modules/@babel/plugin-syntax-numeric-separator/package.json index 3d805d677..dc8d95d6a 100644 --- a/node_modules/@babel/plugin-syntax-numeric-separator/package.json +++ b/node_modules/@babel/plugin-syntax-numeric-separator/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/plugin-syntax-numeric-separator@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/helper-plugin-utils": "^7.8.3" }, diff --git a/node_modules/@babel/plugin-syntax-object-rest-spread/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/plugin-syntax-object-rest-spread/node_modules/@babel/helper-plugin-utils/package.json index bce85b7db..8157deab8 100644 --- a/node_modules/@babel/plugin-syntax-object-rest-spread/node_modules/@babel/helper-plugin-utils/package.json +++ b/node_modules/@babel/plugin-syntax-object-rest-spread/node_modules/@babel/helper-plugin-utils/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-plugin-utils@7.8.3", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/plugin-syntax-object-rest-spread/package.json b/node_modules/@babel/plugin-syntax-object-rest-spread/package.json index 4143be83d..6cfe237f3 100644 --- a/node_modules/@babel/plugin-syntax-object-rest-spread/package.json +++ b/node_modules/@babel/plugin-syntax-object-rest-spread/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/plugin-syntax-object-rest-spread@7.8.3", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -24,11 +24,11 @@ "fetchSpec": "7.8.3" }, "_requiredBy": [ - "/babel-preset-jest" + "/babel-preset-current-node-syntax" ], "_resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, diff --git a/node_modules/@babel/plugin-syntax-optional-catch-binding/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/plugin-syntax-optional-catch-binding/node_modules/@babel/helper-plugin-utils/package.json index b500fb683..c93d984a7 100644 --- a/node_modules/@babel/plugin-syntax-optional-catch-binding/node_modules/@babel/helper-plugin-utils/package.json +++ b/node_modules/@babel/plugin-syntax-optional-catch-binding/node_modules/@babel/helper-plugin-utils/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-plugin-utils@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/plugin-syntax-optional-catch-binding/package.json b/node_modules/@babel/plugin-syntax-optional-catch-binding/package.json index 0f7c05859..e8def05ae 100644 --- a/node_modules/@babel/plugin-syntax-optional-catch-binding/package.json +++ b/node_modules/@babel/plugin-syntax-optional-catch-binding/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/plugin-syntax-optional-catch-binding@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, diff --git a/node_modules/@babel/plugin-syntax-optional-chaining/node_modules/@babel/helper-plugin-utils/package.json b/node_modules/@babel/plugin-syntax-optional-chaining/node_modules/@babel/helper-plugin-utils/package.json index 259534140..d09583f97 100644 --- a/node_modules/@babel/plugin-syntax-optional-chaining/node_modules/@babel/helper-plugin-utils/package.json +++ b/node_modules/@babel/plugin-syntax-optional-chaining/node_modules/@babel/helper-plugin-utils/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/helper-plugin-utils@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Logan Smyth", "email": "loganfsmyth@gmail.com" diff --git a/node_modules/@babel/plugin-syntax-optional-chaining/package.json b/node_modules/@babel/plugin-syntax-optional-chaining/package.json index 791b5dca4..d0d48386d 100644 --- a/node_modules/@babel/plugin-syntax-optional-chaining/package.json +++ b/node_modules/@babel/plugin-syntax-optional-chaining/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/plugin-syntax-optional-chaining@7.8.3", - "/home/runner/work/readable-readme/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", "_spec": "7.8.3", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_where": "/workspace/readable-readme", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, diff --git a/node_modules/@babel/template/package.json b/node_modules/@babel/template/package.json index bce662b13..96df8e451 100644 --- a/node_modules/@babel/template/package.json +++ b/node_modules/@babel/template/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/template@7.4.4", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -26,11 +26,13 @@ "_requiredBy": [ "/@babel/core", "/@babel/helper-function-name", - "/@babel/helpers" + "/@babel/helpers", + "/babel-plugin-jest-hoist", + "/jest-config/babel-plugin-jest-hoist" ], "_resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.4.tgz", "_spec": "7.4.4", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/traverse/node_modules/debug/package.json b/node_modules/@babel/traverse/node_modules/debug/package.json index 25d64246d..875c79cd2 100644 --- a/node_modules/@babel/traverse/node_modules/debug/package.json +++ b/node_modules/@babel/traverse/node_modules/debug/package.json @@ -2,7 +2,7 @@ "_args": [ [ "debug@4.1.1", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "_spec": "4.1.1", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" diff --git a/node_modules/@babel/traverse/node_modules/ms/package.json b/node_modules/@babel/traverse/node_modules/ms/package.json index 6d1acc299..a61e802e6 100644 --- a/node_modules/@babel/traverse/node_modules/ms/package.json +++ b/node_modules/@babel/traverse/node_modules/ms/package.json @@ -2,7 +2,7 @@ "_args": [ [ "ms@2.1.2", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "_spec": "2.1.2", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/zeit/ms/issues" }, diff --git a/node_modules/@babel/traverse/package.json b/node_modules/@babel/traverse/package.json index 4d11f8f0c..1dd0fc40e 100644 --- a/node_modules/@babel/traverse/package.json +++ b/node_modules/@babel/traverse/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/traverse@7.5.5", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -26,12 +26,14 @@ "_requiredBy": [ "/@babel/core", "/@babel/helpers", + "/@jest/core/jest-jasmine2", "/jest-circus", - "/jest-jasmine2" + "/jest-jasmine2", + "/jest/jest-jasmine2" ], "_resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.5.5.tgz", "_spec": "7.5.5", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@babel/types/package.json b/node_modules/@babel/types/package.json index 96cb3fd55..f84f7add2 100644 --- a/node_modules/@babel/types/package.json +++ b/node_modules/@babel/types/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@babel/types@7.5.5", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -36,11 +36,16 @@ "/@types/babel__generator", "/@types/babel__template", "/@types/babel__traverse", + "/babel-plugin-jest-hoist", + "/jest-circus/jest-snapshot", + "/jest-config/babel-plugin-jest-hoist", + "/jest-jasmine2/jest-snapshot", + "/jest-runtime/jest-snapshot", "/jest-snapshot" ], "_resolved": "https://registry.npmjs.org/@babel/types/-/types-7.5.5.tgz", "_spec": "7.5.5", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" diff --git a/node_modules/@bcoe/v8-coverage/package.json b/node_modules/@bcoe/v8-coverage/package.json index caa812ad8..548bd4970 100644 --- a/node_modules/@bcoe/v8-coverage/package.json +++ b/node_modules/@bcoe/v8-coverage/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@bcoe/v8-coverage@0.2.3", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,7 +28,7 @@ ], "_resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", "_spec": "0.2.3", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Charles Samborski", "email": "demurgos@demurgos.net", diff --git a/node_modules/@cnakazawa/watch/package.json b/node_modules/@cnakazawa/watch/package.json index b9402040d..fc5fde618 100644 --- a/node_modules/@cnakazawa/watch/package.json +++ b/node_modules/@cnakazawa/watch/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@cnakazawa/watch@1.0.3", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -28,13 +28,13 @@ ], "_resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.3.tgz", "_spec": "1.0.3", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Mikeal Rogers", "email": "mikeal.rogers@gmail.com" }, "bin": { - "watch": "./cli.js" + "watch": "cli.js" }, "bugs": { "url": "https://github.com/mikeal/watch/issues" diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/find-up/package.json b/node_modules/@istanbuljs/load-nyc-config/node_modules/find-up/package.json index f8ccd0686..e10dbd439 100644 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/find-up/package.json +++ b/node_modules/@istanbuljs/load-nyc-config/node_modules/find-up/package.json @@ -2,7 +2,7 @@ "_args": [ [ "find-up@4.1.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "_spec": "4.1.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/package.json b/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/package.json index bc5921226..4ad322419 100644 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/package.json +++ b/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/package.json @@ -2,7 +2,7 @@ "_args": [ [ "locate-path@5.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "_spec": "5.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/package.json b/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/package.json index 09b5a7d5c..9e57f9da3 100644 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/package.json +++ b/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/package.json @@ -2,7 +2,7 @@ "_args": [ [ "p-locate@4.1.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "_spec": "4.1.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/path-exists/package.json b/node_modules/@istanbuljs/load-nyc-config/node_modules/path-exists/package.json index 105bc31b6..408007c34 100644 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/path-exists/package.json +++ b/node_modules/@istanbuljs/load-nyc-config/node_modules/path-exists/package.json @@ -2,7 +2,7 @@ "_args": [ [ "path-exists@4.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "_spec": "4.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/package.json b/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/package.json index ac31ccfaa..ddf7187a8 100644 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/package.json +++ b/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/package.json @@ -2,7 +2,7 @@ "_args": [ [ "resolve-from@5.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", "_spec": "5.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@istanbuljs/load-nyc-config/package.json b/node_modules/@istanbuljs/load-nyc-config/package.json index 6277479e6..a1ae6000b 100644 --- a/node_modules/@istanbuljs/load-nyc-config/package.json +++ b/node_modules/@istanbuljs/load-nyc-config/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@istanbuljs/load-nyc-config@1.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -26,12 +26,11 @@ "fetchSpec": "1.0.0" }, "_requiredBy": [ - "/babel-plugin-istanbul", - "/jest-circus/babel-plugin-istanbul" + "/babel-plugin-istanbul" ], "_resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz", "_spec": "1.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/istanbuljs/load-nyc-config/issues" }, diff --git a/node_modules/@istanbuljs/schema/package.json b/node_modules/@istanbuljs/schema/package.json index 692171314..5c468c5a5 100644 --- a/node_modules/@istanbuljs/schema/package.json +++ b/node_modules/@istanbuljs/schema/package.json @@ -2,7 +2,7 @@ "_args": [ [ "@istanbuljs/schema@0.1.2", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -26,14 +26,11 @@ "_requiredBy": [ "/babel-plugin-istanbul", "/istanbul-lib-instrument", - "/jest-circus/babel-plugin-istanbul", - "/jest-circus/istanbul-lib-instrument", - "/jest-circus/test-exclude", "/test-exclude" ], "_resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", "_spec": "0.1.2", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Corey Farrell" }, diff --git a/node_modules/@jest/console/node_modules/@jest/types/build/Transform.d.ts b/node_modules/@jest/console/node_modules/@jest/types/build/Transform.d.ts index ea3e511cb..af8063f7d 100644 --- a/node_modules/@jest/console/node_modules/@jest/types/build/Transform.d.ts +++ b/node_modules/@jest/console/node_modules/@jest/types/build/Transform.d.ts @@ -7,6 +7,6 @@ export declare type TransformResult = { code: string; originalCode: string; - mapCoverage: boolean; + mapCoverage?: boolean; sourceMapPath: string | null; }; diff --git a/node_modules/@jest/console/node_modules/@jest/types/build/ts3.4/Transform.d.ts b/node_modules/@jest/console/node_modules/@jest/types/build/ts3.4/Transform.d.ts index bcc63baf1..231ae24ca 100644 --- a/node_modules/@jest/console/node_modules/@jest/types/build/ts3.4/Transform.d.ts +++ b/node_modules/@jest/console/node_modules/@jest/types/build/ts3.4/Transform.d.ts @@ -7,6 +7,6 @@ export declare type TransformResult = { code: string; originalCode: string; - mapCoverage: boolean; + mapCoverage?: boolean; sourceMapPath: string | null; }; diff --git a/node_modules/@jest/console/node_modules/@jest/types/package.json b/node_modules/@jest/console/node_modules/@jest/types/package.json index 1f72d4062..e7fa04fee 100644 --- a/node_modules/@jest/console/node_modules/@jest/types/package.json +++ b/node_modules/@jest/console/node_modules/@jest/types/package.json @@ -1,34 +1,34 @@ { "_args": [ [ - "@jest/types@25.4.0", - "/home/runner/work/readable-readme/readable-readme" + "@jest/types@25.5.0", + "/workspace/readable-readme" ] ], "_development": true, - "_from": "@jest/types@25.4.0", - "_id": "@jest/types@25.4.0", + "_from": "@jest/types@25.5.0", + "_id": "@jest/types@25.5.0", "_inBundle": false, - "_integrity": "sha512-XBeaWNzw2PPnGW5aXvZt3+VO60M+34RY3XDsCK5tW7kyj3RK0XClRutCfjqcBuaR2aBQTbluEDME9b5MB9UAPw==", + "_integrity": "sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==", "_location": "/@jest/console/@jest/types", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "@jest/types@25.4.0", + "raw": "@jest/types@25.5.0", "name": "@jest/types", "escapedName": "@jest%2ftypes", "scope": "@jest", - "rawSpec": "25.4.0", + "rawSpec": "25.5.0", "saveSpec": null, - "fetchSpec": "25.4.0" + "fetchSpec": "25.5.0" }, "_requiredBy": [ "/@jest/console" ], - "_resolved": "https://registry.npmjs.org/@jest/types/-/types-25.4.0.tgz", - "_spec": "25.4.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_resolved": "https://registry.npmjs.org/@jest/types/-/types-25.5.0.tgz", + "_spec": "25.5.0", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/facebook/jest/issues" }, @@ -44,7 +44,7 @@ "engines": { "node": ">= 8.3" }, - "gitHead": "5b129d714cadb818be28afbe313cbeae8fbb1dde", + "gitHead": "ddd73d18adfb982b9b0d94bad7d41c9f78567ca7", "homepage": "https://github.com/facebook/jest#readme", "license": "MIT", "main": "build/index.js", @@ -65,5 +65,5 @@ ] } }, - "version": "25.4.0" + "version": "25.5.0" } diff --git a/node_modules/@jest/console/node_modules/ansi-styles/package.json b/node_modules/@jest/console/node_modules/ansi-styles/package.json index 74926d473..7da0d11a9 100644 --- a/node_modules/@jest/console/node_modules/ansi-styles/package.json +++ b/node_modules/@jest/console/node_modules/ansi-styles/package.json @@ -2,7 +2,7 @@ "_args": [ [ "ansi-styles@4.2.1", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "_spec": "4.2.1", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@jest/console/node_modules/chalk/package.json b/node_modules/@jest/console/node_modules/chalk/package.json index 4cfc85e57..7a6434e68 100644 --- a/node_modules/@jest/console/node_modules/chalk/package.json +++ b/node_modules/@jest/console/node_modules/chalk/package.json @@ -2,7 +2,7 @@ "_args": [ [ "chalk@3.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -23,11 +23,12 @@ "fetchSpec": "3.0.0" }, "_requiredBy": [ - "/@jest/console" + "/@jest/console", + "/@jest/console/@jest/types" ], "_resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", "_spec": "3.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/chalk/chalk/issues" }, diff --git a/node_modules/@jest/console/node_modules/color-convert/package.json b/node_modules/@jest/console/node_modules/color-convert/package.json index 03b0d0256..7ca5b5b62 100644 --- a/node_modules/@jest/console/node_modules/color-convert/package.json +++ b/node_modules/@jest/console/node_modules/color-convert/package.json @@ -2,7 +2,7 @@ "_args": [ [ "color-convert@2.0.1", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "_spec": "2.0.1", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Heather Arthur", "email": "fayearthur@gmail.com" diff --git a/node_modules/@jest/console/node_modules/color-name/package.json b/node_modules/@jest/console/node_modules/color-name/package.json index b2e04d087..84255b2a8 100644 --- a/node_modules/@jest/console/node_modules/color-name/package.json +++ b/node_modules/@jest/console/node_modules/color-name/package.json @@ -2,7 +2,7 @@ "_args": [ [ "color-name@1.1.4", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "_spec": "1.1.4", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "DY", "email": "dfcreative@gmail.com" diff --git a/node_modules/@jest/console/node_modules/has-flag/package.json b/node_modules/@jest/console/node_modules/has-flag/package.json index 7fc805a12..eaf560d3a 100644 --- a/node_modules/@jest/console/node_modules/has-flag/package.json +++ b/node_modules/@jest/console/node_modules/has-flag/package.json @@ -2,7 +2,7 @@ "_args": [ [ "has-flag@4.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "_spec": "4.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@jest/console/node_modules/supports-color/package.json b/node_modules/@jest/console/node_modules/supports-color/package.json index 7c44887ff..e916bfdbe 100644 --- a/node_modules/@jest/console/node_modules/supports-color/package.json +++ b/node_modules/@jest/console/node_modules/supports-color/package.json @@ -2,7 +2,7 @@ "_args": [ [ "supports-color@7.1.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", "_spec": "7.1.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@jest/console/package.json b/node_modules/@jest/console/package.json index 505bfe876..0a1347880 100644 --- a/node_modules/@jest/console/package.json +++ b/node_modules/@jest/console/package.json @@ -1,15 +1,15 @@ { "_args": [ [ - "@jest/console@25.4.0", - "/home/runner/work/readable-readme/readable-readme" + "@jest/console@25.5.0", + "/workspace/readable-readme" ] ], "_development": true, - "_from": "@jest/console@25.4.0", - "_id": "@jest/console@25.4.0", + "_from": "@jest/console@25.5.0", + "_id": "@jest/console@25.5.0", "_inBundle": false, - "_integrity": "sha512-CfE0erx4hdJ6t7RzAcE1wLG6ZzsHSmybvIBQDoCkDM1QaSeWL9wJMzID/2BbHHa7ll9SsbbK43HjbERbBaFX2A==", + "_integrity": "sha512-T48kZa6MK1Y6k4b89sexwmSF4YLeZS/Udqg3Jj3jG/cHH+N/sLFCEoXEDMOKugJQ9FxPN1osxIknvKkxt6MKyw==", "_location": "/@jest/console", "_phantomChildren": { "@types/color-name": "1.1.1", @@ -20,32 +20,34 @@ "_requested": { "type": "version", "registry": true, - "raw": "@jest/console@25.4.0", + "raw": "@jest/console@25.5.0", "name": "@jest/console", "escapedName": "@jest%2fconsole", "scope": "@jest", - "rawSpec": "25.4.0", + "rawSpec": "25.5.0", "saveSpec": null, - "fetchSpec": "25.4.0" + "fetchSpec": "25.5.0" }, "_requiredBy": [ "/@jest/core", + "/@jest/core/jest-runner", + "/@jest/core/jest-runtime", "/@jest/reporters", "/@jest/test-result", - "/jest-runner", - "/jest-runtime" + "/jest/jest-runner", + "/jest/jest-runtime" ], - "_resolved": "https://registry.npmjs.org/@jest/console/-/console-25.4.0.tgz", - "_spec": "25.4.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_resolved": "https://registry.npmjs.org/@jest/console/-/console-25.5.0.tgz", + "_spec": "25.5.0", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/facebook/jest/issues" }, "dependencies": { - "@jest/types": "^25.4.0", + "@jest/types": "^25.5.0", "chalk": "^3.0.0", - "jest-message-util": "^25.4.0", - "jest-util": "^25.4.0", + "jest-message-util": "^25.5.0", + "jest-util": "^25.5.0", "slash": "^3.0.0" }, "devDependencies": { @@ -54,7 +56,7 @@ "engines": { "node": ">= 8.3" }, - "gitHead": "5b129d714cadb818be28afbe313cbeae8fbb1dde", + "gitHead": "ddd73d18adfb982b9b0d94bad7d41c9f78567ca7", "homepage": "https://github.com/facebook/jest#readme", "license": "MIT", "main": "build/index.js", @@ -75,5 +77,5 @@ ] } }, - "version": "25.4.0" + "version": "25.5.0" } diff --git a/node_modules/@jest/core/build/SearchSource.d.ts b/node_modules/@jest/core/build/SearchSource.d.ts index 42eafe81f..a605bf1b5 100644 --- a/node_modules/@jest/core/build/SearchSource.d.ts +++ b/node_modules/@jest/core/build/SearchSource.d.ts @@ -27,8 +27,10 @@ export declare type TestSelectionConfig = { }; export default class SearchSource { private _context; + private _dependencyResolver; private _testPathCases; constructor(context: Context); + private _getOrBuildDependencyResolver; private _filterTestPathsWithStats; private _getAllTestPaths; isTestFilePath(path: Config.Path): boolean; @@ -39,4 +41,5 @@ export default class SearchSource { findTestRelatedToChangedFiles(changedFilesInfo: ChangedFiles, collectCoverage: boolean): SearchResult; private _getTestPaths; getTestPaths(globalConfig: Config.GlobalConfig, changedFiles: ChangedFiles | undefined, filter?: Filter): Promise; + findRelatedSourcesFromTestsInChangedFiles(changedFilesInfo: ChangedFiles): Array; } diff --git a/node_modules/@jest/core/build/SearchSource.js b/node_modules/@jest/core/build/SearchSource.js index 12baed849..642dba1c6 100644 --- a/node_modules/@jest/core/build/SearchSource.js +++ b/node_modules/@jest/core/build/SearchSource.js @@ -164,14 +164,24 @@ const toTests = (context, tests) => path })); +const hasSCM = changedFilesInfo => { + const {repos} = changedFilesInfo; // no SCM (git/hg/...) is found in any of the roots. + + const noSCM = Object.values(repos).every(scm => scm.size === 0); + return !noSCM; +}; + class SearchSource { constructor(context) { _defineProperty(this, '_context', void 0); + _defineProperty(this, '_dependencyResolver', void 0); + _defineProperty(this, '_testPathCases', []); const {config} = context; this._context = context; + this._dependencyResolver = null; const rootPattern = new RegExp( config.roots .map(dir => (0, _jestRegexUtil().escapePathForRegex)(dir + path().sep)) @@ -209,6 +219,18 @@ class SearchSource { } } + _getOrBuildDependencyResolver() { + if (!this._dependencyResolver) { + this._dependencyResolver = new (_jestResolveDependencies().default)( + this._context.resolver, + this._context.hasteFS, + (0, _jestSnapshot().buildSnapshotResolver)(this._context.config) + ); + } + + return this._dependencyResolver; + } + _filterTestPathsWithStats(allPaths, testPathPattern) { const data = { stats: { @@ -263,11 +285,7 @@ class SearchSource { } findRelatedTests(allPaths, collectCoverage) { - const dependencyResolver = new (_jestResolveDependencies().default)( - this._context.resolver, - this._context.hasteFS, - (0, _jestSnapshot().buildSnapshotResolver)(this._context.config) - ); + const dependencyResolver = this._getOrBuildDependencyResolver(); if (!collectCoverage) { return { @@ -348,15 +366,15 @@ class SearchSource { } findTestRelatedToChangedFiles(changedFilesInfo, collectCoverage) { - const {repos, changedFiles} = changedFilesInfo; // no SCM (git/hg/...) is found in any of the roots. + if (!hasSCM(changedFilesInfo)) { + return { + noSCM: true, + tests: [] + }; + } - const noSCM = Object.keys(repos).every(scm => repos[scm].size === 0); - return noSCM - ? { - noSCM: true, - tests: [] - } - : this.findRelatedTests(changedFiles, collectCoverage); + const {changedFiles} = changedFilesInfo; + return this.findRelatedTests(changedFiles, collectCoverage); } _getTestPaths(globalConfig, changedFiles) { @@ -381,16 +399,18 @@ class SearchSource { windows: false }; paths = paths - .map(p => path().resolve(this._context.config.cwd, p)) - .map( - p => - (0, _micromatch().default)( - allFiles, - p.replace(/\\/g, '\\\\'), - options - )[0] - ) - .filter(p => p); + .map(p => { + const relativePath = path() + .resolve(this._context.config.cwd, p) + .replace(/\\/g, '\\\\'); + const match = (0, _micromatch().default)( + allFiles, + relativePath, + options + ); + return match[0]; + }) + .filter(Boolean); } if (globalConfig.runTestsByPath && paths && paths.length) { @@ -435,6 +455,27 @@ class SearchSource { return searchResult; } + + findRelatedSourcesFromTestsInChangedFiles(changedFilesInfo) { + if (!hasSCM(changedFilesInfo)) { + return []; + } + + const {changedFiles} = changedFilesInfo; + + const dependencyResolver = this._getOrBuildDependencyResolver(); + + const relatedSourcesSet = new Set(); + changedFiles.forEach(filePath => { + if (this.isTestFilePath(filePath)) { + const sourcePaths = dependencyResolver.resolve(filePath, { + skipNodeResolution: this._context.config.skipNodeResolution + }); + sourcePaths.forEach(sourcePath => relatedSourcesSet.add(sourcePath)); + } + }); + return Array.from(relatedSourcesSet); + } } exports.default = SearchSource; diff --git a/node_modules/@jest/core/build/TestScheduler.d.ts b/node_modules/@jest/core/build/TestScheduler.d.ts index 45e069be3..5e41b1422 100644 --- a/node_modules/@jest/core/build/TestScheduler.d.ts +++ b/node_modules/@jest/core/build/TestScheduler.d.ts @@ -16,6 +16,7 @@ export declare type TestSchedulerContext = { firstRun: boolean; previousSuccess: boolean; changedFiles?: Set; + sourcesRelatedToTestsInChangedFiles?: Set; }; export default class TestScheduler { private _dispatcher; diff --git a/node_modules/@jest/core/build/TestScheduler.js b/node_modules/@jest/core/build/TestScheduler.js index ed97d1c1d..244877d1e 100644 --- a/node_modules/@jest/core/build/TestScheduler.js +++ b/node_modules/@jest/core/build/TestScheduler.js @@ -244,10 +244,21 @@ class TestScheduler { const testRunners = Object.create(null); contexts.forEach(({config}) => { if (!testRunners[config.runner]) { + var _this$_context, _this$_context2; + const Runner = require(config.runner); testRunners[config.runner] = new Runner(this._globalConfig, { - changedFiles: this._context && this._context.changedFiles + changedFiles: + (_this$_context = this._context) === null || + _this$_context === void 0 + ? void 0 + : _this$_context.changedFiles, + sourcesRelatedToTestsInChangedFiles: + (_this$_context2 = this._context) === null || + _this$_context2 === void 0 + ? void 0 + : _this$_context2.sourcesRelatedToTestsInChangedFiles }); } }); @@ -334,9 +345,20 @@ class TestScheduler { } if (!isDefault && collectCoverage) { + var _this$_context3, _this$_context4; + this.addReporter( new (_reporters().CoverageReporter)(this._globalConfig, { - changedFiles: this._context && this._context.changedFiles + changedFiles: + (_this$_context3 = this._context) === null || + _this$_context3 === void 0 + ? void 0 + : _this$_context3.changedFiles, + sourcesRelatedToTestsInChangedFiles: + (_this$_context4 = this._context) === null || + _this$_context4 === void 0 + ? void 0 + : _this$_context4.sourcesRelatedToTestsInChangedFiles }) ); } @@ -364,9 +386,20 @@ class TestScheduler { ); if (collectCoverage) { + var _this$_context5, _this$_context6; + this.addReporter( new (_reporters().CoverageReporter)(this._globalConfig, { - changedFiles: this._context && this._context.changedFiles + changedFiles: + (_this$_context5 = this._context) === null || + _this$_context5 === void 0 + ? void 0 + : _this$_context5.changedFiles, + sourcesRelatedToTestsInChangedFiles: + (_this$_context6 = this._context) === null || + _this$_context6 === void 0 + ? void 0 + : _this$_context6.sourcesRelatedToTestsInChangedFiles }) ); } diff --git a/node_modules/@jest/core/build/cli/index.js b/node_modules/@jest/core/build/cli/index.js index 1a5b1de8f..db8de1933 100644 --- a/node_modules/@jest/core/build/cli/index.js +++ b/node_modules/@jest/core/build/cli/index.js @@ -190,11 +190,6 @@ function _interopRequireDefault(obj) { const {print: preRunMessagePrint} = _jestUtil().preRunMessage; async function runCLI(argv, projects) { - const realFs = require('fs'); - - const fs = require('graceful-fs'); - - fs.gracefulify(realFs); let results; // If we output a JSON object, we can't write anything to stdout, since // it'll break the JSON structure and it won't be valid. diff --git a/node_modules/@jest/core/build/runJest.js b/node_modules/@jest/core/build/runJest.js index 43d433e92..ac63e11af 100644 --- a/node_modules/@jest/core/build/runJest.js +++ b/node_modules/@jest/core/build/runJest.js @@ -161,13 +161,12 @@ function _interopRequireWildcard(obj) { */ const getTestPaths = async ( globalConfig, - context, + source, outputStream, changedFiles, jestHooks, filter ) => { - const source = new _SearchSource.default(context); const data = await source.getTestPaths(globalConfig, changedFiles, filter); if (!data.tests.length && globalConfig.onlyChanged && data.noSCM) { @@ -272,11 +271,15 @@ async function runJest({ } } + const searchSources = contexts.map( + context => new _SearchSource.default(context) + ); const testRunData = await Promise.all( - contexts.map(async context => { + contexts.map(async (context, index) => { + const searchSource = searchSources[index]; const matches = await getTestPaths( globalConfig, - context, + searchSource, outputStream, changedFilesPromise && (await changedFilesPromise), jestHooks, @@ -357,9 +360,23 @@ async function runJest({ } if (changedFilesPromise) { - testSchedulerContext.changedFiles = ( - await changedFilesPromise - ).changedFiles; + const changedFilesInfo = await changedFilesPromise; + + if (changedFilesInfo.changedFiles) { + testSchedulerContext.changedFiles = changedFilesInfo.changedFiles; + const sourcesRelatedToTestsInChangedFilesArray = contexts + .map((_, index) => { + const searchSource = searchSources[index]; + const relatedSourceFromTestsInChangedFiles = searchSource.findRelatedSourcesFromTestsInChangedFiles( + changedFilesInfo + ); + return relatedSourceFromTestsInChangedFiles; + }) + .reduce((total, paths) => total.concat(paths), []); + testSchedulerContext.sourcesRelatedToTestsInChangedFiles = new Set( + sourcesRelatedToTestsInChangedFilesArray + ); + } } const results = await new _TestScheduler.default( diff --git a/node_modules/@jest/core/build/ts3.4/SearchSource.d.ts b/node_modules/@jest/core/build/ts3.4/SearchSource.d.ts index d811b3c24..9855d3af7 100644 --- a/node_modules/@jest/core/build/ts3.4/SearchSource.d.ts +++ b/node_modules/@jest/core/build/ts3.4/SearchSource.d.ts @@ -27,8 +27,10 @@ export declare type TestSelectionConfig = { }; export default class SearchSource { private _context; + private _dependencyResolver; private _testPathCases; constructor(context: Context); + private _getOrBuildDependencyResolver; private _filterTestPathsWithStats; private _getAllTestPaths; isTestFilePath(path: Config.Path): boolean; @@ -39,4 +41,5 @@ export default class SearchSource { findTestRelatedToChangedFiles(changedFilesInfo: ChangedFiles, collectCoverage: boolean): SearchResult; private _getTestPaths; getTestPaths(globalConfig: Config.GlobalConfig, changedFiles: ChangedFiles | undefined, filter?: Filter): Promise; + findRelatedSourcesFromTestsInChangedFiles(changedFilesInfo: ChangedFiles): Array; } diff --git a/node_modules/@jest/core/build/ts3.4/TestScheduler.d.ts b/node_modules/@jest/core/build/ts3.4/TestScheduler.d.ts index 47bdc4a86..e1dadf6f1 100644 --- a/node_modules/@jest/core/build/ts3.4/TestScheduler.d.ts +++ b/node_modules/@jest/core/build/ts3.4/TestScheduler.d.ts @@ -16,6 +16,7 @@ export declare type TestSchedulerContext = { firstRun: boolean; previousSuccess: boolean; changedFiles?: Set; + sourcesRelatedToTestsInChangedFiles?: Set; }; export default class TestScheduler { private _dispatcher; diff --git a/node_modules/@jest/core/node_modules/.bin/jest-runtime b/node_modules/@jest/core/node_modules/.bin/jest-runtime new file mode 120000 index 000000000..ec00171e0 --- /dev/null +++ b/node_modules/@jest/core/node_modules/.bin/jest-runtime @@ -0,0 +1 @@ +../jest-runtime/bin/jest-runtime.js \ No newline at end of file diff --git a/node_modules/@jest/reporters/node_modules/jest-worker/LICENSE b/node_modules/@jest/core/node_modules/@jest/test-sequencer/LICENSE similarity index 100% rename from node_modules/@jest/reporters/node_modules/jest-worker/LICENSE rename to node_modules/@jest/core/node_modules/@jest/test-sequencer/LICENSE diff --git a/node_modules/@jest/core/node_modules/@jest/test-sequencer/build/index.d.ts b/node_modules/@jest/core/node_modules/@jest/test-sequencer/build/index.d.ts new file mode 100644 index 000000000..db1524b34 --- /dev/null +++ b/node_modules/@jest/core/node_modules/@jest/test-sequencer/build/index.d.ts @@ -0,0 +1,51 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { AggregatedResult } from '@jest/test-result'; +import type { Context } from 'jest-runtime'; +import type { Test } from 'jest-runner'; +declare type Cache = { + [key: string]: [0 | 1, number]; +}; +/** + * The TestSequencer will ultimately decide which tests should run first. + * It is responsible for storing and reading from a local cache + * map that stores context information for a given test, such as how long it + * took to run during the last run and if it has failed or not. + * Such information is used on: + * TestSequencer.sort(tests: Array) + * to sort the order of the provided tests. + * + * After the results are collected, + * TestSequencer.cacheResults(tests: Array, results: AggregatedResult) + * is called to store/update this information on the cache map. + */ +export default class TestSequencer { + private _cache; + _getCachePath(context: Context): string; + _getCache(test: Test): Cache; + /** + * Sorting tests is very important because it has a great impact on the + * user-perceived responsiveness and speed of the test run. + * + * If such information is on cache, tests are sorted based on: + * -> Has it failed during the last run ? + * Since it's important to provide the most expected feedback as quickly + * as possible. + * -> How long it took to run ? + * Because running long tests first is an effort to minimize worker idle + * time at the end of a long test run. + * And if that information is not available they are sorted based on file size + * since big test files usually take longer to complete. + * + * Note that a possible improvement would be to analyse other information + * from the file other than its size. + * + */ + sort(tests: Array): Array; + cacheResults(tests: Array, results: AggregatedResult): void; +} +export {}; diff --git a/node_modules/@jest/core/node_modules/@jest/test-sequencer/build/index.js b/node_modules/@jest/core/node_modules/@jest/test-sequencer/build/index.js new file mode 100644 index 000000000..0e969dca9 --- /dev/null +++ b/node_modules/@jest/core/node_modules/@jest/test-sequencer/build/index.js @@ -0,0 +1,213 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +function fs() { + const data = _interopRequireWildcard(require('graceful-fs')); + + fs = function () { + return data; + }; + + return data; +} + +function _jestHasteMap() { + const data = require('jest-haste-map'); + + _jestHasteMap = function () { + return data; + }; + + return data; +} + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +const FAIL = 0; +const SUCCESS = 1; + +/** + * The TestSequencer will ultimately decide which tests should run first. + * It is responsible for storing and reading from a local cache + * map that stores context information for a given test, such as how long it + * took to run during the last run and if it has failed or not. + * Such information is used on: + * TestSequencer.sort(tests: Array) + * to sort the order of the provided tests. + * + * After the results are collected, + * TestSequencer.cacheResults(tests: Array, results: AggregatedResult) + * is called to store/update this information on the cache map. + */ +class TestSequencer { + constructor() { + _defineProperty(this, '_cache', new Map()); + } + + _getCachePath(context) { + const {config} = context; + return (0, _jestHasteMap().getCacheFilePath)( + config.cacheDirectory, + 'perf-cache-' + config.name + ); + } + + _getCache(test) { + const {context} = test; + + if (!this._cache.has(context) && context.config.cache) { + const cachePath = this._getCachePath(context); + + if (fs().existsSync(cachePath)) { + try { + this._cache.set( + context, + JSON.parse(fs().readFileSync(cachePath, 'utf8')) + ); + } catch (e) {} + } + } + + let cache = this._cache.get(context); + + if (!cache) { + cache = {}; + + this._cache.set(context, cache); + } + + return cache; + } + /** + * Sorting tests is very important because it has a great impact on the + * user-perceived responsiveness and speed of the test run. + * + * If such information is on cache, tests are sorted based on: + * -> Has it failed during the last run ? + * Since it's important to provide the most expected feedback as quickly + * as possible. + * -> How long it took to run ? + * Because running long tests first is an effort to minimize worker idle + * time at the end of a long test run. + * And if that information is not available they are sorted based on file size + * since big test files usually take longer to complete. + * + * Note that a possible improvement would be to analyse other information + * from the file other than its size. + * + */ + + sort(tests) { + const stats = {}; + + const fileSize = ({path, context: {hasteFS}}) => + stats[path] || (stats[path] = hasteFS.getSize(path) || 0); + + const hasFailed = (cache, test) => + cache[test.path] && cache[test.path][0] === FAIL; + + const time = (cache, test) => cache[test.path] && cache[test.path][1]; + + tests.forEach(test => (test.duration = time(this._getCache(test), test))); + return tests.sort((testA, testB) => { + const cacheA = this._getCache(testA); + + const cacheB = this._getCache(testB); + + const failedA = hasFailed(cacheA, testA); + const failedB = hasFailed(cacheB, testB); + const hasTimeA = testA.duration != null; + + if (failedA !== failedB) { + return failedA ? -1 : 1; + } else if (hasTimeA != (testB.duration != null)) { + // If only one of two tests has timing information, run it last + return hasTimeA ? 1 : -1; + } else if (testA.duration != null && testB.duration != null) { + return testA.duration < testB.duration ? 1 : -1; + } else { + return fileSize(testA) < fileSize(testB) ? 1 : -1; + } + }); + } + + cacheResults(tests, results) { + const map = Object.create(null); + tests.forEach(test => (map[test.path] = test)); + results.testResults.forEach(testResult => { + if (testResult && map[testResult.testFilePath] && !testResult.skipped) { + const cache = this._getCache(map[testResult.testFilePath]); + + const perf = testResult.perfStats; + cache[testResult.testFilePath] = [ + testResult.numFailingTests ? FAIL : SUCCESS, + perf.end - perf.start || 0 + ]; + } + }); + + this._cache.forEach((cache, context) => + fs().writeFileSync(this._getCachePath(context), JSON.stringify(cache)) + ); + } +} + +exports.default = TestSequencer; diff --git a/node_modules/@jest/test-sequencer/build/ts3.4/index.d.ts b/node_modules/@jest/core/node_modules/@jest/test-sequencer/build/ts3.4/index.d.ts similarity index 100% rename from node_modules/@jest/test-sequencer/build/ts3.4/index.d.ts rename to node_modules/@jest/core/node_modules/@jest/test-sequencer/build/ts3.4/index.d.ts diff --git a/node_modules/@jest/core/node_modules/@jest/test-sequencer/package.json b/node_modules/@jest/core/node_modules/@jest/test-sequencer/package.json new file mode 100644 index 000000000..56729bcb6 --- /dev/null +++ b/node_modules/@jest/core/node_modules/@jest/test-sequencer/package.json @@ -0,0 +1,70 @@ +{ + "_args": [ + [ + "@jest/test-sequencer@25.5.4", + "/workspace/readable-readme" + ] + ], + "_development": true, + "_from": "@jest/test-sequencer@25.5.4", + "_id": "@jest/test-sequencer@25.5.4", + "_inBundle": false, + "_integrity": "sha512-pTJGEkSeg1EkCO2YWq6hbFvKNXk8ejqlxiOg1jBNLnWrgXOkdY6UmqZpwGFXNnRt9B8nO1uWMzLLZ4eCmhkPNA==", + "_location": "/@jest/core/@jest/test-sequencer", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@jest/test-sequencer@25.5.4", + "name": "@jest/test-sequencer", + "escapedName": "@jest%2ftest-sequencer", + "scope": "@jest", + "rawSpec": "25.5.4", + "saveSpec": null, + "fetchSpec": "25.5.4" + }, + "_requiredBy": [ + "/@jest/core/jest-config" + ], + "_resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.5.4.tgz", + "_spec": "25.5.4", + "_where": "/workspace/readable-readme", + "bugs": { + "url": "https://github.com/facebook/jest/issues" + }, + "dependencies": { + "@jest/test-result": "^25.5.0", + "graceful-fs": "^4.2.4", + "jest-haste-map": "^25.5.1", + "jest-runner": "^25.5.4", + "jest-runtime": "^25.5.4" + }, + "devDependencies": { + "@types/graceful-fs": "^4.1.3" + }, + "engines": { + "node": ">= 8.3" + }, + "gitHead": "389d13724bbf6bb64dcde9700a6ecea3333942db", + "homepage": "https://github.com/facebook/jest#readme", + "license": "MIT", + "main": "build/index.js", + "name": "@jest/test-sequencer", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/facebook/jest.git", + "directory": "packages/jest-test-sequencer" + }, + "types": "build/index.d.ts", + "typesVersions": { + "<3.8": { + "build/*": [ + "build/ts3.4/*" + ] + } + }, + "version": "25.5.4" +} diff --git a/node_modules/@jest/core/node_modules/@jest/types/build/Transform.d.ts b/node_modules/@jest/core/node_modules/@jest/types/build/Transform.d.ts index ea3e511cb..af8063f7d 100644 --- a/node_modules/@jest/core/node_modules/@jest/types/build/Transform.d.ts +++ b/node_modules/@jest/core/node_modules/@jest/types/build/Transform.d.ts @@ -7,6 +7,6 @@ export declare type TransformResult = { code: string; originalCode: string; - mapCoverage: boolean; + mapCoverage?: boolean; sourceMapPath: string | null; }; diff --git a/node_modules/@jest/core/node_modules/@jest/types/build/ts3.4/Transform.d.ts b/node_modules/@jest/core/node_modules/@jest/types/build/ts3.4/Transform.d.ts index bcc63baf1..231ae24ca 100644 --- a/node_modules/@jest/core/node_modules/@jest/types/build/ts3.4/Transform.d.ts +++ b/node_modules/@jest/core/node_modules/@jest/types/build/ts3.4/Transform.d.ts @@ -7,6 +7,6 @@ export declare type TransformResult = { code: string; originalCode: string; - mapCoverage: boolean; + mapCoverage?: boolean; sourceMapPath: string | null; }; diff --git a/node_modules/@jest/core/node_modules/@jest/types/package.json b/node_modules/@jest/core/node_modules/@jest/types/package.json index 58406c7d9..62f9944ee 100644 --- a/node_modules/@jest/core/node_modules/@jest/types/package.json +++ b/node_modules/@jest/core/node_modules/@jest/types/package.json @@ -1,34 +1,39 @@ { "_args": [ [ - "@jest/types@25.4.0", - "/home/runner/work/readable-readme/readable-readme" + "@jest/types@25.5.0", + "/workspace/readable-readme" ] ], "_development": true, - "_from": "@jest/types@25.4.0", - "_id": "@jest/types@25.4.0", + "_from": "@jest/types@25.5.0", + "_id": "@jest/types@25.5.0", "_inBundle": false, - "_integrity": "sha512-XBeaWNzw2PPnGW5aXvZt3+VO60M+34RY3XDsCK5tW7kyj3RK0XClRutCfjqcBuaR2aBQTbluEDME9b5MB9UAPw==", + "_integrity": "sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==", "_location": "/@jest/core/@jest/types", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "@jest/types@25.4.0", + "raw": "@jest/types@25.5.0", "name": "@jest/types", "escapedName": "@jest%2ftypes", "scope": "@jest", - "rawSpec": "25.4.0", + "rawSpec": "25.5.0", "saveSpec": null, - "fetchSpec": "25.4.0" + "fetchSpec": "25.5.0" }, "_requiredBy": [ - "/@jest/core" + "/@jest/core", + "/@jest/core/jest-config", + "/@jest/core/jest-jasmine2", + "/@jest/core/jest-runner", + "/@jest/core/jest-runtime", + "/@jest/core/pretty-format" ], - "_resolved": "https://registry.npmjs.org/@jest/types/-/types-25.4.0.tgz", - "_spec": "25.4.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_resolved": "https://registry.npmjs.org/@jest/types/-/types-25.5.0.tgz", + "_spec": "25.5.0", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/facebook/jest/issues" }, @@ -44,7 +49,7 @@ "engines": { "node": ">= 8.3" }, - "gitHead": "5b129d714cadb818be28afbe313cbeae8fbb1dde", + "gitHead": "ddd73d18adfb982b9b0d94bad7d41c9f78567ca7", "homepage": "https://github.com/facebook/jest#readme", "license": "MIT", "main": "build/index.js", @@ -65,5 +70,5 @@ ] } }, - "version": "25.4.0" + "version": "25.5.0" } diff --git a/node_modules/@jest/core/node_modules/ansi-regex/index.d.ts b/node_modules/@jest/core/node_modules/ansi-regex/index.d.ts new file mode 100644 index 000000000..2dbf6af2b --- /dev/null +++ b/node_modules/@jest/core/node_modules/ansi-regex/index.d.ts @@ -0,0 +1,37 @@ +declare namespace ansiRegex { + interface Options { + /** + Match only the first ANSI escape. + + @default false + */ + onlyFirst: boolean; + } +} + +/** +Regular expression for matching ANSI escape codes. + +@example +``` +import ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` +*/ +declare function ansiRegex(options?: ansiRegex.Options): RegExp; + +export = ansiRegex; diff --git a/node_modules/@jest/core/node_modules/ansi-regex/index.js b/node_modules/@jest/core/node_modules/ansi-regex/index.js new file mode 100644 index 000000000..35054aa67 --- /dev/null +++ b/node_modules/@jest/core/node_modules/ansi-regex/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = ({onlyFirst = false} = {}) => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' + ].join('|'); + + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +}; diff --git a/node_modules/macos-release/license b/node_modules/@jest/core/node_modules/ansi-regex/license similarity index 100% rename from node_modules/macos-release/license rename to node_modules/@jest/core/node_modules/ansi-regex/license diff --git a/node_modules/@jest/core/node_modules/ansi-regex/package.json b/node_modules/@jest/core/node_modules/ansi-regex/package.json new file mode 100644 index 000000000..7a42bf46f --- /dev/null +++ b/node_modules/@jest/core/node_modules/ansi-regex/package.json @@ -0,0 +1,91 @@ +{ + "_args": [ + [ + "ansi-regex@5.0.0", + "/workspace/readable-readme" + ] + ], + "_development": true, + "_from": "ansi-regex@5.0.0", + "_id": "ansi-regex@5.0.0", + "_inBundle": false, + "_integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "_location": "/@jest/core/ansi-regex", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ansi-regex@5.0.0", + "name": "ansi-regex", + "escapedName": "ansi-regex", + "rawSpec": "5.0.0", + "saveSpec": null, + "fetchSpec": "5.0.0" + }, + "_requiredBy": [ + "/@jest/core/pretty-format" + ], + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "_spec": "5.0.0", + "_where": "/workspace/readable-readme", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/chalk/ansi-regex/issues" + }, + "description": "Regular expression for matching ANSI escape codes", + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.9.0", + "xo": "^0.25.3" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "homepage": "https://github.com/chalk/ansi-regex#readme", + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "license": "MIT", + "name": "ansi-regex", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/ansi-regex.git" + }, + "scripts": { + "test": "xo && ava && tsd", + "view-supported": "node fixtures/view-codes.js" + }, + "version": "5.0.0" +} diff --git a/node_modules/@jest/core/node_modules/ansi-regex/readme.md b/node_modules/@jest/core/node_modules/ansi-regex/readme.md new file mode 100644 index 000000000..3c2b77c43 --- /dev/null +++ b/node_modules/@jest/core/node_modules/ansi-regex/readme.md @@ -0,0 +1,78 @@ +# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) + +> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install ansi-regex +``` + + +## Usage + +```js +const ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` + + +## API + +### ansiRegex(options?) + +Returns a regex for matching ANSI escape codes. + +#### options + +Type: `object` + +##### onlyFirst + +Type: `boolean`
+Default: `false` *(Matches any ANSI escape codes in a string)* + +Match only the first ANSI escape. + + +## FAQ + +### Why do you test for codes not in the ECMA 48 standard? + +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. + +On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/@jest/core/node_modules/ansi-styles/package.json b/node_modules/@jest/core/node_modules/ansi-styles/package.json index 91022c6e1..f635e4fb9 100644 --- a/node_modules/@jest/core/node_modules/ansi-styles/package.json +++ b/node_modules/@jest/core/node_modules/ansi-styles/package.json @@ -2,7 +2,7 @@ "_args": [ [ "ansi-styles@4.2.1", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -23,11 +23,12 @@ "fetchSpec": "4.2.1" }, "_requiredBy": [ - "/@jest/core/chalk" + "/@jest/core/chalk", + "/@jest/core/pretty-format" ], "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "_spec": "4.2.1", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@jest/core/node_modules/chalk/package.json b/node_modules/@jest/core/node_modules/chalk/package.json index 468d77ec1..93a1dd837 100644 --- a/node_modules/@jest/core/node_modules/chalk/package.json +++ b/node_modules/@jest/core/node_modules/chalk/package.json @@ -2,7 +2,7 @@ "_args": [ [ "chalk@3.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -24,11 +24,15 @@ }, "_requiredBy": [ "/@jest/core", - "/@jest/core/@jest/types" + "/@jest/core/@jest/types", + "/@jest/core/jest-config", + "/@jest/core/jest-jasmine2", + "/@jest/core/jest-runner", + "/@jest/core/jest-runtime" ], "_resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", "_spec": "3.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/chalk/chalk/issues" }, diff --git a/node_modules/@jest/core/node_modules/color-convert/package.json b/node_modules/@jest/core/node_modules/color-convert/package.json index 1d20e6e25..2073ce378 100644 --- a/node_modules/@jest/core/node_modules/color-convert/package.json +++ b/node_modules/@jest/core/node_modules/color-convert/package.json @@ -2,7 +2,7 @@ "_args": [ [ "color-convert@2.0.1", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "_spec": "2.0.1", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Heather Arthur", "email": "fayearthur@gmail.com" diff --git a/node_modules/@jest/core/node_modules/color-name/package.json b/node_modules/@jest/core/node_modules/color-name/package.json index 16846162f..7af43cf8e 100644 --- a/node_modules/@jest/core/node_modules/color-name/package.json +++ b/node_modules/@jest/core/node_modules/color-name/package.json @@ -2,7 +2,7 @@ "_args": [ [ "color-name@1.1.4", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "_spec": "1.1.4", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "DY", "email": "dfcreative@gmail.com" diff --git a/node_modules/@jest/core/node_modules/graceful-fs/LICENSE b/node_modules/@jest/core/node_modules/graceful-fs/LICENSE new file mode 100644 index 000000000..9d2c80369 --- /dev/null +++ b/node_modules/@jest/core/node_modules/graceful-fs/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@jest/core/node_modules/graceful-fs/README.md b/node_modules/@jest/core/node_modules/graceful-fs/README.md new file mode 100644 index 000000000..5273a50ad --- /dev/null +++ b/node_modules/@jest/core/node_modules/graceful-fs/README.md @@ -0,0 +1,133 @@ +# graceful-fs + +graceful-fs functions as a drop-in replacement for the fs module, +making various improvements. + +The improvements are meant to normalize behavior across different +platforms and environments, and to make filesystem access more +resilient to errors. + +## Improvements over [fs module](https://nodejs.org/api/fs.html) + +* Queues up `open` and `readdir` calls, and retries them once + something closes if there is an EMFILE error from too many file + descriptors. +* fixes `lchmod` for Node versions prior to 0.6.2. +* implements `fs.lutimes` if possible. Otherwise it becomes a noop. +* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or + `lchown` if the user isn't root. +* makes `lchmod` and `lchown` become noops, if not available. +* retries reading a file if `read` results in EAGAIN error. + +On Windows, it retries renaming a file for up to one second if `EACCESS` +or `EPERM` error occurs, likely because antivirus software has locked +the directory. + +## USAGE + +```javascript +// use just like fs +var fs = require('graceful-fs') + +// now go and do stuff with it... +fs.readFileSync('some-file-or-whatever') +``` + +## Global Patching + +If you want to patch the global fs module (or any other fs-like +module) you can do this: + +```javascript +// Make sure to read the caveat below. +var realFs = require('fs') +var gracefulFs = require('graceful-fs') +gracefulFs.gracefulify(realFs) +``` + +This should only ever be done at the top-level application layer, in +order to delay on EMFILE errors from any fs-using dependencies. You +should **not** do this in a library, because it can cause unexpected +delays in other parts of the program. + +## Changes + +This module is fairly stable at this point, and used by a lot of +things. That being said, because it implements a subtle behavior +change in a core part of the node API, even modest changes can be +extremely breaking, and the versioning is thus biased towards +bumping the major when in doubt. + +The main change between major versions has been switching between +providing a fully-patched `fs` module vs monkey-patching the node core +builtin, and the approach by which a non-monkey-patched `fs` was +created. + +The goal is to trade `EMFILE` errors for slower fs operations. So, if +you try to open a zillion files, rather than crashing, `open` +operations will be queued up and wait for something else to `close`. + +There are advantages to each approach. Monkey-patching the fs means +that no `EMFILE` errors can possibly occur anywhere in your +application, because everything is using the same core `fs` module, +which is patched. However, it can also obviously cause undesirable +side-effects, especially if the module is loaded multiple times. + +Implementing a separate-but-identical patched `fs` module is more +surgical (and doesn't run the risk of patching multiple times), but +also imposes the challenge of keeping in sync with the core module. + +The current approach loads the `fs` module, and then creates a +lookalike object that has all the same methods, except a few that are +patched. It is safe to use in all versions of Node from 0.8 through +7.0. + +### v4 + +* Do not monkey-patch the fs module. This module may now be used as a + drop-in dep, and users can opt into monkey-patching the fs builtin + if their app requires it. + +### v3 + +* Monkey-patch fs, because the eval approach no longer works on recent + node. +* fixed possible type-error throw if rename fails on windows +* verify that we *never* get EMFILE errors +* Ignore ENOSYS from chmod/chown +* clarify that graceful-fs must be used as a drop-in + +### v2.1.0 + +* Use eval rather than monkey-patching fs. +* readdir: Always sort the results +* win32: requeue a file if error has an OK status + +### v2.0 + +* A return to monkey patching +* wrap process.cwd + +### v1.1 + +* wrap readFile +* Wrap fs.writeFile. +* readdir protection +* Don't clobber the fs builtin +* Handle fs.read EAGAIN errors by trying again +* Expose the curOpen counter +* No-op lchown/lchmod if not implemented +* fs.rename patch only for win32 +* Patch fs.rename to handle AV software on Windows +* Close #4 Chown should not fail on einval or eperm if non-root +* Fix isaacs/fstream#1 Only wrap fs one time +* Fix #3 Start at 1024 max files, then back off on EMFILE +* lutimes that doens't blow up on Linux +* A full on-rewrite using a queue instead of just swallowing the EMFILE error +* Wrap Read/Write streams as well + +### 1.0 + +* Update engines for node 0.6 +* Be lstat-graceful on Windows +* first diff --git a/node_modules/@jest/core/node_modules/graceful-fs/clone.js b/node_modules/@jest/core/node_modules/graceful-fs/clone.js new file mode 100644 index 000000000..028356c96 --- /dev/null +++ b/node_modules/@jest/core/node_modules/graceful-fs/clone.js @@ -0,0 +1,19 @@ +'use strict' + +module.exports = clone + +function clone (obj) { + if (obj === null || typeof obj !== 'object') + return obj + + if (obj instanceof Object) + var copy = { __proto__: obj.__proto__ } + else + var copy = Object.create(null) + + Object.getOwnPropertyNames(obj).forEach(function (key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) + }) + + return copy +} diff --git a/node_modules/@jest/core/node_modules/graceful-fs/graceful-fs.js b/node_modules/@jest/core/node_modules/graceful-fs/graceful-fs.js new file mode 100644 index 000000000..de3df47fd --- /dev/null +++ b/node_modules/@jest/core/node_modules/graceful-fs/graceful-fs.js @@ -0,0 +1,354 @@ +var fs = require('fs') +var polyfills = require('./polyfills.js') +var legacy = require('./legacy-streams.js') +var clone = require('./clone.js') + +var util = require('util') + +/* istanbul ignore next - node 0.x polyfill */ +var gracefulQueue +var previousSymbol + +/* istanbul ignore else - node 0.x polyfill */ +if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { + gracefulQueue = Symbol.for('graceful-fs.queue') + // This is used in testing by future versions + previousSymbol = Symbol.for('graceful-fs.previous') +} else { + gracefulQueue = '___graceful-fs.queue' + previousSymbol = '___graceful-fs.previous' +} + +function noop () {} + +function publishQueue(context, queue) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue + } + }) +} + +var debug = noop +if (util.debuglog) + debug = util.debuglog('gfs4') +else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') + console.error(m) + } + +// Once time initialization +if (!fs[gracefulQueue]) { + // This queue can be shared by multiple loaded instances + var queue = global[gracefulQueue] || [] + publishQueue(fs, queue) + + // Patch fs.close/closeSync to shared queue version, because we need + // to retry() whenever a close happens *anywhere* in the program. + // This is essential when multiple graceful-fs instances are + // in play at the same time. + fs.close = (function (fs$close) { + function close (fd, cb) { + return fs$close.call(fs, fd, function (err) { + // This function uses the graceful-fs shared queue + if (!err) { + retry() + } + + if (typeof cb === 'function') + cb.apply(this, arguments) + }) + } + + Object.defineProperty(close, previousSymbol, { + value: fs$close + }) + return close + })(fs.close) + + fs.closeSync = (function (fs$closeSync) { + function closeSync (fd) { + // This function uses the graceful-fs shared queue + fs$closeSync.apply(fs, arguments) + retry() + } + + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }) + return closeSync + })(fs.closeSync) + + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug(fs[gracefulQueue]) + require('assert').equal(fs[gracefulQueue].length, 0) + }) + } +} + +if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); +} + +module.exports = patch(clone(fs)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module.exports = patch(fs) + fs.__patched = true; +} + +function patch (fs) { + // Everything that references the open() function needs to be in here + polyfills(fs) + fs.gracefulify = patch + + fs.createReadStream = createReadStream + fs.createWriteStream = createWriteStream + var fs$readFile = fs.readFile + fs.readFile = readFile + function readFile (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$readFile(path, options, cb) + + function go$readFile (path, options, cb) { + return fs$readFile(path, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readFile, [path, options, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + }) + } + } + + var fs$writeFile = fs.writeFile + fs.writeFile = writeFile + function writeFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$writeFile(path, data, options, cb) + + function go$writeFile (path, data, options, cb) { + return fs$writeFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$writeFile, [path, data, options, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + }) + } + } + + var fs$appendFile = fs.appendFile + if (fs$appendFile) + fs.appendFile = appendFile + function appendFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$appendFile(path, data, options, cb) + + function go$appendFile (path, data, options, cb) { + return fs$appendFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$appendFile, [path, data, options, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + }) + } + } + + var fs$readdir = fs.readdir + fs.readdir = readdir + function readdir (path, options, cb) { + var args = [path] + if (typeof options !== 'function') { + args.push(options) + } else { + cb = options + } + args.push(go$readdir$cb) + + return go$readdir(args) + + function go$readdir$cb (err, files) { + if (files && files.sort) + files.sort() + + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readdir, [args]]) + + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + } + } + + function go$readdir (args) { + return fs$readdir.apply(fs, args) + } + + if (process.version.substr(0, 4) === 'v0.8') { + var legStreams = legacy(fs) + ReadStream = legStreams.ReadStream + WriteStream = legStreams.WriteStream + } + + var fs$ReadStream = fs.ReadStream + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } + + var fs$WriteStream = fs.WriteStream + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open + } + + Object.defineProperty(fs, 'ReadStream', { + get: function () { + return ReadStream + }, + set: function (val) { + ReadStream = val + }, + enumerable: true, + configurable: true + }) + Object.defineProperty(fs, 'WriteStream', { + get: function () { + return WriteStream + }, + set: function (val) { + WriteStream = val + }, + enumerable: true, + configurable: true + }) + + // legacy names + var FileReadStream = ReadStream + Object.defineProperty(fs, 'FileReadStream', { + get: function () { + return FileReadStream + }, + set: function (val) { + FileReadStream = val + }, + enumerable: true, + configurable: true + }) + var FileWriteStream = WriteStream + Object.defineProperty(fs, 'FileWriteStream', { + get: function () { + return FileWriteStream + }, + set: function (val) { + FileWriteStream = val + }, + enumerable: true, + configurable: true + }) + + function ReadStream (path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + } + + function ReadStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + if (that.autoClose) + that.destroy() + + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + that.read() + } + }) + } + + function WriteStream (path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments) + } + + function WriteStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + that.destroy() + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + } + }) + } + + function createReadStream (path, options) { + return new fs.ReadStream(path, options) + } + + function createWriteStream (path, options) { + return new fs.WriteStream(path, options) + } + + var fs$open = fs.open + fs.open = open + function open (path, flags, mode, cb) { + if (typeof mode === 'function') + cb = mode, mode = null + + return go$open(path, flags, mode, cb) + + function go$open (path, flags, mode, cb) { + return fs$open(path, flags, mode, function (err, fd) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$open, [path, flags, mode, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + }) + } + } + + return fs +} + +function enqueue (elem) { + debug('ENQUEUE', elem[0].name, elem[1]) + fs[gracefulQueue].push(elem) +} + +function retry () { + var elem = fs[gracefulQueue].shift() + if (elem) { + debug('RETRY', elem[0].name, elem[1]) + elem[0].apply(null, elem[1]) + } +} diff --git a/node_modules/@jest/core/node_modules/graceful-fs/legacy-streams.js b/node_modules/@jest/core/node_modules/graceful-fs/legacy-streams.js new file mode 100644 index 000000000..d617b50fc --- /dev/null +++ b/node_modules/@jest/core/node_modules/graceful-fs/legacy-streams.js @@ -0,0 +1,118 @@ +var Stream = require('stream').Stream + +module.exports = legacy + +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream + } + + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); + + Stream.call(this); + + var self = this; + + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; + + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.encoding) this.setEncoding(this.encoding); + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); + } + + if (this.start > this.end) { + throw new Error('start must be <= end'); + } + + this.pos = this.start; + } + + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } + + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } + + self.fd = fd; + self.emit('open', fd); + self._read(); + }) + } + + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); + + Stream.call(this); + + this.path = path; + this.fd = null; + this.writable = true; + + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } + + this.pos = this.start; + } + + this.busy = false; + this._queue = []; + + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); + } + } +} diff --git a/node_modules/@jest/core/node_modules/graceful-fs/package.json b/node_modules/@jest/core/node_modules/graceful-fs/package.json new file mode 100644 index 000000000..2b190323d --- /dev/null +++ b/node_modules/@jest/core/node_modules/graceful-fs/package.json @@ -0,0 +1,87 @@ +{ + "_args": [ + [ + "graceful-fs@4.2.4", + "/workspace/readable-readme" + ] + ], + "_development": true, + "_from": "graceful-fs@4.2.4", + "_id": "graceful-fs@4.2.4", + "_inBundle": false, + "_integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "_location": "/@jest/core/graceful-fs", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "graceful-fs@4.2.4", + "name": "graceful-fs", + "escapedName": "graceful-fs", + "rawSpec": "4.2.4", + "saveSpec": null, + "fetchSpec": "4.2.4" + }, + "_requiredBy": [ + "/@jest/core", + "/@jest/core/@jest/test-sequencer", + "/@jest/core/jest-config", + "/@jest/core/jest-runner", + "/@jest/core/jest-runtime" + ], + "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "_spec": "4.2.4", + "_where": "/workspace/readable-readme", + "bugs": { + "url": "https://github.com/isaacs/node-graceful-fs/issues" + }, + "dependencies": {}, + "description": "A drop-in replacement for fs, making various improvements.", + "devDependencies": { + "import-fresh": "^2.0.0", + "mkdirp": "^0.5.0", + "rimraf": "^2.2.8", + "tap": "^12.7.0" + }, + "directories": { + "test": "test" + }, + "files": [ + "fs.js", + "graceful-fs.js", + "legacy-streams.js", + "polyfills.js", + "clone.js" + ], + "homepage": "https://github.com/isaacs/node-graceful-fs#readme", + "keywords": [ + "fs", + "module", + "reading", + "retry", + "retries", + "queue", + "error", + "errors", + "handling", + "EMFILE", + "EAGAIN", + "EINVAL", + "EPERM", + "EACCESS" + ], + "license": "ISC", + "main": "graceful-fs.js", + "name": "graceful-fs", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/node-graceful-fs.git" + }, + "scripts": { + "postpublish": "git push origin --follow-tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "node test.js | tap -" + }, + "version": "4.2.4" +} diff --git a/node_modules/@jest/core/node_modules/graceful-fs/polyfills.js b/node_modules/@jest/core/node_modules/graceful-fs/polyfills.js new file mode 100644 index 000000000..a5808d23f --- /dev/null +++ b/node_modules/@jest/core/node_modules/graceful-fs/polyfills.js @@ -0,0 +1,342 @@ +var constants = require('constants') + +var origCwd = process.cwd +var cwd = null + +var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform + +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +try { + process.cwd() +} catch (er) {} + +var chdir = process.chdir +process.chdir = function(d) { + cwd = null + chdir.call(process, d) +} + +module.exports = patch + +function patch (fs) { + // (re-)implement some things that are known busted or missing. + + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) + } + + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } + + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. + + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) + + fs.chmod = chmodFix(fs.chmod) + fs.fchmod = chmodFix(fs.fchmod) + fs.lchmod = chmodFix(fs.lchmod) + + fs.chownSync = chownFixSync(fs.chownSync) + fs.fchownSync = chownFixSync(fs.fchownSync) + fs.lchownSync = chownFixSync(fs.lchownSync) + + fs.chmodSync = chmodFixSync(fs.chmodSync) + fs.fchmodSync = chmodFixSync(fs.fchmodSync) + fs.lchmodSync = chmodFixSync(fs.lchmodSync) + + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) + + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) + + // if lchmod/lchown do not exist, then make them no-ops + if (!fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + if (cb) process.nextTick(cb) + } + fs.lchmodSync = function () {} + } + if (!fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + if (cb) process.nextTick(cb) + } + fs.lchownSync = function () {} + } + + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. + + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + if (platform === "win32") { + fs.rename = (function (fs$rename) { return function (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + }})(fs.rename) + } + + // if read() returns EAGAIN, then just try it again. + fs.read = (function (fs$read) { + function read (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + + // This ensures `util.promisify` works as it does for native `fs.read`. + read.__proto__ = fs$read + return read + })(fs.read) + + fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } + }})(fs.readSync) + + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) + } + + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + } + + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } + + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + + } else { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} + } + } + + function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + + function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + function callback (er, stats) { + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + if (cb) cb.apply(this, arguments) + } + return options ? orig.call(fs, target, options, callback) + : orig.call(fs, target, callback) + } + } + + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options) { + var stats = options ? orig.call(fs, target, options) + : orig.call(fs, target) + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + return stats; + } + } + + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true + + if (er.code === "ENOSYS") + return true + + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } + + return false + } +} diff --git a/node_modules/@jest/core/node_modules/has-flag/package.json b/node_modules/@jest/core/node_modules/has-flag/package.json index 167c52818..e52985684 100644 --- a/node_modules/@jest/core/node_modules/has-flag/package.json +++ b/node_modules/@jest/core/node_modules/has-flag/package.json @@ -2,7 +2,7 @@ "_args": [ [ "has-flag@4.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "_spec": "4.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/babel-preset-jest/node_modules/babel-plugin-jest-hoist/LICENSE b/node_modules/@jest/core/node_modules/jest-config/LICENSE similarity index 100% rename from node_modules/babel-preset-jest/node_modules/babel-plugin-jest-hoist/LICENSE rename to node_modules/@jest/core/node_modules/jest-config/LICENSE diff --git a/node_modules/@jest/core/node_modules/jest-config/build/Defaults.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/Defaults.d.ts new file mode 100644 index 000000000..8a26ee6ec --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/Defaults.d.ts @@ -0,0 +1,9 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +declare const defaultOptions: Config.DefaultOptions; +export default defaultOptions; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/Defaults.js b/node_modules/@jest/core/node_modules/jest-config/build/Defaults.js new file mode 100644 index 000000000..c3e1a44c5 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/Defaults.js @@ -0,0 +1,94 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +function _jestRegexUtil() { + const data = require('jest-regex-util'); + + _jestRegexUtil = function () { + return data; + }; + + return data; +} + +var _constants = require('./constants'); + +var _getCacheDirectory = _interopRequireDefault(require('./getCacheDirectory')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const NODE_MODULES_REGEXP = (0, _jestRegexUtil().replacePathSepForRegex)( + _constants.NODE_MODULES +); +const defaultOptions = { + automock: false, + bail: 0, + browser: false, + cache: true, + cacheDirectory: (0, _getCacheDirectory.default)(), + changedFilesWithAncestor: false, + clearMocks: false, + collectCoverage: false, + coveragePathIgnorePatterns: [NODE_MODULES_REGEXP], + coverageProvider: 'babel', + coverageReporters: ['json', 'text', 'lcov', 'clover'], + errorOnDeprecated: false, + expand: false, + forceCoverageMatch: [], + globals: {}, + haste: { + computeSha1: false, + providesModuleNodeModules: [], + throwOnModuleCollision: false + }, + maxConcurrency: 5, + maxWorkers: '50%', + moduleDirectories: ['node_modules'], + moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node'], + moduleNameMapper: {}, + modulePathIgnorePatterns: [], + noStackTrace: false, + notify: false, + notifyMode: 'failure-change', + prettierPath: 'prettier', + resetMocks: false, + resetModules: false, + restoreMocks: false, + roots: [''], + runTestsByPath: false, + runner: 'jest-runner', + setupFiles: [], + setupFilesAfterEnv: [], + skipFilter: false, + snapshotSerializers: [], + testEnvironment: 'jest-environment-jsdom', + testEnvironmentOptions: {}, + testFailureExitCode: 1, + testLocationInResults: false, + testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'], + testPathIgnorePatterns: [NODE_MODULES_REGEXP], + testRegex: [], + testRunner: 'jasmine2', + testSequencer: '@jest/test-sequencer', + testURL: 'http://localhost', + timers: 'real', + transformIgnorePatterns: [NODE_MODULES_REGEXP], + useStderr: false, + watch: false, + watchPathIgnorePatterns: [], + watchman: true +}; +var _default = defaultOptions; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/Deprecated.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/Deprecated.d.ts new file mode 100644 index 000000000..58f67ccbb --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/Deprecated.d.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +declare const _default: Record; +export default _default; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/Deprecated.js b/node_modules/@jest/core/node_modules/jest-config/build/Deprecated.js new file mode 100644 index 000000000..44031b124 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/Deprecated.js @@ -0,0 +1,98 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +function _prettyFormat() { + const data = _interopRequireDefault(require('pretty-format')); + + _prettyFormat = function () { + return data; + }; + + return data; +} + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const format = value => + (0, _prettyFormat().default)(value, { + min: true + }); + +var _default = { + mapCoverage: () => ` Option ${_chalk().default.bold( + '"mapCoverage"' + )} has been removed, as it's no longer necessary. + + Please update your configuration.`, + preprocessorIgnorePatterns: options => ` Option ${_chalk().default.bold( + '"preprocessorIgnorePatterns"' + )} was replaced by ${_chalk().default.bold( + '"transformIgnorePatterns"' + )}, which support multiple preprocessors. + + Jest now treats your current configuration as: + { + ${_chalk().default.bold( + '"transformIgnorePatterns"' + )}: ${_chalk().default.bold(format(options.preprocessorIgnorePatterns))} + } + + Please update your configuration.`, + scriptPreprocessor: options => ` Option ${_chalk().default.bold( + '"scriptPreprocessor"' + )} was replaced by ${_chalk().default.bold( + '"transform"' + )}, which support multiple preprocessors. + + Jest now treats your current configuration as: + { + ${_chalk().default.bold('"transform"')}: ${_chalk().default.bold( + `{".*": ${format(options.scriptPreprocessor)}}` + )} + } + + Please update your configuration.`, + setupTestFrameworkScriptFile: _options => ` Option ${_chalk().default.bold( + '"setupTestFrameworkScriptFile"' + )} was replaced by configuration ${_chalk().default.bold( + '"setupFilesAfterEnv"' + )}, which supports multiple paths. + + Please update your configuration.`, + testPathDirs: options => ` Option ${_chalk().default.bold( + '"testPathDirs"' + )} was replaced by ${_chalk().default.bold('"roots"')}. + + Jest now treats your current configuration as: + { + ${_chalk().default.bold('"roots"')}: ${_chalk().default.bold( + format(options.testPathDirs) + )} + } + + Please update your configuration. + ` +}; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/Descriptions.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/Descriptions.d.ts new file mode 100644 index 000000000..acf6e3b67 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/Descriptions.d.ts @@ -0,0 +1,11 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +declare const descriptions: { + [key in keyof Config.InitialOptions]: string; +}; +export default descriptions; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/Descriptions.js b/node_modules/@jest/core/node_modules/jest-config/build/Descriptions.js new file mode 100644 index 000000000..bcdf116f2 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/Descriptions.js @@ -0,0 +1,102 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const descriptions = { + automock: 'All imported modules in your tests should be mocked automatically', + bail: 'Stop running tests after `n` failures', + browser: 'Respect "browser" field in package.json when resolving modules', + cacheDirectory: + 'The directory where Jest should store its cached dependency information', + clearMocks: 'Automatically clear mock calls and instances between every test', + collectCoverage: + 'Indicates whether the coverage information should be collected while executing the test', + collectCoverageFrom: + 'An array of glob patterns indicating a set of files for which coverage information should be collected', + coverageDirectory: + 'The directory where Jest should output its coverage files', + coveragePathIgnorePatterns: + 'An array of regexp pattern strings used to skip coverage collection', + coverageReporters: + 'A list of reporter names that Jest uses when writing coverage reports', + coverageThreshold: + 'An object that configures minimum threshold enforcement for coverage results', + dependencyExtractor: 'A path to a custom dependency extractor', + errorOnDeprecated: + 'Make calling deprecated APIs throw helpful error messages', + forceCoverageMatch: + 'Force coverage collection from ignored files using an array of glob patterns', + globalSetup: + 'A path to a module which exports an async function that is triggered once before all test suites', + globalTeardown: + 'A path to a module which exports an async function that is triggered once after all test suites', + globals: + 'A set of global variables that need to be available in all test environments', + maxWorkers: + 'The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.', + moduleDirectories: + "An array of directory names to be searched recursively up from the requiring module's location", + moduleFileExtensions: 'An array of file extensions your modules use', + moduleNameMapper: + 'A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module', + modulePathIgnorePatterns: + "An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader", + notify: 'Activates notifications for test results', + notifyMode: + 'An enum that specifies notification mode. Requires { notify: true }', + preset: "A preset that is used as a base for Jest's configuration", + projects: 'Run tests from one or more projects', + reporters: 'Use this configuration option to add custom reporters to Jest', + resetMocks: 'Automatically reset mock state between every test', + resetModules: 'Reset the module registry before running each individual test', + resolver: 'A path to a custom resolver', + restoreMocks: 'Automatically restore mock state between every test', + rootDir: + 'The root directory that Jest should scan for tests and modules within', + roots: + 'A list of paths to directories that Jest should use to search for files in', + runner: + "Allows you to use a custom runner instead of Jest's default test runner", + setupFiles: + 'The paths to modules that run some code to configure or set up the testing environment before each test', + setupFilesAfterEnv: + 'A list of paths to modules that run some code to configure or set up the testing framework before each test', + snapshotSerializers: + 'A list of paths to snapshot serializer modules Jest should use for snapshot testing', + testEnvironment: 'The test environment that will be used for testing', + testEnvironmentOptions: 'Options that will be passed to the testEnvironment', + testLocationInResults: 'Adds a location field to test results', + testMatch: 'The glob patterns Jest uses to detect test files', + testPathIgnorePatterns: + 'An array of regexp pattern strings that are matched against all test paths, matched tests are skipped', + testRegex: + 'The regexp pattern or array of patterns that Jest uses to detect test files', + testResultsProcessor: + 'This option allows the use of a custom results processor', + testRunner: 'This option allows use of a custom test runner', + testURL: + 'This option sets the URL for the jsdom environment. It is reflected in properties such as location.href', + timers: + 'Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"', + transform: 'A map from regular expressions to paths to transformers', + transformIgnorePatterns: + 'An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation', + unmockedModulePathPatterns: + 'An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them', + verbose: + 'Indicates whether each individual test should be reported during the run', + watchPathIgnorePatterns: + 'An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode', + watchman: 'Whether to use watchman for file crawling' +}; +var _default = descriptions; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/ReporterValidationErrors.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ReporterValidationErrors.d.ts new file mode 100644 index 000000000..642fdae48 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/ReporterValidationErrors.d.ts @@ -0,0 +1,19 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +import { ValidationError } from 'jest-validate'; +/** + * Reporter Validation Error is thrown if the given arguments + * within the reporter are not valid. + * + * This is a highly specific reporter error and in the future will be + * merged with jest-validate. Till then, we can make use of it. It works + * and that's what counts most at this time. + */ +export declare function createReporterError(reporterIndex: number, reporterValue: Array | string): ValidationError; +export declare function createArrayReporterError(arrayReporter: Config.ReporterConfig, reporterIndex: number, valueIndex: number, value: string | Record, expectedType: string, valueName: string): ValidationError; +export declare function validateReporters(reporterConfig: Array): boolean; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/ReporterValidationErrors.js b/node_modules/@jest/core/node_modules/jest-config/build/ReporterValidationErrors.js new file mode 100644 index 000000000..53e1b8226 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/ReporterValidationErrors.js @@ -0,0 +1,138 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.createReporterError = createReporterError; +exports.createArrayReporterError = createArrayReporterError; +exports.validateReporters = validateReporters; + +function _jestValidate() { + const data = require('jest-validate'); + + _jestValidate = function () { + return data; + }; + + return data; +} + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +function _jestGetType() { + const data = _interopRequireDefault(require('jest-get-type')); + + _jestGetType = function () { + return data; + }; + + return data; +} + +var _utils = require('./utils'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const validReporterTypes = ['array', 'string']; +const ERROR = `${_utils.BULLET}Reporter Validation Error`; +/** + * Reporter Validation Error is thrown if the given arguments + * within the reporter are not valid. + * + * This is a highly specific reporter error and in the future will be + * merged with jest-validate. Till then, we can make use of it. It works + * and that's what counts most at this time. + */ + +function createReporterError(reporterIndex, reporterValue) { + const errorMessage = + ` Reporter at index ${reporterIndex} must be of type:\n` + + ` ${_chalk().default.bold.green(validReporterTypes.join(' or '))}\n` + + ` but instead received:\n` + + ` ${_chalk().default.bold.red( + (0, _jestGetType().default)(reporterValue) + )}`; + return new (_jestValidate().ValidationError)( + ERROR, + errorMessage, + _utils.DOCUMENTATION_NOTE + ); +} + +function createArrayReporterError( + arrayReporter, + reporterIndex, + valueIndex, + value, + expectedType, + valueName +) { + const errorMessage = + ` Unexpected value for ${valueName} ` + + `at index ${valueIndex} of reporter at index ${reporterIndex}\n` + + ' Expected:\n' + + ` ${_chalk().default.bold.red(expectedType)}\n` + + ' Got:\n' + + ` ${_chalk().default.bold.green((0, _jestGetType().default)(value))}\n` + + ` Reporter configuration:\n` + + ` ${_chalk().default.bold.green( + JSON.stringify(arrayReporter, null, 2).split('\n').join('\n ') + )}`; + return new (_jestValidate().ValidationError)( + ERROR, + errorMessage, + _utils.DOCUMENTATION_NOTE + ); +} + +function validateReporters(reporterConfig) { + return reporterConfig.every((reporter, index) => { + if (Array.isArray(reporter)) { + validateArrayReporter(reporter, index); + } else if (typeof reporter !== 'string') { + throw createReporterError(index, reporter); + } + + return true; + }); +} + +function validateArrayReporter(arrayReporter, reporterIndex) { + const [path, options] = arrayReporter; + + if (typeof path !== 'string') { + throw createArrayReporterError( + arrayReporter, + reporterIndex, + 0, + path, + 'string', + 'Path' + ); + } else if (typeof options !== 'object') { + throw createArrayReporterError( + arrayReporter, + reporterIndex, + 1, + options, + 'object', + 'Reporter Configuration' + ); + } +} diff --git a/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.d.ts new file mode 100644 index 000000000..a58484fa0 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.d.ts @@ -0,0 +1,9 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +declare const initialOptions: Config.InitialOptions; +export default initialOptions; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.js b/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.js new file mode 100644 index 000000000..5a67c6c6f --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.js @@ -0,0 +1,179 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +function _jestRegexUtil() { + const data = require('jest-regex-util'); + + _jestRegexUtil = function () { + return data; + }; + + return data; +} + +function _jestValidate() { + const data = require('jest-validate'); + + _jestValidate = function () { + return data; + }; + + return data; +} + +var _constants = require('./constants'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const NODE_MODULES_REGEXP = (0, _jestRegexUtil().replacePathSepForRegex)( + _constants.NODE_MODULES +); +const initialOptions = { + automock: false, + bail: (0, _jestValidate().multipleValidOptions)(false, 0), + browser: false, + cache: true, + cacheDirectory: '/tmp/user/jest', + changedFilesWithAncestor: false, + changedSince: 'master', + clearMocks: false, + collectCoverage: true, + collectCoverageFrom: ['src', '!public'], + collectCoverageOnlyFrom: { + '/this-directory-is-covered/Covered.js': true + }, + coverageDirectory: 'coverage', + coveragePathIgnorePatterns: [NODE_MODULES_REGEXP], + coverageProvider: 'v8', + coverageReporters: ['json', 'text', 'lcov', 'clover'], + coverageThreshold: { + global: { + branches: 50, + functions: 100, + lines: 100, + statements: 100 + } + }, + dependencyExtractor: '/dependencyExtractor.js', + displayName: (0, _jestValidate().multipleValidOptions)('test-config', { + color: 'blue', + name: 'test-config' + }), + errorOnDeprecated: false, + expand: false, + extraGlobals: [], + filter: '/filter.js', + forceCoverageMatch: ['**/*.t.js'], + forceExit: false, + globalSetup: 'setup.js', + globalTeardown: 'teardown.js', + globals: { + __DEV__: true + }, + haste: { + computeSha1: true, + defaultPlatform: 'ios', + hasteImplModulePath: '/haste_impl.js', + platforms: ['ios', 'android'], + providesModuleNodeModules: ['react', 'react-native'], + throwOnModuleCollision: false + }, + json: false, + lastCommit: false, + logHeapUsage: true, + maxConcurrency: 5, + maxWorkers: '50%', + moduleDirectories: ['node_modules'], + moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node'], + moduleLoader: '', + moduleNameMapper: { + '^React$': '/node_modules/react' + }, + modulePathIgnorePatterns: ['/build/'], + modulePaths: ['/shared/vendor/modules'], + name: 'string', + noStackTrace: false, + notify: false, + notifyMode: 'failure-change', + onlyChanged: false, + preset: 'react-native', + prettierPath: '/node_modules/prettier', + projects: ['project-a', 'project-b/'], + reporters: [ + 'default', + 'custom-reporter-1', + [ + 'custom-reporter-2', + { + configValue: true + } + ] + ], + resetMocks: false, + resetModules: false, + resolver: '/resolver.js', + restoreMocks: false, + rootDir: '/', + roots: [''], + runTestsByPath: false, + runner: 'jest-runner', + setupFiles: ['/setup.js'], + setupFilesAfterEnv: ['/testSetupFile.js'], + silent: true, + skipFilter: false, + skipNodeResolution: false, + snapshotResolver: '/snapshotResolver.js', + snapshotSerializers: ['my-serializer-module'], + testEnvironment: 'jest-environment-jsdom', + testEnvironmentOptions: { + userAgent: 'Agent/007' + }, + testFailureExitCode: 1, + testLocationInResults: false, + testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], + testNamePattern: 'test signature', + testPathIgnorePatterns: [NODE_MODULES_REGEXP], + testRegex: (0, + _jestValidate() + .multipleValidOptions)('(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$', [ + '/__tests__/\\.test\\.[jt]sx?$', + '/__tests__/\\.spec\\.[jt]sx?$' + ]), + testResultsProcessor: 'processor-node-module', + testRunner: 'jasmine2', + testSequencer: '@jest/test-sequencer', + testTimeout: 5000, + testURL: 'http://localhost', + timers: 'real', + transform: { + '^.+\\.js$': '/preprocessor.js' + }, + transformIgnorePatterns: [NODE_MODULES_REGEXP], + unmockedModulePathPatterns: ['mock'], + updateSnapshot: true, + useStderr: false, + verbose: false, + watch: false, + watchPathIgnorePatterns: ['/e2e/'], + watchPlugins: [ + 'path/to/yourWatchPlugin', + [ + 'jest-watch-typeahead/filename', + { + key: 'k', + prompt: 'do something with my custom prompt' + } + ] + ], + watchman: true +}; +var _default = initialOptions; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/color.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/color.d.ts new file mode 100644 index 000000000..199baac4a --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/color.d.ts @@ -0,0 +1,7 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare const getDisplayNameColor: (seed?: string | undefined) => "hex" | "bold" | "reset" | "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright" | "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough" | "visible" | "Instance" | "level" | "keyword" | "rgb" | "hsl" | "hsv" | "hwb" | "ansi" | "ansi256" | "bgHex" | "bgKeyword" | "bgRgb" | "bgHsl" | "bgHsv" | "bgHwb" | "bgAnsi" | "bgAnsi256" | "supportsColor" | "Level" | "Color" | "ForegroundColor" | "BackgroundColor" | "Modifiers" | "stderr"; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/color.js b/node_modules/@jest/core/node_modules/jest-config/build/color.js new file mode 100644 index 000000000..378d41f98 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/color.js @@ -0,0 +1,51 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.getDisplayNameColor = void 0; + +function _crypto() { + const data = require('crypto'); + + _crypto = function () { + return data; + }; + + return data; +} + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const colors = ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']; + +const getDisplayNameColor = seed => { + if (seed === undefined) { + return 'white'; + } + + const hash = (0, _crypto().createHash)('sha256'); + hash.update(seed); + const num = hash.digest().readUInt32LE(0); + return colors[num % colors.length]; +}; + +exports.getDisplayNameColor = getDisplayNameColor; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/constants.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/constants.d.ts new file mode 100644 index 000000000..fb9b1a2af --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/constants.d.ts @@ -0,0 +1,16 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare const NODE_MODULES: string; +export declare const DEFAULT_JS_PATTERN = "^.+\\.[jt]sx?$"; +export declare const DEFAULT_REPORTER_LABEL = "default"; +export declare const PACKAGE_JSON = "package.json"; +export declare const JEST_CONFIG_BASE_NAME = "jest.config"; +export declare const JEST_CONFIG_EXT_CJS = ".cjs"; +export declare const JEST_CONFIG_EXT_MJS = ".mjs"; +export declare const JEST_CONFIG_EXT_JS = ".js"; +export declare const JEST_CONFIG_EXT_JSON = ".json"; +export declare const JEST_CONFIG_EXT_ORDER: readonly string[]; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/constants.js b/node_modules/@jest/core/node_modules/jest-config/build/constants.js new file mode 100644 index 000000000..b6735b896 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/constants.js @@ -0,0 +1,90 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.JEST_CONFIG_EXT_ORDER = exports.JEST_CONFIG_EXT_JSON = exports.JEST_CONFIG_EXT_JS = exports.JEST_CONFIG_EXT_MJS = exports.JEST_CONFIG_EXT_CJS = exports.JEST_CONFIG_BASE_NAME = exports.PACKAGE_JSON = exports.DEFAULT_REPORTER_LABEL = exports.DEFAULT_JS_PATTERN = exports.NODE_MODULES = void 0; + +function path() { + const data = _interopRequireWildcard(require('path')); + + path = function () { + return data; + }; + + return data; +} + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const NODE_MODULES = path().sep + 'node_modules' + path().sep; +exports.NODE_MODULES = NODE_MODULES; +const DEFAULT_JS_PATTERN = '^.+\\.[jt]sx?$'; +exports.DEFAULT_JS_PATTERN = DEFAULT_JS_PATTERN; +const DEFAULT_REPORTER_LABEL = 'default'; +exports.DEFAULT_REPORTER_LABEL = DEFAULT_REPORTER_LABEL; +const PACKAGE_JSON = 'package.json'; +exports.PACKAGE_JSON = PACKAGE_JSON; +const JEST_CONFIG_BASE_NAME = 'jest.config'; +exports.JEST_CONFIG_BASE_NAME = JEST_CONFIG_BASE_NAME; +const JEST_CONFIG_EXT_CJS = '.cjs'; +exports.JEST_CONFIG_EXT_CJS = JEST_CONFIG_EXT_CJS; +const JEST_CONFIG_EXT_MJS = '.mjs'; +exports.JEST_CONFIG_EXT_MJS = JEST_CONFIG_EXT_MJS; +const JEST_CONFIG_EXT_JS = '.js'; +exports.JEST_CONFIG_EXT_JS = JEST_CONFIG_EXT_JS; +const JEST_CONFIG_EXT_JSON = '.json'; +exports.JEST_CONFIG_EXT_JSON = JEST_CONFIG_EXT_JSON; +const JEST_CONFIG_EXT_ORDER = Object.freeze([ + JEST_CONFIG_EXT_JS, + JEST_CONFIG_EXT_MJS, + JEST_CONFIG_EXT_CJS, + JEST_CONFIG_EXT_JSON +]); +exports.JEST_CONFIG_EXT_ORDER = JEST_CONFIG_EXT_ORDER; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/getCacheDirectory.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/getCacheDirectory.d.ts new file mode 100644 index 000000000..e2767bc38 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/getCacheDirectory.d.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +declare const getCacheDirectory: () => string; +export default getCacheDirectory; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/getCacheDirectory.js b/node_modules/@jest/core/node_modules/jest-config/build/getCacheDirectory.js new file mode 100644 index 000000000..409def636 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/getCacheDirectory.js @@ -0,0 +1,104 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +function path() { + const data = _interopRequireWildcard(require('path')); + + path = function () { + return data; + }; + + return data; +} + +function _os() { + const data = require('os'); + + _os = function () { + return data; + }; + + return data; +} + +function _realpathNative() { + const data = require('realpath-native'); + + _realpathNative = function () { + return data; + }; + + return data; +} + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const getCacheDirectory = () => { + const {getuid} = process; + const tmpdirPath = path().join( + (0, _realpathNative().sync)((0, _os().tmpdir)()), + 'jest' + ); + + if (getuid == null) { + return tmpdirPath; + } else { + // On some platforms tmpdir() is `/tmp`, causing conflicts between different + // users and permission issues. Adding an additional subdivision by UID can + // help. + return `${tmpdirPath}_${getuid.call(process).toString(36)}`; + } +}; + +var _default = getCacheDirectory; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/getMaxWorkers.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/getMaxWorkers.d.ts new file mode 100644 index 000000000..81dfedc36 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/getMaxWorkers.d.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +export default function getMaxWorkers(argv: Partial>, defaultOptions?: Partial>): number; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/getMaxWorkers.js b/node_modules/@jest/core/node_modules/jest-config/build/getMaxWorkers.js new file mode 100644 index 000000000..7f97165cc --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/getMaxWorkers.js @@ -0,0 +1,57 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = getMaxWorkers; + +function _os() { + const data = require('os'); + + _os = function () { + return data; + }; + + return data; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function getMaxWorkers(argv, defaultOptions) { + if (argv.runInBand) { + return 1; + } else if (argv.maxWorkers) { + return parseWorkers(argv.maxWorkers); + } else if (defaultOptions && defaultOptions.maxWorkers) { + return parseWorkers(defaultOptions.maxWorkers); + } else { + // In watch mode, Jest should be unobtrusive and not use all available CPUs. + const numCpus = (0, _os().cpus)() ? (0, _os().cpus)().length : 1; + const isWatchModeEnabled = argv.watch || argv.watchAll; + return Math.max( + isWatchModeEnabled ? Math.floor(numCpus / 2) : numCpus - 1, + 1 + ); + } +} + +const parseWorkers = maxWorkers => { + const parsed = parseInt(maxWorkers.toString(), 10); + + if ( + typeof maxWorkers === 'string' && + maxWorkers.trim().endsWith('%') && + parsed > 0 && + parsed <= 100 + ) { + const numCpus = (0, _os().cpus)().length; + const workers = Math.floor((parsed / 100) * numCpus); + return workers >= 1 ? workers : 1; + } + + return parsed > 0 ? parsed : 1; +}; diff --git a/node_modules/jest-config/build/importEsm.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/importEsm.d.ts similarity index 100% rename from node_modules/jest-config/build/importEsm.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/importEsm.d.ts diff --git a/node_modules/jest-config/build/importEsm.js b/node_modules/@jest/core/node_modules/jest-config/build/importEsm.js similarity index 100% rename from node_modules/jest-config/build/importEsm.js rename to node_modules/@jest/core/node_modules/jest-config/build/importEsm.js diff --git a/node_modules/@jest/core/node_modules/jest-config/build/index.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/index.d.ts new file mode 100644 index 000000000..1a57d2032 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/index.d.ts @@ -0,0 +1,27 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +export { getTestEnvironment, isJSONString } from './utils'; +export { default as normalize } from './normalize'; +export { default as deprecationEntries } from './Deprecated'; +export { replaceRootDirInPath } from './utils'; +export { default as defaults } from './Defaults'; +export { default as descriptions } from './Descriptions'; +import * as constants from './constants'; +export { constants }; +declare type ReadConfig = { + configPath: Config.Path | null | undefined; + globalConfig: Config.GlobalConfig; + hasDeprecationWarnings: boolean; + projectConfig: Config.ProjectConfig; +}; +export declare function readConfig(argv: Config.Argv, packageRootOrConfig: Config.Path | Config.InitialOptions, skipArgvConfigOption?: boolean, parentConfigPath?: Config.Path | null, projectIndex?: number): Promise; +export declare function readConfigs(argv: Config.Argv, projectPaths: Array): Promise<{ + globalConfig: Config.GlobalConfig; + configs: Array; + hasDeprecationWarnings: boolean; +}>; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/index.js b/node_modules/@jest/core/node_modules/jest-config/build/index.js new file mode 100644 index 000000000..6a585f502 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/index.js @@ -0,0 +1,474 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.readConfig = readConfig; +exports.readConfigs = readConfigs; +Object.defineProperty(exports, 'getTestEnvironment', { + enumerable: true, + get: function () { + return _utils.getTestEnvironment; + } +}); +Object.defineProperty(exports, 'isJSONString', { + enumerable: true, + get: function () { + return _utils.isJSONString; + } +}); +Object.defineProperty(exports, 'replaceRootDirInPath', { + enumerable: true, + get: function () { + return _utils.replaceRootDirInPath; + } +}); +Object.defineProperty(exports, 'normalize', { + enumerable: true, + get: function () { + return _normalize.default; + } +}); +Object.defineProperty(exports, 'deprecationEntries', { + enumerable: true, + get: function () { + return _Deprecated.default; + } +}); +Object.defineProperty(exports, 'defaults', { + enumerable: true, + get: function () { + return _Defaults.default; + } +}); +Object.defineProperty(exports, 'descriptions', { + enumerable: true, + get: function () { + return _Descriptions.default; + } +}); +exports.constants = void 0; + +function path() { + const data = _interopRequireWildcard(require('path')); + + path = function () { + return data; + }; + + return data; +} + +function fs() { + const data = _interopRequireWildcard(require('graceful-fs')); + + fs = function () { + return data; + }; + + return data; +} + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +function _realpathNative() { + const data = require('realpath-native'); + + _realpathNative = function () { + return data; + }; + + return data; +} + +var _utils = require('./utils'); + +var _normalize = _interopRequireDefault(require('./normalize')); + +var _resolveConfigPath = _interopRequireDefault(require('./resolveConfigPath')); + +var _readConfigFileAndSetRootDir = _interopRequireDefault( + require('./readConfigFileAndSetRootDir') +); + +var _Deprecated = _interopRequireDefault(require('./Deprecated')); + +var _Defaults = _interopRequireDefault(require('./Defaults')); + +var _Descriptions = _interopRequireDefault(require('./Descriptions')); + +var constants = _interopRequireWildcard(require('./constants')); + +exports.constants = constants; + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +async function readConfig( + argv, + packageRootOrConfig, // Whether it needs to look into `--config` arg passed to CLI. + // It only used to read initial config. If the initial config contains + // `project` property, we don't want to read `--config` value and rather + // read individual configs for every project. + skipArgvConfigOption, + parentConfigPath, + projectIndex = Infinity +) { + let rawOptions; + let configPath = null; + + if (typeof packageRootOrConfig !== 'string') { + if (parentConfigPath) { + const parentConfigDirname = path().dirname(parentConfigPath); + rawOptions = packageRootOrConfig; + rawOptions.rootDir = rawOptions.rootDir + ? (0, _utils.replaceRootDirInPath)( + parentConfigDirname, + rawOptions.rootDir + ) + : parentConfigDirname; + } else { + throw new Error( + 'Jest: Cannot use configuration as an object without a file path.' + ); + } + } else if ((0, _utils.isJSONString)(argv.config)) { + // A JSON string was passed to `--config` argument and we can parse it + // and use as is. + let config; + + try { + config = JSON.parse(argv.config); + } catch (e) { + throw new Error( + 'There was an error while parsing the `--config` argument as a JSON string.' + ); + } // NOTE: we might need to resolve this dir to an absolute path in the future + + config.rootDir = config.rootDir || packageRootOrConfig; + rawOptions = config; // A string passed to `--config`, which is either a direct path to the config + // or a path to directory containing `package.json` or `jest.config.js` + } else if (!skipArgvConfigOption && typeof argv.config == 'string') { + configPath = (0, _resolveConfigPath.default)(argv.config, process.cwd()); + rawOptions = await (0, _readConfigFileAndSetRootDir.default)(configPath); + } else { + // Otherwise just try to find config in the current rootDir. + configPath = (0, _resolveConfigPath.default)( + packageRootOrConfig, + process.cwd() + ); + rawOptions = await (0, _readConfigFileAndSetRootDir.default)(configPath); + } + + const {options, hasDeprecationWarnings} = (0, _normalize.default)( + rawOptions, + argv, + configPath, + projectIndex + ); + const {globalConfig, projectConfig} = groupOptions(options); + return { + configPath, + globalConfig, + hasDeprecationWarnings, + projectConfig + }; +} + +const groupOptions = options => ({ + globalConfig: Object.freeze({ + bail: options.bail, + changedFilesWithAncestor: options.changedFilesWithAncestor, + changedSince: options.changedSince, + collectCoverage: options.collectCoverage, + collectCoverageFrom: options.collectCoverageFrom, + collectCoverageOnlyFrom: options.collectCoverageOnlyFrom, + coverageDirectory: options.coverageDirectory, + coverageProvider: options.coverageProvider, + coverageReporters: options.coverageReporters, + coverageThreshold: options.coverageThreshold, + detectLeaks: options.detectLeaks, + detectOpenHandles: options.detectOpenHandles, + enabledTestsMap: options.enabledTestsMap, + errorOnDeprecated: options.errorOnDeprecated, + expand: options.expand, + filter: options.filter, + findRelatedTests: options.findRelatedTests, + forceExit: options.forceExit, + globalSetup: options.globalSetup, + globalTeardown: options.globalTeardown, + json: options.json, + lastCommit: options.lastCommit, + listTests: options.listTests, + logHeapUsage: options.logHeapUsage, + maxConcurrency: options.maxConcurrency, + maxWorkers: options.maxWorkers, + noSCM: undefined, + noStackTrace: options.noStackTrace, + nonFlagArgs: options.nonFlagArgs, + notify: options.notify, + notifyMode: options.notifyMode, + onlyChanged: options.onlyChanged, + onlyFailures: options.onlyFailures, + outputFile: options.outputFile, + passWithNoTests: options.passWithNoTests, + projects: options.projects, + replname: options.replname, + reporters: options.reporters, + rootDir: options.rootDir, + runTestsByPath: options.runTestsByPath, + silent: options.silent, + skipFilter: options.skipFilter, + testFailureExitCode: options.testFailureExitCode, + testNamePattern: options.testNamePattern, + testPathPattern: options.testPathPattern, + testResultsProcessor: options.testResultsProcessor, + testSequencer: options.testSequencer, + testTimeout: options.testTimeout, + updateSnapshot: options.updateSnapshot, + useStderr: options.useStderr, + verbose: options.verbose, + watch: options.watch, + watchAll: options.watchAll, + watchPlugins: options.watchPlugins, + watchman: options.watchman + }), + projectConfig: Object.freeze({ + automock: options.automock, + browser: options.browser, + cache: options.cache, + cacheDirectory: options.cacheDirectory, + clearMocks: options.clearMocks, + coveragePathIgnorePatterns: options.coveragePathIgnorePatterns, + cwd: options.cwd, + dependencyExtractor: options.dependencyExtractor, + detectLeaks: options.detectLeaks, + detectOpenHandles: options.detectOpenHandles, + displayName: options.displayName, + errorOnDeprecated: options.errorOnDeprecated, + extraGlobals: options.extraGlobals, + filter: options.filter, + forceCoverageMatch: options.forceCoverageMatch, + globalSetup: options.globalSetup, + globalTeardown: options.globalTeardown, + globals: options.globals, + haste: options.haste, + moduleDirectories: options.moduleDirectories, + moduleFileExtensions: options.moduleFileExtensions, + moduleLoader: options.moduleLoader, + moduleNameMapper: options.moduleNameMapper, + modulePathIgnorePatterns: options.modulePathIgnorePatterns, + modulePaths: options.modulePaths, + name: options.name, + prettierPath: options.prettierPath, + resetMocks: options.resetMocks, + resetModules: options.resetModules, + resolver: options.resolver, + restoreMocks: options.restoreMocks, + rootDir: options.rootDir, + roots: options.roots, + runner: options.runner, + setupFiles: options.setupFiles, + setupFilesAfterEnv: options.setupFilesAfterEnv, + skipFilter: options.skipFilter, + skipNodeResolution: options.skipNodeResolution, + snapshotResolver: options.snapshotResolver, + snapshotSerializers: options.snapshotSerializers, + testEnvironment: options.testEnvironment, + testEnvironmentOptions: options.testEnvironmentOptions, + testLocationInResults: options.testLocationInResults, + testMatch: options.testMatch, + testPathIgnorePatterns: options.testPathIgnorePatterns, + testRegex: options.testRegex, + testRunner: options.testRunner, + testURL: options.testURL, + timers: options.timers, + transform: options.transform, + transformIgnorePatterns: options.transformIgnorePatterns, + unmockedModulePathPatterns: options.unmockedModulePathPatterns, + watchPathIgnorePatterns: options.watchPathIgnorePatterns + }) +}); + +const ensureNoDuplicateConfigs = (parsedConfigs, projects) => { + if (projects.length <= 1) { + return; + } + + const configPathMap = new Map(); + + for (const config of parsedConfigs) { + const {configPath} = config; + + if (configPathMap.has(configPath)) { + const message = `Whoops! Two projects resolved to the same config path: ${_chalk().default.bold( + String(configPath) + )}: + + Project 1: ${_chalk().default.bold( + projects[parsedConfigs.findIndex(x => x === config)] + )} + Project 2: ${_chalk().default.bold( + projects[parsedConfigs.findIndex(x => x === configPathMap.get(configPath))] + )} + +This usually means that your ${_chalk().default.bold( + '"projects"' + )} config includes a directory that doesn't have any configuration recognizable by Jest. Please fix it. +`; + throw new Error(message); + } + + if (configPath !== null) { + configPathMap.set(configPath, config); + } + } +}; // Possible scenarios: +// 1. jest --config config.json +// 2. jest --projects p1 p2 +// 3. jest --projects p1 p2 --config config.json +// 4. jest --projects p1 +// 5. jest +// +// If no projects are specified, process.cwd() will be used as the default +// (and only) project. + +async function readConfigs(argv, projectPaths) { + let globalConfig; + let hasDeprecationWarnings; + let configs = []; + let projects = projectPaths; + let configPath; + + if (projectPaths.length === 1) { + const parsedConfig = await readConfig(argv, projects[0]); + configPath = parsedConfig.configPath; + hasDeprecationWarnings = parsedConfig.hasDeprecationWarnings; + globalConfig = parsedConfig.globalConfig; + configs = [parsedConfig.projectConfig]; + + if (globalConfig.projects && globalConfig.projects.length) { + // Even though we had one project in CLI args, there might be more + // projects defined in the config. + // In other words, if this was a single project, + // and its config has `projects` settings, use that value instead. + projects = globalConfig.projects; + } + } + + if (projects.length > 0) { + const projectIsCwd = + process.platform === 'win32' + ? projects[0] === (0, _realpathNative().sync)(process.cwd()) + : projects[0] === process.cwd(); + const parsedConfigs = await Promise.all( + projects + .filter(root => { + // Ignore globbed files that cannot be `require`d. + if ( + typeof root === 'string' && + fs().existsSync(root) && + !fs().lstatSync(root).isDirectory() && + !constants.JEST_CONFIG_EXT_ORDER.some(ext => root.endsWith(ext)) + ) { + return false; + } + + return true; + }) + .map((root, projectIndex) => { + const projectIsTheOnlyProject = + projectIndex === 0 && projects.length === 1; + const skipArgvConfigOption = !( + projectIsTheOnlyProject && projectIsCwd + ); + return readConfig( + argv, + root, + skipArgvConfigOption, + configPath, + projectIndex + ); + }) + ); + ensureNoDuplicateConfigs(parsedConfigs, projects); + configs = parsedConfigs.map(({projectConfig}) => projectConfig); + + if (!hasDeprecationWarnings) { + hasDeprecationWarnings = parsedConfigs.some( + ({hasDeprecationWarnings}) => !!hasDeprecationWarnings + ); + } // If no config was passed initially, use the one from the first project + + if (!globalConfig) { + globalConfig = parsedConfigs[0].globalConfig; + } + } + + if (!globalConfig || !configs.length) { + throw new Error('jest: No configuration found for any project.'); + } + + return { + configs, + globalConfig, + hasDeprecationWarnings: !!hasDeprecationWarnings + }; +} diff --git a/node_modules/@jest/core/node_modules/jest-config/build/normalize.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/normalize.d.ts new file mode 100644 index 000000000..fc939e63d --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/normalize.d.ts @@ -0,0 +1,13 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +declare type AllOptions = Config.ProjectConfig & Config.GlobalConfig; +export default function normalize(initialOptions: Config.InitialOptions, argv: Config.Argv, configPath?: Config.Path | null, projectIndex?: number): { + hasDeprecationWarnings: boolean; + options: AllOptions; +}; +export {}; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/normalize.js b/node_modules/@jest/core/node_modules/jest-config/build/normalize.js new file mode 100644 index 000000000..f4e48f20f --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/normalize.js @@ -0,0 +1,1260 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = normalize; + +function _crypto() { + const data = require('crypto'); + + _crypto = function () { + return data; + }; + + return data; +} + +function path() { + const data = _interopRequireWildcard(require('path')); + + path = function () { + return data; + }; + + return data; +} + +function _gracefulFs() { + const data = require('graceful-fs'); + + _gracefulFs = function () { + return data; + }; + + return data; +} + +function _glob() { + const data = require('glob'); + + _glob = function () { + return data; + }; + + return data; +} + +function _jestValidate() { + const data = require('jest-validate'); + + _jestValidate = function () { + return data; + }; + + return data; +} + +function _jestUtil() { + const data = require('jest-util'); + + _jestUtil = function () { + return data; + }; + + return data; +} + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +function _micromatch() { + const data = _interopRequireDefault(require('micromatch')); + + _micromatch = function () { + return data; + }; + + return data; +} + +function _realpathNative() { + const data = require('realpath-native'); + + _realpathNative = function () { + return data; + }; + + return data; +} + +function _jestResolve() { + const data = _interopRequireDefault(require('jest-resolve')); + + _jestResolve = function () { + return data; + }; + + return data; +} + +function _jestRegexUtil() { + const data = require('jest-regex-util'); + + _jestRegexUtil = function () { + return data; + }; + + return data; +} + +function _deepmerge() { + const data = _interopRequireDefault(require('deepmerge')); + + _deepmerge = function () { + return data; + }; + + return data; +} + +var _validatePattern = _interopRequireDefault(require('./validatePattern')); + +var _getMaxWorkers = _interopRequireDefault(require('./getMaxWorkers')); + +var _utils = require('./utils'); + +var _constants = require('./constants'); + +var _ReporterValidationErrors = require('./ReporterValidationErrors'); + +var _Defaults = _interopRequireDefault(require('./Defaults')); + +var _Deprecated = _interopRequireDefault(require('./Deprecated')); + +var _setFromArgv = _interopRequireDefault(require('./setFromArgv')); + +var _ValidConfig = _interopRequireDefault(require('./ValidConfig')); + +var _color = require('./color'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const ERROR = `${_utils.BULLET}Validation Error`; +const PRESET_EXTENSIONS = ['.json', '.js']; +const PRESET_NAME = 'jest-preset'; + +const createConfigError = message => + new (_jestValidate().ValidationError)( + ERROR, + message, + _utils.DOCUMENTATION_NOTE + ); + +function verifyDirectoryExists(path, key) { + try { + const rootStat = (0, _gracefulFs().statSync)(path); + + if (!rootStat.isDirectory()) { + throw createConfigError( + ` ${_chalk().default.bold(path)} in the ${_chalk().default.bold( + key + )} option is not a directory.` + ); + } + } catch (err) { + if (err instanceof _jestValidate().ValidationError) { + throw err; + } + + if (err.code === 'ENOENT') { + throw createConfigError( + ` Directory ${_chalk().default.bold( + path + )} in the ${_chalk().default.bold(key)} option was not found.` + ); + } // Not sure in which cases `statSync` can throw, so let's just show the underlying error to the user + + throw createConfigError( + ` Got an error trying to find ${_chalk().default.bold( + path + )} in the ${_chalk().default.bold(key)} option.\n\n Error was: ${ + err.message + }` + ); + } +} // TS 3.5 forces us to split these into 2 + +const mergeModuleNameMapperWithPreset = (options, preset) => { + if (options['moduleNameMapper'] && preset['moduleNameMapper']) { + options['moduleNameMapper'] = { + ...options['moduleNameMapper'], + ...preset['moduleNameMapper'], + ...options['moduleNameMapper'] + }; + } +}; + +const mergeTransformWithPreset = (options, preset) => { + if (options['transform'] && preset['transform']) { + options['transform'] = { + ...options['transform'], + ...preset['transform'], + ...options['transform'] + }; + } +}; + +const mergeGlobalsWithPreset = (options, preset) => { + if (options['globals'] && preset['globals']) { + options['globals'] = (0, _deepmerge().default)( + preset['globals'], + options['globals'] + ); + } +}; + +const setupPreset = (options, optionsPreset) => { + let preset; + const presetPath = (0, _utils.replaceRootDirInPath)( + options.rootDir, + optionsPreset + ); + + const presetModule = _jestResolve().default.findNodeModule( + presetPath.startsWith('.') + ? presetPath + : path().join(presetPath, PRESET_NAME), + { + basedir: options.rootDir, + extensions: PRESET_EXTENSIONS + } + ); + + try { + // Force re-evaluation to support multiple projects + try { + if (presetModule) { + delete require.cache[require.resolve(presetModule)]; + } + } catch (e) {} // @ts-ignore: `presetModule` can be null? + + preset = require(presetModule); + } catch (error) { + if (error instanceof SyntaxError || error instanceof TypeError) { + throw createConfigError( + ` Preset ${_chalk().default.bold(presetPath)} is invalid:\n\n ${ + error.message + }\n ${error.stack}` + ); + } + + if (error.message.includes('Cannot find module')) { + if (error.message.includes(presetPath)) { + const preset = _jestResolve().default.findNodeModule(presetPath, { + basedir: options.rootDir + }); + + if (preset) { + throw createConfigError( + ` Module ${_chalk().default.bold( + presetPath + )} should have "jest-preset.js" or "jest-preset.json" file at the root.` + ); + } + + throw createConfigError( + ` Preset ${_chalk().default.bold(presetPath)} not found.` + ); + } + + throw createConfigError( + ` Missing dependency in ${_chalk().default.bold(presetPath)}:\n\n ${ + error.message + }\n ${error.stack}` + ); + } + + throw createConfigError( + ` An unknown error occurred in ${_chalk().default.bold( + presetPath + )}:\n\n ${error.message}\n ${error.stack}` + ); + } + + if (options.setupFiles) { + options.setupFiles = (preset.setupFiles || []).concat(options.setupFiles); + } + + if (options.setupFilesAfterEnv) { + options.setupFilesAfterEnv = (preset.setupFilesAfterEnv || []).concat( + options.setupFilesAfterEnv + ); + } + + if (options.modulePathIgnorePatterns && preset.modulePathIgnorePatterns) { + options.modulePathIgnorePatterns = preset.modulePathIgnorePatterns.concat( + options.modulePathIgnorePatterns + ); + } + + mergeModuleNameMapperWithPreset(options, preset); + mergeTransformWithPreset(options, preset); + mergeGlobalsWithPreset(options, preset); + return {...preset, ...options}; +}; + +const setupBabelJest = options => { + const transform = options.transform; + let babelJest; + + if (transform) { + const customJSPattern = Object.keys(transform).find(pattern => { + const regex = new RegExp(pattern); + return regex.test('a.js') || regex.test('a.jsx'); + }); + const customTSPattern = Object.keys(transform).find(pattern => { + const regex = new RegExp(pattern); + return regex.test('a.ts') || regex.test('a.tsx'); + }); + [customJSPattern, customTSPattern].forEach(pattern => { + if (pattern) { + const customTransformer = transform[pattern]; + + if (Array.isArray(customTransformer)) { + if (customTransformer[0] === 'babel-jest') { + babelJest = require.resolve('babel-jest'); + customTransformer[0] = babelJest; + } else if (customTransformer[0].includes('babel-jest')) { + babelJest = customTransformer[0]; + } + } else { + if (customTransformer === 'babel-jest') { + babelJest = require.resolve('babel-jest'); + transform[pattern] = babelJest; + } else if (customTransformer.includes('babel-jest')) { + babelJest = customTransformer; + } + } + } + }); + } else { + babelJest = require.resolve('babel-jest'); + options.transform = { + [_constants.DEFAULT_JS_PATTERN]: babelJest + }; + } +}; + +const normalizeCollectCoverageOnlyFrom = (options, key) => { + const initialCollectCoverageFrom = options[key]; + const collectCoverageOnlyFrom = Array.isArray(initialCollectCoverageFrom) + ? initialCollectCoverageFrom // passed from argv + : Object.keys(initialCollectCoverageFrom); // passed from options + + return collectCoverageOnlyFrom.reduce((map, filePath) => { + filePath = path().resolve( + options.rootDir, + (0, _utils.replaceRootDirInPath)(options.rootDir, filePath) + ); + map[filePath] = true; + return map; + }, Object.create(null)); +}; + +const normalizeCollectCoverageFrom = (options, key) => { + const initialCollectCoverageFrom = options[key]; + let value; + + if (!initialCollectCoverageFrom) { + value = []; + } + + if (!Array.isArray(initialCollectCoverageFrom)) { + try { + value = JSON.parse(initialCollectCoverageFrom); + } catch (e) {} + + if (options[key] && !Array.isArray(value)) { + value = [initialCollectCoverageFrom]; + } + } else { + value = initialCollectCoverageFrom; + } + + if (value) { + value = value.map(filePath => + filePath.replace(/^(!?)(\/)(.*)/, '$1$3') + ); + } + + return value; +}; + +const normalizeUnmockedModulePathPatterns = ( + options, + key // _replaceRootDirTags is specifically well-suited for substituting +) => + // in paths (it deals with properly interpreting relative path + // separators, etc). + // + // For patterns, direct global substitution is far more ideal, so we + // special case substitutions for patterns here. + options[key].map(pattern => + (0, _jestRegexUtil().replacePathSepForRegex)( + pattern.replace(//g, options.rootDir) + ) + ); + +const normalizePreprocessor = options => { + if (options.scriptPreprocessor && options.transform) { + throw createConfigError(` Options: ${_chalk().default.bold( + 'scriptPreprocessor' + )} and ${_chalk().default.bold('transform')} cannot be used together. + Please change your configuration to only use ${_chalk().default.bold( + 'transform' + )}.`); + } + + if (options.preprocessorIgnorePatterns && options.transformIgnorePatterns) { + throw createConfigError(` Options ${_chalk().default.bold( + 'preprocessorIgnorePatterns' + )} and ${_chalk().default.bold( + 'transformIgnorePatterns' + )} cannot be used together. + Please change your configuration to only use ${_chalk().default.bold( + 'transformIgnorePatterns' + )}.`); + } + + if (options.scriptPreprocessor) { + options.transform = { + '.*': options.scriptPreprocessor + }; + } + + if (options.preprocessorIgnorePatterns) { + options.transformIgnorePatterns = options.preprocessorIgnorePatterns; + } + + delete options.scriptPreprocessor; + delete options.preprocessorIgnorePatterns; + return options; +}; + +const normalizeMissingOptions = (options, configPath, projectIndex) => { + if (!options.name) { + options.name = (0, _crypto().createHash)('md5') + .update(options.rootDir) // In case we load config from some path that has the same root dir + .update(configPath || '') + .update(String(projectIndex)) + .digest('hex'); + } + + if (!options.setupFiles) { + options.setupFiles = []; + } + + return options; +}; + +const normalizeRootDir = options => { + // Assert that there *is* a rootDir + if (!options.rootDir) { + throw createConfigError( + ` Configuration option ${_chalk().default.bold( + 'rootDir' + )} must be specified.` + ); + } + + options.rootDir = path().normalize(options.rootDir); + + try { + // try to resolve windows short paths, ignoring errors (permission errors, mostly) + options.rootDir = (0, _realpathNative().sync)(options.rootDir); + } catch (e) { + // ignored + } + + verifyDirectoryExists(options.rootDir, 'rootDir'); + return {...options, rootDir: options.rootDir}; +}; + +const normalizeReporters = options => { + const reporters = options.reporters; + + if (!reporters || !Array.isArray(reporters)) { + return options; + } + + (0, _ReporterValidationErrors.validateReporters)(reporters); + options.reporters = reporters.map(reporterConfig => { + const normalizedReporterConfig = + typeof reporterConfig === 'string' // if reporter config is a string, we wrap it in an array + ? // and pass an empty object for options argument, to normalize + // the shape. + [reporterConfig, {}] + : reporterConfig; + const reporterPath = (0, _utils.replaceRootDirInPath)( + options.rootDir, + normalizedReporterConfig[0] + ); + + if (reporterPath !== _constants.DEFAULT_REPORTER_LABEL) { + const reporter = _jestResolve().default.findNodeModule(reporterPath, { + basedir: options.rootDir + }); + + if (!reporter) { + throw new (_jestResolve().default.ModuleNotFoundError)( + `Could not resolve a module for a custom reporter.\n` + + ` Module name: ${reporterPath}` + ); + } + + normalizedReporterConfig[0] = reporter; + } + + return normalizedReporterConfig; + }); + return options; +}; + +const buildTestPathPattern = argv => { + const patterns = []; + + if (argv._) { + patterns.push(...argv._); + } + + if (argv.testPathPattern) { + patterns.push(...argv.testPathPattern); + } + + const replacePosixSep = pattern => { + // yargs coerces positional args into numbers + const patternAsString = pattern.toString(); + + if (path().sep === '/') { + return patternAsString; + } + + return patternAsString.replace(/\//g, '\\\\'); + }; + + const testPathPattern = patterns.map(replacePosixSep).join('|'); + + if ((0, _validatePattern.default)(testPathPattern)) { + return testPathPattern; + } else { + showTestPathPatternError(testPathPattern); + return ''; + } +}; + +const showTestPathPatternError = testPathPattern => { + (0, _jestUtil().clearLine)(process.stdout); + console.log( + _chalk().default.red( + ` Invalid testPattern ${testPathPattern} supplied. ` + + `Running all tests instead.` + ) + ); +}; + +function normalize(initialOptions, argv, configPath, projectIndex = Infinity) { + const {hasDeprecationWarnings} = (0, _jestValidate().validate)( + initialOptions, + { + comment: _utils.DOCUMENTATION_NOTE, + deprecatedConfig: _Deprecated.default, + exampleConfig: _ValidConfig.default, + recursiveBlacklist: [ + 'collectCoverageOnlyFrom', // 'coverageThreshold' allows to use 'global' and glob strings on the same + // level, there's currently no way we can deal with such config + 'coverageThreshold', + 'globals', + 'moduleNameMapper', + 'testEnvironmentOptions', + 'transform' + ] + } + ); + let options = normalizePreprocessor( + normalizeReporters( + normalizeMissingOptions( + normalizeRootDir((0, _setFromArgv.default)(initialOptions, argv)), + configPath, + projectIndex + ) + ) + ); + + if (options.preset) { + options = setupPreset(options, options.preset); + } + + if (!options.setupFilesAfterEnv) { + options.setupFilesAfterEnv = []; + } + + if ( + options.setupTestFrameworkScriptFile && + options.setupFilesAfterEnv.length > 0 + ) { + throw createConfigError(` Options: ${_chalk().default.bold( + 'setupTestFrameworkScriptFile' + )} and ${_chalk().default.bold( + 'setupFilesAfterEnv' + )} cannot be used together. + Please change your configuration to only use ${_chalk().default.bold( + 'setupFilesAfterEnv' + )}.`); + } + + if (options.setupTestFrameworkScriptFile) { + options.setupFilesAfterEnv.push(options.setupTestFrameworkScriptFile); + } + + options.testEnvironment = (0, _utils.getTestEnvironment)({ + rootDir: options.rootDir, + testEnvironment: + options.testEnvironment || _Defaults.default.testEnvironment + }); + + if (!options.roots && options.testPathDirs) { + options.roots = options.testPathDirs; + delete options.testPathDirs; + } + + if (!options.roots) { + options.roots = [options.rootDir]; + } + + if (!options.testRunner || options.testRunner === 'jasmine2') { + options.testRunner = require.resolve('jest-jasmine2'); + } + + if (!options.coverageDirectory) { + options.coverageDirectory = path().resolve(options.rootDir, 'coverage'); + } + + setupBabelJest(options); // TODO: Type this properly + + const newOptions = {..._Defaults.default}; + + if (options.resolver) { + newOptions.resolver = (0, _utils.resolve)(null, { + filePath: options.resolver, + key: 'resolver', + rootDir: options.rootDir + }); + } + + const optionKeys = Object.keys(options); + optionKeys.reduce((newOptions, key) => { + // The resolver has been resolved separately; skip it + if (key === 'resolver') { + return newOptions; + } // This is cheating, because it claims that all keys of InitialOptions are Required. + // We only really know it's Required for oldOptions[key], not for oldOptions.someOtherKey, + // so oldOptions[key] is the only way it should be used. + + const oldOptions = options; + let value; + + switch (key) { + case 'collectCoverageOnlyFrom': + value = normalizeCollectCoverageOnlyFrom(oldOptions, key); + break; + + case 'setupFiles': + case 'setupFilesAfterEnv': + case 'snapshotSerializers': + { + const option = oldOptions[key]; + value = + option && + option.map(filePath => + (0, _utils.resolve)(newOptions.resolver, { + filePath, + key, + rootDir: options.rootDir + }) + ); + } + break; + + case 'modulePaths': + case 'roots': + { + const option = oldOptions[key]; + value = + option && + option.map(filePath => + path().resolve( + options.rootDir, + (0, _utils.replaceRootDirInPath)(options.rootDir, filePath) + ) + ); + } + break; + + case 'collectCoverageFrom': + value = normalizeCollectCoverageFrom(oldOptions, key); + break; + + case 'cacheDirectory': + case 'coverageDirectory': + { + const option = oldOptions[key]; + value = + option && + path().resolve( + options.rootDir, + (0, _utils.replaceRootDirInPath)(options.rootDir, option) + ); + } + break; + + case 'dependencyExtractor': + case 'globalSetup': + case 'globalTeardown': + case 'moduleLoader': + case 'snapshotResolver': + case 'testResultsProcessor': + case 'testRunner': + case 'filter': + { + const option = oldOptions[key]; + value = + option && + (0, _utils.resolve)(newOptions.resolver, { + filePath: option, + key, + rootDir: options.rootDir + }); + } + break; + + case 'runner': + { + const option = oldOptions[key]; + value = + option && + (0, _utils.getRunner)(newOptions.resolver, { + filePath: option, + rootDir: options.rootDir + }); + } + break; + + case 'prettierPath': + { + // We only want this to throw if "prettierPath" is explicitly passed + // from config or CLI, and the requested path isn't found. Otherwise we + // set it to null and throw an error lazily when it is used. + const option = oldOptions[key]; + value = + option && + (0, _utils.resolve)(newOptions.resolver, { + filePath: option, + key, + optional: option === _Defaults.default[key], + rootDir: options.rootDir + }); + } + break; + + case 'moduleNameMapper': + const moduleNameMapper = oldOptions[key]; + value = + moduleNameMapper && + Object.keys(moduleNameMapper).map(regex => { + const item = moduleNameMapper && moduleNameMapper[regex]; + return ( + item && [ + regex, + (0, _utils._replaceRootDirTags)(options.rootDir, item) + ] + ); + }); + break; + + case 'transform': + const transform = oldOptions[key]; + value = + transform && + Object.keys(transform).map(regex => { + const transformElement = transform[regex]; + return [ + regex, + (0, _utils.resolve)(newOptions.resolver, { + filePath: Array.isArray(transformElement) + ? transformElement[0] + : transformElement, + key, + rootDir: options.rootDir + }), + Array.isArray(transformElement) ? transformElement[1] : {} + ]; + }); + break; + + case 'coveragePathIgnorePatterns': + case 'modulePathIgnorePatterns': + case 'testPathIgnorePatterns': + case 'transformIgnorePatterns': + case 'watchPathIgnorePatterns': + case 'unmockedModulePathPatterns': + value = normalizeUnmockedModulePathPatterns(oldOptions, key); + break; + + case 'haste': + value = {...oldOptions[key]}; + + if (value.hasteImplModulePath != null) { + const resolvedHasteImpl = (0, _utils.resolve)(newOptions.resolver, { + filePath: (0, _utils.replaceRootDirInPath)( + options.rootDir, + value.hasteImplModulePath + ), + key: 'haste.hasteImplModulePath', + rootDir: options.rootDir + }); + value.hasteImplModulePath = resolvedHasteImpl || undefined; + } + + break; + + case 'projects': + value = (oldOptions[key] || []) + .map(project => + typeof project === 'string' + ? (0, _utils._replaceRootDirTags)(options.rootDir, project) + : project + ) + .reduce((projects, project) => { + // Project can be specified as globs. If a glob matches any files, + // We expand it to these paths. If not, we keep the original path + // for the future resolution. + const globMatches = + typeof project === 'string' ? (0, _glob().sync)(project) : []; + return projects.concat(globMatches.length ? globMatches : project); + }, []); + break; + + case 'moduleDirectories': + case 'testMatch': + { + const replacedRootDirTags = (0, _utils._replaceRootDirTags)( + (0, _utils.escapeGlobCharacters)(options.rootDir), + oldOptions[key] + ); + + if (replacedRootDirTags) { + value = Array.isArray(replacedRootDirTags) + ? replacedRootDirTags.map(_jestUtil().replacePathSepForGlob) + : (0, _jestUtil().replacePathSepForGlob)(replacedRootDirTags); + } else { + value = replacedRootDirTags; + } + } + break; + + case 'testRegex': + { + const option = oldOptions[key]; + value = option + ? (Array.isArray(option) ? option : [option]).map( + _jestRegexUtil().replacePathSepForRegex + ) + : []; + } + break; + + case 'moduleFileExtensions': { + value = oldOptions[key]; + + if ( + Array.isArray(value) && // If it's the wrong type, it can throw at a later time + (options.runner === undefined || + options.runner === _Defaults.default.runner) && // Only require 'js' for the default jest-runner + !value.includes('js') + ) { + const errorMessage = + ` moduleFileExtensions must include 'js':\n` + + ` but instead received:\n` + + ` ${_chalk().default.bold.red(JSON.stringify(value))}`; // If `js` is not included, any dependency Jest itself injects into + // the environment, like jasmine or sourcemap-support, will need to + // `require` its modules with a file extension. This is not plausible + // in the long run, so it's way easier to just fail hard early. + // We might consider throwing if `json` is missing as well, as it's a + // fair assumption from modules that they can do + // `require('some-package/package') without the trailing `.json` as it + // works in Node normally. + + throw createConfigError( + errorMessage + + "\n Please change your configuration to include 'js'." + ); + } + + break; + } + + case 'bail': { + const bail = oldOptions[key]; + + if (typeof bail === 'boolean') { + value = bail ? 1 : 0; + } else if (typeof bail === 'string') { + value = 1; // If Jest is invoked as `jest --bail someTestPattern` then need to + // move the pattern from the `bail` configuration and into `argv._` + // to be processed as an extra parameter + + argv._.push(bail); + } else { + value = oldOptions[key]; + } + + break; + } + + case 'displayName': { + const displayName = oldOptions[key]; + /** + * Ensuring that displayName shape is correct here so that the + * reporters can trust the shape of the data + */ + + if (typeof displayName === 'object') { + const {name, color} = displayName; + + if ( + !name || + !color || + typeof name !== 'string' || + typeof color !== 'string' + ) { + const errorMessage = + ` Option "${_chalk().default.bold( + 'displayName' + )}" must be of type:\n\n` + + ' {\n' + + ' name: string;\n' + + ' color: string;\n' + + ' }\n'; + throw createConfigError(errorMessage); + } + + value = oldOptions[key]; + } else { + value = { + color: (0, _color.getDisplayNameColor)(options.runner), + name: displayName + }; + } + + break; + } + + case 'testTimeout': { + if (oldOptions[key] < 0) { + throw createConfigError( + ` Option "${_chalk().default.bold( + 'testTimeout' + )}" must be a natural number.` + ); + } + + value = oldOptions[key]; + break; + } + + case 'automock': + case 'browser': + case 'cache': + case 'changedSince': + case 'changedFilesWithAncestor': + case 'clearMocks': + case 'collectCoverage': + case 'coverageProvider': + case 'coverageReporters': + case 'coverageThreshold': + case 'detectLeaks': + case 'detectOpenHandles': + case 'errorOnDeprecated': + case 'expand': + case 'extraGlobals': + case 'globals': + case 'findRelatedTests': + case 'forceCoverageMatch': + case 'forceExit': + case 'lastCommit': + case 'listTests': + case 'logHeapUsage': + case 'maxConcurrency': + case 'mapCoverage': + case 'name': + case 'noStackTrace': + case 'notify': + case 'notifyMode': + case 'onlyChanged': + case 'outputFile': + case 'passWithNoTests': + case 'replname': + case 'reporters': + case 'resetMocks': + case 'resetModules': + case 'restoreMocks': + case 'rootDir': + case 'runTestsByPath': + case 'silent': + case 'skipFilter': + case 'skipNodeResolution': + case 'testEnvironment': + case 'testEnvironmentOptions': + case 'testFailureExitCode': + case 'testLocationInResults': + case 'testNamePattern': + case 'testURL': + case 'timers': + case 'useStderr': + case 'verbose': + case 'watch': + case 'watchAll': + case 'watchman': + value = oldOptions[key]; + break; + + case 'watchPlugins': + value = (oldOptions[key] || []).map(watchPlugin => { + if (typeof watchPlugin === 'string') { + return { + config: {}, + path: (0, _utils.getWatchPlugin)(newOptions.resolver, { + filePath: watchPlugin, + rootDir: options.rootDir + }) + }; + } else { + return { + config: watchPlugin[1] || {}, + path: (0, _utils.getWatchPlugin)(newOptions.resolver, { + filePath: watchPlugin[0], + rootDir: options.rootDir + }) + }; + } + }); + break; + } // @ts-ignore: automock is missing in GlobalConfig, so what + + newOptions[key] = value; + return newOptions; + }, newOptions); + newOptions.roots.forEach((root, i) => { + verifyDirectoryExists(root, `roots[${i}]`); + }); + + try { + // try to resolve windows short paths, ignoring errors (permission errors, mostly) + newOptions.cwd = (0, _realpathNative().sync)(process.cwd()); + } catch (e) { + // ignored + } + + newOptions.testSequencer = (0, _utils.getSequencer)(newOptions.resolver, { + filePath: options.testSequencer || _Defaults.default.testSequencer, + rootDir: options.rootDir + }); + newOptions.nonFlagArgs = argv._; + newOptions.testPathPattern = buildTestPathPattern(argv); + newOptions.json = !!argv.json; + newOptions.testFailureExitCode = parseInt(newOptions.testFailureExitCode, 10); + + if ( + newOptions.lastCommit || + newOptions.changedFilesWithAncestor || + newOptions.changedSince + ) { + newOptions.onlyChanged = true; + } + + if (argv.all) { + newOptions.onlyChanged = false; + } else if (newOptions.testPathPattern) { + // When passing a test path pattern we don't want to only monitor changed + // files unless `--watch` is also passed. + newOptions.onlyChanged = newOptions.watch; + } + + if (!newOptions.onlyChanged) { + newOptions.onlyChanged = false; + } + + if (!newOptions.lastCommit) { + newOptions.lastCommit = false; + } + + if (!newOptions.onlyFailures) { + newOptions.onlyFailures = false; + } + + if (!newOptions.watchAll) { + newOptions.watchAll = false; + } // as any since it can happen. We really need to fix the types here + + if (newOptions.moduleNameMapper === _Defaults.default.moduleNameMapper) { + newOptions.moduleNameMapper = []; + } + + newOptions.updateSnapshot = + argv.ci && !argv.updateSnapshot + ? 'none' + : argv.updateSnapshot + ? 'all' + : 'new'; + newOptions.maxConcurrency = parseInt(newOptions.maxConcurrency, 10); + newOptions.maxWorkers = (0, _getMaxWorkers.default)(argv, options); + + if (newOptions.testRegex.length && options.testMatch) { + throw createConfigError( + ` Configuration options ${_chalk().default.bold('testMatch')} and` + + ` ${_chalk().default.bold('testRegex')} cannot be used together.` + ); + } + + if (newOptions.testRegex.length && !options.testMatch) { + // Prevent the default testMatch conflicting with any explicitly + // configured `testRegex` value + newOptions.testMatch = []; + } // If argv.json is set, coverageReporters shouldn't print a text report. + + if (argv.json) { + newOptions.coverageReporters = (newOptions.coverageReporters || []).filter( + reporter => reporter !== 'text' + ); + } // If collectCoverage is enabled while using --findRelatedTests we need to + // avoid having false negatives in the generated coverage report. + // The following: `--findRelatedTests '/rootDir/file1.js' --coverage` + // Is transformed to: `--findRelatedTests '/rootDir/file1.js' --coverage --collectCoverageFrom 'file1.js'` + // where arguments to `--collectCoverageFrom` should be globs (or relative + // paths to the rootDir) + + if (newOptions.collectCoverage && argv.findRelatedTests) { + let collectCoverageFrom = argv._.map(filename => { + filename = (0, _utils.replaceRootDirInPath)(options.rootDir, filename); + return path().isAbsolute(filename) + ? path().relative(options.rootDir, filename) + : filename; + }); // Don't override existing collectCoverageFrom options + + if (newOptions.collectCoverageFrom) { + collectCoverageFrom = collectCoverageFrom.reduce((patterns, filename) => { + if ( + (0, _micromatch().default)( + [ + (0, _jestUtil().replacePathSepForGlob)( + path().relative(options.rootDir, filename) + ) + ], + newOptions.collectCoverageFrom + ).length === 0 + ) { + return patterns; + } + + return [...patterns, filename]; + }, newOptions.collectCoverageFrom); + } + + newOptions.collectCoverageFrom = collectCoverageFrom; + } else if (!newOptions.collectCoverageFrom) { + newOptions.collectCoverageFrom = []; + } + + if (!newOptions.findRelatedTests) { + newOptions.findRelatedTests = false; + } + + if (!newOptions.projects) { + newOptions.projects = []; + } + + if (!newOptions.extraGlobals) { + newOptions.extraGlobals = []; + } + + if (!newOptions.forceExit) { + newOptions.forceExit = false; + } + + if (!newOptions.logHeapUsage) { + newOptions.logHeapUsage = false; + } + + return { + hasDeprecationWarnings, + options: newOptions + }; +} diff --git a/node_modules/@jest/core/node_modules/jest-config/build/readConfigFileAndSetRootDir.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/readConfigFileAndSetRootDir.d.ts new file mode 100644 index 000000000..0b5a48fb6 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/readConfigFileAndSetRootDir.d.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +export default function readConfigFileAndSetRootDir(configPath: Config.Path): Promise; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/readConfigFileAndSetRootDir.js b/node_modules/@jest/core/node_modules/jest-config/build/readConfigFileAndSetRootDir.js new file mode 100644 index 000000000..bd1f5f928 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/readConfigFileAndSetRootDir.js @@ -0,0 +1,157 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = readConfigFileAndSetRootDir; + +function path() { + const data = _interopRequireWildcard(require('path')); + + path = function () { + return data; + }; + + return data; +} + +function fs() { + const data = _interopRequireWildcard(require('graceful-fs')); + + fs = function () { + return data; + }; + + return data; +} + +var _jsonlint = _interopRequireDefault(require('./vendor/jsonlint')); + +var _constants = require('./constants'); + +function _importEsm() { + const data = _interopRequireDefault(require('./importEsm')); + + _importEsm = function () { + return data; + }; + + return data; +} + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// @ts-ignore: vendored +// Read the configuration and set its `rootDir` +// 1. If it's a `package.json` file, we look into its "jest" property +// 2. For any other file, we just require it. If we receive an 'ERR_REQUIRE_ESM' +// from node, perform a dynamic import instead. +async function readConfigFileAndSetRootDir(configPath) { + const isJSON = configPath.endsWith(_constants.JEST_CONFIG_EXT_JSON); + let configObject; + + try { + configObject = require(configPath); + } catch (error) { + if (error.code === 'ERR_REQUIRE_ESM') { + try { + const importedConfig = await (0, _importEsm().default)(configPath); + + if (!importedConfig.default) { + throw new Error( + `Jest: Failed to load mjs config file ${configPath} - did you use a default export?` + ); + } + + configObject = importedConfig.default; + } catch (innerError) { + if (innerError.message === 'Not supported') { + throw new Error( + `Jest: Your version of Node does not support dynamic import - please enable it or use a .cjs file extension for file ${configPath}` + ); + } + + throw innerError; + } + } else if (isJSON) { + throw new Error( + `Jest: Failed to parse config file ${configPath}\n` + + ` ${_jsonlint.default.errors(fs().readFileSync(configPath, 'utf8'))}` + ); + } else { + throw error; + } + } + + if (configPath.endsWith(_constants.PACKAGE_JSON)) { + // Event if there's no "jest" property in package.json we will still use + // an empty object. + configObject = configObject.jest || {}; + } + + if (configObject.rootDir) { + // We don't touch it if it has an absolute path specified + if (!path().isAbsolute(configObject.rootDir)) { + // otherwise, we'll resolve it relative to the file's __dirname + configObject.rootDir = path().resolve( + path().dirname(configPath), + configObject.rootDir + ); + } + } else { + // If rootDir is not there, we'll set it to this file's __dirname + configObject.rootDir = path().dirname(configPath); + } + + return configObject; +} diff --git a/node_modules/@jest/core/node_modules/jest-config/build/resolveConfigPath.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/resolveConfigPath.d.ts new file mode 100644 index 000000000..4dfebc97c --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/resolveConfigPath.d.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +declare const _default: (pathToResolve: string, cwd: string) => string; +export default _default; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/resolveConfigPath.js b/node_modules/@jest/core/node_modules/jest-config/build/resolveConfigPath.js new file mode 100644 index 000000000..9896ee9b9 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/resolveConfigPath.js @@ -0,0 +1,153 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +function path() { + const data = _interopRequireWildcard(require('path')); + + path = function () { + return data; + }; + + return data; +} + +function fs() { + const data = _interopRequireWildcard(require('graceful-fs')); + + fs = function () { + return data; + }; + + return data; +} + +var _constants = require('./constants'); + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const isFile = filePath => + fs().existsSync(filePath) && !fs().lstatSync(filePath).isDirectory(); + +const getConfigFilename = ext => _constants.JEST_CONFIG_BASE_NAME + ext; + +var _default = (pathToResolve, cwd) => { + if (!path().isAbsolute(cwd)) { + throw new Error(`"cwd" must be an absolute path. cwd: ${cwd}`); + } + + const absolutePath = path().isAbsolute(pathToResolve) + ? pathToResolve + : path().resolve(cwd, pathToResolve); + + if (isFile(absolutePath)) { + return absolutePath; + } // This is a guard against passing non existing path as a project/config, + // that will otherwise result in a very confusing situation. + // e.g. + // With a directory structure like this: + // my_project/ + // packcage.json + // + // Passing a `my_project/some_directory_that_doesnt_exist` as a project + // name will resolve into a (possibly empty) `my_project/package.json` and + // try to run all tests it finds under `my_project` directory. + + if (!fs().existsSync(absolutePath)) { + throw new Error( + `Can't find a root directory while resolving a config file path.\n` + + `Provided path to resolve: ${pathToResolve}\n` + + `cwd: ${cwd}` + ); + } + + return resolveConfigPathByTraversing(absolutePath, pathToResolve, cwd); +}; + +exports.default = _default; + +const resolveConfigPathByTraversing = (pathToResolve, initialPath, cwd) => { + const jestConfig = _constants.JEST_CONFIG_EXT_ORDER.map(ext => + path().resolve(pathToResolve, getConfigFilename(ext)) + ).find(isFile); + + if (jestConfig) { + return jestConfig; + } + + const packageJson = path().resolve(pathToResolve, _constants.PACKAGE_JSON); + + if (isFile(packageJson)) { + return packageJson; + } // This is the system root. + // We tried everything, config is nowhere to be found ¯\_(ツ)_/¯ + + if (pathToResolve === path().dirname(pathToResolve)) { + throw new Error(makeResolutionErrorMessage(initialPath, cwd)); + } // go up a level and try it again + + return resolveConfigPathByTraversing( + path().dirname(pathToResolve), + initialPath, + cwd + ); +}; + +const makeResolutionErrorMessage = (initialPath, cwd) => + 'Could not find a config file based on provided values:\n' + + `path: "${initialPath}"\n` + + `cwd: "${cwd}"\n` + + 'Config paths must be specified by either a direct path to a config\n' + + 'file, or a path to a directory. If directory is given, Jest will try to\n' + + `traverse directory tree up, until it finds one of those files in exact order: ${_constants.JEST_CONFIG_EXT_ORDER.map( + ext => `"${getConfigFilename(ext)}"` + ).join(' or ')}.`; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/setFromArgv.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/setFromArgv.d.ts new file mode 100644 index 000000000..1e45a955a --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/setFromArgv.d.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +export default function setFromArgv(options: Config.InitialOptions, argv: Config.Argv): Config.InitialOptions; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/setFromArgv.js b/node_modules/@jest/core/node_modules/jest-config/build/setFromArgv.js new file mode 100644 index 000000000..6990440c3 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/setFromArgv.js @@ -0,0 +1,67 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = setFromArgv; + +var _utils = require('./utils'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const specialArgs = ['_', '$0', 'h', 'help', 'config']; + +function setFromArgv(options, argv) { + const argvToOptions = Object.keys(argv) + .filter(key => argv[key] !== undefined && specialArgs.indexOf(key) === -1) + .reduce((options, key) => { + switch (key) { + case 'coverage': + options.collectCoverage = argv[key]; + break; + + case 'json': + options.useStderr = argv[key]; + break; + + case 'watchAll': + options.watch = false; + options.watchAll = argv[key]; + break; + + case 'env': + options.testEnvironment = argv[key]; + break; + + case 'config': + break; + + case 'coverageThreshold': + case 'globals': + case 'moduleNameMapper': + case 'transform': + case 'haste': + const str = argv[key]; + + if ((0, _utils.isJSONString)(str)) { + options[key] = JSON.parse(str); + } + + break; + + default: + options[key] = argv[key]; + } + + return options; + }, {}); + return { + ...options, + ...((0, _utils.isJSONString)(argv.config) ? JSON.parse(argv.config) : null), + ...argvToOptions + }; +} diff --git a/node_modules/jest-config/build/ts3.4/Defaults.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/Defaults.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/Defaults.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/Defaults.d.ts diff --git a/node_modules/jest-config/build/ts3.4/Deprecated.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/Deprecated.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/Deprecated.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/Deprecated.d.ts diff --git a/node_modules/jest-config/build/ts3.4/Descriptions.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/Descriptions.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/Descriptions.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/Descriptions.d.ts diff --git a/node_modules/jest-config/build/ts3.4/ReporterValidationErrors.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/ReporterValidationErrors.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/ReporterValidationErrors.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/ReporterValidationErrors.d.ts diff --git a/node_modules/jest-config/build/ts3.4/ValidConfig.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/ValidConfig.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/ValidConfig.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/ValidConfig.d.ts diff --git a/node_modules/jest-config/build/ts3.4/color.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/color.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/color.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/color.d.ts diff --git a/node_modules/jest-config/build/ts3.4/constants.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/constants.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/constants.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/constants.d.ts diff --git a/node_modules/jest-config/build/ts3.4/getCacheDirectory.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/getCacheDirectory.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/getCacheDirectory.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/getCacheDirectory.d.ts diff --git a/node_modules/jest-config/build/ts3.4/getMaxWorkers.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/getMaxWorkers.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/getMaxWorkers.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/getMaxWorkers.d.ts diff --git a/node_modules/jest-config/build/ts3.4/importEsm.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/importEsm.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/importEsm.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/importEsm.d.ts diff --git a/node_modules/jest-config/build/ts3.4/index.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/index.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/index.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/index.d.ts diff --git a/node_modules/jest-config/build/ts3.4/normalize.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/normalize.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/normalize.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/normalize.d.ts diff --git a/node_modules/jest-config/build/ts3.4/readConfigFileAndSetRootDir.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/readConfigFileAndSetRootDir.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/readConfigFileAndSetRootDir.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/readConfigFileAndSetRootDir.d.ts diff --git a/node_modules/jest-config/build/ts3.4/resolveConfigPath.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/resolveConfigPath.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/resolveConfigPath.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/resolveConfigPath.d.ts diff --git a/node_modules/jest-config/build/ts3.4/setFromArgv.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/setFromArgv.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/setFromArgv.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/setFromArgv.d.ts diff --git a/node_modules/jest-config/build/ts3.4/utils.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/utils.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/utils.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/utils.d.ts diff --git a/node_modules/jest-config/build/ts3.4/validatePattern.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/ts3.4/validatePattern.d.ts similarity index 100% rename from node_modules/jest-config/build/ts3.4/validatePattern.d.ts rename to node_modules/@jest/core/node_modules/jest-config/build/ts3.4/validatePattern.d.ts diff --git a/node_modules/@jest/core/node_modules/jest-config/build/utils.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/utils.d.ts new file mode 100644 index 000000000..16ba40886 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/utils.d.ts @@ -0,0 +1,74 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +declare type ResolveOptions = { + rootDir: Config.Path; + key: string; + filePath: Config.Path; + optional?: boolean; +}; +export declare const BULLET: string; +export declare const DOCUMENTATION_NOTE: string; +export declare const resolve: (resolver: string | null | undefined, { key, filePath, rootDir, optional }: ResolveOptions) => string; +export declare const escapeGlobCharacters: (path: string) => string; +export declare const replaceRootDirInPath: (rootDir: string, filePath: string) => string; +declare type OrArray = T | Array; +declare type ReplaceRootDirConfigObj = Record; +declare type ReplaceRootDirConfigValues = OrArray | OrArray | OrArray; +export declare const _replaceRootDirTags: (rootDir: string, config: T) => T; +export declare const resolveWithPrefix: (resolver: string | null | undefined, { filePath, humanOptionName, optionName, prefix, rootDir, }: { + filePath: string; + humanOptionName: string; + optionName: string; + prefix: string; + rootDir: string; +}) => string; +/** + * Finds the test environment to use: + * + * 1. looks for jest-environment- relative to project. + * 1. looks for jest-environment- relative to Jest. + * 1. looks for relative to project. + * 1. looks for relative to Jest. + */ +export declare const getTestEnvironment: ({ rootDir, testEnvironment: filePath, }: { + rootDir: string; + testEnvironment: string; +}) => string; +/** + * Finds the watch plugins to use: + * + * 1. looks for jest-watch- relative to project. + * 1. looks for jest-watch- relative to Jest. + * 1. looks for relative to project. + * 1. looks for relative to Jest. + */ +export declare const getWatchPlugin: (resolver: string | null | undefined, { filePath, rootDir }: { + filePath: string; + rootDir: string; +}) => string; +/** + * Finds the runner to use: + * + * 1. looks for jest-runner- relative to project. + * 1. looks for jest-runner- relative to Jest. + * 1. looks for relative to project. + * 1. looks for relative to Jest. + */ +export declare const getRunner: (resolver: string | null | undefined, { filePath, rootDir }: { + filePath: string; + rootDir: string; +}) => string; +declare type JSONString = string & { + readonly $$type: never; +}; +export declare const isJSONString: (text?: string | JSONString | undefined) => text is JSONString; +export declare const getSequencer: (resolver: string | null | undefined, { filePath, rootDir }: { + filePath: string; + rootDir: string; +}) => string; +export {}; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/utils.js b/node_modules/@jest/core/node_modules/jest-config/build/utils.js new file mode 100644 index 000000000..0be254a32 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/utils.js @@ -0,0 +1,313 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.getSequencer = exports.isJSONString = exports.getRunner = exports.getWatchPlugin = exports.getTestEnvironment = exports.resolveWithPrefix = exports._replaceRootDirTags = exports.replaceRootDirInPath = exports.escapeGlobCharacters = exports.resolve = exports.DOCUMENTATION_NOTE = exports.BULLET = void 0; + +function path() { + const data = _interopRequireWildcard(require('path')); + + path = function () { + return data; + }; + + return data; +} + +function _jestValidate() { + const data = require('jest-validate'); + + _jestValidate = function () { + return data; + }; + + return data; +} + +function _jestResolve() { + const data = _interopRequireDefault(require('jest-resolve')); + + _jestResolve = function () { + return data; + }; + + return data; +} + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const BULLET = _chalk().default.bold('\u25cf '); + +exports.BULLET = BULLET; +const DOCUMENTATION_NOTE = ` ${_chalk().default.bold( + 'Configuration Documentation:' +)} + https://jestjs.io/docs/configuration.html +`; +exports.DOCUMENTATION_NOTE = DOCUMENTATION_NOTE; + +const createValidationError = message => + new (_jestValidate().ValidationError)( + `${BULLET}Validation Error`, + message, + DOCUMENTATION_NOTE + ); + +const resolve = (resolver, {key, filePath, rootDir, optional}) => { + const module = _jestResolve().default.findNodeModule( + replaceRootDirInPath(rootDir, filePath), + { + basedir: rootDir, + resolver: resolver || undefined + } + ); + + if (!module && !optional) { + throw createValidationError(` Module ${_chalk().default.bold( + filePath + )} in the ${_chalk().default.bold(key)} option was not found. + ${_chalk().default.bold('')} is: ${rootDir}`); + } /// can cast as string since nulls will be thrown + + return module; +}; + +exports.resolve = resolve; + +const escapeGlobCharacters = path => path.replace(/([()*{}\[\]!?\\])/g, '\\$1'); + +exports.escapeGlobCharacters = escapeGlobCharacters; + +const replaceRootDirInPath = (rootDir, filePath) => { + if (!/^/.test(filePath)) { + return filePath; + } + + return path().resolve( + rootDir, + path().normalize('./' + filePath.substr(''.length)) + ); +}; + +exports.replaceRootDirInPath = replaceRootDirInPath; + +const _replaceRootDirInObject = (rootDir, config) => { + const newConfig = {}; + + for (const configKey in config) { + newConfig[configKey] = + configKey === 'rootDir' + ? config[configKey] + : _replaceRootDirTags(rootDir, config[configKey]); + } + + return newConfig; +}; + +const _replaceRootDirTags = (rootDir, config) => { + if (config == null) { + return config; + } + + switch (typeof config) { + case 'object': + if (Array.isArray(config)) { + /// can be string[] or {}[] + return config.map(item => _replaceRootDirTags(rootDir, item)); + } + + if (config instanceof RegExp) { + return config; + } + + return _replaceRootDirInObject(rootDir, config); + + case 'string': + return replaceRootDirInPath(rootDir, config); + } + + return config; +}; + +exports._replaceRootDirTags = _replaceRootDirTags; + +const resolveWithPrefix = ( + resolver, + {filePath, humanOptionName, optionName, prefix, rootDir} +) => { + const fileName = replaceRootDirInPath(rootDir, filePath); + + let module = _jestResolve().default.findNodeModule(`${prefix}${fileName}`, { + basedir: rootDir, + resolver: resolver || undefined + }); + + if (module) { + return module; + } + + try { + return require.resolve(`${prefix}${fileName}`); + } catch (e) {} + + module = _jestResolve().default.findNodeModule(fileName, { + basedir: rootDir, + resolver: resolver || undefined + }); + + if (module) { + return module; + } + + try { + return require.resolve(fileName); + } catch (e) {} + + throw createValidationError( + ` ${humanOptionName} ${_chalk().default.bold( + fileName + )} cannot be found. Make sure the ${_chalk().default.bold( + optionName + )} configuration option points to an existing node module.` + ); +}; +/** + * Finds the test environment to use: + * + * 1. looks for jest-environment- relative to project. + * 1. looks for jest-environment- relative to Jest. + * 1. looks for relative to project. + * 1. looks for relative to Jest. + */ + +exports.resolveWithPrefix = resolveWithPrefix; + +const getTestEnvironment = ({rootDir, testEnvironment: filePath}) => + resolveWithPrefix(undefined, { + filePath, + humanOptionName: 'Test environment', + optionName: 'testEnvironment', + prefix: 'jest-environment-', + rootDir + }); +/** + * Finds the watch plugins to use: + * + * 1. looks for jest-watch- relative to project. + * 1. looks for jest-watch- relative to Jest. + * 1. looks for relative to project. + * 1. looks for relative to Jest. + */ + +exports.getTestEnvironment = getTestEnvironment; + +const getWatchPlugin = (resolver, {filePath, rootDir}) => + resolveWithPrefix(resolver, { + filePath, + humanOptionName: 'Watch plugin', + optionName: 'watchPlugins', + prefix: 'jest-watch-', + rootDir + }); +/** + * Finds the runner to use: + * + * 1. looks for jest-runner- relative to project. + * 1. looks for jest-runner- relative to Jest. + * 1. looks for relative to project. + * 1. looks for relative to Jest. + */ + +exports.getWatchPlugin = getWatchPlugin; + +const getRunner = (resolver, {filePath, rootDir}) => + resolveWithPrefix(resolver, { + filePath, + humanOptionName: 'Jest Runner', + optionName: 'runner', + prefix: 'jest-runner-', + rootDir + }); + +exports.getRunner = getRunner; + +// newtype +const isJSONString = text => + text != null && + typeof text === 'string' && + text.startsWith('{') && + text.endsWith('}'); + +exports.isJSONString = isJSONString; + +const getSequencer = (resolver, {filePath, rootDir}) => + resolveWithPrefix(resolver, { + filePath, + humanOptionName: 'Jest Sequencer', + optionName: 'testSequencer', + prefix: 'jest-sequencer-', + rootDir + }); + +exports.getSequencer = getSequencer; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/validatePattern.d.ts b/node_modules/@jest/core/node_modules/jest-config/build/validatePattern.d.ts new file mode 100644 index 000000000..8f15207c5 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/validatePattern.d.ts @@ -0,0 +1,7 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export default function validatePattern(pattern?: string): boolean; diff --git a/node_modules/@jest/core/node_modules/jest-config/build/validatePattern.js b/node_modules/@jest/core/node_modules/jest-config/build/validatePattern.js new file mode 100644 index 000000000..36ef2a0c7 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/validatePattern.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = validatePattern; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function validatePattern(pattern) { + if (pattern) { + try { + // eslint-disable-next-line no-new + new RegExp(pattern, 'i'); + } catch (e) { + return false; + } + } + + return true; +} diff --git a/node_modules/@jest/core/node_modules/jest-config/build/vendor/jsonlint.js b/node_modules/@jest/core/node_modules/jest-config/build/vendor/jsonlint.js new file mode 100644 index 000000000..93399c561 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/build/vendor/jsonlint.js @@ -0,0 +1,917 @@ +'use strict'; + +// From: https://github.com/zaach/jsonlint +// Vendored in Jest to avoid jsonlint's transitive dependencies. + +/* eslint-disable */ +var jsonlint = (function () { + var parser = { + trace: function trace() {}, + yy: {}, + symbols_: { + error: 2, + JSONString: 3, + STRING: 4, + JSONNumber: 5, + NUMBER: 6, + JSONNullLiteral: 7, + NULL: 8, + JSONBooleanLiteral: 9, + TRUE: 10, + FALSE: 11, + JSONText: 12, + JSONValue: 13, + EOF: 14, + JSONObject: 15, + JSONArray: 16, + '{': 17, + '}': 18, + JSONMemberList: 19, + JSONMember: 20, + ':': 21, + ',': 22, + '[': 23, + ']': 24, + JSONElementList: 25, + $accept: 0, + $end: 1 + }, + terminals_: { + 2: 'error', + 4: 'STRING', + 6: 'NUMBER', + 8: 'NULL', + 10: 'TRUE', + 11: 'FALSE', + 14: 'EOF', + 17: '{', + 18: '}', + 21: ':', + 22: ',', + 23: '[', + 24: ']' + }, + productions_: [ + 0, + [3, 1], + [5, 1], + [7, 1], + [9, 1], + [9, 1], + [12, 2], + [13, 1], + [13, 1], + [13, 1], + [13, 1], + [13, 1], + [13, 1], + [15, 2], + [15, 3], + [20, 3], + [19, 1], + [19, 3], + [16, 2], + [16, 3], + [25, 1], + [25, 3] + ], + performAction: function anonymous( + yytext, + yyleng, + yylineno, + yy, + yystate, + $$, + _$ + ) { + var $0 = $$.length - 1; + + switch (yystate) { + case 1: + // replace escaped characters with actual character + this.$ = yytext + .replace(/\\(\\|")/g, '$' + '1') + .replace(/\\n/g, '\n') + .replace(/\\r/g, '\r') + .replace(/\\t/g, '\t') + .replace(/\\v/g, '\v') + .replace(/\\f/g, '\f') + .replace(/\\b/g, '\b'); + break; + + case 2: + this.$ = Number(yytext); + break; + + case 3: + this.$ = null; + break; + + case 4: + this.$ = true; + break; + + case 5: + this.$ = false; + break; + + case 6: + return (this.$ = $$[$0 - 1]); + break; + + case 13: + this.$ = {}; + break; + + case 14: + this.$ = $$[$0 - 1]; + break; + + case 15: + this.$ = [$$[$0 - 2], $$[$0]]; + break; + + case 16: + this.$ = {}; + this.$[$$[$0][0]] = $$[$0][1]; + break; + + case 17: + this.$ = $$[$0 - 2]; + $$[$0 - 2][$$[$0][0]] = $$[$0][1]; + break; + + case 18: + this.$ = []; + break; + + case 19: + this.$ = $$[$0 - 1]; + break; + + case 20: + this.$ = [$$[$0]]; + break; + + case 21: + this.$ = $$[$0 - 2]; + $$[$0 - 2].push($$[$0]); + break; + } + }, + table: [ + { + 3: 5, + 4: [1, 12], + 5: 6, + 6: [1, 13], + 7: 3, + 8: [1, 9], + 9: 4, + 10: [1, 10], + 11: [1, 11], + 12: 1, + 13: 2, + 15: 7, + 16: 8, + 17: [1, 14], + 23: [1, 15] + }, + { + 1: [3] + }, + { + 14: [1, 16] + }, + { + 14: [2, 7], + 18: [2, 7], + 22: [2, 7], + 24: [2, 7] + }, + { + 14: [2, 8], + 18: [2, 8], + 22: [2, 8], + 24: [2, 8] + }, + { + 14: [2, 9], + 18: [2, 9], + 22: [2, 9], + 24: [2, 9] + }, + { + 14: [2, 10], + 18: [2, 10], + 22: [2, 10], + 24: [2, 10] + }, + { + 14: [2, 11], + 18: [2, 11], + 22: [2, 11], + 24: [2, 11] + }, + { + 14: [2, 12], + 18: [2, 12], + 22: [2, 12], + 24: [2, 12] + }, + { + 14: [2, 3], + 18: [2, 3], + 22: [2, 3], + 24: [2, 3] + }, + { + 14: [2, 4], + 18: [2, 4], + 22: [2, 4], + 24: [2, 4] + }, + { + 14: [2, 5], + 18: [2, 5], + 22: [2, 5], + 24: [2, 5] + }, + { + 14: [2, 1], + 18: [2, 1], + 21: [2, 1], + 22: [2, 1], + 24: [2, 1] + }, + { + 14: [2, 2], + 18: [2, 2], + 22: [2, 2], + 24: [2, 2] + }, + { + 3: 20, + 4: [1, 12], + 18: [1, 17], + 19: 18, + 20: 19 + }, + { + 3: 5, + 4: [1, 12], + 5: 6, + 6: [1, 13], + 7: 3, + 8: [1, 9], + 9: 4, + 10: [1, 10], + 11: [1, 11], + 13: 23, + 15: 7, + 16: 8, + 17: [1, 14], + 23: [1, 15], + 24: [1, 21], + 25: 22 + }, + { + 1: [2, 6] + }, + { + 14: [2, 13], + 18: [2, 13], + 22: [2, 13], + 24: [2, 13] + }, + { + 18: [1, 24], + 22: [1, 25] + }, + { + 18: [2, 16], + 22: [2, 16] + }, + { + 21: [1, 26] + }, + { + 14: [2, 18], + 18: [2, 18], + 22: [2, 18], + 24: [2, 18] + }, + { + 22: [1, 28], + 24: [1, 27] + }, + { + 22: [2, 20], + 24: [2, 20] + }, + { + 14: [2, 14], + 18: [2, 14], + 22: [2, 14], + 24: [2, 14] + }, + { + 3: 20, + 4: [1, 12], + 20: 29 + }, + { + 3: 5, + 4: [1, 12], + 5: 6, + 6: [1, 13], + 7: 3, + 8: [1, 9], + 9: 4, + 10: [1, 10], + 11: [1, 11], + 13: 30, + 15: 7, + 16: 8, + 17: [1, 14], + 23: [1, 15] + }, + { + 14: [2, 19], + 18: [2, 19], + 22: [2, 19], + 24: [2, 19] + }, + { + 3: 5, + 4: [1, 12], + 5: 6, + 6: [1, 13], + 7: 3, + 8: [1, 9], + 9: 4, + 10: [1, 10], + 11: [1, 11], + 13: 31, + 15: 7, + 16: 8, + 17: [1, 14], + 23: [1, 15] + }, + { + 18: [2, 17], + 22: [2, 17] + }, + { + 18: [2, 15], + 22: [2, 15] + }, + { + 22: [2, 21], + 24: [2, 21] + } + ], + defaultActions: { + 16: [2, 6] + }, + parseError: function parseError(str, hash) { + throw new Error(str); + }, + parse: function parse(input) { + var self = this, + stack = [0], + vstack = [null], + // semantic value stack + lstack = [], + // location stack + table = this.table, + yytext = '', + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; //this.reductionCount = this.shiftCount = 0; + + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + if (typeof this.lexer.yylloc == 'undefined') this.lexer.yylloc = {}; + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + if (typeof this.yy.parseError === 'function') + this.parseError = this.yy.parseError; + + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + + function lex() { + var token; + token = self.lexer.lex() || 1; // $end = 1 + // if token isn't its numeric value, convert + + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token; + } + + var symbol, + preErrorSymbol, + state, + action, + a, + r, + yyval = {}, + p, + len, + newState, + expected; + + while (true) { + // retrieve state number from top of stack + state = stack[stack.length - 1]; // use default actions if available + + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol == null) symbol = lex(); // read action for current state and first input + + action = table[state] && table[state][symbol]; + } // handle parse error + + _handle_error: if ( + typeof action === 'undefined' || + !action.length || + !action[0] + ) { + if (!recovering) { + // Report error + expected = []; + + for (p in table[state]) + if (this.terminals_[p] && p > 2) { + expected.push("'" + this.terminals_[p] + "'"); + } + + var errStr = ''; + + if (this.lexer.showPosition) { + errStr = + 'Parse error on line ' + + (yylineno + 1) + + ':\n' + + this.lexer.showPosition() + + '\nExpecting ' + + expected.join(', ') + + ", got '" + + this.terminals_[symbol] + + "'"; + } else { + errStr = + 'Parse error on line ' + + (yylineno + 1) + + ': Unexpected ' + + (symbol == 1 + ? /*EOF*/ + 'end of input' + : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + + this.parseError(errStr, { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected + }); + } // just recovered from another error + + if (recovering == 3) { + if (symbol == EOF) { + throw new Error(errStr || 'Parsing halted.'); + } // discard current lookahead and grab another + + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + symbol = lex(); + } // try to recover from error + + while (1) { + // check for error recovery rule in this state + if (TERROR.toString() in table[state]) { + break; + } + + if (state == 0) { + throw new Error(errStr || 'Parsing halted.'); + } + + popStack(1); + state = stack[stack.length - 1]; + } + + preErrorSymbol = symbol; // save the lookahead token + + symbol = TERROR; // insert generic error symbol as new lookahead + + state = stack[stack.length - 1]; + action = table[state] && table[state][TERROR]; + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + } // this shouldn't happen, unless resolve defaults are off + + if (action[0] instanceof Array && action.length > 1) { + throw new Error( + 'Parse Error: multiple actions possible at state: ' + + state + + ', token: ' + + symbol + ); + } + + switch (action[0]) { + case 1: + // shift + //this.shiftCount++; + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); // push state + + symbol = null; + + if (!preErrorSymbol) { + // normal execution/no error + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) recovering--; + } else { + // error just occurred, resume old lookahead f/ before error + symbol = preErrorSymbol; + preErrorSymbol = null; + } + + break; + + case 2: + // reduce + //this.reductionCount++; + len = this.productions_[action[1]][1]; // perform semantic action + + yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 + // default location, uses first token for firsts, last for lasts + + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + r = this.performAction.call( + yyval, + yytext, + yyleng, + yylineno, + this.yy, + action[1], + vstack, + lstack + ); + + if (typeof r !== 'undefined') { + return r; + } // pop off stack + + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + + stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) + + vstack.push(yyval.$); + lstack.push(yyval._$); // goto new state = table[STATE][NONTERMINAL] + + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + + case 3: + // accept + return true; + } + } + + return true; + } + }; + /* Jison generated lexer */ + + var lexer = (function () { + var lexer = { + EOF: 1, + parseError: function parseError(str, hash) { + if (this.yy.parseError) { + this.yy.parseError(str, hash); + } else { + throw new Error(str); + } + }, + setInput: function (input) { + this._input = input; + this._more = this._less = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + return this; + }, + input: function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/\n/); + if (lines) this.yylineno++; + this._input = this._input.slice(1); + return ch; + }, + unput: function (ch) { + this._input = ch + this._input; + return this; + }, + more: function () { + this._more = true; + return this; + }, + less: function (n) { + this._input = this.match.slice(n) + this._input; + }, + pastInput: function () { + var past = this.matched.substr( + 0, + this.matched.length - this.match.length + ); + return ( + (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, '') + ); + }, + upcomingInput: function () { + var next = this.match; + + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + + return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace( + /\n/g, + '' + ); + }, + showPosition: function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join('-'); + return pre + this.upcomingInput() + '\n' + c + '^'; + }, + next: function () { + if (this.done) { + return this.EOF; + } + + if (!this._input) this.done = true; + var token, match, tempMatch, index, col, lines; + + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + + var rules = this._currentRules(); + + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (!this.options.flex) break; + } + } + + if (match) { + lines = match[0].match(/\n.*/g); + if (lines) this.yylineno += lines.length; + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines + ? lines[lines.length - 1].length - 1 + : this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.yyleng = this.yytext.length; + this._more = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call( + this, + this.yy, + this, + rules[index], + this.conditionStack[this.conditionStack.length - 1] + ); + if (this.done && this._input) this.done = false; + if (token) return token; + else return; + } + + if (this._input === '') { + return this.EOF; + } else { + this.parseError( + 'Lexical error on line ' + + (this.yylineno + 1) + + '. Unrecognized text.\n' + + this.showPosition(), + { + text: '', + token: null, + line: this.yylineno + } + ); + } + }, + lex: function lex() { + var r = this.next(); + + if (typeof r !== 'undefined') { + return r; + } else { + return this.lex(); + } + }, + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + popState: function popState() { + return this.conditionStack.pop(); + }, + _currentRules: function _currentRules() { + return this.conditions[ + this.conditionStack[this.conditionStack.length - 1] + ].rules; + }, + topState: function () { + return this.conditionStack[this.conditionStack.length - 2]; + }, + pushState: function begin(condition) { + this.begin(condition); + } + }; + lexer.options = {}; + + lexer.performAction = function anonymous( + yy, + yy_, + $avoiding_name_collisions, + YY_START + ) { + var YYSTATE = YY_START; + + switch ($avoiding_name_collisions) { + case 0: + /* skip whitespace */ + break; + + case 1: + return 6; + break; + + case 2: + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); + return 4; + break; + + case 3: + return 17; + break; + + case 4: + return 18; + break; + + case 5: + return 23; + break; + + case 6: + return 24; + break; + + case 7: + return 22; + break; + + case 8: + return 21; + break; + + case 9: + return 10; + break; + + case 10: + return 11; + break; + + case 11: + return 8; + break; + + case 12: + return 14; + break; + + case 13: + return 'INVALID'; + break; + } + }; + + lexer.rules = [ + /^(?:\s+)/, + /^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/, + /^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/, + /^(?:\{)/, + /^(?:\})/, + /^(?:\[)/, + /^(?:\])/, + /^(?:,)/, + /^(?::)/, + /^(?:true\b)/, + /^(?:false\b)/, + /^(?:null\b)/, + /^(?:$)/, + /^(?:.)/ + ]; + lexer.conditions = { + INITIAL: { + rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], + inclusive: true + } + }; + return lexer; + })(); + + parser.lexer = lexer; + return parser; +})(); + +exports.parser = jsonlint; + +exports.errors = function (input) { + try { + this.parse(input); + } catch (e) { + return e.stack; + } +}; + +exports.parse = function () { + return jsonlint.parse.apply(jsonlint, arguments); +}; + +exports.main = function commonjsMain(args) { + if (!args[1]) throw new Error('Usage: ' + args[0] + ' FILE'); + + if (typeof process !== 'undefined') { + var source = require('fs').readFileSync( + require('path').join(process.cwd(), args[1]), + 'utf8' + ); + } else { + var cwd = require('file').path(require('file').cwd()); + + var source = cwd.join(args[1]).read({ + charset: 'utf-8' + }); + } + + return exports.parser.parse(source); +}; diff --git a/node_modules/@jest/core/node_modules/jest-config/package.json b/node_modules/@jest/core/node_modules/jest-config/package.json new file mode 100644 index 000000000..8841a889b --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-config/package.json @@ -0,0 +1,88 @@ +{ + "_args": [ + [ + "jest-config@25.5.4", + "/workspace/readable-readme" + ] + ], + "_development": true, + "_from": "jest-config@25.5.4", + "_id": "jest-config@25.5.4", + "_inBundle": false, + "_integrity": "sha512-SZwR91SwcdK6bz7Gco8qL7YY2sx8tFJYzvg216DLihTWf+LKY/DoJXpM9nTzYakSyfblbqeU48p/p7Jzy05Atg==", + "_location": "/@jest/core/jest-config", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "jest-config@25.5.4", + "name": "jest-config", + "escapedName": "jest-config", + "rawSpec": "25.5.4", + "saveSpec": null, + "fetchSpec": "25.5.4" + }, + "_requiredBy": [ + "/@jest/core", + "/@jest/core/jest-runner", + "/@jest/core/jest-runtime" + ], + "_resolved": "https://registry.npmjs.org/jest-config/-/jest-config-25.5.4.tgz", + "_spec": "25.5.4", + "_where": "/workspace/readable-readme", + "bugs": { + "url": "https://github.com/facebook/jest/issues" + }, + "dependencies": { + "@babel/core": "^7.1.0", + "@jest/test-sequencer": "^25.5.4", + "@jest/types": "^25.5.0", + "babel-jest": "^25.5.1", + "chalk": "^3.0.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.1", + "graceful-fs": "^4.2.4", + "jest-environment-jsdom": "^25.5.0", + "jest-environment-node": "^25.5.0", + "jest-get-type": "^25.2.6", + "jest-jasmine2": "^25.5.4", + "jest-regex-util": "^25.2.6", + "jest-resolve": "^25.5.1", + "jest-util": "^25.5.0", + "jest-validate": "^25.5.0", + "micromatch": "^4.0.2", + "pretty-format": "^25.5.0", + "realpath-native": "^2.0.0" + }, + "devDependencies": { + "@types/babel__core": "^7.0.4", + "@types/glob": "^7.1.1", + "@types/graceful-fs": "^4.1.3", + "@types/micromatch": "^4.0.0" + }, + "engines": { + "node": ">= 8.3" + }, + "gitHead": "389d13724bbf6bb64dcde9700a6ecea3333942db", + "homepage": "https://github.com/facebook/jest#readme", + "license": "MIT", + "main": "build/index.js", + "name": "jest-config", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/facebook/jest.git", + "directory": "packages/jest-config" + }, + "types": "build/index.d.ts", + "typesVersions": { + "<3.8": { + "build/*": [ + "build/ts3.4/*" + ] + } + }, + "version": "25.5.4" +} diff --git a/node_modules/jest-haste-map/node_modules/jest-worker/LICENSE b/node_modules/@jest/core/node_modules/jest-jasmine2/LICENSE similarity index 100% rename from node_modules/jest-haste-map/node_modules/jest-worker/LICENSE rename to node_modules/@jest/core/node_modules/jest-jasmine2/LICENSE diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/ExpectationFailed.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ExpectationFailed.d.ts new file mode 100644 index 000000000..657f1ccf2 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ExpectationFailed.d.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export default class ExpectationFailed extends Error { +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/ExpectationFailed.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ExpectationFailed.js new file mode 100644 index 000000000..cca6c96f4 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ExpectationFailed.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +class ExpectationFailed extends Error {} + +exports.default = ExpectationFailed; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/PCancelable.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/PCancelable.js new file mode 100644 index 000000000..31cca71b2 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/PCancelable.js @@ -0,0 +1,85 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict'; + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +var Promise = global[Symbol.for('jest-native-promise')] || global.Promise; + +class CancelError extends Error { + constructor() { + super('Promise was canceled'); + this.name = 'CancelError'; + } +} + +class PCancelable { + static fn(fn) { + return function () { + const args = [].slice.apply(arguments); + return new PCancelable((onCancel, resolve, reject) => { + args.unshift(onCancel); + fn.apply(null, args).then(resolve, reject); + }); + }; + } + + constructor(executor) { + this._pending = true; + this._canceled = false; + this._promise = new Promise((resolve, reject) => { + this._reject = reject; + return executor( + fn => { + this._cancel = fn; + }, + val => { + this._pending = false; + resolve(val); + }, + err => { + this._pending = false; + reject(err); + } + ); + }); + } + + then() { + return this._promise.then.apply(this._promise, arguments); + } + + catch() { + return this._promise.catch.apply(this._promise, arguments); + } + + cancel() { + if (!this._pending || this._canceled) { + return; + } + + if (typeof this._cancel === 'function') { + try { + this._cancel(); + } catch (err) { + this._reject(err); + } + } + + this._canceled = true; + + this._reject(new CancelError()); + } + + get canceled() { + return this._canceled; + } +} + +Object.setPrototypeOf(PCancelable.prototype, Promise.prototype); +module.exports = PCancelable; +module.exports.CancelError = CancelError; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/assertionErrorMessage.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/assertionErrorMessage.d.ts new file mode 100644 index 000000000..8c00fb574 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/assertionErrorMessage.d.ts @@ -0,0 +1,10 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import { DiffOptions } from 'jest-matcher-utils'; +import type { AssertionErrorWithStack } from './types'; +declare function assertionErrorMessage(error: AssertionErrorWithStack, options: DiffOptions): string; +export default assertionErrorMessage; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/assertionErrorMessage.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/assertionErrorMessage.js new file mode 100644 index 000000000..74558f40e --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/assertionErrorMessage.js @@ -0,0 +1,156 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _jestMatcherUtils = require('jest-matcher-utils'); + +var _chalk = _interopRequireDefault(require('chalk')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const assertOperatorsMap = { + '!=': 'notEqual', + '!==': 'notStrictEqual', + '==': 'equal', + '===': 'strictEqual' +}; +const humanReadableOperators = { + deepEqual: 'to deeply equal', + deepStrictEqual: 'to deeply and strictly equal', + equal: 'to be equal', + notDeepEqual: 'not to deeply equal', + notDeepStrictEqual: 'not to deeply and strictly equal', + notEqual: 'to not be equal', + notStrictEqual: 'not be strictly equal', + strictEqual: 'to strictly be equal' +}; + +const getOperatorName = (operator, stack) => { + if (typeof operator === 'string') { + return assertOperatorsMap[operator] || operator; + } + + if (stack.match('.doesNotThrow')) { + return 'doesNotThrow'; + } + + if (stack.match('.throws')) { + return 'throws'; + } // this fallback is only needed for versions older than node 10 + + if (stack.match('.fail')) { + return 'fail'; + } + + return ''; +}; + +const operatorMessage = operator => { + const niceOperatorName = getOperatorName(operator, ''); + const humanReadableOperator = humanReadableOperators[niceOperatorName]; + return typeof operator === 'string' + ? `${humanReadableOperator || niceOperatorName} to:\n` + : ''; +}; + +const assertThrowingMatcherHint = operatorName => + operatorName + ? _chalk.default.dim('assert') + + _chalk.default.dim('.' + operatorName + '(') + + _chalk.default.red('function') + + _chalk.default.dim(')') + : ''; + +const assertMatcherHint = (operator, operatorName, expected) => { + let message = ''; + + if (operator === '==' && expected === true) { + message = + _chalk.default.dim('assert') + + _chalk.default.dim('(') + + _chalk.default.red('received') + + _chalk.default.dim(')'); + } else if (operatorName) { + message = + _chalk.default.dim('assert') + + _chalk.default.dim('.' + operatorName + '(') + + _chalk.default.red('received') + + _chalk.default.dim(', ') + + _chalk.default.green('expected') + + _chalk.default.dim(')'); + } + + return message; +}; + +function assertionErrorMessage(error, options) { + const {expected, actual, generatedMessage, message, operator, stack} = error; + const diffString = (0, _jestMatcherUtils.diff)(expected, actual, options); + const hasCustomMessage = !generatedMessage; + const operatorName = getOperatorName(operator, stack); + const trimmedStack = stack + .replace(message, '') + .replace(/AssertionError(.*)/g, ''); + + if (operatorName === 'doesNotThrow') { + return ( + buildHintString(assertThrowingMatcherHint(operatorName)) + + _chalk.default.reset(`Expected the function not to throw an error.\n`) + + _chalk.default.reset(`Instead, it threw:\n`) + + ` ${(0, _jestMatcherUtils.printReceived)(actual)}` + + _chalk.default.reset( + hasCustomMessage ? '\n\nMessage:\n ' + message : '' + ) + + trimmedStack + ); + } + + if (operatorName === 'throws') { + return ( + buildHintString(assertThrowingMatcherHint(operatorName)) + + _chalk.default.reset(`Expected the function to throw an error.\n`) + + _chalk.default.reset(`But it didn't throw anything.`) + + _chalk.default.reset( + hasCustomMessage ? '\n\nMessage:\n ' + message : '' + ) + + trimmedStack + ); + } + + if (operatorName === 'fail') { + return ( + buildHintString(assertMatcherHint(operator, operatorName, expected)) + + _chalk.default.reset(hasCustomMessage ? 'Message:\n ' + message : '') + + trimmedStack + ); + } + + return ( + buildHintString(assertMatcherHint(operator, operatorName, expected)) + + _chalk.default.reset(`Expected value ${operatorMessage(operator)}`) + + ` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` + + _chalk.default.reset(`Received:\n`) + + ` ${(0, _jestMatcherUtils.printReceived)(actual)}` + + _chalk.default.reset(hasCustomMessage ? '\n\nMessage:\n ' + message : '') + + (diffString ? `\n\nDifference:\n\n${diffString}` : '') + + trimmedStack + ); +} + +function buildHintString(hint) { + return hint ? hint + '\n\n' : ''; +} + +var _default = assertionErrorMessage; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/each.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/each.d.ts new file mode 100644 index 000000000..c49770bdf --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/each.d.ts @@ -0,0 +1,9 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { JestEnvironment } from '@jest/environment'; +declare const _default: (environment: JestEnvironment) => void; +export default _default; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/each.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/each.js new file mode 100644 index 000000000..0f93bb352 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/each.js @@ -0,0 +1,34 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _jestEach = require('jest-each'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +var _default = environment => { + environment.global.it.each = (0, _jestEach.bind)(environment.global.it); + environment.global.fit.each = (0, _jestEach.bind)(environment.global.fit); + environment.global.xit.each = (0, _jestEach.bind)(environment.global.xit); + environment.global.describe.each = (0, _jestEach.bind)( + environment.global.describe, + false + ); + environment.global.xdescribe.each = (0, _jestEach.bind)( + environment.global.xdescribe, + false + ); + environment.global.fdescribe.each = (0, _jestEach.bind)( + environment.global.fdescribe, + false + ); +}; + +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/errorOnPrivate.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/errorOnPrivate.d.ts new file mode 100644 index 000000000..081dd14a7 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/errorOnPrivate.d.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Global } from '@jest/types'; +export declare function installErrorOnPrivate(global: Global.Global): void; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/errorOnPrivate.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/errorOnPrivate.js new file mode 100644 index 000000000..5b7342517 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/errorOnPrivate.js @@ -0,0 +1,66 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.installErrorOnPrivate = installErrorOnPrivate; + +var _jestUtil = require('jest-util'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// prettier-ignore +const disabledGlobals = { + fail: 'Illegal usage of global `fail`, prefer throwing an error, or the `done.fail` callback.', + pending: 'Illegal usage of global `pending`, prefer explicitly skipping a test using `test.skip`', + spyOn: 'Illegal usage of global `spyOn`, prefer `jest.spyOn`.', + spyOnProperty: 'Illegal usage of global `spyOnProperty`, prefer `jest.spyOn`.' +}; +// prettier-ignore +const disabledJasmineMethods = { + addMatchers: 'Illegal usage of `jasmine.addMatchers`, prefer `expect.extends`.', + any: 'Illegal usage of `jasmine.any`, prefer `expect.any`.', + anything: 'Illegal usage of `jasmine.anything`, prefer `expect.anything`.', + arrayContaining: 'Illegal usage of `jasmine.arrayContaining`, prefer `expect.arrayContaining`.', + createSpy: 'Illegal usage of `jasmine.createSpy`, prefer `jest.fn`.', + objectContaining: 'Illegal usage of `jasmine.objectContaining`, prefer `expect.objectContaining`.', + stringMatching: 'Illegal usage of `jasmine.stringMatching`, prefer `expect.stringMatching`.' +}; + +function installErrorOnPrivate(global) { + const jasmine = global.jasmine; + Object.keys(disabledGlobals).forEach(functionName => { + global[functionName] = () => { + throwAtFunction(disabledGlobals[functionName], global[functionName]); + }; + }); + Object.keys(disabledJasmineMethods).forEach(methodName => { + // @ts-ignore + jasmine[methodName] = () => { + throwAtFunction(disabledJasmineMethods[methodName], jasmine[methodName]); + }; + }); + + function set() { + throwAtFunction( + 'Illegal usage of `jasmine.DEFAULT_TIMEOUT_INTERVAL`, prefer `jest.setTimeout`.', + set + ); + } + + const original = jasmine.DEFAULT_TIMEOUT_INTERVAL; + Object.defineProperty(jasmine, 'DEFAULT_TIMEOUT_INTERVAL', { + configurable: true, + enumerable: true, + get: () => original, + set + }); +} + +function throwAtFunction(message, fn) { + throw new _jestUtil.ErrorWithStack(message, fn); +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/expectationResultFactory.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/expectationResultFactory.d.ts new file mode 100644 index 000000000..f3101fadf --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/expectationResultFactory.d.ts @@ -0,0 +1,16 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { FailedAssertion } from '@jest/test-result'; +export declare type Options = { + matcherName: string; + passed: boolean; + actual?: any; + error?: any; + expected?: any; + message?: string | null; +}; +export default function expectationResultFactory(options: Options, initError?: Error): FailedAssertion; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/expectationResultFactory.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/expectationResultFactory.js new file mode 100644 index 000000000..90761f784 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/expectationResultFactory.js @@ -0,0 +1,93 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = expectationResultFactory; + +var _prettyFormat = _interopRequireDefault(require('pretty-format')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function messageFormatter({error, message, passed}) { + if (passed) { + return 'Passed.'; + } + + if (message) { + return message; + } + + if (typeof error === 'string') { + return error; + } + + if ( + // duck-type Error, see #2549 + error && + typeof error === 'object' && + typeof error.message === 'string' && + typeof error.name === 'string' + ) { + return `${error.name}: ${error.message}`; + } + + return `thrown: ${(0, _prettyFormat.default)(error, { + maxDepth: 3 + })}`; +} + +function stackFormatter(options, initError, errorMessage) { + if (options.passed) { + return ''; + } + + if (options.error) { + if (options.error.stack) { + return options.error.stack; + } + + if (options.error === errorMessage) { + return errorMessage; + } + } + + if (initError) { + return errorMessage.trimRight() + '\n\n' + initError.stack; + } + + return new Error(errorMessage).stack; +} + +function expectationResultFactory(options, initError) { + const message = messageFormatter(options); + const stack = stackFormatter(options, initError, message); + + if (options.passed) { + return { + error: options.error, + matcherName: options.matcherName, + message, + passed: options.passed, + stack + }; + } + + return { + actual: options.actual, + error: options.error, + expected: options.expected, + matcherName: options.matcherName, + message, + passed: options.passed, + stack + }; +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/index.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/index.d.ts new file mode 100644 index 000000000..c71445918 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/index.d.ts @@ -0,0 +1,16 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +import type { TestResult } from '@jest/test-result'; +import type { JestEnvironment } from '@jest/environment'; +import type { RuntimeType as Runtime } from 'jest-runtime'; +import type { Jasmine as JestJasmine } from './types'; +declare function jasmine2(globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, environment: JestEnvironment, runtime: Runtime, testPath: string): Promise; +declare namespace jasmine2 { + type Jasmine = JestJasmine; +} +export = jasmine2; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/index.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/index.js new file mode 100644 index 000000000..63b2ca3d7 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/index.js @@ -0,0 +1,263 @@ +'use strict'; + +var path = _interopRequireWildcard(require('path')); + +var _sourceMap = require('@jest/source-map'); + +var _each = _interopRequireDefault(require('./each')); + +var _errorOnPrivate = require('./errorOnPrivate'); + +var _reporter = _interopRequireDefault(require('./reporter')); + +var _jasmineAsyncInstall = _interopRequireDefault( + require('./jasmineAsyncInstall') +); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const JASMINE = require.resolve('./jasmine/jasmineLight'); + +async function jasmine2(globalConfig, config, environment, runtime, testPath) { + var _runtime$unstable_sho2; + + const reporter = new _reporter.default(globalConfig, config, testPath); + const jasmineFactory = runtime.requireInternalModule(JASMINE); + const jasmine = jasmineFactory.create({ + process, + testPath, + testTimeout: globalConfig.testTimeout + }); + const env = jasmine.getEnv(); + + const jasmineInterface = jasmineFactory._interface(jasmine, env); + + Object.assign(environment.global, jasmineInterface); + env.addReporter(jasmineInterface.jsApiReporter); // TODO: Remove config option if V8 exposes some way of getting location of caller + // in a future version + + if (config.testLocationInResults === true) { + const originalIt = environment.global.it; + + environment.global.it = (...args) => { + const stack = (0, _sourceMap.getCallsite)(1, runtime.getSourceMaps()); + const it = originalIt(...args); // @ts-ignore + + it.result.__callsite = stack; + return it; + }; + + const originalXit = environment.global.xit; + + environment.global.xit = (...args) => { + const stack = (0, _sourceMap.getCallsite)(1, runtime.getSourceMaps()); + const xit = originalXit(...args); // @ts-ignore + + xit.result.__callsite = stack; + return xit; + }; + + const originalFit = environment.global.fit; + + environment.global.fit = (...args) => { + const stack = (0, _sourceMap.getCallsite)(1, runtime.getSourceMaps()); + const fit = originalFit(...args); // @ts-ignore + + fit.result.__callsite = stack; + return fit; + }; + } + + (0, _jasmineAsyncInstall.default)(globalConfig, environment.global); + (0, _each.default)(environment); + environment.global.test = environment.global.it; + environment.global.it.only = environment.global.fit; + environment.global.it.todo = env.todo; + environment.global.it.skip = environment.global.xit; + environment.global.xtest = environment.global.xit; + environment.global.describe.skip = environment.global.xdescribe; + environment.global.describe.only = environment.global.fdescribe; + + if (config.timers === 'fake') { + environment.fakeTimers.useFakeTimers(); + } + + env.beforeEach(() => { + if (config.resetModules) { + runtime.resetModules(); + } + + if (config.clearMocks) { + runtime.clearAllMocks(); + } + + if (config.resetMocks) { + runtime.resetAllMocks(); + + if (config.timers === 'fake') { + environment.fakeTimers.useFakeTimers(); + } + } + + if (config.restoreMocks) { + runtime.restoreAllMocks(); + } + }); + env.addReporter(reporter); + runtime + .requireInternalModule(path.resolve(__dirname, './jestExpect.js')) + .default({ + expand: globalConfig.expand + }); + + if (globalConfig.errorOnDeprecated) { + (0, _errorOnPrivate.installErrorOnPrivate)(environment.global); + } else { + Object.defineProperty(jasmine, 'DEFAULT_TIMEOUT_INTERVAL', { + configurable: true, + enumerable: true, + + get() { + return this._DEFAULT_TIMEOUT_INTERVAL; + }, + + set(value) { + this._DEFAULT_TIMEOUT_INTERVAL = value; + } + }); + } + + const snapshotState = runtime + .requireInternalModule(path.resolve(__dirname, './setup_jest_globals.js')) + .default({ + config, + globalConfig, + localRequire: runtime.requireModule.bind(runtime), + testPath + }); + + for (const path of config.setupFilesAfterEnv) { + var _runtime$unstable_sho; + + // TODO: remove ? in Jest 26 + const esm = + (_runtime$unstable_sho = runtime.unstable_shouldLoadAsEsm) === null || + _runtime$unstable_sho === void 0 + ? void 0 + : _runtime$unstable_sho.call(runtime, path); + + if (esm) { + await runtime.unstable_importModule(path); + } else { + runtime.requireModule(path); + } + } + + if (globalConfig.enabledTestsMap) { + env.specFilter = spec => { + const suiteMap = + globalConfig.enabledTestsMap && + globalConfig.enabledTestsMap[spec.result.testPath]; + return (suiteMap && suiteMap[spec.result.fullName]) || false; + }; + } else if (globalConfig.testNamePattern) { + const testNameRegex = new RegExp(globalConfig.testNamePattern, 'i'); + + env.specFilter = spec => testNameRegex.test(spec.getFullName()); + } // TODO: remove ? in Jest 26 + + const esm = + (_runtime$unstable_sho2 = runtime.unstable_shouldLoadAsEsm) === null || + _runtime$unstable_sho2 === void 0 + ? void 0 + : _runtime$unstable_sho2.call(runtime, testPath); + + if (esm) { + await runtime.unstable_importModule(testPath); + } else { + runtime.requireModule(testPath); + } + + await env.execute(); + const results = await reporter.getResults(); + return addSnapshotData(results, snapshotState); +} + +const addSnapshotData = (results, snapshotState) => { + results.testResults.forEach(({fullName, status}) => { + if (status === 'pending' || status === 'failed') { + // if test is skipped or failed, we don't want to mark + // its snapshots as obsolete. + snapshotState.markSnapshotsAsCheckedForTest(fullName); + } + }); + const uncheckedCount = snapshotState.getUncheckedCount(); + const uncheckedKeys = snapshotState.getUncheckedKeys(); + + if (uncheckedCount) { + snapshotState.removeUncheckedKeys(); + } + + const status = snapshotState.save(); + results.snapshot.fileDeleted = status.deleted; + results.snapshot.added = snapshotState.added; + results.snapshot.matched = snapshotState.matched; + results.snapshot.unmatched = snapshotState.unmatched; + results.snapshot.updated = snapshotState.updated; + results.snapshot.unchecked = !status.deleted ? uncheckedCount : 0; // Copy the array to prevent memory leaks + + results.snapshot.uncheckedKeys = Array.from(uncheckedKeys); + return results; +}; // eslint-disable-next-line no-redeclare + +module.exports = jasmine2; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/isError.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/isError.d.ts new file mode 100644 index 000000000..b21d23599 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/isError.d.ts @@ -0,0 +1,10 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export default function isError(potentialError: any): { + isError: boolean; + message: string | null; +}; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/isError.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/isError.js new file mode 100644 index 000000000..7e79a2909 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/isError.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = isError; + +var _prettyFormat = _interopRequireDefault(require('pretty-format')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function isError(potentialError) { + // duck-type Error, see #2549 + const isError = + potentialError !== null && + typeof potentialError === 'object' && + typeof potentialError.message === 'string' && + typeof potentialError.name === 'string'; + const message = isError + ? null + : `Failed: ${(0, _prettyFormat.default)(potentialError, { + maxDepth: 3 + })}`; + return { + isError, + message + }; +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/CallTracker.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/CallTracker.d.ts new file mode 100644 index 000000000..1692e9c91 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/CallTracker.d.ts @@ -0,0 +1,25 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +export declare type Context = { + object: unknown; + args: Array; + returnValue?: unknown; +}; +declare class CallTracker { + track: (context: Context) => void; + any: () => boolean; + count: () => number; + argsFor: (index: number) => Array; + all: () => Array; + allArgs: () => Array; + first: () => Context; + mostRecent: () => Context; + reset: () => void; + constructor(); +} +export default CallTracker; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/CallTracker.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/CallTracker.js new file mode 100644 index 000000000..c0ce7505c --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/CallTracker.js @@ -0,0 +1,121 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +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. +*/ +class CallTracker { + constructor() { + _defineProperty(this, 'track', void 0); + + _defineProperty(this, 'any', void 0); + + _defineProperty(this, 'count', void 0); + + _defineProperty(this, 'argsFor', void 0); + + _defineProperty(this, 'all', void 0); + + _defineProperty(this, 'allArgs', void 0); + + _defineProperty(this, 'first', void 0); + + _defineProperty(this, 'mostRecent', void 0); + + _defineProperty(this, 'reset', void 0); + + let calls = []; + + this.track = function (context) { + calls.push(context); + }; + + this.any = function () { + return !!calls.length; + }; + + this.count = function () { + return calls.length; + }; + + this.argsFor = function (index) { + const call = calls[index]; + return call ? call.args : []; + }; + + this.all = function () { + return calls; + }; + + this.allArgs = function () { + const callArgs = []; + + for (let i = 0; i < calls.length; i++) { + callArgs.push(calls[i].args); + } + + return callArgs; + }; + + this.first = function () { + return calls[0]; + }; + + this.mostRecent = function () { + return calls[calls.length - 1]; + }; + + this.reset = function () { + calls = []; + }; + } +} + +var _default = CallTracker; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Env.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Env.d.ts new file mode 100644 index 000000000..5ca161244 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Env.d.ts @@ -0,0 +1,42 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { AssertionErrorWithStack, Jasmine, Reporter, Spy } from '../types'; +import type { default as Spec } from './Spec'; +import type Suite from './Suite'; +export default function (j$: Jasmine): { + new (_options?: object | undefined): { + specFilter: (spec: Spec) => boolean; + catchExceptions: (value: unknown) => boolean; + throwOnExpectationFailure: (value: unknown) => void; + catchingExceptions: () => boolean; + topSuite: () => Suite; + fail: (error: Error | AssertionErrorWithStack) => void; + pending: (message: string) => void; + afterAll: (afterAllFunction: (done: (error?: any) => void) => void, timeout?: number | undefined) => void; + fit: (description: string, fn: (done: (error?: any) => void) => void, timeout?: number | undefined) => Spec; + throwingExpectationFailures: () => boolean; + randomizeTests: (value: unknown) => void; + randomTests: () => boolean; + seed: (value: unknown) => unknown; + execute: (runnablesToRun?: string[] | undefined, suiteTree?: Suite | undefined) => Promise; + fdescribe: (description: string, specDefinitions: Function) => Suite; + spyOn: (obj: Record, methodName: string, accessType?: "get" | "set" | "writable" | "configurable" | "enumerable" | "value" | undefined) => Spy; + beforeEach: (beforeEachFunction: (done: (error?: any) => void) => void, timeout?: number | undefined) => void; + afterEach: (afterEachFunction: (done: (error?: any) => void) => void, timeout?: number | undefined) => void; + clearReporters: () => void; + addReporter: (reporterToAdd: Reporter) => void; + it: (description: string, fn: (done: (error?: any) => void) => void, timeout?: number | undefined) => Spec; + xdescribe: (description: string, specDefinitions: Function) => Suite; + xit: (description: string, fn: (done: (error?: any) => void) => void, timeout?: number | undefined) => Spec; + beforeAll: (beforeAllFunction: (done: (error?: any) => void) => void, timeout?: number | undefined) => void; + todo: () => Spec; + provideFallbackReporter: (reporterToAdd: Reporter) => void; + allowRespy: (allow: boolean) => void; + describe: (description: string, specDefinitions: Function) => Suite; + }; +}; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Env.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Env.js new file mode 100644 index 000000000..c57976077 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Env.js @@ -0,0 +1,745 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = _default; + +var _assert = require('assert'); + +var _chalk = _interopRequireDefault(require('chalk')); + +var _jestMessageUtil = require('jest-message-util'); + +var _jestUtil = require('jest-util'); + +var _queueRunner = _interopRequireDefault(require('../queueRunner')); + +var _treeProcessor = _interopRequireDefault(require('../treeProcessor')); + +var _isError = _interopRequireDefault(require('../isError')); + +var _assertionErrorMessage = _interopRequireDefault( + require('../assertionErrorMessage') +); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +function _default(j$) { + var _temp; + + return ( + (_temp = class Env { + constructor(_options) { + _defineProperty(this, 'specFilter', void 0); + + _defineProperty(this, 'catchExceptions', void 0); + + _defineProperty(this, 'throwOnExpectationFailure', void 0); + + _defineProperty(this, 'catchingExceptions', void 0); + + _defineProperty(this, 'topSuite', void 0); + + _defineProperty(this, 'fail', void 0); + + _defineProperty(this, 'pending', void 0); + + _defineProperty(this, 'afterAll', void 0); + + _defineProperty(this, 'fit', void 0); + + _defineProperty(this, 'throwingExpectationFailures', void 0); + + _defineProperty(this, 'randomizeTests', void 0); + + _defineProperty(this, 'randomTests', void 0); + + _defineProperty(this, 'seed', void 0); + + _defineProperty(this, 'execute', void 0); + + _defineProperty(this, 'fdescribe', void 0); + + _defineProperty(this, 'spyOn', void 0); + + _defineProperty(this, 'beforeEach', void 0); + + _defineProperty(this, 'afterEach', void 0); + + _defineProperty(this, 'clearReporters', void 0); + + _defineProperty(this, 'addReporter', void 0); + + _defineProperty(this, 'it', void 0); + + _defineProperty(this, 'xdescribe', void 0); + + _defineProperty(this, 'xit', void 0); + + _defineProperty(this, 'beforeAll', void 0); + + _defineProperty(this, 'todo', void 0); + + _defineProperty(this, 'provideFallbackReporter', void 0); + + _defineProperty(this, 'allowRespy', void 0); + + _defineProperty(this, 'describe', void 0); + + let totalSpecsDefined = 0; + let catchExceptions = true; + const realSetTimeout = global.setTimeout; + const realClearTimeout = global.clearTimeout; + const runnableResources = {}; + const currentlyExecutingSuites = []; + let currentSpec = null; + let throwOnExpectationFailure = false; + let random = false; + let seed = null; + let nextSpecId = 0; + let nextSuiteId = 0; + + const getNextSpecId = function () { + return 'spec' + nextSpecId++; + }; + + const getNextSuiteId = function () { + return 'suite' + nextSuiteId++; + }; + + const topSuite = new j$.Suite({ + id: getNextSuiteId(), + description: '', + + getTestPath() { + return j$.testPath; + } + }); + let currentDeclarationSuite = topSuite; + + const currentSuite = function () { + return currentlyExecutingSuites[currentlyExecutingSuites.length - 1]; + }; + + const currentRunnable = function () { + return currentSpec || currentSuite(); + }; + + const reporter = new j$.ReportDispatcher([ + 'jasmineStarted', + 'jasmineDone', + 'suiteStarted', + 'suiteDone', + 'specStarted', + 'specDone' + ]); + + this.specFilter = function () { + return true; + }; + + const defaultResourcesForRunnable = function (id, _parentRunnableId) { + const resources = { + spies: [] + }; + runnableResources[id] = resources; + }; + + const clearResourcesForRunnable = function (id) { + spyRegistry.clearSpies(); + delete runnableResources[id]; + }; + + const beforeAndAfterFns = function (suite) { + return function () { + let afters = []; + let befores = []; + + while (suite) { + befores = befores.concat(suite.beforeFns); + afters = afters.concat(suite.afterFns); + suite = suite.parentSuite; + } + + return { + befores: befores.reverse(), + afters + }; + }; + }; + + const getSpecName = function (spec, suite) { + const fullName = [spec.description]; + const suiteFullName = suite.getFullName(); + + if (suiteFullName !== '') { + fullName.unshift(suiteFullName); + } + + return fullName.join(' '); + }; + + this.catchExceptions = function (value) { + catchExceptions = !!value; + return catchExceptions; + }; + + this.catchingExceptions = function () { + return catchExceptions; + }; + + this.throwOnExpectationFailure = function (value) { + throwOnExpectationFailure = !!value; + }; + + this.throwingExpectationFailures = function () { + return throwOnExpectationFailure; + }; + + this.randomizeTests = function (value) { + random = !!value; + }; + + this.randomTests = function () { + return random; + }; + + this.seed = function (value) { + if (value) { + seed = value; + } + + return seed; + }; + + const queueRunnerFactory = options => { + options.clearTimeout = realClearTimeout; + options.fail = this.fail; + options.setTimeout = realSetTimeout; + return (0, _queueRunner.default)(options); + }; + + this.topSuite = function () { + return topSuite; + }; + + const uncaught = err => { + if (currentSpec) { + currentSpec.onException(err); + currentSpec.cancel(); + } else { + console.error('Unhandled error'); + console.error(err.stack); + } + }; + + let oldListenersException; + let oldListenersRejection; + + const executionSetup = function () { + // Need to ensure we are the only ones handling these exceptions. + oldListenersException = process + .listeners('uncaughtException') + .slice(); + oldListenersRejection = process + .listeners('unhandledRejection') + .slice(); + j$.process.removeAllListeners('uncaughtException'); + j$.process.removeAllListeners('unhandledRejection'); + j$.process.on('uncaughtException', uncaught); + j$.process.on('unhandledRejection', uncaught); + }; + + const executionTeardown = function () { + j$.process.removeListener('uncaughtException', uncaught); + j$.process.removeListener('unhandledRejection', uncaught); // restore previous exception handlers + + oldListenersException.forEach(listener => { + j$.process.on('uncaughtException', listener); + }); + oldListenersRejection.forEach(listener => { + j$.process.on('unhandledRejection', listener); + }); + }; + + this.execute = async function (runnablesToRun, suiteTree = topSuite) { + if (!runnablesToRun) { + if (focusedRunnables.length) { + runnablesToRun = focusedRunnables; + } else { + runnablesToRun = [suiteTree.id]; + } + } + + if (currentlyExecutingSuites.length === 0) { + executionSetup(); + } + + const lastDeclarationSuite = currentDeclarationSuite; + await (0, _treeProcessor.default)({ + nodeComplete(suite) { + if (!suite.disabled) { + clearResourcesForRunnable(suite.id); + } + + currentlyExecutingSuites.pop(); + + if (suite === topSuite) { + reporter.jasmineDone({ + failedExpectations: topSuite.result.failedExpectations + }); + } else { + reporter.suiteDone(suite.getResult()); + } + }, + + nodeStart(suite) { + currentlyExecutingSuites.push(suite); + defaultResourcesForRunnable( + suite.id, + suite.parentSuite && suite.parentSuite.id + ); + + if (suite === topSuite) { + reporter.jasmineStarted({ + totalSpecsDefined + }); + } else { + reporter.suiteStarted(suite.result); + } + }, + + queueRunnerFactory, + runnableIds: runnablesToRun, + tree: suiteTree + }); + currentDeclarationSuite = lastDeclarationSuite; + + if (currentlyExecutingSuites.length === 0) { + executionTeardown(); + } + }; + + this.addReporter = function (reporterToAdd) { + reporter.addReporter(reporterToAdd); + }; + + this.provideFallbackReporter = function (reporterToAdd) { + reporter.provideFallbackReporter(reporterToAdd); + }; + + this.clearReporters = function () { + reporter.clearReporters(); + }; + + const spyRegistry = new j$.SpyRegistry({ + currentSpies() { + if (!currentRunnable()) { + throw new Error( + 'Spies must be created in a before function or a spec' + ); + } + + return runnableResources[currentRunnable().id].spies; + } + }); + + this.allowRespy = function (allow) { + spyRegistry.allowRespy(allow); + }; + + this.spyOn = function (...args) { + return spyRegistry.spyOn.apply(spyRegistry, args); + }; + + const suiteFactory = function (description) { + const suite = new j$.Suite({ + id: getNextSuiteId(), + description, + parentSuite: currentDeclarationSuite, + throwOnExpectationFailure, + + getTestPath() { + return j$.testPath; + } + }); + return suite; + }; + + this.describe = function (description, specDefinitions) { + const suite = suiteFactory(description); + + if (specDefinitions === undefined) { + throw new Error( + `Missing second argument. It must be a callback function.` + ); + } + + if (typeof specDefinitions !== 'function') { + throw new Error( + `Invalid second argument, ${specDefinitions}. It must be a callback function.` + ); + } + + if (specDefinitions.length > 0) { + throw new Error('describe does not expect any arguments'); + } + + if (currentDeclarationSuite.markedPending) { + suite.pend(); + } + + if (currentDeclarationSuite.markedTodo) { + // @ts-ignore TODO Possible error: Suite does not have todo method + suite.todo(); + } + + addSpecsToSuite(suite, specDefinitions); + return suite; + }; + + this.xdescribe = function (description, specDefinitions) { + const suite = suiteFactory(description); + suite.pend(); + addSpecsToSuite(suite, specDefinitions); + return suite; + }; + + const focusedRunnables = []; + + this.fdescribe = function (description, specDefinitions) { + const suite = suiteFactory(description); + suite.isFocused = true; + focusedRunnables.push(suite.id); + unfocusAncestor(); + addSpecsToSuite(suite, specDefinitions); + return suite; + }; + + const addSpecsToSuite = (suite, specDefinitions) => { + const parentSuite = currentDeclarationSuite; + parentSuite.addChild(suite); + currentDeclarationSuite = suite; + let declarationError = undefined; + let describeReturnValue = undefined; + + try { + describeReturnValue = specDefinitions.call(suite); + } catch (e) { + declarationError = e; + } // TODO throw in Jest 25: declarationError = new Error + + if ((0, _jestUtil.isPromise)(describeReturnValue)) { + console.log( + (0, _jestMessageUtil.formatExecError)( + new Error( + _chalk.default.yellow( + 'Returning a Promise from "describe" is not supported. Tests must be defined synchronously.\n' + + 'Returning a value from "describe" will fail the test in a future version of Jest.' + ) + ), + { + rootDir: '', + testMatch: [] + }, + { + noStackTrace: false + } + ) + ); + } else if (describeReturnValue !== undefined) { + console.log( + (0, _jestMessageUtil.formatExecError)( + new Error( + _chalk.default.yellow( + 'A "describe" callback must not return a value.\n' + + 'Returning a value from "describe" will fail the test in a future version of Jest.' + ) + ), + { + rootDir: '', + testMatch: [] + }, + { + noStackTrace: false + } + ) + ); + } + + if (declarationError) { + this.it('encountered a declaration exception', () => { + throw declarationError; + }); + } + + currentDeclarationSuite = parentSuite; + }; + + function findFocusedAncestor(suite) { + while (suite) { + if (suite.isFocused) { + return suite.id; + } + + suite = suite.parentSuite; + } + + return null; + } + + function unfocusAncestor() { + const focusedAncestor = findFocusedAncestor(currentDeclarationSuite); + + if (focusedAncestor) { + for (let i = 0; i < focusedRunnables.length; i++) { + if (focusedRunnables[i] === focusedAncestor) { + focusedRunnables.splice(i, 1); + break; + } + } + } + } + + const specFactory = (description, fn, suite, timeout) => { + totalSpecsDefined++; + const spec = new j$.Spec({ + id: getNextSpecId(), + beforeAndAfterFns: beforeAndAfterFns(suite), + resultCallback: specResultCallback, + + getSpecName(spec) { + return getSpecName(spec, suite); + }, + + getTestPath() { + return j$.testPath; + }, + + onStart: specStarted, + description, + queueRunnerFactory, + + userContext() { + return suite.clonedSharedUserContext(); + }, + + queueableFn: { + fn, + + timeout() { + return timeout || j$._DEFAULT_TIMEOUT_INTERVAL; + } + }, + throwOnExpectationFailure + }); + + if (!this.specFilter(spec)) { + spec.disable(); + } + + return spec; + + function specResultCallback(result) { + clearResourcesForRunnable(spec.id); + currentSpec = null; + reporter.specDone(result); + } + + function specStarted(spec) { + currentSpec = spec; + defaultResourcesForRunnable(spec.id, suite.id); + reporter.specStarted(spec.result); + } + }; + + this.it = function (description, fn, timeout) { + if (typeof description !== 'string') { + throw new Error( + `Invalid first argument, ${description}. It must be a string.` + ); + } + + if (fn === undefined) { + throw new Error( + 'Missing second argument. It must be a callback function. Perhaps you want to use `test.todo` for a test placeholder.' + ); + } + + if (typeof fn !== 'function') { + throw new Error( + `Invalid second argument, ${fn}. It must be a callback function.` + ); + } + + const spec = specFactory( + description, + fn, + currentDeclarationSuite, + timeout + ); + + if (currentDeclarationSuite.markedPending) { + spec.pend(); + } // When a test is defined inside another, jasmine will not run it. + // This check throws an error to warn the user about the edge-case. + + if (currentSpec !== null) { + throw new Error( + `Tests cannot be nested. Test "${spec.description}" cannot run because it is nested within "${currentSpec.description}".` + ); + } + + currentDeclarationSuite.addChild(spec); + return spec; + }; + + this.xit = function (...args) { + const spec = this.it.apply(this, args); + spec.pend('Temporarily disabled with xit'); + return spec; + }; + + this.todo = function () { + const description = arguments[0]; + + if (arguments.length !== 1 || typeof description !== 'string') { + throw new _jestUtil.ErrorWithStack( + 'Todo must be called with only a description.', + this.todo + ); + } + + const spec = specFactory( + description, + () => {}, + currentDeclarationSuite + ); + spec.todo(); + currentDeclarationSuite.addChild(spec); + return spec; + }; + + this.fit = function (description, fn, timeout) { + const spec = specFactory( + description, + fn, + currentDeclarationSuite, + timeout + ); + currentDeclarationSuite.addChild(spec); + focusedRunnables.push(spec.id); + unfocusAncestor(); + return spec; + }; + + this.beforeEach = function (beforeEachFunction, timeout) { + currentDeclarationSuite.beforeEach({ + fn: beforeEachFunction, + + timeout() { + return timeout || j$._DEFAULT_TIMEOUT_INTERVAL; + } + }); + }; + + this.beforeAll = function (beforeAllFunction, timeout) { + currentDeclarationSuite.beforeAll({ + fn: beforeAllFunction, + + timeout() { + return timeout || j$._DEFAULT_TIMEOUT_INTERVAL; + } + }); + }; + + this.afterEach = function (afterEachFunction, timeout) { + currentDeclarationSuite.afterEach({ + fn: afterEachFunction, + + timeout() { + return timeout || j$._DEFAULT_TIMEOUT_INTERVAL; + } + }); + }; + + this.afterAll = function (afterAllFunction, timeout) { + currentDeclarationSuite.afterAll({ + fn: afterAllFunction, + + timeout() { + return timeout || j$._DEFAULT_TIMEOUT_INTERVAL; + } + }); + }; + + this.pending = function (message) { + let fullMessage = j$.Spec.pendingSpecExceptionMessage; + + if (message) { + fullMessage += message; + } + + throw fullMessage; + }; + + this.fail = function (error) { + let checkIsError; + let message; + + if ( + error instanceof _assert.AssertionError || + (error && error.name === _assert.AssertionError.name) + ) { + checkIsError = false; // @ts-ignore TODO Possible error: j$.Spec does not have expand property + + message = (0, _assertionErrorMessage.default)(error, { + expand: j$.Spec.expand + }); + } else { + const check = (0, _isError.default)(error); + checkIsError = check.isError; + message = check.message; + } + + const errorAsErrorObject = checkIsError ? error : new Error(message); + const runnable = currentRunnable(); + + if (!runnable) { + errorAsErrorObject.message = + 'Caught error after test environment was torn down\n\n' + + errorAsErrorObject.message; + throw errorAsErrorObject; + } + + runnable.addExpectationResult(false, { + matcherName: '', + passed: false, + expected: '', + actual: '', + message, + error: errorAsErrorObject + }); + }; + } + }), + _temp + ); +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/JsApiReporter.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/JsApiReporter.d.ts new file mode 100644 index 000000000..ece0b732d --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/JsApiReporter.d.ts @@ -0,0 +1,31 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Reporter, RunDetails } from '../types'; +import type { SpecResult } from './Spec'; +import type { SuiteResult } from './Suite'; +import type Timer from './Timer'; +export default class JsApiReporter implements Reporter { + started: boolean; + finished: boolean; + runDetails: RunDetails; + jasmineStarted: (runDetails: RunDetails) => void; + jasmineDone: (runDetails: RunDetails) => void; + status: () => unknown; + executionTime: () => unknown; + suiteStarted: (result: SuiteResult) => void; + suiteDone: (result: SuiteResult) => void; + suiteResults: (index: number, length: number) => Array; + suites: () => Record; + specResults: (index: number, length: number) => Array; + specDone: (result: SpecResult) => void; + specs: () => Array; + specStarted: (spec: SpecResult) => void; + constructor(options: { + timer?: Timer; + }); +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/JsApiReporter.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/JsApiReporter.js new file mode 100644 index 000000000..982f4469d --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/JsApiReporter.js @@ -0,0 +1,173 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* eslint-disable sort-keys */ +const noopTimer = { + start() {}, + + elapsed() { + return 0; + } +}; + +class JsApiReporter { + constructor(options) { + _defineProperty(this, 'started', void 0); + + _defineProperty(this, 'finished', void 0); + + _defineProperty(this, 'runDetails', void 0); + + _defineProperty(this, 'jasmineStarted', void 0); + + _defineProperty(this, 'jasmineDone', void 0); + + _defineProperty(this, 'status', void 0); + + _defineProperty(this, 'executionTime', void 0); + + _defineProperty(this, 'suiteStarted', void 0); + + _defineProperty(this, 'suiteDone', void 0); + + _defineProperty(this, 'suiteResults', void 0); + + _defineProperty(this, 'suites', void 0); + + _defineProperty(this, 'specResults', void 0); + + _defineProperty(this, 'specDone', void 0); + + _defineProperty(this, 'specs', void 0); + + _defineProperty(this, 'specStarted', void 0); + + const timer = options.timer || noopTimer; + let status = 'loaded'; + this.started = false; + this.finished = false; + this.runDetails = {}; + + this.jasmineStarted = () => { + this.started = true; + status = 'started'; + timer.start(); + }; + + let executionTime; + + function validateAfterAllExceptions({failedExpectations}) { + if (failedExpectations && failedExpectations.length > 0) { + throw failedExpectations[0]; + } + } + + this.jasmineDone = function (runDetails) { + validateAfterAllExceptions(runDetails); + this.finished = true; + this.runDetails = runDetails; + executionTime = timer.elapsed(); + status = 'done'; + }; + + this.status = function () { + return status; + }; + + const suites = []; + const suites_hash = {}; + + this.specStarted = function () {}; + + this.suiteStarted = function (result) { + suites_hash[result.id] = result; + }; + + this.suiteDone = function (result) { + storeSuite(result); + }; + + this.suiteResults = function (index, length) { + return suites.slice(index, index + length); + }; + + function storeSuite(result) { + suites.push(result); + suites_hash[result.id] = result; + } + + this.suites = function () { + return suites_hash; + }; + + const specs = []; + + this.specDone = function (result) { + specs.push(result); + }; + + this.specResults = function (index, length) { + return specs.slice(index, index + length); + }; + + this.specs = function () { + return specs; + }; + + this.executionTime = function () { + return executionTime; + }; + } +} + +exports.default = JsApiReporter; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.d.ts new file mode 100644 index 000000000..9f89d05c7 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.d.ts @@ -0,0 +1,22 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Reporter, RunDetails } from '../types'; +import type { SpecResult } from './Spec'; +import type { SuiteResult } from './Suite'; +export default class ReportDispatcher implements Reporter { + addReporter: (reporter: Reporter) => void; + provideFallbackReporter: (reporter: Reporter) => void; + clearReporters: () => void; + jasmineDone: (runDetails: RunDetails) => void; + jasmineStarted: (runDetails: RunDetails) => void; + specDone: (result: SpecResult) => void; + specStarted: (spec: SpecResult) => void; + suiteDone: (result: SuiteResult) => void; + suiteStarted: (result: SuiteResult) => void; + constructor(methods: Array); +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.js new file mode 100644 index 000000000..730e76b37 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.js @@ -0,0 +1,125 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +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. +*/ +class ReportDispatcher { + // @ts-ignore + // @ts-ignore + // @ts-ignore + // @ts-ignore + // @ts-ignore + // @ts-ignore + constructor(methods) { + _defineProperty(this, 'addReporter', void 0); + + _defineProperty(this, 'provideFallbackReporter', void 0); + + _defineProperty(this, 'clearReporters', void 0); + + _defineProperty(this, 'jasmineDone', void 0); + + _defineProperty(this, 'jasmineStarted', void 0); + + _defineProperty(this, 'specDone', void 0); + + _defineProperty(this, 'specStarted', void 0); + + _defineProperty(this, 'suiteDone', void 0); + + _defineProperty(this, 'suiteStarted', void 0); + + const dispatchedMethods = methods || []; + + for (let i = 0; i < dispatchedMethods.length; i++) { + const method = dispatchedMethods[i]; + + this[method] = (function (m) { + return function () { + dispatch(m, arguments); + }; + })(method); + } + + let reporters = []; + let fallbackReporter = null; + + this.addReporter = function (reporter) { + reporters.push(reporter); + }; + + this.provideFallbackReporter = function (reporter) { + fallbackReporter = reporter; + }; + + this.clearReporters = function () { + reporters = []; + }; + + return this; + + function dispatch(method, args) { + if (reporters.length === 0 && fallbackReporter !== null) { + reporters.push(fallbackReporter); + } + + for (let i = 0; i < reporters.length; i++) { + const reporter = reporters[i]; + + if (reporter[method]) { + // @ts-ignore + reporter[method].apply(reporter, args); + } + } + } + } +} + +exports.default = ReportDispatcher; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Spec.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Spec.d.ts new file mode 100644 index 000000000..1b8ed45e1 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Spec.d.ts @@ -0,0 +1,81 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Config } from '@jest/types'; +import type { FailedAssertion, Milliseconds, Status } from '@jest/test-result'; +import ExpectationFailed from '../ExpectationFailed'; +import expectationResultFactory, { Options as ExpectationResultFactoryOptions } from '../expectationResultFactory'; +import type { QueueableFn, default as queueRunner } from '../queueRunner'; +import type { AssertionErrorWithStack } from '../types'; +export declare type Attributes = { + id: string; + resultCallback: (result: Spec['result']) => void; + description: string; + throwOnExpectationFailure: unknown; + getTestPath: () => Config.Path; + queueableFn: QueueableFn; + beforeAndAfterFns: () => { + befores: Array; + afters: Array; + }; + userContext: () => unknown; + onStart: (context: Spec) => void; + getSpecName: (spec: Spec) => string; + queueRunnerFactory: typeof queueRunner; +}; +export declare type SpecResult = { + id: string; + description: string; + fullName: string; + duration?: Milliseconds; + failedExpectations: Array; + testPath: Config.Path; + passedExpectations: Array>; + pendingReason: string; + status: Status; + __callsite?: { + getColumnNumber: () => number; + getLineNumber: () => number; + }; +}; +export default class Spec { + id: string; + description: string; + resultCallback: (result: SpecResult) => void; + queueableFn: QueueableFn; + beforeAndAfterFns: () => { + befores: Array; + afters: Array; + }; + userContext: () => unknown; + onStart: (spec: Spec) => void; + getSpecName: (spec: Spec) => string; + queueRunnerFactory: typeof queueRunner; + throwOnExpectationFailure: boolean; + initError: Error; + result: SpecResult; + disabled?: boolean; + currentRun?: ReturnType; + markedTodo?: boolean; + markedPending?: boolean; + expand?: boolean; + static pendingSpecExceptionMessage: string; + static isPendingSpecException(e: Error): boolean; + constructor(attrs: Attributes); + addExpectationResult(passed: boolean, data: ExpectationResultFactoryOptions, isError?: boolean): void; + execute(onComplete: Function, enabled: boolean): void; + cancel(): void; + onException(error: ExpectationFailed | AssertionErrorWithStack): void; + disable(): void; + pend(message?: string): void; + todo(): void; + getResult(): SpecResult; + status(enabled?: boolean): "todo" | "passed" | "failed" | "pending" | "disabled"; + isExecutable(): boolean; + getFullName(): string; + isAssertionError(error: Error): boolean; +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Spec.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Spec.js new file mode 100644 index 000000000..6fb658bda --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Spec.js @@ -0,0 +1,298 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _assert = require('assert'); + +var _ExpectationFailed = _interopRequireDefault( + require('../ExpectationFailed') +); + +var _expectationResultFactory = _interopRequireDefault( + require('../expectationResultFactory') +); + +var _assertionErrorMessage = _interopRequireDefault( + require('../assertionErrorMessage') +); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +class Spec { + static isPendingSpecException(e) { + return !!( + e && + e.toString && + e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1 + ); + } + + constructor(attrs) { + _defineProperty(this, 'id', void 0); + + _defineProperty(this, 'description', void 0); + + _defineProperty(this, 'resultCallback', void 0); + + _defineProperty(this, 'queueableFn', void 0); + + _defineProperty(this, 'beforeAndAfterFns', void 0); + + _defineProperty(this, 'userContext', void 0); + + _defineProperty(this, 'onStart', void 0); + + _defineProperty(this, 'getSpecName', void 0); + + _defineProperty(this, 'queueRunnerFactory', void 0); + + _defineProperty(this, 'throwOnExpectationFailure', void 0); + + _defineProperty(this, 'initError', void 0); + + _defineProperty(this, 'result', void 0); + + _defineProperty(this, 'disabled', void 0); + + _defineProperty(this, 'currentRun', void 0); + + _defineProperty(this, 'markedTodo', void 0); + + _defineProperty(this, 'markedPending', void 0); + + _defineProperty(this, 'expand', void 0); + + this.resultCallback = attrs.resultCallback || function () {}; + + this.id = attrs.id; + this.description = attrs.description || ''; + this.queueableFn = attrs.queueableFn; + + this.beforeAndAfterFns = + attrs.beforeAndAfterFns || + function () { + return { + befores: [], + afters: [] + }; + }; + + this.userContext = + attrs.userContext || + function () { + return {}; + }; + + this.onStart = attrs.onStart || function () {}; + + this.getSpecName = + attrs.getSpecName || + function () { + return ''; + }; + + this.queueRunnerFactory = attrs.queueRunnerFactory || function () {}; + + this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure; + this.initError = new Error(); + this.initError.name = ''; // Without this line v8 stores references to all closures + // in the stack in the Error object. This line stringifies the stack + // property to allow garbage-collecting objects on the stack + // https://crbug.com/v8/7142 + + this.initError.stack = this.initError.stack; + this.queueableFn.initError = this.initError; // @ts-ignore + + this.result = { + id: this.id, + description: this.description, + fullName: this.getFullName(), + failedExpectations: [], + passedExpectations: [], + pendingReason: '', + testPath: attrs.getTestPath() + }; + } + + addExpectationResult(passed, data, isError) { + const expectationResult = (0, _expectationResultFactory.default)( + data, + this.initError + ); + + if (passed) { + this.result.passedExpectations.push(expectationResult); + } else { + this.result.failedExpectations.push(expectationResult); + + if (this.throwOnExpectationFailure && !isError) { + throw new _ExpectationFailed.default(); + } + } + } + + execute(onComplete, enabled) { + const self = this; + this.onStart(this); + + if ( + !this.isExecutable() || + this.markedPending || + this.markedTodo || + enabled === false + ) { + complete(enabled); + return; + } + + const fns = this.beforeAndAfterFns(); + const allFns = fns.befores.concat(this.queueableFn).concat(fns.afters); + this.currentRun = this.queueRunnerFactory({ + queueableFns: allFns, + + onException() { + // @ts-ignore + self.onException.apply(self, arguments); + }, + + userContext: this.userContext(), + setTimeout, + clearTimeout, + fail: () => {} + }); + this.currentRun.then(() => complete(true)); + + function complete(enabledAgain) { + self.result.status = self.status(enabledAgain); + self.resultCallback(self.result); + + if (onComplete) { + onComplete(); + } + } + } + + cancel() { + if (this.currentRun) { + this.currentRun.cancel(); + } + } + + onException(error) { + if (Spec.isPendingSpecException(error)) { + this.pend(extractCustomPendingMessage(error)); + return; + } + + if (error instanceof _ExpectationFailed.default) { + return; + } + + this.addExpectationResult( + false, + { + matcherName: '', + passed: false, + expected: '', + actual: '', + error: this.isAssertionError(error) + ? (0, _assertionErrorMessage.default)(error, { + expand: this.expand + }) + : error + }, + true + ); + } + + disable() { + this.disabled = true; + } + + pend(message) { + this.markedPending = true; + + if (message) { + this.result.pendingReason = message; + } + } + + todo() { + this.markedTodo = true; + } + + getResult() { + this.result.status = this.status(); + return this.result; + } + + status(enabled) { + if (this.disabled || enabled === false) { + return 'disabled'; + } + + if (this.markedTodo) { + return 'todo'; + } + + if (this.markedPending) { + return 'pending'; + } + + if (this.result.failedExpectations.length > 0) { + return 'failed'; + } else { + return 'passed'; + } + } + + isExecutable() { + return !this.disabled; + } + + getFullName() { + return this.getSpecName(this); + } + + isAssertionError(error) { + return ( + error instanceof _assert.AssertionError || + (error && error.name === _assert.AssertionError.name) + ); + } +} + +exports.default = Spec; + +_defineProperty(Spec, 'pendingSpecExceptionMessage', void 0); + +Spec.pendingSpecExceptionMessage = '=> marked Pending'; + +const extractCustomPendingMessage = function (e) { + const fullMessage = e.toString(); + const boilerplateStart = fullMessage.indexOf( + Spec.pendingSpecExceptionMessage + ); + const boilerplateEnd = + boilerplateStart + Spec.pendingSpecExceptionMessage.length; + return fullMessage.substr(boilerplateEnd); +}; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/SpyStrategy.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/SpyStrategy.d.ts new file mode 100644 index 000000000..a54754d42 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/SpyStrategy.d.ts @@ -0,0 +1,22 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +export default class SpyStrategy { + identity: () => string; + exec: (...args: Array) => unknown; + callThrough: () => unknown; + returnValue: (value: unknown) => unknown; + returnValues: () => unknown; + throwError: (something: string | Error) => unknown; + callFake: (fn: Function) => unknown; + stub: (fn: Function) => unknown; + constructor({ name, fn, getSpy, }?: { + name?: string; + fn?: Function; + getSpy?: () => unknown; + }); +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/SpyStrategy.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/SpyStrategy.js new file mode 100644 index 000000000..ce1679452 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/SpyStrategy.js @@ -0,0 +1,141 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +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. +*/ +class SpyStrategy { + constructor({ + name = 'unknown', + fn = function () {}, + getSpy = function () {} + } = {}) { + _defineProperty(this, 'identity', void 0); + + _defineProperty(this, 'exec', void 0); + + _defineProperty(this, 'callThrough', void 0); + + _defineProperty(this, 'returnValue', void 0); + + _defineProperty(this, 'returnValues', void 0); + + _defineProperty(this, 'throwError', void 0); + + _defineProperty(this, 'callFake', void 0); + + _defineProperty(this, 'stub', void 0); + + const identity = name; + const originalFn = fn; + + let plan = function () {}; + + this.identity = function () { + return identity; + }; + + this.exec = function () { + return plan.apply(this, arguments); + }; + + this.callThrough = function () { + plan = originalFn; + return getSpy(); + }; + + this.returnValue = function (value) { + plan = function () { + return value; + }; + + return getSpy(); + }; + + this.returnValues = function () { + const values = Array.prototype.slice.call(arguments); + + plan = function () { + return values.shift(); + }; + + return getSpy(); + }; + + this.throwError = function (something) { + const error = + something instanceof Error ? something : new Error(something); + + plan = function () { + throw error; + }; + + return getSpy(); + }; + + this.callFake = function (fn) { + if (typeof fn !== 'function') { + throw new Error( + 'Argument passed to callFake should be a function, got ' + fn + ); + } + + plan = fn; + return getSpy(); + }; + + this.stub = function (_fn) { + plan = function () {}; + + return getSpy(); + }; + } +} + +exports.default = SpyStrategy; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Suite.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Suite.d.ts new file mode 100644 index 000000000..7bfd374e0 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Suite.d.ts @@ -0,0 +1,61 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Config } from '@jest/types'; +import expectationResultFactory from '../expectationResultFactory'; +import type { QueueableFn } from '../queueRunner'; +import type Spec from './Spec'; +export declare type SuiteResult = { + id: string; + description: string; + fullName: string; + failedExpectations: Array>; + testPath: Config.Path; + status?: string; +}; +export declare type Attributes = { + id: string; + parentSuite?: Suite; + description: string; + throwOnExpectationFailure?: boolean; + getTestPath: () => Config.Path; +}; +export default class Suite { + id: string; + parentSuite?: Suite; + description: string; + throwOnExpectationFailure: boolean; + beforeFns: Array; + afterFns: Array; + beforeAllFns: Array; + afterAllFns: Array; + disabled: boolean; + children: Array; + result: SuiteResult; + sharedContext?: object; + markedPending: boolean; + markedTodo: boolean; + isFocused: boolean; + constructor(attrs: Attributes); + getFullName(): string; + disable(): void; + pend(_message?: string): void; + beforeEach(fn: QueueableFn): void; + beforeAll(fn: QueueableFn): void; + afterEach(fn: QueueableFn): void; + afterAll(fn: QueueableFn): void; + addChild(child: Suite | Spec): void; + status(): "failed" | "pending" | "disabled" | "finished"; + isExecutable(): boolean; + canBeReentered(): boolean; + getResult(): SuiteResult; + sharedUserContext(): object; + clonedSharedUserContext(): object; + onException(...args: Parameters): void; + addExpectationResult(...args: Parameters): void; + execute(..._args: Array): void; +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Suite.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Suite.js new file mode 100644 index 000000000..f1a505121 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Suite.js @@ -0,0 +1,235 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _jestUtil = require('jest-util'); + +var _ExpectationFailed = _interopRequireDefault( + require('../ExpectationFailed') +); + +var _expectationResultFactory = _interopRequireDefault( + require('../expectationResultFactory') +); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +class Suite { + constructor(attrs) { + _defineProperty(this, 'id', void 0); + + _defineProperty(this, 'parentSuite', void 0); + + _defineProperty(this, 'description', void 0); + + _defineProperty(this, 'throwOnExpectationFailure', void 0); + + _defineProperty(this, 'beforeFns', void 0); + + _defineProperty(this, 'afterFns', void 0); + + _defineProperty(this, 'beforeAllFns', void 0); + + _defineProperty(this, 'afterAllFns', void 0); + + _defineProperty(this, 'disabled', void 0); + + _defineProperty(this, 'children', void 0); + + _defineProperty(this, 'result', void 0); + + _defineProperty(this, 'sharedContext', void 0); + + _defineProperty(this, 'markedPending', void 0); + + _defineProperty(this, 'markedTodo', void 0); + + _defineProperty(this, 'isFocused', void 0); + + this.markedPending = false; + this.markedTodo = false; + this.isFocused = false; + this.id = attrs.id; + this.parentSuite = attrs.parentSuite; + this.description = (0, _jestUtil.convertDescriptorToString)( + attrs.description + ); + this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure; + this.beforeFns = []; + this.afterFns = []; + this.beforeAllFns = []; + this.afterAllFns = []; + this.disabled = false; + this.children = []; + this.result = { + id: this.id, + description: this.description, + fullName: this.getFullName(), + failedExpectations: [], + testPath: attrs.getTestPath() + }; + } + + getFullName() { + const fullName = []; + + for ( + let parentSuite = this; + parentSuite; + parentSuite = parentSuite.parentSuite + ) { + if (parentSuite.parentSuite) { + fullName.unshift(parentSuite.description); + } + } + + return fullName.join(' '); + } + + disable() { + this.disabled = true; + } + + pend(_message) { + this.markedPending = true; + } + + beforeEach(fn) { + this.beforeFns.unshift(fn); + } + + beforeAll(fn) { + this.beforeAllFns.push(fn); + } + + afterEach(fn) { + this.afterFns.unshift(fn); + } + + afterAll(fn) { + this.afterAllFns.unshift(fn); + } + + addChild(child) { + this.children.push(child); + } + + status() { + if (this.disabled) { + return 'disabled'; + } + + if (this.markedPending) { + return 'pending'; + } + + if (this.result.failedExpectations.length > 0) { + return 'failed'; + } else { + return 'finished'; + } + } + + isExecutable() { + return !this.disabled; + } + + canBeReentered() { + return this.beforeAllFns.length === 0 && this.afterAllFns.length === 0; + } + + getResult() { + this.result.status = this.status(); + return this.result; + } + + sharedUserContext() { + if (!this.sharedContext) { + this.sharedContext = {}; + } + + return this.sharedContext; + } + + clonedSharedUserContext() { + return this.sharedUserContext(); + } + + onException(...args) { + if (args[0] instanceof _ExpectationFailed.default) { + return; + } + + if (isAfterAll(this.children)) { + const data = { + matcherName: '', + passed: false, + expected: '', + actual: '', + error: arguments[0] + }; + this.result.failedExpectations.push( + (0, _expectationResultFactory.default)(data) + ); + } else { + for (let i = 0; i < this.children.length; i++) { + const child = this.children[i]; + child.onException.apply(child, args); + } + } + } + + addExpectationResult(...args) { + if (isAfterAll(this.children) && isFailure(args)) { + const data = args[1]; + this.result.failedExpectations.push( + (0, _expectationResultFactory.default)(data) + ); + + if (this.throwOnExpectationFailure) { + throw new _ExpectationFailed.default(); + } + } else { + for (let i = 0; i < this.children.length; i++) { + const child = this.children[i]; + + try { + child.addExpectationResult.apply(child, args); + } catch (e) { + // keep going + } + } + } + } + + execute(..._args) {} +} + +exports.default = Suite; + +function isAfterAll(children) { + return children && children[0] && children[0].result.status; +} + +function isFailure(args) { + return !args[0]; +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Timer.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Timer.d.ts new file mode 100644 index 000000000..17c97e615 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Timer.d.ts @@ -0,0 +1,14 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +export default class Timer { + start: () => void; + elapsed: () => number; + constructor(options?: { + now?: () => number; + }); +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Timer.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Timer.js new file mode 100644 index 000000000..61839408e --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/Timer.js @@ -0,0 +1,79 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +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. +*/ +const defaultNow = (function (Date) { + return function () { + return new Date().getTime(); + }; +})(Date); + +class Timer { + constructor(options) { + _defineProperty(this, 'start', void 0); + + _defineProperty(this, 'elapsed', void 0); + + options = options || {}; + const now = options.now || defaultNow; + let startTime; + + this.start = function () { + startTime = now(); + }; + + this.elapsed = function () { + return now() - startTime; + }; + } +} + +exports.default = Timer; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/createSpy.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/createSpy.d.ts new file mode 100644 index 000000000..5f23ea9fb --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/createSpy.d.ts @@ -0,0 +1,13 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Spy } from '../types'; +interface Fn extends Record { + (): any; +} +declare function createSpy(name: string, originalFn: Fn): Spy; +export default createSpy; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/createSpy.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/createSpy.js new file mode 100644 index 000000000..44f487aa3 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/createSpy.js @@ -0,0 +1,88 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _CallTracker = _interopRequireDefault(require('./CallTracker')); + +var _SpyStrategy = _interopRequireDefault(require('./SpyStrategy')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* eslint-disable sort-keys */ +function createSpy(name, originalFn) { + const spyStrategy = new _SpyStrategy.default({ + name, + fn: originalFn, + + getSpy() { + return spy; + } + }); + const callTracker = new _CallTracker.default(); + + const spy = function (...args) { + const callData = { + object: this, + args: Array.prototype.slice.apply(arguments) + }; + callTracker.track(callData); + const returnValue = spyStrategy.exec.apply(this, args); + callData.returnValue = returnValue; + return returnValue; + }; + + for (const prop in originalFn) { + if (prop === 'and' || prop === 'calls') { + throw new Error( + "Jasmine spies would overwrite the 'and' and 'calls' properties " + + 'on the object being spied upon' + ); + } + + spy[prop] = originalFn[prop]; + } + + spy.and = spyStrategy; + spy.calls = callTracker; + return spy; +} + +var _default = createSpy; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/jasmineLight.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/jasmineLight.d.ts new file mode 100644 index 000000000..649a15a83 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/jasmineLight.d.ts @@ -0,0 +1,27 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Jasmine } from '../types'; +import JsApiReporter from './JsApiReporter'; +export declare const create: (createOptions: Record) => Jasmine; +export declare const _interface: (jasmine: Jasmine, env: any) => { + describe(description: string, specDefinitions: Function): any; + xdescribe(description: string, specDefinitions: Function): any; + fdescribe(description: string, specDefinitions: Function): any; + it(): any; + xit(): any; + fit(): any; + beforeEach(): any; + afterEach(): any; + beforeAll(): any; + afterAll(): any; + pending(): any; + fail(): any; + spyOn(obj: Record, methodName: string, accessType?: string | undefined): any; + jsApiReporter: JsApiReporter; + jasmine: Jasmine; +}; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/jasmineLight.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/jasmineLight.js new file mode 100644 index 000000000..2ea6a0cb6 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/jasmineLight.js @@ -0,0 +1,171 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports._interface = exports.create = void 0; + +var _createSpy = _interopRequireDefault(require('./createSpy')); + +var _Env = _interopRequireDefault(require('./Env')); + +var _JsApiReporter = _interopRequireDefault(require('./JsApiReporter')); + +var _ReportDispatcher = _interopRequireDefault(require('./ReportDispatcher')); + +var _Spec = _interopRequireDefault(require('./Spec')); + +var _spyRegistry = _interopRequireDefault(require('./spyRegistry')); + +var _Suite = _interopRequireDefault(require('./Suite')); + +var _Timer = _interopRequireDefault(require('./Timer')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* eslint-disable sort-keys */ +const create = function (createOptions) { + const j$ = {...createOptions}; + j$._DEFAULT_TIMEOUT_INTERVAL = createOptions.testTimeout || 5000; + + j$.getEnv = function (options) { + const env = (j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options)); //jasmine. singletons in here (setTimeout blah blah). + + return env; + }; + + j$.createSpy = _createSpy.default; + j$.Env = (0, _Env.default)(j$); + j$.JsApiReporter = _JsApiReporter.default; + j$.ReportDispatcher = _ReportDispatcher.default; + j$.Spec = _Spec.default; + j$.SpyRegistry = _spyRegistry.default; + j$.Suite = _Suite.default; + j$.Timer = _Timer.default; + j$.version = '2.5.2-light'; + return j$; +}; // Interface is a reserved word in strict mode, so can't export it as ESM + +exports.create = create; + +const _interface = function (jasmine, env) { + const jasmineInterface = { + describe(description, specDefinitions) { + return env.describe(description, specDefinitions); + }, + + xdescribe(description, specDefinitions) { + return env.xdescribe(description, specDefinitions); + }, + + fdescribe(description, specDefinitions) { + return env.fdescribe(description, specDefinitions); + }, + + it() { + return env.it.apply(env, arguments); + }, + + xit() { + return env.xit.apply(env, arguments); + }, + + fit() { + return env.fit.apply(env, arguments); + }, + + beforeEach() { + if (typeof arguments[0] !== 'function') { + throw new Error( + 'Invalid first argument. It must be a callback function.' + ); + } + + return env.beforeEach.apply(env, arguments); + }, + + afterEach() { + if (typeof arguments[0] !== 'function') { + throw new Error( + 'Invalid first argument. It must be a callback function.' + ); + } + + return env.afterEach.apply(env, arguments); + }, + + beforeAll() { + if (typeof arguments[0] !== 'function') { + throw new Error( + 'Invalid first argument. It must be a callback function.' + ); + } + + return env.beforeAll.apply(env, arguments); + }, + + afterAll() { + if (typeof arguments[0] !== 'function') { + throw new Error( + 'Invalid first argument. It must be a callback function.' + ); + } + + return env.afterAll.apply(env, arguments); + }, + + pending() { + return env.pending.apply(env, arguments); + }, + + fail() { + return env.fail.apply(env, arguments); + }, + + spyOn(obj, methodName, accessType) { + return env.spyOn(obj, methodName, accessType); + }, + + jsApiReporter: new jasmine.JsApiReporter({ + timer: new jasmine.Timer() + }), + jasmine + }; + return jasmineInterface; +}; + +exports._interface = _interface; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/spyRegistry.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/spyRegistry.d.ts new file mode 100644 index 000000000..c5f215c31 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/spyRegistry.d.ts @@ -0,0 +1,18 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Spy } from '../types'; +export default class SpyRegistry { + allowRespy: (allow: unknown) => void; + spyOn: (obj: Record, methodName: string, accessType?: keyof PropertyDescriptor) => Spy; + clearSpies: () => void; + respy: unknown; + private _spyOnProperty; + constructor({ currentSpies, }?: { + currentSpies?: () => Array; + }); +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/spyRegistry.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/spyRegistry.js new file mode 100644 index 000000000..6109ae30d --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmine/spyRegistry.js @@ -0,0 +1,222 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _CallTracker = _interopRequireDefault(require('./CallTracker')); + +var _createSpy = _interopRequireDefault(require('./createSpy')); + +var _SpyStrategy = _interopRequireDefault(require('./SpyStrategy')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +const formatErrorMsg = (domain, usage) => { + const usageDefinition = usage ? '\nUsage: ' + usage : ''; + return msg => domain + ' : ' + msg + usageDefinition; +}; + +function isSpy(putativeSpy) { + if (!putativeSpy) { + return false; + } + + return ( + putativeSpy.and instanceof _SpyStrategy.default && + putativeSpy.calls instanceof _CallTracker.default + ); +} + +const getErrorMsg = formatErrorMsg('', 'spyOn(, )'); + +class SpyRegistry { + constructor({currentSpies = () => []} = {}) { + _defineProperty(this, 'allowRespy', void 0); + + _defineProperty(this, 'spyOn', void 0); + + _defineProperty(this, 'clearSpies', void 0); + + _defineProperty(this, 'respy', void 0); + + _defineProperty(this, '_spyOnProperty', void 0); + + this.allowRespy = function (allow) { + this.respy = allow; + }; + + this.spyOn = (obj, methodName, accessType) => { + if (accessType) { + return this._spyOnProperty(obj, methodName, accessType); + } + + if (obj === void 0) { + throw new Error( + getErrorMsg( + 'could not find an object to spy upon for ' + methodName + '()' + ) + ); + } + + if (methodName === void 0) { + throw new Error(getErrorMsg('No method name supplied')); + } + + if (obj[methodName] === void 0) { + throw new Error(getErrorMsg(methodName + '() method does not exist')); + } + + if (obj[methodName] && isSpy(obj[methodName])) { + if (this.respy) { + return obj[methodName]; + } else { + throw new Error( + getErrorMsg(methodName + ' has already been spied upon') + ); + } + } + + let descriptor; + + try { + descriptor = Object.getOwnPropertyDescriptor(obj, methodName); + } catch (e) { + // IE 8 doesn't support `definePropery` on non-DOM nodes + } + + if (descriptor && !(descriptor.writable || descriptor.set)) { + throw new Error( + getErrorMsg(methodName + ' is not declared writable or has no setter') + ); + } + + const originalMethod = obj[methodName]; + const spiedMethod = (0, _createSpy.default)(methodName, originalMethod); + let restoreStrategy; + + if (Object.prototype.hasOwnProperty.call(obj, methodName)) { + restoreStrategy = function () { + obj[methodName] = originalMethod; + }; + } else { + restoreStrategy = function () { + if (!delete obj[methodName]) { + obj[methodName] = originalMethod; + } + }; + } + + currentSpies().push({ + restoreObjectToOriginalState: restoreStrategy + }); + obj[methodName] = spiedMethod; + return spiedMethod; + }; + + this._spyOnProperty = function (obj, propertyName, accessType = 'get') { + if (!obj) { + throw new Error( + getErrorMsg( + 'could not find an object to spy upon for ' + propertyName + ) + ); + } + + if (!propertyName) { + throw new Error(getErrorMsg('No property name supplied')); + } + + let descriptor; + + try { + descriptor = Object.getOwnPropertyDescriptor(obj, propertyName); + } catch (e) { + // IE 8 doesn't support `definePropery` on non-DOM nodes + } + + if (!descriptor) { + throw new Error(getErrorMsg(propertyName + ' property does not exist')); + } + + if (!descriptor.configurable) { + throw new Error( + getErrorMsg(propertyName + ' is not declared configurable') + ); + } + + if (!descriptor[accessType]) { + throw new Error( + getErrorMsg( + 'Property ' + + propertyName + + ' does not have access type ' + + accessType + ) + ); + } + + if (obj[propertyName] && isSpy(obj[propertyName])) { + if (this.respy) { + return obj[propertyName]; + } else { + throw new Error( + getErrorMsg(propertyName + ' has already been spied upon') + ); + } + } + + const originalDescriptor = descriptor; + const spiedProperty = (0, _createSpy.default)( + propertyName, + descriptor[accessType] + ); + let restoreStrategy; + + if (Object.prototype.hasOwnProperty.call(obj, propertyName)) { + restoreStrategy = function () { + Object.defineProperty(obj, propertyName, originalDescriptor); + }; + } else { + restoreStrategy = function () { + delete obj[propertyName]; + }; + } + + currentSpies().push({ + restoreObjectToOriginalState: restoreStrategy + }); + const spiedDescriptor = {...descriptor, [accessType]: spiedProperty}; + Object.defineProperty(obj, propertyName, spiedDescriptor); + return spiedProperty; + }; + + this.clearSpies = function () { + const spies = currentSpies(); + + for (let i = spies.length - 1; i >= 0; i--) { + const spyEntry = spies[i]; + spyEntry.restoreObjectToOriginalState(); + } + }; + } +} + +exports.default = SpyRegistry; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmineAsyncInstall.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmineAsyncInstall.d.ts new file mode 100644 index 000000000..ec25aba4c --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmineAsyncInstall.d.ts @@ -0,0 +1,12 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** + * This module adds ability to test async promise code with jasmine by + * returning a promise from `it/test` and `before/afterEach/All` blocks. + */ +import type { Config, Global } from '@jest/types'; +export default function jasmineAsyncInstall(globalConfig: Config.GlobalConfig, global: Global.Global): void; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js new file mode 100644 index 000000000..27b4c316c --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js @@ -0,0 +1,180 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = jasmineAsyncInstall; + +var _co = _interopRequireDefault(require('co')); + +var _isGeneratorFn = _interopRequireDefault(require('is-generator-fn')); + +var _throat = _interopRequireDefault(require('throat')); + +var _isError = _interopRequireDefault(require('./isError')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +var Promise = global[Symbol.for('jest-native-promise')] || global.Promise; + +function isPromise(obj) { + return obj && typeof obj.then === 'function'; +} + +function promisifyLifeCycleFunction(originalFn, env) { + return function (fn, timeout) { + if (!fn) { + return originalFn.call(env); + } + + const hasDoneCallback = typeof fn === 'function' && fn.length > 0; + + if (hasDoneCallback) { + // Jasmine will handle it + return originalFn.call(env, fn, timeout); + } + + const extraError = new Error(); // Without this line v8 stores references to all closures + // in the stack in the Error object. This line stringifies the stack + // property to allow garbage-collecting objects on the stack + // https://crbug.com/v8/7142 + + extraError.stack = extraError.stack; // We make *all* functions async and run `done` right away if they + // didn't return a promise. + + const asyncJestLifecycle = function (done) { + const wrappedFn = (0, _isGeneratorFn.default)(fn) + ? _co.default.wrap(fn) + : fn; + const returnValue = wrappedFn.call({}); + + if (isPromise(returnValue)) { + returnValue.then(done.bind(null, null), error => { + const {isError: checkIsError, message} = (0, _isError.default)(error); + + if (message) { + extraError.message = message; + } + + done.fail(checkIsError ? error : extraError); + }); + } else { + done(); + } + }; + + return originalFn.call(env, asyncJestLifecycle, timeout); + }; +} // Similar to promisifyLifeCycleFunction but throws an error +// when the return value is neither a Promise nor `undefined` + +function promisifyIt(originalFn, env, jasmine) { + return function (specName, fn, timeout) { + if (!fn) { + const spec = originalFn.call(env, specName); + spec.pend('not implemented'); + return spec; + } + + const hasDoneCallback = fn.length > 0; + + if (hasDoneCallback) { + return originalFn.call(env, specName, fn, timeout); + } + + const extraError = new Error(); // Without this line v8 stores references to all closures + // in the stack in the Error object. This line stringifies the stack + // property to allow garbage-collecting objects on the stack + // https://crbug.com/v8/7142 + + extraError.stack = extraError.stack; + + const asyncJestTest = function (done) { + const wrappedFn = (0, _isGeneratorFn.default)(fn) + ? _co.default.wrap(fn) + : fn; + const returnValue = wrappedFn.call({}); + + if (isPromise(returnValue)) { + returnValue.then(done.bind(null, null), error => { + const {isError: checkIsError, message} = (0, _isError.default)(error); + + if (message) { + extraError.message = message; + } + + if (jasmine.Spec.isPendingSpecException(error)) { + env.pending(message); + done(); + } else { + done.fail(checkIsError ? error : extraError); + } + }); + } else if (returnValue === undefined) { + done(); + } else { + done.fail( + new Error( + 'Jest: `it` and `test` must return either a Promise or undefined.' + ) + ); + } + }; + + return originalFn.call(env, specName, asyncJestTest, timeout); + }; +} + +function makeConcurrent(originalFn, env, mutex) { + return function (specName, fn, timeout) { + let promise = Promise.resolve(); + const spec = originalFn.call(env, specName, () => promise, timeout); + + if (env != null && !env.specFilter(spec)) { + return spec; + } + + try { + promise = mutex(() => { + const promise = fn(); + + if (isPromise(promise)) { + return promise; + } + + throw new Error( + `Jest: concurrent test "${spec.getFullName()}" must return a Promise.` + ); + }); + } catch (error) { + promise = Promise.reject(error); + } + + return spec; + }; +} + +function jasmineAsyncInstall(globalConfig, global) { + const jasmine = global.jasmine; + const mutex = (0, _throat.default)(globalConfig.maxConcurrency); + const env = jasmine.getEnv(); + env.it = promisifyIt(env.it, env, jasmine); + env.fit = promisifyIt(env.fit, env, jasmine); + + global.it.concurrent = (env => { + const concurrent = makeConcurrent(env.it, env, mutex); + concurrent.only = makeConcurrent(env.fit, env, mutex); + concurrent.skip = makeConcurrent(env.xit, env, mutex); + return concurrent; + })(env); + + global.fit.concurrent = makeConcurrent(env.fit, env, mutex); + env.afterAll = promisifyLifeCycleFunction(env.afterAll, env); + env.afterEach = promisifyLifeCycleFunction(env.afterEach, env); + env.beforeAll = promisifyLifeCycleFunction(env.beforeAll, env); + env.beforeEach = promisifyLifeCycleFunction(env.beforeEach, env); +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jestExpect.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jestExpect.d.ts new file mode 100644 index 000000000..0557578a6 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jestExpect.d.ts @@ -0,0 +1,10 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +declare const _default: (config: { + expand: boolean; +}) => void; +export default _default; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/jestExpect.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jestExpect.js new file mode 100644 index 000000000..19f1684c5 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/jestExpect.js @@ -0,0 +1,69 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _expect = _interopRequireDefault(require('expect')); + +var _jestSnapshot = require('jest-snapshot'); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +var _default = config => { + global.expect = _expect.default; + + _expect.default.setState({ + expand: config.expand + }); + + _expect.default.extend({ + toMatchInlineSnapshot: _jestSnapshot.toMatchInlineSnapshot, + toMatchSnapshot: _jestSnapshot.toMatchSnapshot, + toThrowErrorMatchingInlineSnapshot: + _jestSnapshot.toThrowErrorMatchingInlineSnapshot, + toThrowErrorMatchingSnapshot: _jestSnapshot.toThrowErrorMatchingSnapshot + }); + + _expect.default.addSnapshotSerializer = _jestSnapshot.addSerializer; + const jasmine = global.jasmine; + jasmine.anything = _expect.default.anything; + jasmine.any = _expect.default.any; + jasmine.objectContaining = _expect.default.objectContaining; + jasmine.arrayContaining = _expect.default.arrayContaining; + jasmine.stringMatching = _expect.default.stringMatching; + + jasmine.addMatchers = jasmineMatchersObject => { + const jestMatchersObject = Object.create(null); + Object.keys(jasmineMatchersObject).forEach(name => { + jestMatchersObject[name] = function (...args) { + // use "expect.extend" if you need to use equality testers (via this.equal) + const result = jasmineMatchersObject[name](null, null); // if there is no 'negativeCompare', both should be handled by `compare` + + const negativeCompare = result.negativeCompare || result.compare; + return this.isNot + ? negativeCompare.apply( + null, // @ts-ignore + args + ) + : result.compare.apply( + null, // @ts-ignore + args + ); + }; + }); + const expect = global.expect; + expect.extend(jestMatchersObject); + }; +}; + +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/pTimeout.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/pTimeout.d.ts new file mode 100644 index 000000000..35eb08201 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/pTimeout.d.ts @@ -0,0 +1,7 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export default function pTimeout(promise: Promise, ms: number, clearTimeout: NodeJS.Global['clearTimeout'], setTimeout: NodeJS.Global['setTimeout'], onTimeout: () => any): Promise; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/pTimeout.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/pTimeout.js new file mode 100644 index 000000000..4f878955a --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/pTimeout.js @@ -0,0 +1,33 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = pTimeout; +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +var Promise = global[Symbol.for('jest-native-promise')] || global.Promise; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// A specialized version of `p-timeout` that does not touch globals. +// It does not throw on timeout. +function pTimeout(promise, ms, clearTimeout, setTimeout, onTimeout) { + return new Promise((resolve, reject) => { + const timer = setTimeout(() => resolve(onTimeout()), ms); + promise.then( + val => { + clearTimeout(timer); + resolve(val); + }, + err => { + clearTimeout(timer); + reject(err); + } + ); + }); +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/queueRunner.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/queueRunner.d.ts new file mode 100644 index 000000000..9c60f33ab --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/queueRunner.d.ts @@ -0,0 +1,26 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +declare type Global = NodeJS.Global; +export declare type Options = { + clearTimeout: Global['clearTimeout']; + fail: (error: Error) => void; + onException: (error: Error) => void; + queueableFns: Array; + setTimeout: Global['setTimeout']; + userContext: any; +}; +export declare type QueueableFn = { + fn: (done: (error?: any) => void) => void; + timeout?: () => number; + initError?: Error; +}; +export default function queueRunner(options: Options): { + cancel: any; + catch: (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise; + then: (onfulfilled?: ((value: void) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise; +}; +export {}; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/queueRunner.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/queueRunner.js new file mode 100644 index 000000000..d2b316584 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/queueRunner.js @@ -0,0 +1,83 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = queueRunner; + +var _PCancelable = _interopRequireDefault(require('./PCancelable')); + +var _pTimeout = _interopRequireDefault(require('./pTimeout')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +var Promise = global[Symbol.for('jest-native-promise')] || global.Promise; + +// har to type :( +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function queueRunner(options) { + const token = new _PCancelable.default((onCancel, resolve) => { + onCancel(resolve); + }); + + const mapper = ({fn, timeout, initError = new Error()}) => { + let promise = new Promise(resolve => { + const next = function (...args) { + const err = args[0]; + + if (err) { + options.fail.apply(null, args); + } + + resolve(); + }; + + next.fail = function (...args) { + options.fail.apply(null, args); + resolve(); + }; + + try { + fn.call(options.userContext, next); + } catch (e) { + options.onException(e); + resolve(); + } + }); + promise = Promise.race([promise, token]); + + if (!timeout) { + return promise; + } + + const timeoutMs = timeout(); + return (0, _pTimeout.default)( + promise, + timeoutMs, + options.clearTimeout, + options.setTimeout, + () => { + initError.message = + 'Timeout - Async callback was not invoked within the ' + + timeoutMs + + 'ms timeout specified by jest.setTimeout.'; + initError.stack = initError.message + initError.stack; + options.onException(initError); + } + ); + }; + + const result = options.queueableFns.reduce( + (promise, fn) => promise.then(() => mapper(fn)), + Promise.resolve() + ); + return { + cancel: token.cancel.bind(token), + catch: result.catch.bind(result), + then: result.then.bind(result) + }; +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/reporter.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/reporter.d.ts new file mode 100644 index 000000000..902d4510f --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/reporter.d.ts @@ -0,0 +1,31 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +import { TestResult } from '@jest/test-result'; +import type { SpecResult } from './jasmine/Spec'; +import type { SuiteResult } from './jasmine/Suite'; +import type { Reporter, RunDetails } from './types'; +export default class Jasmine2Reporter implements Reporter { + private _testResults; + private _globalConfig; + private _config; + private _currentSuites; + private _resolve; + private _resultsPromise; + private _startTimes; + private _testPath; + constructor(globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, testPath: Config.Path); + jasmineStarted(_runDetails: RunDetails): void; + specStarted(spec: SpecResult): void; + specDone(result: SpecResult): void; + suiteStarted(suite: SuiteResult): void; + suiteDone(_result: SuiteResult): void; + jasmineDone(_runDetails: RunDetails): void; + getResults(): Promise; + private _addMissingMessageToStack; + private _extractSpecResults; +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/reporter.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/reporter.js new file mode 100644 index 000000000..10b1cd2eb --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/reporter.js @@ -0,0 +1,175 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _testResult = require('@jest/test-result'); + +var _jestMessageUtil = require('jest-message-util'); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +var jestNow = global[Symbol.for('jest-native-now')] || global.Date.now; +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +var Promise = global[Symbol.for('jest-native-promise')] || global.Promise; + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +class Jasmine2Reporter { + constructor(globalConfig, config, testPath) { + _defineProperty(this, '_testResults', void 0); + + _defineProperty(this, '_globalConfig', void 0); + + _defineProperty(this, '_config', void 0); + + _defineProperty(this, '_currentSuites', void 0); + + _defineProperty(this, '_resolve', void 0); + + _defineProperty(this, '_resultsPromise', void 0); + + _defineProperty(this, '_startTimes', void 0); + + _defineProperty(this, '_testPath', void 0); + + this._globalConfig = globalConfig; + this._config = config; + this._testPath = testPath; + this._testResults = []; + this._currentSuites = []; + this._resolve = null; + this._resultsPromise = new Promise(resolve => (this._resolve = resolve)); + this._startTimes = new Map(); + } + + jasmineStarted(_runDetails) {} + + specStarted(spec) { + this._startTimes.set(spec.id, jestNow()); + } + + specDone(result) { + this._testResults.push( + this._extractSpecResults(result, this._currentSuites.slice(0)) + ); + } + + suiteStarted(suite) { + this._currentSuites.push(suite.description); + } + + suiteDone(_result) { + this._currentSuites.pop(); + } + + jasmineDone(_runDetails) { + let numFailingTests = 0; + let numPassingTests = 0; + let numPendingTests = 0; + let numTodoTests = 0; + const testResults = this._testResults; + testResults.forEach(testResult => { + if (testResult.status === 'failed') { + numFailingTests++; + } else if (testResult.status === 'pending') { + numPendingTests++; + } else if (testResult.status === 'todo') { + numTodoTests++; + } else { + numPassingTests++; + } + }); + const testResult = { + ...(0, _testResult.createEmptyTestResult)(), + console: null, + failureMessage: (0, _jestMessageUtil.formatResultsErrors)( + testResults, + this._config, + this._globalConfig, + this._testPath + ), + numFailingTests, + numPassingTests, + numPendingTests, + numTodoTests, + snapshot: { + added: 0, + fileDeleted: false, + matched: 0, + unchecked: 0, + unmatched: 0, + updated: 0 + }, + testFilePath: this._testPath, + testResults + }; + + this._resolve(testResult); + } + + getResults() { + return this._resultsPromise; + } + + _addMissingMessageToStack(stack, message) { + // Some errors (e.g. Angular injection error) don't prepend error.message + // to stack, instead the first line of the stack is just plain 'Error' + const ERROR_REGEX = /^Error:?\s*\n/; + + if (stack && message && !stack.includes(message)) { + return message + stack.replace(ERROR_REGEX, '\n'); + } + + return stack; + } + + _extractSpecResults(specResult, ancestorTitles) { + const start = this._startTimes.get(specResult.id); + + const duration = start ? jestNow() - start : undefined; + const status = + specResult.status === 'disabled' ? 'pending' : specResult.status; + const location = specResult.__callsite + ? { + column: specResult.__callsite.getColumnNumber(), + line: specResult.__callsite.getLineNumber() + } + : null; + const results = { + ancestorTitles, + duration, + failureMessages: [], + fullName: specResult.fullName, + location, + numPassingAsserts: 0, + // Jasmine2 only returns an array of failed asserts. + status, + title: specResult.description + }; + specResult.failedExpectations.forEach(failed => { + const message = + !failed.matcherName && failed.stack + ? this._addMissingMessageToStack(failed.stack, failed.message) + : failed.message || ''; + results.failureMessages.push(message); + }); + return results; + } +} + +exports.default = Jasmine2Reporter; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/setup_jest_globals.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/setup_jest_globals.d.ts new file mode 100644 index 000000000..0f89d4439 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/setup_jest_globals.d.ts @@ -0,0 +1,16 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +import type { Plugin } from 'pretty-format'; +export declare type SetupOptions = { + config: Config.ProjectConfig; + globalConfig: Config.GlobalConfig; + localRequire: (moduleName: string) => Plugin; + testPath: Config.Path; +}; +declare const _default: ({ config, globalConfig, localRequire, testPath, }: SetupOptions) => import("jest-snapshot/build/State").default; +export default _default; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/setup_jest_globals.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/setup_jest_globals.js new file mode 100644 index 000000000..875345b46 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/setup_jest_globals.js @@ -0,0 +1,114 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _expect = require('expect'); + +var _jestSnapshot = require('jest-snapshot'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// Get suppressed errors form jest-matchers that weren't throw during +// test execution and add them to the test result, potentially failing +// a passing test. +const addSuppressedErrors = result => { + const {suppressedErrors} = (0, _expect.getState)(); + (0, _expect.setState)({ + suppressedErrors: [] + }); + + if (suppressedErrors.length) { + result.status = 'failed'; + result.failedExpectations = suppressedErrors.map(error => ({ + actual: '', + // passing error for custom test reporters + error, + expected: '', + matcherName: '', + message: error.message, + passed: false, + stack: error.stack + })); + } +}; + +const addAssertionErrors = result => { + const assertionErrors = (0, _expect.extractExpectedAssertionsErrors)(); + + if (assertionErrors.length) { + const jasmineErrors = assertionErrors.map(({actual, error, expected}) => ({ + actual, + expected, + message: error.stack, + passed: false + })); + result.status = 'failed'; + result.failedExpectations = result.failedExpectations.concat(jasmineErrors); + } +}; + +const patchJasmine = () => { + global.jasmine.Spec = (realSpec => { + class Spec extends realSpec { + constructor(attr) { + const resultCallback = attr.resultCallback; + + attr.resultCallback = function (result) { + addSuppressedErrors(result); + addAssertionErrors(result); + resultCallback.call(attr, result); + }; + + const onStart = attr.onStart; + + attr.onStart = context => { + (0, _expect.setState)({ + currentTestName: context.getFullName() + }); + onStart && onStart.call(attr, context); + }; + + super(attr); + } + } + + return Spec; + })(global.jasmine.Spec); +}; + +var _default = ({config, globalConfig, localRequire, testPath}) => { + // Jest tests snapshotSerializers in order preceding built-in serializers. + // Therefore, add in reverse because the last added is the first tested. + config.snapshotSerializers + .concat() + .reverse() + .forEach(path => { + (0, _jestSnapshot.addSerializer)(localRequire(path)); + }); + patchJasmine(); + const {expand, updateSnapshot} = globalConfig; + const snapshotResolver = (0, _jestSnapshot.buildSnapshotResolver)(config); + const snapshotPath = snapshotResolver.resolveSnapshotPath(testPath); + const snapshotState = new _jestSnapshot.SnapshotState(snapshotPath, { + expand, + getBabelTraverse: () => require('@babel/traverse').default, + getPrettier: () => + config.prettierPath ? require(config.prettierPath) : null, + updateSnapshot + }); + (0, _expect.setState)({ + snapshotState, + testPath + }); // Return it back to the outer scope (test runner outside the VM). + + return snapshotState; +}; + +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/treeProcessor.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/treeProcessor.d.ts new file mode 100644 index 000000000..725de8a1c --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/treeProcessor.d.ts @@ -0,0 +1,26 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type Suite from './jasmine/Suite'; +declare type Options = { + nodeComplete: (suite: TreeNode) => void; + nodeStart: (suite: TreeNode) => void; + queueRunnerFactory: any; + runnableIds: Array; + tree: TreeNode; +}; +export declare type TreeNode = { + afterAllFns: Array; + beforeAllFns: Array; + disabled?: boolean; + execute: (onComplete: () => void, enabled: boolean) => void; + id: string; + onException: (error: Error) => void; + sharedUserContext: () => any; + children?: Array; +} & Pick; +export default function treeProcessor(options: Options): void; +export {}; diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/treeProcessor.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/treeProcessor.js new file mode 100644 index 000000000..a9c682544 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/treeProcessor.js @@ -0,0 +1,79 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = treeProcessor; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function treeProcessor(options) { + const { + nodeComplete, + nodeStart, + queueRunnerFactory, + runnableIds, + tree + } = options; + + function isEnabled(node, parentEnabled) { + return parentEnabled || runnableIds.indexOf(node.id) !== -1; + } + + function getNodeHandler(node, parentEnabled) { + const enabled = isEnabled(node, parentEnabled); + return node.children + ? getNodeWithChildrenHandler(node, enabled) + : getNodeWithoutChildrenHandler(node, enabled); + } + + function getNodeWithoutChildrenHandler(node, enabled) { + return function fn(done = () => {}) { + node.execute(done, enabled); + }; + } + + function getNodeWithChildrenHandler(node, enabled) { + return async function fn(done = () => {}) { + nodeStart(node); + await queueRunnerFactory({ + onException: error => node.onException(error), + queueableFns: wrapChildren(node, enabled), + userContext: node.sharedUserContext() + }); + nodeComplete(node); + done(); + }; + } + + function hasNoEnabledTest(node) { + if (node.children) { + return node.children.every(hasNoEnabledTest); + } + + return node.disabled || node.markedPending; + } + + function wrapChildren(node, enabled) { + if (!node.children) { + throw new Error('`node.children` is not defined.'); + } + + const children = node.children.map(child => ({ + fn: getNodeHandler(child, enabled) + })); + + if (hasNoEnabledTest(node)) { + return children; + } + + return node.beforeAllFns.concat(children).concat(node.afterAllFns); + } + + const treeHandler = getNodeHandler(tree, false); + return treeHandler(); +} diff --git a/node_modules/jest-jasmine2/build/ts3.4/ExpectationFailed.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/ExpectationFailed.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/ExpectationFailed.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/ExpectationFailed.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/assertionErrorMessage.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/assertionErrorMessage.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/assertionErrorMessage.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/assertionErrorMessage.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/each.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/each.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/each.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/each.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/errorOnPrivate.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/errorOnPrivate.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/errorOnPrivate.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/errorOnPrivate.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/expectationResultFactory.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/expectationResultFactory.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/expectationResultFactory.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/expectationResultFactory.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/index.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/index.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/index.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/index.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/isError.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/isError.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/isError.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/isError.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/jasmine/CallTracker.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/CallTracker.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/jasmine/CallTracker.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/CallTracker.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/jasmine/Env.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/Env.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/jasmine/Env.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/Env.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/jasmine/JsApiReporter.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/JsApiReporter.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/jasmine/JsApiReporter.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/JsApiReporter.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/jasmine/ReportDispatcher.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/ReportDispatcher.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/jasmine/ReportDispatcher.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/ReportDispatcher.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/jasmine/Spec.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/Spec.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/jasmine/Spec.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/Spec.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/jasmine/SpyStrategy.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/SpyStrategy.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/jasmine/SpyStrategy.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/SpyStrategy.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/jasmine/Suite.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/Suite.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/jasmine/Suite.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/Suite.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/jasmine/Timer.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/Timer.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/jasmine/Timer.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/Timer.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/jasmine/createSpy.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/createSpy.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/jasmine/createSpy.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/createSpy.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/jasmine/jasmineLight.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/jasmineLight.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/jasmine/jasmineLight.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/jasmineLight.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/jasmine/spyRegistry.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/spyRegistry.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/jasmine/spyRegistry.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmine/spyRegistry.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/jasmineAsyncInstall.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmineAsyncInstall.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/jasmineAsyncInstall.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jasmineAsyncInstall.d.ts diff --git a/node_modules/jest-circus/build/ts3.4/legacy-code-todo-rewrite/jestExpect.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jestExpect.d.ts similarity index 100% rename from node_modules/jest-circus/build/ts3.4/legacy-code-todo-rewrite/jestExpect.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/jestExpect.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/pTimeout.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/pTimeout.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/pTimeout.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/pTimeout.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/queueRunner.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/queueRunner.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/queueRunner.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/queueRunner.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/reporter.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/reporter.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/reporter.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/reporter.d.ts diff --git a/node_modules/jest-jasmine2/build/ts3.4/setup_jest_globals.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/setup_jest_globals.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/setup_jest_globals.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/setup_jest_globals.d.ts diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/treeProcessor.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/treeProcessor.d.ts new file mode 100644 index 000000000..87b7a469c --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/treeProcessor.d.ts @@ -0,0 +1,26 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import Suite from './jasmine/Suite'; +declare type Options = { + nodeComplete: (suite: TreeNode) => void; + nodeStart: (suite: TreeNode) => void; + queueRunnerFactory: any; + runnableIds: Array; + tree: TreeNode; +}; +export declare type TreeNode = { + afterAllFns: Array; + beforeAllFns: Array; + disabled?: boolean; + execute: (onComplete: () => void, enabled: boolean) => void; + id: string; + onException: (error: Error) => void; + sharedUserContext: () => any; + children?: Array; +} & Pick; +export default function treeProcessor(options: Options): void; +export {}; diff --git a/node_modules/jest-jasmine2/build/ts3.4/types.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/types.d.ts similarity index 100% rename from node_modules/jest-jasmine2/build/ts3.4/types.d.ts rename to node_modules/@jest/core/node_modules/jest-jasmine2/build/ts3.4/types.d.ts diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/types.d.ts b/node_modules/@jest/core/node_modules/jest-jasmine2/build/types.d.ts new file mode 100644 index 000000000..f1b050897 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/types.d.ts @@ -0,0 +1,72 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/// +import type { AssertionError } from 'assert'; +import type { Config } from '@jest/types'; +import expect = require('expect'); +import type { default as Spec, SpecResult } from './jasmine/Spec'; +import type JsApiReporter from './jasmine/JsApiReporter'; +import type Timer from './jasmine/Timer'; +import type Env from './jasmine/Env'; +import type createSpy from './jasmine/createSpy'; +import type ReportDispatcher from './jasmine/ReportDispatcher'; +import type SpyRegistry from './jasmine/spyRegistry'; +import type { default as Suite, SuiteResult } from './jasmine/Suite'; +import type SpyStrategy from './jasmine/SpyStrategy'; +import type CallTracker from './jasmine/CallTracker'; +export interface AssertionErrorWithStack extends AssertionError { + stack: string; +} +export declare type SyncExpectationResult = { + pass: boolean; + message: () => string; +}; +export declare type AsyncExpectationResult = Promise; +export declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult; +export declare type RawMatcherFn = (expected: any, actual: any, options?: any) => ExpectationResult; +export declare type RunDetails = { + totalSpecsDefined?: number; + failedExpectations?: SuiteResult['failedExpectations']; +}; +export declare type Reporter = { + jasmineDone: (runDetails: RunDetails) => void; + jasmineStarted: (runDetails: RunDetails) => void; + specDone: (result: SpecResult) => void; + specStarted: (spec: SpecResult) => void; + suiteDone: (result: SuiteResult) => void; + suiteStarted: (result: SuiteResult) => void; +}; +export interface Spy extends Record { + (this: Record, ...args: Array): unknown; + and: SpyStrategy; + calls: CallTracker; + restoreObjectToOriginalState?: () => void; +} +export declare type Jasmine = { + _DEFAULT_TIMEOUT_INTERVAL: number; + DEFAULT_TIMEOUT_INTERVAL: number; + currentEnv_: ReturnType['prototype']; + getEnv: (options?: object) => ReturnType['prototype']; + createSpy: typeof createSpy; + Env: ReturnType; + JsApiReporter: typeof JsApiReporter; + ReportDispatcher: typeof ReportDispatcher; + Spec: typeof Spec; + SpyRegistry: typeof SpyRegistry; + Suite: typeof Suite; + Timer: typeof Timer; + version: string; + testPath: Config.Path; + addMatchers: Function; +} & typeof expect & NodeJS.Global; +declare global { + module NodeJS { + interface Global { + expect: typeof expect; + } + } +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/build/types.js b/node_modules/@jest/core/node_modules/jest-jasmine2/build/types.js new file mode 100644 index 000000000..d852d2412 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/build/types.js @@ -0,0 +1,7 @@ +'use strict'; + +var _expect = _interopRequireDefault(require('expect')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} diff --git a/node_modules/@jest/core/node_modules/jest-jasmine2/package.json b/node_modules/@jest/core/node_modules/jest-jasmine2/package.json new file mode 100644 index 000000000..eeda3e76e --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-jasmine2/package.json @@ -0,0 +1,83 @@ +{ + "_args": [ + [ + "jest-jasmine2@25.5.4", + "/workspace/readable-readme" + ] + ], + "_development": true, + "_from": "jest-jasmine2@25.5.4", + "_id": "jest-jasmine2@25.5.4", + "_inBundle": false, + "_integrity": "sha512-9acbWEfbmS8UpdcfqnDO+uBUgKa/9hcRh983IHdM+pKmJPL77G0sWAAK0V0kr5LK3a8cSBfkFSoncXwQlRZfkQ==", + "_location": "/@jest/core/jest-jasmine2", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "jest-jasmine2@25.5.4", + "name": "jest-jasmine2", + "escapedName": "jest-jasmine2", + "rawSpec": "25.5.4", + "saveSpec": null, + "fetchSpec": "25.5.4" + }, + "_requiredBy": [ + "/@jest/core/jest-config", + "/@jest/core/jest-runner" + ], + "_resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-25.5.4.tgz", + "_spec": "25.5.4", + "_where": "/workspace/readable-readme", + "bugs": { + "url": "https://github.com/facebook/jest/issues" + }, + "dependencies": { + "@babel/traverse": "^7.1.0", + "@jest/environment": "^25.5.0", + "@jest/source-map": "^25.5.0", + "@jest/test-result": "^25.5.0", + "@jest/types": "^25.5.0", + "chalk": "^3.0.0", + "co": "^4.6.0", + "expect": "^25.5.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^25.5.0", + "jest-matcher-utils": "^25.5.0", + "jest-message-util": "^25.5.0", + "jest-runtime": "^25.5.4", + "jest-snapshot": "^25.5.1", + "jest-util": "^25.5.0", + "pretty-format": "^25.5.0", + "throat": "^5.0.0" + }, + "devDependencies": { + "@types/babel__traverse": "^7.0.4", + "@types/co": "^4.6.2" + }, + "engines": { + "node": ">= 8.3" + }, + "gitHead": "389d13724bbf6bb64dcde9700a6ecea3333942db", + "homepage": "https://github.com/facebook/jest#readme", + "license": "MIT", + "main": "build/index.js", + "name": "jest-jasmine2", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/facebook/jest.git", + "directory": "packages/jest-jasmine2" + }, + "types": "build/index.d.ts", + "typesVersions": { + "<3.8": { + "build/*": [ + "build/ts3.4/*" + ] + } + }, + "version": "25.5.4" +} diff --git a/node_modules/@jest/core/node_modules/jest-runner/LICENSE b/node_modules/@jest/core/node_modules/jest-runner/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runner/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@jest/core/node_modules/jest-runner/build/index.d.ts b/node_modules/@jest/core/node_modules/jest-runner/build/index.d.ts new file mode 100644 index 000000000..c71e8fbe7 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runner/build/index.d.ts @@ -0,0 +1,27 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +import type { OnTestFailure as JestOnTestFailure, OnTestStart as JestOnTestStart, OnTestSuccess as JestOnTestSuccess, Test as JestTest, TestRunnerContext as JestTestRunnerContext, TestRunnerOptions as JestTestRunnerOptions, TestWatcher as JestTestWatcher } from './types'; +declare namespace TestRunner { + type Test = JestTest; + type OnTestFailure = JestOnTestFailure; + type OnTestStart = JestOnTestStart; + type OnTestSuccess = JestOnTestSuccess; + type TestWatcher = JestTestWatcher; + type TestRunnerContext = JestTestRunnerContext; + type TestRunnerOptions = JestTestRunnerOptions; +} +declare class TestRunner { + private _globalConfig; + private _context; + readonly isSerial?: boolean; + constructor(globalConfig: Config.GlobalConfig, context?: JestTestRunnerContext); + runTests(tests: Array, watcher: JestTestWatcher, onStart: JestOnTestStart, onResult: JestOnTestSuccess, onFailure: JestOnTestFailure, options: JestTestRunnerOptions): Promise; + private _createInBandTestRun; + private _createParallelTestRun; +} +export = TestRunner; diff --git a/node_modules/@jest/core/node_modules/jest-runner/build/index.js b/node_modules/@jest/core/node_modules/jest-runner/build/index.js new file mode 100644 index 000000000..cc6e9181e --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runner/build/index.js @@ -0,0 +1,223 @@ +'use strict'; + +function _exit() { + const data = _interopRequireDefault(require('exit')); + + _exit = function () { + return data; + }; + + return data; +} + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +function _throat() { + const data = _interopRequireDefault(require('throat')); + + _throat = function () { + return data; + }; + + return data; +} + +function _jestWorker() { + const data = _interopRequireDefault(require('jest-worker')); + + _jestWorker = function () { + return data; + }; + + return data; +} + +var _runTest = _interopRequireDefault(require('./runTest')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +const TEST_WORKER_PATH = require.resolve('./testWorker'); + +/* eslint-disable-next-line no-redeclare */ +class TestRunner { + constructor(globalConfig, context) { + _defineProperty(this, '_globalConfig', void 0); + + _defineProperty(this, '_context', void 0); + + _defineProperty(this, 'isSerial', void 0); + + this._globalConfig = globalConfig; + this._context = context || {}; + } + + async runTests(tests, watcher, onStart, onResult, onFailure, options) { + return await (options.serial + ? this._createInBandTestRun(tests, watcher, onStart, onResult, onFailure) + : this._createParallelTestRun( + tests, + watcher, + onStart, + onResult, + onFailure + )); + } + + async _createInBandTestRun(tests, watcher, onStart, onResult, onFailure) { + process.env.JEST_WORKER_ID = '1'; + const mutex = (0, _throat().default)(1); + return tests.reduce( + (promise, test) => + mutex(() => + promise + .then(async () => { + if (watcher.isInterrupted()) { + throw new CancelRun(); + } + + await onStart(test); + return (0, _runTest.default)( + test.path, + this._globalConfig, + test.context.config, + test.context.resolver, + this._context + ); + }) + .then(result => onResult(test, result)) + .catch(err => onFailure(test, err)) + ), + Promise.resolve() + ); + } + + async _createParallelTestRun(tests, watcher, onStart, onResult, onFailure) { + const resolvers = new Map(); + + for (const test of tests) { + if (!resolvers.has(test.context.config.name)) { + resolvers.set(test.context.config.name, { + config: test.context.config, + serializableModuleMap: test.context.moduleMap.toJSON() + }); + } + } + + const worker = new (_jestWorker().default)(TEST_WORKER_PATH, { + exposedMethods: ['worker'], + forkOptions: { + stdio: 'pipe' + }, + maxRetries: 3, + numWorkers: this._globalConfig.maxWorkers, + setupArgs: [ + { + serializableResolvers: Array.from(resolvers.values()) + } + ] + }); + if (worker.getStdout()) worker.getStdout().pipe(process.stdout); + if (worker.getStderr()) worker.getStderr().pipe(process.stderr); + const mutex = (0, _throat().default)(this._globalConfig.maxWorkers); // Send test suites to workers continuously instead of all at once to track + // the start time of individual tests. + + const runTestInWorker = test => + mutex(async () => { + if (watcher.isInterrupted()) { + return Promise.reject(); + } + + await onStart(test); + return worker.worker({ + config: test.context.config, + context: { + ...this._context, + changedFiles: + this._context.changedFiles && + Array.from(this._context.changedFiles), + sourcesRelatedToTestsInChangedFiles: + this._context.sourcesRelatedToTestsInChangedFiles && + Array.from(this._context.sourcesRelatedToTestsInChangedFiles) + }, + globalConfig: this._globalConfig, + path: test.path + }); + }); + + const onError = async (err, test) => { + await onFailure(test, err); + + if (err.type === 'ProcessTerminatedError') { + console.error( + 'A worker process has quit unexpectedly! ' + + 'Most likely this is an initialization error.' + ); + (0, _exit().default)(1); + } + }; + + const onInterrupt = new Promise((_, reject) => { + watcher.on('change', state => { + if (state.interrupted) { + reject(new CancelRun()); + } + }); + }); + const runAllTests = Promise.all( + tests.map(test => + runTestInWorker(test) + .then(testResult => onResult(test, testResult)) + .catch(error => onError(error, test)) + ) + ); + + const cleanup = async () => { + const {forceExited} = await worker.end(); + + if (forceExited) { + console.error( + _chalk().default.yellow( + 'A worker process has failed to exit gracefully and has been force exited. ' + + 'This is likely caused by tests leaking due to improper teardown. ' + + 'Try running with --runInBand --detectOpenHandles to find leaks.' + ) + ); + } + }; + + return Promise.race([runAllTests, onInterrupt]).then(cleanup, cleanup); + } +} + +class CancelRun extends Error { + constructor(message) { + super(message); + this.name = 'CancelRun'; + } +} + +module.exports = TestRunner; diff --git a/node_modules/@jest/core/node_modules/jest-runner/build/runTest.d.ts b/node_modules/@jest/core/node_modules/jest-runner/build/runTest.d.ts new file mode 100644 index 000000000..fcc242c73 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runner/build/runTest.d.ts @@ -0,0 +1,12 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Config } from '@jest/types'; +import type { TestResult } from '@jest/test-result'; +import Resolver = require('jest-resolve'); +import type { TestRunnerContext } from './types'; +export default function runTest(path: Config.Path, globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, resolver: Resolver, context?: TestRunnerContext): Promise; diff --git a/node_modules/@jest/core/node_modules/jest-runner/build/runTest.js b/node_modules/@jest/core/node_modules/jest-runner/build/runTest.js new file mode 100644 index 000000000..edd174b78 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runner/build/runTest.js @@ -0,0 +1,483 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = runTest; + +function _vm() { + const data = require('vm'); + + _vm = function () { + return data; + }; + + return data; +} + +function _console() { + const data = require('@jest/console'); + + _console = function () { + return data; + }; + + return data; +} + +function _jestRuntime() { + const data = _interopRequireDefault(require('jest-runtime')); + + _jestRuntime = function () { + return data; + }; + + return data; +} + +function fs() { + const data = _interopRequireWildcard(require('graceful-fs')); + + fs = function () { + return data; + }; + + return data; +} + +function _jestUtil() { + const data = require('jest-util'); + + _jestUtil = function () { + return data; + }; + + return data; +} + +function _jestLeakDetector() { + const data = _interopRequireDefault(require('jest-leak-detector')); + + _jestLeakDetector = function () { + return data; + }; + + return data; +} + +function _jestResolve() { + const data = _interopRequireDefault(require('jest-resolve')); + + _jestResolve = function () { + return data; + }; + + return data; +} + +function _jestConfig() { + const data = require('jest-config'); + + _jestConfig = function () { + return data; + }; + + return data; +} + +function docblock() { + const data = _interopRequireWildcard(require('jest-docblock')); + + docblock = function () { + return data; + }; + + return data; +} + +function _jestMessageUtil() { + const data = require('jest-message-util'); + + _jestMessageUtil = function () { + return data; + }; + + return data; +} + +function _sourceMapSupport() { + const data = _interopRequireDefault(require('source-map-support')); + + _sourceMapSupport = function () { + return data; + }; + + return data; +} + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +function freezeConsole(testConsole, config) { + // @ts-ignore: `_log` is `private` - we should figure out some proper API here + testConsole._log = function fakeConsolePush(_type, message) { + const error = new (_jestUtil().ErrorWithStack)( + `${_chalk().default.red( + `${_chalk().default.bold( + 'Cannot log after tests are done.' + )} Did you forget to wait for something async in your test?` + )}\nAttempted to log "${message}".`, + fakeConsolePush + ); + const formattedError = (0, _jestMessageUtil().formatExecError)( + error, + config, + { + noStackTrace: false + }, + undefined, + true + ); + process.stderr.write('\n' + formattedError + '\n'); // TODO: set exit code in Jest 25 + // process.exitCode = 1; + }; +} // Keeping the core of "runTest" as a separate function (as "runTestInternal") +// is key to be able to detect memory leaks. Since all variables are local to +// the function, when "runTestInternal" finishes its execution, they can all be +// freed, UNLESS something else is leaking them (and that's why we can detect +// the leak!). +// +// If we had all the code in a single function, we should manually nullify all +// references to verify if there is a leak, which is not maintainable and error +// prone. That's why "runTestInternal" CANNOT be inlined inside "runTest". + +async function runTestInternal(path, globalConfig, config, resolver, context) { + const testSource = fs().readFileSync(path, 'utf8'); + const docblockPragmas = docblock().parse(docblock().extract(testSource)); + const customEnvironment = docblockPragmas['jest-environment']; + let testEnvironment = config.testEnvironment; + + if (customEnvironment) { + if (Array.isArray(customEnvironment)) { + throw new Error( + `You can only define a single test environment through docblocks, got "${customEnvironment.join( + ', ' + )}"` + ); + } + + testEnvironment = (0, _jestConfig().getTestEnvironment)({ + ...config, + testEnvironment: customEnvironment + }); + } + + const TestEnvironment = (0, _jestUtil().interopRequireDefault)( + require(testEnvironment) + ).default; + const testFramework = + process.env.JEST_CIRCUS === '1' + ? require('jest-circus/runner') // eslint-disable-line import/no-extraneous-dependencies + : require(config.testRunner); + const Runtime = config.moduleLoader + ? require(config.moduleLoader) + : require('jest-runtime'); + const consoleOut = globalConfig.useStderr ? process.stderr : process.stdout; + + const consoleFormatter = (type, message) => + (0, _console().getConsoleOutput)( + config.cwd, + !!globalConfig.verbose, // 4 = the console call is buried 4 stack frames deep + _console().BufferedConsole.write([], type, message, 4), + config + ); + + let testConsole; + + if (globalConfig.silent) { + testConsole = new (_console().NullConsole)( + consoleOut, + consoleOut, + consoleFormatter + ); + } else if (globalConfig.verbose) { + testConsole = new (_console().CustomConsole)( + consoleOut, + consoleOut, + consoleFormatter + ); + } else { + testConsole = new (_console().BufferedConsole)(); + } + + const environment = new TestEnvironment(config, { + console: testConsole, + docblockPragmas, + testPath: path + }); + const leakDetector = config.detectLeaks + ? new (_jestLeakDetector().default)(environment) + : null; + const cacheFS = { + [path]: testSource + }; + (0, _jestUtil().setGlobal)(environment.global, 'console', testConsole); + const runtime = new Runtime(config, environment, resolver, cacheFS, { + changedFiles: + context === null || context === void 0 ? void 0 : context.changedFiles, + collectCoverage: globalConfig.collectCoverage, + collectCoverageFrom: globalConfig.collectCoverageFrom, + collectCoverageOnlyFrom: globalConfig.collectCoverageOnlyFrom, + coverageProvider: globalConfig.coverageProvider, + sourcesRelatedToTestsInChangedFiles: + context === null || context === void 0 + ? void 0 + : context.sourcesRelatedToTestsInChangedFiles + }); + const start = Date.now(); + + for (const path of config.setupFiles) { + var _runtime$unstable_sho; + + // TODO: remove ? in Jest 26 + const esm = + (_runtime$unstable_sho = runtime.unstable_shouldLoadAsEsm) === null || + _runtime$unstable_sho === void 0 + ? void 0 + : _runtime$unstable_sho.call(runtime, path); + + if (esm) { + await runtime.unstable_importModule(path); + } else { + runtime.requireModule(path); + } + } + + const sourcemapOptions = { + environment: 'node', + handleUncaughtExceptions: false, + retrieveSourceMap: source => { + const sourceMaps = runtime.getSourceMaps(); + const sourceMapSource = sourceMaps && sourceMaps[source]; + + if (sourceMapSource) { + try { + return { + map: JSON.parse(fs().readFileSync(sourceMapSource, 'utf8')), + url: source + }; + } catch (e) {} + } + + return null; + } + }; // For tests + + runtime + .requireInternalModule( + require.resolve('source-map-support'), + 'source-map-support' + ) + .install(sourcemapOptions); // For runtime errors + + _sourceMapSupport().default.install(sourcemapOptions); + + if ( + environment.global && + environment.global.process && + environment.global.process.exit + ) { + const realExit = environment.global.process.exit; + + environment.global.process.exit = function exit(...args) { + const error = new (_jestUtil().ErrorWithStack)( + `process.exit called with "${args.join(', ')}"`, + exit + ); + const formattedError = (0, _jestMessageUtil().formatExecError)( + error, + config, + { + noStackTrace: false + }, + undefined, + true + ); + process.stderr.write(formattedError); + return realExit(...args); + }; + } // if we don't have `getVmContext` on the env,or `compileFunction` available skip coverage + + const collectV8Coverage = + globalConfig.coverageProvider === 'v8' && + typeof environment.getVmContext === 'function' && + typeof _vm().compileFunction === 'function'; + + try { + await environment.setup(); + let result; + + try { + if (collectV8Coverage) { + await runtime.collectV8Coverage(); + } + + result = await testFramework( + globalConfig, + config, + environment, + runtime, + path + ); + } catch (err) { + // Access stack before uninstalling sourcemaps + err.stack; + throw err; + } finally { + if (collectV8Coverage) { + await runtime.stopCollectingV8Coverage(); + } + } + + freezeConsole(testConsole, config); + const testCount = + result.numPassingTests + + result.numFailingTests + + result.numPendingTests + + result.numTodoTests; + result.perfStats = { + end: Date.now(), + start + }; + result.testFilePath = path; + result.console = testConsole.getBuffer(); + result.skipped = testCount === result.numPendingTests; + result.displayName = config.displayName; + const coverage = runtime.getAllCoverageInfoCopy(); + + if (coverage) { + const coverageKeys = Object.keys(coverage); + + if (coverageKeys.length) { + result.coverage = coverage; + } + } + + if (collectV8Coverage) { + const v8Coverage = runtime.getAllV8CoverageInfoCopy(); + + if (v8Coverage && v8Coverage.length > 0) { + result.v8Coverage = v8Coverage; + } + } + + if (globalConfig.logHeapUsage) { + if (global.gc) { + global.gc(); + } + + result.memoryUsage = process.memoryUsage().heapUsed; + } // Delay the resolution to allow log messages to be output. + + return new Promise(resolve => { + setImmediate(() => + resolve({ + leakDetector, + result + }) + ); + }); + } finally { + var _runtime$teardown; + + await environment.teardown(); // TODO: this function might be missing, remove ? in Jest 26 + + (_runtime$teardown = runtime.teardown) === null || + _runtime$teardown === void 0 + ? void 0 + : _runtime$teardown.call(runtime); + + _sourceMapSupport().default.resetRetrieveHandlers(); + } +} + +async function runTest(path, globalConfig, config, resolver, context) { + const {leakDetector, result} = await runTestInternal( + path, + globalConfig, + config, + resolver, + context + ); + + if (leakDetector) { + // We wanna allow a tiny but time to pass to allow last-minute cleanup + await new Promise(resolve => setTimeout(resolve, 100)); // Resolve leak detector, outside the "runTestInternal" closure. + + result.leaks = await leakDetector.isLeaking(); + } else { + result.leaks = false; + } + + return result; +} diff --git a/node_modules/@jest/core/node_modules/jest-runner/build/testWorker.d.ts b/node_modules/@jest/core/node_modules/jest-runner/build/testWorker.d.ts new file mode 100644 index 000000000..9b8142324 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runner/build/testWorker.d.ts @@ -0,0 +1,26 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Config } from '@jest/types'; +import type { TestResult } from '@jest/test-result'; +import HasteMap = require('jest-haste-map'); +import type { TestRunnerSerializedContext } from './types'; +export declare type SerializableResolver = { + config: Config.ProjectConfig; + serializableModuleMap: HasteMap.SerializableModuleMap; +}; +declare type WorkerData = { + config: Config.ProjectConfig; + globalConfig: Config.GlobalConfig; + path: Config.Path; + context?: TestRunnerSerializedContext; +}; +export declare function setup(setupData: { + serializableResolvers: Array; +}): void; +export declare function worker({ config, globalConfig, path, context, }: WorkerData): Promise; +export {}; diff --git a/node_modules/@jest/core/node_modules/jest-runner/build/testWorker.js b/node_modules/@jest/core/node_modules/jest-runner/build/testWorker.js new file mode 100644 index 000000000..e78c06892 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runner/build/testWorker.js @@ -0,0 +1,145 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.setup = setup; +exports.worker = worker; + +function _jestHasteMap() { + const data = _interopRequireDefault(require('jest-haste-map')); + + _jestHasteMap = function () { + return data; + }; + + return data; +} + +function _exit() { + const data = _interopRequireDefault(require('exit')); + + _exit = function () { + return data; + }; + + return data; +} + +function _jestMessageUtil() { + const data = require('jest-message-util'); + + _jestMessageUtil = function () { + return data; + }; + + return data; +} + +function _jestRuntime() { + const data = _interopRequireDefault(require('jest-runtime')); + + _jestRuntime = function () { + return data; + }; + + return data; +} + +function _jestResolve() { + const data = _interopRequireDefault(require('jest-resolve')); + + _jestResolve = function () { + return data; + }; + + return data; +} + +var _runTest = _interopRequireDefault(require('./runTest')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// Make sure uncaught errors are logged before we exit. +process.on('uncaughtException', err => { + console.error(err.stack); + (0, _exit().default)(1); +}); + +const formatError = error => { + if (typeof error === 'string') { + const {message, stack} = (0, _jestMessageUtil().separateMessageFromStack)( + error + ); + return { + message, + stack, + type: 'Error' + }; + } + + return { + code: error.code || undefined, + message: error.message, + stack: error.stack, + type: 'Error' + }; +}; + +const resolvers = new Map(); + +const getResolver = config => { + const resolver = resolvers.get(config.name); + + if (!resolver) { + throw new Error('Cannot find resolver for: ' + config.name); + } + + return resolver; +}; + +function setup(setupData) { + // Module maps that will be needed for the test runs are passed. + for (const { + config, + serializableModuleMap + } of setupData.serializableResolvers) { + const moduleMap = _jestHasteMap().default.ModuleMap.fromJSON( + serializableModuleMap + ); + + resolvers.set( + config.name, + _jestRuntime().default.createResolver(config, moduleMap) + ); + } +} + +async function worker({config, globalConfig, path, context}) { + try { + return await (0, _runTest.default)( + path, + globalConfig, + config, + getResolver(config), + context && { + ...context, + changedFiles: context.changedFiles && new Set(context.changedFiles), + sourcesRelatedToTestsInChangedFiles: + context.sourcesRelatedToTestsInChangedFiles && + new Set(context.sourcesRelatedToTestsInChangedFiles) + } + ); + } catch (error) { + throw formatError(error); + } +} diff --git a/node_modules/jest-runner/build/ts3.4/index.d.ts b/node_modules/@jest/core/node_modules/jest-runner/build/ts3.4/index.d.ts similarity index 100% rename from node_modules/jest-runner/build/ts3.4/index.d.ts rename to node_modules/@jest/core/node_modules/jest-runner/build/ts3.4/index.d.ts diff --git a/node_modules/jest-runner/build/ts3.4/runTest.d.ts b/node_modules/@jest/core/node_modules/jest-runner/build/ts3.4/runTest.d.ts similarity index 100% rename from node_modules/jest-runner/build/ts3.4/runTest.d.ts rename to node_modules/@jest/core/node_modules/jest-runner/build/ts3.4/runTest.d.ts diff --git a/node_modules/jest-runner/build/ts3.4/testWorker.d.ts b/node_modules/@jest/core/node_modules/jest-runner/build/ts3.4/testWorker.d.ts similarity index 100% rename from node_modules/jest-runner/build/ts3.4/testWorker.d.ts rename to node_modules/@jest/core/node_modules/jest-runner/build/ts3.4/testWorker.d.ts diff --git a/node_modules/@jest/core/node_modules/jest-runner/build/ts3.4/types.d.ts b/node_modules/@jest/core/node_modules/jest-runner/build/ts3.4/types.d.ts new file mode 100644 index 000000000..5c909b2e6 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runner/build/ts3.4/types.d.ts @@ -0,0 +1,53 @@ +/// +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/// +import { EventEmitter } from 'events'; +import { Config } from '@jest/types'; +import { SerializableError, TestResult } from '@jest/test-result'; +import { JestEnvironment } from '@jest/environment'; +import { FS as HasteFS, ModuleMap } from 'jest-haste-map'; +import HasteResolver = require('jest-resolve'); +import Runtime = require('jest-runtime'); +export declare type ErrorWithCode = Error & { + code?: string; +}; +export declare type Test = { + context: Context; + duration?: number; + path: Config.Path; +}; +export declare type Context = { + config: Config.ProjectConfig; + hasteFS: HasteFS; + moduleMap: ModuleMap; + resolver: HasteResolver; +}; +export declare type OnTestStart = (test: Test) => Promise; +export declare type OnTestFailure = (test: Test, serializableError: SerializableError) => Promise; +export declare type OnTestSuccess = (test: Test, testResult: TestResult) => Promise; +export declare type TestFramework = (globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, environment: JestEnvironment, runtime: Runtime, testPath: string) => Promise; +export declare type TestRunnerOptions = { + serial: boolean; +}; +export declare type TestRunnerContext = { + changedFiles?: Set; + sourcesRelatedToTestsInChangedFiles?: Set; +}; +export declare type TestRunnerSerializedContext = { + changedFiles?: Array; + sourcesRelatedToTestsInChangedFiles?: Array; +}; +export declare type WatcherState = { + interrupted: boolean; +}; +export interface TestWatcher extends EventEmitter { + state: WatcherState; + setState(state: WatcherState): void; + isInterrupted(): boolean; + isWatchMode(): boolean; +} diff --git a/node_modules/@jest/core/node_modules/jest-runner/build/types.d.ts b/node_modules/@jest/core/node_modules/jest-runner/build/types.d.ts new file mode 100644 index 000000000..dcd557926 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runner/build/types.d.ts @@ -0,0 +1,52 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/// +import type { EventEmitter } from 'events'; +import type { Config } from '@jest/types'; +import type { SerializableError, TestResult } from '@jest/test-result'; +import type { JestEnvironment } from '@jest/environment'; +import type { FS as HasteFS, ModuleMap } from 'jest-haste-map'; +import HasteResolver = require('jest-resolve'); +import Runtime = require('jest-runtime'); +export declare type ErrorWithCode = Error & { + code?: string; +}; +export declare type Test = { + context: Context; + duration?: number; + path: Config.Path; +}; +export declare type Context = { + config: Config.ProjectConfig; + hasteFS: HasteFS; + moduleMap: ModuleMap; + resolver: HasteResolver; +}; +export declare type OnTestStart = (test: Test) => Promise; +export declare type OnTestFailure = (test: Test, serializableError: SerializableError) => Promise; +export declare type OnTestSuccess = (test: Test, testResult: TestResult) => Promise; +export declare type TestFramework = (globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, environment: JestEnvironment, runtime: Runtime, testPath: string) => Promise; +export declare type TestRunnerOptions = { + serial: boolean; +}; +export declare type TestRunnerContext = { + changedFiles?: Set; + sourcesRelatedToTestsInChangedFiles?: Set; +}; +export declare type TestRunnerSerializedContext = { + changedFiles?: Array; + sourcesRelatedToTestsInChangedFiles?: Array; +}; +export declare type WatcherState = { + interrupted: boolean; +}; +export interface TestWatcher extends EventEmitter { + state: WatcherState; + setState(state: WatcherState): void; + isInterrupted(): boolean; + isWatchMode(): boolean; +} diff --git a/node_modules/@jest/core/node_modules/jest-runner/build/types.js b/node_modules/@jest/core/node_modules/jest-runner/build/types.js new file mode 100644 index 000000000..a5deb51a9 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runner/build/types.js @@ -0,0 +1,25 @@ +'use strict'; + +function _jestResolve() { + const data = _interopRequireDefault(require('jest-resolve')); + + _jestResolve = function () { + return data; + }; + + return data; +} + +function _jestRuntime() { + const data = _interopRequireDefault(require('jest-runtime')); + + _jestRuntime = function () { + return data; + }; + + return data; +} + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} diff --git a/node_modules/@jest/core/node_modules/jest-runner/package.json b/node_modules/@jest/core/node_modules/jest-runner/package.json new file mode 100644 index 000000000..8418c5846 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runner/package.json @@ -0,0 +1,88 @@ +{ + "_args": [ + [ + "jest-runner@25.5.4", + "/workspace/readable-readme" + ] + ], + "_development": true, + "_from": "jest-runner@25.5.4", + "_id": "jest-runner@25.5.4", + "_inBundle": false, + "_integrity": "sha512-V/2R7fKZo6blP8E9BL9vJ8aTU4TH2beuqGNxHbxi6t14XzTb+x90B3FRgdvuHm41GY8ch4xxvf0ATH4hdpjTqg==", + "_location": "/@jest/core/jest-runner", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "jest-runner@25.5.4", + "name": "jest-runner", + "escapedName": "jest-runner", + "rawSpec": "25.5.4", + "saveSpec": null, + "fetchSpec": "25.5.4" + }, + "_requiredBy": [ + "/@jest/core", + "/@jest/core/@jest/test-sequencer" + ], + "_resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-25.5.4.tgz", + "_spec": "25.5.4", + "_where": "/workspace/readable-readme", + "bugs": { + "url": "https://github.com/facebook/jest/issues" + }, + "dependencies": { + "@jest/console": "^25.5.0", + "@jest/environment": "^25.5.0", + "@jest/test-result": "^25.5.0", + "@jest/types": "^25.5.0", + "chalk": "^3.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.4", + "jest-config": "^25.5.4", + "jest-docblock": "^25.3.0", + "jest-haste-map": "^25.5.1", + "jest-jasmine2": "^25.5.4", + "jest-leak-detector": "^25.5.0", + "jest-message-util": "^25.5.0", + "jest-resolve": "^25.5.1", + "jest-runtime": "^25.5.4", + "jest-util": "^25.5.0", + "jest-worker": "^25.5.0", + "source-map-support": "^0.5.6", + "throat": "^5.0.0" + }, + "devDependencies": { + "@types/exit": "^0.1.30", + "@types/graceful-fs": "^4.1.2", + "@types/node": "*", + "@types/source-map-support": "^0.5.0", + "jest-circus": "^25.5.4" + }, + "engines": { + "node": ">= 8.3" + }, + "gitHead": "389d13724bbf6bb64dcde9700a6ecea3333942db", + "homepage": "https://github.com/facebook/jest#readme", + "license": "MIT", + "main": "build/index.js", + "name": "jest-runner", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/facebook/jest.git", + "directory": "packages/jest-runner" + }, + "types": "build/index.d.ts", + "typesVersions": { + "<3.8": { + "build/*": [ + "build/ts3.4/*" + ] + } + }, + "version": "25.5.4" +} diff --git a/node_modules/@jest/core/node_modules/jest-runtime/LICENSE b/node_modules/@jest/core/node_modules/jest-runtime/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@jest/core/node_modules/jest-runtime/bin/jest-runtime.js b/node_modules/@jest/core/node_modules/jest-runtime/bin/jest-runtime.js new file mode 100755 index 000000000..6a510e724 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/bin/jest-runtime.js @@ -0,0 +1,13 @@ +#!/usr/bin/env node +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +if (process.env.NODE_ENV == null) { + process.env.NODE_ENV = 'test'; +} + +require('../build/cli').run(); diff --git a/node_modules/@jest/core/node_modules/jest-runtime/build/cli/args.d.ts b/node_modules/@jest/core/node_modules/jest-runtime/build/cli/args.d.ts new file mode 100644 index 000000000..191ccbe42 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/build/cli/args.d.ts @@ -0,0 +1,9 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Options } from 'yargs'; +export declare const usage = "Usage: $0 [--config=] "; +export declare const options: Record<'cache' | 'config' | 'debug' | 'version' | 'watchman', Options>; diff --git a/node_modules/@jest/core/node_modules/jest-runtime/build/cli/args.js b/node_modules/@jest/core/node_modules/jest-runtime/build/cli/args.js new file mode 100644 index 000000000..9419c6099 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/build/cli/args.js @@ -0,0 +1,46 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.options = exports.usage = void 0; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const usage = 'Usage: $0 [--config=] '; +exports.usage = usage; +const options = { + cache: { + default: true, + description: + 'Whether to use the preprocessor cache. Disable ' + + 'the cache using --no-cache.', + type: 'boolean' + }, + config: { + alias: 'c', + description: 'The path to a Jest config file.', + type: 'string' + }, + debug: { + description: 'Print debugging info about your jest config.', + type: 'boolean' + }, + version: { + alias: 'v', + description: 'Print the version and exit', + type: 'boolean' + }, + watchman: { + default: true, + description: + 'Whether to use watchman for file crawling. Disable using ' + + '--no-watchman.', + type: 'boolean' + } +}; +exports.options = options; diff --git a/node_modules/@jest/core/node_modules/jest-runtime/build/cli/index.d.ts b/node_modules/@jest/core/node_modules/jest-runtime/build/cli/index.d.ts new file mode 100644 index 000000000..7f3973e60 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/build/cli/index.d.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +export declare function run(cliArgv?: Config.Argv, cliInfo?: Array): Promise; diff --git a/node_modules/@jest/core/node_modules/jest-runtime/build/cli/index.js b/node_modules/@jest/core/node_modules/jest-runtime/build/cli/index.js new file mode 100644 index 000000000..36507d53f --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/build/cli/index.js @@ -0,0 +1,268 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.run = run; + +function _os() { + const data = require('os'); + + _os = function () { + return data; + }; + + return data; +} + +function path() { + const data = _interopRequireWildcard(require('path')); + + path = function () { + return data; + }; + + return data; +} + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +function _realpathNative() { + const data = require('realpath-native'); + + _realpathNative = function () { + return data; + }; + + return data; +} + +function _yargs() { + const data = _interopRequireDefault(require('yargs')); + + _yargs = function () { + return data; + }; + + return data; +} + +function _console() { + const data = require('@jest/console'); + + _console = function () { + return data; + }; + + return data; +} + +function _jestUtil() { + const data = require('jest-util'); + + _jestUtil = function () { + return data; + }; + + return data; +} + +function _jestValidate() { + const data = require('jest-validate'); + + _jestValidate = function () { + return data; + }; + + return data; +} + +function _jestConfig() { + const data = require('jest-config'); + + _jestConfig = function () { + return data; + }; + + return data; +} + +function _version() { + const data = require('../version'); + + _version = function () { + return data; + }; + + return data; +} + +var args = _interopRequireWildcard(require('./args')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +async function run(cliArgv, cliInfo) { + let argv; + + if (cliArgv) { + argv = cliArgv; + } else { + argv = _yargs() + .default.usage(args.usage) + .help(false) + .version(false) + .options(args.options).argv; + (0, _jestValidate().validateCLIOptions)(argv, { + ...args.options, + deprecationEntries: _jestConfig().deprecationEntries + }); + } + + if (argv.help) { + _yargs().default.showHelp(); + + process.on('exit', () => (process.exitCode = 1)); + return; + } + + if (argv.version) { + console.log(`v${_version().VERSION}\n`); + return; + } + + if (!argv._.length) { + console.log('Please provide a path to a script. (See --help for details)'); + process.on('exit', () => (process.exitCode = 1)); + return; + } + + const root = (0, _realpathNative().sync)(process.cwd()); + const filePath = path().resolve(root, argv._[0]); + + if (argv.debug) { + const info = cliInfo ? ', ' + cliInfo.join(', ') : ''; + console.log(`Using Jest Runtime v${_version().VERSION}${info}`); + } + + const options = await (0, _jestConfig().readConfig)(argv, root); + const globalConfig = options.globalConfig; // Always disable automocking in scripts. + + const config = {...options.projectConfig, automock: false}; // Break circular dependency + + const Runtime = require('..'); + + try { + var _runtime$unstable_sho2; + + const hasteMap = await Runtime.createContext(config, { + maxWorkers: Math.max((0, _os().cpus)().length - 1, 1), + watchman: globalConfig.watchman + }); + + const Environment = require(config.testEnvironment); + + const environment = new Environment(config); + (0, _jestUtil().setGlobal)( + environment.global, + 'console', + new (_console().CustomConsole)(process.stdout, process.stderr) + ); + (0, _jestUtil().setGlobal)(environment.global, 'jestProjectConfig', config); + (0, _jestUtil().setGlobal)( + environment.global, + 'jestGlobalConfig', + globalConfig + ); + const runtime = new Runtime(config, environment, hasteMap.resolver); + + for (const path of config.setupFiles) { + var _runtime$unstable_sho; + + // TODO: remove ? in Jest 26 + const esm = + (_runtime$unstable_sho = runtime.unstable_shouldLoadAsEsm) === null || + _runtime$unstable_sho === void 0 + ? void 0 + : _runtime$unstable_sho.call(runtime, path); + + if (esm) { + await runtime.unstable_importModule(path); + } else { + runtime.requireModule(path); + } + } // TODO: remove ? in Jest 26 + + const esm = + (_runtime$unstable_sho2 = runtime.unstable_shouldLoadAsEsm) === null || + _runtime$unstable_sho2 === void 0 + ? void 0 + : _runtime$unstable_sho2.call(runtime, filePath); + + if (esm) { + await runtime.unstable_importModule(filePath); + } else { + runtime.requireModule(filePath); + } + } catch (e) { + console.error(_chalk().default.red(e.stack || e)); + process.on('exit', () => (process.exitCode = 1)); + } +} diff --git a/node_modules/@jest/core/node_modules/jest-runtime/build/helpers.d.ts b/node_modules/@jest/core/node_modules/jest-runtime/build/helpers.d.ts new file mode 100644 index 000000000..8529b38f8 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/build/helpers.d.ts @@ -0,0 +1,7 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare const findSiblingsWithFileExtension: (moduleFileExtensions: string[], from: string, moduleName: string) => string; diff --git a/node_modules/@jest/core/node_modules/jest-runtime/build/helpers.js b/node_modules/@jest/core/node_modules/jest-runtime/build/helpers.js new file mode 100644 index 000000000..a7ef6c618 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/build/helpers.js @@ -0,0 +1,131 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.findSiblingsWithFileExtension = void 0; + +function path() { + const data = _interopRequireWildcard(require('path')); + + path = function () { + return data; + }; + + return data; +} + +function _slash() { + const data = _interopRequireDefault(require('slash')); + + _slash = function () { + return data; + }; + + return data; +} + +function _glob() { + const data = _interopRequireDefault(require('glob')); + + _glob = function () { + return data; + }; + + return data; +} + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const findSiblingsWithFileExtension = ( + moduleFileExtensions, + from, + moduleName +) => { + if (!path().isAbsolute(moduleName) && path().extname(moduleName) === '') { + const dirname = path().dirname(from); + const pathToModule = path().resolve(dirname, moduleName); + + try { + const slashedDirname = (0, _slash().default)(dirname); + + const matches = _glob() + .default.sync(`${pathToModule}.*`) + .map(match => (0, _slash().default)(match)) + .map(match => { + const relativePath = path().posix.relative(slashedDirname, match); + return path().posix.dirname(match) === slashedDirname + ? `./${relativePath}` + : relativePath; + }) + .map(match => `\t'${match}'`) + .join('\n'); + + if (matches) { + const foundMessage = `\n\nHowever, Jest was able to find:\n${matches}`; + const mappedModuleFileExtensions = moduleFileExtensions + .map(ext => `'${ext}'`) + .join(', '); + return ( + foundMessage + + "\n\nYou might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently " + + `[${mappedModuleFileExtensions}].\n\nSee https://jestjs.io/docs/en/configuration#modulefileextensions-arraystring` + ); + } + } catch (_unused) {} + } + + return ''; +}; + +exports.findSiblingsWithFileExtension = findSiblingsWithFileExtension; diff --git a/node_modules/@jest/core/node_modules/jest-runtime/build/index.d.ts b/node_modules/@jest/core/node_modules/jest-runtime/build/index.d.ts new file mode 100644 index 000000000..6c0c8f866 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/build/index.d.ts @@ -0,0 +1,124 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +import type { JestEnvironment } from '@jest/environment'; +import type { SourceMapRegistry } from '@jest/source-map'; +import { ShouldInstrumentOptions, shouldInstrument } from '@jest/transform'; +import type { V8CoverageResult } from '@jest/test-result'; +import { options as cliOptions } from './cli/args'; +import type { Context as JestContext } from './types'; +import HasteMap = require('jest-haste-map'); +import Resolver = require('jest-resolve'); +declare type HasteMapOptions = { + console?: Console; + maxWorkers: number; + resetCache: boolean; + watch?: boolean; + watchman: boolean; +}; +declare type InternalModuleOptions = { + isInternalModule: boolean; + supportsDynamicImport: boolean; + supportsStaticESM: boolean; +}; +declare namespace Runtime { + type Context = JestContext; + type RuntimeType = Runtime; +} +declare class Runtime { + private _cacheFS; + private _config; + private _coverageOptions; + private _currentlyExecutingModulePath; + private _environment; + private _explicitShouldMock; + private _internalModuleRegistry; + private _isCurrentlyExecutingManualMock; + private _mockFactories; + private _mockMetaDataCache; + private _mockRegistry; + private _isolatedMockRegistry; + private _moduleMocker; + private _isolatedModuleRegistry; + private _moduleRegistry; + private _esmoduleRegistry; + private _resolver; + private _shouldAutoMock; + private _shouldMockModuleCache; + private _shouldUnmockTransitiveDependenciesCache; + private _sourceMapRegistry; + private _scriptTransformer; + private _fileTransforms; + private _v8CoverageInstrumenter; + private _v8CoverageResult; + private _transitiveShouldMock; + private _unmockList; + private _virtualMocks; + private _moduleImplementation?; + private jestObjectCaches; + constructor(config: Config.ProjectConfig, environment: JestEnvironment, resolver: Resolver, cacheFS?: Record, coverageOptions?: ShouldInstrumentOptions); + static shouldInstrument: typeof shouldInstrument; + static createContext(config: Config.ProjectConfig, options: { + console?: Console; + maxWorkers: number; + watch?: boolean; + watchman: boolean; + }): Promise; + static createHasteMap(config: Config.ProjectConfig, options?: HasteMapOptions): HasteMap; + static createResolver(config: Config.ProjectConfig, moduleMap: HasteMap.ModuleMap): Resolver; + static runCLI(args?: Config.Argv, info?: Array): Promise; + static getCLIOptions(): typeof cliOptions; + unstable_shouldLoadAsEsm: typeof import("jest-resolve/build/shouldLoadAsEsm").default; + private loadEsmModule; + private linkModules; + unstable_importModule(from: Config.Path, moduleName?: string): Promise; + private loadCjsAsEsm; + requireModule(from: Config.Path, moduleName?: string, options?: InternalModuleOptions, isRequireActual?: boolean | null): T; + requireInternalModule(from: Config.Path, to?: string): T; + requireActual(from: Config.Path, moduleName: string): T; + requireMock(from: Config.Path, moduleName: string): T; + private _loadModule; + private _getFullTransformationOptions; + requireModuleOrMock(from: Config.Path, moduleName: string): T; + isolateModules(fn: () => void): void; + resetModules(): void; + collectV8Coverage(): Promise; + stopCollectingV8Coverage(): Promise; + getAllCoverageInfoCopy(): JestEnvironment['global']['__coverage__']; + getAllV8CoverageInfoCopy(): V8CoverageResult; + getSourceMapInfo(_coveredFiles: Set): Record; + getSourceMaps(): SourceMapRegistry; + setMock(from: string, moduleName: string, mockFactory: () => unknown, options?: { + virtual?: boolean; + }): void; + restoreAllMocks(): void; + resetAllMocks(): void; + clearAllMocks(): void; + teardown(): void; + private _resolveModule; + private _requireResolve; + private _requireResolvePaths; + private _execModule; + private transformFile; + private createScriptFromCode; + private _requireCoreModule; + private _importCoreModule; + private _getMockedNativeModule; + private _generateMock; + private _shouldMock; + private _createRequireImplementation; + private _createJestObjectFor; + private _logFormattedReferenceError; + private wrapCodeInModuleWrapper; + private constructInjectedModuleParameters; + private handleExecutionError; + private getGlobalsForCjs; + private getGlobalsForEsm; + private getGlobalsFromEnvironment; + private readFile; +} +export = Runtime; diff --git a/node_modules/@jest/core/node_modules/jest-runtime/build/index.js b/node_modules/@jest/core/node_modules/jest-runtime/build/index.js new file mode 100644 index 000000000..35d64c03a --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/build/index.js @@ -0,0 +1,1859 @@ +'use strict'; + +function _url() { + const data = require('url'); + + _url = function () { + return data; + }; + + return data; +} + +function path() { + const data = _interopRequireWildcard(require('path')); + + path = function () { + return data; + }; + + return data; +} + +function _vm() { + const data = require('vm'); + + _vm = function () { + return data; + }; + + return data; +} + +function nativeModule() { + const data = _interopRequireWildcard(require('module')); + + nativeModule = function () { + return data; + }; + + return data; +} + +function _jestMessageUtil() { + const data = require('jest-message-util'); + + _jestMessageUtil = function () { + return data; + }; + + return data; +} + +function _jestUtil() { + const data = require('jest-util'); + + _jestUtil = function () { + return data; + }; + + return data; +} + +function _jestRegexUtil() { + const data = require('jest-regex-util'); + + _jestRegexUtil = function () { + return data; + }; + + return data; +} + +function _transform() { + const data = require('@jest/transform'); + + _transform = function () { + return data; + }; + + return data; +} + +function _collectV8Coverage() { + const data = require('collect-v8-coverage'); + + _collectV8Coverage = function () { + return data; + }; + + return data; +} + +function fs() { + const data = _interopRequireWildcard(require('graceful-fs')); + + fs = function () { + return data; + }; + + return data; +} + +var _cli = require('./cli'); + +var _args = require('./cli/args'); + +var _helpers = require('./helpers'); + +function _jestMock() { + const data = _interopRequireDefault(require('jest-mock')); + + _jestMock = function () { + return data; + }; + + return data; +} + +function _jestHasteMap() { + const data = _interopRequireDefault(require('jest-haste-map')); + + _jestHasteMap = function () { + return data; + }; + + return data; +} + +function _jestResolve() { + const data = _interopRequireDefault(require('jest-resolve')); + + _jestResolve = function () { + return data; + }; + + return data; +} + +function _jestSnapshot() { + const data = _interopRequireDefault(require('jest-snapshot')); + + _jestSnapshot = function () { + return data; + }; + + return data; +} + +function _stripBom() { + const data = _interopRequireDefault(require('strip-bom')); + + _stripBom = function () { + return data; + }; + + return data; +} + +var _Object$fromEntries; + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +const defaultTransformOptions = { + isInternalModule: false, + supportsDynamicImport: false, + supportsStaticESM: false +}; +const fromEntries = + (_Object$fromEntries = Object.fromEntries) !== null && + _Object$fromEntries !== void 0 + ? _Object$fromEntries + : function fromEntries(iterable) { + return [...iterable].reduce((obj, [key, val]) => { + obj[key] = val; + return obj; + }, {}); + }; +const testTimeoutSymbol = Symbol.for('TEST_TIMEOUT_SYMBOL'); +const retryTimesSymbol = Symbol.for('RETRY_TIMES'); +const NODE_MODULES = path().sep + 'node_modules' + path().sep; + +const getModuleNameMapper = config => { + if ( + Array.isArray(config.moduleNameMapper) && + config.moduleNameMapper.length + ) { + return config.moduleNameMapper.map(([regex, moduleName]) => ({ + moduleName, + regex: new RegExp(regex) + })); + } + + return null; +}; + +const unmockRegExpCache = new WeakMap(); +const EVAL_RESULT_VARIABLE = 'Object.'; +const runtimeSupportsVmModules = typeof _vm().SyntheticModule === 'function'; +/* eslint-disable-next-line no-redeclare */ + +class Runtime { + constructor(config, environment, resolver, cacheFS = {}, coverageOptions) { + _defineProperty(this, '_cacheFS', void 0); + + _defineProperty(this, '_config', void 0); + + _defineProperty(this, '_coverageOptions', void 0); + + _defineProperty(this, '_currentlyExecutingModulePath', void 0); + + _defineProperty(this, '_environment', void 0); + + _defineProperty(this, '_explicitShouldMock', void 0); + + _defineProperty(this, '_internalModuleRegistry', void 0); + + _defineProperty(this, '_isCurrentlyExecutingManualMock', void 0); + + _defineProperty(this, '_mockFactories', void 0); + + _defineProperty(this, '_mockMetaDataCache', void 0); + + _defineProperty(this, '_mockRegistry', void 0); + + _defineProperty(this, '_isolatedMockRegistry', void 0); + + _defineProperty(this, '_moduleMocker', void 0); + + _defineProperty(this, '_isolatedModuleRegistry', void 0); + + _defineProperty(this, '_moduleRegistry', void 0); + + _defineProperty(this, '_esmoduleRegistry', void 0); + + _defineProperty(this, '_resolver', void 0); + + _defineProperty(this, '_shouldAutoMock', void 0); + + _defineProperty(this, '_shouldMockModuleCache', void 0); + + _defineProperty(this, '_shouldUnmockTransitiveDependenciesCache', void 0); + + _defineProperty(this, '_sourceMapRegistry', void 0); + + _defineProperty(this, '_scriptTransformer', void 0); + + _defineProperty(this, '_fileTransforms', void 0); + + _defineProperty(this, '_v8CoverageInstrumenter', void 0); + + _defineProperty(this, '_v8CoverageResult', void 0); + + _defineProperty(this, '_transitiveShouldMock', void 0); + + _defineProperty(this, '_unmockList', void 0); + + _defineProperty(this, '_virtualMocks', void 0); + + _defineProperty(this, '_moduleImplementation', void 0); + + _defineProperty(this, 'jestObjectCaches', void 0); + + _defineProperty( + this, + 'unstable_shouldLoadAsEsm', + _jestResolve().default.unstable_shouldLoadAsEsm + ); + + this._cacheFS = new Map(Object.entries(cacheFS)); + this._config = config; + this._coverageOptions = coverageOptions || { + changedFiles: undefined, + collectCoverage: false, + collectCoverageFrom: [], + collectCoverageOnlyFrom: undefined, + coverageProvider: 'babel', + sourcesRelatedToTestsInChangedFiles: undefined + }; + this._currentlyExecutingModulePath = ''; + this._environment = environment; + this._explicitShouldMock = new Map(); + this._internalModuleRegistry = new Map(); + this._isCurrentlyExecutingManualMock = null; + this._mockFactories = new Map(); + this._mockRegistry = new Map(); // during setup, this cannot be null (and it's fine to explode if it is) + + this._moduleMocker = this._environment.moduleMocker; + this._isolatedModuleRegistry = null; + this._isolatedMockRegistry = null; + this._moduleRegistry = new Map(); + this._esmoduleRegistry = new Map(); + this._resolver = resolver; + this._scriptTransformer = new (_transform().ScriptTransformer)(config); + this._shouldAutoMock = config.automock; + this._sourceMapRegistry = new Map(); + this._fileTransforms = new Map(); + this._virtualMocks = new Map(); + this.jestObjectCaches = new Map(); + this._mockMetaDataCache = new Map(); + this._shouldMockModuleCache = new Map(); + this._shouldUnmockTransitiveDependenciesCache = new Map(); + this._transitiveShouldMock = new Map(); + this._unmockList = unmockRegExpCache.get(config); + + if (!this._unmockList && config.unmockedModulePathPatterns) { + this._unmockList = new RegExp( + config.unmockedModulePathPatterns.join('|') + ); + unmockRegExpCache.set(config, this._unmockList); + } + + if (config.automock) { + const virtualMocks = fromEntries(this._virtualMocks); + config.setupFiles.forEach(filePath => { + if (filePath && filePath.includes(NODE_MODULES)) { + const moduleID = this._resolver.getModuleID(virtualMocks, filePath); + + this._transitiveShouldMock.set(moduleID, false); + } + }); + } + + this.resetModules(); + } + + static createContext(config, options) { + (0, _jestUtil().createDirectory)(config.cacheDirectory); + const instance = Runtime.createHasteMap(config, { + console: options.console, + maxWorkers: options.maxWorkers, + resetCache: !config.cache, + watch: options.watch, + watchman: options.watchman + }); + return instance.build().then( + hasteMap => ({ + config, + hasteFS: hasteMap.hasteFS, + moduleMap: hasteMap.moduleMap, + resolver: Runtime.createResolver(config, hasteMap.moduleMap) + }), + error => { + throw error; + } + ); + } + + static createHasteMap(config, options) { + const ignorePatternParts = [ + ...config.modulePathIgnorePatterns, + ...(options && options.watch ? config.watchPathIgnorePatterns : []), + config.cacheDirectory.startsWith(config.rootDir + path().sep) && + config.cacheDirectory + ].filter(Boolean); + const ignorePattern = + ignorePatternParts.length > 0 + ? new RegExp(ignorePatternParts.join('|')) + : undefined; + return new (_jestHasteMap().default)({ + cacheDirectory: config.cacheDirectory, + computeSha1: config.haste.computeSha1, + console: options && options.console, + dependencyExtractor: config.dependencyExtractor, + extensions: [_jestSnapshot().default.EXTENSION].concat( + config.moduleFileExtensions + ), + hasteImplModulePath: config.haste.hasteImplModulePath, + ignorePattern, + maxWorkers: (options && options.maxWorkers) || 1, + mocksPattern: (0, _jestRegexUtil().escapePathForRegex)( + path().sep + '__mocks__' + path().sep + ), + name: config.name, + platforms: config.haste.platforms || ['ios', 'android'], + providesModuleNodeModules: config.haste.providesModuleNodeModules, + resetCache: options && options.resetCache, + retainAllFiles: false, + rootDir: config.rootDir, + roots: config.roots, + throwOnModuleCollision: config.haste.throwOnModuleCollision, + useWatchman: options && options.watchman, + watch: options && options.watch + }); + } + + static createResolver(config, moduleMap) { + return new (_jestResolve().default)(moduleMap, { + browser: config.browser, + defaultPlatform: config.haste.defaultPlatform, + extensions: config.moduleFileExtensions.map(extension => '.' + extension), + hasCoreModules: true, + moduleDirectories: config.moduleDirectories, + moduleNameMapper: getModuleNameMapper(config), + modulePaths: config.modulePaths, + platforms: config.haste.platforms, + resolver: config.resolver, + rootDir: config.rootDir + }); + } + + static runCLI(args, info) { + return (0, _cli.run)(args, info); + } + + static getCLIOptions() { + return _args.options; + } // unstable as it should be replaced by https://github.com/nodejs/modules/issues/393, and we don't want people to use it + + async loadEsmModule(modulePath, query = '') { + const cacheKey = modulePath + query; + + if (!this._esmoduleRegistry.has(cacheKey)) { + invariant( + typeof this._environment.getVmContext === 'function', + 'ES Modules are only supported if your test environment has the `getVmContext` function' + ); + + const context = this._environment.getVmContext(); + + invariant(context); + + if (this._resolver.isCoreModule(modulePath)) { + const core = await this._importCoreModule(modulePath, context); + + this._esmoduleRegistry.set(cacheKey, core); + + return core; + } + + const transformedCode = this.transformFile(modulePath, { + isInternalModule: false, + supportsDynamicImport: true, + supportsStaticESM: true + }); + const module = new (_vm().SourceTextModule)(transformedCode, { + context, + identifier: modulePath, + importModuleDynamically: this.linkModules.bind(this), + + initializeImportMeta(meta) { + meta.url = (0, _url().pathToFileURL)(modulePath).href; + } + }); + + this._esmoduleRegistry.set( + cacheKey, // we wanna put the linking promise in the cache so modules loaded in + // parallel can all await it. We then await it synchronously below, so + // we shouldn't get any unhandled rejections + module + .link(this.linkModules.bind(this)) + .then(() => module.evaluate()) + .then(() => module) + ); + } + + const module = this._esmoduleRegistry.get(cacheKey); + + invariant(module); + return module; + } + + linkModules(specifier, referencingModule) { + if (specifier === '@jest/globals') { + const fromCache = this._esmoduleRegistry.get('@jest/globals'); + + if (fromCache) { + return fromCache; + } + + const globals = this.getGlobalsForEsm( + referencingModule.identifier, + referencingModule.context + ); + + this._esmoduleRegistry.set('@jest/globals', globals); + + return globals; + } + + const [path, query] = specifier.split('?'); + + const resolved = this._resolveModule(referencingModule.identifier, path); + + if ( + this._resolver.isCoreModule(resolved) || + this.unstable_shouldLoadAsEsm(resolved) + ) { + return this.loadEsmModule(resolved, query); + } + + return this.loadCjsAsEsm( + referencingModule.identifier, + resolved, + referencingModule.context + ); + } + + async unstable_importModule(from, moduleName) { + invariant( + runtimeSupportsVmModules, + 'You need to run with a version of node that supports ES Modules in the VM API.' + ); + const [path, query] = (moduleName !== null && moduleName !== void 0 + ? moduleName + : '' + ).split('?'); + + const modulePath = this._resolveModule(from, path); + + return this.loadEsmModule(modulePath, query); + } + + async loadCjsAsEsm(from, modulePath, context) { + // CJS loaded via `import` should share cache with other CJS: https://github.com/nodejs/modules/issues/503 + const cjs = this.requireModuleOrMock(from, modulePath); + const module = new (_vm().SyntheticModule)( + ['default'], + function () { + // @ts-ignore: TS doesn't know what `this` is + this.setExport('default', cjs); + }, + { + context, + identifier: modulePath + } + ); + await module.link(() => { + throw new Error('This should never happen'); + }); + await module.evaluate(); + return module; + } + + requireModule(from, moduleName, options, isRequireActual) { + const moduleID = this._resolver.getModuleID( + fromEntries(this._virtualMocks), + from, + moduleName + ); + + let modulePath; // Some old tests rely on this mocking behavior. Ideally we'll change this + // to be more explicit. + + const moduleResource = moduleName && this._resolver.getModule(moduleName); + + const manualMock = + moduleName && this._resolver.getMockModule(from, moduleName); + + if ( + !(options === null || options === void 0 + ? void 0 + : options.isInternalModule) && + !isRequireActual && + !moduleResource && + manualMock && + manualMock !== this._isCurrentlyExecutingManualMock && + this._explicitShouldMock.get(moduleID) !== false + ) { + modulePath = manualMock; + } + + if (moduleName && this._resolver.isCoreModule(moduleName)) { + return this._requireCoreModule(moduleName); + } + + if (!modulePath) { + modulePath = this._resolveModule(from, moduleName); + } + + let moduleRegistry; + + if ( + options === null || options === void 0 ? void 0 : options.isInternalModule + ) { + moduleRegistry = this._internalModuleRegistry; + } else { + if ( + this._moduleRegistry.get(modulePath) || + !this._isolatedModuleRegistry + ) { + moduleRegistry = this._moduleRegistry; + } else { + moduleRegistry = this._isolatedModuleRegistry; + } + } + + const module = moduleRegistry.get(modulePath); + + if (module) { + return module.exports; + } // We must register the pre-allocated module object first so that any + // circular dependencies that may arise while evaluating the module can + // be satisfied. + + const localModule = { + children: [], + exports: {}, + filename: modulePath, + id: modulePath, + loaded: false + }; + moduleRegistry.set(modulePath, localModule); + + this._loadModule( + localModule, + from, + moduleName, + modulePath, + options, + moduleRegistry + ); + + return localModule.exports; + } + + requireInternalModule(from, to) { + return this.requireModule(from, to, { + isInternalModule: true, + supportsDynamicImport: false, + supportsStaticESM: false + }); + } + + requireActual(from, moduleName) { + return this.requireModule(from, moduleName, undefined, true); + } + + requireMock(from, moduleName) { + const moduleID = this._resolver.getModuleID( + fromEntries(this._virtualMocks), + from, + moduleName + ); + + if ( + this._isolatedMockRegistry && + this._isolatedMockRegistry.get(moduleID) + ) { + return this._isolatedMockRegistry.get(moduleID); + } else if (this._mockRegistry.get(moduleID)) { + return this._mockRegistry.get(moduleID); + } + + const mockRegistry = this._isolatedMockRegistry || this._mockRegistry; + + if (this._mockFactories.has(moduleID)) { + // has check above makes this ok + const module = this._mockFactories.get(moduleID)(); + + mockRegistry.set(moduleID, module); + return module; + } + + const manualMockOrStub = this._resolver.getMockModule(from, moduleName); + + let modulePath; + + if (manualMockOrStub) { + modulePath = this._resolveModule(from, manualMockOrStub); + } else { + modulePath = this._resolveModule(from, moduleName); + } + + let isManualMock = + manualMockOrStub && + !this._resolver.resolveStubModuleName(from, moduleName); + + if (!isManualMock) { + // If the actual module file has a __mocks__ dir sitting immediately next + // to it, look to see if there is a manual mock for this file. + // + // subDir1/my_module.js + // subDir1/__mocks__/my_module.js + // subDir2/my_module.js + // subDir2/__mocks__/my_module.js + // + // Where some other module does a relative require into each of the + // respective subDir{1,2} directories and expects a manual mock + // corresponding to that particular my_module.js file. + const moduleDir = path().dirname(modulePath); + const moduleFileName = path().basename(modulePath); + const potentialManualMock = path().join( + moduleDir, + '__mocks__', + moduleFileName + ); + + if (fs().existsSync(potentialManualMock)) { + isManualMock = true; + modulePath = potentialManualMock; + } + } + + if (isManualMock) { + const localModule = { + children: [], + exports: {}, + filename: modulePath, + id: modulePath, + loaded: false + }; + + this._loadModule( + localModule, + from, + moduleName, + modulePath, + undefined, + mockRegistry + ); + + mockRegistry.set(moduleID, localModule.exports); + } else { + // Look for a real module to generate an automock from + mockRegistry.set(moduleID, this._generateMock(from, moduleName)); + } + + return mockRegistry.get(moduleID); + } + + _loadModule( + localModule, + from, + moduleName, + modulePath, + options, + moduleRegistry + ) { + if (path().extname(modulePath) === '.json') { + const text = (0, _stripBom().default)(this.readFile(modulePath)); + + const transformedFile = this._scriptTransformer.transformJson( + modulePath, + this._getFullTransformationOptions(options), + text + ); + + localModule.exports = this._environment.global.JSON.parse( + transformedFile + ); + } else if (path().extname(modulePath) === '.node') { + localModule.exports = require(modulePath); + } else { + // Only include the fromPath if a moduleName is given. Else treat as root. + const fromPath = moduleName ? from : null; + + this._execModule(localModule, options, moduleRegistry, fromPath); + } + + localModule.loaded = true; + } + + _getFullTransformationOptions(options = defaultTransformOptions) { + return {...options, ...this._coverageOptions}; + } + + requireModuleOrMock(from, moduleName) { + // this module is unmockable + if (moduleName === '@jest/globals') { + // @ts-ignore: we don't care that it's not assignable to T + return this.getGlobalsForCjs(from); + } + + try { + if (this._shouldMock(from, moduleName)) { + return this.requireMock(from, moduleName); + } else { + return this.requireModule(from, moduleName); + } + } catch (e) { + const moduleNotFound = _jestResolve().default.tryCastModuleNotFoundError( + e + ); + + if (moduleNotFound) { + if ( + moduleNotFound.siblingWithSimilarExtensionFound === null || + moduleNotFound.siblingWithSimilarExtensionFound === undefined + ) { + moduleNotFound.hint = (0, _helpers.findSiblingsWithFileExtension)( + this._config.moduleFileExtensions, + from, + moduleNotFound.moduleName || moduleName + ); + moduleNotFound.siblingWithSimilarExtensionFound = Boolean( + moduleNotFound.hint + ); + } + + moduleNotFound.buildMessage(this._config.rootDir); + throw moduleNotFound; + } + + throw e; + } + } + + isolateModules(fn) { + if (this._isolatedModuleRegistry || this._isolatedMockRegistry) { + throw new Error( + 'isolateModules cannot be nested inside another isolateModules.' + ); + } + + this._isolatedModuleRegistry = new Map(); + this._isolatedMockRegistry = new Map(); + + try { + fn(); + } finally { + var _this$_isolatedModule, _this$_isolatedMockRe; + + // might be cleared within the callback + (_this$_isolatedModule = this._isolatedModuleRegistry) === null || + _this$_isolatedModule === void 0 + ? void 0 + : _this$_isolatedModule.clear(); + (_this$_isolatedMockRe = this._isolatedMockRegistry) === null || + _this$_isolatedMockRe === void 0 + ? void 0 + : _this$_isolatedMockRe.clear(); + this._isolatedModuleRegistry = null; + this._isolatedMockRegistry = null; + } + } + + resetModules() { + var _this$_isolatedModule2, _this$_isolatedMockRe2; + + (_this$_isolatedModule2 = this._isolatedModuleRegistry) === null || + _this$_isolatedModule2 === void 0 + ? void 0 + : _this$_isolatedModule2.clear(); + (_this$_isolatedMockRe2 = this._isolatedMockRegistry) === null || + _this$_isolatedMockRe2 === void 0 + ? void 0 + : _this$_isolatedMockRe2.clear(); + this._isolatedModuleRegistry = null; + this._isolatedMockRegistry = null; + + this._mockRegistry.clear(); + + this._moduleRegistry.clear(); + + this._esmoduleRegistry.clear(); + + if (this._environment) { + if (this._environment.global) { + const envGlobal = this._environment.global; + Object.keys(envGlobal).forEach(key => { + const globalMock = envGlobal[key]; + + if ( + ((typeof globalMock === 'object' && globalMock !== null) || + typeof globalMock === 'function') && + globalMock._isMockFunction === true + ) { + globalMock.mockClear(); + } + }); + } + + if (this._environment.fakeTimers) { + this._environment.fakeTimers.clearAllTimers(); + } + } + } + + async collectV8Coverage() { + this._v8CoverageInstrumenter = new (_collectV8Coverage().CoverageInstrumenter)(); + await this._v8CoverageInstrumenter.startInstrumenting(); + } + + async stopCollectingV8Coverage() { + if (!this._v8CoverageInstrumenter) { + throw new Error('You need to call `collectV8Coverage` first.'); + } + + this._v8CoverageResult = await this._v8CoverageInstrumenter.stopInstrumenting(); + } + + getAllCoverageInfoCopy() { + return (0, _jestUtil().deepCyclicCopy)( + this._environment.global.__coverage__ + ); + } + + getAllV8CoverageInfoCopy() { + if (!this._v8CoverageResult) { + throw new Error('You need to `stopCollectingV8Coverage` first'); + } + + return this._v8CoverageResult + .filter(res => res.url.startsWith('file://')) + .map(res => ({...res, url: (0, _url().fileURLToPath)(res.url)})) + .filter( + ( + res // TODO: will this work on windows? It might be better if `shouldInstrument` deals with it anyways + ) => + res.url.startsWith(this._config.rootDir) && + this._fileTransforms.has(res.url) && + (0, _transform().shouldInstrument)( + res.url, + this._coverageOptions, + this._config + ) + ) + .map(result => { + const transformedFile = this._fileTransforms.get(result.url); + + return { + codeTransformResult: transformedFile, + result + }; + }); + } // TODO - remove in Jest 26 + + getSourceMapInfo(_coveredFiles) { + return {}; + } + + getSourceMaps() { + return fromEntries(this._sourceMapRegistry); + } + + setMock(from, moduleName, mockFactory, options) { + if (options === null || options === void 0 ? void 0 : options.virtual) { + const mockPath = this._resolver.getModulePath(from, moduleName); + + this._virtualMocks.set(mockPath, true); + } + + const moduleID = this._resolver.getModuleID( + fromEntries(this._virtualMocks), + from, + moduleName + ); + + this._explicitShouldMock.set(moduleID, true); + + this._mockFactories.set(moduleID, mockFactory); + } + + restoreAllMocks() { + this._moduleMocker.restoreAllMocks(); + } + + resetAllMocks() { + this._moduleMocker.resetAllMocks(); + } + + clearAllMocks() { + this._moduleMocker.clearAllMocks(); + } + + teardown() { + this.restoreAllMocks(); + this.resetAllMocks(); + this.resetModules(); + + this._internalModuleRegistry.clear(); + + this._mockFactories.clear(); + + this._mockMetaDataCache.clear(); + + this._shouldMockModuleCache.clear(); + + this._shouldUnmockTransitiveDependenciesCache.clear(); + + this._explicitShouldMock.clear(); + + this._transitiveShouldMock.clear(); + + this._virtualMocks.clear(); + + this._cacheFS.clear(); + + this._unmockList = undefined; + + this._sourceMapRegistry.clear(); + + this._fileTransforms.clear(); + + this.jestObjectCaches.clear(); + this._v8CoverageResult = []; + this._v8CoverageInstrumenter = undefined; + this._moduleImplementation = undefined; + } + + _resolveModule(from, to) { + return to ? this._resolver.resolveModule(from, to) : from; + } + + _requireResolve(from, moduleName, options = {}) { + if (moduleName == null) { + throw new Error( + 'The first argument to require.resolve must be a string. Received null or undefined.' + ); + } + + const {paths} = options; + + if (paths) { + for (const p of paths) { + const absolutePath = path().resolve(from, '..', p); + + const module = this._resolver.resolveModuleFromDirIfExists( + absolutePath, + moduleName, // required to also resolve files without leading './' directly in the path + { + paths: [absolutePath] + } + ); + + if (module) { + return module; + } + } + + throw new (_jestResolve().default.ModuleNotFoundError)( + `Cannot resolve module '${moduleName}' from paths ['${paths.join( + "', '" + )}'] from ${from}` + ); + } + + try { + return this._resolveModule(from, moduleName); + } catch (err) { + const module = this._resolver.getMockModule(from, moduleName); + + if (module) { + return module; + } else { + throw err; + } + } + } + + _requireResolvePaths(from, moduleName) { + if (moduleName == null) { + throw new Error( + 'The first argument to require.resolve.paths must be a string. Received null or undefined.' + ); + } + + if (!moduleName.length) { + throw new Error( + 'The first argument to require.resolve.paths must not be the empty string.' + ); + } + + if (moduleName[0] === '.') { + return [path().resolve(from, '..')]; + } + + if (this._resolver.isCoreModule(moduleName)) { + return null; + } + + return this._resolver.getModulePaths(path().resolve(from, '..')); + } + + _execModule(localModule, options, moduleRegistry, from) { + // If the environment was disposed, prevent this module from being executed. + if (!this._environment.global) { + return; + } + + const filename = localModule.filename; + const lastExecutingModulePath = this._currentlyExecutingModulePath; + this._currentlyExecutingModulePath = filename; + const origCurrExecutingManualMock = this._isCurrentlyExecutingManualMock; + this._isCurrentlyExecutingManualMock = filename; + const dirname = path().dirname(filename); + localModule.children = []; + Object.defineProperty(localModule, 'parent', { + enumerable: true, + + get() { + const key = from || ''; + return moduleRegistry.get(key) || null; + } + }); + localModule.paths = this._resolver.getModulePaths(dirname); + Object.defineProperty(localModule, 'require', { + value: this._createRequireImplementation(localModule, options) + }); + const transformedCode = this.transformFile(filename, options); + let compiledFunction = null; // Use this if available instead of deprecated `JestEnvironment.runScript` + + if (typeof this._environment.getVmContext === 'function') { + const vmContext = this._environment.getVmContext(); + + if (vmContext) { + if (typeof _vm().compileFunction === 'function') { + try { + compiledFunction = (0, _vm().compileFunction)( + transformedCode, + this.constructInjectedModuleParameters(), + { + filename, + parsingContext: vmContext + } + ); + } catch (e) { + throw (0, _transform().handlePotentialSyntaxError)(e); + } + } else { + const script = this.createScriptFromCode(transformedCode, filename); + const runScript = script.runInContext(vmContext); + + if (runScript === null) { + compiledFunction = null; + } else { + compiledFunction = runScript[EVAL_RESULT_VARIABLE]; + } + } + } + } else { + const script = this.createScriptFromCode(transformedCode, filename); + + const runScript = this._environment.runScript(script); + + if (runScript === null) { + compiledFunction = null; + } else { + compiledFunction = runScript[EVAL_RESULT_VARIABLE]; + } + } + + if (compiledFunction === null) { + this._logFormattedReferenceError( + 'You are trying to `import` a file after the Jest environment has been torn down.' + ); + + process.exitCode = 1; + return; + } + + const jestObject = this._createJestObjectFor(filename); + + this.jestObjectCaches.set(filename, jestObject); + + try { + compiledFunction.call( + localModule.exports, + localModule, // module object + localModule.exports, // module exports + localModule.require, // require implementation + dirname, // __dirname + filename, // __filename + this._environment.global, // global object + jestObject, // jest object + ...this._config.extraGlobals.map(globalVariable => { + if (this._environment.global[globalVariable]) { + return this._environment.global[globalVariable]; + } + + throw new Error( + `You have requested '${globalVariable}' as a global variable, but it was not present. Please check your config or your global environment.` + ); + }) + ); + } catch (error) { + this.handleExecutionError(error, localModule); + } + + this._isCurrentlyExecutingManualMock = origCurrExecutingManualMock; + this._currentlyExecutingModulePath = lastExecutingModulePath; + } + + transformFile(filename, options) { + const source = this.readFile(filename); + + if ( + options === null || options === void 0 ? void 0 : options.isInternalModule + ) { + return source; + } + + const transformedFile = this._scriptTransformer.transform( + filename, + this._getFullTransformationOptions(options), + source + ); + + this._fileTransforms.set(filename, transformedFile); + + if (transformedFile.sourceMapPath) { + this._sourceMapRegistry.set(filename, transformedFile.sourceMapPath); + } + + return transformedFile.code; + } + + createScriptFromCode(scriptSource, filename) { + try { + return new (_vm().Script)(this.wrapCodeInModuleWrapper(scriptSource), { + displayErrors: true, + filename: this._resolver.isCoreModule(filename) + ? `jest-nodejs-core-${filename}` + : filename + }); + } catch (e) { + throw (0, _transform().handlePotentialSyntaxError)(e); + } + } + + _requireCoreModule(moduleName) { + if (moduleName === 'process') { + return this._environment.global.process; + } + + if (moduleName === 'module') { + return this._getMockedNativeModule(); + } + + return require(moduleName); + } + + _importCoreModule(moduleName, context) { + const required = this._requireCoreModule(moduleName); + + return new (_vm().SyntheticModule)( + ['default', ...Object.keys(required)], + function () { + // @ts-ignore: TS doesn't know what `this` is + this.setExport('default', required); + Object.entries(required).forEach(([key, value]) => { + // @ts-ignore: TS doesn't know what `this` is + this.setExport(key, value); + }); + }, // should identifier be `node://${moduleName}`? + { + context, + identifier: moduleName + } + ); + } + + _getMockedNativeModule() { + if (this._moduleImplementation) { + return this._moduleImplementation; + } + + const createRequire = modulePath => { + const filename = + typeof modulePath === 'string' + ? modulePath.startsWith('file:///') + ? (0, _url().fileURLToPath)(new (_url().URL)(modulePath)) + : modulePath + : (0, _url().fileURLToPath)(modulePath); + + if (!path().isAbsolute(filename)) { + const error = new TypeError( + `The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received '${filename}'` + ); // @ts-ignore + + error.code = 'ERR_INVALID_ARG_TYPE'; + throw error; + } + + return this._createRequireImplementation({ + children: [], + exports: {}, + filename, + id: filename, + loaded: false + }); + }; // should we implement the class ourselves? + + class Module extends nativeModule().Module {} + + Object.entries(nativeModule().Module).forEach(([key, value]) => { + // @ts-ignore + Module[key] = value; + }); + Module.Module = Module; + + if ('createRequire' in nativeModule()) { + Module.createRequire = createRequire; + } + + if ('createRequireFromPath' in nativeModule()) { + Module.createRequireFromPath = function createRequireFromPath(filename) { + if (typeof filename !== 'string') { + const error = new TypeError( + `The argument 'filename' must be string. Received '${filename}'.${ + filename instanceof _url().URL + ? ' Use createRequire for URL filename.' + : '' + }` + ); // @ts-ignore + + error.code = 'ERR_INVALID_ARG_TYPE'; + throw error; + } + + return createRequire(filename); + }; + } + + if ('syncBuiltinESMExports' in nativeModule()) { + Module.syncBuiltinESMExports = function syncBuiltinESMExports() {}; + } + + this._moduleImplementation = Module; + return Module; + } + + _generateMock(from, moduleName) { + const modulePath = + this._resolver.resolveStubModuleName(from, moduleName) || + this._resolveModule(from, moduleName); + + if (!this._mockMetaDataCache.has(modulePath)) { + // This allows us to handle circular dependencies while generating an + // automock + this._mockMetaDataCache.set( + modulePath, + this._moduleMocker.getMetadata({}) || {} + ); // In order to avoid it being possible for automocking to potentially + // cause side-effects within the module environment, we need to execute + // the module in isolation. This could cause issues if the module being + // mocked has calls into side-effectful APIs on another module. + + const origMockRegistry = this._mockRegistry; + const origModuleRegistry = this._moduleRegistry; + this._mockRegistry = new Map(); + this._moduleRegistry = new Map(); + const moduleExports = this.requireModule(from, moduleName); // Restore the "real" module/mock registries + + this._mockRegistry = origMockRegistry; + this._moduleRegistry = origModuleRegistry; + + const mockMetadata = this._moduleMocker.getMetadata(moduleExports); + + if (mockMetadata == null) { + throw new Error( + `Failed to get mock metadata: ${modulePath}\n\n` + + `See: https://jestjs.io/docs/manual-mocks.html#content` + ); + } + + this._mockMetaDataCache.set(modulePath, mockMetadata); + } + + return this._moduleMocker.generateFromMetadata( + // added above if missing + this._mockMetaDataCache.get(modulePath) + ); + } + + _shouldMock(from, moduleName) { + const explicitShouldMock = this._explicitShouldMock; + + const moduleID = this._resolver.getModuleID( + fromEntries(this._virtualMocks), + from, + moduleName + ); + + const key = from + path().delimiter + moduleID; + + if (explicitShouldMock.has(moduleID)) { + // guaranteed by `has` above + return explicitShouldMock.get(moduleID); + } + + if ( + !this._shouldAutoMock || + this._resolver.isCoreModule(moduleName) || + this._shouldUnmockTransitiveDependenciesCache.get(key) + ) { + return false; + } + + if (this._shouldMockModuleCache.has(moduleID)) { + // guaranteed by `has` above + return this._shouldMockModuleCache.get(moduleID); + } + + let modulePath; + + try { + modulePath = this._resolveModule(from, moduleName); + } catch (e) { + const manualMock = this._resolver.getMockModule(from, moduleName); + + if (manualMock) { + this._shouldMockModuleCache.set(moduleID, true); + + return true; + } + + throw e; + } + + if (this._unmockList && this._unmockList.test(modulePath)) { + this._shouldMockModuleCache.set(moduleID, false); + + return false; + } // transitive unmocking for package managers that store flat packages (npm3) + + const currentModuleID = this._resolver.getModuleID( + fromEntries(this._virtualMocks), + from + ); + + if ( + this._transitiveShouldMock.get(currentModuleID) === false || + (from.includes(NODE_MODULES) && + modulePath.includes(NODE_MODULES) && + ((this._unmockList && this._unmockList.test(from)) || + explicitShouldMock.get(currentModuleID) === false)) + ) { + this._transitiveShouldMock.set(moduleID, false); + + this._shouldUnmockTransitiveDependenciesCache.set(key, true); + + return false; + } + + this._shouldMockModuleCache.set(moduleID, true); + + return true; + } + + _createRequireImplementation(from, options) { + // TODO: somehow avoid having to type the arguments - they should come from `NodeRequire/LocalModuleRequire.resolve` + const resolve = (moduleName, options) => + this._requireResolve(from.filename, moduleName, options); + + resolve.paths = moduleName => + this._requireResolvePaths(from.filename, moduleName); + + const moduleRequire = ( + options === null || options === void 0 ? void 0 : options.isInternalModule + ) + ? moduleName => this.requireInternalModule(from.filename, moduleName) + : this.requireModuleOrMock.bind(this, from.filename); + moduleRequire.extensions = Object.create(null); + moduleRequire.requireActual = this.requireActual.bind(this, from.filename); + moduleRequire.requireMock = this.requireMock.bind(this, from.filename); + moduleRequire.resolve = resolve; + + moduleRequire.cache = (() => { + // TODO: consider warning somehow that this does nothing. We should support deletions, anyways + const notPermittedMethod = () => true; + + return new Proxy(Object.create(null), { + defineProperty: notPermittedMethod, + deleteProperty: notPermittedMethod, + get: (_target, key) => + typeof key === 'string' ? this._moduleRegistry.get(key) : undefined, + + getOwnPropertyDescriptor() { + return { + configurable: true, + enumerable: true + }; + }, + + has: (_target, key) => + typeof key === 'string' && this._moduleRegistry.has(key), + ownKeys: () => Array.from(this._moduleRegistry.keys()), + set: notPermittedMethod + }); + })(); + + Object.defineProperty(moduleRequire, 'main', { + enumerable: true, + + get() { + let mainModule = from.parent; + + while ( + mainModule && + mainModule.parent && + mainModule.id !== mainModule.parent.id + ) { + mainModule = mainModule.parent; + } + + return mainModule; + } + }); + return moduleRequire; + } + + _createJestObjectFor(from) { + const disableAutomock = () => { + this._shouldAutoMock = false; + return jestObject; + }; + + const enableAutomock = () => { + this._shouldAutoMock = true; + return jestObject; + }; + + const unmock = moduleName => { + const moduleID = this._resolver.getModuleID( + fromEntries(this._virtualMocks), + from, + moduleName + ); + + this._explicitShouldMock.set(moduleID, false); + + return jestObject; + }; + + const deepUnmock = moduleName => { + const moduleID = this._resolver.getModuleID( + fromEntries(this._virtualMocks), + from, + moduleName + ); + + this._explicitShouldMock.set(moduleID, false); + + this._transitiveShouldMock.set(moduleID, false); + + return jestObject; + }; + + const mock = (moduleName, mockFactory, options) => { + if (mockFactory !== undefined) { + return setMockFactory(moduleName, mockFactory, options); + } + + const moduleID = this._resolver.getModuleID( + fromEntries(this._virtualMocks), + from, + moduleName + ); + + this._explicitShouldMock.set(moduleID, true); + + return jestObject; + }; + + const setMockFactory = (moduleName, mockFactory, options) => { + this.setMock(from, moduleName, mockFactory, options); + return jestObject; + }; + + const clearAllMocks = () => { + this.clearAllMocks(); + return jestObject; + }; + + const resetAllMocks = () => { + this.resetAllMocks(); + return jestObject; + }; + + const restoreAllMocks = () => { + this.restoreAllMocks(); + return jestObject; + }; + + const useFakeTimers = () => { + _getFakeTimers().useFakeTimers(); + + return jestObject; + }; + + const useRealTimers = () => { + _getFakeTimers().useRealTimers(); + + return jestObject; + }; + + const resetModules = () => { + this.resetModules(); + return jestObject; + }; + + const isolateModules = fn => { + this.isolateModules(fn); + return jestObject; + }; + + const fn = this._moduleMocker.fn.bind(this._moduleMocker); + + const spyOn = this._moduleMocker.spyOn.bind(this._moduleMocker); + + const setTimeout = timeout => { + if (this._environment.global.jasmine) { + this._environment.global.jasmine._DEFAULT_TIMEOUT_INTERVAL = timeout; + } else { + // @ts-ignore: https://github.com/Microsoft/TypeScript/issues/24587 + this._environment.global[testTimeoutSymbol] = timeout; + } + + return jestObject; + }; + + const retryTimes = numTestRetries => { + // @ts-ignore: https://github.com/Microsoft/TypeScript/issues/24587 + this._environment.global[retryTimesSymbol] = numTestRetries; + return jestObject; + }; + + const _getFakeTimers = () => { + if (!this._environment.fakeTimers) { + this._logFormattedReferenceError( + 'You are trying to access a property or method of the Jest environment after it has been torn down.' + ); + + process.exitCode = 1; + } // We've logged a user message above, so it doesn't matter if we return `null` here + + return this._environment.fakeTimers; + }; + + const jestObject = { + addMatchers: matchers => + this._environment.global.jasmine.addMatchers(matchers), + advanceTimersByTime: msToRun => + _getFakeTimers().advanceTimersByTime(msToRun), + advanceTimersToNextTimer: steps => + _getFakeTimers().advanceTimersToNextTimer(steps), + autoMockOff: disableAutomock, + autoMockOn: enableAutomock, + clearAllMocks, + clearAllTimers: () => _getFakeTimers().clearAllTimers(), + deepUnmock, + disableAutomock, + doMock: mock, + dontMock: unmock, + enableAutomock, + fn, + genMockFromModule: moduleName => this._generateMock(from, moduleName), + getTimerCount: () => _getFakeTimers().getTimerCount(), + isMockFunction: this._moduleMocker.isMockFunction, + isolateModules, + mock, + requireActual: this.requireActual.bind(this, from), + requireMock: this.requireMock.bind(this, from), + resetAllMocks, + resetModuleRegistry: resetModules, + resetModules, + restoreAllMocks, + retryTimes, + runAllImmediates: () => _getFakeTimers().runAllImmediates(), + runAllTicks: () => _getFakeTimers().runAllTicks(), + runAllTimers: () => _getFakeTimers().runAllTimers(), + runOnlyPendingTimers: () => _getFakeTimers().runOnlyPendingTimers(), + runTimersToTime: msToRun => _getFakeTimers().advanceTimersByTime(msToRun), + setMock: (moduleName, mock) => setMockFactory(moduleName, () => mock), + setTimeout, + spyOn, + unmock, + useFakeTimers, + useRealTimers + }; + return jestObject; + } + + _logFormattedReferenceError(errorMessage) { + const originalStack = new ReferenceError(errorMessage).stack + .split('\n') // Remove this file from the stack (jest-message-utils will keep one line) + .filter(line => line.indexOf(__filename) === -1) + .join('\n'); + const {message, stack} = (0, _jestMessageUtil().separateMessageFromStack)( + originalStack + ); + console.error( + `\n${message}\n` + + (0, _jestMessageUtil().formatStackTrace)(stack, this._config, { + noStackTrace: false + }) + ); + } + + wrapCodeInModuleWrapper(content) { + const args = this.constructInjectedModuleParameters(); + return ( + '({"' + + EVAL_RESULT_VARIABLE + + `":function(${args.join(',')}){` + + content + + '\n}});' + ); + } + + constructInjectedModuleParameters() { + return [ + 'module', + 'exports', + 'require', + '__dirname', + '__filename', + 'global', + 'jest', + ...this._config.extraGlobals + ]; + } + + handleExecutionError(e, module) { + const moduleNotFoundError = _jestResolve().default.tryCastModuleNotFoundError( + e + ); + + if (moduleNotFoundError) { + if (!moduleNotFoundError.requireStack) { + moduleNotFoundError.requireStack = [module.filename || module.id]; + + for (let cursor = module.parent; cursor; cursor = cursor.parent) { + moduleNotFoundError.requireStack.push(cursor.filename || cursor.id); + } + + moduleNotFoundError.buildMessage(this._config.rootDir); + } + + throw moduleNotFoundError; + } + + throw e; + } + + getGlobalsForCjs(from) { + const jest = this.jestObjectCaches.get(from); + invariant(jest, 'There should always be a Jest object already'); + return {...this.getGlobalsFromEnvironment(), jest}; + } + + async getGlobalsForEsm(from, context) { + let jest = this.jestObjectCaches.get(from); + + if (!jest) { + jest = this._createJestObjectFor(from); + this.jestObjectCaches.set(from, jest); + } + + const globals = {...this.getGlobalsFromEnvironment(), jest}; + const module = new (_vm().SyntheticModule)( + Object.keys(globals), + function () { + Object.entries(globals).forEach(([key, value]) => { + // @ts-ignore: TS doesn't know what `this` is + this.setExport(key, value); + }); + }, + { + context, + identifier: '@jest/globals' + } + ); + await module.link(() => { + throw new Error('This should never happen'); + }); + await module.evaluate(); + return module; + } + + getGlobalsFromEnvironment() { + return { + afterAll: this._environment.global.afterAll, + afterEach: this._environment.global.afterEach, + beforeAll: this._environment.global.beforeAll, + beforeEach: this._environment.global.beforeEach, + describe: this._environment.global.describe, + expect: this._environment.global.expect, + fdescribe: this._environment.global.fdescribe, + fit: this._environment.global.fit, + it: this._environment.global.it, + test: this._environment.global.test, + xdescribe: this._environment.global.xdescribe, + xit: this._environment.global.xit, + xtest: this._environment.global.xtest + }; + } + + readFile(filename) { + let source = this._cacheFS.get(filename); + + if (!source) { + source = fs().readFileSync(filename, 'utf8'); + + this._cacheFS.set(filename, source); + } + + return source; + } +} + +_defineProperty(Runtime, 'shouldInstrument', _transform().shouldInstrument); + +function invariant(condition, message) { + if (!condition) { + throw new Error(message); + } +} + +module.exports = Runtime; diff --git a/node_modules/jest-runtime/build/ts3.4/cli/args.d.ts b/node_modules/@jest/core/node_modules/jest-runtime/build/ts3.4/cli/args.d.ts similarity index 100% rename from node_modules/jest-runtime/build/ts3.4/cli/args.d.ts rename to node_modules/@jest/core/node_modules/jest-runtime/build/ts3.4/cli/args.d.ts diff --git a/node_modules/jest-runtime/build/ts3.4/cli/index.d.ts b/node_modules/@jest/core/node_modules/jest-runtime/build/ts3.4/cli/index.d.ts similarity index 100% rename from node_modules/jest-runtime/build/ts3.4/cli/index.d.ts rename to node_modules/@jest/core/node_modules/jest-runtime/build/ts3.4/cli/index.d.ts diff --git a/node_modules/jest-runtime/build/ts3.4/helpers.d.ts b/node_modules/@jest/core/node_modules/jest-runtime/build/ts3.4/helpers.d.ts similarity index 100% rename from node_modules/jest-runtime/build/ts3.4/helpers.d.ts rename to node_modules/@jest/core/node_modules/jest-runtime/build/ts3.4/helpers.d.ts diff --git a/node_modules/@jest/core/node_modules/jest-runtime/build/ts3.4/index.d.ts b/node_modules/@jest/core/node_modules/jest-runtime/build/ts3.4/index.d.ts new file mode 100644 index 000000000..cb8e6dded --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/build/ts3.4/index.d.ts @@ -0,0 +1,124 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import { Config } from '@jest/types'; +import { JestEnvironment } from '@jest/environment'; +import { SourceMapRegistry } from '@jest/source-map'; +import { ShouldInstrumentOptions, shouldInstrument } from '@jest/transform'; +import { V8CoverageResult } from '@jest/test-result'; +import { options as cliOptions } from './cli/args'; +import { Context as JestContext } from './types'; +import HasteMap = require('jest-haste-map'); +import Resolver = require('jest-resolve'); +declare type HasteMapOptions = { + console?: Console; + maxWorkers: number; + resetCache: boolean; + watch?: boolean; + watchman: boolean; +}; +declare type InternalModuleOptions = { + isInternalModule: boolean; + supportsDynamicImport: boolean; + supportsStaticESM: boolean; +}; +declare namespace Runtime { + type Context = JestContext; + type RuntimeType = Runtime; +} +declare class Runtime { + private _cacheFS; + private _config; + private _coverageOptions; + private _currentlyExecutingModulePath; + private _environment; + private _explicitShouldMock; + private _internalModuleRegistry; + private _isCurrentlyExecutingManualMock; + private _mockFactories; + private _mockMetaDataCache; + private _mockRegistry; + private _isolatedMockRegistry; + private _moduleMocker; + private _isolatedModuleRegistry; + private _moduleRegistry; + private _esmoduleRegistry; + private _resolver; + private _shouldAutoMock; + private _shouldMockModuleCache; + private _shouldUnmockTransitiveDependenciesCache; + private _sourceMapRegistry; + private _scriptTransformer; + private _fileTransforms; + private _v8CoverageInstrumenter; + private _v8CoverageResult; + private _transitiveShouldMock; + private _unmockList; + private _virtualMocks; + private _moduleImplementation?; + private jestObjectCaches; + constructor(config: Config.ProjectConfig, environment: JestEnvironment, resolver: Resolver, cacheFS?: Record, coverageOptions?: ShouldInstrumentOptions); + static shouldInstrument: typeof shouldInstrument; + static createContext(config: Config.ProjectConfig, options: { + console?: Console; + maxWorkers: number; + watch?: boolean; + watchman: boolean; + }): Promise; + static createHasteMap(config: Config.ProjectConfig, options?: HasteMapOptions): HasteMap; + static createResolver(config: Config.ProjectConfig, moduleMap: HasteMap.ModuleMap): Resolver; + static runCLI(args?: Config.Argv, info?: Array): Promise; + static getCLIOptions(): typeof cliOptions; + unstable_shouldLoadAsEsm: typeof import("jest-resolve/build/shouldLoadAsEsm").default; + private loadEsmModule; + private linkModules; + unstable_importModule(from: Config.Path, moduleName?: string): Promise; + private loadCjsAsEsm; + requireModule(from: Config.Path, moduleName?: string, options?: InternalModuleOptions, isRequireActual?: boolean | null): T; + requireInternalModule(from: Config.Path, to?: string): T; + requireActual(from: Config.Path, moduleName: string): T; + requireMock(from: Config.Path, moduleName: string): T; + private _loadModule; + private _getFullTransformationOptions; + requireModuleOrMock(from: Config.Path, moduleName: string): T; + isolateModules(fn: () => void): void; + resetModules(): void; + collectV8Coverage(): Promise; + stopCollectingV8Coverage(): Promise; + getAllCoverageInfoCopy(): JestEnvironment['global']['__coverage__']; + getAllV8CoverageInfoCopy(): V8CoverageResult; + getSourceMapInfo(_coveredFiles: Set): Record; + getSourceMaps(): SourceMapRegistry; + setMock(from: string, moduleName: string, mockFactory: () => unknown, options?: { + virtual?: boolean; + }): void; + restoreAllMocks(): void; + resetAllMocks(): void; + clearAllMocks(): void; + teardown(): void; + private _resolveModule; + private _requireResolve; + private _requireResolvePaths; + private _execModule; + private transformFile; + private createScriptFromCode; + private _requireCoreModule; + private _importCoreModule; + private _getMockedNativeModule; + private _generateMock; + private _shouldMock; + private _createRequireImplementation; + private _createJestObjectFor; + private _logFormattedReferenceError; + private wrapCodeInModuleWrapper; + private constructInjectedModuleParameters; + private handleExecutionError; + private getGlobalsForCjs; + private getGlobalsForEsm; + private getGlobalsFromEnvironment; + private readFile; +} +export = Runtime; diff --git a/node_modules/jest-runtime/build/ts3.4/types.d.ts b/node_modules/@jest/core/node_modules/jest-runtime/build/ts3.4/types.d.ts similarity index 100% rename from node_modules/jest-runtime/build/ts3.4/types.d.ts rename to node_modules/@jest/core/node_modules/jest-runtime/build/ts3.4/types.d.ts diff --git a/node_modules/jest-runtime/build/ts3.4/version.d.ts b/node_modules/@jest/core/node_modules/jest-runtime/build/ts3.4/version.d.ts similarity index 100% rename from node_modules/jest-runtime/build/ts3.4/version.d.ts rename to node_modules/@jest/core/node_modules/jest-runtime/build/ts3.4/version.d.ts diff --git a/node_modules/@jest/core/node_modules/jest-runtime/build/types.d.ts b/node_modules/@jest/core/node_modules/jest-runtime/build/types.d.ts new file mode 100644 index 000000000..f52c4be37 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/build/types.d.ts @@ -0,0 +1,15 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +import HasteResolver = require('jest-resolve'); +import type { FS as HasteFS, ModuleMap } from 'jest-haste-map'; +export declare type Context = { + config: Config.ProjectConfig; + hasteFS: HasteFS; + moduleMap: ModuleMap; + resolver: HasteResolver; +}; diff --git a/node_modules/@jest/core/node_modules/jest-runtime/build/types.js b/node_modules/@jest/core/node_modules/jest-runtime/build/types.js new file mode 100644 index 000000000..56441c8d0 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/build/types.js @@ -0,0 +1,15 @@ +'use strict'; + +function _jestResolve() { + const data = _interopRequireDefault(require('jest-resolve')); + + _jestResolve = function () { + return data; + }; + + return data; +} + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} diff --git a/node_modules/@jest/core/node_modules/jest-runtime/build/version.d.ts b/node_modules/@jest/core/node_modules/jest-runtime/build/version.d.ts new file mode 100644 index 000000000..f74a8838d --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/build/version.d.ts @@ -0,0 +1,7 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare const VERSION: string; diff --git a/node_modules/@jest/core/node_modules/jest-runtime/build/version.js b/node_modules/@jest/core/node_modules/jest-runtime/build/version.js new file mode 100644 index 000000000..5ca58b3e7 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/build/version.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.VERSION = void 0; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// For some reason, doing `require`ing here works, while inside `cli` fails +const VERSION = require('../package.json').version; + +exports.VERSION = VERSION; diff --git a/node_modules/@jest/core/node_modules/jest-runtime/package.json b/node_modules/@jest/core/node_modules/jest-runtime/package.json new file mode 100644 index 000000000..10f1b9084 --- /dev/null +++ b/node_modules/@jest/core/node_modules/jest-runtime/package.json @@ -0,0 +1,102 @@ +{ + "_args": [ + [ + "jest-runtime@25.5.4", + "/workspace/readable-readme" + ] + ], + "_development": true, + "_from": "jest-runtime@25.5.4", + "_id": "jest-runtime@25.5.4", + "_inBundle": false, + "_integrity": "sha512-RWTt8LeWh3GvjYtASH2eezkc8AehVoWKK20udV6n3/gC87wlTbE1kIA+opCvNWyyPeBs6ptYsc6nyHUb1GlUVQ==", + "_location": "/@jest/core/jest-runtime", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "jest-runtime@25.5.4", + "name": "jest-runtime", + "escapedName": "jest-runtime", + "rawSpec": "25.5.4", + "saveSpec": null, + "fetchSpec": "25.5.4" + }, + "_requiredBy": [ + "/@jest/core", + "/@jest/core/@jest/test-sequencer", + "/@jest/core/jest-jasmine2", + "/@jest/core/jest-runner" + ], + "_resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-25.5.4.tgz", + "_spec": "25.5.4", + "_where": "/workspace/readable-readme", + "bin": { + "jest-runtime": "bin/jest-runtime.js" + }, + "bugs": { + "url": "https://github.com/facebook/jest/issues" + }, + "dependencies": { + "@jest/console": "^25.5.0", + "@jest/environment": "^25.5.0", + "@jest/globals": "^25.5.2", + "@jest/source-map": "^25.5.0", + "@jest/test-result": "^25.5.0", + "@jest/transform": "^25.5.1", + "@jest/types": "^25.5.0", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.4", + "jest-config": "^25.5.4", + "jest-haste-map": "^25.5.1", + "jest-message-util": "^25.5.0", + "jest-mock": "^25.5.0", + "jest-regex-util": "^25.2.6", + "jest-resolve": "^25.5.1", + "jest-snapshot": "^25.5.1", + "jest-util": "^25.5.0", + "jest-validate": "^25.5.0", + "realpath-native": "^2.0.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0", + "yargs": "^15.3.1" + }, + "devDependencies": { + "@jest/test-utils": "^25.5.0", + "@types/exit": "^0.1.30", + "@types/glob": "^7.1.1", + "@types/graceful-fs": "^4.1.2", + "execa": "^3.2.0", + "jest-environment-node": "^25.5.0", + "jest-snapshot-serializer-raw": "^1.1.0" + }, + "engines": { + "node": ">= 8.3" + }, + "gitHead": "389d13724bbf6bb64dcde9700a6ecea3333942db", + "homepage": "https://github.com/facebook/jest#readme", + "license": "MIT", + "main": "build/index.js", + "name": "jest-runtime", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/facebook/jest.git", + "directory": "packages/jest-runtime" + }, + "types": "build/index.d.ts", + "typesVersions": { + "<3.8": { + "build/*": [ + "build/ts3.4/*" + ] + } + }, + "version": "25.5.4" +} diff --git a/node_modules/@jest/core/node_modules/pretty-format/LICENSE b/node_modules/@jest/core/node_modules/pretty-format/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@jest/core/node_modules/pretty-format/README.md b/node_modules/@jest/core/node_modules/pretty-format/README.md new file mode 100755 index 000000000..ca445cfaf --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/README.md @@ -0,0 +1,456 @@ +# pretty-format + +Stringify any JavaScript value. + +- Serialize built-in JavaScript types. +- Serialize application-specific data types with built-in or user-defined plugins. + +## Installation + +```sh +$ yarn add pretty-format +``` + +## Usage + +```js +const prettyFormat = require('pretty-format'); // CommonJS +``` + +```js +import prettyFormat from 'pretty-format'; // ES2015 modules +``` + +```js +const val = {object: {}}; +val.circularReference = val; +val[Symbol('foo')] = 'foo'; +val.map = new Map([['prop', 'value']]); +val.array = [-0, Infinity, NaN]; + +console.log(prettyFormat(val)); +/* +Object { + "array": Array [ + -0, + Infinity, + NaN, + ], + "circularReference": [Circular], + "map": Map { + "prop" => "value", + }, + "object": Object {}, + Symbol(foo): "foo", +} +*/ +``` + +## Usage with options + +```js +function onClick() {} + +console.log(prettyFormat(onClick)); +/* +[Function onClick] +*/ + +const options = { + printFunctionName: false, +}; +console.log(prettyFormat(onClick, options)); +/* +[Function] +*/ +``` + + +| key | type | default | description | +| :------------------ | :-------- | :--------- | :------------------------------------------------------ | +| `callToJSON` | `boolean` | `true` | call `toJSON` method (if it exists) on objects | +| `escapeRegex` | `boolean` | `false` | escape special characters in regular expressions | +| `escapeString` | `boolean` | `true` | escape special characters in strings | +| `highlight` | `boolean` | `false` | highlight syntax with colors in terminal (some plugins) | +| `indent` | `number` | `2` | spaces in each level of indentation | +| `maxDepth` | `number` | `Infinity` | levels to print in arrays, objects, elements, and so on | +| `min` | `boolean` | `false` | minimize added space: no indentation nor line breaks | +| `plugins` | `array` | `[]` | plugins to serialize application-specific data types | +| `printFunctionName` | `boolean` | `true` | include or omit the name of a function | +| `theme` | `object` | | colors to highlight syntax in terminal | + +Property values of `theme` are from [ansi-styles colors](https://github.com/chalk/ansi-styles#colors) + +```js +const DEFAULT_THEME = { + comment: 'gray', + content: 'reset', + prop: 'yellow', + tag: 'cyan', + value: 'green', +}; +``` + +## Usage with plugins + +The `pretty-format` package provides some built-in plugins, including: + +- `ReactElement` for elements from `react` +- `ReactTestComponent` for test objects from `react-test-renderer` + +```js +// CommonJS +const prettyFormat = require('pretty-format'); +const ReactElement = prettyFormat.plugins.ReactElement; +const ReactTestComponent = prettyFormat.plugins.ReactTestComponent; + +const React = require('react'); +const renderer = require('react-test-renderer'); +``` + +```js +// ES2015 modules and destructuring assignment +import prettyFormat from 'pretty-format'; +const {ReactElement, ReactTestComponent} = prettyFormat.plugins; + +import React from 'react'; +import renderer from 'react-test-renderer'; +``` + +```js +const onClick = () => {}; +const element = React.createElement('button', {onClick}, 'Hello World'); + +const formatted1 = prettyFormat(element, { + plugins: [ReactElement], + printFunctionName: false, +}); +const formatted2 = prettyFormat(renderer.create(element).toJSON(), { + plugins: [ReactTestComponent], + printFunctionName: false, +}); +/* + +*/ +``` + +## Usage in Jest + +For snapshot tests, Jest uses `pretty-format` with options that include some of its built-in plugins. For this purpose, plugins are also known as **snapshot serializers**. + +To serialize application-specific data types, you can add modules to `devDependencies` of a project, and then: + +In an **individual** test file, you can add a module as follows. It precedes any modules from Jest configuration. + +```js +import serializer from 'my-serializer-module'; +expect.addSnapshotSerializer(serializer); + +// tests which have `expect(value).toMatchSnapshot()` assertions +``` + +For **all** test files, you can specify modules in Jest configuration. They precede built-in plugins for React, HTML, and Immutable.js data types. For example, in a `package.json` file: + +```json +{ + "jest": { + "snapshotSerializers": ["my-serializer-module"] + } +} +``` + +## Writing plugins + +A plugin is a JavaScript object. + +If `options` has a `plugins` array: for the first plugin whose `test(val)` method returns a truthy value, then `prettyFormat(val, options)` returns the result from either: + +- `serialize(val, …)` method of the **improved** interface (available in **version 21** or later) +- `print(val, …)` method of the **original** interface (if plugin does not have `serialize` method) + +### test + +Write `test` so it can receive `val` argument of any type. To serialize **objects** which have certain properties, then a guarded expression like `val != null && …` or more concise `val && …` prevents the following errors: + +- `TypeError: Cannot read property 'whatever' of null` +- `TypeError: Cannot read property 'whatever' of undefined` + +For example, `test` method of built-in `ReactElement` plugin: + +```js +const elementSymbol = Symbol.for('react.element'); +const test = val => val && val.$$typeof === elementSymbol; +``` + +Pay attention to efficiency in `test` because `pretty-format` calls it often. + +### serialize + +The **improved** interface is available in **version 21** or later. + +Write `serialize` to return a string, given the arguments: + +- `val` which “passed the test” +- unchanging `config` object: derived from `options` +- current `indentation` string: concatenate to `indent` from `config` +- current `depth` number: compare to `maxDepth` from `config` +- current `refs` array: find circular references in objects +- `printer` callback function: serialize children + +### config + + +| key | type | description | +| :------------------ | :-------- | :------------------------------------------------------ | +| `callToJSON` | `boolean` | call `toJSON` method (if it exists) on objects | +| `colors` | `Object` | escape codes for colors to highlight syntax | +| `escapeRegex` | `boolean` | escape special characters in regular expressions | +| `escapeString` | `boolean` | escape special characters in strings | +| `indent` | `string` | spaces in each level of indentation | +| `maxDepth` | `number` | levels to print in arrays, objects, elements, and so on | +| `min` | `boolean` | minimize added space: no indentation nor line breaks | +| `plugins` | `array` | plugins to serialize application-specific data types | +| `printFunctionName` | `boolean` | include or omit the name of a function | +| `spacingInner` | `strong` | spacing to separate items in a list | +| `spacingOuter` | `strong` | spacing to enclose a list of items | + +Each property of `colors` in `config` corresponds to a property of `theme` in `options`: + +- the key is the same (for example, `tag`) +- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`) + +Some properties in `config` are derived from `min` in `options`: + +- `spacingInner` and `spacingOuter` are **newline** if `min` is `false` +- `spacingInner` is **space** and `spacingOuter` is **empty string** if `min` is `true` + +### Example of serialize and test + +This plugin is a pattern you can apply to serialize composite data types. Side note: `pretty-format` does not need a plugin to serialize arrays. + +```js +// We reused more code when we factored out a function for child items +// that is independent of depth, name, and enclosing punctuation (see below). +const SEPARATOR = ','; +function serializeItems(items, config, indentation, depth, refs, printer) { + if (items.length === 0) { + return ''; + } + const indentationItems = indentation + config.indent; + return ( + config.spacingOuter + + items + .map( + item => + indentationItems + + printer(item, config, indentationItems, depth, refs), // callback + ) + .join(SEPARATOR + config.spacingInner) + + (config.min ? '' : SEPARATOR) + // following the last item + config.spacingOuter + + indentation + ); +} + +const plugin = { + test(val) { + return Array.isArray(val); + }, + serialize(array, config, indentation, depth, refs, printer) { + const name = array.constructor.name; + return ++depth > config.maxDepth + ? '[' + name + ']' + : (config.min ? '' : name + ' ') + + '[' + + serializeItems(array, config, indentation, depth, refs, printer) + + ']'; + }, +}; +``` + +```js +const val = { + filter: 'completed', + items: [ + { + text: 'Write test', + completed: true, + }, + { + text: 'Write serialize', + completed: true, + }, + ], +}; +``` + +```js +console.log( + prettyFormat(val, { + plugins: [plugin], + }), +); +/* +Object { + "filter": "completed", + "items": Array [ + Object { + "completed": true, + "text": "Write test", + }, + Object { + "completed": true, + "text": "Write serialize", + }, + ], +} +*/ +``` + +```js +console.log( + prettyFormat(val, { + indent: 4, + plugins: [plugin], + }), +); +/* +Object { + "filter": "completed", + "items": Array [ + Object { + "completed": true, + "text": "Write test", + }, + Object { + "completed": true, + "text": "Write serialize", + }, + ], +} +*/ +``` + +```js +console.log( + prettyFormat(val, { + maxDepth: 1, + plugins: [plugin], + }), +); +/* +Object { + "filter": "completed", + "items": [Array], +} +*/ +``` + +```js +console.log( + prettyFormat(val, { + min: true, + plugins: [plugin], + }), +); +/* +{"filter": "completed", "items": [{"completed": true, "text": "Write test"}, {"completed": true, "text": "Write serialize"}]} +*/ +``` + +### print + +The **original** interface is adequate for plugins: + +- that **do not** depend on options other than `highlight` or `min` +- that **do not** depend on `depth` or `refs` in recursive traversal, and +- if values either + - do **not** require indentation, or + - do **not** occur as children of JavaScript data structures (for example, array) + +Write `print` to return a string, given the arguments: + +- `val` which “passed the test” +- current `printer(valChild)` callback function: serialize children +- current `indenter(lines)` callback function: indent lines at the next level +- unchanging `config` object: derived from `options` +- unchanging `colors` object: derived from `options` + +The 3 properties of `config` are `min` in `options` and: + +- `spacing` and `edgeSpacing` are **newline** if `min` is `false` +- `spacing` is **space** and `edgeSpacing` is **empty string** if `min` is `true` + +Each property of `colors` corresponds to a property of `theme` in `options`: + +- the key is the same (for example, `tag`) +- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`) + +### Example of print and test + +This plugin prints functions with the **number of named arguments** excluding rest argument. + +```js +const plugin = { + print(val) { + return `[Function ${val.name || 'anonymous'} ${val.length}]`; + }, + test(val) { + return typeof val === 'function'; + }, +}; +``` + +```js +const val = { + onClick(event) {}, + render() {}, +}; + +prettyFormat(val, { + plugins: [plugin], +}); +/* +Object { + "onClick": [Function onClick 1], + "render": [Function render 0], +} +*/ + +prettyFormat(val); +/* +Object { + "onClick": [Function onClick], + "render": [Function render], +} +*/ +``` + +This plugin **ignores** the `printFunctionName` option. That limitation of the original `print` interface is a reason to use the improved `serialize` interface, described above. + +```js +prettyFormat(val, { + plugins: [pluginOld], + printFunctionName: false, +}); +/* +Object { + "onClick": [Function onClick 1], + "render": [Function render 0], +} +*/ + +prettyFormat(val, { + printFunctionName: false, +}); +/* +Object { + "onClick": [Function], + "render": [Function], +} +*/ +``` diff --git a/node_modules/jest-circus/node_modules/pretty-format/build-es5/index.js b/node_modules/@jest/core/node_modules/pretty-format/build-es5/index.js similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build-es5/index.js rename to node_modules/@jest/core/node_modules/pretty-format/build-es5/index.js diff --git a/node_modules/jest-circus/node_modules/pretty-format/build-es5/index.js.map b/node_modules/@jest/core/node_modules/pretty-format/build-es5/index.js.map similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build-es5/index.js.map rename to node_modules/@jest/core/node_modules/pretty-format/build-es5/index.js.map diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/collections.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/collections.d.ts new file mode 100644 index 000000000..eaf7e611e --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/collections.d.ts @@ -0,0 +1,32 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Config, Printer, Refs } from './types'; +/** + * Return entries (for example, of a map) + * with spacing, indentation, and comma + * without surrounding punctuation (for example, braces) + */ +export declare function printIteratorEntries(iterator: Iterator<[unknown, unknown]>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer, separator?: string): string; +/** + * Return values (for example, of a set) + * with spacing, indentation, and comma + * without surrounding punctuation (braces or brackets) + */ +export declare function printIteratorValues(iterator: Iterator, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string; +/** + * Return items (for example, of an array) + * with spacing, indentation, and comma + * without surrounding punctuation (for example, brackets) + **/ +export declare function printListItems(list: ArrayLike, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string; +/** + * Return properties of an object + * with spacing, indentation, and comma + * without surrounding punctuation (for example, braces) + */ +export declare function printObjectProperties(val: Record, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/collections.js b/node_modules/@jest/core/node_modules/pretty-format/build/collections.js new file mode 100644 index 000000000..c31d21e94 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/collections.js @@ -0,0 +1,185 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.printIteratorEntries = printIteratorEntries; +exports.printIteratorValues = printIteratorValues; +exports.printListItems = printListItems; +exports.printObjectProperties = printObjectProperties; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +const getKeysOfEnumerableProperties = object => { + const keys = Object.keys(object).sort(); + + if (Object.getOwnPropertySymbols) { + Object.getOwnPropertySymbols(object).forEach(symbol => { + if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) { + keys.push(symbol); + } + }); + } + + return keys; +}; +/** + * Return entries (for example, of a map) + * with spacing, indentation, and comma + * without surrounding punctuation (for example, braces) + */ + +function printIteratorEntries( + iterator, + config, + indentation, + depth, + refs, + printer, // Too bad, so sad that separator for ECMAScript Map has been ' => ' + // What a distracting diff if you change a data structure to/from + // ECMAScript Object or Immutable.Map/OrderedMap which use the default. + separator = ': ' +) { + let result = ''; + let current = iterator.next(); + + if (!current.done) { + result += config.spacingOuter; + const indentationNext = indentation + config.indent; + + while (!current.done) { + const name = printer( + current.value[0], + config, + indentationNext, + depth, + refs + ); + const value = printer( + current.value[1], + config, + indentationNext, + depth, + refs + ); + result += indentationNext + name + separator + value; + current = iterator.next(); + + if (!current.done) { + result += ',' + config.spacingInner; + } else if (!config.min) { + result += ','; + } + } + + result += config.spacingOuter + indentation; + } + + return result; +} +/** + * Return values (for example, of a set) + * with spacing, indentation, and comma + * without surrounding punctuation (braces or brackets) + */ + +function printIteratorValues( + iterator, + config, + indentation, + depth, + refs, + printer +) { + let result = ''; + let current = iterator.next(); + + if (!current.done) { + result += config.spacingOuter; + const indentationNext = indentation + config.indent; + + while (!current.done) { + result += + indentationNext + + printer(current.value, config, indentationNext, depth, refs); + current = iterator.next(); + + if (!current.done) { + result += ',' + config.spacingInner; + } else if (!config.min) { + result += ','; + } + } + + result += config.spacingOuter + indentation; + } + + return result; +} +/** + * Return items (for example, of an array) + * with spacing, indentation, and comma + * without surrounding punctuation (for example, brackets) + **/ + +function printListItems(list, config, indentation, depth, refs, printer) { + let result = ''; + + if (list.length) { + result += config.spacingOuter; + const indentationNext = indentation + config.indent; + + for (let i = 0; i < list.length; i++) { + result += + indentationNext + + printer(list[i], config, indentationNext, depth, refs); + + if (i < list.length - 1) { + result += ',' + config.spacingInner; + } else if (!config.min) { + result += ','; + } + } + + result += config.spacingOuter + indentation; + } + + return result; +} +/** + * Return properties of an object + * with spacing, indentation, and comma + * without surrounding punctuation (for example, braces) + */ + +function printObjectProperties(val, config, indentation, depth, refs, printer) { + let result = ''; + const keys = getKeysOfEnumerableProperties(val); + + if (keys.length) { + result += config.spacingOuter; + const indentationNext = indentation + config.indent; + + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const name = printer(key, config, indentationNext, depth, refs); + const value = printer(val[key], config, indentationNext, depth, refs); + result += indentationNext + name + ': ' + value; + + if (i < keys.length - 1) { + result += ',' + config.spacingInner; + } else if (!config.min) { + result += ','; + } + } + + result += config.spacingOuter + indentation; + } + + return result; +} diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/index.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/index.d.ts new file mode 100644 index 000000000..8b3bc9e15 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/index.d.ts @@ -0,0 +1,37 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type * as PrettyFormat from './types'; +/** + * Returns a presentation string of your `val` object + * @param val any potential JavaScript object + * @param options Custom settings + */ +declare function prettyFormat(val: unknown, options?: PrettyFormat.OptionsReceived): string; +declare namespace prettyFormat { + var plugins: { + AsymmetricMatcher: PrettyFormat.NewPlugin; + ConvertAnsi: PrettyFormat.NewPlugin; + DOMCollection: PrettyFormat.NewPlugin; + DOMElement: PrettyFormat.NewPlugin; + Immutable: PrettyFormat.NewPlugin; + ReactElement: PrettyFormat.NewPlugin; + ReactTestComponent: PrettyFormat.NewPlugin; + }; +} +declare namespace prettyFormat { + type Colors = PrettyFormat.Colors; + type Config = PrettyFormat.Config; + type Options = PrettyFormat.Options; + type OptionsReceived = PrettyFormat.OptionsReceived; + type OldPlugin = PrettyFormat.OldPlugin; + type NewPlugin = PrettyFormat.NewPlugin; + type Plugin = PrettyFormat.Plugin; + type Plugins = PrettyFormat.Plugins; + type Refs = PrettyFormat.Refs; + type Theme = PrettyFormat.Theme; +} +export = prettyFormat; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/index.js b/node_modules/@jest/core/node_modules/pretty-format/build/index.js new file mode 100644 index 000000000..95198471e --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/index.js @@ -0,0 +1,559 @@ +'use strict'; + +var _ansiStyles = _interopRequireDefault(require('ansi-styles')); + +var _collections = require('./collections'); + +var _AsymmetricMatcher = _interopRequireDefault( + require('./plugins/AsymmetricMatcher') +); + +var _ConvertAnsi = _interopRequireDefault(require('./plugins/ConvertAnsi')); + +var _DOMCollection = _interopRequireDefault(require('./plugins/DOMCollection')); + +var _DOMElement = _interopRequireDefault(require('./plugins/DOMElement')); + +var _Immutable = _interopRequireDefault(require('./plugins/Immutable')); + +var _ReactElement = _interopRequireDefault(require('./plugins/ReactElement')); + +var _ReactTestComponent = _interopRequireDefault( + require('./plugins/ReactTestComponent') +); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const toString = Object.prototype.toString; +const toISOString = Date.prototype.toISOString; +const errorToString = Error.prototype.toString; +const regExpToString = RegExp.prototype.toString; +/** + * Explicitly comparing typeof constructor to function avoids undefined as name + * when mock identity-obj-proxy returns the key as the value for any key. + */ + +const getConstructorName = val => + (typeof val.constructor === 'function' && val.constructor.name) || 'Object'; +/* global window */ + +/** Is val is equal to global window object? Works even if it does not exist :) */ + +const isWindow = val => typeof window !== 'undefined' && val === window; + +const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/; +const NEWLINE_REGEXP = /\n/gi; + +class PrettyFormatPluginError extends Error { + constructor(message, stack) { + super(message); + this.stack = stack; + this.name = this.constructor.name; + } +} + +function isToStringedArrayType(toStringed) { + return ( + toStringed === '[object Array]' || + toStringed === '[object ArrayBuffer]' || + toStringed === '[object DataView]' || + toStringed === '[object Float32Array]' || + toStringed === '[object Float64Array]' || + toStringed === '[object Int8Array]' || + toStringed === '[object Int16Array]' || + toStringed === '[object Int32Array]' || + toStringed === '[object Uint8Array]' || + toStringed === '[object Uint8ClampedArray]' || + toStringed === '[object Uint16Array]' || + toStringed === '[object Uint32Array]' + ); +} + +function printNumber(val) { + return Object.is(val, -0) ? '-0' : String(val); +} + +function printBigInt(val) { + return String(`${val}n`); +} + +function printFunction(val, printFunctionName) { + if (!printFunctionName) { + return '[Function]'; + } + + return '[Function ' + (val.name || 'anonymous') + ']'; +} + +function printSymbol(val) { + return String(val).replace(SYMBOL_REGEXP, 'Symbol($1)'); +} + +function printError(val) { + return '[' + errorToString.call(val) + ']'; +} +/** + * The first port of call for printing an object, handles most of the + * data-types in JS. + */ + +function printBasicValue(val, printFunctionName, escapeRegex, escapeString) { + if (val === true || val === false) { + return '' + val; + } + + if (val === undefined) { + return 'undefined'; + } + + if (val === null) { + return 'null'; + } + + const typeOf = typeof val; + + if (typeOf === 'number') { + return printNumber(val); + } + + if (typeOf === 'bigint') { + return printBigInt(val); + } + + if (typeOf === 'string') { + if (escapeString) { + return '"' + val.replace(/"|\\/g, '\\$&') + '"'; + } + + return '"' + val + '"'; + } + + if (typeOf === 'function') { + return printFunction(val, printFunctionName); + } + + if (typeOf === 'symbol') { + return printSymbol(val); + } + + const toStringed = toString.call(val); + + if (toStringed === '[object WeakMap]') { + return 'WeakMap {}'; + } + + if (toStringed === '[object WeakSet]') { + return 'WeakSet {}'; + } + + if ( + toStringed === '[object Function]' || + toStringed === '[object GeneratorFunction]' + ) { + return printFunction(val, printFunctionName); + } + + if (toStringed === '[object Symbol]') { + return printSymbol(val); + } + + if (toStringed === '[object Date]') { + return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val); + } + + if (toStringed === '[object Error]') { + return printError(val); + } + + if (toStringed === '[object RegExp]') { + if (escapeRegex) { + // https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js + return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&'); + } + + return regExpToString.call(val); + } + + if (val instanceof Error) { + return printError(val); + } + + return null; +} +/** + * Handles more complex objects ( such as objects with circular references. + * maps and sets etc ) + */ + +function printComplexValue( + val, + config, + indentation, + depth, + refs, + hasCalledToJSON +) { + if (refs.indexOf(val) !== -1) { + return '[Circular]'; + } + + refs = refs.slice(); + refs.push(val); + const hitMaxDepth = ++depth > config.maxDepth; + const min = config.min; + + if ( + config.callToJSON && + !hitMaxDepth && + val.toJSON && + typeof val.toJSON === 'function' && + !hasCalledToJSON + ) { + return printer(val.toJSON(), config, indentation, depth, refs, true); + } + + const toStringed = toString.call(val); + + if (toStringed === '[object Arguments]') { + return hitMaxDepth + ? '[Arguments]' + : (min ? '' : 'Arguments ') + + '[' + + (0, _collections.printListItems)( + val, + config, + indentation, + depth, + refs, + printer + ) + + ']'; + } + + if (isToStringedArrayType(toStringed)) { + return hitMaxDepth + ? '[' + val.constructor.name + ']' + : (min ? '' : val.constructor.name + ' ') + + '[' + + (0, _collections.printListItems)( + val, + config, + indentation, + depth, + refs, + printer + ) + + ']'; + } + + if (toStringed === '[object Map]') { + return hitMaxDepth + ? '[Map]' + : 'Map {' + + (0, _collections.printIteratorEntries)( + val.entries(), + config, + indentation, + depth, + refs, + printer, + ' => ' + ) + + '}'; + } + + if (toStringed === '[object Set]') { + return hitMaxDepth + ? '[Set]' + : 'Set {' + + (0, _collections.printIteratorValues)( + val.values(), + config, + indentation, + depth, + refs, + printer + ) + + '}'; + } // Avoid failure to serialize global window object in jsdom test environment. + // For example, not even relevant if window is prop of React element. + + return hitMaxDepth || isWindow(val) + ? '[' + getConstructorName(val) + ']' + : (min ? '' : getConstructorName(val) + ' ') + + '{' + + (0, _collections.printObjectProperties)( + val, + config, + indentation, + depth, + refs, + printer + ) + + '}'; +} + +function isNewPlugin(plugin) { + return plugin.serialize != null; +} + +function printPlugin(plugin, val, config, indentation, depth, refs) { + let printed; + + try { + printed = isNewPlugin(plugin) + ? plugin.serialize(val, config, indentation, depth, refs, printer) + : plugin.print( + val, + valChild => printer(valChild, config, indentation, depth, refs), + str => { + const indentationNext = indentation + config.indent; + return ( + indentationNext + + str.replace(NEWLINE_REGEXP, '\n' + indentationNext) + ); + }, + { + edgeSpacing: config.spacingOuter, + min: config.min, + spacing: config.spacingInner + }, + config.colors + ); + } catch (error) { + throw new PrettyFormatPluginError(error.message, error.stack); + } + + if (typeof printed !== 'string') { + throw new Error( + `pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".` + ); + } + + return printed; +} + +function findPlugin(plugins, val) { + for (let p = 0; p < plugins.length; p++) { + try { + if (plugins[p].test(val)) { + return plugins[p]; + } + } catch (error) { + throw new PrettyFormatPluginError(error.message, error.stack); + } + } + + return null; +} + +function printer(val, config, indentation, depth, refs, hasCalledToJSON) { + const plugin = findPlugin(config.plugins, val); + + if (plugin !== null) { + return printPlugin(plugin, val, config, indentation, depth, refs); + } + + const basicResult = printBasicValue( + val, + config.printFunctionName, + config.escapeRegex, + config.escapeString + ); + + if (basicResult !== null) { + return basicResult; + } + + return printComplexValue( + val, + config, + indentation, + depth, + refs, + hasCalledToJSON + ); +} + +const DEFAULT_THEME = { + comment: 'gray', + content: 'reset', + prop: 'yellow', + tag: 'cyan', + value: 'green' +}; +const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME); +const DEFAULT_OPTIONS = { + callToJSON: true, + escapeRegex: false, + escapeString: true, + highlight: false, + indent: 2, + maxDepth: Infinity, + min: false, + plugins: [], + printFunctionName: true, + theme: DEFAULT_THEME +}; + +function validateOptions(options) { + Object.keys(options).forEach(key => { + if (!DEFAULT_OPTIONS.hasOwnProperty(key)) { + throw new Error(`pretty-format: Unknown option "${key}".`); + } + }); + + if (options.min && options.indent !== undefined && options.indent !== 0) { + throw new Error( + 'pretty-format: Options "min" and "indent" cannot be used together.' + ); + } + + if (options.theme !== undefined) { + if (options.theme === null) { + throw new Error(`pretty-format: Option "theme" must not be null.`); + } + + if (typeof options.theme !== 'object') { + throw new Error( + `pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".` + ); + } + } +} + +const getColorsHighlight = options => + DEFAULT_THEME_KEYS.reduce((colors, key) => { + const value = + options.theme && options.theme[key] !== undefined + ? options.theme[key] + : DEFAULT_THEME[key]; + const color = value && _ansiStyles.default[value]; + + if ( + color && + typeof color.close === 'string' && + typeof color.open === 'string' + ) { + colors[key] = color; + } else { + throw new Error( + `pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.` + ); + } + + return colors; + }, Object.create(null)); + +const getColorsEmpty = () => + DEFAULT_THEME_KEYS.reduce((colors, key) => { + colors[key] = { + close: '', + open: '' + }; + return colors; + }, Object.create(null)); + +const getPrintFunctionName = options => + options && options.printFunctionName !== undefined + ? options.printFunctionName + : DEFAULT_OPTIONS.printFunctionName; + +const getEscapeRegex = options => + options && options.escapeRegex !== undefined + ? options.escapeRegex + : DEFAULT_OPTIONS.escapeRegex; + +const getEscapeString = options => + options && options.escapeString !== undefined + ? options.escapeString + : DEFAULT_OPTIONS.escapeString; + +const getConfig = options => ({ + callToJSON: + options && options.callToJSON !== undefined + ? options.callToJSON + : DEFAULT_OPTIONS.callToJSON, + colors: + options && options.highlight + ? getColorsHighlight(options) + : getColorsEmpty(), + escapeRegex: getEscapeRegex(options), + escapeString: getEscapeString(options), + indent: + options && options.min + ? '' + : createIndent( + options && options.indent !== undefined + ? options.indent + : DEFAULT_OPTIONS.indent + ), + maxDepth: + options && options.maxDepth !== undefined + ? options.maxDepth + : DEFAULT_OPTIONS.maxDepth, + min: options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min, + plugins: + options && options.plugins !== undefined + ? options.plugins + : DEFAULT_OPTIONS.plugins, + printFunctionName: getPrintFunctionName(options), + spacingInner: options && options.min ? ' ' : '\n', + spacingOuter: options && options.min ? '' : '\n' +}); + +function createIndent(indent) { + return new Array(indent + 1).join(' '); +} +/** + * Returns a presentation string of your `val` object + * @param val any potential JavaScript object + * @param options Custom settings + */ + +function prettyFormat(val, options) { + if (options) { + validateOptions(options); + + if (options.plugins) { + const plugin = findPlugin(options.plugins, val); + + if (plugin !== null) { + return printPlugin(plugin, val, getConfig(options), '', 0, []); + } + } + } + + const basicResult = printBasicValue( + val, + getPrintFunctionName(options), + getEscapeRegex(options), + getEscapeString(options) + ); + + if (basicResult !== null) { + return basicResult; + } + + return printComplexValue(val, getConfig(options), '', 0, []); +} + +prettyFormat.plugins = { + AsymmetricMatcher: _AsymmetricMatcher.default, + ConvertAnsi: _ConvertAnsi.default, + DOMCollection: _DOMCollection.default, + DOMElement: _DOMElement.default, + Immutable: _Immutable.default, + ReactElement: _ReactElement.default, + ReactTestComponent: _ReactTestComponent.default +}; // eslint-disable-next-line no-redeclare + +module.exports = prettyFormat; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/AsymmetricMatcher.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/AsymmetricMatcher.d.ts new file mode 100644 index 000000000..fd2531b88 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/AsymmetricMatcher.d.ts @@ -0,0 +1,11 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { NewPlugin } from '../types'; +export declare const serialize: NewPlugin['serialize']; +export declare const test: NewPlugin['test']; +declare const plugin: NewPlugin; +export default plugin; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js new file mode 100644 index 000000000..a09dec215 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js @@ -0,0 +1,103 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = exports.test = exports.serialize = void 0; + +var _collections = require('../collections'); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +const asymmetricMatcher = + typeof Symbol === 'function' && Symbol.for + ? Symbol.for('jest.asymmetricMatcher') + : 0x1357a5; +const SPACE = ' '; + +const serialize = (val, config, indentation, depth, refs, printer) => { + const stringedValue = val.toString(); + + if ( + stringedValue === 'ArrayContaining' || + stringedValue === 'ArrayNotContaining' + ) { + if (++depth > config.maxDepth) { + return '[' + stringedValue + ']'; + } + + return ( + stringedValue + + SPACE + + '[' + + (0, _collections.printListItems)( + val.sample, + config, + indentation, + depth, + refs, + printer + ) + + ']' + ); + } + + if ( + stringedValue === 'ObjectContaining' || + stringedValue === 'ObjectNotContaining' + ) { + if (++depth > config.maxDepth) { + return '[' + stringedValue + ']'; + } + + return ( + stringedValue + + SPACE + + '{' + + (0, _collections.printObjectProperties)( + val.sample, + config, + indentation, + depth, + refs, + printer + ) + + '}' + ); + } + + if ( + stringedValue === 'StringMatching' || + stringedValue === 'StringNotMatching' + ) { + return ( + stringedValue + + SPACE + + printer(val.sample, config, indentation, depth, refs) + ); + } + + if ( + stringedValue === 'StringContaining' || + stringedValue === 'StringNotContaining' + ) { + return ( + stringedValue + + SPACE + + printer(val.sample, config, indentation, depth, refs) + ); + } + + return val.toAsymmetricMatcher(); +}; + +exports.serialize = serialize; + +const test = val => val && val.$$typeof === asymmetricMatcher; + +exports.test = test; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ConvertAnsi.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ConvertAnsi.d.ts new file mode 100644 index 000000000..bb0f507b7 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ConvertAnsi.d.ts @@ -0,0 +1,11 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { NewPlugin } from '../types'; +export declare const test: NewPlugin['test']; +export declare const serialize: NewPlugin['serialize']; +declare const plugin: NewPlugin; +export default plugin; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ConvertAnsi.js b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ConvertAnsi.js new file mode 100644 index 000000000..3d2d8fcbe --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ConvertAnsi.js @@ -0,0 +1,96 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = exports.serialize = exports.test = void 0; + +var _ansiRegex = _interopRequireDefault(require('ansi-regex')); + +var _ansiStyles = _interopRequireDefault(require('ansi-styles')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const toHumanReadableAnsi = text => + text.replace((0, _ansiRegex.default)(), match => { + switch (match) { + case _ansiStyles.default.red.close: + case _ansiStyles.default.green.close: + case _ansiStyles.default.cyan.close: + case _ansiStyles.default.gray.close: + case _ansiStyles.default.white.close: + case _ansiStyles.default.yellow.close: + case _ansiStyles.default.bgRed.close: + case _ansiStyles.default.bgGreen.close: + case _ansiStyles.default.bgYellow.close: + case _ansiStyles.default.inverse.close: + case _ansiStyles.default.dim.close: + case _ansiStyles.default.bold.close: + case _ansiStyles.default.reset.open: + case _ansiStyles.default.reset.close: + return ''; + + case _ansiStyles.default.red.open: + return ''; + + case _ansiStyles.default.green.open: + return ''; + + case _ansiStyles.default.cyan.open: + return ''; + + case _ansiStyles.default.gray.open: + return ''; + + case _ansiStyles.default.white.open: + return ''; + + case _ansiStyles.default.yellow.open: + return ''; + + case _ansiStyles.default.bgRed.open: + return ''; + + case _ansiStyles.default.bgGreen.open: + return ''; + + case _ansiStyles.default.bgYellow.open: + return ''; + + case _ansiStyles.default.inverse.open: + return ''; + + case _ansiStyles.default.dim.open: + return ''; + + case _ansiStyles.default.bold.open: + return ''; + + default: + return ''; + } + }); + +const test = val => + typeof val === 'string' && !!val.match((0, _ansiRegex.default)()); + +exports.test = test; + +const serialize = (val, config, indentation, depth, refs, printer) => + printer(toHumanReadableAnsi(val), config, indentation, depth, refs); + +exports.serialize = serialize; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/DOMCollection.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/DOMCollection.d.ts new file mode 100644 index 000000000..bb0f507b7 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/DOMCollection.d.ts @@ -0,0 +1,11 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { NewPlugin } from '../types'; +export declare const test: NewPlugin['test']; +export declare const serialize: NewPlugin['serialize']; +declare const plugin: NewPlugin; +export default plugin; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/DOMCollection.js b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/DOMCollection.js new file mode 100644 index 000000000..f25655138 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/DOMCollection.js @@ -0,0 +1,78 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = exports.serialize = exports.test = void 0; + +var _collections = require('../collections'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const SPACE = ' '; +const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap']; +const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/; + +const testName = name => + OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name); + +const test = val => + val && + val.constructor && + !!val.constructor.name && + testName(val.constructor.name); + +exports.test = test; + +const isNamedNodeMap = collection => + collection.constructor.name === 'NamedNodeMap'; + +const serialize = (collection, config, indentation, depth, refs, printer) => { + const name = collection.constructor.name; + + if (++depth > config.maxDepth) { + return '[' + name + ']'; + } + + return ( + (config.min ? '' : name + SPACE) + + (OBJECT_NAMES.indexOf(name) !== -1 + ? '{' + + (0, _collections.printObjectProperties)( + isNamedNodeMap(collection) + ? Array.from(collection).reduce((props, attribute) => { + props[attribute.name] = attribute.value; + return props; + }, {}) + : {...collection}, + config, + indentation, + depth, + refs, + printer + ) + + '}' + : '[' + + (0, _collections.printListItems)( + Array.from(collection), + config, + indentation, + depth, + refs, + printer + ) + + ']') + ); +}; + +exports.serialize = serialize; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/DOMElement.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/DOMElement.d.ts new file mode 100644 index 000000000..bb0f507b7 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/DOMElement.d.ts @@ -0,0 +1,11 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { NewPlugin } from '../types'; +export declare const test: NewPlugin['test']; +export declare const serialize: NewPlugin['serialize']; +declare const plugin: NewPlugin; +export default plugin; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/DOMElement.js b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/DOMElement.js new file mode 100644 index 000000000..ffa2d32e0 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/DOMElement.js @@ -0,0 +1,104 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = exports.serialize = exports.test = void 0; + +var _markup = require('./lib/markup'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const ELEMENT_NODE = 1; +const TEXT_NODE = 3; +const COMMENT_NODE = 8; +const FRAGMENT_NODE = 11; +const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/; + +const testNode = (nodeType, name) => + (nodeType === ELEMENT_NODE && ELEMENT_REGEXP.test(name)) || + (nodeType === TEXT_NODE && name === 'Text') || + (nodeType === COMMENT_NODE && name === 'Comment') || + (nodeType === FRAGMENT_NODE && name === 'DocumentFragment'); + +const test = val => + val && + val.constructor && + val.constructor.name && + testNode(val.nodeType, val.constructor.name); + +exports.test = test; + +function nodeIsText(node) { + return node.nodeType === TEXT_NODE; +} + +function nodeIsComment(node) { + return node.nodeType === COMMENT_NODE; +} + +function nodeIsFragment(node) { + return node.nodeType === FRAGMENT_NODE; +} + +const serialize = (node, config, indentation, depth, refs, printer) => { + if (nodeIsText(node)) { + return (0, _markup.printText)(node.data, config); + } + + if (nodeIsComment(node)) { + return (0, _markup.printComment)(node.data, config); + } + + const type = nodeIsFragment(node) + ? `DocumentFragment` + : node.tagName.toLowerCase(); + + if (++depth > config.maxDepth) { + return (0, _markup.printElementAsLeaf)(type, config); + } + + return (0, _markup.printElement)( + type, + (0, _markup.printProps)( + nodeIsFragment(node) + ? [] + : Array.from(node.attributes) + .map(attr => attr.name) + .sort(), + nodeIsFragment(node) + ? {} + : Array.from(node.attributes).reduce((props, attribute) => { + props[attribute.name] = attribute.value; + return props; + }, {}), + config, + indentation + config.indent, + depth, + refs, + printer + ), + (0, _markup.printChildren)( + Array.prototype.slice.call(node.childNodes || node.children), + config, + indentation + config.indent, + depth, + refs, + printer + ), + config, + indentation + ); +}; + +exports.serialize = serialize; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/Immutable.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/Immutable.d.ts new file mode 100644 index 000000000..fd2531b88 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/Immutable.d.ts @@ -0,0 +1,11 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { NewPlugin } from '../types'; +export declare const serialize: NewPlugin['serialize']; +export declare const test: NewPlugin['test']; +declare const plugin: NewPlugin; +export default plugin; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/Immutable.js b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/Immutable.js new file mode 100644 index 000000000..92684017d --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/Immutable.js @@ -0,0 +1,247 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = exports.test = exports.serialize = void 0; + +var _collections = require('../collections'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// SENTINEL constants are from https://github.com/facebook/immutable-js +const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; +const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@'; +const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; +const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@'; +const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; +const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4 + +const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@'; +const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@'; +const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@'; + +const getImmutableName = name => 'Immutable.' + name; + +const printAsLeaf = name => '[' + name + ']'; + +const SPACE = ' '; +const LAZY = '…'; // Seq is lazy if it calls a method like filter + +const printImmutableEntries = ( + val, + config, + indentation, + depth, + refs, + printer, + type +) => + ++depth > config.maxDepth + ? printAsLeaf(getImmutableName(type)) + : getImmutableName(type) + + SPACE + + '{' + + (0, _collections.printIteratorEntries)( + val.entries(), + config, + indentation, + depth, + refs, + printer + ) + + '}'; // Record has an entries method because it is a collection in immutable v3. +// Return an iterator for Immutable Record from version v3 or v4. + +function getRecordEntries(val) { + let i = 0; + return { + next() { + if (i < val._keys.length) { + const key = val._keys[i++]; + return { + done: false, + value: [key, val.get(key)] + }; + } + + return { + done: true, + value: undefined + }; + } + }; +} + +const printImmutableRecord = ( + val, + config, + indentation, + depth, + refs, + printer +) => { + // _name property is defined only for an Immutable Record instance + // which was constructed with a second optional descriptive name arg + const name = getImmutableName(val._name || 'Record'); + return ++depth > config.maxDepth + ? printAsLeaf(name) + : name + + SPACE + + '{' + + (0, _collections.printIteratorEntries)( + getRecordEntries(val), + config, + indentation, + depth, + refs, + printer + ) + + '}'; +}; + +const printImmutableSeq = (val, config, indentation, depth, refs, printer) => { + const name = getImmutableName('Seq'); + + if (++depth > config.maxDepth) { + return printAsLeaf(name); + } + + if (val[IS_KEYED_SENTINEL]) { + return ( + name + + SPACE + + '{' + // from Immutable collection of entries or from ECMAScript object + (val._iter || val._object + ? (0, _collections.printIteratorEntries)( + val.entries(), + config, + indentation, + depth, + refs, + printer + ) + : LAZY) + + '}' + ); + } + + return ( + name + + SPACE + + '[' + + (val._iter || // from Immutable collection of values + val._array || // from ECMAScript array + val._collection || // from ECMAScript collection in immutable v4 + val._iterable // from ECMAScript collection in immutable v3 + ? (0, _collections.printIteratorValues)( + val.values(), + config, + indentation, + depth, + refs, + printer + ) + : LAZY) + + ']' + ); +}; + +const printImmutableValues = ( + val, + config, + indentation, + depth, + refs, + printer, + type +) => + ++depth > config.maxDepth + ? printAsLeaf(getImmutableName(type)) + : getImmutableName(type) + + SPACE + + '[' + + (0, _collections.printIteratorValues)( + val.values(), + config, + indentation, + depth, + refs, + printer + ) + + ']'; + +const serialize = (val, config, indentation, depth, refs, printer) => { + if (val[IS_MAP_SENTINEL]) { + return printImmutableEntries( + val, + config, + indentation, + depth, + refs, + printer, + val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map' + ); + } + + if (val[IS_LIST_SENTINEL]) { + return printImmutableValues( + val, + config, + indentation, + depth, + refs, + printer, + 'List' + ); + } + + if (val[IS_SET_SENTINEL]) { + return printImmutableValues( + val, + config, + indentation, + depth, + refs, + printer, + val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set' + ); + } + + if (val[IS_STACK_SENTINEL]) { + return printImmutableValues( + val, + config, + indentation, + depth, + refs, + printer, + 'Stack' + ); + } + + if (val[IS_SEQ_SENTINEL]) { + return printImmutableSeq(val, config, indentation, depth, refs, printer); + } // For compatibility with immutable v3 and v4, let record be the default. + + return printImmutableRecord(val, config, indentation, depth, refs, printer); +}; // Explicitly comparing sentinel properties to true avoids false positive +// when mock identity-obj-proxy returns the key as the value for any key. + +exports.serialize = serialize; + +const test = val => + val && + (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true); + +exports.test = test; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ReactElement.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ReactElement.d.ts new file mode 100644 index 000000000..fd2531b88 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ReactElement.d.ts @@ -0,0 +1,11 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { NewPlugin } from '../types'; +export declare const serialize: NewPlugin['serialize']; +export declare const test: NewPlugin['test']; +declare const plugin: NewPlugin; +export default plugin; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ReactElement.js b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ReactElement.js new file mode 100644 index 000000000..ad2cca083 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ReactElement.js @@ -0,0 +1,166 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = exports.test = exports.serialize = void 0; + +var ReactIs = _interopRequireWildcard(require('react-is')); + +var _markup = require('./lib/markup'); + +function _getRequireWildcardCache() { + if (typeof WeakMap !== 'function') return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function () { + return cache; + }; + return cache; +} + +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// Given element.props.children, or subtree during recursive traversal, +// return flattened array of children. +const getChildren = (arg, children = []) => { + if (Array.isArray(arg)) { + arg.forEach(item => { + getChildren(item, children); + }); + } else if (arg != null && arg !== false) { + children.push(arg); + } + + return children; +}; + +const getType = element => { + const type = element.type; + + if (typeof type === 'string') { + return type; + } + + if (typeof type === 'function') { + return type.displayName || type.name || 'Unknown'; + } + + if (ReactIs.isFragment(element)) { + return 'React.Fragment'; + } + + if (ReactIs.isSuspense(element)) { + return 'React.Suspense'; + } + + if (typeof type === 'object' && type !== null) { + if (ReactIs.isContextProvider(element)) { + return 'Context.Provider'; + } + + if (ReactIs.isContextConsumer(element)) { + return 'Context.Consumer'; + } + + if (ReactIs.isForwardRef(element)) { + if (type.displayName) { + return type.displayName; + } + + const functionName = type.render.displayName || type.render.name || ''; + return functionName !== '' + ? 'ForwardRef(' + functionName + ')' + : 'ForwardRef'; + } + + if (ReactIs.isMemo(element)) { + const functionName = + type.displayName || type.type.displayName || type.type.name || ''; + return functionName !== '' ? 'Memo(' + functionName + ')' : 'Memo'; + } + } + + return 'UNDEFINED'; +}; + +const getPropKeys = element => { + const {props} = element; + return Object.keys(props) + .filter(key => key !== 'children' && props[key] !== undefined) + .sort(); +}; + +const serialize = (element, config, indentation, depth, refs, printer) => + ++depth > config.maxDepth + ? (0, _markup.printElementAsLeaf)(getType(element), config) + : (0, _markup.printElement)( + getType(element), + (0, _markup.printProps)( + getPropKeys(element), + element.props, + config, + indentation + config.indent, + depth, + refs, + printer + ), + (0, _markup.printChildren)( + getChildren(element.props.children), + config, + indentation + config.indent, + depth, + refs, + printer + ), + config, + indentation + ); + +exports.serialize = serialize; + +const test = val => val && ReactIs.isElement(val); + +exports.test = test; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ReactTestComponent.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ReactTestComponent.d.ts new file mode 100644 index 000000000..91542d985 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ReactTestComponent.d.ts @@ -0,0 +1,18 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { NewPlugin } from '../types'; +export declare type ReactTestObject = { + $$typeof: symbol; + type: string; + props?: Record; + children?: null | Array; +}; +declare type ReactTestChild = ReactTestObject | string | number; +export declare const serialize: NewPlugin['serialize']; +export declare const test: NewPlugin['test']; +declare const plugin: NewPlugin; +export default plugin; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ReactTestComponent.js b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ReactTestComponent.js new file mode 100644 index 000000000..9399f78b0 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/ReactTestComponent.js @@ -0,0 +1,65 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = exports.test = exports.serialize = void 0; + +var _markup = require('./lib/markup'); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +const testSymbol = + typeof Symbol === 'function' && Symbol.for + ? Symbol.for('react.test.json') + : 0xea71357; + +const getPropKeys = object => { + const {props} = object; + return props + ? Object.keys(props) + .filter(key => props[key] !== undefined) + .sort() + : []; +}; + +const serialize = (object, config, indentation, depth, refs, printer) => + ++depth > config.maxDepth + ? (0, _markup.printElementAsLeaf)(object.type, config) + : (0, _markup.printElement)( + object.type, + object.props + ? (0, _markup.printProps)( + getPropKeys(object), + object.props, + config, + indentation + config.indent, + depth, + refs, + printer + ) + : '', + object.children + ? (0, _markup.printChildren)( + object.children, + config, + indentation + config.indent, + depth, + refs, + printer + ) + : '', + config, + indentation + ); + +exports.serialize = serialize; + +const test = val => val && val.$$typeof === testSymbol; + +exports.test = test; +const plugin = { + serialize, + test +}; +var _default = plugin; +exports.default = _default; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/lib/escapeHTML.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/lib/escapeHTML.d.ts new file mode 100644 index 000000000..aee0d3d06 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/lib/escapeHTML.d.ts @@ -0,0 +1,7 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export default function escapeHTML(str: string): string; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/lib/escapeHTML.js b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/lib/escapeHTML.js new file mode 100644 index 000000000..50dda2590 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/lib/escapeHTML.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = escapeHTML; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function escapeHTML(str) { + return str.replace(//g, '>'); +} diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/lib/markup.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/lib/markup.d.ts new file mode 100644 index 000000000..bf662a691 --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/lib/markup.d.ts @@ -0,0 +1,13 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config, Printer, Refs } from '../../types'; +export declare const printProps: (keys: string[], props: Record, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string; +export declare const printChildren: (children: any[], config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string; +export declare const printText: (text: string, config: Config) => string; +export declare const printComment: (comment: string, config: Config) => string; +export declare const printElement: (type: string, printedProps: string, printedChildren: string, config: Config, indentation: string) => string; +export declare const printElementAsLeaf: (type: string, config: Config) => string; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/plugins/lib/markup.js b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/lib/markup.js new file mode 100644 index 000000000..d47b88f7b --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/plugins/lib/markup.js @@ -0,0 +1,147 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.printElementAsLeaf = exports.printElement = exports.printComment = exports.printText = exports.printChildren = exports.printProps = void 0; + +var _escapeHTML = _interopRequireDefault(require('./escapeHTML')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// Return empty string if keys is empty. +const printProps = (keys, props, config, indentation, depth, refs, printer) => { + const indentationNext = indentation + config.indent; + const colors = config.colors; + return keys + .map(key => { + const value = props[key]; + let printed = printer(value, config, indentationNext, depth, refs); + + if (typeof value !== 'string') { + if (printed.indexOf('\n') !== -1) { + printed = + config.spacingOuter + + indentationNext + + printed + + config.spacingOuter + + indentation; + } + + printed = '{' + printed + '}'; + } + + return ( + config.spacingInner + + indentation + + colors.prop.open + + key + + colors.prop.close + + '=' + + colors.value.open + + printed + + colors.value.close + ); + }) + .join(''); +}; // Return empty string if children is empty. + +exports.printProps = printProps; + +const printChildren = (children, config, indentation, depth, refs, printer) => + children + .map( + child => + config.spacingOuter + + indentation + + (typeof child === 'string' + ? printText(child, config) + : printer(child, config, indentation, depth, refs)) + ) + .join(''); + +exports.printChildren = printChildren; + +const printText = (text, config) => { + const contentColor = config.colors.content; + return ( + contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close + ); +}; + +exports.printText = printText; + +const printComment = (comment, config) => { + const commentColor = config.colors.comment; + return ( + commentColor.open + + '' + + commentColor.close + ); +}; // Separate the functions to format props, children, and element, +// so a plugin could override a particular function, if needed. +// Too bad, so sad: the traditional (but unnecessary) space +// in a self-closing tagColor requires a second test of printedProps. + +exports.printComment = printComment; + +const printElement = ( + type, + printedProps, + printedChildren, + config, + indentation +) => { + const tagColor = config.colors.tag; + return ( + tagColor.open + + '<' + + type + + (printedProps && + tagColor.close + + printedProps + + config.spacingOuter + + indentation + + tagColor.open) + + (printedChildren + ? '>' + + tagColor.close + + printedChildren + + config.spacingOuter + + indentation + + tagColor.open + + '' + + tagColor.close + ); +}; + +exports.printElement = printElement; + +const printElementAsLeaf = (type, config) => { + const tagColor = config.colors.tag; + return ( + tagColor.open + + '<' + + type + + tagColor.close + + ' …' + + tagColor.open + + ' />' + + tagColor.close + ); +}; + +exports.printElementAsLeaf = printElementAsLeaf; diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/collections.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/collections.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/collections.d.ts rename to node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/collections.d.ts diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/index.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/index.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/index.d.ts rename to node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/index.d.ts diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/AsymmetricMatcher.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/AsymmetricMatcher.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/AsymmetricMatcher.d.ts rename to node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/AsymmetricMatcher.d.ts diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/ConvertAnsi.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/ConvertAnsi.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/ConvertAnsi.d.ts rename to node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/ConvertAnsi.d.ts diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/DOMCollection.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/DOMCollection.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/DOMCollection.d.ts rename to node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/DOMCollection.d.ts diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/DOMElement.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/DOMElement.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/DOMElement.d.ts rename to node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/DOMElement.d.ts diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/Immutable.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/Immutable.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/Immutable.d.ts rename to node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/Immutable.d.ts diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/ReactElement.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/ReactElement.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/ReactElement.d.ts rename to node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/ReactElement.d.ts diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/ReactTestComponent.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/ReactTestComponent.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/ReactTestComponent.d.ts rename to node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/ReactTestComponent.d.ts diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/lib/escapeHTML.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/lib/escapeHTML.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/lib/escapeHTML.d.ts rename to node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/lib/escapeHTML.d.ts diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/lib/markup.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/lib/markup.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/plugins/lib/markup.d.ts rename to node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/plugins/lib/markup.d.ts diff --git a/node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/types.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/types.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/pretty-format/build/ts3.4/types.d.ts rename to node_modules/@jest/core/node_modules/pretty-format/build/ts3.4/types.d.ts diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/types.d.ts b/node_modules/@jest/core/node_modules/pretty-format/build/types.d.ts new file mode 100644 index 000000000..5f1e06dbd --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/types.d.ts @@ -0,0 +1,100 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare type Colors = { + comment: { + close: string; + open: string; + }; + content: { + close: string; + open: string; + }; + prop: { + close: string; + open: string; + }; + tag: { + close: string; + open: string; + }; + value: { + close: string; + open: string; + }; +}; +declare type Indent = (arg0: string) => string; +export declare type Refs = Array; +declare type Print = (arg0: unknown) => string; +export declare type Theme = { + comment: string; + content: string; + prop: string; + tag: string; + value: string; +}; +declare type ThemeReceived = { + comment?: string; + content?: string; + prop?: string; + tag?: string; + value?: string; +}; +export declare type Options = { + callToJSON: boolean; + escapeRegex: boolean; + escapeString: boolean; + highlight: boolean; + indent: number; + maxDepth: number; + min: boolean; + plugins: Plugins; + printFunctionName: boolean; + theme: Theme; +}; +export declare type OptionsReceived = { + callToJSON?: boolean; + escapeRegex?: boolean; + escapeString?: boolean; + highlight?: boolean; + indent?: number; + maxDepth?: number; + min?: boolean; + plugins?: Plugins; + printFunctionName?: boolean; + theme?: ThemeReceived; +}; +export declare type Config = { + callToJSON: boolean; + colors: Colors; + escapeRegex: boolean; + escapeString: boolean; + indent: string; + maxDepth: number; + min: boolean; + plugins: Plugins; + printFunctionName: boolean; + spacingInner: string; + spacingOuter: string; +}; +export declare type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string; +declare type Test = (arg0: any) => boolean; +export declare type NewPlugin = { + serialize: (val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string; + test: Test; +}; +declare type PluginOptions = { + edgeSpacing: string; + min: boolean; + spacing: string; +}; +export declare type OldPlugin = { + print: (val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string; + test: Test; +}; +export declare type Plugin = NewPlugin | OldPlugin; +export declare type Plugins = Array; +export {}; diff --git a/node_modules/@jest/core/node_modules/pretty-format/build/types.js b/node_modules/@jest/core/node_modules/pretty-format/build/types.js new file mode 100644 index 000000000..ad9a93a7c --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/core/node_modules/pretty-format/package.json b/node_modules/@jest/core/node_modules/pretty-format/package.json new file mode 100644 index 000000000..d4ace1fec --- /dev/null +++ b/node_modules/@jest/core/node_modules/pretty-format/package.json @@ -0,0 +1,81 @@ +{ + "_args": [ + [ + "pretty-format@25.5.0", + "/workspace/readable-readme" + ] + ], + "_development": true, + "_from": "pretty-format@25.5.0", + "_id": "pretty-format@25.5.0", + "_inBundle": false, + "_integrity": "sha512-kbo/kq2LQ/A/is0PQwsEHM7Ca6//bGPPvU6UnsdDRSKTWxT/ru/xb88v4BJf6a69H+uTytOEsTusT9ksd/1iWQ==", + "_location": "/@jest/core/pretty-format", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "pretty-format@25.5.0", + "name": "pretty-format", + "escapedName": "pretty-format", + "rawSpec": "25.5.0", + "saveSpec": null, + "fetchSpec": "25.5.0" + }, + "_requiredBy": [ + "/@jest/core/jest-config", + "/@jest/core/jest-jasmine2" + ], + "_resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.5.0.tgz", + "_spec": "25.5.0", + "_where": "/workspace/readable-readme", + "author": { + "name": "James Kyle", + "email": "me@thejameskyle.com" + }, + "browser": "build-es5/index.js", + "bugs": { + "url": "https://github.com/facebook/jest/issues" + }, + "dependencies": { + "@jest/types": "^25.5.0", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^16.12.0" + }, + "description": "Stringify any JavaScript value.", + "devDependencies": { + "@types/react": "*", + "@types/react-is": "^16.7.1", + "@types/react-test-renderer": "*", + "immutable": "4.0.0-rc.9", + "react": "*", + "react-dom": "*", + "react-test-renderer": "*" + }, + "engines": { + "node": ">= 8.3" + }, + "gitHead": "ddd73d18adfb982b9b0d94bad7d41c9f78567ca7", + "homepage": "https://github.com/facebook/jest#readme", + "license": "MIT", + "main": "build/index.js", + "name": "pretty-format", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/facebook/jest.git", + "directory": "packages/pretty-format" + }, + "types": "build/index.d.ts", + "typesVersions": { + "<3.8": { + "build/*": [ + "build/ts3.4/*" + ] + } + }, + "version": "25.5.0" +} diff --git a/node_modules/@jest/core/node_modules/supports-color/package.json b/node_modules/@jest/core/node_modules/supports-color/package.json index 26a7c4d9a..1263636b9 100644 --- a/node_modules/@jest/core/node_modules/supports-color/package.json +++ b/node_modules/@jest/core/node_modules/supports-color/package.json @@ -2,7 +2,7 @@ "_args": [ [ "supports-color@7.1.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", "_spec": "7.1.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@jest/core/package.json b/node_modules/@jest/core/package.json index c6931883b..9b0a4edc7 100644 --- a/node_modules/@jest/core/package.json +++ b/node_modules/@jest/core/package.json @@ -1,66 +1,106 @@ { "_args": [ [ - "@jest/core@25.4.0", - "/home/runner/work/readable-readme/readable-readme" + "@jest/core@25.5.4", + "/workspace/readable-readme" ] ], "_development": true, - "_from": "@jest/core@25.4.0", - "_id": "@jest/core@25.4.0", + "_from": "@jest/core@25.5.4", + "_id": "@jest/core@25.5.4", "_inBundle": false, - "_integrity": "sha512-h1x9WSVV0+TKVtATGjyQIMJENs8aF6eUjnCoi4jyRemYZmekLr8EJOGQqTWEX8W6SbZ6Skesy9pGXrKeAolUJw==", + "_integrity": "sha512-3uSo7laYxF00Dg/DMgbn4xMJKmDdWvZnf89n8Xj/5/AeQ2dOQmn6b6Hkj/MleyzZWXpwv+WSdYWl4cLsy2JsoA==", "_location": "/@jest/core", "_phantomChildren": { + "@babel/core": "7.5.5", + "@babel/traverse": "7.5.5", + "@jest/console": "25.5.0", + "@jest/environment": "25.5.0", + "@jest/globals": "25.5.2", + "@jest/source-map": "25.5.0", + "@jest/test-result": "25.5.0", + "@jest/transform": "25.5.1", "@types/color-name": "1.1.1", "@types/istanbul-lib-coverage": "2.0.1", "@types/istanbul-reports": "1.1.1", - "@types/yargs": "15.0.4" + "@types/yargs": "15.0.4", + "babel-jest": "25.5.1", + "co": "4.6.0", + "collect-v8-coverage": "1.0.0", + "deepmerge": "4.2.2", + "exit": "0.1.2", + "expect": "25.5.0", + "glob": "7.1.4", + "is-generator-fn": "2.1.0", + "jest-docblock": "25.3.0", + "jest-each": "25.5.0", + "jest-environment-jsdom": "25.5.0", + "jest-environment-node": "25.5.0", + "jest-get-type": "25.2.6", + "jest-haste-map": "25.5.1", + "jest-leak-detector": "25.5.0", + "jest-matcher-utils": "25.5.0", + "jest-message-util": "25.5.0", + "jest-mock": "25.5.0", + "jest-regex-util": "25.2.6", + "jest-resolve": "25.5.1", + "jest-snapshot": "25.5.1", + "jest-util": "25.5.0", + "jest-validate": "25.5.0", + "jest-worker": "25.5.0", + "micromatch": "4.0.2", + "react-is": "16.13.0", + "realpath-native": "2.0.0", + "slash": "3.0.0", + "source-map-support": "0.5.13", + "strip-bom": "4.0.0", + "throat": "5.0.0", + "yargs": "15.3.1" }, "_requested": { "type": "version", "registry": true, - "raw": "@jest/core@25.4.0", + "raw": "@jest/core@25.5.4", "name": "@jest/core", "escapedName": "@jest%2fcore", "scope": "@jest", - "rawSpec": "25.4.0", + "rawSpec": "25.5.4", "saveSpec": null, - "fetchSpec": "25.4.0" + "fetchSpec": "25.5.4" }, "_requiredBy": [ "/jest", "/jest/jest-cli" ], - "_resolved": "https://registry.npmjs.org/@jest/core/-/core-25.4.0.tgz", - "_spec": "25.4.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_resolved": "https://registry.npmjs.org/@jest/core/-/core-25.5.4.tgz", + "_spec": "25.5.4", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/facebook/jest/issues" }, "dependencies": { - "@jest/console": "^25.4.0", - "@jest/reporters": "^25.4.0", - "@jest/test-result": "^25.4.0", - "@jest/transform": "^25.4.0", - "@jest/types": "^25.4.0", + "@jest/console": "^25.5.0", + "@jest/reporters": "^25.5.1", + "@jest/test-result": "^25.5.0", + "@jest/transform": "^25.5.1", + "@jest/types": "^25.5.0", "ansi-escapes": "^4.2.1", "chalk": "^3.0.0", "exit": "^0.1.2", - "graceful-fs": "^4.2.3", - "jest-changed-files": "^25.4.0", - "jest-config": "^25.4.0", - "jest-haste-map": "^25.4.0", - "jest-message-util": "^25.4.0", + "graceful-fs": "^4.2.4", + "jest-changed-files": "^25.5.0", + "jest-config": "^25.5.4", + "jest-haste-map": "^25.5.1", + "jest-message-util": "^25.5.0", "jest-regex-util": "^25.2.6", - "jest-resolve": "^25.4.0", - "jest-resolve-dependencies": "^25.4.0", - "jest-runner": "^25.4.0", - "jest-runtime": "^25.4.0", - "jest-snapshot": "^25.4.0", - "jest-util": "^25.4.0", - "jest-validate": "^25.4.0", - "jest-watcher": "^25.4.0", + "jest-resolve": "^25.5.1", + "jest-resolve-dependencies": "^25.5.4", + "jest-runner": "^25.5.4", + "jest-runtime": "^25.5.4", + "jest-snapshot": "^25.5.1", + "jest-util": "^25.5.0", + "jest-validate": "^25.5.0", + "jest-watcher": "^25.5.0", "micromatch": "^4.0.2", "p-each-series": "^2.1.0", "realpath-native": "^2.0.0", @@ -70,7 +110,7 @@ }, "description": "Delightful JavaScript Testing.", "devDependencies": { - "@jest/test-sequencer": "^25.4.0", + "@jest/test-sequencer": "^25.5.4", "@types/exit": "^0.1.30", "@types/graceful-fs": "^4.1.2", "@types/micromatch": "^4.0.0", @@ -81,7 +121,7 @@ "engines": { "node": ">= 8.3" }, - "gitHead": "5b129d714cadb818be28afbe313cbeae8fbb1dde", + "gitHead": "389d13724bbf6bb64dcde9700a6ecea3333942db", "homepage": "https://jestjs.io/", "keywords": [ "ava", @@ -128,5 +168,5 @@ ] } }, - "version": "25.4.0" + "version": "25.5.4" } diff --git a/node_modules/@jest/environment/build/index.d.ts b/node_modules/@jest/environment/build/index.d.ts index 76a4ef094..cf46e963c 100644 --- a/node_modules/@jest/environment/build/index.d.ts +++ b/node_modules/@jest/environment/build/index.d.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ /// -/// import type { Context, Script } from 'vm'; import type { Circus, Config, Global } from '@jest/types'; import jestMock = require('jest-mock'); diff --git a/node_modules/@jest/environment/build/ts3.4/index.d.ts b/node_modules/@jest/environment/build/ts3.4/index.d.ts index 81daed998..1cd63757a 100644 --- a/node_modules/@jest/environment/build/ts3.4/index.d.ts +++ b/node_modules/@jest/environment/build/ts3.4/index.d.ts @@ -1,5 +1,4 @@ /// -/// /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * @@ -7,7 +6,6 @@ * LICENSE file in the root directory of this source tree. */ /// -/// import { Context, Script } from 'vm'; import { Circus, Config, Global } from '@jest/types'; import jestMock = require('jest-mock'); diff --git a/node_modules/@jest/environment/node_modules/@jest/types/build/Transform.d.ts b/node_modules/@jest/environment/node_modules/@jest/types/build/Transform.d.ts index ea3e511cb..af8063f7d 100644 --- a/node_modules/@jest/environment/node_modules/@jest/types/build/Transform.d.ts +++ b/node_modules/@jest/environment/node_modules/@jest/types/build/Transform.d.ts @@ -7,6 +7,6 @@ export declare type TransformResult = { code: string; originalCode: string; - mapCoverage: boolean; + mapCoverage?: boolean; sourceMapPath: string | null; }; diff --git a/node_modules/@jest/environment/node_modules/@jest/types/build/ts3.4/Transform.d.ts b/node_modules/@jest/environment/node_modules/@jest/types/build/ts3.4/Transform.d.ts index bcc63baf1..231ae24ca 100644 --- a/node_modules/@jest/environment/node_modules/@jest/types/build/ts3.4/Transform.d.ts +++ b/node_modules/@jest/environment/node_modules/@jest/types/build/ts3.4/Transform.d.ts @@ -7,6 +7,6 @@ export declare type TransformResult = { code: string; originalCode: string; - mapCoverage: boolean; + mapCoverage?: boolean; sourceMapPath: string | null; }; diff --git a/node_modules/@jest/environment/node_modules/@jest/types/package.json b/node_modules/@jest/environment/node_modules/@jest/types/package.json index 221d0d59e..77d484dd9 100644 --- a/node_modules/@jest/environment/node_modules/@jest/types/package.json +++ b/node_modules/@jest/environment/node_modules/@jest/types/package.json @@ -1,34 +1,34 @@ { "_args": [ [ - "@jest/types@25.4.0", - "/home/runner/work/readable-readme/readable-readme" + "@jest/types@25.5.0", + "/workspace/readable-readme" ] ], "_development": true, - "_from": "@jest/types@25.4.0", - "_id": "@jest/types@25.4.0", + "_from": "@jest/types@25.5.0", + "_id": "@jest/types@25.5.0", "_inBundle": false, - "_integrity": "sha512-XBeaWNzw2PPnGW5aXvZt3+VO60M+34RY3XDsCK5tW7kyj3RK0XClRutCfjqcBuaR2aBQTbluEDME9b5MB9UAPw==", + "_integrity": "sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==", "_location": "/@jest/environment/@jest/types", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "@jest/types@25.4.0", + "raw": "@jest/types@25.5.0", "name": "@jest/types", "escapedName": "@jest%2ftypes", "scope": "@jest", - "rawSpec": "25.4.0", + "rawSpec": "25.5.0", "saveSpec": null, - "fetchSpec": "25.4.0" + "fetchSpec": "25.5.0" }, "_requiredBy": [ "/@jest/environment" ], - "_resolved": "https://registry.npmjs.org/@jest/types/-/types-25.4.0.tgz", - "_spec": "25.4.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_resolved": "https://registry.npmjs.org/@jest/types/-/types-25.5.0.tgz", + "_spec": "25.5.0", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/facebook/jest/issues" }, @@ -44,7 +44,7 @@ "engines": { "node": ">= 8.3" }, - "gitHead": "5b129d714cadb818be28afbe313cbeae8fbb1dde", + "gitHead": "ddd73d18adfb982b9b0d94bad7d41c9f78567ca7", "homepage": "https://github.com/facebook/jest#readme", "license": "MIT", "main": "build/index.js", @@ -65,5 +65,5 @@ ] } }, - "version": "25.4.0" + "version": "25.5.0" } diff --git a/node_modules/@jest/environment/node_modules/ansi-styles/package.json b/node_modules/@jest/environment/node_modules/ansi-styles/package.json index 68e4968d2..c19198271 100644 --- a/node_modules/@jest/environment/node_modules/ansi-styles/package.json +++ b/node_modules/@jest/environment/node_modules/ansi-styles/package.json @@ -2,7 +2,7 @@ "_args": [ [ "ansi-styles@4.2.1", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "_spec": "4.2.1", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@jest/environment/node_modules/chalk/package.json b/node_modules/@jest/environment/node_modules/chalk/package.json index 0907c4f9b..2c14f5bbd 100644 --- a/node_modules/@jest/environment/node_modules/chalk/package.json +++ b/node_modules/@jest/environment/node_modules/chalk/package.json @@ -2,7 +2,7 @@ "_args": [ [ "chalk@3.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", "_spec": "3.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/chalk/chalk/issues" }, diff --git a/node_modules/@jest/environment/node_modules/color-convert/package.json b/node_modules/@jest/environment/node_modules/color-convert/package.json index 9d6da17ed..a31ac7205 100644 --- a/node_modules/@jest/environment/node_modules/color-convert/package.json +++ b/node_modules/@jest/environment/node_modules/color-convert/package.json @@ -2,7 +2,7 @@ "_args": [ [ "color-convert@2.0.1", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "_spec": "2.0.1", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Heather Arthur", "email": "fayearthur@gmail.com" diff --git a/node_modules/@jest/environment/node_modules/color-name/package.json b/node_modules/@jest/environment/node_modules/color-name/package.json index dd578a4d9..207e74f86 100644 --- a/node_modules/@jest/environment/node_modules/color-name/package.json +++ b/node_modules/@jest/environment/node_modules/color-name/package.json @@ -2,7 +2,7 @@ "_args": [ [ "color-name@1.1.4", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "_spec": "1.1.4", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "DY", "email": "dfcreative@gmail.com" diff --git a/node_modules/@jest/environment/node_modules/has-flag/package.json b/node_modules/@jest/environment/node_modules/has-flag/package.json index a6eeb8644..a5fac1f32 100644 --- a/node_modules/@jest/environment/node_modules/has-flag/package.json +++ b/node_modules/@jest/environment/node_modules/has-flag/package.json @@ -2,7 +2,7 @@ "_args": [ [ "has-flag@4.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "_spec": "4.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@jest/environment/node_modules/supports-color/package.json b/node_modules/@jest/environment/node_modules/supports-color/package.json index 89ad716b3..f2d9dfa35 100644 --- a/node_modules/@jest/environment/node_modules/supports-color/package.json +++ b/node_modules/@jest/environment/node_modules/supports-color/package.json @@ -2,7 +2,7 @@ "_args": [ [ "supports-color@7.1.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", "_spec": "7.1.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@jest/environment/package.json b/node_modules/@jest/environment/package.json index 47ec693a7..0bbab6c14 100644 --- a/node_modules/@jest/environment/package.json +++ b/node_modules/@jest/environment/package.json @@ -1,15 +1,15 @@ { "_args": [ [ - "@jest/environment@25.4.0", - "/home/runner/work/readable-readme/readable-readme" + "@jest/environment@25.5.0", + "/workspace/readable-readme" ] ], "_development": true, - "_from": "@jest/environment@25.4.0", - "_id": "@jest/environment@25.4.0", + "_from": "@jest/environment@25.5.0", + "_id": "@jest/environment@25.5.0", "_inBundle": false, - "_integrity": "sha512-KDctiak4mu7b4J6BIoN/+LUL3pscBzoUCP+EtSPd2tK9fqyDY5OF+CmkBywkFWezS9tyH5ACOQNtpjtueEDH6Q==", + "_integrity": "sha512-U2VXPEqL07E/V7pSZMSQCvV5Ea4lqOlT+0ZFijl/i316cRMHvZ4qC+jBdryd+lmRetjQo0YIQr6cVPNxxK87mA==", "_location": "/@jest/environment", "_phantomChildren": { "@types/color-name": "1.1.1", @@ -20,32 +20,35 @@ "_requested": { "type": "version", "registry": true, - "raw": "@jest/environment@25.4.0", + "raw": "@jest/environment@25.5.0", "name": "@jest/environment", "escapedName": "@jest%2fenvironment", "scope": "@jest", - "rawSpec": "25.4.0", + "rawSpec": "25.5.0", "saveSpec": null, - "fetchSpec": "25.4.0" + "fetchSpec": "25.5.0" }, "_requiredBy": [ - "/jest-circus", + "/@jest/core/jest-jasmine2", + "/@jest/core/jest-runner", + "/@jest/core/jest-runtime", + "/@jest/globals", "/jest-environment-jsdom", "/jest-environment-node", - "/jest-jasmine2", - "/jest-runner", - "/jest-runtime" + "/jest/jest-jasmine2", + "/jest/jest-runner", + "/jest/jest-runtime" ], - "_resolved": "https://registry.npmjs.org/@jest/environment/-/environment-25.4.0.tgz", - "_spec": "25.4.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_resolved": "https://registry.npmjs.org/@jest/environment/-/environment-25.5.0.tgz", + "_spec": "25.5.0", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/facebook/jest/issues" }, "dependencies": { - "@jest/fake-timers": "^25.4.0", - "@jest/types": "^25.4.0", - "jest-mock": "^25.4.0" + "@jest/fake-timers": "^25.5.0", + "@jest/types": "^25.5.0", + "jest-mock": "^25.5.0" }, "devDependencies": { "@types/node": "*" @@ -53,7 +56,7 @@ "engines": { "node": ">= 8.3" }, - "gitHead": "5b129d714cadb818be28afbe313cbeae8fbb1dde", + "gitHead": "ddd73d18adfb982b9b0d94bad7d41c9f78567ca7", "homepage": "https://github.com/facebook/jest#readme", "license": "MIT", "main": "build/index.js", @@ -74,5 +77,5 @@ ] } }, - "version": "25.4.0" + "version": "25.5.0" } diff --git a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Transform.d.ts b/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Transform.d.ts index ea3e511cb..af8063f7d 100644 --- a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Transform.d.ts +++ b/node_modules/@jest/fake-timers/node_modules/@jest/types/build/Transform.d.ts @@ -7,6 +7,6 @@ export declare type TransformResult = { code: string; originalCode: string; - mapCoverage: boolean; + mapCoverage?: boolean; sourceMapPath: string | null; }; diff --git a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/ts3.4/Transform.d.ts b/node_modules/@jest/fake-timers/node_modules/@jest/types/build/ts3.4/Transform.d.ts index bcc63baf1..231ae24ca 100644 --- a/node_modules/@jest/fake-timers/node_modules/@jest/types/build/ts3.4/Transform.d.ts +++ b/node_modules/@jest/fake-timers/node_modules/@jest/types/build/ts3.4/Transform.d.ts @@ -7,6 +7,6 @@ export declare type TransformResult = { code: string; originalCode: string; - mapCoverage: boolean; + mapCoverage?: boolean; sourceMapPath: string | null; }; diff --git a/node_modules/@jest/fake-timers/node_modules/@jest/types/package.json b/node_modules/@jest/fake-timers/node_modules/@jest/types/package.json index ce8726495..42efee46a 100644 --- a/node_modules/@jest/fake-timers/node_modules/@jest/types/package.json +++ b/node_modules/@jest/fake-timers/node_modules/@jest/types/package.json @@ -1,34 +1,34 @@ { "_args": [ [ - "@jest/types@25.4.0", - "/home/runner/work/readable-readme/readable-readme" + "@jest/types@25.5.0", + "/workspace/readable-readme" ] ], "_development": true, - "_from": "@jest/types@25.4.0", - "_id": "@jest/types@25.4.0", + "_from": "@jest/types@25.5.0", + "_id": "@jest/types@25.5.0", "_inBundle": false, - "_integrity": "sha512-XBeaWNzw2PPnGW5aXvZt3+VO60M+34RY3XDsCK5tW7kyj3RK0XClRutCfjqcBuaR2aBQTbluEDME9b5MB9UAPw==", + "_integrity": "sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==", "_location": "/@jest/fake-timers/@jest/types", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "@jest/types@25.4.0", + "raw": "@jest/types@25.5.0", "name": "@jest/types", "escapedName": "@jest%2ftypes", "scope": "@jest", - "rawSpec": "25.4.0", + "rawSpec": "25.5.0", "saveSpec": null, - "fetchSpec": "25.4.0" + "fetchSpec": "25.5.0" }, "_requiredBy": [ "/@jest/fake-timers" ], - "_resolved": "https://registry.npmjs.org/@jest/types/-/types-25.4.0.tgz", - "_spec": "25.4.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_resolved": "https://registry.npmjs.org/@jest/types/-/types-25.5.0.tgz", + "_spec": "25.5.0", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/facebook/jest/issues" }, @@ -44,7 +44,7 @@ "engines": { "node": ">= 8.3" }, - "gitHead": "5b129d714cadb818be28afbe313cbeae8fbb1dde", + "gitHead": "ddd73d18adfb982b9b0d94bad7d41c9f78567ca7", "homepage": "https://github.com/facebook/jest#readme", "license": "MIT", "main": "build/index.js", @@ -65,5 +65,5 @@ ] } }, - "version": "25.4.0" + "version": "25.5.0" } diff --git a/node_modules/@jest/fake-timers/node_modules/ansi-styles/package.json b/node_modules/@jest/fake-timers/node_modules/ansi-styles/package.json index 3a3957898..d623fc92a 100644 --- a/node_modules/@jest/fake-timers/node_modules/ansi-styles/package.json +++ b/node_modules/@jest/fake-timers/node_modules/ansi-styles/package.json @@ -2,7 +2,7 @@ "_args": [ [ "ansi-styles@4.2.1", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "_spec": "4.2.1", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@jest/fake-timers/node_modules/chalk/package.json b/node_modules/@jest/fake-timers/node_modules/chalk/package.json index 737dca387..23516320a 100644 --- a/node_modules/@jest/fake-timers/node_modules/chalk/package.json +++ b/node_modules/@jest/fake-timers/node_modules/chalk/package.json @@ -2,7 +2,7 @@ "_args": [ [ "chalk@3.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", "_spec": "3.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/chalk/chalk/issues" }, diff --git a/node_modules/@jest/fake-timers/node_modules/color-convert/package.json b/node_modules/@jest/fake-timers/node_modules/color-convert/package.json index 9d65e500b..b65faf46a 100644 --- a/node_modules/@jest/fake-timers/node_modules/color-convert/package.json +++ b/node_modules/@jest/fake-timers/node_modules/color-convert/package.json @@ -2,7 +2,7 @@ "_args": [ [ "color-convert@2.0.1", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "_spec": "2.0.1", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Heather Arthur", "email": "fayearthur@gmail.com" diff --git a/node_modules/@jest/fake-timers/node_modules/color-name/package.json b/node_modules/@jest/fake-timers/node_modules/color-name/package.json index 2d215bdde..35bd93c64 100644 --- a/node_modules/@jest/fake-timers/node_modules/color-name/package.json +++ b/node_modules/@jest/fake-timers/node_modules/color-name/package.json @@ -2,7 +2,7 @@ "_args": [ [ "color-name@1.1.4", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "_spec": "1.1.4", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "DY", "email": "dfcreative@gmail.com" diff --git a/node_modules/@jest/fake-timers/node_modules/has-flag/package.json b/node_modules/@jest/fake-timers/node_modules/has-flag/package.json index f8c5fb092..db03e017e 100644 --- a/node_modules/@jest/fake-timers/node_modules/has-flag/package.json +++ b/node_modules/@jest/fake-timers/node_modules/has-flag/package.json @@ -2,7 +2,7 @@ "_args": [ [ "has-flag@4.0.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "_spec": "4.0.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@jest/fake-timers/node_modules/supports-color/package.json b/node_modules/@jest/fake-timers/node_modules/supports-color/package.json index bb82644e0..05b1ea99a 100644 --- a/node_modules/@jest/fake-timers/node_modules/supports-color/package.json +++ b/node_modules/@jest/fake-timers/node_modules/supports-color/package.json @@ -2,7 +2,7 @@ "_args": [ [ "supports-color@7.1.0", - "/Users/tianhaozhou/Desktop/proj/readable-readme" + "/workspace/readable-readme" ] ], "_development": true, @@ -27,7 +27,7 @@ ], "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", "_spec": "7.1.0", - "_where": "/Users/tianhaozhou/Desktop/proj/readable-readme", + "_where": "/workspace/readable-readme", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/node_modules/@jest/fake-timers/package.json b/node_modules/@jest/fake-timers/package.json index 14f643e3a..c63e22941 100644 --- a/node_modules/@jest/fake-timers/package.json +++ b/node_modules/@jest/fake-timers/package.json @@ -1,15 +1,15 @@ { "_args": [ [ - "@jest/fake-timers@25.4.0", - "/home/runner/work/readable-readme/readable-readme" + "@jest/fake-timers@25.5.0", + "/workspace/readable-readme" ] ], "_development": true, - "_from": "@jest/fake-timers@25.4.0", - "_id": "@jest/fake-timers@25.4.0", + "_from": "@jest/fake-timers@25.5.0", + "_id": "@jest/fake-timers@25.5.0", "_inBundle": false, - "_integrity": "sha512-lI9z+VOmVX4dPPFzyj0vm+UtaB8dCJJ852lcDnY0uCPRvZAaVGnMwBBc1wxtf+h7Vz6KszoOvKAt4QijDnHDkg==", + "_integrity": "sha512-9y2+uGnESw/oyOI3eww9yaxdZyHq7XvprfP/eeoCsjqKYts2yRlsHS/SgjPDV8FyMfn2nbMy8YzUk6nyvdLOpQ==", "_location": "/@jest/fake-timers", "_phantomChildren": { "@types/color-name": "1.1.1", @@ -20,30 +20,30 @@ "_requested": { "type": "version", "registry": true, - "raw": "@jest/fake-timers@25.4.0", + "raw": "@jest/fake-timers@25.5.0", "name": "@jest/fake-timers", "escapedName": "@jest%2ffake-timers", "scope": "@jest", - "rawSpec": "25.4.0", + "rawSpec": "25.5.0", "saveSpec": null, - "fetchSpec": "25.4.0" + "fetchSpec": "25.5.0" }, "_requiredBy": [ "/@jest/environment", "/jest-environment-jsdom", "/jest-environment-node" ], - "_resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-25.4.0.tgz", - "_spec": "25.4.0", - "_where": "/home/runner/work/readable-readme/readable-readme", + "_resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-25.5.0.tgz", + "_spec": "25.5.0", + "_where": "/workspace/readable-readme", "bugs": { "url": "https://github.com/facebook/jest/issues" }, "dependencies": { - "@jest/types": "^25.4.0", - "jest-message-util": "^25.4.0", - "jest-mock": "^25.4.0", - "jest-util": "^25.4.0", + "@jest/types": "^25.5.0", + "jest-message-util": "^25.5.0", + "jest-mock": "^25.5.0", + "jest-util": "^25.5.0", "lolex": "^5.0.0" }, "devDependencies": { @@ -53,7 +53,7 @@ "engines": { "node": ">= 8.3" }, - "gitHead": "5b129d714cadb818be28afbe313cbeae8fbb1dde", + "gitHead": "ddd73d18adfb982b9b0d94bad7d41c9f78567ca7", "homepage": "https://github.com/facebook/jest#readme", "license": "MIT", "main": "build/index.js", @@ -74,5 +74,5 @@ ] } }, - "version": "25.4.0" + "version": "25.5.0" } diff --git a/node_modules/@jest/globals/LICENSE b/node_modules/@jest/globals/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/@jest/globals/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@jest/globals/build/index.d.ts b/node_modules/@jest/globals/build/index.d.ts new file mode 100644 index 000000000..06ec26a0a --- /dev/null +++ b/node_modules/@jest/globals/build/index.d.ts @@ -0,0 +1,23 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import importedExpect = require('expect'); +import type { Jest } from '@jest/environment'; +import type { Global } from '@jest/types'; +export declare const jest: Jest; +export declare const expect: typeof importedExpect; +export declare const it: Global.GlobalAdditions['it']; +export declare const test: Global.GlobalAdditions['test']; +export declare const fit: Global.GlobalAdditions['fit']; +export declare const xit: Global.GlobalAdditions['xit']; +export declare const xtest: Global.GlobalAdditions['xtest']; +export declare const describe: Global.GlobalAdditions['describe']; +export declare const xdescribe: Global.GlobalAdditions['xdescribe']; +export declare const fdescribe: Global.GlobalAdditions['fdescribe']; +export declare const beforeAll: Global.GlobalAdditions['beforeAll']; +export declare const beforeEach: Global.GlobalAdditions['beforeEach']; +export declare const afterEach: Global.GlobalAdditions['afterEach']; +export declare const afterAll: Global.GlobalAdditions['afterAll']; diff --git a/node_modules/@jest/globals/build/index.js b/node_modules/@jest/globals/build/index.js new file mode 100644 index 000000000..06f90c10c --- /dev/null +++ b/node_modules/@jest/globals/build/index.js @@ -0,0 +1,25 @@ +'use strict'; + +function _expect() { + const data = _interopRequireDefault(require('expect')); + + _expect = function () { + return data; + }; + + return data; +} + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +throw new Error( + 'Do not import `@jest/globals` outside of the Jest test environment' +); diff --git a/node_modules/@jest/globals/build/ts3.4/index.d.ts b/node_modules/@jest/globals/build/ts3.4/index.d.ts new file mode 100644 index 000000000..e0c9479ce --- /dev/null +++ b/node_modules/@jest/globals/build/ts3.4/index.d.ts @@ -0,0 +1,23 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import importedExpect = require('expect'); +import { Jest } from '@jest/environment'; +import { Global } from '@jest/types'; +export declare const jest: Jest; +export declare const expect: typeof importedExpect; +export declare const it: Global.GlobalAdditions['it']; +export declare const test: Global.GlobalAdditions['test']; +export declare const fit: Global.GlobalAdditions['fit']; +export declare const xit: Global.GlobalAdditions['xit']; +export declare const xtest: Global.GlobalAdditions['xtest']; +export declare const describe: Global.GlobalAdditions['describe']; +export declare const xdescribe: Global.GlobalAdditions['xdescribe']; +export declare const fdescribe: Global.GlobalAdditions['fdescribe']; +export declare const beforeAll: Global.GlobalAdditions['beforeAll']; +export declare const beforeEach: Global.GlobalAdditions['beforeEach']; +export declare const afterEach: Global.GlobalAdditions['afterEach']; +export declare const afterAll: Global.GlobalAdditions['afterAll']; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/LICENSE b/node_modules/@jest/globals/node_modules/@jest/types/LICENSE new file mode 100644 index 000000000..b96dcb048 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/Circus.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/Circus.d.ts new file mode 100644 index 000000000..4a6ad8926 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/Circus.d.ts @@ -0,0 +1,176 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/// +import type * as Global from './Global'; +declare type Process = NodeJS.Process; +export declare type DoneFn = Global.DoneFn; +export declare type BlockFn = Global.BlockFn; +export declare type BlockName = Global.BlockName; +export declare type BlockMode = void | 'skip' | 'only' | 'todo'; +export declare type TestMode = BlockMode; +export declare type TestName = Global.TestName; +export declare type TestFn = Global.TestFn; +export declare type HookFn = Global.HookFn; +export declare type AsyncFn = TestFn | HookFn; +export declare type SharedHookType = 'afterAll' | 'beforeAll'; +export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; +export declare type TestContext = Record; +export declare type Exception = any; +export declare type FormattedError = string; +export declare type Hook = { + asyncError: Error; + fn: HookFn; + type: HookType; + parent: DescribeBlock; + timeout: number | undefined | null; +}; +export interface EventHandler { + (event: AsyncEvent, state: State): void | Promise; + (event: SyncEvent, state: State): void; +} +export declare type Event = SyncEvent | AsyncEvent; +export declare type SyncEvent = { + asyncError: Error; + mode: BlockMode; + name: 'start_describe_definition'; + blockName: BlockName; +} | { + mode: BlockMode; + name: 'finish_describe_definition'; + blockName: BlockName; +} | { + asyncError: Error; + name: 'add_hook'; + hookType: HookType; + fn: HookFn; + timeout: number | undefined; +} | { + asyncError: Error; + name: 'add_test'; + testName: TestName; + fn?: TestFn; + mode?: TestMode; + timeout: number | undefined; +} | { + name: 'error'; + error: Exception; +}; +export declare type AsyncEvent = { + name: 'setup'; + testNamePattern?: string; + parentProcess: Process; +} | { + name: 'include_test_location_in_result'; +} | { + name: 'hook_start'; + hook: Hook; +} | { + name: 'hook_success'; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; +} | { + name: 'hook_failure'; + error: string | Exception; + describeBlock?: DescribeBlock; + test?: TestEntry; + hook: Hook; +} | { + name: 'test_fn_start'; + test: TestEntry; +} | { + name: 'test_fn_success'; + test: TestEntry; +} | { + name: 'test_fn_failure'; + error: Exception; + test: TestEntry; +} | { + name: 'test_retry'; + test: TestEntry; +} | { + name: 'test_start'; + test: TestEntry; +} | { + name: 'test_skip'; + test: TestEntry; +} | { + name: 'test_todo'; + test: TestEntry; +} | { + name: 'test_done'; + test: TestEntry; +} | { + name: 'run_describe_start'; + describeBlock: DescribeBlock; +} | { + name: 'run_describe_finish'; + describeBlock: DescribeBlock; +} | { + name: 'run_start'; +} | { + name: 'run_finish'; +} | { + name: 'teardown'; +}; +export declare type TestStatus = 'skip' | 'done' | 'todo'; +export declare type TestResult = { + duration?: number | null; + errors: Array; + invocations: number; + status: TestStatus; + location?: { + column: number; + line: number; + } | null; + testPath: Array; +}; +export declare type RunResult = { + unhandledErrors: Array; + testResults: TestResults; +}; +export declare type TestResults = Array; +export declare type GlobalErrorHandlers = { + uncaughtException: Array<(exception: Exception) => void>; + unhandledRejection: Array<(exception: Exception, promise: Promise) => void>; +}; +export declare type State = { + currentDescribeBlock: DescribeBlock; + currentlyRunningTest?: TestEntry | null; + expand?: boolean; + hasFocusedTests: boolean; + originalGlobalErrorHandlers?: GlobalErrorHandlers; + parentProcess: Process | null; + rootDescribeBlock: DescribeBlock; + testNamePattern?: RegExp | null; + testTimeout: number; + unhandledErrors: Array; + includeTestLocationInResult: boolean; +}; +export declare type DescribeBlock = { + children: Array; + hooks: Array; + mode: BlockMode; + name: BlockName; + parent?: DescribeBlock; + tests: Array; +}; +export declare type TestError = Exception | Array<[Exception | undefined, Exception]>; +export declare type TestEntry = { + asyncError: Exception; + errors: TestError; + fn?: TestFn; + invocations: number; + mode: TestMode; + name: TestName; + parent: DescribeBlock; + startedAt?: number | null; + duration?: number | null; + status?: TestStatus | null; + timeout?: number; +}; +export {}; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/Circus.js b/node_modules/@jest/globals/node_modules/@jest/types/build/Circus.js new file mode 100644 index 000000000..ad9a93a7c --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/Circus.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/Config.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/Config.d.ts new file mode 100644 index 000000000..f9f49a4d4 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/Config.d.ts @@ -0,0 +1,419 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/// +import type { Arguments } from 'yargs'; +import type { ReportOptions } from 'istanbul-reports'; +import chalk = require('chalk'); +declare type CoverageProvider = 'babel' | 'v8'; +export declare type Path = string; +export declare type Glob = string; +export declare type HasteConfig = { + computeSha1?: boolean; + defaultPlatform?: string | null; + hasteImplModulePath?: string; + platforms?: Array; + providesModuleNodeModules: Array; + throwOnModuleCollision?: boolean; +}; +export declare type ReporterConfig = [string, Record]; +export declare type TransformerConfig = [string, Record]; +export interface ConfigGlobals { + [K: string]: unknown; +} +export declare type DefaultOptions = { + automock: boolean; + bail: number; + browser: boolean; + cache: boolean; + cacheDirectory: Path; + changedFilesWithAncestor: boolean; + clearMocks: boolean; + collectCoverage: boolean; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageProvider: CoverageProvider; + errorOnDeprecated: boolean; + expand: boolean; + forceCoverageMatch: Array; + globals: ConfigGlobals; + haste: HasteConfig; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: Record>; + modulePathIgnorePatterns: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: NotifyMode; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + restoreMocks: boolean; + roots: Array; + runTestsByPath: boolean; + runner: 'jest-runner'; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + testSequencer: string; + testURL: string; + timers: 'real' | 'fake'; + transformIgnorePatterns: Array; + useStderr: boolean; + watch: boolean; + watchPathIgnorePatterns: Array; + watchman: boolean; +}; +export declare type DisplayName = string | { + name: string; + color: typeof chalk.Color; +}; +export declare type InitialOptionsWithRootDir = InitialOptions & Required>; +export declare type InitialOptions = Partial<{ + automock: boolean; + bail: boolean | number; + browser: boolean; + cache: boolean; + cacheDirectory: Path; + clearMocks: boolean; + changedFilesWithAncestor: boolean; + changedSince: string; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageProvider: CoverageProvider; + coverageReporters: Array; + coverageThreshold: { + global: { + [key: string]: number; + }; + }; + dependencyExtractor: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName: DisplayName; + expand: boolean; + extraGlobals: Array; + filter: Path; + findRelatedTests: boolean; + forceCoverageMatch: Array; + forceExit: boolean; + json: boolean; + globals: ConfigGlobals; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: HasteConfig; + reporters: Array; + logHeapUsage: boolean; + lastCommit: boolean; + listTests: boolean; + mapCoverage: boolean; + maxConcurrency: number; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleLoader: Path; + moduleNameMapper: { + [key: string]: string | Array; + }; + modulePathIgnorePatterns: Array; + modulePaths: Array; + name: string; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + outputFile: Path; + passWithNoTests: boolean; + preprocessorIgnorePatterns: Array; + preset: string | null | undefined; + prettierPath: string | null | undefined; + projects: Array; + replname: string | null | undefined; + resetMocks: boolean; + resetModules: boolean; + resolver: Path | null | undefined; + restoreMocks: boolean; + rootDir: Path; + roots: Array; + runner: string; + runTestsByPath: boolean; + scriptPreprocessor: string; + setupFiles: Array; + setupTestFrameworkScriptFile: Path; + setupFilesAfterEnv: Array; + silent: boolean; + skipFilter: boolean; + skipNodeResolution: boolean; + snapshotResolver: Path; + snapshotSerializers: Array; + errorOnDeprecated: boolean; + testEnvironment: string; + testEnvironmentOptions: Record; + testFailureExitCode: string | number; + testLocationInResults: boolean; + testMatch: Array; + testNamePattern: string; + testPathDirs: Array; + testPathIgnorePatterns: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testURL: string; + testTimeout: number; + timers: 'real' | 'fake'; + transform: { + [regex: string]: Path | TransformerConfig; + }; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns: Array; + updateSnapshot: boolean; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins: Array]>; +}>; +export declare type SnapshotUpdateState = 'all' | 'new' | 'none'; +declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change'; +export declare type CoverageThresholdValue = { + branches?: number; + functions?: number; + lines?: number; + statements?: number; +}; +declare type CoverageThreshold = { + [path: string]: CoverageThresholdValue; + global: CoverageThresholdValue; +}; +export declare type GlobalConfig = { + bail: number; + changedSince?: string; + changedFilesWithAncestor: boolean; + collectCoverage: boolean; + collectCoverageFrom: Array; + collectCoverageOnlyFrom?: { + [key: string]: boolean; + }; + coverageDirectory: string; + coveragePathIgnorePatterns?: Array; + coverageProvider: CoverageProvider; + coverageReporters: Array; + coverageThreshold?: CoverageThreshold; + detectLeaks: boolean; + detectOpenHandles: boolean; + enabledTestsMap?: { + [key: string]: { + [key: string]: boolean; + }; + }; + expand: boolean; + filter?: Path; + findRelatedTests: boolean; + forceExit: boolean; + json: boolean; + globalSetup?: string; + globalTeardown?: string; + lastCommit: boolean; + logHeapUsage: boolean; + listTests: boolean; + maxConcurrency: number; + maxWorkers: number; + noStackTrace: boolean; + nonFlagArgs: Array; + noSCM?: boolean; + notify: boolean; + notifyMode: NotifyMode; + outputFile?: Path; + onlyChanged: boolean; + onlyFailures: boolean; + passWithNoTests: boolean; + projects: Array; + replname?: string; + reporters?: Array; + runTestsByPath: boolean; + rootDir: Path; + silent?: boolean; + skipFilter: boolean; + errorOnDeprecated: boolean; + testFailureExitCode: number; + testNamePattern?: string; + testPathPattern: string; + testResultsProcessor?: string; + testSequencer: string; + testTimeout?: number; + updateSnapshot: SnapshotUpdateState; + useStderr: boolean; + verbose?: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPlugins?: Array<{ + path: string; + config: Record; + }> | null; +}; +export declare type ProjectConfig = { + automock: boolean; + browser: boolean; + cache: boolean; + cacheDirectory: Path; + clearMocks: boolean; + coveragePathIgnorePatterns: Array; + cwd: Path; + dependencyExtractor?: string; + detectLeaks: boolean; + detectOpenHandles: boolean; + displayName?: DisplayName; + errorOnDeprecated: boolean; + extraGlobals: Array; + filter?: Path; + forceCoverageMatch: Array; + globalSetup?: string; + globalTeardown?: string; + globals: ConfigGlobals; + haste: HasteConfig; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleLoader?: Path; + moduleNameMapper: Array<[string, string]>; + modulePathIgnorePatterns: Array; + modulePaths?: Array; + name: string; + prettierPath: string; + resetMocks: boolean; + resetModules: boolean; + resolver?: Path; + restoreMocks: boolean; + rootDir: Path; + roots: Array; + runner: string; + setupFiles: Array; + setupFilesAfterEnv: Array; + skipFilter: boolean; + skipNodeResolution?: boolean; + snapshotResolver?: Path; + snapshotSerializers: Array; + testEnvironment: string; + testEnvironmentOptions: Record; + testMatch: Array; + testLocationInResults: boolean; + testPathIgnorePatterns: Array; + testRegex: Array; + testRunner: string; + testURL: string; + timers: 'real' | 'fake'; + transform: Array<[string, Path, Record]>; + transformIgnorePatterns: Array; + watchPathIgnorePatterns: Array; + unmockedModulePathPatterns?: Array; +}; +export declare type Argv = Arguments; + color: boolean; + colors: boolean; + config: string; + coverage: boolean; + coverageDirectory: string; + coveragePathIgnorePatterns: Array; + coverageReporters: Array; + coverageThreshold: string; + debug: boolean; + env: string; + expand: boolean; + findRelatedTests: boolean; + forceExit: boolean; + globals: string; + globalSetup: string | null | undefined; + globalTeardown: string | null | undefined; + haste: string; + init: boolean; + json: boolean; + lastCommit: boolean; + logHeapUsage: boolean; + maxWorkers: number | string; + moduleDirectories: Array; + moduleFileExtensions: Array; + moduleNameMapper: string; + modulePathIgnorePatterns: Array; + modulePaths: Array; + noStackTrace: boolean; + notify: boolean; + notifyMode: string; + onlyChanged: boolean; + outputFile: string; + preset: string | null | undefined; + projects: Array; + prettierPath: string | null | undefined; + resetMocks: boolean; + resetModules: boolean; + resolver: string | null | undefined; + restoreMocks: boolean; + rootDir: string; + roots: Array; + runInBand: boolean; + setupFiles: Array; + setupFilesAfterEnv: Array; + showConfig: boolean; + silent: boolean; + snapshotSerializers: Array; + testEnvironment: string; + testFailureExitCode: string | null | undefined; + testMatch: Array; + testNamePattern: string; + testPathIgnorePatterns: Array; + testPathPattern: Array; + testRegex: string | Array; + testResultsProcessor: string; + testRunner: string; + testSequencer: string; + testURL: string; + testTimeout: number | null | undefined; + timers: string; + transform: string; + transformIgnorePatterns: Array; + unmockedModulePathPatterns: Array | null | undefined; + updateSnapshot: boolean; + useStderr: boolean; + verbose: boolean; + version: boolean; + watch: boolean; + watchAll: boolean; + watchman: boolean; + watchPathIgnorePatterns: Array; +}>>; +export {}; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/Config.js b/node_modules/@jest/globals/node_modules/@jest/types/build/Config.js new file mode 100644 index 000000000..c6c531133 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/Config.js @@ -0,0 +1,15 @@ +'use strict'; + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/Global.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/Global.d.ts new file mode 100644 index 000000000..37676d5e2 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/Global.d.ts @@ -0,0 +1,83 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/// +import type { CoverageMapData } from 'istanbul-lib-coverage'; +export declare type DoneFn = (reason?: string | Error) => void; +export declare type TestName = string; +export declare type TestFn = (done?: DoneFn) => Promise | void | undefined; +export declare type BlockFn = () => void; +export declare type BlockName = string; +export declare type HookFn = TestFn; +export declare type Col = unknown; +export declare type Row = Array; +export declare type Table = Array; +export declare type ArrayTable = Table | Row; +export declare type TemplateTable = TemplateStringsArray; +export declare type TemplateData = Array; +export declare type EachTable = ArrayTable | TemplateTable; +export declare type EachTestFn = (...args: Array) => Promise | void | undefined; +declare type Jasmine = { + _DEFAULT_TIMEOUT_INTERVAL?: number; + addMatchers: Function; +}; +declare type Each = (table: EachTable, ...taggedTemplateData: Array) => (title: string, test: EachTestFn, timeout?: number) => void; +export interface ItBase { + (testName: TestName, fn: TestFn, timeout?: number): void; + each: Each; +} +export interface It extends ItBase { + only: ItBase; + skip: ItBase; + todo: (testName: TestName, ...rest: Array) => void; +} +export interface ItConcurrentBase { + (testName: string, testFn: () => Promise, timeout?: number): void; +} +export interface ItConcurrentExtended extends ItConcurrentBase { + only: ItConcurrentBase; + skip: ItConcurrentBase; +} +export interface ItConcurrent extends It { + concurrent: ItConcurrentExtended; +} +export interface DescribeBase { + (blockName: BlockName, blockFn: BlockFn): void; + each: Each; +} +export interface Describe extends DescribeBase { + only: DescribeBase; + skip: DescribeBase; +} +export interface TestFrameworkGlobals { + it: ItConcurrent; + test: ItConcurrent; + fit: ItBase & { + concurrent?: ItConcurrentBase; + }; + xit: ItBase; + xtest: ItBase; + describe: Describe; + xdescribe: DescribeBase; + fdescribe: DescribeBase; + beforeAll: HookFn; + beforeEach: HookFn; + afterEach: HookFn; + afterAll: HookFn; +} +export interface GlobalAdditions extends TestFrameworkGlobals { + __coverage__: CoverageMapData; + jasmine: Jasmine; + fail: () => void; + pending: () => void; + spyOn: () => void; + spyOnProperty: () => void; +} +declare type NodeGlobalWithoutAdditions = Omit; +export interface Global extends GlobalAdditions, NodeGlobalWithoutAdditions { + [extras: string]: any; +} +export {}; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/Global.js b/node_modules/@jest/globals/node_modules/@jest/types/build/Global.js new file mode 100644 index 000000000..ad9a93a7c --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/Global.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/TestResult.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/TestResult.d.ts new file mode 100644 index 000000000..560216c9e --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/TestResult.d.ts @@ -0,0 +1,30 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare type Milliseconds = number; +declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled'; +declare type Callsite = { + column: number; + line: number; +}; +export declare type AssertionResult = { + ancestorTitles: Array; + duration?: Milliseconds | null; + failureMessages: Array; + fullName: string; + invocations?: number; + location?: Callsite | null; + numPassingAsserts: number; + status: Status; + title: string; +}; +export declare type SerializableError = { + code?: unknown; + message: string; + stack: string | null | undefined; + type?: string; +}; +export {}; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/TestResult.js b/node_modules/@jest/globals/node_modules/@jest/types/build/TestResult.js new file mode 100644 index 000000000..ad9a93a7c --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/TestResult.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/Transform.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/Transform.d.ts new file mode 100644 index 000000000..af8063f7d --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/Transform.d.ts @@ -0,0 +1,12 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare type TransformResult = { + code: string; + originalCode: string; + mapCoverage?: boolean; + sourceMapPath: string | null; +}; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/Transform.js b/node_modules/@jest/globals/node_modules/@jest/types/build/Transform.js new file mode 100644 index 000000000..ad9a93a7c --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/Transform.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/index.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/index.d.ts new file mode 100644 index 000000000..be82158e4 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/index.d.ts @@ -0,0 +1,12 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type * as Circus from './Circus'; +import type * as Config from './Config'; +import type * as Global from './Global'; +import type * as TestResult from './TestResult'; +import type * as TransformTypes from './Transform'; +export type { Circus, Config, Global, TestResult, TransformTypes }; diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/index.js b/node_modules/@jest/globals/node_modules/@jest/types/build/index.js new file mode 100644 index 000000000..ad9a93a7c --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/index.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/jest-circus/node_modules/@jest/types/build/ts3.4/Circus.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/ts3.4/Circus.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/@jest/types/build/ts3.4/Circus.d.ts rename to node_modules/@jest/globals/node_modules/@jest/types/build/ts3.4/Circus.d.ts diff --git a/node_modules/jest-circus/node_modules/@jest/types/build/ts3.4/Config.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/ts3.4/Config.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/@jest/types/build/ts3.4/Config.d.ts rename to node_modules/@jest/globals/node_modules/@jest/types/build/ts3.4/Config.d.ts diff --git a/node_modules/jest-circus/node_modules/@jest/types/build/ts3.4/Global.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/ts3.4/Global.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/@jest/types/build/ts3.4/Global.d.ts rename to node_modules/@jest/globals/node_modules/@jest/types/build/ts3.4/Global.d.ts diff --git a/node_modules/jest-circus/node_modules/@jest/types/build/ts3.4/TestResult.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/ts3.4/TestResult.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/@jest/types/build/ts3.4/TestResult.d.ts rename to node_modules/@jest/globals/node_modules/@jest/types/build/ts3.4/TestResult.d.ts diff --git a/node_modules/@jest/globals/node_modules/@jest/types/build/ts3.4/Transform.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/ts3.4/Transform.d.ts new file mode 100644 index 000000000..231ae24ca --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/build/ts3.4/Transform.d.ts @@ -0,0 +1,12 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare type TransformResult = { + code: string; + originalCode: string; + mapCoverage?: boolean; + sourceMapPath: string | null; +}; diff --git a/node_modules/jest-circus/node_modules/@jest/types/build/ts3.4/index.d.ts b/node_modules/@jest/globals/node_modules/@jest/types/build/ts3.4/index.d.ts similarity index 100% rename from node_modules/jest-circus/node_modules/@jest/types/build/ts3.4/index.d.ts rename to node_modules/@jest/globals/node_modules/@jest/types/build/ts3.4/index.d.ts diff --git a/node_modules/@jest/globals/node_modules/@jest/types/package.json b/node_modules/@jest/globals/node_modules/@jest/types/package.json new file mode 100644 index 000000000..1d35fe766 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/@jest/types/package.json @@ -0,0 +1,69 @@ +{ + "_args": [ + [ + "@jest/types@25.5.0", + "/workspace/readable-readme" + ] + ], + "_development": true, + "_from": "@jest/types@25.5.0", + "_id": "@jest/types@25.5.0", + "_inBundle": false, + "_integrity": "sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==", + "_location": "/@jest/globals/@jest/types", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@jest/types@25.5.0", + "name": "@jest/types", + "escapedName": "@jest%2ftypes", + "scope": "@jest", + "rawSpec": "25.5.0", + "saveSpec": null, + "fetchSpec": "25.5.0" + }, + "_requiredBy": [ + "/@jest/globals" + ], + "_resolved": "https://registry.npmjs.org/@jest/types/-/types-25.5.0.tgz", + "_spec": "25.5.0", + "_where": "/workspace/readable-readme", + "bugs": { + "url": "https://github.com/facebook/jest/issues" + }, + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + }, + "devDependencies": { + "@types/node": "*" + }, + "engines": { + "node": ">= 8.3" + }, + "gitHead": "ddd73d18adfb982b9b0d94bad7d41c9f78567ca7", + "homepage": "https://github.com/facebook/jest#readme", + "license": "MIT", + "main": "build/index.js", + "name": "@jest/types", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/facebook/jest.git", + "directory": "packages/jest-types" + }, + "types": "build/index.d.ts", + "typesVersions": { + "<3.8": { + "build/*": [ + "build/ts3.4/*" + ] + } + }, + "version": "25.5.0" +} diff --git a/node_modules/@jest/globals/node_modules/ansi-styles/index.d.ts b/node_modules/@jest/globals/node_modules/ansi-styles/index.d.ts new file mode 100644 index 000000000..7e9b2b71b --- /dev/null +++ b/node_modules/@jest/globals/node_modules/ansi-styles/index.d.ts @@ -0,0 +1,197 @@ +import * as cssColors from 'color-name'; + +declare namespace ansiStyles { + interface ColorConvert { + /** + The RGB color space. + + @param red - (`0`-`255`) + @param green - (`0`-`255`) + @param blue - (`0`-`255`) + */ + rgb(red: number, green: number, blue: number): string; + + /** + The RGB HEX color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hex(hex: string): string; + + /** + @param keyword - A CSS color name. + */ + keyword(keyword: keyof typeof cssColors): string; + + /** + The HSL color space. + + @param hue - (`0`-`360`) + @param saturation - (`0`-`100`) + @param lightness - (`0`-`100`) + */ + hsl(hue: number, saturation: number, lightness: number): string; + + /** + The HSV color space. + + @param hue - (`0`-`360`) + @param saturation - (`0`-`100`) + @param value - (`0`-`100`) + */ + hsv(hue: number, saturation: number, value: number): string; + + /** + The HSV color space. + + @param hue - (`0`-`360`) + @param whiteness - (`0`-`100`) + @param blackness - (`0`-`100`) + */ + hwb(hue: number, whiteness: number, blackness: number): string; + + /** + Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color. + */ + ansi(ansi: number): string; + + /** + Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color. + */ + ansi256(ansi: number): string; + } + + interface CSPair { + /** + The ANSI terminal control sequence for starting this style. + */ + readonly open: string; + + /** + The ANSI terminal control sequence for ending this style. + */ + readonly close: string; + } + + interface ColorBase { + readonly ansi: ColorConvert; + readonly ansi256: ColorConvert; + readonly ansi16m: ColorConvert; + + /** + The ANSI terminal control sequence for ending this color. + */ + readonly close: string; + } + + interface Modifier { + /** + Resets the current color chain. + */ + readonly reset: CSPair; + + /** + Make text bold. + */ + readonly bold: CSPair; + + /** + Emitting only a small amount of light. + */ + readonly dim: CSPair; + + /** + Make text italic. (Not widely supported) + */ + readonly italic: CSPair; + + /** + Make text underline. (Not widely supported) + */ + readonly underline: CSPair; + + /** + Inverse background and foreground colors. + */ + readonly inverse: CSPair; + + /** + Prints the text, but makes it invisible. + */ + readonly hidden: CSPair; + + /** + Puts a horizontal line through the center of the text. (Not widely supported) + */ + readonly strikethrough: CSPair; + } + + interface ForegroundColor { + readonly black: CSPair; + readonly red: CSPair; + readonly green: CSPair; + readonly yellow: CSPair; + readonly blue: CSPair; + readonly cyan: CSPair; + readonly magenta: CSPair; + readonly white: CSPair; + + /** + Alias for `blackBright`. + */ + readonly gray: CSPair; + + /** + Alias for `blackBright`. + */ + readonly grey: CSPair; + + readonly blackBright: CSPair; + readonly redBright: CSPair; + readonly greenBright: CSPair; + readonly yellowBright: CSPair; + readonly blueBright: CSPair; + readonly cyanBright: CSPair; + readonly magentaBright: CSPair; + readonly whiteBright: CSPair; + } + + interface BackgroundColor { + readonly bgBlack: CSPair; + readonly bgRed: CSPair; + readonly bgGreen: CSPair; + readonly bgYellow: CSPair; + readonly bgBlue: CSPair; + readonly bgCyan: CSPair; + readonly bgMagenta: CSPair; + readonly bgWhite: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGray: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGrey: CSPair; + + readonly bgBlackBright: CSPair; + readonly bgRedBright: CSPair; + readonly bgGreenBright: CSPair; + readonly bgYellowBright: CSPair; + readonly bgBlueBright: CSPair; + readonly bgCyanBright: CSPair; + readonly bgMagentaBright: CSPair; + readonly bgWhiteBright: CSPair; + } +} + +declare const ansiStyles: { + readonly modifier: ansiStyles.Modifier; + readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase; + readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase; + readonly codes: ReadonlyMap; +} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier; + +export = ansiStyles; diff --git a/node_modules/@jest/globals/node_modules/ansi-styles/index.js b/node_modules/@jest/globals/node_modules/ansi-styles/index.js new file mode 100644 index 000000000..5d82581a1 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/ansi-styles/index.js @@ -0,0 +1,163 @@ +'use strict'; + +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; +}; + +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; +}; + +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; + +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; + +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); + + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); + + return value; + }, + enumerable: true, + configurable: true + }); +}; + +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = require('color-convert'); + } + + const offset = isBackground ? 10 : 0; + const styles = {}; + + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } + + return styles; +}; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; + + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); + + return styles; +} + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); diff --git a/node_modules/os-name/license b/node_modules/@jest/globals/node_modules/ansi-styles/license similarity index 100% rename from node_modules/os-name/license rename to node_modules/@jest/globals/node_modules/ansi-styles/license diff --git a/node_modules/@jest/globals/node_modules/ansi-styles/package.json b/node_modules/@jest/globals/node_modules/ansi-styles/package.json new file mode 100644 index 000000000..2b1011e00 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/ansi-styles/package.json @@ -0,0 +1,93 @@ +{ + "_args": [ + [ + "ansi-styles@4.2.1", + "/workspace/readable-readme" + ] + ], + "_development": true, + "_from": "ansi-styles@4.2.1", + "_id": "ansi-styles@4.2.1", + "_inBundle": false, + "_integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "_location": "/@jest/globals/ansi-styles", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ansi-styles@4.2.1", + "name": "ansi-styles", + "escapedName": "ansi-styles", + "rawSpec": "4.2.1", + "saveSpec": null, + "fetchSpec": "4.2.1" + }, + "_requiredBy": [ + "/@jest/globals/chalk" + ], + "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "_spec": "4.2.1", + "_where": "/workspace/readable-readme", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/chalk/ansi-styles/issues" + }, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "description": "ANSI escape codes for styling strings in the terminal", + "devDependencies": { + "@types/color-convert": "^1.9.0", + "ava": "^2.3.0", + "svg-term-cli": "^2.1.1", + "tsd": "^0.11.0", + "xo": "^0.25.3" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "funding": "https://github.com/chalk/ansi-styles?sponsor=1", + "homepage": "https://github.com/chalk/ansi-styles#readme", + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "license": "MIT", + "name": "ansi-styles", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/ansi-styles.git" + }, + "scripts": { + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor", + "test": "xo && ava && tsd" + }, + "version": "4.2.1" +} diff --git a/node_modules/@jest/globals/node_modules/ansi-styles/readme.md b/node_modules/@jest/globals/node_modules/ansi-styles/readme.md new file mode 100644 index 000000000..2a1ef6546 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/ansi-styles/readme.md @@ -0,0 +1,158 @@ +# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles) + +> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. + + + +## Install + +``` +$ npm install ansi-styles +``` + +## Usage + +```js +const style = require('ansi-styles'); + +console.log(`${style.green.open}Hello world!${style.green.close}`); + + +// Color conversion between 16/256/truecolor +// NOTE: If conversion goes to 16 colors or 256 colors, the original color +// may be degraded to fit that color palette. This means terminals +// that do not support 16 million colors will best-match the +// original color. +console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close); +console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close); +console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close); +``` + +## API + +Each style has an `open` and `close` property. + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(Not widely supported)* +- `underline` +- `inverse` +- `hidden` +- `strikethrough` *(Not widely supported)* + +### 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` + +## Advanced usage + +By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `style.modifier` +- `style.color` +- `style.bgColor` + +###### Example + +```js +console.log(style.color.green.open); +``` + +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values. + +###### Example + +```js +console.log(style.codes.get(36)); +//=> 39 +``` + +## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728) + +`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors. + +The following color spaces from `color-convert` are supported: + +- `rgb` +- `hex` +- `keyword` +- `hsl` +- `hsv` +- `hwb` +- `ansi` +- `ansi256` + +To use these, call the associated conversion function with the intended output, for example: + +```js +style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code +style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code + +style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code +style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code + +style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code +style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code +``` + +## Related + +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/@jest/globals/node_modules/chalk/index.d.ts b/node_modules/@jest/globals/node_modules/chalk/index.d.ts new file mode 100644 index 000000000..7e22c45ec --- /dev/null +++ b/node_modules/@jest/globals/node_modules/chalk/index.d.ts @@ -0,0 +1,411 @@ +declare const enum LevelEnum { + /** + All colors disabled. + */ + None = 0, + + /** + Basic 16 colors support. + */ + Basic = 1, + + /** + ANSI 256 colors support. + */ + Ansi256 = 2, + + /** + Truecolor 16 million colors support. + */ + TrueColor = 3 +} + +/** +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 { + type Level = LevelEnum; + + interface Options { + /** + Specify the color support for Chalk. + By default, color support is automatically detected based on the environment. + */ + level?: Level; + } + + interface Instance { + /** + Return a new Chalk 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}%} + `); + ``` + */ + (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. + */ + 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: typeof LevelEnum; + Color: Color; + ForegroundColor: ForegroundColor; + BackgroundColor: BackgroundColor; + Modifiers: Modifiers; + stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false}; +}; + +export = chalk; diff --git a/node_modules/windows-release/license b/node_modules/@jest/globals/node_modules/chalk/license similarity index 100% rename from node_modules/windows-release/license rename to node_modules/@jest/globals/node_modules/chalk/license diff --git a/node_modules/@jest/globals/node_modules/chalk/package.json b/node_modules/@jest/globals/node_modules/chalk/package.json new file mode 100644 index 000000000..6c5ef0d53 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/chalk/package.json @@ -0,0 +1,99 @@ +{ + "_args": [ + [ + "chalk@3.0.0", + "/workspace/readable-readme" + ] + ], + "_development": true, + "_from": "chalk@3.0.0", + "_id": "chalk@3.0.0", + "_inBundle": false, + "_integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "_location": "/@jest/globals/chalk", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "chalk@3.0.0", + "name": "chalk", + "escapedName": "chalk", + "rawSpec": "3.0.0", + "saveSpec": null, + "fetchSpec": "3.0.0" + }, + "_requiredBy": [ + "/@jest/globals/@jest/types" + ], + "_resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "_spec": "3.0.0", + "_where": "/workspace/readable-readme", + "bugs": { + "url": "https://github.com/chalk/chalk/issues" + }, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "description": "Terminal string styling done right", + "devDependencies": { + "ava": "^2.4.0", + "coveralls": "^3.0.7", + "execa": "^3.2.0", + "import-fresh": "^3.1.0", + "matcha": "^0.7.0", + "nyc": "^14.1.1", + "resolve-from": "^5.0.0", + "tsd": "^0.7.4", + "xo": "^0.25.3" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "source", + "index.d.ts" + ], + "homepage": "https://github.com/chalk/chalk#readme", + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "str", + "ansi", + "style", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "license": "MIT", + "main": "source", + "name": "chalk", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/chalk.git" + }, + "scripts": { + "bench": "matcha benchmark.js", + "test": "xo && nyc ava && tsd" + }, + "version": "3.0.0", + "xo": { + "rules": { + "unicorn/prefer-string-slice": "off", + "unicorn/prefer-includes": "off" + } + } +} diff --git a/node_modules/@jest/globals/node_modules/chalk/readme.md b/node_modules/@jest/globals/node_modules/chalk/readme.md new file mode 100644 index 000000000..877cb93b7 --- /dev/null +++ b/node_modules/@jest/globals/node_modules/chalk/readme.md @@ -0,0 +1,304 @@ +

+
+
+ Chalk +
+
+
+

+ +> Terminal string styling done right + +[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) + + + + +## 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 ~46,000 packages](https://www.npmjs.com/browse/depended/chalk) as of October 1, 2019 + + +## 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.`