/** * @author Flo Edelmann */ 'use strict' const { RuleTester } = require('../../eslint-compat') const rule = require('../../../lib/rules/no-constant-condition.js') const tester = new RuleTester({ languageOptions: { parser: require('vue-eslint-parser'), ecmaVersion: 6 } }) tester.run('no-constant-condition', rule, { valid: [ '', '', '', '' ], invalid: [ { code: '', errors: [ { messageId: 'unexpected', type: 'UnaryExpression', column: 31, endColumn: 33 } ] }, { code: '', errors: [ { messageId: 'unexpected', type: 'Literal', column: 36, endColumn: 40 } ] }, { code: '', errors: [ { messageId: 'unexpected', type: 'Literal', column: 31, endColumn: 32 } ] }, { code: '', errors: [ { messageId: 'unexpected', type: 'ObjectExpression', column: 33, endColumn: 35 } ] }, { code: '', errors: [ { messageId: 'unexpected', type: 'BinaryExpression', column: 31, endColumn: 36 } ] }, { code: '', errors: [ { messageId: 'unexpected', type: 'LogicalExpression', column: 31, endColumn: 37 } ] } // failing in Node.js v8, because template literals are not supported there: // { // code: '', // errors: [ // { // messageId: 'unexpected', // type: 'TemplateLiteral', // column: 31, // endColumn: 36 // } // ] // }, // { // code: '', // errors: [ // { // messageId: 'unexpected', // type: 'TemplateLiteral', // column: 31, // endColumn: 33 // } // ] // } ] })