本文整理汇总了TypeScript中vs/test/utils/servicesTestUtils.onError函数的典型用法代码示例。如果您正苦于以下问题:TypeScript onError函数的具体用法?TypeScript onError怎么用?TypeScript onError使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了onError函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onError
extfs.mkdirp(newDir, 493, (error) => {
if (error) {
return onError(error, done);
}
assert.ok(fs.existsSync(newDir));
extfs.writeFileAndFlush(testFile, 'Hello World', null, (error) => {
if (error) {
return onError(error, done);
}
assert.equal(fs.readFileSync(testFile), 'Hello World');
const largeString = (new Array(100 * 1024)).join('Large String\n');
extfs.writeFileAndFlush(testFile, largeString, null, (error) => {
if (error) {
return onError(error, done);
}
assert.equal(fs.readFileSync(testFile), largeString);
done();
});
});
});
示例2: testFile
testFile((error, testFile, cleanUp) => {
if (error) {
return onError(error, done);
}
fs.writeFileSync(testFile, '// my comment\n{ "foo": "bar" }');
let watcher = new ConfigWatcher<{ foo: string; }>(testFile, { changeBufferDelay: 100 });
watcher.getConfig(); // ensure we are in sync
fs.writeFileSync(testFile, '// my comment\n{ "foo": "changed" }');
// still old values because change is not bubbling yet
assert.equal(watcher.getConfig().foo, 'bar');
assert.equal(watcher.getValue('foo'), 'bar');
// force a load from disk
watcher.reload(config => {
assert.equal(config.foo, 'changed');
assert.equal(watcher.getConfig().foo, 'changed');
assert.equal(watcher.getValue('foo'), 'changed');
watcher.dispose();
cleanUp(done);
});
});
示例3: onError
extfs.copy(sourceDir, testDir, (error) => {
if (error) {
return onError(error, done);
}
events = new utils.TestEventService();
service = new FileService(testDir, { disableWatcher: true }, events);
done();
});
示例4: onError
extfs.writeFileAndFlush(testFile, largeString, null, (error) => {
if (error) {
return onError(error, done);
}
assert.equal(fs.readFileSync(testFile), largeString);
extfs.del(parentDir, os.tmpdir(), () => { }, done);
});
示例5: onError
extfs.mkdirp(newDir, 493, (error) => {
if (error) {
return onError(error, done);
}
assert.ok(fs.existsSync(newDir));
pfs.writeFile(testFile, 'Hello World', null).done(() => {
assert.equal(fs.readFileSync(testFile), 'Hello World');
extfs.del(parentDir, os.tmpdir(), () => { }, done);
}, error => onError(error, done));
});