Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken Tests #419

Closed
curran opened this issue Jan 28, 2024 · 1 comment · Fixed by #424
Closed

Broken Tests #419

curran opened this issue Jan 28, 2024 · 1 comment · Fixed by #424

Comments

@curran
Copy link
Contributor

curran commented Jan 28, 2024

I noticed that in the current master, the npm test command fails with the following error:

$ npm test

> prettier-plugin-svelte@3.1.2 test
> ava


SyntaxError: Unexpected token (3:21)
  1 |
  2 |         {
> 3 |           "@context": "https://schema.org",
    |                     ^
  4 |           "@type": "etc..."
  5 |         }
  6 |     
    at Ka (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/plugins/babel.mjs:15:1323)
    at qa (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/plugins/babel.mjs:15:1472)
    at Object.parse (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/plugins/babel.mjs:16:17099)
    at parse (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/index.mjs:17080:24)
    at async textToDoc (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/index.mjs:18032:19) {
  loc: { start: { line: 3, column: 21 } },
  cause: SyntaxError: Unexpected token (3:20)
      at Hi (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/plugins/babel.mjs:1:1666)
      at s (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/plugins/babel.mjs:3:11189)
      at tt.raise (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/plugins/babel.mjs:5:19557)
      at tt.unexpected (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/plugins/babel.mjs:5:19959)
      at tt.parseExprAtom (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/plugins/babel.mjs:7:94078)
      at tt.parseExprAtom (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/plugins/babel.mjs:7:5406)
      at tt.parseExprSubscripts (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/plugins/babel.mjs:7:86651)
      at tt.parseUpdate (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/plugins/babel.mjs:7:86279)
      at tt.parseMaybeUnary (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/plugins/babel.mjs:7:85908)
      at tt.parseMaybeUnary (file:///home/curran/repos/prettier-plugin-svelte-browser/node_modules/prettier/plugins/babel.mjs:7:63844) {
    code: 'BABEL_PARSER_SYNTAX_ERROR',
    reasonCode: 'UnexpectedToken',
    loc: B { line: 3, column: 20, index: 31 },
    pos: [Getter/Setter]
  },
  codeFrame: '  1 |\n' +
    '  2 |         {\n' +
    '> 3 |           "@context": "https://schema.org",\n' +
    '    |                     ^\n' +
    '  4 |           "@type": "etc..."\n' +
    '  5 |         }\n' +
    '  6 |     '
}
  285 tests passed

curran added a commit to vizhub-core/prettier-plugin-svelte-browser that referenced this issue Jan 28, 2024
@dummdidumm
Copy link
Member

The test isn't broken, it's just emitting the inner error but proceeds with the outer format. This is all working as expected. That said, we can certainly silence it by supporting JSON in script tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants