Angular builders - more complex testing examples

Đang mở
#23,297 3 bình luận 1 reaction 1 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

feature feature: insufficient votes feature: votes required freq1: low

📚 Docs or angular.io bug report

Description

There is already a pretty good documentation in regards to Angular CLI Builders, however, I get stuck right after trying something more complex than triggering a simple command.

I am extending the existing @angular-devkit/build-ng-packagr builder, so that certain logic is executed after the packagr builder is done. That all works fine, however I don't know how to test it correctly.

I tried to create a fake workspace, where I would run my builder, but obviously that fails due to absence of dependencies, like @angular/core.

I as well tried to look into official builder itself where I found that bunch of deprecated API is used, therefore did not proceed there.

🔬 Minimal Reproduction

What's the affected URL?**

https://next.angular.io/guide/cli-builder

Reproduction Steps**

This can of course be fixed by creating package.json and installing @angular/core in the fake workspace, but is this the right way?

🔥 Exception or Error

Building Angular Package
Building entry point 'lib'
Compiling TypeScript sources through ngc

BUILD ERROR
Could not resolve module @angular/core
Error: Could not resolve module @angular/core
    at StaticSymbolResolver.getSymbolByModule (/Users/osk/Workspaces/experimental/packages/compiler/src/aot/static_symbol_resolver.ts:521:11)
    at StaticReflector.findDeclaration (/Users/osk/Workspaces/experimental/packages/compiler/src/aot/static_reflector.ts:111:29)
    at StaticReflector.initializeConversionMap (/Users/osk/Workspaces/experimental/packages/compiler/src/aot/static_reflector.ts:367:14)
    at new StaticReflector (/Users/osk/Workspaces/experimental/packages/compiler/src/aot/static_reflector.ts:69:10)
    at Object.createAotCompiler (/Users/osk/Workspaces/experimental/packages/compiler/src/aot/compiler_factory.ts:67:7)
    at AngularCompilerProgram._createCompiler (/Users/osk/Workspaces/packages/compiler-cli/src/transformers/program.ts:651:22)
    at AngularCompilerProgram.get [as hostAdapter] (/Users/osk/Workspaces/packages/compiler-cli/src/transformers/program.ts:531:12)
    at AngularCompilerProgram._createProgramWithBasicStubs (/Users/osk/Workspaces/packages/compiler-cli/src/transformers/program.ts:690:71)
    at /Users/osk/Workspaces/packages/compiler-cli/src/transformers/program.ts:240:17

Ngôn ngữ chính
TypeScript
Star
27k
Fork
11.8k
Merge trung bình
16 giờ 35 phút
Pull request đã merge (30 ngày)
176

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của angular/angular-cli

Tất cả issue của angular/angular-cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.