Angular v4迄今为止,该应用程序是建立在每个版本的基础上并逐渐更新的。目前我们正在进行中Angular v7,最终 CEO 同意编写单元测试,而以前并非如此。
我刚刚创建了一个简单的规范来开始测试并开始在整个项目中实施它,但由于以下错误而卡住了两天:
async() 测试助手需要 AsyncTestZoneSpec,但无法找到。请确保您的环境包含 zone.js/dist/async->test.js
在谷歌上搜索上述错误时,我找到了一些答案,但这与WallaybyjsAngular相关但特定于 Angular。
我试图用全新的angular项目安装来重现这个问题,但真的不能。这可能是在Angular 7.
以下是test.ts文件:
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
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 …Run Code Online (Sandbox Code Playgroud) 我当前的角度版本是“^7.1.4”,我想继续使用相同的版本。但是在做 ng serve 时,我遇到了错误。
您正在运行 Node.js 的 v8.9.3 版本,Angular CLI 8.0+ 不支持该版本。支持的官方 Node.js 版本是 10.9 或更高版本。
请访问https://nodejs.org/en/以查找有关如何更新 Node.js 的说明。
节点版本:v8.9.3 NPM 版本:6.4.1
提前致谢
目前我们正在构建詹金斯部署管道。在这些构建中,我们使用 HachiCorp 金库进行秘密管理。为了获取秘密,我们使用hashcorp-vault-plugin。问题是我们想要声明管道脚本上的所有变量,就像这样-testing'、'testing_again'、secret/another_test(我们不希望这样)
node {
// define the secrets and the env variables
// engine version can be defined on secret, job, folder or global.
// the default is engine version 2 unless otherwise specified globally.
def secrets = [
[path: 'secret/testing', engineVersion: 1, secretValues: [
[envVar: 'testing', vaultKey: 'value_one'],
[envVar: 'testing_again', vaultKey: 'value_two']]],
[path: 'secret/another_test', engineVersion: 2, secretValues: [
[vaultKey: 'another_test']]]
]
// optional configuration, if you do not provide this the next higher configuration …Run Code Online (Sandbox Code Playgroud)