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: Bump chai and chai-as-promised #913

Merged
merged 1 commit into from
Jun 20, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,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:
Expand Down
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,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",
"appium-xcode": "^5.0.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"chai": "^5.1.1",
"chai-as-promised": "^8.0.0",
"conventional-changelog-conventionalcommits": "^8.0.0",
"fancy-log": "^2.0.0",
"node-simctl": "^7.0.1",
Expand Down
15 changes: 8 additions & 7 deletions test/functional/webdriveragent-e2e-specs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import Simctl from 'node-simctl';
import { getVersion } from 'appium-xcode';
import { getSimulator } from 'appium-ios-simulator';
Expand All @@ -15,10 +13,6 @@ const MOCHA_TIMEOUT_MS = 60 * 1000 * 4;
const SIM_DEVICE_NAME = 'webDriverAgentTest';
const SIM_STARTUP_TIMEOUT_MS = MOCHA_TIMEOUT_MS;


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

let testUrl = 'http://localhost:8100/tree';

function getStartOpts (device) {
Expand All @@ -36,9 +30,16 @@ function getStartOpts (device) {

describe('WebDriverAgent', function () {
this.timeout(MOCHA_TIMEOUT_MS);

let chai;
let xcodeVersion;

before(async function () {
chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');

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

// Don't do these tests on Sauce Labs
if (process.env.CLOUD) {
this.skip();
Expand Down
15 changes: 10 additions & 5 deletions test/unit/utils-specs.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
import { getXctestrunFilePath, getAdditionalRunContent, getXctestrunFileName } from '../../lib/utils';
import { PLATFORM_NAME_IOS, PLATFORM_NAME_TVOS } from '../../lib/constants';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { withMocks } from '@appium/test-support';
import { fs } from '@appium/support';
import path from 'path';
import { fail } from 'assert';
import { arch } from 'os';

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

function get_arch() {
return arch() === 'arm64' ? 'arm64' : 'x86_64';
}

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

before(async function() {
chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');

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

describe('#getXctestrunFilePath', withMocks({fs}, function (mocks) {
const platformVersion = '12.0';
const sdkVersion = '12.2';
Expand Down
16 changes: 10 additions & 6 deletions test/unit/webdriveragent-specs.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { BOOTSTRAP_PATH } from '../../lib/utils';
import { WebDriverAgent } from '../../lib/webdriveragent';
import * as utils from '../../lib/utils';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import path from 'path';
import _ from 'lodash';
import sinon from 'sinon';


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

const fakeConstructorArgs = {
device: 'some sim',
platformVersion: '9',
Expand All @@ -25,6 +19,16 @@ const customAgentPath = '/path/to/some/agent/WebDriverAgent.xcodeproj';
const customDerivedDataPath = '/path/to/some/agent/DerivedData/';

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

before(async function() {
chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');

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

it('should have a default wda agent if not specified', function () {
let agent = new WebDriverAgent({}, fakeConstructorArgs);
agent.bootstrapPath.should.eql(BOOTSTRAP_PATH);
Expand Down
Loading