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

exception thrown by power assert with object spread operator #797

Closed
nfcampos opened this issue Apr 28, 2016 · 6 comments
Closed

exception thrown by power assert with object spread operator #797

nfcampos opened this issue Apr 28, 2016 · 6 comments

Comments

@nfcampos
Copy link
Contributor

Description

import test from 'ava'

test('fail', t => {
  const obj = {a: 1}

  t.true(obj == {...obj})
})

the following test file fails to run and throws the following exception

SyntaxError: Unexpected token (1:16)
    at Parser.pp.raise (/Users/nuno/cp/j2/node_modules/power-assert-formatter/node_modules/acorn/dist/acorn.js:943:13)
    at Parser.pp.unexpected (/Users/nuno/cp/j2/node_modules/power-assert-formatter/node_modules/acorn/dist/acorn.js:1503:8)
    at Parser.pp.parseIdent (/Users/nuno/cp/j2/node_modules/power-assert-formatter/node_modules/acorn/dist/acorn.js:670:10)
    at Parser.parseIdent (/Users/nuno/cp/j2/node_modules/acorn-es7-plugin/acorn-es7-plugin.js:93:19)
    at Parser.pp.parsePropertyName (/Users/nuno/cp/j2/node_modules/power-assert-formatter/node_modules/acorn/dist/acorn.js:554:127)
    at Parser.parsePropertyName (/Users/nuno/cp/j2/node_modules/acorn-es7-plugin/acorn-es7-plugin.js:219:19)
    at Parser.pp.parseObj (/Users/nuno/cp/j2/node_modules/power-assert-formatter/node_modules/acorn/dist/acorn.js:500:10)
    at Parser.pp.parseExprAtom (/Users/nuno/cp/j2/node_modules/power-assert-formatter/node_modules/acorn/dist/acorn.js:310:19)
    at Parser.parseExprAtom (/Users/nuno/cp/j2/node_modules/acorn-es7-plugin/acorn-es7-plugin.js:109:21)
    at Parser.pp.parseExprSubscripts (/Users/nuno/cp/j2/node_modules/power-assert-formatter/node_modules/acorn/dist/acorn.js:216:19)
    at Parser.pp.parseMaybeUnary (/Users/nuno/cp/j2/node_modules/power-assert-formatter/node_modules/acorn/dist/acorn.js:197:19)
    at Parser.pp.parseExprOp (/Users/nuno/cp/j2/node_modules/power-assert-formatter/node_modules/acorn/dist/acorn.js:173:42)
    at Parser.pp.parseExprOps (/Users/nuno/cp/j2/node_modules/power-assert-formatter/node_modules/acorn/dist/acorn.js:153:15)
    at Parser.pp.parseMaybeConditional (/Users/nuno/cp/j2/node_modules/power-assert-formatter/node_modules/acorn/dist/acorn.js:133:19)
    at Parser.pp.parseMaybeAssign (/Users/nuno/cp/j2/node_modules/power-assert-formatter/node_modules/acorn/dist/acorn.js:110:19)
    at Parser.pp.parseExprList (/Users/nuno/cp/j2/node_modules/power-assert-formatter/node_modules/acorn/dist/acorn.js:651:185)

Environment

default ava configuration

Node.js v6.0.0
darwin 15.4.0

Is there a way of disabling power assert so that the test at least runs?

@sindresorhus
Copy link
Member

// @twada

@sindresorhus
Copy link
Member

Move it out of the inline assertion for now:

import test from 'ava'

test('fail', t => {
  const obj = {a: 1}
  const obj2 = {...obj}

  t.true(obj == obj2)
})

@nfcampos
Copy link
Contributor Author

Thanks, btw, it does works if the file is transpiled with babel before running the test,
so this works babel fail.js -o transpiled.js; ava transpiled.js and this doesn't ava fail.js.

@jamestalmage
Copy link
Contributor

@twada - Is this a power-assert issue? Can we close it and open up another issue in your repo? What would it be babel-plugin-espower?

@twada
Copy link
Contributor

twada commented May 7, 2016

@jamestalmage @sindresorhus I'm so sorry that I overlooked this. Please file this issue to power-assert-runtime.

@nfcampos
Copy link
Contributor Author

I've opened the issue twada/power-assert-runtime#6

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

4 participants