<commit_before>'use strict';

const path = require('path');
const execa = require('execa');
const internalIp = require('internal-ip');
const testBin = require('../helpers/test-bin');
const isWebpack5 = require('../helpers/isWebpack5');

describe('CLI', () => {
  const webpack4Test = isWebpack5 ? it.skip : it;
  const webpack5Test = isWebpack5 ? it : it.skip;

  webpack4Test('--hot webpack 4', (done) => {
    testBin('--hot')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).toContain('webpack/hot/dev-server.js');
        done();
      })
      .catch(done);
  });

  webpack4Test('--no-hot webpack 4', (done) => {
    testBin('--no-hot')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).not.toContain('webpack/hot/dev-server.js');
        done();
      })
      .catch(done);
  });

  webpack5Test('--hot webpack 5', (done) => {
    // need detailed stats to check for 'dev-server.js'
    testBin('--hot --stats=detailed')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).toContain('webpack/hot/dev-server.js');
        done();
      })
      .catch(done);
  });

  webpack5Test('--no-hot webpack 5', (done) => {
    testBin('--no-hot --stats=detailed')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).not.toContain('webpack/hot/dev-server.js');
        done();
      })
      .catch(done);
  });

  // TODO: do not skip after the major version is bumped
  // https://github.com/webpack/webpack-cli/commit/7c5a2bae49625ee4982d7478b7e741968731cea2
  it.skip('--hot-only', (done) => {
    testBin('--hot-only')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).toContain('/hot/only-dev-server');
        done();
      })
      .catch(done);
  });

  it('--bonjour', (done) => {
    testBin('--bonjour')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).toContain('Bonjour');
        done();
      })
      .catch(done);
  });

  it('--https', (done) => {
    testBin('--https')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).toContain('Project is running at');
        done();<commit_msg>test: enable --hot-only test case (#3018)<commit_after>'use strict';

const path = require('path');
const execa = require('execa');
const internalIp = require('internal-ip');
const testBin = require('../helpers/test-bin');
const isWebpack5 = require('../helpers/isWebpack5');

describe('CLI', () => {
  const webpack4Test = isWebpack5 ? it.skip : it;
  const webpack5Test = isWebpack5 ? it : it.skip;

  webpack4Test('--hot webpack 4', (done) => {
    testBin('--hot')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).toContain('webpack/hot/dev-server.js');
        done();
      })
      .catch(done);
  });

  webpack4Test('--no-hot webpack 4', (done) => {
    testBin('--no-hot')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).not.toContain('webpack/hot/dev-server.js');
        done();
      })
      .catch(done);
  });

  webpack5Test('--hot webpack 5', (done) => {
    // need detailed stats to check for 'dev-server.js'
    testBin('--hot --stats=detailed')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).toContain('webpack/hot/dev-server.js');
        done();
      })
      .catch(done);
  });

  webpack5Test('--no-hot webpack 5', (done) => {
    testBin('--no-hot --stats=detailed')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).not.toContain('webpack/hot/dev-server.js');
        done();
      })
      .catch(done);
  });

  it('--hot-only', (done) => {
    // need detailed stats to check for 'only-dev-server.js'
    testBin('--hot-only --stats detailed')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).toContain('/hot/only-dev-server');
        done();
      })
      .catch(done);
  });

  it('--bonjour', (done) => {
    testBin('--bonjour')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).toContain('Bonjour');
        done();
      })
      .catch(done);
  });

  it('--https', (done) => {
    testBin('--https')
      .then((output) => {
        expect(output.exitCode).toEqual(0);
        expect(output.stderr).toContain('Project is running at');
        done();
{'fraction_non_alphanumeric': 0.20451612903225808, 'fraction_numerical': 0.015698924731182794, 'mean_word_length': 2.5395738203957383, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, 'https://': 1, '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': '6919590', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1557, 'n_words': 230}