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 #182

Merged
merged 1 commit into from
Jun 19, 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 @@ -5,11 +5,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:
runs-on: ubuntu-latest
Expand Down
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,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.1",
"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",
"prettier": "^3.0.0",
Expand Down
10 changes: 6 additions & 4 deletions test/afc/afc-specs.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import chai from 'chai';
import AfcService from '../../lib/afc';
import { getServerWithFixtures, fixtures } from '../fixtures';


chai.should();

describe('afc', function () {
let server;
let socket;
let service;
let chai;

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

afterEach(function () {
service.close();
Expand Down
47 changes: 27 additions & 20 deletions test/imagemounter/list-developer-image-specs.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { findDeveloperImage } from '../../lib/imagemounter/utils/list_developer_image';
import { fs } from '@appium/support';
chai.should();
chai.use(chaiAsPromised);


describe('findDeveloperImage', function () {
it('should download and return the correct developer image for a given version', async function () {
const result = await findDeveloperImage('14.7.1', {
githubRepo: 'appium/appium-ios-device',
subFolderList: ['test', 'imagemounter'],
branch: 'master'
});
result.developerImage.endsWith('/DeveloperDiskImage.dmg').should.be.true;
result.developerImageSignature.endsWith('/DeveloperDiskImage.dmg.signature').should.be.true;
(await fs.exists(result.developerImage)).should.be.true;
(await fs.exists(result.developerImageSignature)).should.be.true;
});
let chai;

it('should throw an error if the developer image cannot be found', function () {
findDeveloperImage('99.99.99', {
githubRepo: 'appium/appium-ios-device',
subFolderList: ['test', 'imagemounter']
}).should.be.rejectedWith('Failed to get developer image for iOS 99.99');
before(async function () {
chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');
chai.should();
chai.use(chaiAsPromised.default);
});

it('should download and return the correct developer image for a given version', async function () {
const result = await findDeveloperImage('14.7.1', {
githubRepo: 'appium/appium-ios-device',
subFolderList: ['test', 'imagemounter'],
branch: 'master'
});
result.developerImage.endsWith('/DeveloperDiskImage.dmg').should.be.true;
result.developerImageSignature.endsWith('/DeveloperDiskImage.dmg.signature').should.be.true;
(await fs.exists(result.developerImage)).should.be.true;
(await fs.exists(result.developerImageSignature)).should.be.true;
});

it('should throw an error if the developer image cannot be found', function () {
findDeveloperImage('99.99.99', {
githubRepo: 'appium/appium-ios-device',
subFolderList: ['test', 'imagemounter']
}).should.be.rejectedWith('Failed to get developer image for iOS 99.99');
});
});
10 changes: 6 additions & 4 deletions test/installation-proxy/installation-proxy-service-specs.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import chai from 'chai';
import InstallationServiceProxy from '../../lib/installation-proxy';
import PlistService from '../../lib/plist-service';
import { getServerWithFixtures, fixtures } from '../fixtures';


chai.should();

describe('installation proxy', function () {
let server;
let socket;
let installationServiceProxy;
let chai;

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

afterEach(function () {
if (installationServiceProxy) {
Expand Down
10 changes: 6 additions & 4 deletions test/instrument/instrument-service-specs.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import chai from 'chai';
import {InstrumentService, INSTRUMENT_CHANNEL} from '../../lib/instrument';
import { getServerWithFixtures, fixtures } from '../fixtures';
import B from 'bluebird';


chai.should();

describe('instrument', function () {
let server;
let socket;
let instrumentService;
const pid = 6385;
let chai;

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

afterEach(function () {
if (instrumentService) {
Expand Down
10 changes: 6 additions & 4 deletions test/instrument/nskeyed-specs.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import chai from 'chai';
import {unarchive, archive, NSURL, NSUUID, NSDate} from '../../lib/instrument/transformer/nskeyed';
import {v4} from 'uuid';


chai.should();

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

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

it('should parses JavaScript objects into iOS NSKeyedArchive data', function () {
const data = {
Expand Down
14 changes: 8 additions & 6 deletions test/lockdown/lockdown-specs.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { Lockdown } from '../../lib/lockdown';
import { PlistService } from '../../lib/plist-service';
import { getServerWithFixtures, fixtures } from '../fixtures';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';


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

describe('lockdown', function () {
let server;
let socket;
let chai;

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

afterEach(function () {
try {
Expand Down
10 changes: 6 additions & 4 deletions test/syslog/syslog-service-specs.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import B from 'bluebird';
import chai from 'chai';
import SyslogService from '../../lib/syslog';
import { getServerWithFixtures, fixtures } from '../fixtures';
import { toUtf8String } from '../../lib/syslog/transformer/syslog-decoder';


chai.should();

describe('syslog', function () {
let server;
let socket;
let syslogService;
let chai;

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

afterEach(function () {
syslogService?.close();
Expand Down
10 changes: 6 additions & 4 deletions test/usbmux/usbmux-specs.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { Usbmux } from '../..';
import chai from 'chai';
import { getServerWithFixtures, fixtures, UDID } from '../fixtures';


chai.should();

describe('usbmux', function () {
let usbmux;
let server;
let socket;
let chai;

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

afterEach(function () {
try {
Expand Down
9 changes: 6 additions & 3 deletions test/utilities-specs.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { utilities } from '..';
import chai from 'chai';
import { getServerWithFixtures, fixtures, UDID } from './fixtures';


chai.should();

describe('utilities', function () {
let server;
let socket;
let chai;

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

afterEach(function () {
if (server) {
Expand Down
10 changes: 6 additions & 4 deletions test/webinspector/webinspector-helpers-specs.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import chai from 'chai';
import { cleanupRpcObject } from '../../lib/webinspector';


chai.should();

describe('webinspector helpers', function () {
let chai;

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

it('should cleanup an rpc object', function () {
cleanupRpcObject({
Expand Down
10 changes: 6 additions & 4 deletions test/webinspector/webinspector-service-specs.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import chai from 'chai';
import B from 'bluebird';
import semver from 'semver';
import WebInspectorService from '../../lib/webinspector';
import { getServerWithFixtures, fixtures } from '../fixtures';


chai.should();

describe('webinspector', function () {
let server;
let socket;
let webInspectorService;
let chai;

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

afterEach(function () {
if (webInspectorService) {
Expand Down
Loading