簡體   English   中英

使用 Mocha 和 JavaScript 語法測試 Angular 9 (TypeScript)

[英]Test Angular 9 (TypeScript) with Mocha and JavaScript Syntax

We recently migrated to Angular 9 (Type Script) from Angular.js and would like to continue writing our tests in Mocha, but keep the JavaScript syntax (not writing tests in TypeScript Mocha).

Is that possible to write JavaScript test for Type Script code (I know that JavaScript syntax is possible to write, this is not what I am asking) - the question is - is it possible to test the actual TypeScript components of Angular?

任何指南/文章將不勝感激。

謝謝。

所需的行為應該按照您的意願工作。

TypeScript 基本上只是 JavaScript 之上的(視覺)層。 要么創建.spec.ts文件並編寫默認 JavaScript 代碼,要么創建.spec.js文件並編寫 JavaScript。 無論哪種方式,它都應該“正常工作”。 如果您需要檢查是否定義了設置,則 mocha 只會為您的測試加載某些擴展。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM