mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-26 00:21:41 +08:00
Merge pull request #7803 from tkqubo/update-mock-fs
Update mock-fs to 3.6.0
This commit is contained in:
@@ -77,3 +77,10 @@ var mockedFS = mock.fs({
|
||||
if (mockedFS.readFileSync('/file', { encoding: 'utf8' }) === 'blah') {
|
||||
console.log('woo');
|
||||
}
|
||||
|
||||
mock({
|
||||
'path/to/file.txt': 'file content here'
|
||||
}, {
|
||||
createTmp: true,
|
||||
createCwd: false
|
||||
});
|
||||
|
||||
14
mock-fs/mock-fs.d.ts
vendored
14
mock-fs/mock-fs.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
// Type definitions for mock-fs 2.5.0
|
||||
// Type definitions for mock-fs 3.6.0
|
||||
// Project: https://github.com/tschaub/mock-fs
|
||||
// Definitions by: Wim Looman <https://github.com/Nemo157>
|
||||
// Definitions by: Wim Looman <https://github.com/Nemo157>, Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
@@ -8,7 +8,7 @@
|
||||
declare module "mock-fs" {
|
||||
import fs = require("fs");
|
||||
|
||||
function mock(config?: mock.Config): void;
|
||||
function mock(config?: mock.Config, options?: mock.Options): void;
|
||||
|
||||
module mock {
|
||||
function file(config: FileConfig): File;
|
||||
@@ -17,12 +17,17 @@ declare module "mock-fs" {
|
||||
|
||||
function restore(): void;
|
||||
|
||||
function fs(config?: Config): typeof fs;
|
||||
function fs(config?: Config, options?: Options): typeof fs;
|
||||
|
||||
interface Config {
|
||||
[path: string]: string | Buffer | File | Directory | Symlink | Config;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
createCwd?: boolean;
|
||||
createTmp?: boolean;
|
||||
}
|
||||
|
||||
interface CommonConfig {
|
||||
mode?: number;
|
||||
uid?: number;
|
||||
@@ -30,6 +35,7 @@ declare module "mock-fs" {
|
||||
atime?: Date;
|
||||
ctime?: Date;
|
||||
mtime?: Date;
|
||||
birthtime?: Date;
|
||||
}
|
||||
|
||||
interface FileConfig extends CommonConfig {
|
||||
|
||||
Reference in New Issue
Block a user