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

Generated code no longer pass the tests #135

Closed
mriska opened this issue Feb 7, 2017 · 2 comments · Fixed by #137
Closed

Generated code no longer pass the tests #135

mriska opened this issue Feb 7, 2017 · 2 comments · Fixed by #137

Comments

@mriska
Copy link
Contributor

mriska commented Feb 7, 2017

Steps to reproduce:

ember new foo
cd foo
ember install ember-cli-coffeescript
ember g helper bar
ember test

produces the following error:

not ok 9 PhantomJS 2.1 - TestLoader Failures: foo/tests/unit/helpers/bar-test: could not be loaded
    ---
        actual: >
            null
        stack: >
            http://localhost:7357/assets/foo.js:46:22
            exports@http://localhost:7357/assets/vendor.js:140:37
            _reify@http://localhost:7357/assets/vendor.js:173:66
            reify@http://localhost:7357/assets/vendor.js:159:33
            exports@http://localhost:7357/assets/vendor.js:138:15
            requireModule@http://localhost:7357/assets/vendor.js:32:25
            require@http://localhost:7357/assets/test-support.js:4713:14
            loadModules@http://localhost:7357/assets/test-support.js:4705:21
            load@http://localhost:7357/assets/test-support.js:4735:33
            http://localhost:7357/assets/test-support.js:4619:22
        message: >
            Died on test #1 moduleLoadFailure@http://localhost:7357/assets/test-support.js:4607:17
            require@http://localhost:7357/assets/test-support.js:4715:29
            loadModules@http://localhost:7357/assets/test-support.js:4705:21
            load@http://localhost:7357/assets/test-support.js:4735:33
            http://localhost:7357/assets/test-support.js:4619:22: Strict mode forbids implicit creation of global property 'bar'
        Log: |
    ...
not ok 10 PhantomJS 2.1 - Global error: Error:
ReferenceError: Strict mode forbids implicit creation of global property 'bar' at http://localhost:7357/assets/test-support.js, line 4614
    ---
        Log: |
            { type: 'error',
              text: 'Error: \nReferenceError: Strict mode forbids implicit creation of global property \'bar\' at http://localhost:7357/assets/test-support.js, line 4614\n' }
    ...
not ok 11 PhantomJS 2.1 - TestLoader Failures: global failure
    ---
        actual: >
            null
        stack: >
            http://localhost:7357/assets/test-support.js:4614
        message: >
            Error:
            ReferenceError: Strict mode forbids implicit creation of global property 'bar'
        Log: |
    ...

This is due to the way the compiled file looks:

define('foo/helpers/bar', ['exports', 'ember'], function (exports, _ember) {
  var BarHelper;

  exports.bar = bar = function (params) {
    return params;
  };

  BarHelper = _ember['default'].Helper.helper(bar);

  exports.bar = bar;
  exports['default'] = BarHelper;
});

The variable bar does not get defined properly. This issue is related to #134. Directly exporting the functions produces code that passes the tests.

This problem affects at least helper, initializer, util, serializer

@kimroen Do you want me to create a PR for the changes?

@kimroen
Copy link
Owner

kimroen commented Feb 7, 2017

@mriska If you have time to go through and update all the blueprints as mentioned in #134 then I would love a PR for that. If not, then I'll make sure to check that this works after making those changes.

Thanks!

@mriska
Copy link
Contributor Author

mriska commented Feb 7, 2017

I'll see if I can find some time for it tomorrow.

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

Successfully merging a pull request may close this issue.

2 participants