1
我一直在開發人員工具中發現這個錯誤,並且在過去的幾天裏我一直在思考。未處理的Promise拒絕:Zone.js
Unhandled Promise rejection: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.
所以我已閱讀並試圖相當多的東西,一切有關解決這個涉及Zone.js無濟於事未處理的承諾廢品。 所有的錯誤似乎都指向我的shim.min.js文件,但似乎不管我在錯誤中加載我的文件的順序仍然存在!
這裏是我的所有相關文件:
這是我polyfill.ts文件:
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
這是我test.ts文件:
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/jasmine-patch';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare var __karma__: any;
declare var require: any;
// Prevent Karma from running prematurely.
__karma__.loaded = function() {};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
// Finally, start Karma to run the tests.
__karma__.start();
如果您還有其他任何想看的文件,請告訴我!
任何幫助非常感謝!