79286348

Date: 2024-12-16 23:46:08
Score: 0.5
Natty:
Report link

There is now Aside, an unofficial Google library for adding type support, linting and unit testing to Apps Script using TypeScript, ESLint, Prettier, and Jest.

Note that as far as I can tell, to run tests in Jest on functions which remotely execute Google Apps APIs (even things like SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Home").getRange("A1").getValue()), you would need to:

  1. Write a test function which will run remotely and does setup, calls the function you are testing, and then outputs the result to stdout
  2. Write a Jest test which will call clasp run <test_function> (see this documentation on clasp run and this SO post on calling command line functions from node) and then write assertions against the output.
Reasons:
  • Blacklisted phrase (1): this document
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Jimmy Li