1- import chai , { expect } from 'chai' ;
2- import chaiAsPromised from 'chai-as-promised' ;
1+ import assert from 'node:assert/strict' ;
32import { getXctestrunFilePath , getAdditionalRunContent , getXctestrunFileName } from '../../lib/utils' ;
43import { PLATFORM_NAME_IOS , PLATFORM_NAME_TVOS } from '../../lib/constants' ;
54import { fs } from '@appium/support' ;
@@ -8,8 +7,7 @@ import {fail} from 'node:assert';
87import { arch } from 'node:os' ;
98import sinon from 'sinon' ;
109import type { DeviceInfo } from '../../lib/types' ;
11-
12- chai . use ( chaiAsPromised ) ;
10+ import { describe , beforeEach , afterEach , it } from 'node:test' ;
1311
1412function get_arch ( ) : string {
1513 return arch ( ) === 'arm64' ? 'arm64' : 'x86_64' ;
@@ -39,7 +37,8 @@ describe('utils', function () {
3937 . resolves ( true ) ;
4038 sandbox . stub ( fs , 'copyFile' ) ;
4139 const deviceInfo : DeviceInfo = { isRealDevice : true , udid, platformVersion, platformName} ;
42- await expect ( getXctestrunFilePath ( deviceInfo , sdkVersion , bootstrapPath ) ) . to . eventually . equal (
40+ assert . strictEqual (
41+ await getXctestrunFilePath ( deviceInfo , sdkVersion , bootstrapPath ) ,
4342 path . resolve ( `${ bootstrapPath } /${ udid } _${ sdkVersion } .xctestrun` ) ,
4443 ) ;
4544 sandbox . assert . notCalled ( fs . copyFile as any ) ;
@@ -72,7 +71,8 @@ describe('utils', function () {
7271 platformVersion,
7372 platformName : PLATFORM_NAME_IOS ,
7473 } ;
75- await expect ( getXctestrunFilePath ( deviceInfo , sdkVersion , bootstrapPath ) ) . to . eventually . equal (
74+ assert . strictEqual (
75+ await getXctestrunFilePath ( deviceInfo , sdkVersion , bootstrapPath ) ,
7676 path . resolve ( `${ bootstrapPath } /${ udid } _${ sdkVersion } .xctestrun` ) ,
7777 ) ;
7878 } ) ;
@@ -99,7 +99,8 @@ describe('utils', function () {
9999 platformVersion,
100100 platformName : PLATFORM_NAME_IOS ,
101101 } ;
102- await expect ( getXctestrunFilePath ( deviceInfo , sdkVersion , bootstrapPath ) ) . to . eventually . equal (
102+ assert . strictEqual (
103+ await getXctestrunFilePath ( deviceInfo , sdkVersion , bootstrapPath ) ,
103104 path . resolve ( `${ bootstrapPath } /${ udid } _${ platformVersion } .xctestrun` ) ,
104105 ) ;
105106 sandbox . assert . notCalled ( fs . copyFile as any ) ;
@@ -143,7 +144,8 @@ describe('utils', function () {
143144 platformVersion,
144145 platformName : PLATFORM_NAME_IOS ,
145146 } ;
146- await expect ( getXctestrunFilePath ( deviceInfo , sdkVersion , bootstrapPath ) ) . to . eventually . equal (
147+ assert . strictEqual (
148+ await getXctestrunFilePath ( deviceInfo , sdkVersion , bootstrapPath ) ,
147149 path . resolve ( `${ bootstrapPath } /${ udid } _${ platformVersion } .xctestrun` ) ,
148150 ) ;
149151 } ) ;
@@ -164,7 +166,8 @@ describe('utils', function () {
164166 await getXctestrunFilePath ( deviceInfo , sdkVersion , bootstrapPath ) ;
165167 fail ( ) ;
166168 } catch ( err : any ) {
167- expect ( err . message ) . to . equal (
169+ assert . strictEqual (
170+ err . message ,
168171 `If you are using 'useXctestrunFile' capability then you need to have a xctestrun file (expected: '${ expected } ')` ,
169172 ) ;
170173 }
@@ -174,19 +177,20 @@ describe('utils', function () {
174177 describe ( '#getAdditionalRunContent' , function ( ) {
175178 it ( 'should return ios format' , function ( ) {
176179 const wdaPort = getAdditionalRunContent ( PLATFORM_NAME_IOS , 8000 ) ;
177- expect ( wdaPort . WebDriverAgentRunner . EnvironmentVariables . USE_PORT ) . to . equal ( '8000' ) ;
180+ assert . strictEqual ( wdaPort . WebDriverAgentRunner . EnvironmentVariables . USE_PORT , '8000' ) ;
178181 } ) ;
179182
180183 it ( 'should return tvos format' , function ( ) {
181184 const wdaPort = getAdditionalRunContent ( PLATFORM_NAME_TVOS , '9000' ) ;
182- expect ( wdaPort . WebDriverAgentRunner_tvOS . EnvironmentVariables . USE_PORT ) . to . equal ( '9000' ) ;
185+ assert . strictEqual ( wdaPort . WebDriverAgentRunner_tvOS . EnvironmentVariables . USE_PORT , '9000' ) ;
183186 } ) ;
184187
185188 it ( 'should include max HTTP request body size if provided' , function ( ) {
186189 const runContent = getAdditionalRunContent ( PLATFORM_NAME_IOS , 8000 , undefined , 1024 ) ;
187- expect (
190+ assert . strictEqual (
188191 runContent . WebDriverAgentRunner . EnvironmentVariables . MAX_HTTP_REQUEST_BODY_SIZE ,
189- ) . to . equal ( '1024' ) ;
192+ '1024' ,
193+ ) ;
190194 } ) ;
191195 } ) ;
192196
@@ -198,7 +202,8 @@ describe('utils', function () {
198202 const platformName = 'iOs' ;
199203 const deviceInfo : DeviceInfo = { isRealDevice : true , udid, platformVersion, platformName} ;
200204
201- expect ( getXctestrunFileName ( deviceInfo , '10.2.0' ) ) . to . equal (
205+ assert . strictEqual (
206+ getXctestrunFileName ( deviceInfo , '10.2.0' ) ,
202207 'WebDriverAgentRunner_iphoneos10.2.0-arm64.xctestrun' ,
203208 ) ;
204209 } ) ;
@@ -207,7 +212,8 @@ describe('utils', function () {
207212 const platformName = 'ios' ;
208213 const deviceInfo : DeviceInfo = { isRealDevice : false , udid, platformVersion, platformName} ;
209214
210- expect ( getXctestrunFileName ( deviceInfo , '10.2.0' ) ) . to . equal (
215+ assert . strictEqual (
216+ getXctestrunFileName ( deviceInfo , '10.2.0' ) ,
211217 `WebDriverAgentRunner_iphonesimulator10.2.0-${ get_arch ( ) } .xctestrun` ,
212218 ) ;
213219 } ) ;
@@ -216,7 +222,8 @@ describe('utils', function () {
216222 const platformName = 'tVos' ;
217223 const deviceInfo : DeviceInfo = { isRealDevice : true , udid, platformVersion, platformName} ;
218224
219- expect ( getXctestrunFileName ( deviceInfo , '10.2.0' ) ) . to . equal (
225+ assert . strictEqual (
226+ getXctestrunFileName ( deviceInfo , '10.2.0' ) ,
220227 'WebDriverAgentRunner_tvOS_appletvos10.2.0-arm64.xctestrun' ,
221228 ) ;
222229 } ) ;
@@ -225,7 +232,8 @@ describe('utils', function () {
225232 const platformName = 'tvOS' ;
226233 const deviceInfo : DeviceInfo = { isRealDevice : false , udid, platformVersion, platformName} ;
227234
228- expect ( getXctestrunFileName ( deviceInfo , '10.2.0' ) ) . to . equal (
235+ assert . strictEqual (
236+ getXctestrunFileName ( deviceInfo , '10.2.0' ) ,
229237 `WebDriverAgentRunner_tvOS_appletvsimulator10.2.0-${ get_arch ( ) } .xctestrun` ,
230238 ) ;
231239 } ) ;
0 commit comments