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

Test arrow function inside generator. #5605

Merged
merged 3 commits into from Apr 12, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,19 @@
const assert = require("assert");
const babel = require("babel-core");

test("Doesn't throw with arrow function inside generator", function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think our tests are all describe and it.

I think this tests would be best as an exec.js test like https://github.com/babel/babel/blob/7.0/packages/babel-plugin-transform-regenerator/test/fixtures/function-sent/example/exec.js

Copy link
Member Author

@yavorsky yavorsky Apr 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@loganfsmyth thanks! Initially, I created this for 6.0 as an addition for #5567 and needed to prevent running code (error with arrow functions with node < 4).

I think our tests are all describe and it.

Yeah, accidentally looked into https://github.com/babel/babel/blob/7.0/packages/babel-plugin-transform-es2015-modules-commonjs/test/esmodule-flag.js

I could change base branch to 6.0 or just update it to run with exec.js.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Focusing on 7.x seems best at this point. If you just want to test the input/output without exec.js you can go the expect.js and actual.js route too, not strong feelings really.

const code = "function* gen () {const a = () => {return 1;}}";

const transform = function () {
babel.transform(code, {
"plugins": [
require("../"),
],
});
};

assert.doesNotThrow(
transform,
Error
);
});