本文整理汇总了TypeScript中@angular-devkit/core.virtualFs类的典型用法代码示例。如果您正苦于以下问题:TypeScript virtualFs类的具体用法?TypeScript virtualFs怎么用?TypeScript virtualFs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了virtualFs类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: tap
tap(() => {
const fileName = join(outputPath, 'vendor.js.map');
expect(host.scopedSync().exists(fileName)).toBe(true);
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
// this is due the fact that some vendors like `tslib` sourcemaps to js files
const sourcePath = JSON.parse(content).sources[0];
expect(path.extname(sourcePath)).toBe('.js', `${sourcePath} extention should be '.js'`);
}),
开发者ID:baconwaffles,项目名称:angular-cli,代码行数:8,代码来源:vendor-source-map_spec_large.ts
示例2: map
map(() => {
const fileName = './dist/lib/fesm5/lib.js';
const content = virtualFs.fileBufferToString(
host.scopedSync().read(normalize(fileName)),
);
return content;
}),
开发者ID:angular,项目名称:angular-cli,代码行数:8,代码来源:index_spec_large.ts
示例3: tap
tap(() => {
const fileName = 'dist/main.js';
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
// Large image should not be inlined.
expect(content).toMatch(/url\((?:['"]|\\')?large\.png(?:['"]|\\')?\)/);
// Small image should be inlined.
expect(content).toMatch(/url\(\\?['"]data:image\/svg\+xml/);
}),
开发者ID:rexebin,项目名称:angular-cli,代码行数:8,代码来源:styles_spec_large.ts
示例4: tap
tap(() => {
const fileName = 'dist/styles.css';
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
expect(content).toContain(tags.stripIndents`
/* normal-comment */
/*! important-comment */
div { -ms-flex: 1; flex: 1 }`);
}),
开发者ID:DevIntent,项目名称:angular-cli,代码行数:8,代码来源:styles_spec_large.ts
示例5: tap
tap((buildEvent) => {
expect(buildEvent.success).toBe(true);
const fileName = join(outputPath, 'main.js');
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
expect(content).toMatch(/AppServerModuleNgFactory/);
expect(host.scopedSync().exists(join(outputPath, 'main.js.map'))).toBeTruthy();
}),
开发者ID:fmalcher,项目名称:angular-cli,代码行数:8,代码来源:base_spec_large.ts
示例6: it
it('works with service worker', async () => {
host.writeMultipleFiles({
'src/ngsw-config.json': JSON.stringify(manifest),
'src/assets/folder-asset.txt': 'folder-asset.txt',
'src/styles.css': `body { background: url(./spectrum.png); }`,
});
const overrides = { serviceWorker: true };
const run = await architect.scheduleTarget(target, overrides);
await expectAsync(run.result).toBeResolvedTo(jasmine.objectContaining({ success: true }));
expect(host.scopedSync().exists(normalize('dist/ngsw.json')));
const ngswJson = JSON.parse(virtualFs.fileBufferToString(
host.scopedSync().read(normalize('dist/ngsw.json'))));
// Verify index and assets are there.
expect(ngswJson).toEqual(jasmine.objectContaining({
configVersion: 1,
index: '/index.html',
navigationUrls: [
{ positive: true, regex: '^\\\/.*$' },
{ positive: false, regex: '^\\\/(?:.+\\\/)?[^\/]*\\.[^\/]*$' },
{ positive: false, regex: '^\\\/(?:.+\\\/)?[^\/]*__[^\/]*$' },
{ positive: false, regex: '^\\\/(?:.+\\\/)?[^\/]*__[^\/]*\\\/.*$' },
],
assetGroups: [
{
name: 'app',
installMode: 'prefetch',
updateMode: 'prefetch',
urls: [
'/favicon.ico',
'/index.html',
],
patterns: [],
},
{
name: 'assets',
installMode: 'lazy',
updateMode: 'prefetch',
urls: [
'/assets/folder-asset.txt',
'/spectrum.png',
],
patterns: [],
},
],
dataGroups: [],
hashTable: {
'/favicon.ico': '84161b857f5c547e3699ddfbffc6d8d737542e01',
'/assets/folder-asset.txt': '617f202968a6a81050aa617c2e28e1dca11ce8d4',
'/index.html': '1bcafd53046ffb270ac5e6f3cab23e0442f95c4f',
'/spectrum.png': '8d048ece46c0f3af4b598a95fd8e4709b631c3c0',
},
}));
await run.stop();
});
开发者ID:angular,项目名称:angular-cli,代码行数:58,代码来源:service-worker_spec_large.ts
示例7: tap
tap(() => {
expect(host.scopedSync().exists(join(outputPath, 'main.js.map'))).toBe(true);
const scriptContent = virtualFs.fileBufferToString(
host.scopedSync().read(join(outputPath, 'main.js')),
);
expect(scriptContent).toContain('sourceMappingURL=main.js.map');
expect(scriptContent).toContain('sourceMappingURL=data:application/json');
}),
开发者ID:DevIntent,项目名称:angular-cli,代码行数:9,代码来源:base_spec_large.ts
示例8: it
it('bundles TS worker', async () => {
host.writeMultipleFiles(workerFiles);
const logger = new TestLogger('worker-warnings');
const overrides = { webWorkerTsConfig: 'src/tsconfig.worker.json' };
await browserBuild(architect, host, target, overrides, { logger });
// Worker bundle contains worker code.
const workerContent = virtualFs.fileBufferToString(
host.scopedSync().read(join(outputPath, '0.worker.js')));
expect(workerContent).toContain('hello from worker');
expect(workerContent).toContain('bar');
// Main bundle references worker.
const mainContent = virtualFs.fileBufferToString(
host.scopedSync().read(join(outputPath, 'main.js')));
expect(mainContent).toContain('0.worker.js');
expect(logger.includes('WARNING')).toBe(false, 'Should show no warnings.');
});
开发者ID:angular,项目名称:angular-cli,代码行数:18,代码来源:web-worker_spec_large.ts
示例9: tap
tap(() => {
const styles = virtualFs.fileBufferToString(
host.scopedSync().read(normalize(stylesBundle)),
);
const main = virtualFs.fileBufferToString(host.scopedSync().read(normalize(mainBundle)));
expect(styles).toContain(`url('/assets/global-img-absolute.svg')`);
expect(styles).toContain(`url('global-img-relative.png')`);
expect(main).toContain(`url('/assets/component-img-absolute.svg')`);
expect(main).toContain(`url('component-img-relative.png')`);
expect(host.scopedSync().exists(normalize('dist/assets/global-img-absolute.svg')))
.toBe(true);
expect(host.scopedSync().exists(normalize('dist/global-img-relative.png')))
.toBe(true);
expect(host.scopedSync().exists(normalize('dist/assets/component-img-absolute.svg')))
.toBe(true);
expect(host.scopedSync().exists(normalize('dist/component-img-relative.png')))
.toBe(true);
}),
开发者ID:johnpapa,项目名称:angular-cli,代码行数:18,代码来源:styles_spec_large.ts
示例10: it
it('updates Angular as compatible with Angular N-1 (2)', done => {
// Add the basic migration package.
const content = virtualFs.fileBufferToString(host.sync.read(normalize('/package.json')));
const packageJson = JSON.parse(content);
const dependencies = packageJson['dependencies'];
dependencies['@angular-devkit-tests/update-peer-dependencies-angular-5-2'] = '1.0.0';
dependencies['@angular/core'] = '5.1.0';
dependencies['@angular/animations'] = '5.1.0';
dependencies['@angular/common'] = '5.1.0';
dependencies['@angular/compiler'] = '5.1.0';
dependencies['@angular/platform-browser'] = '5.1.0';
dependencies['rxjs'] = '5.5.0';
dependencies['zone.js'] = '0.8.26';
host.sync.write(
normalize('/package.json'),
virtualFs.stringToFileBuffer(JSON.stringify(packageJson)),
);
schematicRunner.runSchematicAsync('update', {
packages: ['@angular/core'],
next: true,
}, appTree).pipe(
map(tree => {
const packageJson = JSON.parse(tree.readContent('/package.json'));
expect(packageJson['dependencies']['@angular/core'][0]).toBe('6');
// Check install task.
expect(schematicRunner.tasks).toEqual([
{
name: 'node-package',
options: jasmine.objectContaining({
command: 'install',
}),
},
{
name: 'run-schematic',
options: jasmine.objectContaining({
name: 'migrate',
}),
},
]);
}),
).subscribe(undefined, done.fail, done);
}, 45000);
开发者ID:iwe7,项目名称:devkit,代码行数:44,代码来源:index_spec.ts
注:本文中的@angular-devkit/core.virtualFs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论