jest-vue-preprocessor icon indicating copy to clipboard operation
jest-vue-preprocessor copied to clipboard

Block-scoped declarations not yet supported outside of strict mode

Open Nikhil-Shenoy opened this issue 7 years ago • 2 comments

I'm trying to run Jest on a React app that I have which uses Vue.js for some components, but I keep running into an error that says Block-scoped declarations not yet supported outside strict mode. I've looked into issues filed on this repository, along with on Stack Overflow, with the same error, but nothing that I tried from those sources has worked. One solution that was presented was to put use strict at the top of my files, but since my project contains hundreds of files, I'd rather not do that. I'm posting here in the hope that I can finally find a solution. I am using the latest version of Jest, I have tried re-installing my node_modules folder, and I have run Jest with the --no-cache option with no success. Attached are what I believe are the relevant files. The complete text of the error:

 C:\Users\z003pudj\Documents\Project X\projectX-core>npm test

 > [email protected] test C:\Users\z003pudj\Documents\Project X\projectX-core
 > jest --config=./__tests__/jest.config

 FAIL  __tests__\sum.test.js
 ? Test suite failed to run

 SyntaxError: Block-scoped declarations (let, const, function, class) not yet
   supported outside strict mode

      at exports.runInThisContext (vm.js:53:16)
      at Module._compile (module.js:373:25)
      at Object.Module._extensions..js (module.js:416:10)
      at Module.load (module.js:343:32)
      at Function.Module._load (module.js:300:12)
      at Module.require (module.js:353:17)
      at require (internal\module.js:12:17)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        5.053s
Ran all test suites.
 console.log src\js\config.js:8
   INCLUDE_TESTING

  console.info node_modules\vue\dist\vue.runtime.common.js:6111
    You are running Vue in development mode.
    Make sure to turn on production mode when deploying for production.
    See more tips at https://vuejs.org/guide/deployment.html

npm ERR! Test failed.  See above for more details.`

Apologies for the .txt extensions. Couldn't upload the files otherwise.

sum.js.txt package.json.txt .babelrc.txt sum.test.js.txt webpack.config.dev.js.txt jest.config.txt

Nikhil-Shenoy avatar Feb 21 '17 15:02 Nikhil-Shenoy

+1

josantana avatar Mar 02 '17 21:03 josantana

@Nikhil-Shenoy can you please create a sample repo, push the code there, I'll check it and try to reproduce steps.

vire avatar Mar 04 '17 17:03 vire