Wallaby.js supported : TypeScript (06)

Wallaby.js 對於 TypeScript 這類的 Compiler 做了很好的支持,這也是我願意選擇買它的原因之一。

值得開心的是完全不用另外寫檔案來去支持 TypeScript,除非您想要覆寫掉原本的 tsoncifg.json 的設定或是想要特別指定 TypeScript 的版本。只要把 wallaby.js 內的讀取檔案路徑都改成 .ts 即可,就像下圖一樣。

module.exports = function (w) {

  return {
    files: [
      'src/**/*.ts'
    ],

    tests: [
      'test/**/*Spec.ts'
    ]
  };
};

可以參考官方提供的 repository,範例中特定提供兩種測試範本一種是 Browser 一種是 Node.js 環境。由於目前工作產品上用的比較單純所以先不往下介紹覆蓋及額外模組設定,若日後有使用到官方文章提供的方式再特別紀錄下來。

Data Source: https://wallabyjs.com/docs/integration/typescript.html