Girish Ramakrishnan
d0a66f1701
Back to mocha!
...
sorry i ever left you dear mocha
node:test has two major issues:
* --bail does not work and requires strange modules and incantations.
I was able to work around this with a custom module.
* the test reporter reports _after_ the suite is run. this makes debugging
really hard. the debugs that we print all happen before the test suite summary.
poor design overall.
2026-02-19 13:24:14 +01:00
Girish Ramakrishnan
c176ac600b
migrate tests to node:test
2026-02-19 10:13:22 +01:00
Girish Ramakrishnan
4ed6fbbd74
eslint: add no-shadow
2026-02-18 08:18:37 +01:00
Girish Ramakrishnan
36aa641cb9
migrate to "export default"
...
also, set no-use-before-define in linter
2026-02-14 15:43:24 +01:00
Girish Ramakrishnan
96dc79cfe6
Migrate codebase from CommonJS to ES Modules
...
- Convert all require()/module.exports to import/export across 260+ files
- Add "type": "module" to package.json to enable ESM by default
- Add migrations/package.json with "type": "commonjs" to keep db-migrate compatible
- Convert eslint.config.js to ESM with sourceType: "module"
- Replace __dirname/__filename with import.meta.dirname/import.meta.filename
- Replace require.main === module with process.argv[1] === import.meta.filename
- Remove 'use strict' directives (implicit in ESM)
- Convert dynamic require() in switch statements to static import lookup maps
(dns.js, domains.js, backupformats.js, backupsites.js, network.js)
- Extract self-referencing exports.CONSTANT patterns into standalone const
declarations (apps.js, services.js, locks.js, users.js, mail.js, etc.)
- Lazify SERVICES object in services.js to avoid circular dependency TDZ issues
- Add clearMailQueue() to mailer.js for ESM-safe queue clearing in tests
- Add _setMockApp() to ldapserver.js for ESM-safe test mocking
- Add _setMockResolve() wrapper to dig.js for ESM-safe DNS mocking in tests
- Convert backupupload.js to use dynamic imports so --check exits before
loading the module graph (which requires BOX_ENV)
- Update check-install to use ESM import for infra_version.js
- Convert scripts/ (hotfix, release, remote_hotfix.js, find-unused-translations)
- All 1315 tests passing
Migration stats (AI-assisted using Cursor with Claude):
- Wall clock time: ~3-4 hours
- Assistant completions: ~80-100
- Estimated token usage: ~1-2M tokens
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-02-14 15:11:45 +01:00
Girish Ramakrishnan
fb04f78112
backupcleaner: fix listing of backups by site
2025-10-21 13:56:08 +02:00
Johannes Zellner
38267a26c1
Send some metrics
2025-09-29 16:16:22 +02:00
Girish Ramakrishnan
f8e5a65f95
Fix test
2025-09-24 14:09:06 +02:00
Girish Ramakrishnan
50d37ad752
Fix consistent use of enabledForUpdates -> enableForUpdates
2025-09-23 16:43:17 +02:00
Girish Ramakrishnan
cc939de641
Fixup tests
2025-09-22 20:17:34 +02:00
Girish Ramakrishnan
4c3a8e1fd7
backup site: add contents
...
it is a json that can be one of the three:
* null - include everything
* include - only include these ids
* exclude - everything except these ids
2025-09-22 13:28:16 +02:00
Girish Ramakrishnan
c5b7264f1a
rename backupTargets to backupSites
2025-09-12 10:32:37 +02:00