File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/* eslint-disable no-console, n/no-restricted-import */
22
3- import * as fs from 'fs' ;
4-
53import { dataCache } from '../framework/data_cache.js' ;
64import { getResourcePath , setBaseResourcePath } from '../framework/resources.js' ;
75import { globalTestConfig } from '../framework/test_config.js' ;
@@ -152,13 +150,16 @@ Did you remember to build with code coverage instrumentation enabled?`
152150dataCache . setStore ( {
153151 load : ( path : string ) => {
154152 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+ }
160161 }
161- } ) ;
162+ ) ;
162163 } ) ;
163164 } ,
164165} ) ;
Original file line number Diff line number Diff line change 33
44function node ( ) {
55 /* eslint-disable-next-line n/no-restricted-require */
6- const { existsSync } = require ( 'fs' ) ;
6+ const { readFile , existsSync } = require ( 'fs' ) ;
77
88 return {
99 type : 'node' ,
10+ readFile,
1011 existsSync,
1112 args : process . argv . slice ( 2 ) ,
1213 cwd : ( ) => process . cwd ( ) ,
@@ -16,6 +17,10 @@ function node() {
1617
1718declare global {
1819 namespace Deno {
20+ function readFile (
21+ path : string ,
22+ callback ?: ( error : unknown , data : string ) => void
23+ ) : Promise < Uint8Array > ;
1924 function readFileSync ( path : string ) : Uint8Array ;
2025 const args : string [ ] ;
2126 const cwd : ( ) => string ;
@@ -36,6 +41,7 @@ function deno() {
3641 return {
3742 type : 'deno' ,
3843 existsSync,
44+ readFile : Deno . readFile ,
3945 args : Deno . args ,
4046 cwd : Deno . cwd ,
4147 exit : Deno . exit ,
You can’t perform that action at this time.
0 commit comments