@@ -5,6 +5,7 @@ import { assertDeepStrictEqual } from 'assert-deep-strict-equal';
55import { readdirSync , readFileSync } from 'fs' ;
66import Vinyl from 'vinyl' ;
77import sinon from 'sinon' ;
8+ import slash from 'slash' ;
89
910// Plugin
1011import { htmlValidator } from '../dist/html-validator.js' ;
@@ -27,7 +28,7 @@ describe('The gulp-w3c-html-validator analyzer()', () => {
2728 const handleEndOfStream = ( ) => {
2829 const actual = {
2930 files : analyzedFiles . valid . length ,
30- path : analyzedFiles . valid [ 0 ] . path ,
31+ path : slash ( analyzedFiles . valid [ 0 ] . path ) ,
3132 results : analyzedFiles . valid [ 0 ] . w3cHtmlValidator ,
3233 } ;
3334 const expected = {
@@ -46,6 +47,8 @@ describe('The gulp-w3c-html-validator analyzer()', () => {
4647 html : readFileSync ( 'spec/html/valid.html' ) . toString ( ) ,
4748 } ,
4849 } ;
50+ if ( process . platform === 'win32' ) //todo: ensure title is the same on all platforms
51+ expected . results . title = 'HTML String (characters: 163)' ;
4952 assertDeepStrictEqual ( actual , expected , done ) ;
5053 } ;
5154 stream . on ( 'data' , ( file ) => analyzedFiles . valid . push ( file ) ) ;
@@ -66,7 +69,7 @@ describe('The gulp-w3c-html-validator analyzer()', () => {
6669 const handleEndOfStream = ( ) => {
6770 const actual = {
6871 files : analyzedFiles . invalid . length ,
69- path : analyzedFiles . invalid [ 0 ] . path ,
72+ path : slash ( analyzedFiles . invalid [ 0 ] . path ) ,
7073 validates : analyzedFiles . invalid [ 0 ] . w3cHtmlValidator . validates ,
7174 messages : analyzedFiles . invalid [ 0 ] . w3cHtmlValidator . messages . map ( message => message . type ) ,
7275 } ;
@@ -103,7 +106,7 @@ describe('The analyzer() ignoreMessages option', () => {
103106 const handleEndOfStream = ( ) => {
104107 const actual = {
105108 files : files . length ,
106- path : files [ 0 ] . path ,
109+ path : slash ( files [ 0 ] . path ) ,
107110 validates : files [ 0 ] . w3cHtmlValidator . validates ,
108111 messages : files [ 0 ] . w3cHtmlValidator . messages . map ( message => message . type ) ,
109112 } ;
@@ -139,7 +142,7 @@ describe('The gulp-w3c-html-validator reporter()', () => {
139142 const handleEndOfStream = ( ) => {
140143 const actual = {
141144 files : files . length ,
142- path : files [ 0 ] . path ,
145+ path : slash ( files [ 0 ] . path ) ,
143146 } ;
144147 const expected = {
145148 files : 1 ,
@@ -169,12 +172,12 @@ describe('The gulp-w3c-html-validator reporter()', () => {
169172 // Uncomment following line to view raw output:
170173 // console.log(spy.secondCall.args);
171174 spy . restore ( ) ;
172- const headerLine = / w 3 c - h t m l - v a l i d a t o r .* f a i l .* s p e c \/ h t m l \/ i n v a l i d .h t m l .* \( m e s s a g e s : 2 \) / ;
175+ const headerLine = / w 3 c - h t m l - v a l i d a t o r .* f a i l .* s p e c . * h t m l . * i n v a l i d .h t m l .* \( m e s s a g e s : 2 \) / ;
173176 const warningLine = / H T M L w a r n i n g : / ;
174177 const errorLine = / H T M L e r r o r : / ;
175178 const actual = {
176179 files : files . length ,
177- path : files [ 0 ] . path ,
180+ path : slash ( files [ 0 ] . path ) ,
178181 lines : {
179182 header : spy . calledWith ( sinon . match ( headerLine ) ) ,
180183 warning : spy . calledWith ( sinon . match ( warningLine ) ) ,
0 commit comments