Google Apps Script→Clasp→TypeScript→Jestとたどり着きました。
ひとまず、Jestが動いているかの確認で、下記コードを参考にさせていただきました。
TypescriptのGASをJestでテストする - アクトインディ開発者ブログ https://tech.actindi.net/2019/07/03/081258
コンパイル方法は
tsc
テストの実行は
npx jest
テスト自体は動いているようですが、下記のようなエラーが表示。
SyntaxError: Cannot use import statement outside a module
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1796:14)
下記のIssuesのコメント欄の手順を参考にbabel-jestの環境を構築するとでエラーが出なくなりました。
SyntaxError: Cannot use import statement outside a module · Issue #9395 · facebook/jest
https://github.com/facebook/jest/issues/9395#issuecomment-583799300
よく理解していませんが...
コメント
コメントを投稿