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

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

Closed
capaj opened this issue Feb 12, 2018 · 9 comments · Fixed by #5532

Comments

@capaj
Copy link
Contributor

capaj commented Feb 12, 2018

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.

capaj added a commit to capaj/jest that referenced this issue Feb 12, 2018
because we can have a "describe" block but no "it" blocks inside
@awkh88
Copy link

awkh88 commented Feb 13, 2018

+1 to this.

Error message:

console.error node_modules/jest-jasmine2/build/jasmine/Env.js:198
Unhandled error
console.error node_modules/jest-jasmine2/build/jasmine/Env.js:199
TypeError: Cannot read property 'result' of undefined
at isAfterAll (/Users/master/coding/makerMap/back-end/node_modules/jest-jasmine2/build/jasmine/Suite.js:212:34)
at Suite.Object..Suite.onException (/Users/master/coding/makerMap/back-end/node_modules/jest-jasmine2/build/jasmine/Suite.js:148:7)
at Suite.Object..Suite.onException (/Users/master/coding/makerMap/back-end/node_modules/jest-jasmine2/build/jasmine/Suite.js:160:25)
at Object.onException (/Users/master/coding/makerMap/back-end/node_modules/jest-jasmine2/build/tree_processor.js:47:32)
at /Users/master/coding/makerMap/back-end/node_modules/jest-jasmine2/build/queue_runner.js:77:15
at Timeout.setTimeout (/Users/master/coding/makerMap/back-end/node_modules/jest-jasmine2/build/p_timeout.js:27:150)
at ontimeout (timers.js:458:11)
at tryOnTimeout (timers.js:296:5)
at Timer.listOnTimeout (timers.js:259:5)

Versions
node 9.5.0
npm 5.6.0
jest 22.2.1
Mac OS 10.13.3

Jest Config

"jest": {
"testPathIgnorePatterns": [
"./tests/testSetup.js",
"./tests/testVars.js"
],
"testEnvironment": "node"
}

I am ignoring a couple of files that I am using for set up, they just contain generic beforeAll and afterAll functions that I need in every test file.

I am a bit frustrated, I have tried to set up a testing framework for a server and I have now spent more than a day doing it...

@capaj capaj mentioned this issue Feb 13, 2018
capaj added a commit to capaj/jest that referenced this issue Feb 28, 2018
because we can have a "describe" block but no "it" blocks inside
cpojer pushed a commit that referenced this issue Feb 28, 2018
because we can have a "describe" block but no "it" blocks inside
@SimenB
Copy link
Member

SimenB commented Apr 13, 2018

Hmm, should have been fixed. Mind providing a reproduction?

@jeffreyagnz
Copy link

jeffreyagnz commented Apr 13, 2018 via email

@SimenB
Copy link
Member

SimenB commented Apr 13, 2018

I've never seen that error, unfortunately

@entymon
Copy link

entymon commented 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) => {

  });
});```




@SimenB
Copy link
Member

SimenB commented May 12, 2018

Can you test with jest@beta to see if it's still an issue?

@entymon
Copy link

entymon commented May 12, 2018

jest@beta works good !

@SimenB
Copy link
Member

SimenB commented May 12, 2018

Awesome

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants