Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
feat: make status independent from uncaught error
Browse files Browse the repository at this point in the history
`test_status` should not be based on the presence of uncaught exception. 
Instead, each recorder should determine its own method to define it. 
Also, if a track has not be explicitely ended, the test should be 
considered to have stop abruptly which amount to failure.
  • Loading branch information
lachrist committed Nov 22, 2022
1 parent cca75bb commit 9c9a93f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion components/trace/appmap/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const compileTrace = (configuration, messages) => {
const sources = [];
const errors = [];
const events = [];
let status = 0;
let status = 1;
for (const message of messages) {
const { type } = message;
if (type === "start") {
Expand Down
2 changes: 1 addition & 1 deletion components/trace/appmap/index.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ assertDeepEqual(
recorder: { name: "process" },
recording: undefined,
git: undefined,
test_status: "failed",
test_status: "succeeded",
exception: {
class: "name",
message: "message",
Expand Down
7 changes: 2 additions & 5 deletions components/trace/appmap/metadata.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ const makeMapName = (map_name, file_name, main) => {
return null;
};

const makeTestStatus = (errors, status) => {
const { length } = errors;
return length === 0 && status === 0 ? "succeeded" : "failed";
};
const makeTestStatus = (status) => (status === 0 ? "succeeded" : "failed");

const makeRecorder = (recorder) => {
assert(
Expand Down Expand Up @@ -133,7 +130,7 @@ export const compileMetadata = (
recorder: makeRecorder(recorder),
recording: makeRecording(recording) ?? undefined,
git: makeGit(repository) ?? undefined,
test_status: makeTestStatus(errors, status) ?? undefined,
test_status: makeTestStatus(status) ?? undefined,
exception: makeException(errors) ?? undefined,
});
/* c8 ignore stop */
2 changes: 1 addition & 1 deletion components/trace/appmap/metadata.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ assertDeepEqual(
message: "error-message",
},
],
0,
1,
),
{
...default_meta_data,
Expand Down

0 comments on commit 9c9a93f

Please sign in to comment.