def _is_spec_file(file):
    """Gets whether the given file is a spec file."""
    basename = file.basename

    # External files (from other workspaces) should never run as specs.
    if (file.short_path.startswith("../")):
        return False

    # `spec.js` or `spec.mjs` files will be imported in the entry-point.
    return basename.endswith("spec.js") or basename.endswith("spec.mjs")