Skip to content

Commit 9d469e2

Browse files
author
David Gnanasekaran
committed
Upgraded dependencies; Added testdata for regression testing
1 parent 16bbf9c commit 9d469e2

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# Vsts coverage styles
22

3-
This package helps to convert the external css files linked in an HTML into an internal style i.e., by injecting in HTML using `<style>` tag in the document head.
4-
It follows the same order while injecting CSS back in the HTML.
3+
Converts all externally linked CSS files in an HTML document into internal styles, by loading & injecting the RAW CSS styles as text within `<style>` tags into HTML document `<head>` section. It follows the same exact CSS file linking order, while injecting back the CSS styles using `<style>` tags. So, CSS override orders are preserved and appears as expected.
54

6-
It doesn't do anything else, so it is as simple and fast as it can.
5+
This plugin was initially designed with an idea to workaround the external CSS linking restrictions in VSTS(Azure DevOps) code coverage report tab in Build Summary. But, this package can also be used in similar situations.
76

8-
install using `npm install vsts-coverage-styles --save `
7+
It focuses primarily on improving the HTML report manipulation speed by caching the repeatedly accessed external CSS files, thus allowing it to complete its inlining process as fast as it can, compared to similar packages.
98

10-
Following is how you can consume the package from the nodejs file.
9+
You can install it as development dependency,
10+
using `npm install vsts-coverage-styles --save-dev`
1111

12-
The override css allows you to fix the glitches due to VSTS stripping pseudo selectors like :after & :before selectors, images & charsets
12+
After installation, you can simply require & consume the package from your nodejs file. Also, this package allows you to hook your custom logics to pre-processing and post-processing events using `preProcessFn` & `postProcessFn` params.
1313

14-
```
14+
The override CSS parameter allows you provide additional styles to append to your coverage reports and fix display glitches, that are caused due to stripping of pseudo selectors like :after & :before selectors, images & charsets from your CSS file by VSTS security mechanism.
15+
16+
```JavaScript
1517
/**
1618
* Vsts test coverage view doesn't load external CSS due to security reasons.
1719
* So we are converting all external css files to internal <style> tags using vsts-coverage-styles (node module).
@@ -45,5 +47,5 @@ vstsCoverageStyles({
4547
});
4648
```
4749

48-
To know about the assumptions and the optimization done for this plugin, check out the following article
50+
To know about the assumptions and optimization factors considered for this plugin, kindly read through the following article
4951
[Code coverage HTML reports are missing styles in VSTS](https://davidsekar.com/aspnetcore/code-coverage-html-reports-are-missing-styles-in-vsts)

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
22
"name": "vsts-coverage-styles",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "This package helps to convert the external css files in an HTML to an internal style i.e., injected using style tag in the document head.",
55
"main": "index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "run.js"
88
},
99
"author": "David Gnanasekaran",
1010
"license": "MIT",
1111
"dependencies": {
12-
"app-root-path": "^2.0.1",
12+
"app-root-path": "^2.2.1",
1313
"cheerio": "^1.0.0-rc.2",
14-
"clean-css": "^4.1.9",
15-
"glob": "^7.1.2",
16-
"merge": "^1.2.0"
14+
"clean-css": "^4.2.1",
15+
"glob": "^7.1.3",
16+
"merge": "^1.2.1"
1717
},
1818
"directories": {
1919
"test": "test"

test-sample/test-data.zip

148 KB
Binary file not shown.

0 commit comments

Comments
 (0)