File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
packages/angular_devkit/core/src/virtual-fs/host Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ export class SimpleMemoryHost implements Host<{}> {
180
180
path = this . _toAbsolute ( path ) ;
181
181
if ( this . _isDirectory ( path ) ) {
182
182
for ( const [ cachePath ] of this . _cache . entries ( ) ) {
183
- if ( path . startsWith ( cachePath + NormalizedSep ) ) {
183
+ if ( cachePath . startsWith ( path ) ) {
184
184
this . _cache . delete ( cachePath ) ;
185
185
}
186
186
}
Original file line number Diff line number Diff line change @@ -65,6 +65,19 @@ describe('SimpleMemoryHost', () => {
65
65
expect ( host . exists ( normalize ( '/sub/file1' ) ) ) . toBe ( false ) ;
66
66
} ) ;
67
67
68
+ it ( 'can delete directory' , ( ) => {
69
+ const host = new SyncDelegateHost ( new SimpleMemoryHost ( ) ) ;
70
+
71
+ const buffer = stringToFileBuffer ( 'hello' ) ;
72
+
73
+ expect ( host . exists ( normalize ( '/sub/file1' ) ) ) . toBe ( false ) ;
74
+ host . write ( normalize ( '/sub/file1' ) , buffer ) ;
75
+ expect ( host . exists ( normalize ( '/sub/file1' ) ) ) . toBe ( true ) ;
76
+ host . delete ( normalize ( '/sub' ) ) ;
77
+ expect ( host . exists ( normalize ( '/sub/file1' ) ) ) . toBe ( false ) ;
78
+ expect ( host . exists ( normalize ( '/sub' ) ) ) . toBe ( false ) ;
79
+ } ) ;
80
+
68
81
it ( 'can rename' , ( ) => {
69
82
const host = new SyncDelegateHost ( new SimpleMemoryHost ( ) ) ;
70
83
You can’t perform that action at this time.
0 commit comments