📄 mock/assert¶
📊 Analysis Summary¶
| Metric | Count |
|---|---|
| 🔧 Functions | 2 |
| 🧱 Classes | 1 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/website-eslint/src/mock/assert.js
Functions¶
fail(actual: any, expected: any, message: any, operator: any, stackStartFunction: any): void¶
Parameters:
actualanyexpectedanymessageanyoperatoranystackStartFunctionany
Returns: void
Code
assert(value: any, message: any): void¶
Parameters:
valueanymessageany
Returns: void
Calls:
fail
Classes¶
AssertionError¶
Extends: Error
Class Code
class AssertionError extends Error {
constructor(options) {
super(options);
this.actual = options.actual;
this.expected = options.expected;
this.operator = options.operator;
if (options.message) {
this.message = options.message;
this.generatedMessage = false;
} else {
this.message = '';
this.generatedMessage = true;
}
const stackStartFunction = options.stackStartFunction || fail;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, stackStartFunction);
} else {
// non v8 browsers so we can have a stacktrace
const err = new Error();
if (err.stack) {
let out = err.stack;
// try to strip useless frames
const fn_name =
typeof stackStartFunction === 'function'
? stackStartFunction.name
: stackStartFunction.toString();
const idx = out.indexOf(`\n${fn_name}`);
if (idx >= 0) {
// once we have located the function frame
// we need to strip out everything before it (and its line)
const next_line = out.indexOf('\n', idx + 1);
out = out.substring(next_line + 1);
}
this.stack = out;
}
}
}
}
Generated by Syntax Scribe