diff --git a/packages/core/test/bundling/forms_reactive/forms_e2e_spec.ts b/packages/core/test/bundling/forms_reactive/forms_e2e_spec.ts index b42eaabdb5d..5b74b8c0a41 100644 --- a/packages/core/test/bundling/forms_reactive/forms_e2e_spec.ts +++ b/packages/core/test/bundling/forms_reactive/forms_e2e_spec.ts @@ -18,7 +18,11 @@ describe('functional test for reactive forms', () => { BUNDLES.forEach((bundle) => { describe(`using ${bundle} bundle`, () => { it('should render template form', withBody('', async () => { - const {whenRendered, bootstrapApp} = require(path.join(PACKAGE, bundle)); + // load the bundle + require(path.join(PACKAGE, bundle)); + // the bundle attaches the following fields to the `window` global. + const {bootstrapApp, whenRendered} = window as any; + await bootstrapApp(); // Reactive forms diff --git a/packages/core/test/bundling/forms_reactive/index.ts b/packages/core/test/bundling/forms_reactive/index.ts index 441b97afb82..99daa8f7d54 100644 --- a/packages/core/test/bundling/forms_reactive/index.ts +++ b/packages/core/test/bundling/forms_reactive/index.ts @@ -101,7 +101,5 @@ function bootstrapApp() { // This bundle includes `@angular/core` within it which means that the test asserting // against it will load a different core bundle. These symbols are exposed so that they // can interact with the correct `@angular/core` instance. -module.exports = { - whenRendered, - bootstrapApp -}; +(window as any).whenRendered = whenRendered; +(window as any).bootstrapApp = bootstrapApp; diff --git a/packages/core/test/bundling/forms_template_driven/forms_e2e_spec.ts b/packages/core/test/bundling/forms_template_driven/forms_e2e_spec.ts index 44ed9659862..73919c08855 100644 --- a/packages/core/test/bundling/forms_template_driven/forms_e2e_spec.ts +++ b/packages/core/test/bundling/forms_template_driven/forms_e2e_spec.ts @@ -18,7 +18,11 @@ describe('functional test for forms', () => { BUNDLES.forEach((bundle) => { describe(`using ${bundle} bundle`, () => { it('should render template form', withBody('', async () => { - const {bootstrapApp, whenRendered} = require(path.join(PACKAGE, bundle)); + // load the bundle + require(path.join(PACKAGE, bundle)); + // the bundle attaches the following fields to the `window` global. + const {bootstrapApp, whenRendered} = window as any; + await bootstrapApp(); // Template forms diff --git a/packages/core/test/bundling/forms_template_driven/index.ts b/packages/core/test/bundling/forms_template_driven/index.ts index ac81bc9e234..e35ffcd69b6 100644 --- a/packages/core/test/bundling/forms_template_driven/index.ts +++ b/packages/core/test/bundling/forms_template_driven/index.ts @@ -78,7 +78,5 @@ function bootstrapApp() { // This bundle includes `@angular/core` within it which means that the test asserting // against it will load a different core bundle. These symbols are exposed so that they // can interact with the correct `@angular/core` instance. -module.exports = { - whenRendered, - bootstrapApp -}; +(window as any).whenRendered = whenRendered; +(window as any).bootstrapApp = bootstrapApp; diff --git a/packages/core/test/bundling/todo/index.ts b/packages/core/test/bundling/todo/index.ts index 2c1860b4a72..fb0ea8d1af6 100644 --- a/packages/core/test/bundling/todo/index.ts +++ b/packages/core/test/bundling/todo/index.ts @@ -203,7 +203,5 @@ function bootstrapApp() { // This bundle includes `@angular/core` within it which means that the test asserting // against it will load a different core bundle. These symbols are exposed so that they // can interact with the correct `@angular/core` instance. -module.exports = { - whenRendered, - bootstrapApp -}; +(window as any).whenRendered = whenRendered; +(window as any).bootstrapApp = bootstrapApp; diff --git a/packages/core/test/bundling/todo/todo_e2e_spec.ts b/packages/core/test/bundling/todo/todo_e2e_spec.ts index bba954e5c02..5d97d7e3aa5 100644 --- a/packages/core/test/bundling/todo/todo_e2e_spec.ts +++ b/packages/core/test/bundling/todo/todo_e2e_spec.ts @@ -19,7 +19,11 @@ describe('functional test for todo', () => { describe(bundle, () => { it('should place styles on the elements within the component', withBody('', async () => { - const {bootstrapApp, whenRendered} = require(path.join(PACKAGE, bundle)); + // load the bundle + require(path.join(PACKAGE, bundle)); + // the bundle attaches the following fields to the `window` global. + const {bootstrapApp, whenRendered} = window as any; + await bootstrapApp(); const toDoAppComponent = (window as any).toDoAppComponent; await whenRendered(toDoAppComponent); diff --git a/packages/core/test/bundling/todo_i18n/index.ts b/packages/core/test/bundling/todo_i18n/index.ts index 5442957114d..85299d19a39 100644 --- a/packages/core/test/bundling/todo_i18n/index.ts +++ b/packages/core/test/bundling/todo_i18n/index.ts @@ -209,4 +209,4 @@ loadTranslations(translations); // This bundle includes `@angular/core` within it which means that the test asserting // against it will load a different core bundle. These symbols are exposed so that they // can interact with the correct `@angular/core` instance. -module.exports = {whenRendered}; +(window as any).whenRendered = whenRendered; diff --git a/packages/core/test/bundling/todo_i18n/todo_e2e_spec.ts b/packages/core/test/bundling/todo_i18n/todo_e2e_spec.ts index c52f3b39d4d..ee418277952 100644 --- a/packages/core/test/bundling/todo_i18n/todo_e2e_spec.ts +++ b/packages/core/test/bundling/todo_i18n/todo_e2e_spec.ts @@ -20,8 +20,11 @@ describe('functional test for todo i18n', () => { describe(bundle, () => { it('should render todo i18n', withBody('', async () => { clearTranslations(); - const {whenRendered} = require(path.join(PACKAGE, bundle)); - await (window as any).appReady; + // load the bundle + require(path.join(PACKAGE, bundle)); + // the bundle attaches the following fields to the `window` global. + const {appReady, whenRendered} = window as any; + await appReady; expect(document.body.textContent).toContain('liste de tâches'); expect(document.body.textContent).toContain('Démontrer les components'); expect(document.body.textContent).toContain('Démontrer NgModules');