wix-incubator / jest-metadata

🦸‍♂️ Superhero power for your Jest reporters! 🦸‍♀️
MIT License
3 stars 2 forks source link

Improve resiliency on `--bail` #75

Open noomorph opened 2 months ago

noomorph commented 2 months ago

Describe the bug

Sometimes I spectate:

            throw new errors_1.JestMetadataError(`Cannot associate a non-existent metadata with a test case: ${testCaseResult.fullName}`);
                  ^

JestMetadataError: Cannot associate a non-existent metadata with a test case: Status tests Simple passed
    at AssociateMetadata.testCaseResult (/Users/yaroslavs/Projects/wix-incubator/jest-allure2-reporter/node_modules/jest-metadata/dist/jest-reporter/AssociateMetadata.js:21:19)
    at ReporterServer.onTestCaseResult (/Users/yaroslavs/Projects/wix-incubator/jest-allure2-reporter/node_modules/jest-metadata/dist/jest-reporter/ReporterServer.js:64:25)
    at ReporterServer.memoized (/Users/yaroslavs/Projects/wix-incubator/jest-allure2-reporter/node_modules/jest-metadata/dist/utils/memoizeLast.js:11:34)
    at ReporterServer.memoized [as onTestCaseResult] (/Users/yaroslavs/Projects/wix-incubator/jest-allure2-reporter/node_modules/jest-metadata/dist/utils/memoizeArg1.js:12:24)

To Reproduce

Run many suites many times with many workers and --bail.

Expected behavior

This error should not happen. Maybe, jest-metadata should generate a fallback metadata with FallbackAPI despite the full-fledged mode.

noomorph commented 1 month ago

One more problematic case discovered:

when logs are enabled, we have weird sequence of events

Got 1 times "/Users/yaroslavs/Projects/wix-incubator/jest-metadata/e2e/__tests__/default/duplicate-generation.js"
Called from /Users/yaroslavs/Projects/wix-incubator/jest-metadata/e2e/__tests__/default/duplicate-generation.js
Got 2 times "/Users/yaroslavs/Projects/wix-incubator/jest-metadata/e2e/__tests__/default/duplicate-generation.js"
Got 1 times "/Users/yaroslavs/Projects/wix-incubator/jest-metadata/e2e/__tests__/default/duplicate-generation.js"
Called from /Users/yaroslavs/Projects/wix-incubator/jest-metadata/e2e/__tests__/default/duplicate-generation.js
Got 1 times "/Users/yaroslavs/Projects/wix-incubator/jest-metadata/e2e/__tests__/default/duplicate-generation.js"
Called from /Users/yaroslavs/Projects/wix-incubator/jest-metadata/e2e/__tests__/default/duplicate-generation.js
Got 2 times "/Users/yaroslavs/Projects/wix-incubator/jest-metadata/e2e/__tests__/default/duplicate-generation.js"
Called from /Users/yaroslavs/Projects/wix-incubator/jest-metadata/e2e/__tests__/default/duplicate-generation.js
Got 2 times "/Users/yaroslavs/Projects/wix-incubator/jest-metadata/e2e/__tests__/default/duplicate-generation.js"
Called from /Users/yaroslavs/Projects/wix-incubator/jest-metadata/e2e/__tests__/default/duplicate-generation.js