question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'result' of undefined at isAfterAll when I comment out all "it" blocks

See original GitHub issue

What is the current behavior?

Jest in watch mode tries to parse results and fails with:

 console.error node_modules/jest-jasmine2/build/jasmine/Env.js:200
    Unhandled error

  console.error node_modules/jest-jasmine2/build/jasmine/Env.js:201
    TypeError: Cannot read property 'result' of undefined
        at isAfterAll (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/jest-jasmine2/build/jasmine/Suite.js:213:34)
        at Suite.Object.<anonymous>.Suite.addExpectationResult (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/jest-jasmine2/build/jasmine/Suite.js:167:7)
        at Env.fail (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/jest-jasmine2/build/jasmine/Env.js:522:25)
        at next.fail (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/jest-jasmine2/build/queue_runner.js:47:22)
        at <anonymous>

What is the expected behavior? Jest just logs something like:

No tests were run.

without breaking the watch mode and without throwing any errors.

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system. I don’t think this depends on a version of any of those. I will be happy to post them if anyone requests.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:9

github_iconTop GitHub Comments

1reaction
entymoncommented, May 12, 2018

I have got same error, it’s happen because I left empty instruction in x.test.js (“jest”: “^22.4.3”,)

image image

describe('Test the addLike method', () => {
  beforeAll(() => {

  });
  afterAll((done) => {

  });
});```




0reactions
github-actions[bot]commented, May 12, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed: Cannot read property 'results' of undefined
"var spec" is not being set to anything. That means "jasmine.getEnv().currentSpec" is not working for whatever reason.
Read more >
karma-runner - Bountysource
Running single test gives: AfterAll TypeError cannot read property 'info' and 'error' of undefined $ 0. Created 2 years ago in karma-runner/karma-jasmine with...
Read more >
an error was thrown in afterall typeerror: cannot read ...
TypeError : Cannot read properties of undefined (reading 'isDynamic') is obscuring any errors thrown in getServerSideProps , and possible anywhere in index.tsx ....
Read more >
Basic Usage -- IM v6 Examples - ImageMagick
So the correct way to do this in IMv6 is to read the image, process and then use the final 'implicit write' argument...
Read more >
Type Safe JavaScript with JSDoc - Medium
Instead we'll use it to check the types of our JavaScript code during code time using JSDocs comments and type inference. So there'll...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found