<commit_before>package org.scalajs.jsenv.test

import scala.concurrent.Await

import org.scalajs.io.VirtualBinaryFile
import org.scalajs.jsenv._

import org.junit.Assert._
import org.junit.Assume._
import org.junit.{Test, Before}

private[test] class RunTests(config: JSEnvSuiteConfig, withCom: Boolean) {
  private val kit = new TestKit(config, withCom)
  import kit._

  @Test
  def failureTest: Unit = {
    """
    var a = {};
    a.foo();
    """.fails()
  }

  @Test
  def syntaxErrorTest: Unit = {
    """
    {
    """.fails()
  }

  @Test // Failed in Phantom - #2053
  def utf8Test: Unit = {
    """
    console.log("\u1234");
    """ hasOutput "\u1234\n";
  }
<commit_msg>Backport exception tests from SeleniumJSEnv<commit_after>package org.scalajs.jsenv.test

import scala.concurrent.Await

import org.scalajs.io.VirtualBinaryFile
import org.scalajs.jsenv._

import org.junit.Assert._
import org.junit.Assume._
import org.junit.{Test, Before}

private[test] class RunTests(config: JSEnvSuiteConfig, withCom: Boolean) {
  private val kit = new TestKit(config, withCom)
  import kit._

  @Test
  def failureTest: Unit = {
    """
    var a = {};
    a.foo();
    """.fails()
  }

  @Test
  def syntaxErrorTest: Unit = {
    """
    {
    """.fails()
  }

  @Test
  def throwExceptionTest: Unit = {
    """
    throw 1;
    """.fails()
  }

  @Test
  def catchExceptionTest: Unit = {
    """
    try {
      throw "hello world";
    } catch (e) {
      console.log(e);
    }
    """ hasOutput "hello world\n"
  }

  @Test // Failed in Phantom - #2053
  def utf8Test: Unit = {
    """
    console.log("\u1234");
    """ hasOutput "\u1234\n";
  }

{'fraction_non_alphanumeric': 0.1487303506650544, 'fraction_numerical': 0.016324062877871828, 'mean_word_length': 2.7274774774774775, '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': '2497975', 'n_tokens_mistral': 623, 'n_tokens_neox': 590, 'n_words': 131}