<commit_before>import { test, testFilePath } from '../utils'

import { RuleTester } from 'eslint'
import { expect } from 'chai'
import fs from 'fs'

const ruleTester = new RuleTester()
    , rule = require('rules/no-unused-modules')

const error = message => ({ ruleId: 'no-unused-modules', message })

const missingExportsOptions = [{
  missingExports: true,
}]

const unusedExportsOptions = [{
  unusedExports: true,
  src: [testFilePath('./no-unused-modules/**/*.js')],
  ignoreExports: [testFilePath('./no-unused-modules/*ignored*.js')],
}]

// tests for missing exports
ruleTester.run('no-unused-modules', rule, {
  valid: [
    test({ options: missingExportsOptions,
           code: 'export default () => 1'}),
    test({ options: missingExportsOptions,
           code: 'export const a = 1'}),
    test({ options: missingExportsOptions,
           code: 'const a = 1; export { a }'}),
    test({ options: missingExportsOptions,
           code: 'function a() { return true }; export { a }'}),
    test({ options: missingExportsOptions,
           code: 'const a = 1; const b = 2; export { a, b }'}),
    test({ options: missingExportsOptions,
           code: 'const a = 1; export default a'}),
  ],
  invalid: [
    test({
      options: missingExportsOptions,
      code: 'const a = 1',
      errors: [error(`No exports found`)],
    }),
    test({
      options: missingExportsOptions,
      code: '/* const a = 1 */',
      errors: [error(`No exports found`)],
    }),
  ],
})

<commit_msg>[Test] `no-unused-modules` add failing test case<commit_after>import { test, testFilePath } from '../utils'

import { RuleTester } from 'eslint'
import { expect } from 'chai'
import fs from 'fs'

const ruleTester = new RuleTester()
    , rule = require('rules/no-unused-modules')

const error = message => ({ ruleId: 'no-unused-modules', message })

const missingExportsOptions = [{
  missingExports: true,
}]

const unusedExportsOptions = [{
  unusedExports: true,
  src: [testFilePath('./no-unused-modules/**/*.js')],
  ignoreExports: [testFilePath('./no-unused-modules/*ignored*.js')],
}]

// tests for missing exports
ruleTester.run('no-unused-modules', rule, {
  valid: [
    test({ code: 'export default function noOptions() {}' }),
    test({ options: missingExportsOptions,
           code: 'export default () => 1'}),
    test({ options: missingExportsOptions,
           code: 'export const a = 1'}),
    test({ options: missingExportsOptions,
           code: 'const a = 1; export { a }'}),
    test({ options: missingExportsOptions,
           code: 'function a() { return true }; export { a }'}),
    test({ options: missingExportsOptions,
           code: 'const a = 1; const b = 2; export { a, b }'}),
    test({ options: missingExportsOptions,
           code: 'const a = 1; export default a'}),
  ],
  invalid: [
    test({
      options: missingExportsOptions,
      code: 'const a = 1',
      errors: [error(`No exports found`)],
    }),
    test({
      options: missingExportsOptions,
      code: '/* const a = 1 */',
      errors: [error(`No exports found`)],
    }),
  ],
})


{'fraction_non_alphanumeric': 0.16317316994517897, 'fraction_numerical': 0.0051596259271202835, 'mean_word_length': 3.06020942408377, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6422204', 'n_tokens_mistral': 962, 'n_tokens_neox': 957, 'n_words': 267}