Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wct] import.meta bombs the process #564

Closed
Westbrook opened this issue Jul 5, 2018 · 10 comments
Closed

[wct] import.meta bombs the process #564

Westbrook opened this issue Jul 5, 2018 · 10 comments
Labels

Comments

@Westbrook
Copy link

When attempting to use import.meta.url to empower new URL() to create import relative URLs, I am able to get polymer serve and polymer build to work with seemingly no issue, however polymer test bombs out when run against even an unused application of this concept:

let url = import.meta.url;

Let alone a version that would empower my element to import local assets:

let url = new URL(
  path,
  import.meta.url
);

My config looks like the following:

{
  "verbose": false,
  "plugins": {
    "local": {
      "browsers": ["chrome"],
      "browserOptions": {
        "chrome": ["headless", "disable-gpu", "no-sandbox"],
        "firefox": ["-headless"]
      }
    },
    "sauce": {
      "disabled": true,
      "username": "redacted",
      "accessKey": "redacted",
      "browsers": [
        {
          "browserName": "firefox",
          "platform": "Windows 10",
          "version": "60"
        },
        {
          "browserName": "microsoftedge",
          "platform": "Windows 10",
          "version": ""
        },
        {
          "browserName": "safari",
          "platform": "OS X 10.12",
          "version": "11"
        }
      ]
    },
    "istanbub": {
      "dir": "./coverage",
      "reporters": ["text", "lcov"],
      "include": ["/*.js"],
      "thresholds": {
        "global": {
          "statements": 100,
          "branches": 96,
          "functions": 100,
          "lines": 100
        }
      }
    }
  }
}

Is there something that I've missed?

@aomarks
Copy link
Member

aomarks commented Jul 5, 2018

Can you include the output/crash log?

@Westbrook
Copy link
Author

Here ya go @aomarks. The same tests run in the browser pass as well (baring the lowdash issue of not having exports).

Versions:
polymer-cli@1.7.7
polymer-build@3.0.4
web-component-tester@6.7.1

Installing and starting Selenium server for local browsers
Selenium server running on port 43519
[BABEL] Note: The code generator has deoptimised the styling of undefined as it exceeds the max of 500KB.
chrome 66                Beginning tests via http://localhost:8081/components/@lingolive/course-catalog/generated-index.html?cli_browser_id=3
chrome failed to maximize
SyntaxError: Unexpected token, expected ( (139:22)
    at Parser.pp$5.raise (/home/circleci/project/node_modules/babylon/lib/index.js:4454:13)
    at Parser.pp.unexpected (/home/circleci/project/node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp$3.parseExprAtom (/home/circleci/project/node_modules/babylon/lib/index.js:3632:14)
    at Parser.parseExprAtom (/home/circleci/project/node_modules/babylon/lib/index.js:7238:22)
    at Parser.pp$3.parseExprSubscripts (/home/circleci/project/node_modules/babylon/lib/index.js:3494:19)
    at Parser.pp$3.parseMaybeUnary (/home/circleci/project/node_modules/babylon/lib/index.js:3474:19)
    at Parser.pp$3.parseExprOps (/home/circleci/project/node_modules/babylon/lib/index.js:3404:19)
    at Parser.pp$3.parseMaybeConditional (/home/circleci/project/node_modules/babylon/lib/index.js:3381:19)
    at Parser.pp$3.parseMaybeAssign (/home/circleci/project/node_modules/babylon/lib/index.js:3344:19)
    at Parser.parseMaybeAssign (/home/circleci/project/node_modules/babylon/lib/index.js:6474:20)
SyntaxError: Unexpected token, expected ( (139:22)
    at Parser.pp$5.raise (/home/circleci/project/node_modules/babylon/lib/index.js:4454:13)
    at Parser.pp.unexpected (/home/circleci/project/node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp$3.parseExprAtom (/home/circleci/project/node_modules/babylon/lib/index.js:3632:14)
    at Parser.parseExprAtom (/home/circleci/project/node_modules/babylon/lib/index.js:7238:22)
    at Parser.pp$3.parseExprSubscripts (/home/circleci/project/node_modules/babylon/lib/index.js:3494:19)
    at Parser.pp$3.parseMaybeUnary (/home/circleci/project/node_modules/babylon/lib/index.js:3474:19)
    at Parser.pp$3.parseExprOps (/home/circleci/project/node_modules/babylon/lib/index.js:3404:19)
    at Parser.pp$3.parseMaybeConditional (/home/circleci/project/node_modules/babylon/lib/index.js:3381:19)
    at Parser.pp$3.parseMaybeAssign (/home/circleci/project/node_modules/babylon/lib/index.js:3344:19)
    at Parser.parseMaybeAssign (/home/circleci/project/node_modules/babylon/lib/index.js:6474:20)
SyntaxError: Unexpected token, expected ( (139:22)
    at Parser.pp$5.raise (/home/circleci/project/node_modules/babylon/lib/index.js:4454:13)
    at Parser.pp.unexpected (/home/circleci/project/node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp$3.parseExprAtom (/home/circleci/project/node_modules/babylon/lib/index.js:3632:14)
    at Parser.parseExprAtom (/home/circleci/project/node_modules/babylon/lib/index.js:7238:22)
    at Parser.pp$3.parseExprSubscripts (/home/circleci/project/node_modules/babylon/lib/index.js:3494:19)
    at Parser.pp$3.parseMaybeUnary (/home/circleci/project/node_modules/babylon/lib/index.js:3474:19)
    at Parser.pp$3.parseExprOps (/home/circleci/project/node_modules/babylon/lib/index.js:3404:19)
    at Parser.pp$3.parseMaybeConditional (/home/circleci/project/node_modules/babylon/lib/index.js:3381:19)
    at Parser.pp$3.parseMaybeAssign (/home/circleci/project/node_modules/babylon/lib/index.js:3344:19)
    at Parser.parseMaybeAssign (/home/circleci/project/node_modules/babylon/lib/index.js:6474:20)

@usergenic
Copy link
Contributor

@Westbrook can you say how your polymer-cli is installed? Do you use npm install -g polymer-cli or via yarn or pnpm or anything else that might not honor the shrinkwrap.json?

@Westbrook
Copy link
Author

I do use yarn. But it seems like polymer-cli relies on a package-lock.json, which I thought Yarn respected.

@Westbrook
Copy link
Author

But the shrinkwrap.json does get put into the directory, interesting...that seems...less than opportune.

@Westbrook
Copy link
Author

yarn being the issue also seems counter to the yarn based compile from source instructions.

@Westbrook
Copy link
Author

@usergenic I took another pass at this from rm -rf node_modules with npm install and still no luck. The error moved around a little bit, but other wise it's much the same:

SyntaxError: Unexpected token, expected ( (126:14)
    at Parser.pp$5.raise (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/istanbul-lib-instrument/node_modules/babylon/lib/index.js:4454:13)
    at Parser.pp.unexpected (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/istanbul-lib-instrument/node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp$3.parseExprAtom (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/istanbul-lib-instrument/node_modules/babylon/lib/index.js:3632:14)
    at Parser.parseExprAtom (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/istanbul-lib-instrument/node_modules/babylon/lib/index.js:7238:22)
    at Parser.pp$3.parseExprSubscripts (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/istanbul-lib-instrument/node_modules/babylon/lib/index.js:3494:19)
    at Parser.pp$3.parseMaybeUnary (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/istanbul-lib-instrument/node_modules/babylon/lib/index.js:3474:19)
    at Parser.pp$3.parseExprOps (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/istanbul-lib-instrument/node_modules/babylon/lib/index.js:3404:19)
    at Parser.pp$3.parseMaybeConditional (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/istanbul-lib-instrument/node_modules/babylon/lib/index.js:3381:19)
    at Parser.pp$3.parseMaybeAssign (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/istanbul-lib-instrument/node_modules/babylon/lib/index.js:3344:19)
    at Parser.parseMaybeAssign (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/istanbul-lib-instrument/node_modules/babylon/lib/index.js:6474:20)

Is there something special required in my polymer.json to make this work?

@Westbrook
Copy link
Author

Further investigation has this looking like it is tied to a mismatch between the babel the CLI/WCT need and that of one of the WCT plugins that I'm using. Feel free to check out the process of digging into that here: Bubbit/wct-istanbub#15

@stale
Copy link

stale bot commented Mar 4, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Apr 28, 2022

This issue has been automatically closed after being marked stale. If you're still facing this problem with the above solution, please comment and we'll reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants