Angular 测试模式项目教程

Angular 测试模式项目教程

angular-test-patternsA High-Quality Guide for Testing Angular 1.x项目地址:https://gitcode.com/gh_mirrors/an/angular-test-patterns

1. 项目的目录结构及介绍

angular-test-patterns/
├── src/
│   ├── gitignore
│   ├── travis.yml
│   ├── README.md
│   ├── angular.json
│   ├── karma.conf.js
│   ├── package-lock.json
│   ├── package.json
│   ├── protractor.conf.js
│   ├── tsconfig.json
│   └── tslint.json
├── init-repo.sh
└── README.md
  • src/:包含项目的源代码和配置文件。
    • gitignore:Git 忽略文件配置。
    • travis.yml:Travis CI 配置文件。
    • README.md:项目说明文档。
    • angular.json:Angular 项目配置文件。
    • karma.conf.js:Karma 测试运行器配置文件。
    • package-lock.json:锁定依赖版本的文件。
    • package.json:Node.js 项目配置文件。
    • protractor.conf.js:Protractor 端到端测试配置文件。
    • tsconfig.json:TypeScript 编译配置文件。
    • tslint.json:TypeScript 代码风格检查配置文件。
  • init-repo.sh:初始化本地仓库的脚本。
  • README.md:项目的主说明文档。

2. 项目的启动文件介绍

项目的启动文件主要是 package.json 中的 scripts 部分。以下是一些常用的启动命令:

{
  "scripts": {
    "test": "npm run test-unit && npm run test-e2e",
    "test-unit": "karma start karma.conf.js",
    "test-e2e": "protractor protractor.conf.js",
    "start": "ng serve"
  }
}
  • npm start:启动开发服务器。
  • npm test:运行单元测试和端到端测试。
  • npm run test-unit:运行单元测试。
  • npm run test-e2e:运行端到端测试。

3. 项目的配置文件介绍

angular.json

angular.json 是 Angular 项目的配置文件,包含了项目的构建、测试和服务器配置等信息。

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "angular-test-patterns": {
      "projectType": "application",
      "schematics": {},
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/angular-test-patterns",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.css"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "bundleBudget": {
                "maximumWarning": "2mb",
                "maximumError": "5mb"
              },
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"

angular-test-patternsA High-Quality Guide for Testing Angular 1.x项目地址:https://gitcode.com/gh_mirrors/an/angular-test-patterns

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

韩烨琰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值