mirror of
https://github.com/TheBinaryNinja/tvapp2.git
synced 2026-06-04 23:15:42 -04:00
build(deps): bump playwright from 1.49.1 to 1.50.1
This commit is contained in:
206
node_modules/playwright/lib/reporters/base.js
generated
vendored
206
node_modules/playwright/lib/reporters/base.js
generated
vendored
@@ -3,22 +3,20 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.colors = exports.BaseReporter = void 0;
|
||||
exports.TerminalReporter = void 0;
|
||||
exports.fitToWidth = fitToWidth;
|
||||
exports.formatError = formatError;
|
||||
exports.formatFailure = formatFailure;
|
||||
exports.formatResultFailure = formatResultFailure;
|
||||
exports.formatRetry = formatRetry;
|
||||
exports.formatTestHeader = formatTestHeader;
|
||||
exports.formatTestTitle = formatTestTitle;
|
||||
exports.kOutputSymbol = exports.isTTY = void 0;
|
||||
exports.nonTerminalScreen = exports.noColors = exports.kOutputSymbol = exports.internalScreen = void 0;
|
||||
exports.prepareErrorStack = prepareErrorStack;
|
||||
exports.relativeFilePath = relativeFilePath;
|
||||
exports.resolveOutputFile = resolveOutputFile;
|
||||
exports.separator = separator;
|
||||
exports.stepSuffix = stepSuffix;
|
||||
exports.stripAnsiEscapes = stripAnsiEscapes;
|
||||
exports.ttyWidth = void 0;
|
||||
exports.terminalScreen = void 0;
|
||||
var _utilsBundle = require("playwright-core/lib/utilsBundle");
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _utils = require("playwright-core/lib/utils");
|
||||
@@ -42,11 +40,49 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
*/
|
||||
|
||||
const kOutputSymbol = exports.kOutputSymbol = Symbol('output');
|
||||
const {
|
||||
isTTY,
|
||||
ttyWidth,
|
||||
colors
|
||||
} = (() => {
|
||||
const noColors = exports.noColors = {
|
||||
bold: t => t,
|
||||
cyan: t => t,
|
||||
dim: t => t,
|
||||
gray: t => t,
|
||||
green: t => t,
|
||||
red: t => t,
|
||||
yellow: t => t,
|
||||
black: t => t,
|
||||
blue: t => t,
|
||||
magenta: t => t,
|
||||
white: t => t,
|
||||
grey: t => t,
|
||||
bgBlack: t => t,
|
||||
bgRed: t => t,
|
||||
bgGreen: t => t,
|
||||
bgYellow: t => t,
|
||||
bgBlue: t => t,
|
||||
bgMagenta: t => t,
|
||||
bgCyan: t => t,
|
||||
bgWhite: t => t,
|
||||
strip: t => t,
|
||||
stripColors: t => t,
|
||||
reset: t => t,
|
||||
italic: t => t,
|
||||
underline: t => t,
|
||||
inverse: t => t,
|
||||
hidden: t => t,
|
||||
strikethrough: t => t,
|
||||
rainbow: t => t,
|
||||
zebra: t => t,
|
||||
america: t => t,
|
||||
trap: t => t,
|
||||
random: t => t,
|
||||
zalgo: t => t,
|
||||
enabled: false,
|
||||
enable: () => {},
|
||||
disable: () => {},
|
||||
setTheme: () => {}
|
||||
};
|
||||
|
||||
// Output goes to terminal.
|
||||
const terminalScreen = exports.terminalScreen = (() => {
|
||||
let isTTY = !!process.stdout.isTTY;
|
||||
let ttyWidth = process.stdout.columns || 0;
|
||||
if (process.env.PLAYWRIGHT_FORCE_TTY === 'false' || process.env.PLAYWRIGHT_FORCE_TTY === '0') {
|
||||
@@ -62,27 +98,33 @@ const {
|
||||
}
|
||||
let useColors = isTTY;
|
||||
if (process.env.DEBUG_COLORS === '0' || process.env.DEBUG_COLORS === 'false' || process.env.FORCE_COLOR === '0' || process.env.FORCE_COLOR === 'false') useColors = false;else if (process.env.DEBUG_COLORS || process.env.FORCE_COLOR) useColors = true;
|
||||
const colors = useColors ? _utilsBundle.colors : {
|
||||
bold: t => t,
|
||||
cyan: t => t,
|
||||
dim: t => t,
|
||||
gray: t => t,
|
||||
green: t => t,
|
||||
red: t => t,
|
||||
yellow: t => t,
|
||||
enabled: false
|
||||
};
|
||||
const colors = useColors ? _utilsBundle.colors : noColors;
|
||||
return {
|
||||
resolveFiles: 'cwd',
|
||||
isTTY,
|
||||
ttyWidth,
|
||||
colors
|
||||
};
|
||||
})();
|
||||
exports.colors = colors;
|
||||
exports.ttyWidth = ttyWidth;
|
||||
exports.isTTY = isTTY;
|
||||
class BaseReporter {
|
||||
|
||||
// Output does not go to terminal, but colors are controlled with terminal env vars.
|
||||
const nonTerminalScreen = exports.nonTerminalScreen = {
|
||||
colors: terminalScreen.colors,
|
||||
isTTY: false,
|
||||
ttyWidth: 0,
|
||||
resolveFiles: 'rootDir'
|
||||
};
|
||||
|
||||
// Internal output for post-processing, should always contain real colors.
|
||||
const internalScreen = exports.internalScreen = {
|
||||
colors: _utilsBundle.colors,
|
||||
isTTY: false,
|
||||
ttyWidth: 0,
|
||||
resolveFiles: 'rootDir'
|
||||
};
|
||||
class TerminalReporter {
|
||||
constructor(options = {}) {
|
||||
this.screen = terminalScreen;
|
||||
this.config = void 0;
|
||||
this.suite = void 0;
|
||||
this.totalTestCount = 0;
|
||||
@@ -123,7 +165,7 @@ class BaseReporter {
|
||||
onTestEnd(test, result) {
|
||||
if (result.status !== 'skipped' && result.status !== test.expectedStatus) ++this._failureCount;
|
||||
const projectName = test.titlePath()[1];
|
||||
const relativePath = relativeTestPath(this.config, test);
|
||||
const relativePath = relativeTestPath(this.screen, this.config, test);
|
||||
const fileAndProject = (projectName ? `[${projectName}] › ` : '') + relativePath;
|
||||
const entry = this.fileDurations.get(fileAndProject) || {
|
||||
duration: 0,
|
||||
@@ -140,18 +182,18 @@ class BaseReporter {
|
||||
this.result = result;
|
||||
}
|
||||
fitToScreen(line, prefix) {
|
||||
if (!ttyWidth) {
|
||||
if (!this.screen.ttyWidth) {
|
||||
// Guard against the case where we cannot determine available width.
|
||||
return line;
|
||||
}
|
||||
return fitToWidth(line, ttyWidth, prefix);
|
||||
return fitToWidth(line, this.screen.ttyWidth, prefix);
|
||||
}
|
||||
generateStartingMessage() {
|
||||
var _this$config$metadata;
|
||||
const jobs = (_this$config$metadata = this.config.metadata.actualWorkers) !== null && _this$config$metadata !== void 0 ? _this$config$metadata : this.config.workers;
|
||||
const shardDetails = this.config.shard ? `, shard ${this.config.shard.current} of ${this.config.shard.total}` : '';
|
||||
if (!this.totalTestCount) return '';
|
||||
return '\n' + colors.dim('Running ') + this.totalTestCount + colors.dim(` test${this.totalTestCount !== 1 ? 's' : ''} using `) + jobs + colors.dim(` worker${jobs !== 1 ? 's' : ''}${shardDetails}`);
|
||||
return '\n' + this.screen.colors.dim('Running ') + this.totalTestCount + this.screen.colors.dim(` test${this.totalTestCount !== 1 ? 's' : ''} using `) + jobs + this.screen.colors.dim(` worker${jobs !== 1 ? 's' : ''}${shardDetails}`);
|
||||
}
|
||||
getSlowTests() {
|
||||
if (!this.config.reportSlowTests) return [];
|
||||
@@ -173,27 +215,27 @@ class BaseReporter {
|
||||
}) {
|
||||
const tokens = [];
|
||||
if (unexpected.length) {
|
||||
tokens.push(colors.red(` ${unexpected.length} failed`));
|
||||
for (const test of unexpected) tokens.push(colors.red(formatTestHeader(this.config, test, {
|
||||
tokens.push(this.screen.colors.red(` ${unexpected.length} failed`));
|
||||
for (const test of unexpected) tokens.push(this.screen.colors.red(this.formatTestHeader(test, {
|
||||
indent: ' '
|
||||
})));
|
||||
}
|
||||
if (interrupted.length) {
|
||||
tokens.push(colors.yellow(` ${interrupted.length} interrupted`));
|
||||
for (const test of interrupted) tokens.push(colors.yellow(formatTestHeader(this.config, test, {
|
||||
tokens.push(this.screen.colors.yellow(` ${interrupted.length} interrupted`));
|
||||
for (const test of interrupted) tokens.push(this.screen.colors.yellow(this.formatTestHeader(test, {
|
||||
indent: ' '
|
||||
})));
|
||||
}
|
||||
if (flaky.length) {
|
||||
tokens.push(colors.yellow(` ${flaky.length} flaky`));
|
||||
for (const test of flaky) tokens.push(colors.yellow(formatTestHeader(this.config, test, {
|
||||
tokens.push(this.screen.colors.yellow(` ${flaky.length} flaky`));
|
||||
for (const test of flaky) tokens.push(this.screen.colors.yellow(this.formatTestHeader(test, {
|
||||
indent: ' '
|
||||
})));
|
||||
}
|
||||
if (skipped) tokens.push(colors.yellow(` ${skipped} skipped`));
|
||||
if (didNotRun) tokens.push(colors.yellow(` ${didNotRun} did not run`));
|
||||
if (expected) tokens.push(colors.green(` ${expected} passed`) + colors.dim(` (${(0, _utilsBundle.ms)(this.result.duration)})`));
|
||||
if (fatalErrors.length && expected + unexpected.length + interrupted.length + flaky.length > 0) tokens.push(colors.red(` ${fatalErrors.length === 1 ? '1 error was not a part of any test' : fatalErrors.length + ' errors were not a part of any test'}, see above for details`));
|
||||
if (skipped) tokens.push(this.screen.colors.yellow(` ${skipped} skipped`));
|
||||
if (didNotRun) tokens.push(this.screen.colors.yellow(` ${didNotRun} did not run`));
|
||||
if (expected) tokens.push(this.screen.colors.green(` ${expected} passed`) + this.screen.colors.dim(` (${(0, _utilsBundle.ms)(this.result.duration)})`));
|
||||
if (fatalErrors.length && expected + unexpected.length + interrupted.length + flaky.length > 0) tokens.push(this.screen.colors.red(` ${fatalErrors.length === 1 ? '1 error was not a part of any test' : fatalErrors.length + ' errors were not a part of any test'}, see above for details`));
|
||||
return tokens.join('\n');
|
||||
}
|
||||
generateSummary() {
|
||||
@@ -251,15 +293,15 @@ class BaseReporter {
|
||||
_printFailures(failures) {
|
||||
console.log('');
|
||||
failures.forEach((test, index) => {
|
||||
console.log(formatFailure(this.config, test, index + 1));
|
||||
console.log(this.formatFailure(test, index + 1));
|
||||
});
|
||||
}
|
||||
_printSlowTests() {
|
||||
const slowTests = this.getSlowTests();
|
||||
slowTests.forEach(([file, duration]) => {
|
||||
console.log(colors.yellow(' Slow test file: ') + file + colors.yellow(` (${(0, _utilsBundle.ms)(duration)})`));
|
||||
console.log(this.screen.colors.yellow(' Slow test file: ') + file + this.screen.colors.yellow(` (${(0, _utilsBundle.ms)(duration)})`));
|
||||
});
|
||||
if (slowTests.length) console.log(colors.yellow(' Consider splitting slow test files to speed up parallel execution'));
|
||||
if (slowTests.length) console.log(this.screen.colors.yellow(' Consider running tests from slow files in parallel, see https://playwright.dev/docs/test-parallel.'));
|
||||
}
|
||||
_printSummary(summary) {
|
||||
if (summary.trim()) console.log(summary);
|
||||
@@ -267,24 +309,36 @@ class BaseReporter {
|
||||
willRetry(test) {
|
||||
return test.outcome() === 'unexpected' && test.results.length <= test.retries;
|
||||
}
|
||||
formatTestTitle(test, step, omitLocation = false) {
|
||||
return formatTestTitle(this.screen, this.config, test, step, omitLocation);
|
||||
}
|
||||
formatTestHeader(test, options = {}) {
|
||||
return formatTestHeader(this.screen, this.config, test, options);
|
||||
}
|
||||
formatFailure(test, index) {
|
||||
return formatFailure(this.screen, this.config, test, index);
|
||||
}
|
||||
formatError(error) {
|
||||
return formatError(this.screen, error);
|
||||
}
|
||||
}
|
||||
exports.BaseReporter = BaseReporter;
|
||||
function formatFailure(config, test, index) {
|
||||
exports.TerminalReporter = TerminalReporter;
|
||||
function formatFailure(screen, config, test, index) {
|
||||
const lines = [];
|
||||
const header = formatTestHeader(config, test, {
|
||||
const header = formatTestHeader(screen, config, test, {
|
||||
indent: ' ',
|
||||
index,
|
||||
mode: 'error'
|
||||
});
|
||||
lines.push(colors.red(header));
|
||||
lines.push(screen.colors.red(header));
|
||||
for (const result of test.results) {
|
||||
const resultLines = [];
|
||||
const errors = formatResultFailure(test, result, ' ', colors.enabled);
|
||||
const errors = formatResultFailure(screen, test, result, ' ');
|
||||
if (!errors.length) continue;
|
||||
const retryLines = [];
|
||||
if (result.retry) {
|
||||
retryLines.push('');
|
||||
retryLines.push(colors.gray(separator(` Retry #${result.retry}`)));
|
||||
retryLines.push(screen.colors.gray(separator(screen, ` Retry #${result.retry}`)));
|
||||
}
|
||||
resultLines.push(...retryLines);
|
||||
resultLines.push(...errors.map(error => '\n' + error.message));
|
||||
@@ -293,37 +347,37 @@ function formatFailure(config, test, index) {
|
||||
const hasPrintableContent = attachment.contentType.startsWith('text/');
|
||||
if (!attachment.path && !hasPrintableContent) continue;
|
||||
resultLines.push('');
|
||||
resultLines.push(colors.cyan(separator(` attachment #${i + 1}: ${attachment.name} (${attachment.contentType})`)));
|
||||
resultLines.push(screen.colors.cyan(separator(screen, ` attachment #${i + 1}: ${attachment.name} (${attachment.contentType})`)));
|
||||
if (attachment.path) {
|
||||
const relativePath = _path.default.relative(process.cwd(), attachment.path);
|
||||
resultLines.push(colors.cyan(` ${relativePath}`));
|
||||
resultLines.push(screen.colors.cyan(` ${relativePath}`));
|
||||
// Make this extensible
|
||||
if (attachment.name === 'trace') {
|
||||
const packageManagerCommand = (0, _utils.getPackageManagerExecCommand)();
|
||||
resultLines.push(colors.cyan(` Usage:`));
|
||||
resultLines.push(screen.colors.cyan(` Usage:`));
|
||||
resultLines.push('');
|
||||
resultLines.push(colors.cyan(` ${packageManagerCommand} playwright show-trace ${quotePathIfNeeded(relativePath)}`));
|
||||
resultLines.push(screen.colors.cyan(` ${packageManagerCommand} playwright show-trace ${quotePathIfNeeded(relativePath)}`));
|
||||
resultLines.push('');
|
||||
}
|
||||
} else {
|
||||
if (attachment.contentType.startsWith('text/') && attachment.body) {
|
||||
let text = attachment.body.toString();
|
||||
if (text.length > 300) text = text.slice(0, 300) + '...';
|
||||
for (const line of text.split('\n')) resultLines.push(colors.cyan(` ${line}`));
|
||||
for (const line of text.split('\n')) resultLines.push(screen.colors.cyan(` ${line}`));
|
||||
}
|
||||
}
|
||||
resultLines.push(colors.cyan(separator(' ')));
|
||||
resultLines.push(screen.colors.cyan(separator(screen, ' ')));
|
||||
}
|
||||
lines.push(...resultLines);
|
||||
}
|
||||
lines.push('');
|
||||
return lines.join('\n');
|
||||
}
|
||||
function formatRetry(result) {
|
||||
function formatRetry(screen, result) {
|
||||
const retryLines = [];
|
||||
if (result.retry) {
|
||||
retryLines.push('');
|
||||
retryLines.push(colors.gray(separator(` Retry #${result.retry}`)));
|
||||
retryLines.push(screen.colors.gray(separator(screen, ` Retry #${result.retry}`)));
|
||||
}
|
||||
return retryLines;
|
||||
}
|
||||
@@ -331,20 +385,20 @@ function quotePathIfNeeded(path) {
|
||||
if (/\s/.test(path)) return `"${path}"`;
|
||||
return path;
|
||||
}
|
||||
function formatResultFailure(test, result, initialIndent, highlightCode) {
|
||||
function formatResultFailure(screen, test, result, initialIndent) {
|
||||
const errorDetails = [];
|
||||
if (result.status === 'passed' && test.expectedStatus === 'failed') {
|
||||
errorDetails.push({
|
||||
message: indent(colors.red(`Expected to fail, but passed.`), initialIndent)
|
||||
message: indent(screen.colors.red(`Expected to fail, but passed.`), initialIndent)
|
||||
});
|
||||
}
|
||||
if (result.status === 'interrupted') {
|
||||
errorDetails.push({
|
||||
message: indent(colors.red(`Test was interrupted.`), initialIndent)
|
||||
message: indent(screen.colors.red(`Test was interrupted.`), initialIndent)
|
||||
});
|
||||
}
|
||||
for (const error of result.errors) {
|
||||
const formattedError = formatError(error, highlightCode);
|
||||
const formattedError = formatError(screen, error);
|
||||
errorDetails.push({
|
||||
message: indent(formattedError.message, initialIndent),
|
||||
location: formattedError.location
|
||||
@@ -352,29 +406,29 @@ function formatResultFailure(test, result, initialIndent, highlightCode) {
|
||||
}
|
||||
return errorDetails;
|
||||
}
|
||||
function relativeFilePath(config, file) {
|
||||
return _path.default.relative(config.rootDir, file) || _path.default.basename(file);
|
||||
function relativeFilePath(screen, config, file) {
|
||||
if (screen.resolveFiles === 'cwd') return _path.default.relative(process.cwd(), file);
|
||||
return _path.default.relative(config.rootDir, file);
|
||||
}
|
||||
function relativeTestPath(config, test) {
|
||||
return relativeFilePath(config, test.location.file);
|
||||
function relativeTestPath(screen, config, test) {
|
||||
return relativeFilePath(screen, config, test.location.file);
|
||||
}
|
||||
function stepSuffix(step) {
|
||||
const stepTitles = step ? step.titlePath() : [];
|
||||
return stepTitles.map(t => t.split('\n')[0]).map(t => ' › ' + t).join('');
|
||||
}
|
||||
function formatTestTitle(config, test, step, omitLocation = false) {
|
||||
var _step$location$line, _step$location, _step$location$column, _step$location2;
|
||||
function formatTestTitle(screen, config, test, step, omitLocation = false) {
|
||||
// root, project, file, ...describes, test
|
||||
const [, projectName,, ...titles] = test.titlePath();
|
||||
let location;
|
||||
if (omitLocation) location = `${relativeTestPath(config, test)}`;else location = `${relativeTestPath(config, test)}:${(_step$location$line = step === null || step === void 0 || (_step$location = step.location) === null || _step$location === void 0 ? void 0 : _step$location.line) !== null && _step$location$line !== void 0 ? _step$location$line : test.location.line}:${(_step$location$column = step === null || step === void 0 || (_step$location2 = step.location) === null || _step$location2 === void 0 ? void 0 : _step$location2.column) !== null && _step$location$column !== void 0 ? _step$location$column : test.location.column}`;
|
||||
if (omitLocation) location = `${relativeTestPath(screen, config, test)}`;else location = `${relativeTestPath(screen, config, test)}:${test.location.line}:${test.location.column}`;
|
||||
const projectTitle = projectName ? `[${projectName}] › ` : '';
|
||||
const testTitle = `${projectTitle}${location} › ${titles.join(' › ')}`;
|
||||
const extraTags = test.tags.filter(t => !testTitle.includes(t));
|
||||
return `${testTitle}${stepSuffix(step)}${extraTags.length ? ' ' + extraTags.join(' ') : ''}`;
|
||||
}
|
||||
function formatTestHeader(config, test, options = {}) {
|
||||
const title = formatTestTitle(config, test);
|
||||
function formatTestHeader(screen, config, test, options = {}) {
|
||||
const title = formatTestTitle(screen, config, test);
|
||||
const header = `${options.indent || ''}${options.index ? options.index + ') ' : ''}${title}`;
|
||||
let fullHeader = header;
|
||||
|
||||
@@ -396,9 +450,9 @@ function formatTestHeader(config, test, options = {}) {
|
||||
}
|
||||
fullHeader = header + (stepPaths.size === 1 ? stepPaths.values().next().value : '');
|
||||
}
|
||||
return separator(fullHeader);
|
||||
return separator(screen, fullHeader);
|
||||
}
|
||||
function formatError(error, highlightCode) {
|
||||
function formatError(screen, error) {
|
||||
const message = error.message || error.value || '';
|
||||
const stack = error.stack;
|
||||
if (!stack && !error.location) return {
|
||||
@@ -412,23 +466,23 @@ function formatError(error, highlightCode) {
|
||||
tokens.push((parsedStack === null || parsedStack === void 0 ? void 0 : parsedStack.message) || message);
|
||||
if (error.snippet) {
|
||||
let snippet = error.snippet;
|
||||
if (!highlightCode) snippet = stripAnsiEscapes(snippet);
|
||||
if (!screen.colors.enabled) snippet = stripAnsiEscapes(snippet);
|
||||
tokens.push('');
|
||||
tokens.push(snippet);
|
||||
}
|
||||
if (parsedStack && parsedStack.stackLines.length) tokens.push(colors.dim(parsedStack.stackLines.join('\n')));
|
||||
if (parsedStack && parsedStack.stackLines.length) tokens.push(screen.colors.dim(parsedStack.stackLines.join('\n')));
|
||||
let location = error.location;
|
||||
if (parsedStack && !location) location = parsedStack.location;
|
||||
if (error.cause) tokens.push(colors.dim('[cause]: ') + formatError(error.cause, highlightCode).message);
|
||||
if (error.cause) tokens.push(screen.colors.dim('[cause]: ') + formatError(screen, error.cause).message);
|
||||
return {
|
||||
location,
|
||||
message: tokens.join('\n')
|
||||
};
|
||||
}
|
||||
function separator(text = '') {
|
||||
function separator(screen, text = '') {
|
||||
if (text) text += ' ';
|
||||
const columns = Math.min(100, ttyWidth || 100);
|
||||
return text + colors.dim('─'.repeat(Math.max(0, columns - text.length)));
|
||||
const columns = Math.min(100, screen.ttyWidth || 100);
|
||||
return text + screen.colors.dim('─'.repeat(Math.max(0, columns - text.length)));
|
||||
}
|
||||
function indent(lines, tab) {
|
||||
return lines.replace(/^(?=.+$)/gm, tab);
|
||||
|
||||
Reference in New Issue
Block a user