mirror of
https://github.com/withastro/astro.git
synced 2025-01-13 22:11:20 -05:00
prettier-plugin: Add a test for JSX embedded in an attribute. This test currently fails. (#508)
* Add a test for JSX embedded in an attribute. This test currently fails. * Oops forgot the semicolons on the correct output * Add `--scope prettier-plugin-astro` so that the prettier plugin is tested on default CI * Replace `assert.equal` with `assert.fixture` to remain inline w/ main * Update astro-prettier.test.js * Skip the other failing test. Co-authored-by: Fred K. Schott <fkschott@gmail.com>
This commit is contained in:
parent
8aca0fabaf
commit
05d6fc66bb
4 changed files with 23 additions and 2 deletions
|
@ -17,7 +17,7 @@
|
||||||
"dev:vscode": "lerna run dev --scope astro-languageserver --scope astro-vscode --scope @astrojs/parser --parallel --stream",
|
"dev:vscode": "lerna run dev --scope astro-languageserver --scope astro-vscode --scope @astrojs/parser --parallel --stream",
|
||||||
"format": "prettier -w \"**/*.{js,jsx,ts,tsx,md,json}\"",
|
"format": "prettier -w \"**/*.{js,jsx,ts,tsx,md,json}\"",
|
||||||
"lint": "eslint \"packages/**/*.ts\"",
|
"lint": "eslint \"packages/**/*.ts\"",
|
||||||
"test": "lerna run test --scope astro --stream",
|
"test": "lerna run test --scope astro --scope prettier-plugin-astro --stream",
|
||||||
"test:core": "yarn workspace astro run test",
|
"test:core": "yarn workspace astro run test",
|
||||||
"test:templates": "lerna run test --scope create-astro --stream"
|
"test:templates": "lerna run test --scope create-astro --stream"
|
||||||
},
|
},
|
||||||
|
|
|
@ -33,7 +33,7 @@ Prettier('can format an Astro file with frontmatter', async () => {
|
||||||
assert.fixture(formatted, out);
|
assert.fixture(formatted, out);
|
||||||
});
|
});
|
||||||
|
|
||||||
Prettier('can format an Astro file with embedded JSX expressions', async () => {
|
Prettier.skip('can format an Astro file with embedded JSX expressions', async () => {
|
||||||
const [src, out] = await getFiles('embedded-expr');
|
const [src, out] = await getFiles('embedded-expr');
|
||||||
assert.not.fixture(src, out);
|
assert.not.fixture(src, out);
|
||||||
|
|
||||||
|
@ -41,4 +41,13 @@ Prettier('can format an Astro file with embedded JSX expressions', async () => {
|
||||||
assert.fixture(formatted, out);
|
assert.fixture(formatted, out);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// This is currently failing! See: https://github.com/snowpackjs/astro/issues/478
|
||||||
|
Prettier.skip('can format an Astro file with a JSX expression in an attribute', async () => {
|
||||||
|
const [src, out] = await getFiles('attribute-with-embedded-expr');
|
||||||
|
assert.not.fixture(src, out);
|
||||||
|
|
||||||
|
const formatted = format(src);
|
||||||
|
assert.fixture(formatted, out);
|
||||||
|
});
|
||||||
|
|
||||||
Prettier.run();
|
Prettier.run();
|
||||||
|
|
6
tools/prettier-plugin-astro/test/fixtures/in/attribute-with-embedded-expr.astro
vendored
Normal file
6
tools/prettier-plugin-astro/test/fixtures/in/attribute-with-embedded-expr.astro
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
export let post
|
||||||
|
export let author
|
||||||
|
---
|
||||||
|
|
||||||
|
<a class="author" href={`/author/${post.author}`}>{author.name}</a>
|
6
tools/prettier-plugin-astro/test/fixtures/out/attribute-with-embedded-expr.astro
vendored
Normal file
6
tools/prettier-plugin-astro/test/fixtures/out/attribute-with-embedded-expr.astro
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
export let post;
|
||||||
|
export let author;
|
||||||
|
---
|
||||||
|
|
||||||
|
<a class="author" href={`/author/${post.author}`}>{author.name}</a>
|
Loading…
Add table
Reference in a new issue