* test: mechanically rewrite spec imports and __dirname for native ESM
This is the automated half of loading spec/ as native ES modules and is
not expected to pass on its own; the hand-written half follows in the
next commit. A script (included in the pull request description) made
three changes to spec/*.ts and spec/lib/*.ts, then oxfmt was re-run:
* relative import specifiers gain their real file extension
* __dirname / __filename become import.meta.dirname / .filename
* files that still call require() from module code get a
createRequire(import.meta.url) prelude
Code inside functions that are stringified and evaluated in another
process (remotely(), itremote(), template-interpolated functions and
similar) is left as it was.
* test: load specs as native ES modules with Node's type stripping
spec/package.json declares "type": "module", so the spec runner and every
spec file now load through Node's own ESM loader and built-in TypeScript
type stripping; the require.extensions transpile hook is gone. A new
spec/fixtures/package.json keeps fixtures in a CommonJS scope.
The hand-written changes on top of the mechanical rewrite:
* spec/index.js becomes an ES module and import()s its test dependencies
after the app is ready, then uses mocha.loadFilesAsync().
* Functions that are stringified and sent to another process now arrive
as written rather than as CommonJS transpiler output, so the
remote-control and utility-process fixtures define the plain names
those bodies use (chai, expect, once, setTimeout, ...) instead of the
old `electron_1` style shims, and a few bodies require() what they use.
* The two specs that exercise lib/ sources require() them, since lib/ is
not in a "type": "module" scope.
* spec-helpers resolves BrowserWindow lazily so it stays loadable from a
utility process.
* tsconfig.spec.json allows .ts extension imports; spec/tsconfig.json
points editors at it.
---------
Co-authored-by: Claude <noreply@anthropic.com>
Turn on erasableSyntaxOnly and isolatedModules for the spec typecheck so
the specs only use TypeScript syntax that a plain type stripper can
remove (no enums, parameter properties, import = require or angle
bracket casts), and lint spec/ for type-only imports so they are
written as `import type` / inline `type` specifiers.
Also hoist a handful of inline require() calls in spec bodies up to the
existing top-level imports and use named imports from ws.
Co-authored-by: Claude <noreply@anthropic.com>
* test: drop the now-empty remote runner from CI
* move fixtures to spec-main
* remove remote runner
* fix stuff
* remove global-paths hack
* move ts-smoke to spec/
* fix test after merge
* rename spec-main to spec
* no need to ignore spec/node_modules twice
* simplify spec-runner a little
* no need to hash pj/yl twice
* undo lint change to verify-mksnapshot.py
* excessive ..
* update electron_woa_testing.yml
* don't search for test-results-remote.xml
it is never produced now