@@ -8,9 +8,11 @@ import { BrowserHandle, BrowserPool } from './browser';
8
8
import { AvaContext , TestContext , getDebugHtmlAtts , minutes , standaloneTestTimeout } from './tests/tooling' ;
9
9
import { Util , getParsedCliParams } from './util' ;
10
10
11
- import { mkdirSync , realpathSync , writeFileSync } from 'fs' ;
11
+ import { mkdirSync , realpathSync } from 'fs' ;
12
+ import { writeFile } from 'fs/promises' ;
12
13
import { TestUrls } from './browser/test-urls' ;
13
14
import { startAllApisMock } from './mock/all-apis-mock' ;
15
+ import { reportedErrors } from './mock/fes/shared-tenant-fes-endpoints' ;
14
16
import { defineComposeTests } from './tests/compose' ;
15
17
import { defineContentScriptTests } from './tests/content-script' ;
16
18
import { defineDecryptTests } from './tests/decrypt' ;
@@ -21,7 +23,6 @@ import { defineSettingsTests } from './tests/settings';
21
23
import { defineSetupTests } from './tests/setup' ;
22
24
import { defineUnitBrowserTests } from './tests/unit-browser' ;
23
25
import { defineUnitNodeTests } from './tests/unit-node' ;
24
- import { reportedErrors } from './mock/fes/shared-tenant-fes-endpoints' ;
25
26
26
27
export const { testVariant, testGroup, oneIfNotPooled, buildDir, isMock } = getParsedCliParams ( ) ;
27
28
export const internalTestState = { expectIntentionalErrReport : false } ; // updated when a particular test that causes an error is run
@@ -106,7 +107,6 @@ const startMockApiAndCopyBuild = async (t: AvaContext) => {
106
107
const address = mockApi . server . address ( ) ;
107
108
if ( typeof address === 'object' && address ) {
108
109
const result = await asyncExec ( `sh ./scripts/config-mock-build.sh ${ buildDir } ${ address . port } ` ) ;
109
-
110
110
t . context . extensionDir = result . stdout ;
111
111
t . context . urls = new TestUrls ( await browserPool . getExtensionId ( t ) , address . port ) ;
112
112
} else {
@@ -128,7 +128,7 @@ const saveBrowserLog = async (t: AvaContext, browser: BrowserHandle) => {
128
128
const input = JSON . stringify ( item . input ) ;
129
129
const output = JSON . stringify ( item . output , undefined , 2 ) ;
130
130
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 } ` ) ;
132
132
t . log ( `browser debug written to file: ${ file } ` ) ;
133
133
}
134
134
} catch ( e ) {
@@ -219,7 +219,7 @@ test.afterEach.always('finalize', async t => {
219
219
const fileName = `debugHtmlAttachment-${ testVariant } -${ failRnd } -${ i } .html` ;
220
220
const filePath = `${ debugArtifactDir } /${ fileName } ` ;
221
221
console . info ( `Writing debug file ${ fileName } ` ) ;
222
- writeFileSync ( filePath , debugHtmlAttachments [ i ] ) ;
222
+ await writeFile ( filePath , debugHtmlAttachments [ i ] ) ;
223
223
try {
224
224
await asyncExec ( `artifact push job ${ filePath } ` ) ;
225
225
} catch {
0 commit comments