New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ephox/bedrock-common

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ephox/bedrock-common - npm Package Compare versions

Comparing version 9.3.0 to 9.3.1

lib/test/ts/api/ReporterTest.d.ts

1

lib/main/ts/api/LoggedError.d.ts

@@ -6,1 +6,2 @@ import { TestError } from './TestError';

}
export declare const loggedError: (error: TestError, logs: string[]) => LoggedError;

@@ -0,1 +1,4 @@

export var loggedError = function (error, logs) {
return ({ error: error, logs: logs });
};
//# sourceMappingURL=LoggedError.js.map

2

lib/main/ts/api/Reporter.d.ts

@@ -5,5 +5,5 @@ import * as TestError from './TestError';

declare type TestError = TestError.TestError;
export declare const pprintAssertionText: (e: TestError.PprintAssertionError) => string;
export declare const html: (err: LoggedError.LoggedError) => string;
export declare const text: (err: LoggedError.LoggedError) => string;
export declare const pprintAssertionText: (e: TestError.PprintAssertionError) => string;
export {};

@@ -12,2 +12,5 @@ import * as TestError from './TestError';

};
var extractError = function (err) {
return err === undefined ? new Error('no error given') : err.error;
};
var formatExtra = function (e) {

@@ -32,52 +35,78 @@ if (!e.logs) {

};
export var html = function (err) {
var e = err === undefined ? new Error('no error given') : err.error;
var extra = formatExtra(err);
var htmlDiffAssertionErrorHtml = function (e) {
return "Test failure: " + e.message + "\nExpected: " + htmlentities(e.diff.expected) + "\nActual: " + htmlentities(e.diff.actual) + "\n\nHTML Diff: " + processQUnit(htmlentities(e.diff.comparison));
};
var htmlDiffAssertionErrorText = function (e) {
// TODO: make this look more like the PprintAssertionError
// TODO: get rid of the <ins> and <del> in the text output. Probably need to change the code that throws this.
return "Test failure: " + e.message + "\nExpected: " + e.diff.expected + "\nActual: " + e.diff.actual + "\n\nHTML Diff: " + e.diff.comparison;
};
var pprintAssertionErrorHtml = function (e) {
var dh = Differ.diffPrettyHtml(e.diff.actual, e.diff.expected);
return "Test failure: " + e.message + "\nExpected: \n" + htmlentities(e.diff.expected) + "\nActual: \n" + htmlentities(e.diff.actual) + "\nDiff: \n" + dh;
};
export var pprintAssertionText = function (e) {
var dh = Differ.diffPrettyText(e.diff.actual, e.diff.expected);
return "Test failure: " + e.message + "\nExpected: \n" + e.diff.expected + "\nActual: \n" + e.diff.actual + "\nDiff: \n" + dh;
};
var assertionErrorHtml = function (e) {
// TODO: make this look more like the PprintAssertionError
return 'Assertion error' + (e.message ? ' [' + e.message + ']' : '') +
': [' + htmlentities(JSON.stringify(e.expected)) + '] ' + e.operator +
' [' + htmlentities(JSON.stringify(e.actual)) + ']';
};
var assertionErrorText = function (e) {
// TODO: make this look more like the PprintAssertionError
return 'Assertion error' + (e.message ? ' [' + e.message + ']' : '') +
': [' + (JSON.stringify(e.expected)) + '] ' + e.operator +
' [' + (JSON.stringify(e.actual)) + ']';
};
var mkHtml = function (e) {
if (TestError.isHTMLDiffError(e)) {
// Provide detailed HTML comparison information
return 'Test failure: ' + e.message +
'\nExpected: ' + htmlentities(e.diff.expected) +
'\nActual: ' + htmlentities(e.diff.actual) +
'\n\nHTML Diff: ' + processQUnit(htmlentities(e.diff.comparison)) +
extra;
return htmlDiffAssertionErrorHtml(e);
}
else if (TestError.isPprintAssertionError(e)) {
var dh = Differ.diffPrettyHtml(e.diff.actual, e.diff.expected);
return 'Test failure: ' + e.message +
'\nExpected: \n' + htmlentities(e.diff.expected) +
'\nActual: \n' + htmlentities(e.diff.actual) +
'\nDiff: \n' + dh + extra;
return pprintAssertionErrorHtml(e);
}
else if (TestError.isAssertionError(e)) {
return 'Assertion error' + (e.message ? ' [' + e.message + ']' : '') +
': [' + htmlentities(JSON.stringify(e.expected)) + '] ' + e.operator +
' [' + htmlentities(JSON.stringify(e.actual)) + ']' + extra;
return assertionErrorHtml(e);
}
else if (e.name && e.message) {
return htmlentities(e.name + ': ' + e.message + extra);
return htmlentities(e.name + ': ' + e.message);
}
else if (e.toString !== undefined) {
return htmlentities(String(e) + extra);
return htmlentities(String(e));
}
else {
return htmlentities(JSON.stringify(e) + extra);
return htmlentities(JSON.stringify(e));
}
};
export var text = function (err) {
var e = err === undefined ? new Error('no error given') : err.error;
var extra = formatExtra(err);
if (TestError.isPprintAssertionError(e)) {
return pprintAssertionText(e) + extra;
var mkText = function (e) {
if (TestError.isHTMLDiffError(e)) {
return htmlDiffAssertionErrorText(e);
}
else if (TestError.isPprintAssertionError(e)) {
return pprintAssertionText(e);
}
else if (TestError.isAssertionError(e)) {
return assertionErrorText(e);
}
else if (e.name && e.message) {
return (e.name + ': ' + e.message);
}
else if (e.toString !== undefined) {
return String(e);
}
else {
return html(err);
return JSON.stringify(e);
}
};
export var pprintAssertionText = function (e) {
var dh = Differ.diffPrettyText(e.diff.actual, e.diff.expected);
return 'Test failure: ' + e.message +
'\nExpected: \n' + e.diff.expected +
'\nActual: \n' + e.diff.actual +
'\nDiff: \n' + dh;
export var html = function (err) {
var e = extractError(err);
return mkHtml(e) + formatExtra(err);
};
export var text = function (err) {
var e = extractError(err);
return mkText(e) + formatExtra(err);
};
//# sourceMappingURL=Reporter.js.map
{
"name": "@ephox/bedrock-common",
"version": "9.3.0",
"version": "9.3.1",
"author": "Tiny Technologies Inc",

@@ -23,3 +23,3 @@ "license": "Apache-2.0",

},
"gitHead": "e851d198d2f83b97c32ad326a66bfb5257cfc24e"
"gitHead": "4aa3a0b342a897048f007d242e9c304d96a98ea6"
}

@@ -7,1 +7,4 @@ import { TestError } from './TestError';

}
export const loggedError = (error: TestError, logs: string[]): LoggedError =>
({error, logs});

@@ -8,6 +8,6 @@ import * as TestError from './TestError';

type AssertionError = TestError.AssertionError;
type HtmlDiffAssertionError = TestError.HtmlDiffAssertionError;
type TestError = TestError.TestError;
type PprintAssertionError = TestError.PprintAssertionError;
type HtmlDiffAssertionError = TestError.HtmlDiffAssertionError;
type AssertionError = TestError.AssertionError;

@@ -22,2 +22,5 @@ /* Required to make <del> and <ins> stay as tags.*/

const extractError = (err: LoggedError): TestError =>
err === undefined ? new Error('no error given') : err.error;
const formatExtra = (e: LoggedError): string => {

@@ -39,49 +42,96 @@ if (!e.logs) {

export const html = (err: LoggedError): string => {
const e = err === undefined ? new Error('no error given') : err.error;
const extra = formatExtra(err);
const htmlDiffAssertionErrorHtml = (e: HtmlDiffAssertionError): string => {
return `Test failure: ${e.message}
Expected: ${htmlentities(e.diff.expected)}
Actual: ${htmlentities(e.diff.actual)}
HTML Diff: ${processQUnit(htmlentities(e.diff.comparison))}`;
};
const htmlDiffAssertionErrorText = (e: HtmlDiffAssertionError): string => {
// TODO: make this look more like the PprintAssertionError
// TODO: get rid of the <ins> and <del> in the text output. Probably need to change the code that throws this.
return `Test failure: ${e.message}
Expected: ${e.diff.expected}
Actual: ${e.diff.actual}
HTML Diff: ${e.diff.comparison}`;
};
const pprintAssertionErrorHtml = (e: PprintAssertionError): string => {
const dh = Differ.diffPrettyHtml(e.diff.actual, e.diff.expected);
return `Test failure: ${e.message}
Expected:
${htmlentities(e.diff.expected)}
Actual:
${htmlentities(e.diff.actual)}
Diff:
${dh}`;
};
export const pprintAssertionText = (e: PprintAssertionError): string => {
const dh = Differ.diffPrettyText(e.diff.actual, e.diff.expected);
return `Test failure: ${e.message}
Expected:
${e.diff.expected}
Actual:
${e.diff.actual}
Diff:
${dh}`;
};
const assertionErrorHtml = (e: AssertionError) => {
// TODO: make this look more like the PprintAssertionError
return 'Assertion error' + (e.message ? ' [' + e.message + ']' : '') +
': [' + htmlentities(JSON.stringify(e.expected)) + '] ' + e.operator +
' [' + htmlentities(JSON.stringify(e.actual)) + ']';
};
const assertionErrorText = (e: AssertionError): string => {
// TODO: make this look more like the PprintAssertionError
return 'Assertion error' + (e.message ? ' [' + e.message + ']' : '') +
': [' + (JSON.stringify(e.expected)) + '] ' + e.operator +
' [' + (JSON.stringify(e.actual)) + ']';
};
const mkHtml = (e: TestError): string => {
if (TestError.isHTMLDiffError(e)) {
// Provide detailed HTML comparison information
return 'Test failure: ' + e.message +
'\nExpected: ' + htmlentities(e.diff.expected) +
'\nActual: ' + htmlentities(e.diff.actual) +
'\n\nHTML Diff: ' + processQUnit(htmlentities(e.diff.comparison)) +
extra;
return htmlDiffAssertionErrorHtml(e);
} else if (TestError.isPprintAssertionError(e)) {
const dh = Differ.diffPrettyHtml(e.diff.actual, e.diff.expected);
return 'Test failure: ' + e.message +
'\nExpected: \n' + htmlentities(e.diff.expected) +
'\nActual: \n' + htmlentities(e.diff.actual) +
'\nDiff: \n' + dh + extra;
return pprintAssertionErrorHtml(e);
} else if (TestError.isAssertionError(e)) {
return 'Assertion error' + (e.message ? ' [' + e.message + ']' : '') +
': [' + htmlentities(JSON.stringify(e.expected)) + '] ' + e.operator +
' [' + htmlentities(JSON.stringify(e.actual)) + ']' + extra;
return assertionErrorHtml(e);
} else if (e.name && e.message) {
return htmlentities(e.name + ': ' + e.message + extra);
return htmlentities(e.name + ': ' + e.message);
} else if (e.toString !== undefined) {
return htmlentities(String(e) + extra);
return htmlentities(String(e));
} else {
return htmlentities(JSON.stringify(e) + extra);
return htmlentities(JSON.stringify(e));
}
};
export const text = (err: LoggedError): string => {
const e = err === undefined ? new Error('no error given') : err.error;
const extra = formatExtra(err);
if (TestError.isPprintAssertionError(e)) {
return pprintAssertionText(e) + extra;
const mkText = (e: TestError): string => {
if (TestError.isHTMLDiffError(e)) {
return htmlDiffAssertionErrorText(e);
} else if (TestError.isPprintAssertionError(e)) {
return pprintAssertionText(e)
} else if (TestError.isAssertionError(e)) {
return assertionErrorText(e);
} else if (e.name && e.message) {
return (e.name + ': ' + e.message);
} else if (e.toString !== undefined) {
return String(e);
} else {
return html(err);
return JSON.stringify(e);
}
};
export const pprintAssertionText = (e: PprintAssertionError): string => {
const dh = Differ.diffPrettyText(e.diff.actual, e.diff.expected);
return 'Test failure: ' + e.message +
'\nExpected: \n' + e.diff.expected +
'\nActual: \n' + e.diff.actual +
'\nDiff: \n' + dh;
export const html = (err: LoggedError): string => {
const e = extractError(err);
return mkHtml(e) + formatExtra(err);
};
export const text = (err: LoggedError): string => {
const e = extractError(err);
return mkText(e) + formatExtra(err);
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc