<commit_before>/**
 Tests for adapter/mocha.src.js
 These tests are executed in browser.
 */

/* globals
 createMochaReporterConstructor,
 createMochaReporterNode,
 createMochaStartFn,
 createConfigObject,
 mochaConfig: true,
 formatError: true,
 processAssertionError: true,
 MockSocket: true,
 Emitter: true,
 sinon: true,
 expect: true,
 describe: true,
 beforeEach: true,
 afterEach: true,
 it: true
 */
describe('adapter mocha', function () {
  var Karma = window.__karma__.constructor
  var sandbox

  beforeEach(function () {
    sandbox = sinon.sandbox.create()
  })

  afterEach(function () {
    sandbox.restore()
  })

  describe('createMochaReporterConstructor', function () {
    beforeEach(function () {
      this.karma = new Karma(new MockSocket(), null, null, null, {search: ''})
      this.karma.config = {
        mocha: {
          reporter: 'html'
        }
      }

      sandbox.stub(window, 'createMochaReporterNode')
    })

    it('should take reporter from client config on debug page', function () {
      expect(createMochaReporterConstructor(this.karma, '/debug.html')).to.equal('html')
    })

    it('should create node for mocha reporter', function () {
      createMochaReporterConstructor(this.karma, '/debug.html')

      expect(createMochaReporterNode.called).to.equal(true)
    })

    it('should define console reporter if does not pass reporter in config', function () {
      this.karma.config.mocha.reporter = null

      expect(createMochaReporterConstructor(this.karma, '/debug.html')).not.to.equal(null)
    })
  })

  describe('reporter', function () {
    var runner, tc

    beforeEach(function () {
      tc = new Karma(new MockSocket(), null, null, null, {search: ''})
      runner = new Emitter()
      var reporter = new (createMochaReporterConstructor(tc))(runner) // eslint-disable-line
    })

    describe('start', function () {
      it('should report total number of specs', function () {
        runner.total = 12
        sandbox.spy(tc, 'info')

        runner.emit('start')
        expect(tc.info.getCall(0).args).to.deep.eq([{total: 12}])
      })<commit_msg>chore: Fix failing tests with Karma 1.1.x<commit_after>/**
 Tests for adapter/mocha.src.js
 These tests are executed in browser.
 */

/* globals
 createMochaReporterConstructor,
 createMochaReporterNode,
 createMochaStartFn,
 createConfigObject,
 mochaConfig: true,
 formatError: true,
 processAssertionError: true,
 MockSocket: true,
 Emitter: true,
 sinon: true,
 expect: true,
 describe: true,
 beforeEach: true,
 afterEach: true,
 it: true
 */
describe('adapter mocha', function () {
  var Karma = window.__karma__.constructor
  var sandbox

  beforeEach(function () {
    sandbox = sinon.sandbox.create()
  })

  afterEach(function () {
    sandbox.restore()
  })

  describe('createMochaReporterConstructor', function () {
    beforeEach(function () {
      this.karma = new Karma(function (method, args) { })
      this.karma.config = {
        mocha: {
          reporter: 'html'
        }
      }

      sandbox.stub(window, 'createMochaReporterNode')
    })

    it('should take reporter from client config on debug page', function () {
      expect(createMochaReporterConstructor(this.karma, '/debug.html')).to.equal('html')
    })

    it('should create node for mocha reporter', function () {
      createMochaReporterConstructor(this.karma, '/debug.html')

      expect(createMochaReporterNode.called).to.equal(true)
    })

    it('should define console reporter if does not pass reporter in config', function () {
      this.karma.config.mocha.reporter = null

      expect(createMochaReporterConstructor(this.karma, '/debug.html')).not.to.equal(null)
    })
  })

  describe('reporter', function () {
    var runner, tc

    beforeEach(function () {
      tc = new Karma(function (method, args) { })
      runner = new Emitter()
      var reporter = new (createMochaReporterConstructor(tc))(runner) // eslint-disable-line
    })

    describe('start', function () {
      it('should report total number of specs', function () {
        runner.total = 12
        sandbox.spy(tc, 'info')

        runner.emit('start')
        expect(tc.info.getCall(0).args).to.deep.eq([{total: 12}])
      })
{'fraction_non_alphanumeric': 0.13221381267738883, 'fraction_numerical': 0.002838221381267739, 'mean_word_length': 3.2588116817724067, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4585781', 'n_tokens_mistral': 1337, 'n_tokens_neox': 1277, 'n_words': 286}