From 755f56f5f9993d7ce1d30a0ffe31b2b54c03588b Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Mon, 8 Apr 2019 18:42:34 -0500 Subject: [PATCH] run tests in strict mode to prevent 73efedb9705401552cc44ecb182433c508f31d24 --- src/css.js | 2 ++ src/dropcss.js | 2 ++ src/html.js | 2 ++ src/matches.js | 2 ++ src/nth.js | 2 ++ src/sel.js | 2 ++ test/coverage.txt | 10 +++++----- 7 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/css.js b/src/css.js index 2714913..77bcf63 100644 --- a/src/css.js +++ b/src/css.js @@ -1,3 +1,5 @@ +"use strict"; + const COMMENTS = /\s*\/\*[\s\S]*?\*\/\s*/gm; const COMBINATORS = /\s*[>~+]\s*|\s+/g; diff --git a/src/dropcss.js b/src/dropcss.js index 9b13011..5572563 100644 --- a/src/dropcss.js +++ b/src/dropcss.js @@ -1,3 +1,5 @@ +"use strict"; + const { parse: parseHTML } = require('./html'); const { parse: parseCSS, generate: generateCSS, SELECTORS, takeUntilMatchedClosing } = require('./css'); const { some } = require('./sel'); diff --git a/src/html.js b/src/html.js index 89779cd..a76435f 100644 --- a/src/html.js +++ b/src/html.js @@ -1,3 +1,5 @@ +"use strict"; + const TAG_OPEN = 1; const ATTRS = 2; const TAG_CLOSE = 3; diff --git a/src/matches.js b/src/matches.js index a81db42..8c75059 100644 --- a/src/matches.js +++ b/src/matches.js @@ -1,3 +1,5 @@ +"use strict"; + const { nth } = require('./nth'); function matchesType(el, name) { diff --git a/src/nth.js b/src/nth.js index da5550c..a12927e 100644 --- a/src/nth.js +++ b/src/nth.js @@ -1,3 +1,5 @@ +"use strict"; + // adapted from https://github.com/fb55/nth-check/blob/master/compile.js // https://css-tricks.com/how-nth-child-works/ diff --git a/src/sel.js b/src/sel.js index 2ef0ac2..4d010be 100644 --- a/src/sel.js +++ b/src/sel.js @@ -1,3 +1,5 @@ +"use strict"; + const matches = require('./matches'); const { getSibsOfType } = require('./html'); diff --git a/test/coverage.txt b/test/coverage.txt index 2bb3a49..ddace51 100644 --- a/test/coverage.txt +++ b/test/coverage.txt @@ -2,10 +2,10 @@ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | ------------|----------|----------|----------|----------|-------------------| All files | 96.71 | 87.98 | 100 | 96.6 | | - css.js | 97.75 | 90 | 100 | 97.67 | 109,110 | - dropcss.js | 99.14 | 97.5 | 100 | 99.07 | 163 | - html.js | 98.82 | 94.12 | 100 | 98.77 | 104 | + css.js | 97.75 | 90 | 100 | 97.67 | 111,112 | + dropcss.js | 99.14 | 97.5 | 100 | 99.07 | 165 | + html.js | 98.82 | 94.12 | 100 | 98.77 | 106 | matches.js | 100 | 100 | 100 | 100 | | - nth.js | 56.25 | 45 | 100 | 56.25 |... 38,41,47,52,54 | - sel.js | 96.95 | 88.89 | 100 | 96.91 |... 10,115,122,248 | + nth.js | 56.25 | 45 | 100 | 56.25 |... 40,43,49,54,56 | + sel.js | 96.95 | 88.89 | 100 | 96.91 |... 12,117,124,250 | ------------|----------|----------|----------|----------|-------------------|