<commit_before>set(web_client_port 30001)

function(javascript_tests_init)
  add_test(
    NAME js_coverage_reset
    COMMAND "${PYTHON_EXECUTABLE}"
            "${PROJECT_SOURCE_DIR}/tests/js_coverage_tool.py"
            reset
            "${PROJECT_BINARY_DIR}/js_coverage"
  )
  add_test(
    NAME js_coverage_combine_report
    WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
    COMMAND "${PYTHON_EXECUTABLE}"
            "${PROJECT_SOURCE_DIR}/tests/js_coverage_tool.py"
            "--threshold=${JS_COVERAGE_MINIMUM_PASS}"
            "--source=${PROJECT_SOURCE_DIR}"
            combine_report
            "${PROJECT_BINARY_DIR}/js_coverage"
  )
endfunction()

function(add_javascript_style_test name input)
  set(working_dir "${PROJECT_SOURCE_DIR}/clients/web")
  if(NOT IS_ABSOLUTE ${input})
    set(input ${working_dir}/${input})
  endif()
  if(NOT EXISTS ${input})
    message(FATAL_ERROR "Failed to add javascript style tests."
                        "Directory '${input}' does not exist.")
  endif()
  add_test(
    NAME "jshint_${name}"
    COMMAND "${JSHINT_EXECUTABLE}" --config "${PROJECT_SOURCE_DIR}/tests/jshint.cfg" "${input}"
  )
  add_test(<commit_msg>add_javascript_style_test: Ensure .jshintignore is considered for plugins<commit_after>set(web_client_port 30001)

function(javascript_tests_init)
  add_test(
    NAME js_coverage_reset
    COMMAND "${PYTHON_EXECUTABLE}"
            "${PROJECT_SOURCE_DIR}/tests/js_coverage_tool.py"
            reset
            "${PROJECT_BINARY_DIR}/js_coverage"
  )
  add_test(
    NAME js_coverage_combine_report
    WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
    COMMAND "${PYTHON_EXECUTABLE}"
            "${PROJECT_SOURCE_DIR}/tests/js_coverage_tool.py"
            "--threshold=${JS_COVERAGE_MINIMUM_PASS}"
            "--source=${PROJECT_SOURCE_DIR}"
            combine_report
            "${PROJECT_BINARY_DIR}/js_coverage"
  )
endfunction()

function(add_javascript_style_test name input)
  set(working_dir "${PROJECT_SOURCE_DIR}/clients/web")
  if(NOT IS_ABSOLUTE ${input})
    set(input ${working_dir}/${input})
  endif()
  if(NOT EXISTS ${input})
    message(FATAL_ERROR "Failed to add javascript style tests."
                        "Directory '${input}' does not exist.")
  endif()
  add_test(
    NAME "jshint_${name}"
    WORKING_DIRECTORY ${input}
    COMMAND "${JSHINT_EXECUTABLE}" --config "${PROJECT_SOURCE_DIR}/tests/jshint.cfg" "${input}"
  )
  add_test(
{'fraction_non_alphanumeric': 0.12279260780287474, 'fraction_numerical': 0.004106776180698152, 'mean_word_length': 3.4615384615384617, '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': '4910145', 'n_tokens_mistral': 847, 'n_tokens_neox': 819, 'n_words': 127}