Giter Site home page Giter Site logo

Comments (7)

gilgameshskytrooper avatar gilgameshskytrooper commented on May 24, 2024 1

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.

adamgruber avatar adamgruber commented on May 24, 2024

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.

gilgameshskytrooper avatar gilgameshskytrooper commented on May 24, 2024

Thanks a bunch

from mochawesome-report-generator.

jeff00seattle avatar jeff00seattle commented on May 24, 2024

Curious, update on adding export to PDF? Thank you.

from mochawesome-report-generator.

adamgruber avatar adamgruber commented on May 24, 2024

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.

nlovell avatar nlovell commented on May 24, 2024

Unless someone opens a PR for this feature it's unlikely to be added anytime soon.

🤔

from mochawesome-report-generator.

jeff00seattle avatar jeff00seattle commented on May 24, 2024

I am wondering if a PDF report be generated headlessly

from mochawesome-report-generator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.