@@ -8,9 +8,11 @@ import { BrowserHandle, BrowserPool } from './browser';
88import { AvaContext , TestContext , getDebugHtmlAtts , minutes , standaloneTestTimeout } from './tests/tooling' ;
99import { Util , getParsedCliParams } from './util' ;
1010
11- import { mkdirSync , realpathSync , writeFileSync } from 'fs' ;
11+ import { mkdirSync , realpathSync } from 'fs' ;
12+ import { writeFile } from 'fs/promises' ;
1213import { TestUrls } from './browser/test-urls' ;
1314import { startAllApisMock } from './mock/all-apis-mock' ;
15+ import { reportedErrors } from './mock/fes/shared-tenant-fes-endpoints' ;
1416import { defineComposeTests } from './tests/compose' ;
1517import { defineContentScriptTests } from './tests/content-script' ;
1618import { defineDecryptTests } from './tests/decrypt' ;
@@ -21,7 +23,6 @@ import { defineSettingsTests } from './tests/settings';
2123import { defineSetupTests } from './tests/setup' ;
2224import { defineUnitBrowserTests } from './tests/unit-browser' ;
2325import { defineUnitNodeTests } from './tests/unit-node' ;
24- import { reportedErrors } from './mock/fes/shared-tenant-fes-endpoints' ;
2526
2627export const { testVariant, testGroup, oneIfNotPooled, buildDir, isMock } = getParsedCliParams ( ) ;
2728export const internalTestState = { expectIntentionalErrReport : false } ; // updated when a particular test that causes an error is run
@@ -106,7 +107,6 @@ const startMockApiAndCopyBuild = async (t: AvaContext) => {
106107 const address = mockApi . server . address ( ) ;
107108 if ( typeof address === 'object' && address ) {
108109 const result = await asyncExec ( `sh ./scripts/config-mock-build.sh ${ buildDir } ${ address . port } ` ) ;
109-
110110 t . context . extensionDir = result . stdout ;
111111 t . context . urls = new TestUrls ( await browserPool . getExtensionId ( t ) , address . port ) ;
112112 } else {
@@ -128,7 +128,7 @@ const saveBrowserLog = async (t: AvaContext, browser: BrowserHandle) => {
128128 const input = JSON . stringify ( item . input ) ;
129129 const output = JSON . stringify ( item . output , undefined , 2 ) ;
130130 const file = `./test/tmp/${ t . title } -${ i } .txt` ;
131- writeFileSync ( file , `in: ${ input } \n\nout: ${ output } ` ) ;
131+ await writeFile ( file , `in: ${ input } \n\nout: ${ output } ` ) ;
132132 t . log ( `browser debug written to file: ${ file } ` ) ;
133133 }
134134 } catch ( e ) {
@@ -219,7 +219,7 @@ test.afterEach.always('finalize', async t => {
219219 const fileName = `debugHtmlAttachment-${ testVariant } -${ failRnd } -${ i } .html` ;
220220 const filePath = `${ debugArtifactDir } /${ fileName } ` ;
221221 console . info ( `Writing debug file ${ fileName } ` ) ;
222- writeFileSync ( filePath , debugHtmlAttachments [ i ] ) ;
222+ await writeFile ( filePath , debugHtmlAttachments [ i ] ) ;
223223 try {
224224 await asyncExec ( `artifact push job ${ filePath } ` ) ;
225225 } catch {
0 commit comments