feat: use tsnapi for exports snapshoting

This commit is contained in:
Anthony Fu committed 2026-04-10 17:12:24 +09:00
1 parent 68c00a2b25
commit 83cf9c396b
9 files changed
+1550 -1712

No files matched your search

-26
View File
@@ -1,26 +0,0 @@
import { x } from 'tinyexec'
import { describe, expect, it } from 'vitest'
import { getPackageExportsManifest } from 'vitest-package-exports'
import yaml from 'yaml'
// TODO: remove this when you are ready for the first release
const IS_READY = false
describe.runIf(IS_READY)('exports-snapshot', async () => {
const packages: { name: string, path: string, private?: boolean }[] = JSON.parse(
await x('pnpm', ['ls', '--only-projects', '-r', '--json']).then(r => r.stdout),
)
for (const pkg of packages) {
if (pkg.private)
continue
it(`${pkg.name}`, async () => {
const manifest = await getPackageExportsManifest({
importMode: 'src',
cwd: pkg.path,
})
await expect(yaml.stringify(manifest.exports))
.toMatchFileSnapshot(`./exports/${pkg.name}.yaml`)
})
}
})