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

✅ display the jasmine seed after executing tests #620

Merged
merged 3 commits into from
Nov 17, 2020

Conversation

BenoitZugmeyer
Copy link
Member

@BenoitZugmeyer BenoitZugmeyer commented Nov 16, 2020

Motivation

Jasmine tests execution order is random. This can be useful to spot issues that occurs because of tests side effects, but sometimes it makes issues hard to reproduce.

Changes

Display the seed used to execute tests, so they can be re-executed in the same order by using the jasmine seed option

Inspired from https://github.com/ketan/karma-jasmine-seed-reporter and https://gist.github.com/odlp/e1586f4f198d157de50e8303b18acfd9/ , but for some reason when using baseReporterDecorator(this); in the reporter (so it can use this.write), console.log() displays the same message twice. Using a karma "logger" instead of this.write fix the issue.

Testing


I have gone over the contributing documentation.

@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner November 16, 2020 13:08
@BenoitZugmeyer BenoitZugmeyer force-pushed the benoit/karma-seed-reporter branch from f2381bb to 73be192 Compare November 16, 2020 13:09
@codecov-io
Copy link

codecov-io commented Nov 16, 2020

Codecov Report

Merging #620 (3875cc9) into master (5b4418b) will decrease coverage by 0.35%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #620      +/-   ##
==========================================
- Coverage   89.13%   88.77%   -0.36%     
==========================================
  Files          54       54              
  Lines        2503     2503              
  Branches      541      541              
==========================================
- Hits         2231     2222       -9     
- Misses        272      281       +9     
Impacted Files Coverage Δ
packages/rum/src/transport/batch.ts 65.85% <0.00%> (-14.64%) ⬇️
packages/rum/src/browser/performanceCollection.ts 62.85% <0.00%> (-2.86%) ⬇️
...ckages/core/src/domain/automaticErrorCollection.ts 98.41% <0.00%> (-1.59%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b4418b...3875cc9. Read the comment docs.

const log = logger.create('jasmine-seed-reporter')
this.onBrowserComplete = function(browser, result) {
if (result.order && result.order.random && result.order.seed) {
log.info(`${browser}: Randomized with seed ${result.order.seed}\n`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Way better to display browser for browser stack tests seed!

Copy link
Contributor

@bcaudan bcaudan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants