diff options
Diffstat (limited to 'test/test-utils.js')
-rw-r--r-- | test/test-utils.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test-utils.js b/test/test-utils.js index 93bf28788..5d5182636 100644 --- a/test/test-utils.js +++ b/test/test-utils.js @@ -1,5 +1,18 @@ import cheerio from 'cheerio'; +import prettier from 'prettier'; +import { fileURLToPath } from 'url'; /** load html */ export function doc(html) { return cheerio.load(html); } + +/** + * format the contents of an astro file + * @param contents {string} + */ +export function format(contents) { + return prettier.format(contents, { + parser: 'astro', + plugins: [fileURLToPath(new URL('../prettier-plugin-astro', import.meta.url))] + }) +} |