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

chore: remove outdated mocha references #747

Merged
merged 1 commit into from
Mar 24, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ it('test1', async ({ browser }) => {
```

#### Execution context
The execution context can be accessed by the `browser.executionContext` property, which contains the current test/hook mocha object extended with the browser id.
The execution context can be accessed by the `browser.executionContext` property, which contains the current test/hook object extended with the browser id.

Example:
```js
Expand Down
3 changes: 1 addition & 2 deletions src/browser/commands/assert-view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const Image = require("../../../image");
const ScreenShooter = require("../../screen-shooter");
const temp = require("../../../temp");
const { getCaptureProcessors } = require("./capture-processors");
const { getTestContext } = require("../../../utils/mocha");
const RuntimeConfig = require("../../../config/runtime-config");
const AssertViewResults = require("./assert-view-results");
const BaseStateError = require("./errors/base-state-error");
Expand Down Expand Up @@ -60,7 +59,7 @@ module.exports = browser => {
const currSize = await currImgInst.getSize();
const currImg = { path: temp.path(Object.assign(tempOpts, { suffix: ".png" })), size: currSize };

const test = getTestContext(session.executionContext);
const test = session.executionContext.ctx.currentTest;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это свойство есть всегда и у хука и у теста: https://github.com/gemini-testing/hermione/blob/master/src/worker/runner/test-runner/execution-thread.js#L13-L24

const refImg = { path: config.getScreenshotPath(test, state), size: null };
const { emitter } = browser;

Expand Down
5 changes: 0 additions & 5 deletions src/utils/mocha.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/src/browser/commands/assert-view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe("assertView command", () => {
};

const initBrowser_ = ({ browser = stubBrowser_(), session = mkSessionStub_() } = {}) => {
session.executionContext = { hermioneCtx: {} };
session.executionContext = { hermioneCtx: {}, ctx: {} };
sandbox.stub(webdriverio, "attach").resolves(session);

return browser.init({ sessionId: session.sessionId, sessionCaps: session.capabilities });
Expand Down