Hazyzh / jest-html-reporters

🌈 Reporter for jest test framework. 🌈
https://hazyzh.github.io/report.html
MIT License
522 stars 100 forks source link

Add check context[key] is defined before accessing it. #252

Closed devinea closed 1 year ago

devinea commented 1 year ago

Fixes the following error: When key = Symbol(LOG_ERRORS_BEFORE_RETRY) context[key] is undefined.

TypeError: Cannot read properties of undefined (reading 'state')
    at mymodule/node_modules/jest-html-reporters/helper.js:151:26
    at Array.forEach (<anonymous>)
    at getJestGlobalData (mymodule/node_modules/jest-html-reporters/helper.js:150:68)
    at mymodule/node_modules/jest-html-reporters/helper.js:133:26
    at step (mymodule/node_modules/jest-html-reporters/helper.js:33:23)
    at Object.next (mymodule/node_modules/jest-html-reporters/helper.js:14:53)
    at mymodule/node_modules/jest-html-reporters/helper.js:8:71
    at new Promise (<anonymous>)
    at Object.<anonymous>.__awaiter (mymodule/node_modules/jest-html-reporters/helper.js:4:12)
    at Object.addMsg (mymodule/node_modules/jest-html-reporters/helper.js:128:12)

LOG_ERRORS_BEFORE_RETRY seems to have been added in jest circus here : https://github.com/facebook/jest/pull/12201/files#diff-1f219915a2f99fe6ad8b7478a41464c5aaabc4c7e6c1e1f004c59d135aa08e9fR22

Hazyzh commented 1 year ago

cool, thanks.

devinea commented 1 year ago

Thanks accepting the PR so quickly.