feat: add vitest-package-exports tests
This commit is contained in:
6 files changed
+1076
-1349
No files matched your search
@@ -6,4 +6,9 @@ export default defineBuildConfig({
|
||||
],
|
||||
declaration: 'node16',
|
||||
clean: true,
|
||||
rollup: {
|
||||
inlineDependencies: [
|
||||
'@antfu/utils',
|
||||
],
|
||||
},
|
||||
})
|
||||
+15
-12
@@ -2,7 +2,7 @@
|
||||
"name": "pkg-placeholder",
|
||||
"type": "module",
|
||||
"version": "0.0.0",
|
||||
"packageManager": "pnpm@10.2.1",
|
||||
"packageManager": "pnpm@10.5.2",
|
||||
"description": "_description_",
|
||||
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
||||
"license": "MIT",
|
||||
@@ -36,20 +36,23 @@
|
||||
"prepare": "simple-git-hooks"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^4.1.1",
|
||||
"@antfu/eslint-config": "^4.4.0",
|
||||
"@antfu/ni": "^23.3.1",
|
||||
"@antfu/utils": "^8.1.0",
|
||||
"@types/node": "^22.13.1",
|
||||
"bumpp": "^10.0.2",
|
||||
"eslint": "^9.20.0",
|
||||
"@antfu/utils": "^9.1.0",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/node": "^22.13.9",
|
||||
"bumpp": "^10.0.3",
|
||||
"eslint": "^9.21.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lint-staged": "^15.4.3",
|
||||
"pnpm": "^10.2.1",
|
||||
"simple-git-hooks": "^2.11.1",
|
||||
"tsx": "^4.19.2",
|
||||
"typescript": "^5.7.3",
|
||||
"unbuild": "^3.3.1",
|
||||
"vite": "^6.1.0",
|
||||
"vitest": "^3.0.5"
|
||||
"tinyexec": "^0.3.2",
|
||||
"tsx": "^4.19.3",
|
||||
"typescript": "^5.8.2",
|
||||
"unbuild": "^3.5.0",
|
||||
"vite": "^6.2.0",
|
||||
"vitest": "^3.0.7",
|
||||
"vitest-package-exports": "^0.1.0"
|
||||
},
|
||||
"simple-git-hooks": {
|
||||
"pre-commit": "pnpm lint-staged"
|
||||
|
||||
Generated
+1017
-1337
File diff suppressed because it is too large.
Load diff
@@ -3,3 +3,5 @@ packages:
|
||||
- docs
|
||||
- packages/*
|
||||
- examples/*
|
||||
onlyBuiltDependencies:
|
||||
- esbuild
|
||||
@@ -0,0 +1,26 @@
|
||||
import yaml from 'js-yaml'
|
||||
import { x } from 'tinyexec'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { getPackageExportsManifest } from 'vitest-package-exports'
|
||||
|
||||
// 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.dump(manifest.exports, { sortKeys: (a, b) => a.localeCompare(b) }))
|
||||
.toMatchFileSnapshot(`./exports/${pkg.name}.yaml`)
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,11 @@
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
server: {
|
||||
deps: {
|
||||
inline: ['vitest-package-exports'],
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in new issue
Block a user