/html-test

Node.js library for testing HTML files on the fly and output errors in the console with Gulp.js compatibilities

Primary LanguageHTMLMIT LicenseMIT

HTML Test

Node.js library for testing HTML files on the fly and output errors in the console with Gulp.js compatibilities

License:MIT npm

screenshot

How to install

npm

npm i --save-dev html-test

yarn

yarn add --dev html-test

How to use

import htmlTest from 'htmlTest';

htmlTest('./html/**/*.html');
import htmlTest from 'htmlTest';

htmlTest('./html/**/*.html', { ignore: 'html/ignore-me/**' });

Gulp.js integration

import gulp from 'gulp';
const { parallel, watch } = gulp;

import htmlTest from 'htmlTest';

const htmlTestRes = () =>
  htmlTest('./html/**/*.html', { ignore: ['html/ignore-me/**', 'node_modules/**'] });

const watcher = () => {
  watch('./html/*.html', htmlTestRes);
};

export default
  parallel(
    htmlTestRes,
    watcher
  )

Config

  • first parameter - source folder
  • ignore - ignored folder/s
  • hide - hide errors for template expression/s - 'js-literals', 'handlebars' etc.

fore exmaple:

htmlTest('./html/**/*.html', { ignore: ['html/ignore-me/**'], hide: ['js-literals']});

Limitations

API limitation is 5 remote requests by one time. To extend it need to add iterations timeout. It means validation will be processed with ignorance some of the requests to avoid waiting delays or need to select prioritized html files.

Recommendations

It's created for fast and rought in-development results without boring test delays and information overflow. So it shows critical errors only in a minimalistic way to console.

For full report with flexible configuration, I recommend:

Reference

Related Projects

I created this and some additional services for html-base to improve quality of frontend output. Here is the list:

Contributing

For issues, bugs or imporvements please open an issue


MIT License