checker.js 476 B

12345678910111213141516171819202122
  1. const assert = require('assert');
  2. const { check } = require('../src/checker.js');
  3. async function test() {
  4. const error = await check().catch((error) => error);
  5. assert(/No configuration provided/.test(error.message));
  6. const fail = await check('./test/fail');
  7. assert(fail.length > 0);
  8. assert(fail.includes('indentation'));
  9. const pass = await check('./test/pass');
  10. assert(pass === null);
  11. }
  12. test().catch((error) => {
  13. console.error(error);
  14. process.exitCode = 1;
  15. });