Skip to content

Commit ece4b02

Browse files
committed
test: snapshot public exports
1 parent b4820d7 commit ece4b02

File tree

15 files changed

+571
-0
lines changed

15 files changed

+571
-0
lines changed

package.json

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@shikijs/vitepress-twoslash": "workspace:*",
3939
"@types/fs-extra": "catalog:",
4040
"@types/hast": "catalog:",
41+
"@types/js-yaml": "catalog:",
4142
"@types/node": "catalog:",
4243
"@vitest/coverage-v8": "catalog:",
4344
"ansi-sequence-parser": "catalog:",
@@ -48,9 +49,11 @@
4849
"eslint-plugin-format": "catalog:",
4950
"esno": "catalog:",
5051
"fast-glob": "catalog:",
52+
"find-up-simple": "catalog:",
5153
"fs-extra": "catalog:",
5254
"hast-util-to-html": "catalog:",
5355
"jiti": "catalog:",
56+
"js-yaml": "catalog:",
5457
"jsonc-parser": "catalog:",
5558
"lint-staged": "catalog:",
5659
"markdown-it": "catalog:",
@@ -75,6 +78,7 @@
7578
"vite-tsconfig-paths": "catalog:",
7679
"vitepress-plugin-mermaid": "catalog:",
7780
"vitest": "catalog:",
81+
"vitest-package-exports": "catalog:",
7882
"vue-tsc": "catalog:",
7983
"wrangler": "catalog:"
8084
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { fileURLToPath } from 'node:url'
2+
import yaml from 'js-yaml'
3+
import { expect, it } from 'vitest'
4+
import { getPackageExportsManifest } from 'vitest-package-exports'
5+
6+
it('exports-snapshot', async () => {
7+
const manifest = await getPackageExportsManifest({
8+
importMode: 'src',
9+
cwd: fileURLToPath(import.meta.url),
10+
})
11+
expect(yaml.dump(manifest.exports)).toMatchInlineSnapshot(`
12+
".:
13+
transformerColorizedBrackets: function
14+
"
15+
`)
16+
})

packages/core/test/exports.test.ts

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { fileURLToPath } from 'node:url'
2+
import yaml from 'js-yaml'
3+
import { expect, it } from 'vitest'
4+
import { getPackageExportsManifest } from 'vitest-package-exports'
5+
6+
it('exports-snapshot', async () => {
7+
const manifest = await getPackageExportsManifest({
8+
importMode: 'src',
9+
cwd: fileURLToPath(import.meta.url),
10+
})
11+
expect(yaml.dump(manifest.exports)).toMatchInlineSnapshot(`
12+
".:
13+
addClassToHast: function
14+
applyColorReplacements: function
15+
codeToHast: function
16+
codeToHtml: function
17+
codeToTokens: function
18+
codeToTokensBase: function
19+
codeToTokensWithThemes: function
20+
createCssVariablesTheme: function
21+
createdBundledHighlighter: function
22+
createHighlighterCore: function
23+
createHighlighterCoreSync: function
24+
createPositionConverter: function
25+
createShikiInternal: function
26+
createShikiInternalSync: function
27+
createSingletonShorthands: function
28+
enableDeprecationWarnings: function
29+
flatTokenVariants: function
30+
getSingletonHighlighterCore: function
31+
getTokenStyleObject: function
32+
guessEmbeddedLanguages: function
33+
hastToHtml: function
34+
isNoneTheme: function
35+
isPlainLang: function
36+
isSpecialLang: function
37+
isSpecialTheme: function
38+
makeSingletonHighlighter: function
39+
makeSingletonHighlighterCore: function
40+
normalizeGetter: function
41+
normalizeTheme: function
42+
resolveColorReplacements: function
43+
ShikiError: function
44+
splitLines: function
45+
splitToken: function
46+
splitTokens: function
47+
stringifyTokenStyle: function
48+
toArray: function
49+
tokenizeAnsiWithTheme: function
50+
tokenizeWithTheme: function
51+
tokensToHast: function
52+
transformerDecorations: function
53+
warnDeprecated: function
54+
./textmate:
55+
disposeOnigString: function
56+
EncodedTokenMetadata: function
57+
FindOption: object
58+
FontStyle: object
59+
INITIAL: object
60+
Registry: function
61+
Theme: function
62+
"
63+
`)
64+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { fileURLToPath } from 'node:url'
2+
import yaml from 'js-yaml'
3+
import { expect, it } from 'vitest'
4+
import { getPackageExportsManifest } from 'vitest-package-exports'
5+
6+
it('exports-snapshot', async () => {
7+
const manifest = await getPackageExportsManifest({
8+
importMode: 'src',
9+
cwd: fileURLToPath(import.meta.url),
10+
})
11+
expect(yaml.dump(manifest.exports)).toMatchInlineSnapshot(`
12+
".:
13+
createJavaScriptRawEngine: function
14+
createJavaScriptRegexEngine: function
15+
defaultJavaScriptRegexConstructor: function
16+
JavaScriptScanner: function
17+
./raw:
18+
createJavaScriptRawEngine: function
19+
"
20+
`)
21+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { fileURLToPath } from 'node:url'
2+
import yaml from 'js-yaml'
3+
import { expect, it } from 'vitest'
4+
import { getPackageExportsManifest } from 'vitest-package-exports'
5+
6+
it('exports-snapshot', async () => {
7+
const manifest = await getPackageExportsManifest({
8+
importMode: 'src',
9+
cwd: fileURLToPath(import.meta.url),
10+
})
11+
expect(yaml.dump(manifest.exports)).toMatchInlineSnapshot(`
12+
".:
13+
createOnigurumaEngine: function
14+
getDefaultWasmLoader: function
15+
loadWasm: function
16+
setDefaultWasmLoader: function
17+
./wasm-inlined:
18+
default: function
19+
getWasmInstance: function
20+
wasmBinary: object
21+
"
22+
`)
23+
})
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { fileURLToPath } from 'node:url'
2+
import yaml from 'js-yaml'
3+
import { expect, it } from 'vitest'
4+
import { getPackageExportsManifest } from 'vitest-package-exports'
5+
6+
it('exports-snapshot', async () => {
7+
const manifest = await getPackageExportsManifest({
8+
importMode: 'src',
9+
cwd: fileURLToPath(import.meta.url),
10+
})
11+
expect(yaml.dump(manifest.exports)).toMatchInlineSnapshot(`
12+
".:
13+
default: function
14+
fromHighlighter: function
15+
setupMarkdownIt: function
16+
./core:
17+
fromHighlighter: function
18+
setupMarkdownIt: function
19+
./async:
20+
fromAsyncCodeToHtml: function
21+
setupMarkdownWithCodeToHtml: function
22+
"
23+
`)
24+
})

packages/monaco/test/exports.test.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { fileURLToPath } from 'node:url'
2+
import yaml from 'js-yaml'
3+
import { expect, it } from 'vitest'
4+
import { getPackageExportsManifest } from 'vitest-package-exports'
5+
6+
it('exports-snapshot', async () => {
7+
const manifest = await getPackageExportsManifest({
8+
importMode: 'src',
9+
cwd: fileURLToPath(import.meta.url),
10+
})
11+
expect(yaml.dump(manifest.exports)).toMatchInlineSnapshot(`
12+
".:
13+
shikiToMonaco: function
14+
textmateThemeToMonacoTheme: function
15+
"
16+
`)
17+
})

packages/rehype/test/exports.test.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { fileURLToPath } from 'node:url'
2+
import yaml from 'js-yaml'
3+
import { expect, it } from 'vitest'
4+
import { getPackageExportsManifest } from 'vitest-package-exports'
5+
6+
it('exports-snapshot', async () => {
7+
const manifest = await getPackageExportsManifest({
8+
importMode: 'src',
9+
cwd: fileURLToPath(import.meta.url),
10+
})
11+
expect(yaml.dump(manifest.exports)).toMatchInlineSnapshot(`
12+
".:
13+
default: function
14+
./core:
15+
default: function
16+
"
17+
`)
18+
})

0 commit comments

Comments
 (0)