Skip to content

Commit

Permalink
test: use snapshots for stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni committed Dec 13, 2021
1 parent b8864a4 commit 68b677e
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 24 deletions.
4 changes: 3 additions & 1 deletion src/cli/formatters/__snapshots__/checkstyle.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CLI Formatter: checkstyle should have stdout output with formatter checkstyle 1`] = `
exports[`CLI Formatter: checkstyle should have stdout output with formatter checkstyle: stderr 1`] = `""`;

exports[`CLI Formatter: checkstyle should have stdout output with formatter checkstyle: stdout 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>
<checkstyle version=\\"4.3\\">
<file name=\\"<PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html\\">
Expand Down
4 changes: 3 additions & 1 deletion src/cli/formatters/__snapshots__/compact.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CLI Formatter: compact should have stdout output with formatter compact 1`] = `
exports[`CLI Formatter: compact should have stdout output with formatter compact: stderr 1`] = `""`;

exports[`CLI Formatter: compact should have stdout output with formatter compact: stdout 1`] = `
"<PROJECT_ROOT>/src/cli/__fixtures__/executable.html: line 8, col 7, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)
<PROJECT_ROOT>/src/cli/__fixtures__/executable.html: line 8, col 14, error - The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)
<PROJECT_ROOT>/src/cli/__fixtures__/executable.html: line 8, col 14, error - Duplicate of attribute name [ bad ] was found. (attr-no-duplication)
Expand Down
4 changes: 3 additions & 1 deletion src/cli/formatters/__snapshots__/default.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CLI Formatter: default should have stdout output with formatter default 1`] = `
exports[`CLI Formatter: default should have stdout output with formatter default: stderr 1`] = `""`;

exports[`CLI Formatter: default should have stdout output with formatter default: stdout 1`] = `
"
<PROJECT_ROOT>/src/cli/__fixtures__/executable.html
 L8 | <div bad='' bad=''></div>
Expand Down
4 changes: 3 additions & 1 deletion src/cli/formatters/__snapshots__/html.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CLI Formatter: html should have stdout output with formatter html 1`] = `"<html><head><title>HTML Hint Violation Report</title></head><body><center><h2>Violation Report</h2></center><table border=\\"1\\"><tr><th>Number#</th><th>File Name</th><th>Line Number</th><th>Message</th></tr><tr><td>1</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>8</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>2</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>8</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>3</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>8</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>4</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>9</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>5</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>9</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>6</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>9</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>7</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>10</td><td>Tag must be paired, no start tag: [ </input> ]</td></tr><tr><td>8</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>11</td><td>Special characters must be escaped : [ < ].</td></tr><tr><td>9</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>11</td><td>Special characters must be escaped : [ > ].</td></tr><tr><td>10</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>13</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>11</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>14</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>12</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>15</td><td>Tag must be paired, no start tag: [ </hello> ]</td></tr><tr><td>13</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>16</td><td>Tag must be paired, no start tag: [ </test> ]</td></tr><tr><td>14</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>17</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>15</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>21</td><td>The value of attribute [ class ] must be in double quotes.</td></tr><tr><td>16</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>21</td><td>The value of attribute [ what ] must be in double quotes.</td></tr><tr><td>17</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>21</td><td>The value of attribute [ something ] must be in double quotes.</td></tr><tr><td>18</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>25</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>19</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>26</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>20</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>27</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr></table></body></html>"`;
exports[`CLI Formatter: html should have stdout output with formatter html: stderr 1`] = `""`;

exports[`CLI Formatter: html should have stdout output with formatter html: stdout 1`] = `"<html><head><title>HTML Hint Violation Report</title></head><body><center><h2>Violation Report</h2></center><table border=\\"1\\"><tr><th>Number#</th><th>File Name</th><th>Line Number</th><th>Message</th></tr><tr><td>1</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>8</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>2</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>8</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>3</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>8</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>4</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>9</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>5</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>9</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>6</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>9</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>7</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>10</td><td>Tag must be paired, no start tag: [ </input> ]</td></tr><tr><td>8</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>11</td><td>Special characters must be escaped : [ < ].</td></tr><tr><td>9</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>11</td><td>Special characters must be escaped : [ > ].</td></tr><tr><td>10</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>13</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>11</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>14</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>12</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>15</td><td>Tag must be paired, no start tag: [ </hello> ]</td></tr><tr><td>13</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>16</td><td>Tag must be paired, no start tag: [ </test> ]</td></tr><tr><td>14</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>17</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>15</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>21</td><td>The value of attribute [ class ] must be in double quotes.</td></tr><tr><td>16</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>21</td><td>The value of attribute [ what ] must be in double quotes.</td></tr><tr><td>17</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>21</td><td>The value of attribute [ something ] must be in double quotes.</td></tr><tr><td>18</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>25</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>19</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>26</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>20</td><td><PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html</td><td>27</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr></table></body></html>"`;
4 changes: 3 additions & 1 deletion src/cli/formatters/__snapshots__/json.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CLI Formatter: json should have stdout output with formatter json 1`] = `
exports[`CLI Formatter: json should have stdout output with formatter json: stderr 1`] = `""`;

exports[`CLI Formatter: json should have stdout output with formatter json: stdout 1`] = `
Array [
Object {
"file": "<PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html",
Expand Down
4 changes: 3 additions & 1 deletion src/cli/formatters/__snapshots__/junit.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CLI Formatter: junit should have stdout output with formatter junit 1`] = `
exports[`CLI Formatter: junit should have stdout output with formatter junit: stderr 1`] = `""`;

exports[`CLI Formatter: junit should have stdout output with formatter junit: stdout 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>
<testsuites>
<testsuite name=\\"HTMLHint Tests\\" time=\\"0.999\\" tests=\\"1\\" failures=\\"1\\">
Expand Down
4 changes: 3 additions & 1 deletion src/cli/formatters/__snapshots__/markdown.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CLI Formatter: markdown should have stdout output with formatter markdown 1`] = `
exports[`CLI Formatter: markdown should have stdout output with formatter markdown: stderr 1`] = `""`;

exports[`CLI Formatter: markdown should have stdout output with formatter markdown: stdout 1`] = `
"# TOC
- [<PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html](#<PROJECT_ROOT>/src/cli/formatters/__fixtures__/example.html)
Expand Down
4 changes: 3 additions & 1 deletion src/cli/formatters/__snapshots__/unix.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CLI Formatter: unix should have stdout output with formatter unix 1`] = `
exports[`CLI Formatter: unix should have stdout output with formatter unix: stderr 1`] = `""`;

exports[`CLI Formatter: unix should have stdout output with formatter unix: stdout 1`] = `
"<PROJECT_ROOT>/src/cli/__fixtures__/executable.html:8:7: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes]
<PROJECT_ROOT>/src/cli/__fixtures__/executable.html:8:14: The value of attribute [ bad ] must be in double quotes. [error/attr-value-double-quotes]
<PROJECT_ROOT>/src/cli/__fixtures__/executable.html:8:14: Duplicate of attribute name [ bad ] was found. [error/attr-no-duplication]
Expand Down
4 changes: 2 additions & 2 deletions src/cli/formatters/checkstyle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ describe('CLI', () => {

expect(exitCode).toBe(1)

expect(stdout).toMatchSnapshot()
expect(stdout).toMatchSnapshot('stdout')

expect(stderr).toBe('')
expect(stderr).toMatchSnapshot('stderr')
})
})
})
4 changes: 2 additions & 2 deletions src/cli/formatters/compact.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ describe('CLI', () => {
])
expect(exitCode).toBe(1)

expect(stdout).toMatchSnapshot()
expect(stdout).toMatchSnapshot('stdout')

expect(stderr).toBe('')
expect(stderr).toMatchSnapshot('stderr')
})
})
})
4 changes: 2 additions & 2 deletions src/cli/formatters/default.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ describe('CLI', () => {

expect(exitCode).toBe(1)

expect(stdout.replace(/(\d+ ms)/, '(99 ms)')).toMatchSnapshot()
expect(stdout.replace(/(\d+ ms)/, '(99 ms)')).toMatchSnapshot('stdout')

expect(stderr).toBe('')
expect(stderr).toMatchSnapshot('stderr')
})
})
})
4 changes: 2 additions & 2 deletions src/cli/formatters/html.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ describe('CLI', () => {

expect(exitCode).toBe(1)

expect(stdout).toMatchSnapshot()
expect(stdout).toMatchSnapshot('stdout')

expect(stderr).toBe('')
expect(stderr).toMatchSnapshot('stderr')
})
})
})
4 changes: 2 additions & 2 deletions src/cli/formatters/json.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ describe('CLI', () => {

expect(
JSON.parse(stdout.replace(/"time":\d+/, '"time":99'))
).toMatchSnapshot()
).toMatchSnapshot('stdout')

expect(stderr).toBe('')
expect(stderr).toMatchSnapshot('stderr')
})
})
})
4 changes: 2 additions & 2 deletions src/cli/formatters/junit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ describe('CLI', () => {

expect(
stdout.replace(/time="\d+\.\d+"/g, 'time="0.999"')
).toMatchSnapshot()
).toMatchSnapshot('stdout')

expect(stderr).toBe('')
expect(stderr).toMatchSnapshot('stderr')
})
})
})
4 changes: 2 additions & 2 deletions src/cli/formatters/markdown.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ describe('CLI', () => {
])
expect(exitCode).toBe(1)

expect(stdout).toMatchSnapshot()
expect(stdout).toMatchSnapshot('stdout')

expect(stderr).toBe('')
expect(stderr).toMatchSnapshot('stderr')
})
})
})
4 changes: 2 additions & 2 deletions src/cli/formatters/unix.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ describe('CLI', () => {
])
expect(exitCode).toBe(1)

expect(stdout).toMatchSnapshot()
expect(stdout).toMatchSnapshot('stdout')

expect(stderr).toBe('')
expect(stderr).toMatchSnapshot('stderr')
})
})
})

0 comments on commit 68b677e

Please sign in to comment.