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

Cannot execute tests when babel does not transpile 'let' keyword #5389

Closed
janmisek opened this issue Jan 22, 2016 · 5 comments
Closed

Cannot execute tests when babel does not transpile 'let' keyword #5389

janmisek opened this issue Jan 22, 2016 · 5 comments
Assignees
Labels

Comments

@janmisek
Copy link

Happening on 2.3.0-beta.1 in chromium 47

I am getting following exception when executing tests in case babel transpilation of 'let' keyword is disabled.

Uncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

My ember-cli-build.js config for babel

        babel: {
            comments: false,
            optional: [
                //"es7.asyncFunctions"
                //"es7.functionBind"
            ],
            blacklist: [
                'es6.templateLiterals',
                'es6.blockScoping',
                'es6.constants'
            ]
        },

Generally problem is that each non jshint module included in compiled tests.js is missing 'use strict' statement

@janmisek
Copy link
Author

I have traced down issue to the https://github.com/babel/ember-cli-babel/blob/cb4c2e763eb2fdb96654957ee2578912f88a8265/index.js#L93 where useStrict is blacklisted from babel with comment Ember-CLI inserts its own 'use strict' directive. But for tests tree (tests.js) this ember-cli strict mode is not used

@janmisek
Copy link
Author

What about use lib/broccoli/test-prefix.js with use strict content to be used same way for tests.

@stefanpenner
Copy link
Contributor

@nathanhammond i think the use-strict trick you added needs to also prepend to the test file.

@rwjblue
Copy link
Member

rwjblue commented Jan 26, 2016

Ya, agreed. Possibly also to test-support.js.

clekstro added a commit to fauxton/ember-cli-deploy-cdnify-purge-cache that referenced this issue Mar 9, 2016
Waiting on a fix for [this issue](ember-cli/ember-cli#5389) to land. When it does, this can be removed
(assuming that tests run as expected after this line is removed.
@nathanhammond
Copy link
Contributor

@rwjblue Can't turn it on for test-support.js since both Ember and QUnit do things where they assume that this is set inside of an IIFE. Not a problem in this case as no user code ends up inside of test-support.js.

@janmisek Thanks for reporting, sorry to take so long on addressing. 😄

@homu homu closed this as completed in #6052 Jul 9, 2016
homu added a commit that referenced this issue Jul 9, 2016
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

5 participants