question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tagged template strings are not supported

See original GitHub issue

If tagged template strings are used, test suit will fail with following error:

Tagged template strings are not supported. Use `transforms: { templateString: false }` to skip transformation and disable this error, or `transforms: { dangerousTaggedTemplateString: true }` if you know what you're doing (1:303)

      at Node.initialise (node_modules/vue-template-es2015-compiler/buble.js:12998:10)
          at Array.forEach (<anonymous>)
          at Array.forEach (<anonymous>)

Apparently, this error message is from buble.js. It seems that vue-jest uses vue-template-es2015-compiler, and vue-template-es2015-compiler uses buble. But neither vue-jest nor vue-template-es2015-compiler explains whether it is necessary and how to configure buble.

Is it possible to resolve this in vue-jest? Any fixes or explanations are appreciated. Thank you.

I created a sample project to illustrate the issue. Steps to reproduce:

  1. clone https://github.com/mjss/vue-jest-with-tagged-template
  2. run npm test:unit

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
FRSgitcommented, Sep 28, 2020

Hey, I’ve added a fix (or rather - I’ve extended the vue-jest library to address this issue) and created a PR #288.

If you want to use it in your project where you have vue-jest as a direct dependency:

  • remove the package with npm uninstall vue-jest or yarn remove vue-jest,
  • add it back from my fork npm install --save-dev https://github.com/FRSource/vue-jest#feat-add-compile-template-options or yarn add -D https://github.com/FRSource/vue-jest#feat-add-compile-template-options.

Or if you’re using vue-jest via @vue/cli-plugin-unit-jest:

  • add this to your package.json:
    "resolutions": {
      "**/vue-jest": "git+https://github.com/FRSource/vue-jest#feat-add-compile-template-options"
    }
    
  • run yarn install.

And ofc stay updated on when the #288 would get merged into the master to switch back to the official vue-jest package!

0reactions
danrochacommented, Jan 30, 2020

No, I gave up on the apollo components a while ago!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tagged template strings are not supported · Issue #720 - GitHub
I want to include the following styled-components example: const styled = require("styled-components"); const StyledBalance ...
Read more >
Template literals (Template strings) - JavaScript | MDN
However, a tagged template literal may not result in a string; ... Almost all characters are allowed literally, including line breaks and ...
Read more >
ES6 Template Literals (Template Strings) - CanIUse
Template literals are string literals allowing embedded expressions using backtick characters (`). You can use multi-line strings and string interpolation ...
Read more >
javascript - Problem with tagged template strings and closure
Basically, if not to go in details, I use tagged template literal to temporarily change the _mode property on thread instance. So the...
Read more >
Tagged template literals is not support in PHP Storm. - YouTrack
Tagged template literals is not support in PHP Storm. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals. Attachments 1.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found