Git Product home page Git Product logo

Comments (13)

job13er avatar job13er commented on July 23, 2024 1

As mentioned above, this has to do with other addons (in our case brocolli-browserify) overwriting window.require. I don't think it's actually anything this project wants to do anything about. @rox163 You can probably close this guy.

from ember-cli-code-coverage.

rwjblue avatar rwjblue commented on July 23, 2024

Can you tell me if Object.keys(require.entries) causes the same error?

If it does, this is likely the same (or related to the same root cause) as #66.

from ember-cli-code-coverage.

rox163 avatar rox163 commented on July 23, 2024

@rwjblue Not sure. What would you like me to do to test that Object.keys line?

from ember-cli-code-coverage.

rwjblue avatar rwjblue commented on July 23, 2024

Run ember test --server, after your tests run in your browser open the console, type Object.keys(require.entries). Is there an error?

from ember-cli-code-coverage.

rox163 avatar rox163 commented on July 23, 2024

@rwjblue Yes there is an error.
screen shot 2016-11-08 at 10 07 12 am

from ember-cli-code-coverage.

rox163 avatar rox163 commented on July 23, 2024

Any suggestions on how to debug/work around this? As far as I can tell there is no custom require in my project directly but not sure about the dependent addons. We dont use yadda as was mentioned as the culprit in the other issue.
I can point you to a project that has this failure when the coverage version is set to 0.3.6 - https://github.com/ciena-frost/ember-frost-popover/blob/master/package.json

from ember-cli-code-coverage.

rox163 avatar rox163 commented on July 23, 2024

Related to #66 as in my case it seems to be a conflict with mocha's require.

from ember-cli-code-coverage.

offirgolan avatar offirgolan commented on July 23, 2024

Bump. I've been running into the same issue:

not ok 219 Chrome 54.0 - Global error: Uncaught TypeError: Cannot convert undefined or null to object at http://localhost:7357/assets/vendor.js, line 73209
    ---
        Log: |
            { type: 'error',
              text: 'Uncaught TypeError: Cannot convert undefined or null to object at http://localhost:7357/assets/vendor.js, line 73209\n' }
    ...
not ok 220 Chrome 54.0 - JSHint | unit/mixins/table-header-test.js: global failure
    ---
        actual: >
            null
        stack: >
            http://localhost:7357/assets/vendor.js:73209
        message: >
            Uncaught TypeError: Cannot convert undefined or null to object
        Log: |
    ...

Running on ember-light-table w/ [email protected]

from ember-cli-code-coverage.

RobbieTheWagner avatar RobbieTheWagner commented on July 23, 2024

@offirgolan are you using something that redefines the global require?

from ember-cli-code-coverage.

offirgolan avatar offirgolan commented on July 23, 2024

When running what @rwjblue suggested

Run ember test --server, after your tests run in your browser open the console, type Object.keys(require.entries). Is there an error?

I get the same error. require.entries is undefined. I do not believe I have any package that would redefine the global require either...

from ember-cli-code-coverage.

a15n avatar a15n commented on July 23, 2024

I have made a PR to unblock those who are facing this issue. It's a simple require.entries || {} fix.

This doesn't fix any underlying issues with conflicting versions of require but it unblocks those who have conflicting versions.

#97

from ember-cli-code-coverage.

job13er avatar job13er commented on July 23, 2024

In case anyone else is still having an issue with an overwritten require and would like help tracking it down: I added the following to my tests/index.html

(got the console.watch bit from here: http://stackoverflow.com/a/11658693)

<script>
    console = console || {}; // just in case
    console.watch = function(oObj, sProp) {
       sPrivateProp = "$_"+sProp+"_$"; // to minimize the name clash risk
       oObj[sPrivateProp] = oObj[sProp];

       // overwrite with accessor
       Object.defineProperty(oObj, sProp, {
           get: function () {
               return oObj[sPrivateProp];
           },

           set: function (value) {
               //console.log("setting " + sProp + " to " + value);
               debugger; // sets breakpoint
               oObj[sPrivateProp] = value;
           }
       });
    }

    console.watch(window, 'require')
</script>

And then ran my tests in the browser (I used ember s -e test but you could use ember test --server as well). The second debugger that was hit was my culprit.

Still tracking down exactly where the file browserfied-highlight.js comes from, but in our case, it looks like that's the one causing problems.

EDIT: I tracked it down, looks like ember-code-snippet is the addon adding a module that's overriding require.

from ember-cli-code-coverage.

job13er avatar job13er commented on July 23, 2024

I opened ef4/ember-code-snippet#34 to bring it to the attention of the authors of ember-code-snippet. In the meantime, I think I'll use a fork of that project that doesn't use broccoli-browserify

from ember-cli-code-coverage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.