hapijs / lab

Node test utility
Other
739 stars 176 forks source link

TypeError: Cannot read property 'ecmaFeatures' of undefined #854

Closed binarymist closed 5 years ago

binarymist commented 6 years ago
"eslint": "^5.4.0",
"eslint-config-airbnb-base": "^13.1.0",
"lab": "^16.0.0",

When I run lab --assert code : no problem When I ran lab --assert code --coverage before upgrading from "eslint": "^4.19.1", "lab": "^15.5.0" : no problem

After upgrade: When I run lab --assert code --coverage

Error requiring file: /Source/purpleteam/test/presenter/apiDecoratingAdapter.js
Cannot read property 'ecmaFeatures' of undefined
TypeError: Cannot read property 'ecmaFeatures' of undefined
    at Parser.parseTopLevel (/Source/purpleteam/node_modules/rewire/node_modules/espree/espree.js:312:23)
    at Parser.parse (/Source/purpleteam/node_modules/acorn/dist/acorn.js:551:15)
    at Object.parse (/Source/purpleteam/node_modules/acorn/dist/acorn.js:5287:37)
    at Object.parse (/Source/purpleteam/node_modules/espree/espree.js:572:21)
    at Object.internals.instrument (/Source/purpleteam/node_modules/lab/lib/coverage.js:268:25)
    at Object.require.extensions.(anonymous function) [as .js] (/Source/purpleteam/node_modules/lab/lib/coverage.js:32:55)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/Source/purpleteam/test/presenter/apiDecoratingAdapter.js:16:13)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.require.extensions.(anonymous function) [as .js] (/Source/purpleteam/node_modules/lab/lib/coverage.js:37:28)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at testFiles.forEach (/Source/purpleteam/node_modules/lab/lib/cli.js:137:13)
    at Array.forEach (<anonymous>)
    at Object.internals.traverse (/Source/purpleteam/node_modules/lab/lib/cli.js:131:15)
    at Object.exports.run (/Source/purpleteam/node_modules/lab/lib/cli.js:64:31)
    at main (/Source/purpleteam/node_modules/lab/bin/lab:52:48)
    at Object.<anonymous> (/Source/purpleteam/node_modules/lab/bin/lab:59:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:266:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! purpleteam@0.1.0-alpha.1 test: `lab --assert code --coverage`
npm ERR! Exit status 1
binarymist commented 6 years ago

I downgraded lab, and problem persists, so seems that the issue is with eslint.

binarymist commented 6 years ago

No, cache was dirty, issue is still with lab, in fact it looks most likely to be due to the espree upgrade

binarymist commented 6 years ago

lab 16.0.0 is using two versions of espree. As seen in package-lock.json

    "lab": {
      "version": "16.0.0",
      "resolved": "https://registry.npmjs.org/lab/-/lab-16.0.0.tgz",
      "integrity": "sha512-RiJYiGzaphEkQeoaENJevdBArwuQOil4p7azwGtLDz58/g/TtbAAODsP/ECQPmXkNORkkHd2WK8CNf9hG8iI+g==",
      "dev": true,
      "requires": {
        "bossy": "4.x.x",
        "diff": "3.5.x",
        "eslint": "5.4.x",
        "eslint-config-hapi": "12.x.x",
        "eslint-plugin-hapi": "4.x.x",
        "espree": "4.0.x",
        "find-rc": "3.0.x",
        "handlebars": "4.x.x",
        "hoek": "5.x.x",
        "json-stable-stringify": "1.x.x",
        "json-stringify-safe": "5.x.x",
        "mkdirp": "0.5.x",
        "seedrandom": "2.4.x",
        "source-map": "0.6.x",
        "source-map-support": "0.5.x",
        "supports-color": "4.4.x",
        "will-call": "1.x.x"
      },
      "dependencies": {
        "espree": {
          "version": "3.5.4",
          "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz",
          "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==",
          "dev": true,
          "requires": {
            "acorn": "^5.5.0",
            "acorn-jsx": "^3.0.0"
...
binarymist commented 6 years ago

Tried:

  "resolutions": {
    "espree": "^4.0.x"
  },

but acorn is then missing. Reverting back to old lab version until fixed.

geek commented 5 years ago

I was unable to reproduce in hapi with lab master (soon to be released lab 18), which is using a centralized ecmaFeatures when calling into espree/eslint.

Feel free to open this up again if you encounter the issue again.

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.