detect-non-literal-fs-filename.js 432 B

12345678910111213141516171819
  1. 'use strict';
  2. const RuleTester = require('eslint').RuleTester;
  3. const tester = new RuleTester();
  4. const invalid = 'var a = fs.open(c)';
  5. const ruleName = 'detect-non-literal-fs-filename';
  6. tester.run(ruleName, require(`../rules/${ruleName}`), {
  7. valid: [{ code: 'var a = fs.open(\'test\')' }],
  8. invalid: [
  9. {
  10. code: invalid,
  11. errors: [{ message: 'Found fs.open with non literal argument at index 0' }]
  12. }
  13. ]
  14. });