From e4090eb01d8a93acfc557fcdd4a8862659a9bcf5 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Sun, 23 Jun 2024 09:37:59 +0200 Subject: [PATCH] chore: Bump chai and chai-as-promised (#303) --- package.json | 8 ++------ test/functional/basic-e2e-specs.js | 15 ++++++++++----- test/functional/caps-e2e-specs.js | 15 ++++++++++----- test/functional/find-e2e-specs.js | 15 ++++++++++----- test/functional/interaction-e2e-specs.js | 15 ++++++++++----- test/unit/driver-specs.js | 10 ++++++++-- test/unit/utils-specs.js | 14 ++++++++++---- test/unit/wda-mac-specs.js | 14 ++++++++++---- 8 files changed, 70 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index c216518..87d8ccc 100644 --- a/package.json +++ b/package.json @@ -75,16 +75,12 @@ "@semantic-release/changelog": "^6.0.1", "@semantic-release/git": "^10.0.1", "@types/bluebird": "^3.5.38", - "@types/chai": "^4.3.5", - "@types/chai-as-promised": "^7.1.5", "@types/lodash": "^4.14.196", "@types/mocha": "^10.0.1", "@types/node": "^20.4.7", - "@types/sinon": "^17.0.0", - "@types/sinon-chai": "^3.2.9", "@types/teen_process": "^2.0.2", - "chai": "^4.1.2", - "chai-as-promised": "^7.1.1", + "chai": "^5.1.1", + "chai-as-promised": "^8.0.0", "conventional-changelog-conventionalcommits": "^7.0.1", "mocha": "^10.0.0", "semantic-release": "^23.0.0", diff --git a/test/functional/basic-e2e-specs.js b/test/functional/basic-e2e-specs.js index 220bb7d..f20e0fb 100644 --- a/test/functional/basic-e2e-specs.js +++ b/test/functional/basic-e2e-specs.js @@ -1,12 +1,7 @@ import _ from 'lodash'; import { remote } from 'webdriverio'; -import chaiAsPromised from 'chai-as-promised'; -import chai from 'chai'; import { HOST, PORT, MOCHA_TIMEOUT, TEXT_EDIT_BUNDLE_ID } from '../utils'; -chai.should(); -chai.use(chaiAsPromised); - const CAPS = { platformName: 'mac', 'appium:automationName': 'mac2', @@ -17,6 +12,16 @@ describe('Mac2Driver - basic', function () { this.timeout(MOCHA_TIMEOUT); let driver; + let chai; + + before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised.default); + }); + beforeEach(async function () { driver = await remote({ hostname: HOST, diff --git a/test/functional/caps-e2e-specs.js b/test/functional/caps-e2e-specs.js index 5ef493e..b9f09dc 100644 --- a/test/functional/caps-e2e-specs.js +++ b/test/functional/caps-e2e-specs.js @@ -1,14 +1,9 @@ import { remote } from 'webdriverio'; -import chaiAsPromised from 'chai-as-promised'; -import chai from 'chai'; import os from 'os'; import path from 'path'; import { fs } from 'appium/support'; import { HOST, PORT, MOCHA_TIMEOUT, TEXT_EDIT_BUNDLE_ID } from '../utils'; -chai.should(); -chai.use(chaiAsPromised); - const TEST_FILE = path.resolve(os.tmpdir(), 'test.test'); const CAPS = { @@ -23,6 +18,16 @@ describe('Mac2Driver - caps', function () { this.timeout(MOCHA_TIMEOUT); let driver; + let chai; + + before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised.default); + }); + beforeEach(async function () { driver = await remote({ hostname: HOST, diff --git a/test/functional/find-e2e-specs.js b/test/functional/find-e2e-specs.js index 5660867..0254721 100644 --- a/test/functional/find-e2e-specs.js +++ b/test/functional/find-e2e-specs.js @@ -1,12 +1,7 @@ import _ from 'lodash'; import { remote } from 'webdriverio'; -import chaiAsPromised from 'chai-as-promised'; -import chai from 'chai'; import { HOST, PORT, MOCHA_TIMEOUT, TEXT_EDIT_BUNDLE_ID } from '../utils'; -chai.should(); -chai.use(chaiAsPromised); - const CAPS = { platformName: 'mac', 'appium:automationName': 'mac2', @@ -17,6 +12,16 @@ describe('Mac2Driver - find elements', function () { this.timeout(MOCHA_TIMEOUT); let driver; + let chai; + + before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised.default); + }); + beforeEach(async function () { driver = await remote({ hostname: HOST, diff --git a/test/functional/interaction-e2e-specs.js b/test/functional/interaction-e2e-specs.js index c98a30b..5a976a9 100644 --- a/test/functional/interaction-e2e-specs.js +++ b/test/functional/interaction-e2e-specs.js @@ -1,12 +1,7 @@ import _ from 'lodash'; import { remote } from 'webdriverio'; -import chaiAsPromised from 'chai-as-promised'; -import chai from 'chai'; import { HOST, PORT, MOCHA_TIMEOUT, TEXT_EDIT_BUNDLE_ID } from '../utils'; -chai.should(); -chai.use(chaiAsPromised); - const CAPS = { platformName: 'mac', 'appium:automationName': 'mac2', @@ -18,6 +13,16 @@ describe('Mac2Driver - elements interaction', function () { this.timeout(MOCHA_TIMEOUT); let driver; + let chai; + + before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised.default); + }); + beforeEach(async function () { driver = await remote({ hostname: HOST, diff --git a/test/unit/driver-specs.js b/test/unit/driver-specs.js index 1cb7f2b..eeac67f 100644 --- a/test/unit/driver-specs.js +++ b/test/unit/driver-specs.js @@ -1,8 +1,14 @@ import Mac2Driver from '../../lib/driver'; -import chai from 'chai'; -const should = chai.should(); describe('Mac2Driver', function () { + let chai; + let should; + + before(async function () { + chai = await import('chai'); + should = chai.should(); + }); + it('should exist', function () { should.exist(Mac2Driver); }); diff --git a/test/unit/utils-specs.js b/test/unit/utils-specs.js index e950320..4be3f2d 100644 --- a/test/unit/utils-specs.js +++ b/test/unit/utils-specs.js @@ -1,14 +1,20 @@ -import chai from 'chai'; -import chaiAsPromised from 'chai-as-promised'; import sinon from 'sinon'; import * as teen_process from 'teen_process'; import { listChildrenProcessIds } from '../../lib/utils'; const sandbox = sinon.createSandbox(); -chai.should(); -chai.use(chaiAsPromised); describe('listChildrenProcessIds', function () { + let chai; + + before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised.default); + }); + const EXAMPLE_PS_OUTPUT = ` USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND PPID _coreaudiod 236 3.1 0.0 4343236 4124 ?? Ss Thu10AM 42:23.82 /usr/sbin/coreau 1 diff --git a/test/unit/wda-mac-specs.js b/test/unit/wda-mac-specs.js index e8a486e..8856c3d 100644 --- a/test/unit/wda-mac-specs.js +++ b/test/unit/wda-mac-specs.js @@ -1,10 +1,16 @@ -import chai from 'chai'; -import chaiAsPromised from 'chai-as-promised'; import WDA_MAC_SERVER from '../../lib/wda-mac'; -chai.use(chaiAsPromised); - describe('WDAMacServer', function () { + let chai; + + before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised.default); + }); + describe('parseProxyProperties', function () { it('should default', function () { WDA_MAC_SERVER.parseProxyProperties({}).should.eql(