mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-11-03 23:08:18 +00:00
Migrate CLI E2E tests to Node.js 26
Run the CLI subprocess suites and benchmark tools as native TypeScript with node:test, and move them under test/e2e-cli. Update CI and Compose runners, run local smoke tests on Linux, macOS, and Windows, and collect source-mapped CLI coverage with c8.
This commit is contained in:
1 parent
a0987016bb
commit
2433d117c2
91 files changed
+2219
-1615
No files matched your search
+10
-21
@@ -49,26 +49,6 @@ if (typeof globalThis.FileReader === "undefined") {
|
||||
}
|
||||
`;
|
||||
|
||||
function injectBanner(): import("vite").Plugin {
|
||||
return {
|
||||
name: "inject-banner",
|
||||
generateBundle(_options, bundle) {
|
||||
for (const chunk of Object.values(bundle)) {
|
||||
if (chunk.type === "chunk" && chunk.isEntry) {
|
||||
// Insert after the shebang line if present, otherwise at the top.
|
||||
if (chunk.code.startsWith("#!")) {
|
||||
const newline = chunk.code.indexOf("\n");
|
||||
chunk.code =
|
||||
chunk.code.slice(0, newline + 1) + fileReaderPolyfillBanner + chunk.code.slice(newline + 1);
|
||||
} else {
|
||||
chunk.code = fileReaderPolyfillBanner + chunk.code;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const buildInputs: Record<string, string> = {
|
||||
index: resolve(__dirname, "entrypoint.ts"),
|
||||
};
|
||||
@@ -77,7 +57,7 @@ if (process.env.LIVESYNC_CLI_TEST_SUPPORT === "1") {
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [svelte(), injectBanner()],
|
||||
plugins: [svelte()],
|
||||
resolve: {
|
||||
// This bundle runs in Node. Vite's client defaults include the `browser`
|
||||
// export condition, which would select Commonlib's inline Web Worker.
|
||||
@@ -98,7 +78,16 @@ export default defineConfig({
|
||||
outDir: "dist",
|
||||
emptyOutDir: true,
|
||||
minify: false,
|
||||
sourcemap: process.env.LIVESYNC_CLI_COVERAGE === "1",
|
||||
rollupOptions: {
|
||||
output: {
|
||||
banner: (chunk) => (chunk.isEntry ? fileReaderPolyfillBanner : ""),
|
||||
// c8 filters mapped ranges before resolving relative source paths.
|
||||
sourcemapPathTransform:
|
||||
process.env.LIVESYNC_CLI_COVERAGE === "1"
|
||||
? (source: string, mapPath: string) => path.resolve(path.dirname(mapPath), source)
|
||||
: undefined,
|
||||
},
|
||||
input: buildInputs,
|
||||
external: (id) => {
|
||||
if (isBuiltin(id)) return true;
|
||||
|
||||
Reference in new issue
Block a user