Skip to content

Commit

Permalink
Merge pull request #960 from gemini-testing/INFRADUTY-27136.test_error
Browse files Browse the repository at this point in the history
fix: declare err property on Test type
  • Loading branch information
KuznetsovRoman authored Jun 28, 2024
2 parents f9239c9 + ddb9988 commit e604e66
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/test-reader/test-object/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type TestOpts = TestObjectData &

export class Test extends ConfigurableTestObject {
public fn: TestFunction<TestFunctionCtx>;
public err?: Error;

static create<T extends Test>(this: new (opts: TestOpts) => T, opts: TestOpts): T {
return new this(opts);
Expand Down
4 changes: 2 additions & 2 deletions test/src/error-snippets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ describe("error-snippets", () => {
);
const originalStack = error.stack;

await extendWithCodeSnippet(error);
const result = await extendWithCodeSnippet(error);

assert.equal(error.stack, originalStack);
assert.isUndefined(result.snippet, originalStack);
});
});

Expand Down
5 changes: 3 additions & 2 deletions test/src/runner/test-runner/regular-test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,14 @@ describe("runner/test-runner/regular-test-runner", () => {
const test = new Test({});
const onFail = sinon.stub().named("onFail");
const runner = mkRunner_({ test }).on(Events.TEST_FAIL, onFail);
const err = new Error();

const workers = mkWorkers_();
workers.runTest.rejects(new Error());
workers.runTest.rejects(err);

await run_({ runner, workers });

assert.calledOnceWith(onFail, sinon.match(test));
assert.calledOnceWith(onFail, sinon.match(Object.assign(test, { err })));
});

it("should be emitted with error", async () => {
Expand Down

0 comments on commit e604e66

Please sign in to comment.