Skip to content

Commit

Permalink
feat: remove zone-patch and its fallback (#1427)
Browse files Browse the repository at this point in the history
BREAKING CHANGE
Since Angular 11, the minimum version of `zone.js` is 0.11.x and Angular 10 is EOL so now we can use zone patch directly from `zone.js`. If one is not using `zone.js@0.11.x`, please upgrade.
  • Loading branch information
ahnpnl authored Apr 27, 2022
1 parent 51f8842 commit bf9ea44
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 163 deletions.
25 changes: 5 additions & 20 deletions src/config/setup-jest.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
require('../utils/reflect-metadata');

try {
// If the user are using zone.js 0.11.1+
// all jest support logic are implemented inside zone.js
// we only need to load zone-testing module
!process.execArgv.includes('--experimental-vm-modules')
? require('zone.js/bundles/zone-testing-bundle.umd.js')
: require('zone.js/fesm2015/zone-testing-bundle.min.js');
} catch (err) {
// Fallback logic to load zone and zone-patch
// when the user still use zone.js 0.10.x
require('zone.js/dist/zone');
require('zone.js/dist/proxy');
require('zone.js/dist/sync-test');
require('zone.js/dist/async-test');
require('zone.js/dist/fake-async-test');
require('../zone-patch');
}
!process.execArgv.includes('--experimental-vm-modules')
? require('zone.js/bundles/zone-testing-bundle.umd.js')
: require('zone.js/fesm2015/zone-testing-bundle.min.js');

const getTestBed = require('@angular/core/testing').getTestBed;
const BrowserDynamicTestingModule = require('@angular/platform-browser-dynamic/testing').BrowserDynamicTestingModule;
const platformBrowserDynamicTesting = require('@angular/platform-browser-dynamic/testing')
.platformBrowserDynamicTesting;
const { BrowserDynamicTestingModule } = require('@angular/platform-browser-dynamic/testing');
const { platformBrowserDynamicTesting } = require('@angular/platform-browser-dynamic/testing')

getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
7 changes: 0 additions & 7 deletions src/zone-patch/README.md

This file was deleted.

136 changes: 0 additions & 136 deletions src/zone-patch/index.js

This file was deleted.

0 comments on commit bf9ea44

Please sign in to comment.