In general I think the following would work, let $Y$ be a non-compact topological space in which there is a distinguished point $y_0$ such that for every point $y$, if $V$ is an open neighbourhood of $y$, then $y_0 \in V$. Moreover suppose this distinguished point $y_0$ has a decreasing sequence of open neighbourhoods $U_n$ such that $\cap U_n = \{y_0 \}$.
Suppose $f : X \rightarrow Y$ has a closed graph, $X \neq \emptyset$, and assume $f(X) \neq \{y_0 \}$. Then there is some point $x \in X$ such that $f(x) = y_1 \neq y_0$. Consider the constant sequence $x_n = x$ in $X$, which converges to $x$ in $X$.
Then clearly $f(x_n) \rightarrow y_1 = f(x)$ because the sequence is constantly equal to $y_1 = f(x)$. But if $V$ is any open neighbourhood of $y_1$, then $y_0 \in V$, hence $f(x_n) \rightarrow y_0$ as well.
But by construction, $x_n \rightarrow x$ and $f$ has a closed graph, so we must have $f(x) = y_1$ and $f(x) = y_0$ which is absurd because $y_1 \neq y_0$, therefore if $f$ is not the constant function $X \rightarrow y_0$, $f$ does not have a closed graph (unless it is the empty function).
Now since the constant function $X \rightarrow y_0$ is continuous (as is the empty function), the space $Y$ satisfies the condition 'For all $f \in Y^{X}$, if $\mathcal{G}(f) \subset X \times Y$ is closed then $f \in C(X,Y)$' for all topological spaces $X$, and it does so in a non-vacuous way because the constant function $X \rightarrow y_0$ does have a closed graph, since because $\cap U_n = \{y_0 \}$, any net $f(x_{\alpha}) = y_0$ can only converge to $y_0$, since for any point $y \neq y_0$, there is some open neighbourhood of $y_0$ in which $y$ is not contained, so the only (non-empty) function for which the closed graph property holds is the constant function $X \rightarrow y_0$, and this function is continuous.
So it would suffice to construct a space that is a candidate for $Y$.
One example I think works as a candidate is the following space:
Let $Y = (0,1]$ as a set, and let $\tau_{(0,1]}$ be the topology generated by the left half-open intervals $(a,1]$ where $a \in (0,1]$, i.e. the open sets consist of the whole space, the empty set, and all left half open intervals $(a,1]$.
This space is non-compact, since $(\frac{1}{n},1] , n \geq 2$ is an open cover, but any finite subcover omits a euclidean neighbourhood of $0$.
Moreover for any point $a \neq 1$, any open neighbourhood of $a$ must be of the form $(b,1]$ with $0 < b < a$, so that $1$ is contained in every open neighbourhood of a point $a \neq 1$.
Finally setting $U_n = (1 - \frac{1}{n},1]$, which are each open neighbourhoods of $1$, we have that $\bigcap_{n \geq 1} U_n = \{1 \}$, so $((0,1],\tau_{(0,1]})$ is a candidate for $(Y,\tau_{Y})$.