-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
ES Bind Operator Throws SyntaxError When Test Failing #881
Comments
@twada Is there any way |
@sindresorhus I'm going to ship new power-assert-runtime soon. It'll fix problems like this entirely. |
Did this fix the issue? Issue creator deleted his account. |
Will be fixed when #903 is released. |
Just noticed what might be a related issue while testing a React component with Enzyme and Ava's native assertions. Below, CustomOption is a child component, and I expect wrapper.contains to return true or false: test('renders children when passed in', t => {
const wrapper = shallow(
<Select>
<CustomOption />
</Select>
);
t.true(wrapper.contains(<CustomOption />));
}); But I end up with this and NPM bails out when the watcher returns 1: SyntaxError: Unexpected token (1:24)
at Parser.pp.raise (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:923:13)
at Parser.pp.unexpected (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:1490:8)
at Parser.pp.parseExprAtom (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:333:12)
at Parser.parseExprAtom (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn-es7-plugin/acorn-es7-plugin.js:136:30)
at Parser.pp.parseExprSubscripts (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:228:19)
at Parser.pp.parseMaybeUnary (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:207:17)
at Parser.pp.parseExprOps (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:154:19)
at Parser.pp.parseMaybeConditional (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:136:19)
at Parser.pp.parseMaybeAssign (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:112:19)
at Parser.pp.parseExprList (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:660:23)
at Parser.pp.parseSubscripts (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:252:29)
at Parser.pp.parseExprSubscripts (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:231:15)
at Parser.pp.parseMaybeUnary (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:207:17)
at Parser.pp.parseExprOps (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:154:19)
at Parser.pp.parseMaybeConditional (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:136:19)
at Parser.pp.parseMaybeAssign (/Users/Amir/Desktop/Nestio/pam/node_modules/acorn/dist/acorn.js:112:19) Conversely, the following is fine. test('renders children when passed in', t => {
const wrapper = shallow(
<Select>
<CustomOption />
</Select>
);
const truthy = wrapper.contains(<CustomOption />);
t.true(truthy);
}); CLI
Relevant Linkshttps://github.com/istarkov/babel-plugin-webpack-loaders ENVAva 0.15.2 |
I'm assuming this has been fixed, since #903 was merged. |
Description
I was trying to use the ES bind operator in my test files.
If I transpile the code in the Babel REPL and try it with the resulting ES5 code all is working fine so I think it must be something with AVAs or power-asserts internal transpilation.
After that I tried to make a reproduction and noticed that the SyntaxError is only there if the test fails.
Test Source
validate.js
:Error Message & Stack Trace
Config
package.json
:.babelrc
:Command-Line Arguments
Relevant Links
Environment
The text was updated successfully, but these errors were encountered: