From e7580bd11d5b7732678d0d01c035ce96ecb877e6 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Wed, 19 Jun 2024 09:04:25 +0200 Subject: [PATCH] chore: Bump chai and chai-as-promised (#130) --- .github/workflows/unit-test.yml | 6 +++--- package.json | 8 ++------ .../accessibility-commands-e2e-specs.js | 13 +++++++------ test/functional/app-commands-e2e-specs.js | 13 +++++++------ test/functional/crashlog-commands-e2e-specs.js | 13 +++++++------ test/functional/idb-e2e-specs.js | 13 ++++++++----- test/functional/interaction-commands-e2e-specs.js | 13 +++++++------ test/functional/misc-commands-e2e-specs.js | 13 +++++++------ test/functional/xctest-commands-e2e-specs.js | 13 +++++++------ test/unit/helpers-specs.js | 15 ++++++++++----- 10 files changed, 65 insertions(+), 55 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 047645a..4a90940 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -6,11 +6,11 @@ jobs: prepare_matrix: runs-on: ubuntu-latest outputs: - versions: ${{ steps.generate-matrix.outputs.versions }} + versions: ${{ steps.generate-matrix.outputs.active }} steps: - - name: Select 3 most recent LTS versions of Node.js + - name: Select all active LTS versions of Node.js id: generate-matrix - run: echo "versions=$(curl -s https://endoflife.date/api/nodejs.json | jq -c '[[.[] | select(.lts != false)][:3] | .[].cycle | tonumber]')" >> "$GITHUB_OUTPUT" + uses: msimerson/node-lts-versions@v1 test: needs: diff --git a/package.json b/package.json index dc47f3b..508e3e0 100644 --- a/package.json +++ b/package.json @@ -61,17 +61,13 @@ "@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.1", "axios": "^1.x", - "chai": "^4.1.2", - "chai-as-promised": "^7.1.1", + "chai": "^5.1.1", + "chai-as-promised": "^8.0.0", "conventional-changelog-conventionalcommits": "^8.0.0", "mocha": "^10.0.0", "node-simctl": "^7.0.1", diff --git a/test/functional/accessibility-commands-e2e-specs.js b/test/functional/accessibility-commands-e2e-specs.js index 07618bc..d43f8e3 100644 --- a/test/functional/accessibility-commands-e2e-specs.js +++ b/test/functional/accessibility-commands-e2e-specs.js @@ -1,21 +1,22 @@ import _ from 'lodash'; -import chai from 'chai'; -import chaiAsPromised from 'chai-as-promised'; import { retryInterval } from 'asyncbox'; import { prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS } from '../helpers/device-helpers'; import IDB from '../../lib/idb'; - -chai.should(); -chai.use(chaiAsPromised); - describe('idb accessibility commands', function () { let idb; let simctl; + let chai; before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised.default); + simctl = await prepareDevice(); idb = new IDB({ udid: simctl.udid, diff --git a/test/functional/app-commands-e2e-specs.js b/test/functional/app-commands-e2e-specs.js index 205a6a5..ad5bd8a 100644 --- a/test/functional/app-commands-e2e-specs.js +++ b/test/functional/app-commands-e2e-specs.js @@ -1,23 +1,24 @@ import _ from 'lodash'; -import chai from 'chai'; -import chaiAsPromised from 'chai-as-promised'; import { prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS } from '../helpers/device-helpers'; import IDB from '../../lib/idb'; import { waitForCondition } from 'asyncbox'; - const MAPS_BUNDLE_ID = 'com.apple.Maps'; -chai.should(); -chai.use(chaiAsPromised); - describe('idb app commands', function () { let idb; let simctl; + let chai; before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised.default); + simctl = await prepareDevice(); idb = new IDB({ udid: simctl.udid, diff --git a/test/functional/crashlog-commands-e2e-specs.js b/test/functional/crashlog-commands-e2e-specs.js index 414a7b3..eeb1746 100644 --- a/test/functional/crashlog-commands-e2e-specs.js +++ b/test/functional/crashlog-commands-e2e-specs.js @@ -1,20 +1,21 @@ import _ from 'lodash'; -import chai from 'chai'; -import chaiAsPromised from 'chai-as-promised'; import { prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS } from '../helpers/device-helpers'; import IDB from '../../lib/idb'; - -chai.should(); -chai.use(chaiAsPromised); - describe('idb crashlog commands', function () { let idb; let simctl; + let chai; before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised.default); + simctl = await prepareDevice(); idb = new IDB({ udid: simctl.udid, diff --git a/test/functional/idb-e2e-specs.js b/test/functional/idb-e2e-specs.js index 34b5747..3d869cd 100644 --- a/test/functional/idb-e2e-specs.js +++ b/test/functional/idb-e2e-specs.js @@ -1,11 +1,6 @@ -import chai from 'chai'; -import chaiAsPromised from 'chai-as-promised'; import {prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS} from '../helpers/device-helpers'; import IDB from '../../lib/idb'; -const should = chai.should(); -chai.use(chaiAsPromised); - async function assertDeviceDescription(idb, udid) { const info = await idb.describeDevice(); info.udid.should.eql(udid); @@ -13,8 +8,16 @@ async function assertDeviceDescription(idb, udid) { describe('idb general', function () { let simctl; + let chai; + let should; before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + should = chai.should(); + chai.use(chaiAsPromised.default); + simctl = await prepareDevice({ prebooted: false, }); diff --git a/test/functional/interaction-commands-e2e-specs.js b/test/functional/interaction-commands-e2e-specs.js index 30c916a..6643d08 100644 --- a/test/functional/interaction-commands-e2e-specs.js +++ b/test/functional/interaction-commands-e2e-specs.js @@ -1,19 +1,20 @@ -import chai from 'chai'; -import chaiAsPromised from 'chai-as-promised'; import { prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS } from '../helpers/device-helpers'; import IDB from '../../lib/idb'; - -chai.should(); -chai.use(chaiAsPromised); - describe('idb interaction commands', function () { let simctl; let idb; + let chai; before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised.default); + simctl = await prepareDevice(); idb = new IDB({ udid: simctl.udid, diff --git a/test/functional/misc-commands-e2e-specs.js b/test/functional/misc-commands-e2e-specs.js index d7cf6df..26ded34 100644 --- a/test/functional/misc-commands-e2e-specs.js +++ b/test/functional/misc-commands-e2e-specs.js @@ -1,19 +1,20 @@ -import chai from 'chai'; -import chaiAsPromised from 'chai-as-promised'; import { prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS } from '../helpers/device-helpers'; import IDB from '../../lib/idb'; - -chai.should(); -chai.use(chaiAsPromised); - describe('idb misc commands', function () { let simctl; let idb; + let chai; before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised.default); + simctl = await prepareDevice(); idb = new IDB({ udid: simctl.udid, diff --git a/test/functional/xctest-commands-e2e-specs.js b/test/functional/xctest-commands-e2e-specs.js index 1e5556e..859726c 100644 --- a/test/functional/xctest-commands-e2e-specs.js +++ b/test/functional/xctest-commands-e2e-specs.js @@ -1,6 +1,4 @@ -import chai from 'chai'; import path from 'path'; -import chaiAsPromised from 'chai-as-promised'; import axios from 'axios'; import { prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS @@ -8,10 +6,6 @@ import { import IDB from '../../lib/idb'; import { retryInterval } from 'asyncbox'; - -chai.should(); -chai.use(chaiAsPromised); - const WDA_BUNDLE_ID = 'com.facebook.WebDriverAgentRunner.xctrunner'; const WDA_BUNDLE_PATH = path.resolve(__dirname, '..', 'asset', 'WebDriverAgentRunner-Runner.app'); const XCTEST_BUNDLE_PATH = path.join(WDA_BUNDLE_PATH, 'PlugIns', 'WebDriverAgentRunner.xctest'); @@ -20,8 +14,15 @@ const SAFARI_BUNDLE_ID = 'com.apple.mobilesafari'; describe('idb xctest commands', function () { let simctl; let idb; + let chai; before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised.default); + simctl = await prepareDevice(); idb = new IDB({ udid: simctl.udid, diff --git a/test/unit/helpers-specs.js b/test/unit/helpers-specs.js index f12ec64..cf988c2 100644 --- a/test/unit/helpers-specs.js +++ b/test/unit/helpers-specs.js @@ -1,14 +1,19 @@ -import chai from 'chai'; -import chaiAsPromised from 'chai-as-promised'; import { fixOutputToArray, convertToIDBEnv } from '../../lib/helpers'; import _ from 'lodash'; -chai.should(); -chai.use(chaiAsPromised); - describe('helpers', function () { + let chai; + + before(async function () { + chai = await import('chai'); + const chaiAsPromised = await import('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised.default); + }); + describe('fixOutputToArray', function () { it('should properly fix the valid output', function () { const result = fixOutputToArray(`