File tree 2 files changed +12
-1
lines changed
packages/angular_devkit/core/node
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -136,12 +136,13 @@ export class NodeJsAsyncHost implements virtualFs.Host<Stats> {
136
136
}
137
137
138
138
exists ( path : Path ) : Observable < boolean > {
139
- return observableFrom ( exists ( path ) ) ;
139
+ return observableFrom ( exists ( getSystemPath ( path ) ) ) ;
140
140
}
141
141
142
142
isDirectory ( path : Path ) : Observable < boolean > {
143
143
return this . stat ( path ) . pipe ( map ( ( stat ) => stat . isDirectory ( ) ) ) ;
144
144
}
145
+
145
146
isFile ( path : Path ) : Observable < boolean > {
146
147
return this . stat ( path ) . pipe ( map ( ( stat ) => stat . isFile ( ) ) ) ;
147
148
}
@@ -267,6 +268,7 @@ export class NodeJsSyncHost implements virtualFs.Host<Stats> {
267
268
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
268
269
return this . stat ( path ) ! . pipe ( map ( ( stat ) => stat . isDirectory ( ) ) ) ;
269
270
}
271
+
270
272
isFile ( path : Path ) : Observable < boolean > {
271
273
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
272
274
return this . stat ( path ) ! . pipe ( map ( ( stat ) => stat . isFile ( ) ) ) ;
Original file line number Diff line number Diff line change @@ -30,8 +30,17 @@ describe('NodeJsAsyncHost', () => {
30
30
root = temp . mkdirSync ( 'core-node-spec-' ) ;
31
31
host = new virtualFs . ScopedHost ( new NodeJsAsyncHost ( ) , normalize ( root ) ) ;
32
32
} ) ;
33
+
33
34
afterEach ( ( done ) => host . delete ( normalize ( '/' ) ) . toPromise ( ) . then ( done , done . fail ) ) ;
34
35
36
+ it ( 'should get correct result for exists' , async ( ) => {
37
+ let isExists = await host . exists ( normalize ( 'not-found' ) ) . toPromise ( ) ;
38
+ expect ( isExists ) . toBe ( false ) ;
39
+ await host . write ( normalize ( 'not-found' ) , virtualFs . stringToFileBuffer ( 'content' ) ) . toPromise ( ) ;
40
+ isExists = await host . exists ( normalize ( 'not-found' ) ) . toPromise ( ) ;
41
+ expect ( isExists ) . toBe ( true ) ;
42
+ } ) ;
43
+
35
44
linuxOnlyIt (
36
45
'can watch' ,
37
46
( done ) => {
You can’t perform that action at this time.
0 commit comments