Let $X_1, \cdots, X_n$ be a random sample in $\mathbb{R}^m$ from an unknown density $f(x)$. Recently Bickel and Breiman have introduced a goodness of fit test for this situation based on the empirical distribution function of the variables $W_i = \exp\{-ng(X_i)V(R_i)\}, i = 1, \cdots, n$, where $g(x)$ is the hypothesized density and $V(R_i)$ represents the volume of the nearest neighbor sphere centered at $X_i$. Under the null hypothesis $H : f(x) = g(x)$, the empirical process is asymptotically independent of $g$. In this paper a weighted version of the empirical process is shown to produce tests which are still (essentially) distribution-free under $H$ but in addition have asymptotic power against sequences of alternatives contiguous to $g$. The optimal weight function is obtained as a function of the particular sequence of alternatives chosen, and consistency behavior against fixed alternatives is determined. Monte Carlo results illustrate the power performance of the tests for various densities and weight functions.