-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes usage of Code component in Vercel (#6198)
* Fixes usage of Code component in Vercel * Adding a changeset
- Loading branch information
Showing
3 changed files
with
60 additions
and
5 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,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fixes usage of Code component in Vercel |
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
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,40 @@ | ||
import { expect } from 'chai'; | ||
import { createContainer } from '../../../dist/core/dev/index.js'; | ||
import { createViteLoader } from '../../../dist/core/module-loader/index.js'; | ||
|
||
const root = new URL('../../fixtures/alias/', import.meta.url); | ||
|
||
describe('<Code />', () => { | ||
describe('Shiki - getHighlighterOptions', () => { | ||
let container; | ||
let mod; | ||
before(async () => { | ||
container = await createContainer({ root, disableTelemetry: true }); | ||
const loader = createViteLoader(container.viteServer); | ||
mod = await loader.import('astro/components/Shiki.js'); | ||
}); | ||
|
||
after(async () => { | ||
await container.close(); | ||
}) | ||
|
||
it('uses the bundles themes for built-in themes', async () => { | ||
const { resolveHighlighterOptions } = mod; | ||
const opts = await resolveHighlighterOptions({ theme: 'css-variables' }); | ||
const themes = opts.themes; | ||
|
||
expect(themes).to.have.a.lengthOf(1); | ||
expect(themes[0]).to.be.an('object'); | ||
}); | ||
|
||
it('uses the string theme name for custom themes', async () => { | ||
const { resolveHighlighterOptions } = mod; | ||
const opts = await resolveHighlighterOptions({ theme: 'some-custom-theme' }); | ||
const themes = opts.themes; | ||
|
||
expect(themes).to.have.a.lengthOf(1); | ||
expect(themes[0]).to.be.an('string'); | ||
expect(themes[0]).to.equal('some-custom-theme'); | ||
}) | ||
}); | ||
}); |