11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciif ((!common.hasCrypto) || (!common.hasIntl)) {
51cb0ef41Sopenharmony_ci  common.skip('ESLint tests require crypto and Intl');
61cb0ef41Sopenharmony_ci}
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_cicommon.skipIfEslintMissing();
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciconst RuleTester = require('../../tools/node_modules/eslint').RuleTester;
111cb0ef41Sopenharmony_ciconst rule = require('../../tools/eslint-rules/eslint-check');
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciconst message = 'Please add a skipIfEslintMissing() call to allow this ' +
141cb0ef41Sopenharmony_ci                'test to be skipped when Node.js is built ' +
151cb0ef41Sopenharmony_ci                'from a source tarball.';
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_cinew RuleTester().run('eslint-check', rule, {
181cb0ef41Sopenharmony_ci  valid: [
191cb0ef41Sopenharmony_ci    'foo;',
201cb0ef41Sopenharmony_ci    'require("common")\n' +
211cb0ef41Sopenharmony_ci      'common.skipIfEslintMissing();\n' +
221cb0ef41Sopenharmony_ci      'require("../../tools/node_modules/eslint")',
231cb0ef41Sopenharmony_ci  ],
241cb0ef41Sopenharmony_ci  invalid: [
251cb0ef41Sopenharmony_ci    {
261cb0ef41Sopenharmony_ci      code: 'require("common")\n' +
271cb0ef41Sopenharmony_ci            'require("../../tools/node_modules/eslint").RuleTester',
281cb0ef41Sopenharmony_ci      errors: [{ message }],
291cb0ef41Sopenharmony_ci      output: 'require("common")\n' +
301cb0ef41Sopenharmony_ci              'common.skipIfEslintMissing();\n' +
311cb0ef41Sopenharmony_ci              'require("../../tools/node_modules/eslint").RuleTester'
321cb0ef41Sopenharmony_ci    },
331cb0ef41Sopenharmony_ci  ]
341cb0ef41Sopenharmony_ci});
35