Skip to content

fix(@angular-devkit/build-angular): load polyfills and runtime as scripts instead of modules #24655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
// All served files with the latest timestamps
%MAPPINGS%
</script>
<script src="_karma_webpack_/runtime.js" crossorigin="anonymous" type="module"></script>
<script src="_karma_webpack_/polyfills.js" crossorigin="anonymous" type="module"></script>
<script src="_karma_webpack_/runtime.js" crossorigin="anonymous"></script>
<script src="_karma_webpack_/polyfills.js" crossorigin="anonymous"></script>
<!-- Dynamically replaced with <script> tags -->
%SCRIPTS%
<script src="_karma_webpack_/scripts.js" crossorigin="anonymous" defer></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
// All served files with the latest timestamps
%MAPPINGS%
</script>
<script src="_karma_webpack_/runtime.js" crossorigin="anonymous" type="module"></script>
<script src="_karma_webpack_/polyfills.js" crossorigin="anonymous" type="module"></script>
<script src="_karma_webpack_/runtime.js" crossorigin="anonymous"></script>
<script src="_karma_webpack_/polyfills.js" crossorigin="anonymous"></script>
<!-- Dynamically replaced with <script> tags -->
%SCRIPTS%
<script src="_karma_webpack_/scripts.js" crossorigin="anonymous" defer></script>
Expand Down
37 changes: 37 additions & 0 deletions tests/legacy-cli/e2e/tests/test/test-jasmine-clock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { ng } from '../../utils/process';
import { writeFile } from '../../utils/fs';

export default async function () {
await writeFile(
'src/app/app.component.spec.ts',
`
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeAll(() => {
jasmine.clock().install();
});

afterAll(() => {
jasmine.clock().uninstall();
});

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [RouterTestingModule],
declarations: [AppComponent],
}).compileComponents();
});

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
expect(fixture.componentInstance).toBeTruthy();
});
});
`,
);

await ng('test', '--watch=false');
}