https://cypress.io logo
Join Discord
Powered by
# help
  • b

    breezy-australia-64868

    04/27/2021, 7:47 PM
    Anyone have this error show up when running Cypress locally with
    npx cypress run
    ? I can run my tests fine one by one with
    open
    and on CI, but running it locally it'll give me that error after running each file. `"after all" hook: generateReport for "is not interactive": CypressError:
    cy.task('coverageReport')
    failed with the following error: > Cannot read property 'loc' of undefined Because this error occurred during a
    after all
    hook we are skipping all of the remaining tests.`
  • b

    bulky-sundown-74498

    04/27/2021, 7:56 PM
    it looks like a code coverage issue
  • b

    bulky-sundown-74498

    04/27/2021, 7:57 PM
    and the "loc" thing is usually linked to items on a babel Abstract Syntax Tree
  • b

    bulky-sundown-74498

    04/27/2021, 7:58 PM
    So @User did you instrument your code in your babel config? In other words did you add anything istabul related in the babel config that you are using for cypress?
  • b

    breezy-australia-64868

    04/27/2021, 8:00 PM
    thanks for the reply! I'm currently instrumenting with the babel plugin like so
    Copy code
    javascript
    if (process.env.NODE_ENV === 'test') {
      plugins.push([
        'babel-plugin-istanbul', {
          extension: ['.js', '.vue'],
          exclude: ['**/*.stories.js'],
        },
      ]);
    }
  • b

    breezy-australia-64868

    04/27/2021, 8:02 PM
    lemme check that the code is actually getting instrumented
  • b

    breezy-australia-64868

    04/27/2021, 8:22 PM
    yeah it seems like all files are instrumented under the
    window._coverage
    object
  • b

    bulky-sundown-74498

    04/27/2021, 8:23 PM
    could there be a version mismatch between the plugin and waht cypress asks for?
  • b

    bulky-sundown-74498

    04/27/2021, 8:25 PM
    I found this example that could help debug it https://github.com/bahmutov/code-coverage-vue-example
  • b

    breezy-australia-64868

    04/27/2021, 10:12 PM
    sweet, will take a look later 🙂 thanks!!
  • p

    purple-alarm-62049

    04/29/2021, 2:33 PM
    **Opinions Wanted: **We have a highly animated (gsap+webgl) long scroll site we are wanting to setup automated image diffs for. We have devised a way to put animation "label" and specific scroll heights (responsive) and we're thinking of storing these in a global on
    window.$anim_steps
    and then just having cypress iterate through those taking snapshots. Can anyone think of a better way to make this list of steps available to cypress other than window object that is fancier/cleaner? LocalStorage? other?
  • r

    refined-monkey-52031

    04/29/2021, 5:57 PM
    Would I need to instrument my code if I was going to try to get code coverage on an external url ?
  • r

    refined-monkey-52031

    04/29/2021, 5:57 PM
    thanks!
  • b

    bulky-sundown-74498

    04/29/2021, 6:18 PM
    I do not think you can get coverage on an external url
  • b

    bulky-sundown-74498

    04/29/2021, 6:18 PM
    since you do not "own" the code
  • b

    bulky-sundown-74498

    04/29/2021, 6:18 PM
    What coverage would you expect to get?
  • b

    bulky-sundown-74498

    04/29/2021, 6:19 PM
    And how would you hope to use the coverage?
  • r

    refined-monkey-52031

    04/29/2021, 8:09 PM
    @User I was trying to run cypress code coverage against a Gatsby site in a GitHub action but since the site takes 45 minutes to get the dev server running from a cold start I was trying to use Gatsby Cloud build that build in a few minutes for the CI test. I can't get the dev server up fast enough before everything times out. Does that make sense ? Thanks!
  • r

    refined-monkey-52031

    04/29/2021, 8:09 PM
    I do own the code
  • r

    refined-monkey-52031

    04/29/2021, 8:10 PM
    @User Its just not working for the CI cause it needs to download all the images
  • r

    refined-monkey-52031

    04/29/2021, 8:11 PM
    In theory if I could get it run the dev server once I could store the cache folder but I can't get it to work once hahaa
  • r

    refined-monkey-52031

    04/29/2021, 8:11 PM
    Any advice would be great
  • r

    refined-monkey-52031

    04/29/2021, 8:12 PM
    I was thinking about using https://github.com/JS-DevTools/coverage-istanbul-loader/blob/master/examples/hello-world/webpack.config.js to maybe instrument the code in a specific build situation maybe that could work
  • r

    refined-monkey-52031

    04/29/2021, 8:18 PM
    @User The coverage I guess would be artifact for that PR that says the code had this amount of coverage at that particular time
  • b

    bulky-sundown-74498

    04/29/2021, 8:18 PM
    The way istanbul works is: - it adds signals in the code (instrumentation) - records these signals while running the tests - use sourcemaps to re link the recorded paths with the actual code (report)
  • r

    refined-monkey-52031

    04/29/2021, 8:19 PM
    However I guess I could make sure that works locally and then I know if the tests pass than I am good to go
  • b

    bulky-sundown-74498

    04/29/2021, 8:19 PM
    Can you add instrumentation with Gatsby Cloud
  • b

    bulky-sundown-74498

    04/29/2021, 8:19 PM
    ?
  • r

    refined-monkey-52031

    04/29/2021, 8:19 PM
    Ok then maybe the webpack plugin could work
  • r

    refined-monkey-52031

    04/29/2021, 8:20 PM
    Gatsby cloud is just the build tool but I could add it to webpack
1...789...252Latest