summaryrefslogtreecommitdiff
path: root/packages/markdown/remark/test/plugins.test.js
diff options
context:
space:
mode:
authorGravatar Bjorn Lu <bjornlu.dev@gmail.com> 2023-09-14 18:22:16 +0800
committerGravatar GitHub <noreply@github.com> 2023-09-14 18:22:16 +0800
commit7522bb4914f2f9e8b8f3c743bc9c941fd3aca644 (patch)
treed2d5491adb3c3fe85102679f2c5468c30df80c39 /packages/markdown/remark/test/plugins.test.js
parent61ac5c9eaa47e7a8039f9cbee20cd73f9cee4516 (diff)
downloadastro-7522bb4914f2f9e8b8f3c743bc9c941fd3aca644.tar.gz
astro-7522bb4914f2f9e8b8f3c743bc9c941fd3aca644.tar.zst
astro-7522bb4914f2f9e8b8f3c743bc9c941fd3aca644.zip
Improve markdown rendering performance (#8532)
Diffstat (limited to 'packages/markdown/remark/test/plugins.test.js')
-rw-r--r--packages/markdown/remark/test/plugins.test.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/packages/markdown/remark/test/plugins.test.js b/packages/markdown/remark/test/plugins.test.js
index 35e5dcaf8..ce2401047 100644
--- a/packages/markdown/remark/test/plugins.test.js
+++ b/packages/markdown/remark/test/plugins.test.js
@@ -1,5 +1,4 @@
-import { renderMarkdown } from '../dist/index.js';
-import { mockRenderMarkdownParams } from './test-utils.js';
+import { createMarkdownProcessor } from '../dist/index.js';
import chai from 'chai';
import { fileURLToPath } from 'node:url';
@@ -8,9 +7,8 @@ describe('plugins', () => {
// https://github.com/withastro/astro/issues/3264
it('should be able to get file path when passing fileURL', async () => {
let context;
- await renderMarkdown(`test`, {
- ...mockRenderMarkdownParams,
- fileURL: new URL('virtual.md', import.meta.url),
+
+ const processor = await createMarkdownProcessor({
remarkPlugins: [
function () {
const transformer = (tree, file) => {
@@ -22,6 +20,10 @@ describe('plugins', () => {
],
});
+ await processor.render(`test`, {
+ fileURL: new URL('virtual.md', import.meta.url),
+ });
+
chai.expect(typeof context).to.equal('object');
chai.expect(context.path).to.equal(fileURLToPath(new URL('virtual.md', import.meta.url)));
});