You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have my project in a directory starting with the letter "x". When I run the tests on my project in this directory, the tests fail with the error below. If I move my project to a different directory starting with a different letter, the tests run successfully.
For example:
Working: C:/Documents/yvue/my-project
Not working: C:/Documents/xvue/my-project
● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.
Here's what you can do:
• If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
• If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation
Details:
SyntaxError: Bad character escape sequence. (2:27)
1 | import { render } from '@testing-library/vue'
> 2 | import HelloWorld from './HelloWorld.vue'
| ^
3 |
4 | describe('Hello World:', () => {
5 | it('renders', async () => {
at instantiate (node_modules/@babel/parser/src/parse-error/credentials.ts:62:21)
at instantiate (node_modules/@babel/parser/src/parse-error.ts:60:12)
at Parser.toParseError [as raise] (node_modules/@babel/parser/src/tokenizer/index.ts:1487:19)
at Object.raise [as invalidEscapeSequence] (node_modules/@babel/parser/src/tokenizer/index.ts:1556:12)
at invalidEscapeSequence (node_modules/@babel/babel-helper-string-parser/src/index.ts:291:14)
at readHexChar (node_modules/@babel/babel-helper-string-parser/src/index.ts:175:24)
at readEscapedChar (node_modules/@babel/babel-helper-string-parser/src/index.ts:78:19)
at Parser.readStringContents [as readString] (node_modules/@babel/parser/src/tokenizer/index.ts:1316:46)
at Parser.readString [as getTokenFromCode] (node_modules/@babel/parser/src/tokenizer/index.ts:975:14)
at Parser.getTokenFromCode [as nextToken] (node_modules/@babel/parser/src/tokenizer/index.ts:272:10)
at Parser.nextToken [as next] (node_modules/@babel/parser/src/tokenizer/index.ts:119:10)
at Parser.next [as parseObjectLike] (node_modules/@babel/parser/src/parser/expression.ts:2032:10)
at Parser.parseObjectLike [as parseExprAtom] (node_modules/@babel/parser/src/parser/expression.ts:1199:21)
at Parser.parseExprAtom [as parseExprSubscripts] (node_modules/@babel/parser/src/parser/expression.ts:718:23)
at Parser.parseExprSubscripts [as parseUpdate] (node_modules/@babel/parser/src/parser/expression.ts:695:21)
at Parser.parseUpdate [as parseMaybeUnary] (node_modules/@babel/parser/src/parser/expression.ts:657:23)
at Parser.parseMaybeUnary [as parseMaybeUnaryOrPrivate] (node_modules/@babel/parser/src/parser/expression.ts:395:14)
at Parser.parseMaybeUnaryOrPrivate [as parseExprOps] (node_modules/@babel/parser/src/parser/expression.ts:407:23)
at Parser.parseExprOps [as parseMaybeConditional] (node_modules/@babel/parser/src/parser/expression.ts:362:23)
at Parser.parseMaybeConditional [as parseMaybeAssign] (node_modules/@babel/parser/src/parser/expression.ts:302:21)
at parseMaybeAssign (node_modules/@babel/parser/src/parser/expression.ts:256:12)
at Parser.callback [as allowInAnd] (node_modules/@babel/parser/src/parser/expression.ts:3085:12)
at Parser.allowInAnd [as parseMaybeAssignAllowIn] (node_modules/@babel/parser/src/parser/expression.ts:255:17)
at Parser.parseMaybeAssignAllowIn [as parseParenAndDistinguishExpression] (node_modules/@babel/parser/src/parser/expression.ts:1784:16)
at Parser.parseParenAndDistinguishExpression [as parseExprAtom] (node_modules/@babel/parser/src/parser/expression.ts:1171:21)
at Parser.parseExprAtom [as parseExprSubscripts] (node_modules/@babel/parser/src/parser/expression.ts:718:23)
at Parser.parseExprSubscripts [as parseUpdate] (node_modules/@babel/parser/src/parser/expression.ts:695:21)
at Parser.parseUpdate [as parseMaybeUnary] (node_modules/@babel/parser/src/parser/expression.ts:657:23)
at Parser.parseMaybeUnary [as parseMaybeUnaryOrPrivate] (node_modules/@babel/parser/src/parser/expression.ts:395:14)
at Parser.parseMaybeUnaryOrPrivate [as parseExprOps] (node_modules/@babel/parser/src/parser/expression.ts:407:23)
at Parser.parseExprOps [as parseMaybeConditional] (node_modules/@babel/parser/src/parser/expression.ts:362:23)
at Parser.parseMaybeConditional [as parseMaybeAssign] (node_modules/@babel/parser/src/parser/expression.ts:302:21)
at Parser.parseMaybeAssign [as parseExpressionBase] (node_modules/@babel/parser/src/parser/expression.ts:225:23)
at parseExpressionBase (node_modules/@babel/parser/src/parser/expression.ts:216:39)
at Parser.callback [as allowInAnd] (node_modules/@babel/parser/src/parser/expression.ts:3080:16)
at Parser.allowInAnd [as parseExpression] (node_modules/@babel/parser/src/parser/expression.ts:216:17)
at Parser.parseExpression [as getExpression] (node_modules/@babel/parser/src/parser/expression.ts:171:23)
at Object.getExpression [as parseExpression] (node_modules/@babel/parser/src/index.ts:76:17)
at prefixIdentifiers (node_modules/@vue/compiler-sfc/dist/compiler-sfc.js:7999:26)
at genCssVarsCode (node_modules/@vue/compiler-sfc/dist/compiler-sfc.js:8146:52)
at Object.compileScript (node_modules/@vue/compiler-sfc/dist/compiler-sfc.js:9013:42)
at processTemplate (node_modules/@vue/vue2-jest/lib/process.js:95:45)
at Object.module.exports [as process] (node_modules/@vue/vue2-jest/lib/process.js:146:26)
at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:542:31)
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:671:40)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:723:19)
at Object.require (src/components/HelloWorld.spec.js:2:1)
In addition, if I remove the v-bind in the css, the tests run successfully.
The text was updated successfully, but these errors were encountered:
OS: Windows 11
Package:
@vue/vue2-jest@29.2.4
I have my project in a directory starting with the letter "x". When I run the tests on my project in this directory, the tests fail with the error below. If I move my project to a different directory starting with a different letter, the tests run successfully.
For example:
Working:
C:/Documents/yvue/my-project
Not working:
C:/Documents/xvue/my-project
Error:
In addition, if I remove the
v-bind
in the css, the tests run successfully.The text was updated successfully, but these errors were encountered: