import { rimraf } from '../../utils/fs';
import { killAllProcesses, ng, silentYarn } from '../../utils/process';
import { ngServe, updateJsonFile } from '../../utils/project';

export default async function() {
  // Setup project for yarn usage
  await rimraf('node_modules');
  await updateJsonFile('package.json', (json) => {
    json.resolutions = { webpack: '5.0.0-rc.3' };
  });
  await silentYarn();
  await silentYarn('webdriver-update');

  // Ensure webpack 5 is used
  const { stdout } = await silentYarn('list', '--pattern', 'webpack');
  if (!/\swebpack@5/.test(stdout)) {
    throw new Error('Expected Webpack 5 to be installed.');
  }
  if (/\swebpack@4/.test(stdout)) {
    throw new Error('Expected Webpack 4 to not be installed.');
  }

  // Execute the CLI with Webpack 5
  await ng('test', '--watch=false');
  await ng('build');
  await ng('build', '--prod');
  await ng('e2e');
  try {
    await ngServe();
  } finally {
    killAllProcesses();
  }
}

import { rimraf } from '../../utils/fs';
import { killAllProcesses, ng, silentYarn } from '../../utils/process';
import { ngServe, updateJsonFile } from '../../utils/project';

export default async function() {
  // Currently disabled as it breaks tslib 2.0.2
  // Cannot destructure property '__extends' of '_tslib_js__WEBPACK_IMPORTED_MODULE_0___default(...)' as it is undefined.
  return;

  // Setup project for yarn usage
  await rimraf('node_modules');
  await updateJsonFile('package.json', (json) => {
    json.resolutions = { webpack: '5.0.0-rc.3' };
  });
  await silentYarn();
  await silentYarn('webdriver-update');

  // Ensure webpack 5 is used
  const { stdout } = await silentYarn('list', '--pattern', 'webpack');
  if (!/\swebpack@5/.test(stdout)) {
    throw new Error('Expected Webpack 5 to be installed.');
  }
  if (/\swebpack@4/.test(stdout)) {
    throw new Error('Expected Webpack 4 to not be installed.');
  }

  // Execute the CLI with Webpack 5
  await ng('test', '--watch=false');
  await ng('build');
  await ng('build', '--prod');
  await ng('e2e');
  try {
    await ngServe();
  } finally {
    killAllProcesses();
  }
}

--- 
+++ 
@@ -3,10 +3,6 @@
 import { ngServe, updateJsonFile } from '../../utils/project';
 
 export default async function() {
-  // Currently disabled as it breaks tslib 2.0.2
-  // Cannot destructure property '__extends' of '_tslib_js__WEBPACK_IMPORTED_MODULE_0___default(...)' as it is undefined.
-  return;
-
   // Setup project for yarn usage
   await rimraf('node_modules');
   await updateJsonFile('package.json', (json) => {
Revert "test(@angular/cli): disable webpack 5 e2e tests"

This reverts commit ba830d56350920d95e6c0023c84da9e485cf7800.
