@@ -103,14 +103,14 @@ impl Snapshot {
103103mod tests {
104104 use std:: sync:: Arc ;
105105
106- use rspack_fs:: { MemoryFileSystem , SyncWritableFileSystem } ;
106+ use rspack_fs:: { MemoryFileSystem , WritableFileSystem } ;
107107 use rspack_paths:: Utf8PathBuf ;
108108
109109 use super :: super :: MemoryStorage ;
110110 use super :: { PathMatcher , Snapshot , SnapshotOptions } ;
111111
112- #[ test]
113- fn should_snapshot_work ( ) {
112+ #[ tokio :: test]
113+ async fn should_snapshot_work ( ) {
114114 let fs = Arc :: new ( MemoryFileSystem :: default ( ) ) ;
115115 let storage = Arc :: new ( MemoryStorage :: default ( ) ) ;
116116 let options = SnapshotOptions :: new (
@@ -119,23 +119,31 @@ mod tests {
119119 vec ! [ PathMatcher :: String ( "node_modules" . into( ) ) ] ,
120120 ) ;
121121
122- fs. create_dir_all ( "/node_modules/project" . into ( ) ) . unwrap ( ) ;
123- fs. create_dir_all ( "/node_modules/lib" . into ( ) ) . unwrap ( ) ;
124- fs. write ( "/file1" . into ( ) , "abc" . as_bytes ( ) ) . unwrap ( ) ;
125- fs. write ( "/constant" . into ( ) , "abc" . as_bytes ( ) ) . unwrap ( ) ;
122+ fs. create_dir_all ( "/node_modules/project" . into ( ) )
123+ . await
124+ . unwrap ( ) ;
125+ fs. create_dir_all ( "/node_modules/lib" . into ( ) ) . await . unwrap ( ) ;
126+ fs. write ( "/file1" . into ( ) , "abc" . as_bytes ( ) ) . await . unwrap ( ) ;
127+ fs. write ( "/constant" . into ( ) , "abc" . as_bytes ( ) )
128+ . await
129+ . unwrap ( ) ;
126130 fs. write (
127131 "/node_modules/project/package.json" . into ( ) ,
128132 r#"{"version":"1.0.0"}"# . as_bytes ( ) ,
129133 )
134+ . await
130135 . unwrap ( ) ;
131136 fs. write ( "/node_modules/project/file1" . into ( ) , "abc" . as_bytes ( ) )
137+ . await
132138 . unwrap ( ) ;
133139 fs. write (
134140 "/node_modules/lib/package.json" . into ( ) ,
135141 r#"{"version":"1.1.0"}"# . as_bytes ( ) ,
136142 )
143+ . await
137144 . unwrap ( ) ;
138145 fs. write ( "/node_modules/lib/file1" . into ( ) , "abc" . as_bytes ( ) )
146+ . await
139147 . unwrap ( ) ;
140148
141149 let snapshot = Snapshot :: new ( options, fs. clone ( ) , storage) ;
@@ -149,11 +157,15 @@ mod tests {
149157 . iter ( ) ,
150158 ) ;
151159 std:: thread:: sleep ( std:: time:: Duration :: from_millis ( 100 ) ) ;
152- fs. write ( "/file1" . into ( ) , "abcd" . as_bytes ( ) ) . unwrap ( ) ;
153- fs. write ( "/constant" . into ( ) , "abcd" . as_bytes ( ) ) . unwrap ( ) ;
160+ fs. write ( "/file1" . into ( ) , "abcd" . as_bytes ( ) ) . await . unwrap ( ) ;
161+ fs. write ( "/constant" . into ( ) , "abcd" . as_bytes ( ) )
162+ . await
163+ . unwrap ( ) ;
154164 fs. write ( "/node_modules/project/file1" . into ( ) , "abcd" . as_bytes ( ) )
165+ . await
155166 . unwrap ( ) ;
156167 fs. write ( "/node_modules/lib/file1" . into ( ) , "abcd" . as_bytes ( ) )
168+ . await
157169 . unwrap ( ) ;
158170
159171 let ( modified_paths, deleted_paths) = snapshot. calc_modified_paths ( ) ;
@@ -167,6 +179,7 @@ mod tests {
167179 "/node_modules/lib/package.json" . into ( ) ,
168180 r#"{"version":"1.3.0"}"# . as_bytes ( ) ,
169181 )
182+ . await
170183 . unwrap ( ) ;
171184 snapshot. add ( [ "/file1" . into ( ) ] . iter ( ) ) ;
172185 let ( modified_paths, deleted_paths) = snapshot. calc_modified_paths ( ) ;
0 commit comments