Resolve issue #13 Add test, reproducible Apps Script build pipeline with coverage-validated CI#19
Conversation
- Created package.json and package-lock.json for project dependencies and scripts. - Updated .gitignore to exclude node_modules and coverage directories. - Added initial development scripts for building and testing the project.
- Updated README instructions for authorizing the script. - Removed optional manual testing functions from CacheFinance.js to streamline the codebase. - Updated gas-source.mjs to validate exclusion of test helpers from the bundle. - Added tests to ensure optional test functions are not included in the final bundle.
- Bump package version to 1.0.1 in package-lock.json. - Update devDependency "@vitest/coverage-v8" to version 3.2.7. - Simplify error handling in ScriptSettings and GasMocks by removing exception parameters. - Add clear methods to ScriptCache and ScriptProperties with documentation. - Modify test setup to prevent unnecessary logging and improve clarity in test cases.
…s and ScriptSettings - Removed branch restrictions from the GitHub Actions workflow for pushes. - Updated the workflow to include a verification step for the bundle and run unit tests with coverage. - Added detailed JSDoc comments for new methods in GasMocks and ScriptSettings to improve code clarity and maintainability.
…asMocks - Simplified error handling in various API classes by removing exception parameters from catch blocks. - Updated documentation in GasMocks to include JSDoc comments for new methods, improving code clarity and maintainability. - Updated source hash in CacheFinance.js to reflect recent changes.
- Simplified error handling in FinanceSiteLookupAnalyzer by removing exception parameters from catch blocks. - Updated documentation in build-cachefinance.mjs and GasMocks to include JSDoc comments for new methods, improving code clarity. - Adjusted validation logic in gas-source.mjs to accommodate whitespace variations in import/export statements. - Updated source hash in CacheFinance.js to reflect recent changes.
- Introduced a JSDoc comment to document the in-memory mock for Apps Script script cache storage in the GasMocks.js file, enhancing code clarity and maintainability.
2c6b1ef to
87a029c
Compare
…inanceWebSites - Bump package version to 1.1.0 in package.json and package-lock.json. - Rename test FinanceWebSites to CacheFinanceWebSites
- Added .vscode/ to .gitignore to prevent IDE-specific files from being tracked in the repository.
|
|
Hey Ben, Just wondering what is going on with these changes? Is this fixing something? I see some stuff relating to NPM, which is something I thought was needed to distribute years ago, but it is not usefuly and I was going to remove, but never got around to it. I am not really up to speed the tests. Are they somehow run when you make a change? Currently when I have an update for git, I just run a script to make the DIST version by stripping out stuff Google apps script can't process. Is all this solving something? |
|
Hey Chris, Thanks for merging — to answer your questions briefly: Nothing changes for end users. dist/CacheFinance.js is still what goes into Apps Script. npm isn’t for distribution (private: true). It’s only for tooling: the build script that strips DEBUG blocks and concatenates src/ into dist/ (same idea as your manual script), plus Vitest for unit tests. Tests run in Node with mocked Apps Script APIs — locally via npm test, and automatically on push/PR in GitHub Actions. They don’t run inside Sheets. What it solves: a repeatable build for easier contributors' contributions, a check that dist/ stays in sync with src/, and tests to catch regressions without live spreadsheet runs. A few small cleanups along the way (import paths, test helpers moved out of the bundle). |



Summary
dist/CacheFinance.jsfromsrc/, strips Node-only DEBUG blocks, validates bundle content, and skips rewriting unchanged output.validateso stale bundles fail fast before merge.Test plan
npm run buildnpm run build:checknpm run validatedist/CacheFinance.jsupdates only when source content changes