          (coverage-enabled (equal (getenv "COVERAGE") "1"))
          (coverage-dir (getenv "COVERAGE_DIR"))
          (selector (if (member test-filter '(nil "")) t (read test-filter)))
+         (original-load-suffixes load-suffixes)
          (load-suffixes
           ;; Prefer source files when coverage is requested, as only those can
           ;; be instrumented.

    (insert ?\n)
    (buffer-substring-no-properties (point-min) (point-max))))

(defun elisp/ert/load--instrument (fullname file)
  "Load and instrument the Emacs Lisp file FULLNAME.
FILE is an abbreviated name as described in

          (if coverage-enabled
              (lambda (fullname file noerror _nomessage)
                (cond
                 ;; Note: ‘file-in-directory-p’ wouldn’t work here because
                 ;; Bazel runfiles are in fact symbolic links, and
                 ;; ‘file-in-directory-p’ resolves symbolic links.
                 ((elisp/ert/outside--tree-p fullname source-dir)
                  ;; File is from outside the Bazel tree, probably a built-in
                  ;; file.  Don’t try to instrument it, as that is unlikely to
                  ;; work.  Search for a corresponding compiled file instead.
                  ;; Since loading a built-in file can only ever load other
                  ;; built-in files, restore the original load suffixes.
                  (let ((load-suffixes original-load-suffixes))
                    (elisp/ert/load--compiled fullname file noerror)))
                 ((file-readable-p fullname)
                  (push (elisp/ert/load--instrument fullname file)
                        load-buffers)
