1- import { readFile , writeFile } from 'node:fs/promises'
1+ import { readFile } from 'node:fs/promises'
22import { join } from 'node:path'
33import { expect , test } from '@playwright/test'
4- import { writeJson } from '../../../../tests/e2e/utils/fs'
4+ import { writeJson , writeTextFile } from '../../../../tests/e2e/utils/fs'
55import { repoRoot } from '../../../../tests/e2e/utils/paths'
66
77const mockDir = join ( repoRoot , 'apps/mokup-web-demo/mock' )
@@ -24,7 +24,7 @@ async function backupFile(filePath: string) {
2424
2525async function restoreAll ( ) {
2626 for ( const backup of backups . reverse ( ) ) {
27- await writeFile ( backup . path , backup . content , 'utf8' )
27+ await writeTextFile ( backup . path , backup . content )
2828 }
2929 backups . length = 0
3030}
@@ -108,7 +108,7 @@ test.describe('edit JSON mock files', () => {
108108 '}' ,
109109 '' ,
110110 ] . join ( '\n' )
111- await writeFile ( filePath , newContent , 'utf8' )
111+ await writeTextFile ( filePath , newContent )
112112
113113 await pollApi ( request , '/api/about' , body => body [ 'e2e' ] === stamp )
114114 } )
@@ -200,7 +200,7 @@ test.describe('edit TS handler mock files', () => {
200200 'export default rule' ,
201201 '' ,
202202 ] . join ( '\n' )
203- await writeFile ( filePath , newContent , 'utf8' )
203+ await writeTextFile ( filePath , newContent )
204204
205205 await pollApi ( request , '/api/health' , body => body [ 'marker' ] === marker )
206206 } )
@@ -220,7 +220,7 @@ test.describe('edit TS handler mock files', () => {
220220 'export default rule' ,
221221 '' ,
222222 ] . join ( '\n' )
223- await writeFile ( filePath , newContent , 'utf8' )
223+ await writeTextFile ( filePath , newContent )
224224
225225 await pollApi ( request , '/api/override' , body => body [ 'marker' ] === marker )
226226 } )
@@ -242,7 +242,7 @@ test.describe('edit TS handler mock files', () => {
242242 'export default rule' ,
243243 '' ,
244244 ] . join ( '\n' )
245- await writeFile ( filePath , newContent , 'utf8' )
245+ await writeTextFile ( filePath , newContent )
246246
247247 await pollApi ( request , '/api/search' , body => body [ 'marker' ] === marker )
248248 } )
@@ -269,7 +269,7 @@ test.describe('edit TS handler mock files', () => {
269269 'export default rule' ,
270270 '' ,
271271 ] . join ( '\n' )
272- await writeFile ( filePath , newContent , 'utf8' )
272+ await writeTextFile ( filePath , newContent )
273273
274274 await expect . poll ( async ( ) => {
275275 try {
@@ -306,7 +306,7 @@ test.describe('edit TS handler mock files', () => {
306306 'export default rule' ,
307307 '' ,
308308 ] . join ( '\n' )
309- await writeFile ( filePath , newContent , 'utf8' )
309+ await writeTextFile ( filePath , newContent )
310310
311311 await pollApi ( request , '/api/users/42' , body => body [ 'marker' ] === marker && body [ 'id' ] === '42' )
312312 } )
0 commit comments