Comments (7)
So the way I got around the problem of needing to compile a single PDF is to host the HTML files using an HTTP file server (I used Go Echo v4 for this purpose, but you can probably also do this in a Node server). Basically, all css/js assets are identical for every single generated HTML file. So you only need to save 1 set of the following files on disk:
MaterialIcons-Regular.woff
MaterialIcons-Regular.woff2
app.css
app.js
roboto-light-webfont.woff
roboto-light-webfont.woff2
roboto-medium-webfont.woff
roboto-medium-webfont.woff2
roboto-regular-webfont.woff
roboto-regular-webfont.woff2
Save the above a directory called /assets/
, making sure to edit the import paths inside these files (i.e. src:url(roboto-medium-webfont.woff2) format("woff2"),url(roboto-medium-webfont.woff) format("woff");
becomes src:url(/assets/roboto-medium-webfont.woff2) format("woff2"),url(/assets/roboto-medium-webfont.woff) format("woff");
. Then make sure the assets
folder contents are accessible on the above server via the path /assets
.
After Mocha finishes running, and the HTML file is generated, just rename the file mochawesome.html
to index.html
, and nuke all other generated files. Then I create a new directory with the structure reports/yyyy-mm-dd_hh-mm-ss
and move index.html
into that directory. Then do string replacement on all src
and href
to use /assets/filename
inside of index.html
(i.e. <script src="/assets/app.js"></script>
).
Then you can just host the file directory reports/yyyy-mm-dd_hh-mm-ss
at /reports/yyyy-mm-dd_hh-mm-ss
on this server.
Not an ideal solution, but works well enough for my organization. This becomes even more secure if you use a basic auth middleware in that server to password protect the mocha awesome test results from prying eyes.
from mochawesome-report-generator.
Thanks for the suggestion. Exporting to PDF isn't currently on the roadmap but it's something I'll consider for future enhancements.
from mochawesome-report-generator.
Thanks a bunch
from mochawesome-report-generator.
Curious, update on adding export to PDF? Thank you.
from mochawesome-report-generator.
TBH, I don't have much time these days to work on this project. Unless someone opens a PR for this feature it's unlikely to be added anytime soon.
from mochawesome-report-generator.
Unless someone opens a PR for this feature it's unlikely to be added anytime soon.
🤔
from mochawesome-report-generator.
I am wondering if a PDF report be generated headlessly
from mochawesome-report-generator.
Related Issues (20)
- Can the validator package be updated? HOT 1
- SNYK has detected a high severity issue HOT 4
- Feature: Statistics on suite
- Snapshots stopped showing up on reports after upgrade to v6.0.1 HOT 1
- Add option to avoid use of custom fonts (assets) HOT 1
- How can I get the title of my spec file/describe as my HTML report file namne HOT 5
- Unlimit mochawesome report files above 1000 and rename them HOT 1
- .html extension duplication in 6.1.0 HOT 6
- Please consider progressive enhancement to avoid blank pages when CSPs don't allow JS HOT 3
- Pattern UKStagingJsonReports/.jsons/*.json matched no report files HOT 8
- formatDuration raises sometimes an "Expected a finite number" exception (and it displays a blank screen) HOT 1
- Report shows passed steps as pending HOT 3
- Failures array empty in report
- Asset folder is getting generate even after --inline=true argument
- Copy Text from Test Header
- Please add line number for soure code displaying HOT 1
- Failing to use [name] for reportFilename HOT 1
- Test result file types/interfaces
- Unable to format the "context" section of the mochawesome report
- Ability to show hooks duration in the generated report
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mochawesome-report-generator.