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 {
@@ -131,15 +131,23 @@ suite('Raw FileSystem', () => {
131
131
} ) ;
132
132
133
133
suite ( 'stat' , ( ) => {
134
+ function convertStat ( old : fsextra . Stats , filetype : FileType ) : FileStat {
135
+ return {
136
+ type : filetype ,
137
+ size : old . size ,
138
+ // XXX Apparently VS Code's new "fs" has granularity of seconds.
139
+ // So we round to the nearest integer.
140
+ // XXX ctime is showing up as 0.
141
+ ctime : 0 ,
142
+ //ctime: Math.round(old.ctimeMs),
143
+ mtime : Math . round ( old . mtimeMs )
144
+ } ;
145
+ }
146
+
134
147
test ( 'gets the info for an existing file' , async ( ) => {
135
148
const filename = await fix . createFile ( 'x/y/z/spam.py' , '...' ) ;
136
149
const old = await fsextra . stat ( filename ) ;
137
- const expected = {
138
- type : FileType . File ,
139
- size : old . size ,
140
- ctime : old . ctimeMs ,
141
- mtime : old . mtimeMs
142
- } ;
150
+ const expected = convertStat ( old , FileType . File ) ;
143
151
144
152
const stat = await filesystem . stat ( filename ) ;
145
153
@@ -149,12 +157,7 @@ suite('Raw FileSystem', () => {
149
157
test ( 'gets the info for an existing directory' , async ( ) => {
150
158
const dirname = await fix . createDirectory ( 'x/y/z/spam' ) ;
151
159
const old = await fsextra . stat ( dirname ) ;
152
- const expected = {
153
- type : FileType . Directory ,
154
- size : old . size ,
155
- ctime : old . ctimeMs ,
156
- mtime : old . mtimeMs
157
- } ;
160
+ const expected = convertStat ( old , FileType . Directory ) ;
158
161
159
162
const stat = await filesystem . stat ( dirname ) ;
160
163
@@ -165,12 +168,7 @@ suite('Raw FileSystem', () => {
165
168
const filename = await fix . createFile ( 'x/y/z/spam.py' , '...' ) ;
166
169
const symlink = await fix . createSymlink ( 'x/y/z/eggs.py' , filename ) ;
167
170
const old = await fsextra . stat ( filename ) ;
168
- const expected = {
169
- type : FileType . SymbolicLink ,
170
- size : old . size ,
171
- ctime : old . ctimeMs ,
172
- mtime : old . mtimeMs
173
- } ;
171
+ const expected = convertStat ( old , FileType . SymbolicLink | FileType . File ) ;
174
172
175
173
const stat = await filesystem . stat ( symlink ) ;
176
174
0 commit comments