File tree 2 files changed +16
-9
lines changed
2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable no-console, n/no-restricted-import */
2
2
3
- import * as fs from 'fs' ;
4
-
5
3
import { dataCache } from '../framework/data_cache.js' ;
6
4
import { getResourcePath , setBaseResourcePath } from '../framework/resources.js' ;
7
5
import { globalTestConfig } from '../framework/test_config.js' ;
@@ -152,13 +150,16 @@ Did you remember to build with code coverage instrumentation enabled?`
152
150
dataCache . setStore ( {
153
151
load : ( path : string ) => {
154
152
return new Promise < Uint8Array > ( ( resolve , reject ) => {
155
- fs . readFile ( getResourcePath ( `cache/${ path } ` ) , ( err , data ) => {
156
- if ( err !== null ) {
157
- reject ( err . message ) ;
158
- } else {
159
- resolve ( data ) ;
153
+ sys . readFile (
154
+ getResourcePath ( `cache/${ path } ` ) ,
155
+ ( err : { message : string } , data : Uint8Array ) => {
156
+ if ( err !== null ) {
157
+ reject ( err . message ) ;
158
+ } else {
159
+ resolve ( data ) ;
160
+ }
160
161
}
161
- } ) ;
162
+ ) ;
162
163
} ) ;
163
164
} ,
164
165
} ) ;
Original file line number Diff line number Diff line change 3
3
4
4
function node ( ) {
5
5
/* eslint-disable-next-line n/no-restricted-require */
6
- const { existsSync } = require ( 'fs' ) ;
6
+ const { readFile , existsSync } = require ( 'fs' ) ;
7
7
8
8
return {
9
9
type : 'node' ,
10
+ readFile,
10
11
existsSync,
11
12
args : process . argv . slice ( 2 ) ,
12
13
cwd : ( ) => process . cwd ( ) ,
@@ -16,6 +17,10 @@ function node() {
16
17
17
18
declare global {
18
19
namespace Deno {
20
+ function readFile (
21
+ path : string ,
22
+ callback ?: ( error : unknown , data : string ) => void
23
+ ) : Promise < Uint8Array > ;
19
24
function readFileSync ( path : string ) : Uint8Array ;
20
25
const args : string [ ] ;
21
26
const cwd : ( ) => string ;
@@ -36,6 +41,7 @@ function deno() {
36
41
return {
37
42
type : 'deno' ,
38
43
existsSync,
44
+ readFile : Deno . readFile ,
39
45
args : Deno . args ,
40
46
cwd : Deno . cwd ,
41
47
exit : Deno . exit ,
You can’t perform that action at this time.
0 commit comments