<commit_before>//= require 'vendors/prism.js'

(function(window, document) {
  class Test {
    constructor(element) {
      window.addEventListener('message', this.received.bind(this), false);
    }

    received(message) {
      document.querySelector('section.result pre.actual > code').textContent = this.readableOutput(message.data.actual)
      document.querySelector('section.result pre.expected > code').textContent = this.readableOutput(message.data.expected)
      var container = document.querySelector('#Test section.result')
      var header = container.querySelector('header')
      var code = container.querySelector('pre.real > code')
      var pres = container.querySelectorAll('pre')

      if (message.data.status == 'error') {

        header.classList.add('error')<commit_msg>Be able to handle iframe error when showing a single test<commit_after>//= require 'vendors/prism.js'

(function(window, document) {
  class Test {
    constructor(element) {
      window.addEventListener('message', this.received.bind(this), false);
      var iframe = document.querySelector('iframe')
      iframe.contentWindow.addEventListener('error', this.failed.bind(this, iframe))
    }

    failed(iframe, event) {

      var container = document.querySelector('#Test section.result')
      var header = container.querySelector('header')
      header.classList.add('error')
      header.querySelector('div.status').textContent = "❌"
      header.querySelector('div.message').textContent = event.message

      container.querySelector('pre.actual > code').textContent = this.readableOutput(iframe.contentWindow.document.body.innerHTML)
      container.querySelector('pre.expected').remove()
    }

    received(message) {
      document.querySelector('section.result pre.actual > code').textContent = this.readableOutput(message.data.actual)
      document.querySelector('section.result pre.expected > code').textContent = this.readableOutput(message.data.expected)
      var container = document.querySelector('#Test section.result')
      var header = container.querySelector('header')
      var code = container.querySelector('pre.real > code')
      var pres = container.querySelectorAll('pre')

      if (message.data.status == 'error') {

        header.classList.add('error')
{'fraction_non_alphanumeric': 0.13304157549234136, 'fraction_numerical': 0.0, 'mean_word_length': 4.046357615894039, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '2871209', 'n_tokens_mistral': 602, 'n_tokens_neox': 601, 'n_words': 109}