Skip to content

Commit 02a3fb9

Browse files
filipesilvaclydin
authored andcommitted
test: add issue for broken app-shell test
1 parent d4bb898 commit 02a3fb9

File tree

3 files changed

+28
-18
lines changed

3 files changed

+28
-18
lines changed

packages/angular_devkit/build_angular/src/app-shell/index.ts

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { JsonObject, experimental, join, normalize, resolve, schema } from '@ang
1515
import { NodeJsSyncHost } from '@angular-devkit/core/node';
1616
import * as fs from 'fs';
1717
import * as path from 'path';
18+
import { readTsconfig } from '../angular-cli-files/utilities/read-tsconfig';
1819
import { augmentAppWithServiceWorker } from '../angular-cli-files/utilities/service-worker';
1920
import { BrowserBuilderOutput } from '../browser';
2021
import { Schema as BrowserBuilderSchema } from '../browser/schema';
@@ -31,40 +32,47 @@ async function _renderUniversal(
3132
const browserIndexOutputPath = path.join(browserResult.outputPath || '', 'index.html');
3233
const indexHtml = fs.readFileSync(browserIndexOutputPath, 'utf8');
3334
const serverBundlePath = await _getServerModuleBundlePath(options, context, serverResult);
34-
3535
const root = context.workspaceRoot;
3636

37+
// Get browser target options.
38+
const browserTarget = targetFromTargetString(options.browserTarget);
39+
const rawBrowserOptions = await context.getTargetOptions(browserTarget);
40+
const browserBuilderName = await context.getBuilderNameForTarget(browserTarget);
41+
const browserOptions = await context.validateOptions<JsonObject & BrowserBuilderSchema>(
42+
rawBrowserOptions,
43+
browserBuilderName,
44+
);
45+
46+
// Determine if browser app was compiled using Ivy.
47+
const { options: compilerOptions } = readTsconfig(browserOptions.tsConfig, context.workspaceRoot);
48+
const ivy = compilerOptions.enableIvy;
49+
3750
// Initialize zone.js
3851
const zonePackage = require.resolve('zone.js', { paths: [root] });
3952
await import(zonePackage);
4053

4154
// Load platform server module renderer
4255
const platformServerPackage = require.resolve('@angular/platform-server', { paths: [root] });
43-
const renderModuleFactory = await import(platformServerPackage)
56+
const renderOpts = {
57+
document: indexHtml,
58+
url: options.route,
59+
};
60+
61+
// Render app using Ivy or VE
62+
const renderCall = await import(platformServerPackage)
4463
// tslint:disable-next-line:no-implicit-dependencies
45-
.then((m: typeof import('@angular/platform-server')) => m.renderModuleFactory);
64+
.then((m: typeof import('@angular/platform-server')) => ivy
65+
? m.renderModule(require(serverBundlePath).AppServerModule, renderOpts)
66+
: m.renderModuleFactory(require(serverBundlePath).AppServerModuleNgFactory, renderOpts));
4667

47-
const AppServerModuleNgFactory = require(serverBundlePath).AppServerModuleNgFactory;
68+
// Render to HTML and overwrite the client index file.
69+
const html = await renderCall;
4870
const outputIndexPath = options.outputIndexPath
4971
? path.join(root, options.outputIndexPath)
5072
: browserIndexOutputPath;
5173

52-
// Render to HTML and overwrite the client index file.
53-
const html = await renderModuleFactory(AppServerModuleNgFactory, {
54-
document: indexHtml,
55-
url: options.route,
56-
});
57-
5874
fs.writeFileSync(outputIndexPath, html);
5975

60-
const browserTarget = targetFromTargetString(options.browserTarget);
61-
const rawBrowserOptions = await context.getTargetOptions(browserTarget);
62-
const browserBuilderName = await context.getBuilderNameForTarget(browserTarget);
63-
const browserOptions = await context.validateOptions<JsonObject & BrowserBuilderSchema>(
64-
rawBrowserOptions,
65-
browserBuilderName,
66-
);
67-
6876
if (browserOptions.serviceWorker) {
6977
const host = new NodeJsSyncHost();
7078
// Create workspace.

packages/angular_devkit/build_angular/test/app-shell/app-shell_spec_large.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { createArchitect, host, veEnabled } from '../utils';
1313

1414

1515
// DISABLED_FOR_IVY These should pass but are currently not supported
16+
// See https://github.com/angular/angular-cli/issues/15383 for details.
1617
(veEnabled ? describe : xdescribe)('AppShell Builder', () => {
1718
const target = { project: 'app', target: 'app-shell' };
1819
let architect: Architect;

tests/legacy-cli/e2e_runner.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ if (!argv.ve) {
105105
// We don't have a platform-server usage story yet for Ivy.
106106
// It's contingent on lazy loading and factory shim considerations that are still being
107107
// discussed.
108+
// Broken currently https://github.com/angular/angular-cli/issues/15383
108109
.filter(name => !name.endsWith('tests/build/platform-server.ts'))
109110
.filter(name => !name.endsWith('tests/build/build-app-shell.ts'))
110111
.filter(name => !name.endsWith('tests/build/build-app-shell-with-schematic.ts'));

0 commit comments

Comments
 (0)