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

"Maximum call stack size exceeded" from espurify #274

Closed
MoOx opened this issue Nov 26, 2015 · 5 comments
Closed

"Maximum call stack size exceeded" from espurify #274

MoOx opened this issue Nov 26, 2015 · 5 comments

Comments

@MoOx
Copy link

MoOx commented Nov 26, 2015

This test is ok

import "babel-core/register"
import test from "ava"

import React from "react"
import ReactDOMServer from "react-dom/server"

test("failure", (t) => {
  const inlinedSvg = ReactDOMServer.renderToStaticMarkup(
    <div />
  )
  t.is(
    inlinedSvg,
    `<span class="SVGIcon TestSVG"><svg class="SVGIcon-svg TestSVG-svg"` +
    `><g></g></svg></span>`,
    "passes & merges className"
  )

  t.end()
})

But this one create an issue

import "babel-core/register"
import test from "ava"

import React from "react"
import ReactDOMServer from "react-dom/server"

test("failure", (t) => {

  t.is(
    ReactDOMServer.renderToStaticMarkup(
      <div />
    ),
    `<span class="SVGIcon TestSVG"><svg class="SVGIcon-svg TestSVG-svg"` +
    `><g></g></svg></span>`,
    "passes & merges className"
  )

  t.end()
})

Error

❯❯ ava "src/__tests__/*.js"

Uncaught Exception:  /Users/MoOx/Sync/Development/react-svg-inline/src/__tests__/index.js
  RangeError: /Users/MoOx/Sync/Development/react-svg-inline/src/__tests__/index.js: Maximum call stack size exceeded
    at cloneProperty (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/espurify/lib/clone-ast.js:46:17)
    at cloneObj (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/espurify/lib/clone-ast.js:40:13)
    at cloneContainer (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/espurify/lib/clone-ast.js:17:20)
    at cloneOf (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/espurify/lib/clone-ast.js:56:24)
    at cloneProperty (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/espurify/lib/clone-ast.js:47:30)
    at cloneObj (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/espurify/lib/clone-ast.js:40:13)
    at cloneContainer (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/espurify/lib/clone-ast.js:17:20)
    at cloneOf (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/espurify/lib/clone-ast.js:56:24)
    at cloneProperty (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/espurify/lib/clone-ast.js:47:30)

Error: Test results were not received from: /Users/MoOx/Sync/Development/react-svg-inline/src/__tests__/index.js
    at ChildProcess.<anonymous> (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/ava/lib/fork.js:51:12)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
From previous event:
    at module.exports (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/ava/lib/fork.js:23:16)
    at run (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/ava/cli.js:112:9)
    at Array.map (native)
    at /Users/MoOx/Sync/Development/react-svg-inline/node_modules/ava/cli.js:195:22
From previous event:
    at init (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/ava/cli.js:187:4)
    at Object.<anonymous> (/Users/MoOx/Sync/Development/react-svg-inline/node_modules/ava/cli.js:234:2)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:136:18)
    at node.js:972:3

Some infos:

❯ node --version
v5.0.0

❯ npm --version
3.5.1

babel 5.8.x

@twada
Copy link
Contributor

twada commented Nov 26, 2015

@MoOx Thank you for reporting and reproduction case.

Currently, power-assert only supports standard AST Nodes defined in The ESTree Spec.
JSX nodes are not supported.

I'll fix this when AVA gets Babel 6 ready.
I'm so sorry for the inconvenience.

@MoOx
Copy link
Author

MoOx commented Nov 27, 2015

So why the first example is working? (Reminder I use babel 5.8 for the moment since lots of things are not working/ready for 6)

@twada
Copy link
Contributor

twada commented Nov 27, 2015

@MoOx

So why the first example is working?

In the first example, JSX element is on the outside of assertion argument expression (in this case, arguments of t.is) so power-assert ignored it.

In the second example, JSX element is on the inside of assertion argument expression, so power-assert tried to infer more information, and something wrong has occurred.

@jamestalmage
Copy link
Contributor

Closing since this is not an AVA issue, but a power-assert one.

I opened power-assert-js/power-assert#34 to track this issue there.

@twada
Copy link
Contributor

twada commented Mar 9, 2016

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

No branches or pull requests

3 participants