checker.js 584 B

12345678910111213141516171819202122232425
  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(
  6. /No configuration provided/.test(error.message),
  7. 'should handle not found'
  8. );
  9. const fail = await check('./test/fail');
  10. assert(fail.length > 0, 'should have errors');
  11. assert(fail.includes('indentation'), 'should have indent error');
  12. const pass = await check('./test/pass');
  13. assert(pass == null, 'should have no errors');
  14. }
  15. test().catch((error) => {
  16. console.error(error);
  17. process.exitCode = 1;
  18. });