In this paper we derive a formula for the sample size of a nonparametric test based on weighted L2L2-Wasserstein distance with a known alternative. As an example we apply the formula to determine the sample size for a hypothesis testing from the Tukey’s contaminated distribution model. The reliability of the sample size formula is evaluated in terms of type I errors and the powers of the test. The Monte Carlo simulation results show that the test based on the weighted L2L2-Wasserstein distance performs equally well as the Anderson–Darling test and is superior to the Kolmogorov–Smirnov and the Cramer–von Mises tests.