         (find-file file)
       (error "%s not found." file))))
 
+(defun possible-test-file-suffixes ()
+  (cons (concat js2r-test-suffix ".js")
+        '("Test.js" "_test.js" "-test.js")))
+
+(defun looks-like-test-file-name (file-name)
+  (_any (apply-partially 's-ends-with-p file-name)
+        (possible-test-file-suffixes)))
+
 (defun jump-to-source-file-other-window (arg)
   (interactive "P")
   (let ((file (guess-source-file)))

    (if (file-exists-p file) file nil)))

(defun test-file-name (suffix)
  (format "%s/%s%s.js" (chop-suffix "/" (guess-test-folder)) (test-file-name-stub) suffix))

(defun test-file-name-stub ()
  (chop-suffix ".js" (file-name-nondirectory (buffer-file-name))))

(defun guess-test-folder ()
  (let ((source-dir (file-name-directory (buffer-file-name))))

      (error "%s not found." file))))

(defun guess-test-file ()
  (when (looks-like-test-file-name (buffer-file-name))
    (error "Looks like you're already in the test file."))
  (or (test-file-that-exists "-test")
      (test-file-that-exists "_test")
      (test-file-that-exists "Test")
