admin: tweaked gitignore for misc files
This commit is contained in:
parent
bcca632ef8
commit
c8453577e9
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,5 @@
|
|||||||
node_modules/**
|
node_modules/**
|
||||||
output/**
|
output/**
|
||||||
misc/**
|
|
||||||
|
|
||||||
**/*.swp
|
**/*.swp
|
||||||
**/*.tgz
|
**/*.tgz
|
||||||
|
3
misc/.gitignore
vendored
Normal file
3
misc/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*.txt
|
||||||
|
tests/**
|
||||||
|
obsolete/**
|
@ -2,22 +2,19 @@
|
|||||||
function throwError(message, info) {
|
function throwError(message, info) {
|
||||||
const error = new Error(`AssertionError: ${ message }`);
|
const error = new Error(`AssertionError: ${ message }`);
|
||||||
error.code = "ERR_ASSERTION";
|
error.code = "ERR_ASSERTION";
|
||||||
for (const key of info) { error[key] = info[key]; }
|
for (const key in info) { error[key] = info[key]; }
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function equal(actual, expected, reason) {
|
export function equal(actual, expected, reason) {
|
||||||
if (actual != expected) {
|
if (actual == expected) { return; }
|
||||||
if (reason == null) { reason = `${ actual } == ${ expected }`; }
|
|
||||||
|
|
||||||
|
if (reason == null) { reason = `${ actual } == ${ expected }`; }
|
||||||
throwError(reason, { actual, expected, operator: "==" });
|
throwError(reason, { actual, expected, operator: "==" });
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function isDeepEqual(actual, expected, memo) {
|
function isDeepEqual(actual, expected, memo) {
|
||||||
if (actual === expected) {
|
if (actual === expected) { return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// One or both things aren't objects
|
// One or both things aren't objects
|
||||||
if (actual === null || typeof(expected) !== 'object') {
|
if (actual === null || typeof(expected) !== 'object') {
|
||||||
@ -70,7 +67,7 @@ export function throws(func, checkFunc, reason) {
|
|||||||
func();
|
func();
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (checkFunc(e)) { return true; }
|
if (checkFunc(e)) { return; }
|
||||||
|
|
||||||
throwError(`The expected exception validation function returned false`, {
|
throwError(`The expected exception validation function returned false`, {
|
||||||
actual: e,
|
actual: e,
|
||||||
@ -86,7 +83,11 @@ export function throws(func, checkFunc, reason) {
|
|||||||
|
|
||||||
export async function rejects(func, checkFunc, reason) {
|
export async function rejects(func, checkFunc, reason) {
|
||||||
try {
|
try {
|
||||||
|
if (func.then) {
|
||||||
|
await func;
|
||||||
|
} else {
|
||||||
await func();
|
await func();
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (checkFunc(e)) { return true; }
|
if (checkFunc(e)) { return true; }
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ export async function rejects(func, checkFunc, reason) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
throwError("Missing rejection", {
|
throwError("Missing rejection", {
|
||||||
operator: "rejects"
|
operation: "rejects"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user