<commit_before>import QUnit from 'qunit';
import { registerDeprecationHandler } from '@ember/debug';

let isRegistered = false;
let deprecations = new Set();
let expectedDeprecations = new Set();

// Ignore deprecations that are not caused by our own code, and which we cannot fix easily.
const ignoredDeprecations = [
  /Versions of modifier manager capabilities prior to 3\.22 have been deprecated/,
  /Usage of the Ember Global is deprecated./,
  /import .* directly from/,
];

export default function setupNoDeprecations({ beforeEach, afterEach }) {
  beforeEach(function () {
    deprecations.clear();
    expectedDeprecations.clear();
    if (!isRegistered) {
      registerDeprecationHandler((message, options, next) => {
        if (!ignoredDeprecations.some((regex) => message.match(regex))) {
          deprecations.add(message);
        }
        next(message, options);
      });
      isRegistered = true;
    }
  });<commit_msg>Temporarily silence `{{hash}}` helper deprecation<commit_after>import QUnit from 'qunit';
import { registerDeprecationHandler } from '@ember/debug';

let isRegistered = false;
let deprecations = new Set();
let expectedDeprecations = new Set();

// Ignore deprecations that are not caused by our own code, and which we cannot fix easily.
const ignoredDeprecations = [
  // @todo remove when we can land https://github.com/josemarluedke/ember-focus-trap/pull/34 here
  /Versions of modifier manager capabilities prior to 3\.22 have been deprecated/,
  /Usage of the Ember Global is deprecated./,
  /import .* directly from/,
  // @todo remove when we can land https://github.com/josemarluedke/ember-focus-trap/pull/35 here
  /Setting properties on objects generated by {{hash}} is deprecated/,
];

export default function setupNoDeprecations({ beforeEach, afterEach }) {
  beforeEach(function () {
    deprecations.clear();
    expectedDeprecations.clear();
    if (!isRegistered) {
      registerDeprecationHandler((message, options, next) => {
        if (!ignoredDeprecations.some((regex) => message.match(regex))) {
          deprecations.add(message);
        }
        next(message, options);
      });
      isRegistered = true;
    }
  });
{'fraction_non_alphanumeric': 0.11568358481938729, 'fraction_numerical': 0.004572473708276178, 'mean_word_length': 3.675213675213675, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '4611710', 'n_tokens_mistral': 635, 'n_tokens_neox': 614, 'n_words': 191}