Skip to content

test: shrink down test file #442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions test/cli/formatters/checkstyle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ describe('CLI', () => {
.readFileSync(path.resolve(__dirname, 'checkstyle.xml'), 'utf8')
.replace(
'{{path}}',
path.resolve(__dirname, '../../html/executable.html')
path
.resolve(__dirname, 'example.html')
// TODO: we need to fix windows backslash
.replace('\\example', '/example')
)
// TODO: we need to fix windows backslash
.replace('html\\executable.html', 'html/executable.html')

const expectedParts = expected.split('\n')

ChildProcess.exec(
[
'node',
path.resolve(__dirname, '../../../bin/htmlhint'),
path.resolve(__dirname, '../../html/executable.html'),
path.resolve(__dirname, 'example.html'),
'--format',
'checkstyle',
].join(' '),
Expand Down
100 changes: 14 additions & 86 deletions test/cli/formatters/checkstyle.xml

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions test/cli/formatters/example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div bad='' bad=''></div>
<div bad='' bad=''></div>
<input type="text"></input>
<div class"foo">

</div>
</div>
</hello>
</test>
</div>
<test>
<hello>
<div>
<div class='' what='' something=''></div>
</div>
</hello>
</test>
</div>
</bad>
</bad>
</body>
</html>
2 changes: 1 addition & 1 deletion test/cli/formatters/html.html
Original file line number Diff line number Diff line change
@@ -1 +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>{{path}}</td><td>8</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>2</td><td>{{path}}</td><td>8</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>3</td><td>{{path}}</td><td>8</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>4</td><td>{{path}}</td><td>9</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>5</td><td>{{path}}</td><td>9</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>6</td><td>{{path}}</td><td>9</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>7</td><td>{{path}}</td><td>10</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>8</td><td>{{path}}</td><td>10</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>9</td><td>{{path}}</td><td>10</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>10</td><td>{{path}}</td><td>11</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>11</td><td>{{path}}</td><td>11</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>12</td><td>{{path}}</td><td>11</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>13</td><td>{{path}}</td><td>12</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>14</td><td>{{path}}</td><td>12</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>15</td><td>{{path}}</td><td>12</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>16</td><td>{{path}}</td><td>13</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>17</td><td>{{path}}</td><td>13</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>18</td><td>{{path}}</td><td>13</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>19</td><td>{{path}}</td><td>14</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>20</td><td>{{path}}</td><td>14</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>21</td><td>{{path}}</td><td>14</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>22</td><td>{{path}}</td><td>15</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>23</td><td>{{path}}</td><td>15</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>24</td><td>{{path}}</td><td>15</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>25</td><td>{{path}}</td><td>16</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>26</td><td>{{path}}</td><td>16</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>27</td><td>{{path}}</td><td>16</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>28</td><td>{{path}}</td><td>17</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>29</td><td>{{path}}</td><td>17</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>30</td><td>{{path}}</td><td>17</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>31</td><td>{{path}}</td><td>18</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>32</td><td>{{path}}</td><td>18</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>33</td><td>{{path}}</td><td>18</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>34</td><td>{{path}}</td><td>19</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>35</td><td>{{path}}</td><td>19</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>36</td><td>{{path}}</td><td>19</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>37</td><td>{{path}}</td><td>20</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>38</td><td>{{path}}</td><td>20</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>39</td><td>{{path}}</td><td>20</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>40</td><td>{{path}}</td><td>21</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>41</td><td>{{path}}</td><td>21</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>42</td><td>{{path}}</td><td>21</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>43</td><td>{{path}}</td><td>22</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>44</td><td>{{path}}</td><td>22</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>45</td><td>{{path}}</td><td>22</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>46</td><td>{{path}}</td><td>23</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>47</td><td>{{path}}</td><td>23</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>48</td><td>{{path}}</td><td>23</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>49</td><td>{{path}}</td><td>24</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>50</td><td>{{path}}</td><td>24</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>51</td><td>{{path}}</td><td>24</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>52</td><td>{{path}}</td><td>25</td><td>Tag must be paired, no start tag: [ </input> ]</td></tr><tr><td>53</td><td>{{path}}</td><td>26</td><td>Special characters must be escaped : [ < ].</td></tr><tr><td>54</td><td>{{path}}</td><td>26</td><td>Special characters must be escaped : [ > ].</td></tr><tr><td>55</td><td>{{path}}</td><td>28</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>56</td><td>{{path}}</td><td>29</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>57</td><td>{{path}}</td><td>30</td><td>Tag must be paired, no start tag: [ </hello> ]</td></tr><tr><td>58</td><td>{{path}}</td><td>31</td><td>Tag must be paired, no start tag: [ </test> ]</td></tr><tr><td>59</td><td>{{path}}</td><td>32</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>60</td><td>{{path}}</td><td>38</td><td>The value of attribute [ class ] must be in double quotes.</td></tr><tr><td>61</td><td>{{path}}</td><td>38</td><td>The value of attribute [ what ] must be in double quotes.</td></tr><tr><td>62</td><td>{{path}}</td><td>38</td><td>The value of attribute [ something ] must be in double quotes.</td></tr><tr><td>63</td><td>{{path}}</td><td>44</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>64</td><td>{{path}}</td><td>50</td><td>The value of attribute [ class ] must be in double quotes.</td></tr><tr><td>65</td><td>{{path}}</td><td>50</td><td>The value of attribute [ what ] must be in double quotes.</td></tr><tr><td>66</td><td>{{path}}</td><td>50</td><td>The value of attribute [ something ] must be in double quotes.</td></tr><tr><td>67</td><td>{{path}}</td><td>56</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>68</td><td>{{path}}</td><td>62</td><td>The value of attribute [ class ] must be in double quotes.</td></tr><tr><td>69</td><td>{{path}}</td><td>62</td><td>The value of attribute [ what ] must be in double quotes.</td></tr><tr><td>70</td><td>{{path}}</td><td>62</td><td>The value of attribute [ something ] must be in double quotes.</td></tr><tr><td>71</td><td>{{path}}</td><td>68</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>72</td><td>{{path}}</td><td>74</td><td>The value of attribute [ class ] must be in double quotes.</td></tr><tr><td>73</td><td>{{path}}</td><td>74</td><td>The value of attribute [ what ] must be in double quotes.</td></tr><tr><td>74</td><td>{{path}}</td><td>74</td><td>The value of attribute [ something ] must be in double quotes.</td></tr><tr><td>75</td><td>{{path}}</td><td>80</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>76</td><td>{{path}}</td><td>81</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>77</td><td>{{path}}</td><td>82</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>78</td><td>{{path}}</td><td>83</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>79</td><td>{{path}}</td><td>84</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>80</td><td>{{path}}</td><td>85</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>81</td><td>{{path}}</td><td>86</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>82</td><td>{{path}}</td><td>87</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>83</td><td>{{path}}</td><td>88</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>84</td><td>{{path}}</td><td>89</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>85</td><td>{{path}}</td><td>90</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>86</td><td>{{path}}</td><td>91</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>87</td><td>{{path}}</td><td>92</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>88</td><td>{{path}}</td><td>93</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>89</td><td>{{path}}</td><td>94</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>90</td><td>{{path}}</td><td>95</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>91</td><td>{{path}}</td><td>96</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>92</td><td>{{path}}</td><td>97</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr></table></body></html>
<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>{{path}}</td><td>8</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>2</td><td>{{path}}</td><td>8</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>3</td><td>{{path}}</td><td>8</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>4</td><td>{{path}}</td><td>9</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>5</td><td>{{path}}</td><td>9</td><td>The value of attribute [ bad ] must be in double quotes.</td></tr><tr><td>6</td><td>{{path}}</td><td>9</td><td>Duplicate of attribute name [ bad ] was found.</td></tr><tr><td>7</td><td>{{path}}</td><td>10</td><td>Tag must be paired, no start tag: [ </input> ]</td></tr><tr><td>8</td><td>{{path}}</td><td>11</td><td>Special characters must be escaped : [ < ].</td></tr><tr><td>9</td><td>{{path}}</td><td>11</td><td>Special characters must be escaped : [ > ].</td></tr><tr><td>10</td><td>{{path}}</td><td>13</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>11</td><td>{{path}}</td><td>14</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>12</td><td>{{path}}</td><td>15</td><td>Tag must be paired, no start tag: [ </hello> ]</td></tr><tr><td>13</td><td>{{path}}</td><td>16</td><td>Tag must be paired, no start tag: [ </test> ]</td></tr><tr><td>14</td><td>{{path}}</td><td>17</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>15</td><td>{{path}}</td><td>21</td><td>The value of attribute [ class ] must be in double quotes.</td></tr><tr><td>16</td><td>{{path}}</td><td>21</td><td>The value of attribute [ what ] must be in double quotes.</td></tr><tr><td>17</td><td>{{path}}</td><td>21</td><td>The value of attribute [ something ] must be in double quotes.</td></tr><tr><td>18</td><td>{{path}}</td><td>25</td><td>Tag must be paired, no start tag: [ </div> ]</td></tr><tr><td>19</td><td>{{path}}</td><td>26</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr><tr><td>20</td><td>{{path}}</td><td>27</td><td>Tag must be paired, no start tag: [ </bad> ]</td></tr></table></body></html>
6 changes: 3 additions & 3 deletions test/cli/formatters/html.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ describe('CLI', () => {
.replace(
/\{\{path\}\}/g,
path
.resolve(__dirname, '../../html/executable.html')
.resolve(__dirname, 'example.html')
// TODO: we need to fix windows backslash
.replace('html\\executable.html', 'html/executable.html')
.replace('\\example', '/example')
)

const expectedParts = expected.split('\n')
Expand All @@ -23,7 +23,7 @@ describe('CLI', () => {
[
'node',
path.resolve(__dirname, '../../../bin/htmlhint'),
path.resolve(__dirname, '../../html/executable.html'),
path.resolve(__dirname, 'example.html'),
'--format',
'html',
].join(' '),
Expand Down
Loading