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.

jest-html-reporters-attach directory does not adhere to 'filename' configuration for javascript resources, resulting in multiple reports pointing to the same javascirpt resources

See original GitHub issue

Describe the bug In a mono repository where tests are run against multiple libraries, each of which has it’s own unique name. the current process creates a ‘[filename].html’" in the ‘[publicPath]’ directory for each test. however all HTML have the same hardcoded script tag <script src="./jest-html-reporters-attach/index.js"/> with muliple projects this means that all html files display the exact same data as the last project that was run

To Reproduce

  1. in “ProjectA”
  2. configure “jest-html-reporters” in jest.config.js to { publicPath: './jestreports', filename: 'projectA-report.html' }
  3. in “ProjectB”
  4. configure “jest-html-reporters” in jest.config.js to { publicPath: './jestreports', filename: 'projectB-report.html' }
  5. run tests for both projects

Expected behavior

  • two files for each project to appear in the publicPath => “./jestreports”
  • projectA-report.html should contain results of it’s test
  • projectB-report.html should contain results of it’s test
  • the JavaScript resources for each report should use the filename attribute specified in the config
  • the src attribute of the script tag should then point to this specific resource folder

** Bub/Actual Behavior**

  • when you open “projectA-report.html” it shows the results of “ProjectB” tests
  • this is because both html files are hard coded to point to the same JavaScript source <script src="./jest-html-reporters-attach/index.js"/>
  • as shown here, two different reports point to the same JavaScript resources jestHtmlRepoters_MultireportBug

the end result of this is that if you have more than one project for which you are using jest-html-reporters the html file will only ever show data for the “last” test that was run.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
Hazyzhcommented, Jan 2, 2022

Hi @mwamufiya seems it’s a miss consider case. I release a new version 3.0.2 just now try to fix it, please have a try again.

and @theeko addMsg not working is a bug, also fixed in this version, please have a try.

Thanks for report the issue.

1reaction
theekocommented, Jan 3, 2022

@Hazyzh I found the issue: addMsg is accepting an object now instead of a string.

I made readme.md changes: https://github.com/Hazyzh/jest-html-reporters/pull/183

Thanks a lot for the fixes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Conflict: Multiple assets emit to the same filename
what I want to know is what tool writes an error like "Conflict: Multiple assets emit to the same filename slots.js". Why would...
Read more >
How to make html files output to a different directory · Issue #665
The problem is when I use the publicPath attribute, multiple pages can not correctly reference js, css and other resources. This is the...
Read more >
Naming Files, Paths, and Namespaces - Win32 apps
A file name is relative to the current directory if it does not begin with one of the following: A UNC name of...
Read more >
Characters to Avoid in Filenames and Directories
Therefore, it is essential to play it safe and avoid common illegal filename and directory characters. Naming conventions are important in web folders...
Read more >
File naming and structure - Research Data Management at ...
Descriptive file names are an important part of organizing, sharing, and keeping track of data files. Develop a naming convention based on ...
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