<commit_before>'use strict';

const spawnSync = require('child_process').spawnSync;
const pkg = require('./../../package.json');
const figures = require('figures');

const relativePathToCli = './src/cli.js';

// Paths to config file and package.json fixtures
const fixturesPath = './tests/fixtures';
const validFixturesPath = `${fixturesPath}/valid`;
const validRcFile = `${validFixturesPath}/.npmpackagejsonlintrc.json`;
const validPkg = `${validFixturesPath}/package.json`;
const errorFixturesPath = `${fixturesPath}/errors`;
const errorPkg = `${errorFixturesPath}/package.json`;
const errorRcFile = `${errorFixturesPath}/.npmpackagejsonlintrc.json`;
const warningFixturesPath = `${fixturesPath}/warnings`;
const warningPkg = `${warningFixturesPath}/package.json`;
const warningRcFile = `${warningFixturesPath}/.npmpackagejsonlintrc.json`;
const errAndWarnsFixturesPath = `${fixturesPath}/errorsAndWarnings`;
const errorWarningPkg = `${errAndWarnsFixturesPath}/package.json`;
const errorWarningRcFile = `${errAndWarnsFixturesPath}/.npmpackagejsonlintrc.json`;
const configJsFileFixturesPath = `${fixturesPath}/configJavaScriptFile`;
const configJavaScriptFile = `${configJsFileFixturesPath}/npmpackagejsonlint.config.js`;
const configJavaScriptFilePkg = `${configJsFileFixturesPath}/package.json`;
const pkgJsonPropFixturePath = `${fixturesPath}/packageJsonProperty`;
const packageJsonPropertyPkg = `${pkgJsonPropFixturePath}/package.json`;
const invalidFixturesPath = `${fixturesPath}/invalidConfig`;
const invalidRcFile = `${invalidFixturesPath}/.npmpackagejsonlintrc.json`;
const invalidPkgJsonPropertyPkg = `${invalidFixturesPath}/package.json`;
const invalidConfigJsFile = `${invalidFixturesPath}/npmpackagejsonlint.config.json`;

// Exit codes
const zeroClean = 0;
const oneMissingTargets = 1;
const twoLintErrorsDetected = 2;
const threeRunTimeException = 3;

describe('cli Unit Tests', function() {
  context('when the help command is run', function() {
    const expected = `
  CLI app for linting package.json files.

  Usage
    $ npmPkgJsonLint <patterns>

  Options
    --quiet, -q Report errors only
    --noConfigFiles, -ncf Disables use of .npmpackagejsonlintrc.json files, npmpackagejsonlint.config.js files, and npmPackageJsonLintConfig object in package.json file.
    --configFile, -c File path of .npmpackagejsonlintrc.json

  Examples
    $ npmPkgJsonLint --version
    $ npmPkgJsonLint .
    $ npmPkgJsonLint ./packages
    $ npmPkgJsonLint ./package1 ./package2
    $ npmPkgJsonLint -c ./config/.npmpackagejsonlintrc.json .
    $ npmPkgJsonLint --configFile ./config/npmpackagejsonlint.config.json .
    $ npmPkgJsonLint -q .
    $ npmPkgJsonLint --quiet ./packages\n\n`;

    it('with --help, a list of commands is printed', function() {
      const cli = spawnSync(relativePathToCli, ['--help']);

      cli.stdout.toString().should.equal(expected);
      cli.stderr.toString().should.equal('');
      cli.status.should.equal(zeroClean);
    });
  });
<commit_msg>Adjust unit test for cli output based on new package description<commit_after>'use strict';

const spawnSync = require('child_process').spawnSync;
const pkg = require('./../../package.json');
const figures = require('figures');

const relativePathToCli = './src/cli.js';

// Paths to config file and package.json fixtures
const fixturesPath = './tests/fixtures';
const validFixturesPath = `${fixturesPath}/valid`;
const validRcFile = `${validFixturesPath}/.npmpackagejsonlintrc.json`;
const validPkg = `${validFixturesPath}/package.json`;
const errorFixturesPath = `${fixturesPath}/errors`;
const errorPkg = `${errorFixturesPath}/package.json`;
const errorRcFile = `${errorFixturesPath}/.npmpackagejsonlintrc.json`;
const warningFixturesPath = `${fixturesPath}/warnings`;
const warningPkg = `${warningFixturesPath}/package.json`;
const warningRcFile = `${warningFixturesPath}/.npmpackagejsonlintrc.json`;
const errAndWarnsFixturesPath = `${fixturesPath}/errorsAndWarnings`;
const errorWarningPkg = `${errAndWarnsFixturesPath}/package.json`;
const errorWarningRcFile = `${errAndWarnsFixturesPath}/.npmpackagejsonlintrc.json`;
const configJsFileFixturesPath = `${fixturesPath}/configJavaScriptFile`;
const configJavaScriptFile = `${configJsFileFixturesPath}/npmpackagejsonlint.config.js`;
const configJavaScriptFilePkg = `${configJsFileFixturesPath}/package.json`;
const pkgJsonPropFixturePath = `${fixturesPath}/packageJsonProperty`;
const packageJsonPropertyPkg = `${pkgJsonPropFixturePath}/package.json`;
const invalidFixturesPath = `${fixturesPath}/invalidConfig`;
const invalidRcFile = `${invalidFixturesPath}/.npmpackagejsonlintrc.json`;
const invalidPkgJsonPropertyPkg = `${invalidFixturesPath}/package.json`;
const invalidConfigJsFile = `${invalidFixturesPath}/npmpackagejsonlint.config.json`;

// Exit codes
const zeroClean = 0;
const oneMissingTargets = 1;
const twoLintErrorsDetected = 2;
const threeRunTimeException = 3;

describe('cli Unit Tests', function() {
  context('when the help command is run', function() {
    const expected = `
  Configurable linter for package.json files.

  Usage
    $ npmPkgJsonLint <patterns>

  Options
    --quiet, -q Report errors only
    --noConfigFiles, -ncf Disables use of .npmpackagejsonlintrc.json files, npmpackagejsonlint.config.js files, and npmPackageJsonLintConfig object in package.json file.
    --configFile, -c File path of .npmpackagejsonlintrc.json

  Examples
    $ npmPkgJsonLint --version
    $ npmPkgJsonLint .
    $ npmPkgJsonLint ./packages
    $ npmPkgJsonLint ./package1 ./package2
    $ npmPkgJsonLint -c ./config/.npmpackagejsonlintrc.json .
    $ npmPkgJsonLint --configFile ./config/npmpackagejsonlint.config.json .
    $ npmPkgJsonLint -q .
    $ npmPkgJsonLint --quiet ./packages\n\n`;

    it('with --help, a list of commands is printed', function() {
      const cli = spawnSync(relativePathToCli, ['--help']);

      cli.stdout.toString().should.equal(expected);
      cli.stderr.toString().should.equal('');
      cli.status.should.equal(zeroClean);
    });
  });

{'fraction_non_alphanumeric': 0.12882927637025998, 'fraction_numerical': 0.001987083954297069, 'mean_word_length': 5.291666666666667, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4589406', 'n_tokens_mistral': 1946, 'n_tokens_neox': 1879, 'n_words': 381}