This repository has been archived by the owner on Feb 7, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { codeToHtml } from 'shikiji' | ||
import { rendererRich, transformerTwoSlash } from 'shikiji-twoslash' | ||
import { describe, expect, it } from 'vitest' | ||
|
||
const files = import.meta.glob('./fixtures/*.*', { as: 'raw', eager: true }) | ||
|
||
describe('fixtures', () => { | ||
for (const file in files) { | ||
it('should works', async () => { | ||
const code = files[file] | ||
const ext = file.split('.').pop()! | ||
const html = await codeToHtml(code, { | ||
lang: ext, | ||
theme: 'vitesse-dark', | ||
transformers: [ | ||
transformerTwoSlash({ | ||
renderer: rendererRich(), | ||
}), | ||
], | ||
}) | ||
|
||
const style = '<link rel="stylesheet" href="../../../style-rich.css" />' | ||
expect(style + html).toMatchFileSnapshot(`./out/${file}.html`) | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// @noErrors | ||
console.e | ||
// ^| |
2 changes: 2 additions & 0 deletions
2
packages/shikiji-twoslash/test/out/fixtures/completion-end.ts.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<link rel="stylesheet" href="../../../style-rich.css" /><pre class="shiki vitesse-dark twoslash lsp" style="background-color:#121212;color:#dbd7caee" tabindex="0"><code><span class="line"><span style="color:#BD976A">console</span><span style="color:#666666">.</span><span style="color:#BD976A"><span>e<span class="twoslash-completions-list"><ul><li><span class="twoslash-completions-icon completions-method"><svg viewBox="0 0 32 32"><path fill="currentColor" d="m19.626 29.526l-.516-1.933a12.004 12.004 0 0 0 6.121-19.26l1.538-1.28a14.003 14.003 0 0 1-7.143 22.473"></path><path fill="currentColor" d="M10 29H8v-3.82l.804-.16C10.262 24.727 12 23.62 12 20v-1.382l-4-2v-2.236l4-2V12c0-5.467 3.925-9 10-9h2v3.82l-.804.16C21.738 7.273 20 8.38 20 12v.382l4 2v2.236l-4 2V20c0 5.467-3.925 9-10 9m0-2c4.935 0 8-2.682 8-7v-2.618l3.764-1.882L18 13.618V12c0-4.578 2.385-6.192 4-6.76V5c-4.935 0-8 2.682-8 7v1.618L10.236 15.5L14 17.382V20c0 4.578-2.385 6.192-4 6.76Z"></path><path fill="currentColor" d="M5.231 24.947a14.003 14.003 0 0 1 7.147-22.474l.516 1.932a12.004 12.004 0 0 0-6.125 19.263Z"></path></svg></span><span><span class="twoslash-completions-matched">e</span><span class="twoslash-completions-unmatched">rror</span></span></li></ul></span></span></span></span> | ||
<span class="line"></span></code></pre> |