Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest mocha uses titlePath instead of fullTitle #18933

Merged
merged 1 commit into from Oct 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/harness/parallel/host.ts
Expand Up @@ -312,6 +312,9 @@ namespace Harness.Parallel.Host {
function makeMochaTest(test: ErrorInfo) {
return {
fullTitle: () => {
return test.name.join(" ");
},
titlePath: () => {
return test.name;
},
err: {
Expand Down
4 changes: 2 additions & 2 deletions src/harness/parallel/shared.ts
Expand Up @@ -6,8 +6,8 @@ namespace Harness.Parallel {
export type ParallelCloseMessage = { type: "close" } | never;
export type ParallelHostMessage = ParallelTestMessage | ParallelCloseMessage | ParallelBatchMessage;

export type ParallelErrorMessage = { type: "error", payload: { error: string, stack: string, name?: string } } | never;
export type ErrorInfo = ParallelErrorMessage["payload"] & { name: string };
export type ParallelErrorMessage = { type: "error", payload: { error: string, stack: string, name?: string[] } } | never;
export type ErrorInfo = ParallelErrorMessage["payload"] & { name: string[] };
export type ParallelResultMessage = { type: "result", payload: { passing: number, errors: ErrorInfo[], duration: number, runner: TestRunnerKind, file: string } } | never;
export type ParallelBatchProgressMessage = { type: "progress", payload: ParallelResultMessage["payload"] } | never;
export type ParallelClientMessage = ParallelErrorMessage | ParallelResultMessage | ParallelBatchProgressMessage;
Expand Down
19 changes: 9 additions & 10 deletions src/harness/parallel/worker.ts
Expand Up @@ -57,14 +57,14 @@ namespace Harness.Parallel.Worker {
callback.call(fakeContext);
}
catch (e) {
errors.push({ error: `Error executing suite: ${e.message}`, stack: e.stack, name: namestack.join(" ") });
errors.push({ error: `Error executing suite: ${e.message}`, stack: e.stack, name: [...namestack] });
return cleanup();
}
try {
beforeFunc && beforeFunc();
}
catch (e) {
errors.push({ error: `Error executing before function: ${e.message}`, stack: e.stack, name: namestack.join(" ") });
errors.push({ error: `Error executing before function: ${e.message}`, stack: e.stack, name: [...namestack] });
return cleanup();
}
finally {
Expand All @@ -76,7 +76,7 @@ namespace Harness.Parallel.Worker {
afterFunc && afterFunc();
}
catch (e) {
errors.push({ error: `Error executing after function: ${e.message}`, stack: e.stack, name: namestack.join(" ") });
errors.push({ error: `Error executing after function: ${e.message}`, stack: e.stack, name: [...namestack] });
}
finally {
afterFunc = undefined;
Expand Down Expand Up @@ -107,13 +107,12 @@ namespace Harness.Parallel.Worker {
slow() { return this; },
};
namestack.push(name);
name = namestack.join(" ");
if (beforeEachFunc) {
try {
beforeEachFunc();
}
catch (error) {
errors.push({ error: error.message, stack: error.stack, name });
errors.push({ error: error.message, stack: error.stack, name: [...namestack] });
namestack.pop();
return;
}
Expand All @@ -124,7 +123,7 @@ namespace Harness.Parallel.Worker {
callback.call(fakeContext);
}
catch (error) {
errors.push({ error: error.message, stack: error.stack, name });
errors.push({ error: error.message, stack: error.stack, name: [...namestack] });
return;
}
finally {
Expand All @@ -141,7 +140,7 @@ namespace Harness.Parallel.Worker {
throw new Error(`done() callback called multiple times; ensure it is only called once.`);
}
if (err) {
errors.push({ error: err.toString(), stack: "", name });
errors.push({ error: err.toString(), stack: "", name: [...namestack] });
}
else {
passing++;
Expand All @@ -150,14 +149,14 @@ namespace Harness.Parallel.Worker {
});
}
catch (error) {
errors.push({ error: error.message, stack: error.stack, name });
errors.push({ error: error.message, stack: error.stack, name: [...namestack] });
return;
}
finally {
namestack.pop();
}
if (!completed) {
errors.push({ error: "Test completes asynchronously, which is unsupported by the parallel harness", stack: "", name });
errors.push({ error: "Test completes asynchronously, which is unsupported by the parallel harness", stack: "", name: [...namestack] });
}
}
}
Expand Down Expand Up @@ -204,7 +203,7 @@ namespace Harness.Parallel.Worker {
}
});
process.on("uncaughtException", error => {
const message: ParallelErrorMessage = { type: "error", payload: { error: error.message, stack: error.stack, name: namestack.join(" ") } };
const message: ParallelErrorMessage = { type: "error", payload: { error: error.message, stack: error.stack, name: [...namestack] } };
try {
process.send(message);
}
Expand Down