Bru*_*.PW 5 jasmine protractor zone.js angular e2e
从 11.0.3 Angular/Core 版本开始,E2E 测试不适用于具有默认配置的项目。
我打开了一个问题https://github.com/angular/angular/issues/40221但它似乎不是回归(?)
https://github.com/BrunoBeraudPW/issue-angular-11.0.3
这是一个默认项目 Angular 11.0.3,我已将所有包更新到最新版本
我已经“手动”更新了所有软件包,因为“ng new”cmd 正在创建一个 Angular 10 应用程序,所以我想问题可能是由于其他软件包造成的。
但即使我刚刚更新了角度包,错误仍然存在
使用 fakeAsync 时:
Failed: zone-testing.js is needed for the async() test helper but could not be found.
Please make sure that your environment includes zone.js/dist/zone-testing.js
Run Code Online (Sandbox Code Playgroud)
selenium-webdriver 库中的几个错误(承诺)
C:\dev-phoenix\1-Photoweb-Forks\test\node_modules\selenium-webdriver\lib\promise.js:3067:27
this.pending_ = {task: task, q: this.subQ_};
task.promise.queue_ = this;
result = this.subQ_.execute_(task.execute);
~
this.subQ_.start();
} catch (ex) {
Run Code Online (Sandbox Code Playgroud)
Internal/modules/cjs/loader.js 中的几个错误
internal/modules/cjs/loader.js:955:30
jasmine-spec-reporter: unable to open 'internal/modules/cjs/loader.js'
Error: ENOENT: no such file or directory, open 'internal/modules/cjs/loader.js'
Run Code Online (Sandbox Code Playgroud)
它似乎无法识别茉莉花函数,它以红色下划线主要函数的名称描述,它,适合等,就像它不包含 test.ts 及其导入'zone.js/dist/zone-testing ';
**Angular Version:**
@angular-devkit/architect 0.1100.3
@angular-devkit/build-angular 0.1100.3
@angular-devkit/core 11.0.3
@angular-devkit/schematics 11.0.3
@schematics/angular 11.0.3
@schematics/update 0.1100.3
rxjs 6.6.3
typescript 4.0.5
Run Code Online (Sandbox Code Playgroud)
感谢 !
小智 0
确保更新您的 test.ts 文件。区域导入必须在区域测试导入之前。
import "zone.js/dist/zone";
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
// 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);
Run Code Online (Sandbox Code Playgroud)
或者可能 src/polyfills.ts 文件丢失/导入丢失:
import 'zone.js/dist/zone'; // Included with Angular CLI.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2290 次 |
| 最近记录: |