( pkgDir: string, tarballs: Tarballs, failures: SmokeFailure[], )
| 100 | type Tarballs = ReadonlyMap<string, string>; |
| 101 | |
| 102 | const smokeTestPackage = async ( |
| 103 | pkgDir: string, |
| 104 | tarballs: Tarballs, |
| 105 | failures: SmokeFailure[], |
| 106 | ): Promise<void> => { |
| 107 | const pkg = await readPackageJson(pkgDir); |
| 108 | const tarballPath = tarballs.get(pkg.name); |
| 109 | if (!tarballPath) { |
| 110 | failures.push({ pkg: pkg.name, subpath: "", reason: "no tarball produced" }); |
| 111 | return; |
| 112 | } |
| 113 | |
| 114 | const tmp = await mkdtemp(join(tmpdir(), "executor-smoke-")); |
| 115 | try { |
| 116 | // npm `overrides` forces transitive `@executor-js/*` deps to resolve |
| 117 | // to their local tarball instead of whatever's published on npm. |
| 118 | // Without this, a plugin built against an unreleased symbol in |
| 119 | // `@executor-js/sdk` would silently install the published `sdk` |
| 120 | // and fail at import — a real bug, but not the bundle bug we're |
| 121 | // here to catch. |
| 122 | const overrides: Record<string, string> = {}; |
| 123 | for (const [name, path] of tarballs) { |
| 124 | overrides[name] = `file:${path}`; |
| 125 | } |
| 126 | const fixture = { |
| 127 | name: "executor-smoke-fixture", |
| 128 | version: "0.0.0", |
| 129 | private: true, |
| 130 | type: "module", |
| 131 | dependencies: { [pkg.name]: `file:${tarballPath}` }, |
| 132 | overrides, |
| 133 | }; |
| 134 | await writeFile(join(tmp, "package.json"), `${JSON.stringify(fixture, null, 2)}\n`); |
| 135 | |
| 136 | const install = await $`npm install --no-audit --no-fund --legacy-peer-deps` |
| 137 | .cwd(tmp) |
| 138 | .quiet() |
| 139 | .nothrow(); |
| 140 | if (install.exitCode !== 0) { |
| 141 | failures.push({ |
| 142 | pkg: pkg.name, |
| 143 | subpath: "<install>", |
| 144 | reason: install.stderr.toString().trim().split("\n").slice(-3).join("\n"), |
| 145 | }); |
| 146 | return; |
| 147 | } |
| 148 | |
| 149 | // Read the installed manifest — that's the real published view |
| 150 | // (publishConfig.exports applied, workspace specifiers resolved). |
| 151 | const installedPkg = await readPackageJson(join(tmp, "node_modules", ...pkg.name.split("/"))); |
| 152 | const subpaths = subpathsToTest(installedPkg); |
| 153 | if (subpaths.length === 0) { |
| 154 | failures.push({ |
| 155 | pkg: pkg.name, |
| 156 | subpath: "", |
| 157 | reason: "no exports declared in published manifest", |
| 158 | }); |
| 159 | return; |
no test coverage detected