|
| 1 | +/** |
| 2 | + * @license |
| 3 | + * Copyright Google LLC All Rights Reserved. |
| 4 | + * |
| 5 | + * Use of this source code is governed by an MIT-style license that can be |
| 6 | + * found in the LICENSE file at https://angular.dev/license |
| 7 | + */ |
| 8 | + |
| 9 | +import { execute } from '../../index'; |
| 10 | +import { BASE_OPTIONS, KARMA_BUILDER_INFO, describeKarmaBuilder } from '../setup'; |
| 11 | +import { BuilderMode } from '../../schema'; |
| 12 | + |
| 13 | +describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget) => { |
| 14 | + describe('Option: "aot"', () => { |
| 15 | + it('enables aot', async () => { |
| 16 | + await setupTarget(harness); |
| 17 | + |
| 18 | + await harness.writeFiles({ |
| 19 | + 'src/aot.spec.ts': ` |
| 20 | + import { Component } from '@angular/core'; |
| 21 | + |
| 22 | + describe('Hello', () => { |
| 23 | + it('should *not* contain jit instructions', () => { |
| 24 | + @Component({ |
| 25 | + template: 'Hello', |
| 26 | + }) |
| 27 | + class Hello {} |
| 28 | +
|
| 29 | + expect((Hello as any).ɵcmp.template.toString()).not.toContain('jit'); |
| 30 | + }); |
| 31 | + }); |
| 32 | +`, |
| 33 | + }); |
| 34 | + |
| 35 | + harness.useTarget('test', { |
| 36 | + ...BASE_OPTIONS, |
| 37 | + aot: true, |
| 38 | + /** Cf. {@link ../builder-mode_spec.ts} */ |
| 39 | + polyfills: ['zone.js', '@angular/localize/init', 'zone.js/testing'], |
| 40 | + builderMode: BuilderMode.Application, |
| 41 | + }); |
| 42 | + |
| 43 | + const { result } = await harness.executeOnce(); |
| 44 | + expect(result?.success).toBeTrue(); |
| 45 | + }); |
| 46 | + }); |
| 47 | +}); |
0 commit comments