8
8
FileSystem , FileSystemUtils , RawFileSystem
9
9
} from '../../../client/common/platform/fileSystem' ;
10
10
import {
11
- FileType ,
11
+ FileStat , FileType ,
12
12
IFileSystemUtils , IRawFileSystem
13
13
} from '../../../client/common/platform/types' ;
14
14
import {
@@ -144,15 +144,23 @@ suite('Raw FileSystem', () => {
144
144
} ) ;
145
145
146
146
suite ( 'stat' , ( ) => {
147
+ function convertStat ( old : fsextra . Stats , filetype : FileType ) : FileStat {
148
+ return {
149
+ type : filetype ,
150
+ size : old . size ,
151
+ // XXX Apparently VS Code's new "fs" has granularity of seconds.
152
+ // So we round to the nearest integer.
153
+ // XXX ctime is showing up as 0.
154
+ ctime : 0 ,
155
+ //ctime: Math.round(old.ctimeMs),
156
+ mtime : Math . round ( old . mtimeMs )
157
+ } ;
158
+ }
159
+
147
160
test ( 'gets the info for an existing file' , async ( ) => {
148
161
const filename = await fix . createFile ( 'x/y/z/spam.py' , '...' ) ;
149
162
const old = await fsextra . stat ( filename ) ;
150
- const expected = {
151
- type : FileType . File ,
152
- size : old . size ,
153
- ctime : old . ctimeMs ,
154
- mtime : old . mtimeMs
155
- } ;
163
+ const expected = convertStat ( old , FileType . File ) ;
156
164
157
165
const stat = await filesystem . stat ( filename ) ;
158
166
@@ -162,12 +170,7 @@ suite('Raw FileSystem', () => {
162
170
test ( 'gets the info for an existing directory' , async ( ) => {
163
171
const dirname = await fix . createDirectory ( 'x/y/z/spam' ) ;
164
172
const old = await fsextra . stat ( dirname ) ;
165
- const expected = {
166
- type : FileType . Directory ,
167
- size : old . size ,
168
- ctime : old . ctimeMs ,
169
- mtime : old . mtimeMs
170
- } ;
173
+ const expected = convertStat ( old , FileType . Directory ) ;
171
174
172
175
const stat = await filesystem . stat ( dirname ) ;
173
176
@@ -178,12 +181,7 @@ suite('Raw FileSystem', () => {
178
181
const filename = await fix . createFile ( 'x/y/z/spam.py' , '...' ) ;
179
182
const symlink = await fix . createSymlink ( 'x/y/z/eggs.py' , filename ) ;
180
183
const old = await fsextra . stat ( filename ) ;
181
- const expected = {
182
- type : FileType . SymbolicLink ,
183
- size : old . size ,
184
- ctime : old . ctimeMs ,
185
- mtime : old . mtimeMs
186
- } ;
184
+ const expected = convertStat ( old , FileType . SymbolicLink | FileType . File ) ;
187
185
188
186
const stat = await filesystem . stat ( symlink ) ;
189
187
0 commit comments