Giter Site home page Giter Site logo

Comments (14)

estyh avatar estyh commented on May 7, 2024 1

I just ran into the same issue, cloned the repo a few days ago. Using npm, jest encounters an unexpected token. Using yarn, it runs fine.
Changing babelrc.js to babel.config.js didn't help. Neither did updating the dependencies. I don't want to make my team install yarn when we are already using npm for everything else.
I am on windows 10
Node 9.5.0
npm 6.4.1

from vue-enterprise-boilerplate.

chrisvfritz avatar chrisvfritz commented on May 7, 2024 1

I believe the problem is now really fixed. For existing projects, downgrading babel-jest to 23.6.x is the key, though you'll also have to delete node_modules and package-lock.json and reinstall after downgrading, due to a bug in NPM's module resolution.

from vue-enterprise-boilerplate.

chrisvfritz avatar chrisvfritz commented on May 7, 2024 1

@bmillspaugh I wasn't able to reproduce the issue and haven't seen it reported again since, so hopefully this was a temporary regression solved in a patch update. For anyone that may want to temporarily disable unit tests in the future, you can do by adding a # at the beginning of the values of the following scripts in package.json: test:unit, test:unit:file, and test:unit:ci. That comments them out, essentially making them a noop.

from vue-enterprise-boilerplate.

frandiox avatar frandiox commented on May 7, 2024

@mix3d Can you try renaming babelrc.js to babel.config.js and see if it works?

from vue-enterprise-boilerplate.

ecasilla avatar ecasilla commented on May 7, 2024

Nope babel.config.js doesn't affect the jest error

from vue-enterprise-boilerplate.

chrisvfritz avatar chrisvfritz commented on May 7, 2024

I haven't been able to reproduce this, but I've just updated Vue CLI, which may fix the problem. @mix3d @ecasilla Can you confirm whether you still see this error with a fresh clone? If you still do, can you provide more information about your environment, including operating system, node version, and NPM version?

from vue-enterprise-boilerplate.

graberzz avatar graberzz commented on May 7, 2024

faced the same issue, updating all dependencies fixed it

from vue-enterprise-boilerplate.

chrisvfritz avatar chrisvfritz commented on May 7, 2024

@graberzz Strange - all the dependencies should have been relatively up-to-date when cloning. Would you mind sharing exactly which dependencies were causing a problem for you?

from vue-enterprise-boilerplate.

ArmandoHerra avatar ArmandoHerra commented on May 7, 2024

Hoping my case helps a bit with reproducing this error.

I found the instance where the unit tests are failing.

At the moment here are my specs and versions:

ProductName: Mac OS X
ProductVersion: 10.13.6
BuildVersion: 17G65
Node: v9.10.0
NPM: 6.4.1
Yarn: 1.9.4

I reproduced the getting started steps both using NPM and Yarn. Using NPM ('npm install') makes the test fail and using Yarn ('yarn') makes things go smoothly and are all working.

Steps on cloned repo with directory named 'issue_77' left screen:

Steps on cloned repo with directory named 'issue_77_2' right screen:

captura de pantalla 2018-09-14 a la s 11 14 02

I still haven't checked deeper into why this is happening but I'll definitely try and see why the discrepancy and why only using 'npm install' makes the tests break. I'm hoping my observation helps out into helping solve this issue.

from vue-enterprise-boilerplate.

chrisvfritz avatar chrisvfritz commented on May 7, 2024

It looks like the root cause here was a bug in NPM's module resolution. I've just committed a workaround that seems to have fixed it though. If anyone is still encountering the problem, please let me know.

from vue-enterprise-boilerplate.

aliaksandr-savitski avatar aliaksandr-savitski commented on May 7, 2024

Hi, I've just encountered this issue with npm.
Cloned repo -> npm i -> npm run test:unit

Test suite failed to run

    /{path-to-propject}/vue-enterprise-boilerplate/tests/unit/setup.js: Unexpected token (84:17)

      Jest encountered an unexpected token
      This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
      By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
      Here's what you can do:
       • 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/en/configuration.html
      Details:
        82 |         functional: true,
        83 |         render(h, { slots }) {
      > 84 |           return <div>{slots().default}</div>
           |                  ^
        85 |         },
        86 |       },
        87 |       ...(options.stubs || {}),

npm 6.9.0
node v10.14.1

Can you advise please?

from vue-enterprise-boilerplate.

tinynow avatar tinynow commented on May 7, 2024

I am encountering the same error.
npm 6.4.1
node v10.15.3

from vue-enterprise-boilerplate.

bmillspaugh avatar bmillspaugh commented on May 7, 2024

Still appears to fail on a new clone of the repo (post fix):

git clone https://github.com/chrisvfritz/vue-enterprise-boilerplate.git unit-test-error
cd unit-test-error
yarn
yarn test:unit

With the same error:

Jest encountered an unexpected token

SyntaxError: F:\source\git\unit-test-error\tests\unit\setup.js: Unexpected token (84:17)
      82 |         functional: true,
      83 |         render(h, { slots }) {
    > 84 |           return <div>{slots().default}</div>
         |                  ^
      85 |         },
      86 |       },
      87 |       ...(options.stubs || {}),

Is there a way to temporarily disable all tests until this is resolved (without having to delete the tests) since it prevents you from committing any changes, and also from publishing any npm packages via lerna (which requires you to commit first)?

node 11.15.0 / npm 6.7.0 / yarn 1.13.0 / jest 23.6.0

from vue-enterprise-boilerplate.

jcaruthersjr avatar jcaruthersjr commented on May 7, 2024

@chrisvfritz I am getting the same error with yarn and npm with versions [email protected] and [email protected]

from vue-enterprise-boilerplate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.