summaryrefslogtreecommitdiff
path: root/test/test-utils.js
blob: 5d51826363747a45b4e4eef185d05ba974f1ef2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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))]
  })
}