feat(test): Show Deno.test() call locations for failures (#14484)

This commit is contained in:
Nayeem Rahman 2022-05-05 00:15:54 +01:00 committed by GitHub
parent 6a21fe745a
commit ca134d25e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 187 additions and 189 deletions

View file

@ -635,6 +635,16 @@
);
}
const jsError = Deno.core.destructureError(new Error());
// Note: There might pop up a case where one of the filename, line number or
// column number from the caller isn't defined. We assume never for now.
// Make `TestDescription::location` optional if such a case is found.
testDef.location = {
fileName: jsError.frames[1].fileName,
lineNumber: jsError.frames[1].lineNumber,
columnNumber: jsError.frames[1].columnNumber,
};
ArrayPrototypePush(tests, testDef);
}
@ -1097,6 +1107,7 @@
const description = {
origin,
name: test.name,
location: test.location,
};
const earlier = DateNow();