Skip to content

Commit

Permalink
Refactoring at integration tests
Browse files Browse the repository at this point in the history
Objects that are defined as globals anyway don't need to be returned as
by their initialization function.
  • Loading branch information
c3er committed Dec 3, 2023
1 parent 1cfca33 commit a88485f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions test/integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,15 @@ async function cleanup() {
}

async function startApp() {
const app = await electron.launch({
_app = await electron.launch({
args: [path.join(__dirname, ".."), "--test", "--log-dir", lib.LOG_DIR],
executablePath: electronPath,
})

const page = await app.firstWindow()
page.on("pageerror", error => assert.fail(`Page error: ${error}`))
page.setDefaultTimeout(DEFAULT_TIMEOUT_MS)
await page.waitForSelector("h1") // Wait until the window is actually loaded

return [app, page]
_page = await _app.firstWindow()
_page.on("pageerror", error => assert.fail(`Page error: ${error}`))
_page.setDefaultTimeout(DEFAULT_TIMEOUT_MS)
await _page.waitForSelector("h1") // Wait until the window is actually loaded
}

describe("Process handling", () => {
Expand Down Expand Up @@ -184,7 +182,7 @@ describe("Process handling", () => {
describe("Integration tests with single app instance", () => {
before(async () => {
await cleanup()
;[_app, _page] = await startApp()
await startApp()
})

after(async () => await _app.close())
Expand Down

0 comments on commit a88485f

Please sign in to comment.