本文整理汇总了TypeScript中mock-fs.fs函数的典型用法代码示例。如果您正苦于以下问题:TypeScript fs函数的具体用法?TypeScript fs怎么用?TypeScript fs使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fs函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setup
setup(() => {
// Configure all the dependencies we'll use in our tests
fileSystem = new FileSystem({ fs: mockFs.fs({}) });
adb = new AdbSimulator(fileSystem);
simulatedAVDManager = new AVDManager(adb);
reactNative = new ReactNative022(adb, fileSystem);
fakeExtensionMessageSender = new FakeExtensionMessageSender();
androidPlatform = createAndroidPlatform(genericRunOptions);
// Create a React-Native project we'll use in our tests
return reactNative.createProject(projectRoot, applicationName);
});
示例2: beforeEach
beforeEach(()=>{
const mock = mockFs.fs({
'/proj1': {
'myst.json': `{
"data": "data/"
}`,
'data': {
'foo.yaml': `
foobar: 吉野家
foonum: 10`,
'bar.json': '{"welcome": "to my bar"}',
},
},
});
fs.mount(mnt, mock);
});
示例3: beforeEach
beforeEach(()=>{
const mock = mockFs.fs({
'/proj1': {
'myst.json': `{
"rootDir": "src",
"outDir": "../out"
}`,
'layout': {
'main.dust': `<div>foo {+body}body{/body} bar</div>`,
},
'src': {
'index.dust': `{>"$PROJ/layout/main.dust"/}{<body}aiu{/body}`,
'index2.dust': `{>"$ROOT/../layout/main.dust"/}`,
},
},
});
fs.mount(mnt, mock);
});
示例4: e
function e() {
mock({
'some/dir': mock.directory({
mode: parseInt("0755", 8),
items: {
file1: 'file one content',
file2: new Buffer([8, 6, 7, 5, 3, 0, 9])
}
})
});
}
function f() {
mock({
'some/dir': {
'regular-file': 'file contents',
'a-symlink': mock.symlink({
path: 'regular-file'
})
}
});
}
var mockedFS = mock.fs({
'/file': 'blah'
});
if (mockedFS.readFileSync('/file', { encoding: 'utf8' }) === 'blah') {
console.log('woo');
}
示例5:
let nodeFileStorageInitializer = () => {
mockedFs = mockFs.fs({
'fileStorage': {}
});
};