[英]Cannot find module from setup-jest.js
我有一個 Angular 庫,我正在努力將其從 Angular 11 更新到 13。Jest 在 11 和 12 中運行良好,但現在我在使用 v13 時遇到了很多麻煩。 我已按照此處概述的步驟進行操作我得到的錯誤如下: 它在setup-jest文件中尋找 angular 核心文件似乎很奇怪。 je ...
[英]Cannot find module from setup-jest.js
我有一個 Angular 庫,我正在努力將其從 Angular 11 更新到 13。Jest 在 11 和 12 中運行良好,但現在我在使用 v13 時遇到了很多麻煩。 我已按照此處概述的步驟進行操作我得到的錯誤如下: 它在setup-jest文件中尋找 angular 核心文件似乎很奇怪。 je ...
[英]Jest ReferenceError on globally defined JS constants within Angular components
今天我開始使用 Jest 對 Angular 項目中的一些 TypeScript 文件進行單元測試。 完成初始 Jest 設置后,在util.ts中為純 TypeScript 方法創建測試非常簡單。 現在我正在測試 Angular 組件中的某些內容,但由於我們在導入的其他組件中的全局常量而遇到錯誤。 ...
[英]ng-mocks giving error about imports with jest-preset-angular
將 ng-mocks 13.5.2 與 jest-preset-angular 12 和 @ngneat/spectator 11 一起使用,每當我嘗試在我的規范文件中使用MockComponents或MockPipe時,我都會收到以下錯誤。 我不確定為什么會這樣。 必須使用import來加載ES模 ...
[英]Configure `jest-preset-angular` with angular workspace
文件結構: 我按照安裝https://thymikee.github.io/jest-preset-angular/docs/getting-started/installation安裝。 如果我 go 與https://thymikee.github.io/jest-preset-angular ...
[英]Using Jest with Angular 13 + Clarity
我目前正在嘗試升級使用 VMware Clarity 的現有 Angular 應用程序。 我已經按照 Angular 更新指南從 8.x 升級到 10.x。 然而,除此之外,開玩笑的配置中斷了,因為較新的 Clarity 版本和 Angular 13 使用 esm。 所以我嘗試構建一個最小的工作示 ...
[英]TypeError: Cannot read properties of undefined (reading 'ngModule')
運行測試我得到這個錯誤TypeError: Cannot read properties of undefined (reading 'ngModule') 我不完全知道是什么導致了這個錯誤,但谷歌說循環依賴問題,但我不知道從哪里開始。 將 NX-monorepo 與 angular 一起使用並開 ...
[英]Upgrading an angular 13 app with js-cookie stops running jest unit tests successfully
我有一個版本為 13 的 angular 應用程序,它使用外部依賴項 js-cookie在瀏覽器中設置和獲取一些 cookies。 作為測試環境,我將jest與jest-preset-angular一起使用。 請參閱下面的 package.json 的所有依賴項。 我的問題是,在 angular 1 ...
[英]Errors running tests using Angular v13 + Jest + ESM + NGXS
從 Angular v12 到 v13 的遷移過程非常艱難,雖然應用程序運行良好,但測試對我們來說仍然是個問題。 到目前為止,我們一直在使用 Jest 和 ESM 運行 v12 測試(因為我們有一個 WebWorker 並且import.meta.url從 v12 開始需要 ESM)。 但是現在 v ...
[英]How to make jest only run testing for the files in src folder Angular?
我正在學習如何在 angular 中設置玩笑測試。 我遵循jest-preset-angular的指示。 我可以在 angular 中成功地使 jest 運行,但是我的應用程序在根目錄中也有兩個子模塊,這jest給出了很多錯誤。 我現在想避免這種情況。 我想知道如何為jest或jest-prese ...
[英]Cannot use import statement outside a module with date-fns in Jest after updating to Angular 13
將 Angular 12 更新到 13 后,我的一些 Jest 測試開始失敗。 它總是同樣的錯誤: /Users/undsoft/projects/work/webui/node_modules/date-fns/esm/format/index.js:1。 ({"Object.":functi ...
[英]Angular 13 + jest + Angular library not working
我正在嘗試在 Angular 13 項目中使用 jest 進行測試。 我將 jest-preset-angular 與 @angular-builders/jest 一起使用。 我使用 ngx-pipes,這是一個沒有為 Angular 13 編譯的庫。它在正常的 Angular 構建期間工作正常。 ...
[英]Could not locate module @app1/shared mapped as... No mapping for self contained modules
我對子項目example-app-v12-monorepo添加了一些更改以反映我的情況: 在examples/example-app-v12-monorepo/projects/app1/src/app/shared/public_api.ts中創建了public_api.ts文件作為共享類的桶。 ...
[英]jest-preset-angular not working with Angular 13 and ESM module
我正在使用帶有 jest 的 ESM 模塊,並且在使用 angular 12 jest-preset-angular 進行編譯時,通過在排除列表中列出 @igniteui 對我來說非常有用。 我升級到 Angular 13 和 jest-preset-angular 的下一個版本,但我現在無法讓它工 ...
[英]Jest Error: Cannot set base providers. After Angular v13 upgrade using 'ng test'
將 Angular 升級到 v 13 后,當我嘗試在 jest 環境中運行測試時出現錯誤: 此外,我像這篇文章中指出的那樣配置了 Jest: https://thymikee.github.io/jest-preset-angular/docs/next/guides/esm-support/但它對 ...
[英]Cannot find module when using jest in nx
我有一個 nx 工作區,我正試圖開玩笑。 起初我收到一個關於 PointerEvent 未定義的錯誤。 the proposed workaround for that was to do an Object.defineProperty(window, 'PointerEvent'... My ...
[英]Adal.service.ts doesn't work for me in angular when I run the tests with Jest
請幫幫我。 我正在遷移到 Jest 以運行 ANGULAR 的單元測試,但是在執行時出現錯誤: 失敗 src/app/modules/dashboard/components/navbar/navbar.component.spec.ts 測試套件無法運行 測試套件:1 個失敗,總共 ...
[英]How to resolve the error "ERR! code ELIFECYCLE"?
我正在使用 Jest 來執行單元測試。 所有測試均已通過並運行,但出現如下錯誤 我從谷歌搜索中嘗試了以下命令,但是,它不起作用 日志中的錯誤 ...
[英]Jest and Serialize-ts Count find type for field:
在使用serilize-ts將 jest 升級到 v9 后,我在 angular 應用程序中使用jest運行測試時遇到問題錯誤是: price.model.ts : 這是我的第一個jest.config.js : 它擴展了這個jest.config.js : 我的package.json : 和 ...
[英]How to setup tsconfig paths in jest.config.js. Angular 8. jest-preset-angular
我在我的 tsconfig 中設置了絕對路徑,可以在服務期間按預期工作,但不能開玩笑。 示例路徑如下所示: 然后在我可以使用的組件中 我目前正在嘗試轉移到 Jest 進行測試。 在我的 jest.config.js 我有一個 moduleNameMapper 部分: 這導致 如果我將 tsconfi ...
[英]unexpected uncovered branch in jest coverage
我正在用 jest 測試一個 angular 項目(使用jest-preset-angular )。 在收集報道時,我得到一個未覆蓋的分支,我不明白為什么。 我可以用 3 個文件重現這個問題。 some-dependency.ts export class SomeDependency {} ...