diff options
Diffstat (limited to 'test/doctool')
-rw-r--r-- | test/doctool/test-doctool-html.mjs | 23 | ||||
-rw-r--r-- | test/doctool/test-doctool-json.mjs | 11 |
2 files changed, 16 insertions, 18 deletions
diff --git a/test/doctool/test-doctool-html.mjs b/test/doctool/test-doctool-html.mjs index b98518c810a..6a64da42cfd 100644 --- a/test/doctool/test-doctool-html.mjs +++ b/test/doctool/test-doctool-html.mjs @@ -3,17 +3,16 @@ import * as fixtures from '../common/fixtures.mjs'; import assert from 'assert'; import { readFileSync } from 'fs'; -import { createRequire } from 'module'; import * as html from '../../tools/doc/html.mjs'; import { replaceLinks } from '../../tools/doc/markdown.mjs'; - -const require = createRequire(new URL('../../tools/doc/', import.meta.url)); -const unified = require('unified'); -const markdown = require('remark-parse'); -const remark2rehype = require('remark-rehype'); -const raw = require('rehype-raw'); -const htmlStringify = require('rehype-stringify'); +import { + rehypeRaw, + rehypeStringify, + remarkParse, + remarkRehype, + unified, +} from '../../tools/doc/deps.mjs'; // Test links mapper is an object of the following structure: // { @@ -31,14 +30,14 @@ const testLinksMapper = { function toHTML({ input, filename, nodeVersion, versions }) { const content = unified() .use(replaceLinks, { filename, linksMapper: testLinksMapper }) - .use(markdown) + .use(remarkParse) .use(html.firstHeader) .use(html.preprocessText, { nodeVersion }) .use(html.preprocessElements, { filename }) .use(html.buildToc, { filename, apilinks: {} }) - .use(remark2rehype, { allowDangerousHtml: true }) - .use(raw) - .use(htmlStringify) + .use(remarkRehype, { allowDangerousHtml: true }) + .use(rehypeRaw) + .use(rehypeStringify) .processSync(input); return html.toHTML({ input, content, filename, nodeVersion, versions }); diff --git a/test/doctool/test-doctool-json.mjs b/test/doctool/test-doctool-json.mjs index d3badf84f55..eb1c9b2ea8c 100644 --- a/test/doctool/test-doctool-json.mjs +++ b/test/doctool/test-doctool-json.mjs @@ -3,13 +3,12 @@ import * as fixtures from '../common/fixtures.mjs'; import assert from 'assert'; import fs from 'fs'; -import { createRequire } from 'module'; import * as json from '../../tools/doc/json.mjs'; - -const require = createRequire(new URL('../../tools/doc/', import.meta.url)); -const unified = require('unified'); -const markdown = require('remark-parse'); +import { + remarkParse, + unified, +} from '../../tools/doc/deps.mjs'; function toJSON(input, filename, cb) { function nullCompiler() { @@ -17,7 +16,7 @@ function toJSON(input, filename, cb) { } unified() - .use(markdown) + .use(remarkParse) .use(json.jsonAPI, { filename }) .use(nullCompiler) .process(input, cb); |