github.com/web-platform-tests/wpt.fyi@v0.0.0-20240530210107-70cf978996f1/util/wct.sh (about)

     1  #!/bin/bash
     2  # wct.sh [true|false]
     3  # Run web component tests with or without Xvfb.
     4  
     5  set -ex
     6  
     7  USE_FRAME_BUFFER=$1
     8  
     9  function stop_xvfb() {
    10    if [ "$USE_FRAME_BUFFER" == "true" ]; then
    11      # It's fine if Xvfb has already exited.
    12      killall Xvfb || true
    13    fi
    14  }
    15  
    16  trap stop_xvfb EXIT SIGINT SIGTERM
    17  
    18  if [ "$USE_FRAME_BUFFER" == "true" ]; then
    19    export DISPLAY=:99
    20    (Xvfb :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset &)
    21  fi
    22  
    23  cd webapp
    24  if [ "$UID" == "0" ]; then
    25    # Used in .github/actions/make-in-docker/Dockerfile
    26    sudo -u browser npm test
    27  else
    28    npm test
    29  fi