本文整理匯總了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': {}
});
};