summaryrefslogtreecommitdiff
path: root/tools/prettier-plugin-astro/test/test-utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/prettier-plugin-astro/test/test-utils.js')
-rw-r--r--tools/prettier-plugin-astro/test/test-utils.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/prettier-plugin-astro/test/test-utils.js b/tools/prettier-plugin-astro/test/test-utils.js
new file mode 100644
index 000000000..c97fd82de
--- /dev/null
+++ b/tools/prettier-plugin-astro/test/test-utils.js
@@ -0,0 +1,12 @@
+import prettier from 'prettier';
+import { fileURLToPath } from 'url';
+/**
+ * format the contents of an astro file
+ * @param contents {string}
+ */
+export function format(contents) {
+ return prettier.format(contents, {
+ parser: 'astro',
+ plugins: [fileURLToPath(new URL('../', import.meta.url))],
+ });
+}