Skip to content

Commit

Permalink
chore: Bump chai and chai-as-promised (#387)
Browse files Browse the repository at this point in the history
* chore: Bump chai and chai-as-promised

* fix lint
  • Loading branch information
KazuCocoa authored Jun 20, 2024
1 parent fb57c73 commit 3a361e2
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 41 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,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.0",
"appium-ios-simulator": "^6.1.2",
"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",
"mocha-junit-reporter": "^2.0.0",
Expand Down
12 changes: 6 additions & 6 deletions test/functional/safari-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@ import { getSimulator } from 'appium-ios-simulator';
import { retryInterval, retry } from 'asyncbox';
import { util } from '@appium/support';
import _ from 'lodash';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { createRemoteDebugger } from '../../index';
import { startHttpServer, stopHttpServer } from './http-server';


chai.should();
chai.use(chaiAsPromised);

const SIM_NAME = process.env.SIM_DEVICE_NAME || `appium-test-${util.uuidV4()}`;
const DEVICE_NAME = process.env.DEVICE_NAME || 'iPhone 15';
const PLATFORM_VERSION = process.env.PLATFORM_VERSION || '17.2';
Expand Down Expand Up @@ -41,10 +35,16 @@ describe('Safari remote debugger', function () {
this.timeout(480000);
this.retries(2);

let chai;
let sim;
let simCreated = false;
let address;
before(async function () {
chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');
chai.should();
chai.use(chaiAsPromised.default);

sim = await getExistingSim(DEVICE_NAME, PLATFORM_VERSION);
if (!sim) {
const udid = await new Simctl().createDevice(SIM_NAME, DEVICE_NAME, PLATFORM_VERSION);
Expand Down
12 changes: 7 additions & 5 deletions test/unit/mixins/execute-specs.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { MOCHA_TIMEOUT } from '../../helpers/helpers';
import exec from '../../../lib/mixins/execute';
import sinon from 'sinon';

const { executeAtom, executeAtomAsync, callFunction, execute } = exec;

chai.should();
chai.use(chaiAsPromised);

describe('execute', function () {
this.timeout(MOCHA_TIMEOUT);

let chai;

before(async function () {
chai = await import('chai');
chai.should();
});

describe('executeAtom', function () {
it('should execute atom and call send event on rpc client', async function () {
const ctx = {
Expand Down
12 changes: 7 additions & 5 deletions test/unit/mixins/navigate-specs.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import RemoteDebugger from '../../../lib/remote-debugger';

chai.should();
chai.use(chaiAsPromised);

describe('navigate', function () {
let chai;

before(async function () {
chai = await import('chai');
chai.should();
});

describe('isPageLoadingCompleted', function () {
const BUNDLE_ID = 'com.apple.mobilesafari';

Expand Down
10 changes: 6 additions & 4 deletions test/unit/remote-messages-specs.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import RemoteMessages from '../../lib/rpc/remote-messages';
import chai from 'chai';
import { MOCHA_TIMEOUT } from '../helpers/helpers';


chai.should();

describe('RemoteMessages', function () {
this.timeout(MOCHA_TIMEOUT);

let chai;
const remoteMessages = new RemoteMessages();

before(async function () {
chai = await import('chai');
chai.should();
});

describe('getRemoteCommand', function () {
const commands = [
'setConnectionKey', 'connectToApp', 'setSenderKey', 'indicateWebView',
Expand Down
14 changes: 9 additions & 5 deletions test/unit/rpc/rpc-client-specs.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import sinon from 'sinon';
import { MOCHA_TIMEOUT } from '../../helpers/helpers';
import RpcClient from '../../../lib/rpc/rpc-client';

chai.should();
chai.use(chaiAsPromised);

describe('rpc-client', function () {
this.timeout(MOCHA_TIMEOUT);

let chai;

before(async function () {
chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');
chai.should();
chai.use(chaiAsPromised.default);
});

describe('.send', function () {
it('should send RPC message to device', async function () {
});
Expand Down
17 changes: 10 additions & 7 deletions test/unit/utils-specs.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import {
pageArrayFromDict, checkParams, appInfoFromDict, getDebuggerAppKey, getPossibleDebuggerAppKeys
} from '../../lib/utils';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import _ from 'lodash';
import { MOCHA_TIMEOUT } from '../helpers/helpers';


const expect = chai.expect;
chai.should();
chai.use(chaiAsPromised);

describe('utils', function () {
this.timeout(MOCHA_TIMEOUT);
let chai;
let expect;

before(async function () {
chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');
chai.should();
chai.use(chaiAsPromised.default);
expect = chai.expect;
});

describe('appInfoFromDict', function () {
it('should return the id and entry for a dict', function () {
Expand Down

0 comments on commit 3a361e2

Please sign in to comment.