Skip to content

Commit

Permalink
Show proper error when a @QuarkusTest is run from a non-Quarkus proje…
Browse files Browse the repository at this point in the history
…ct dir

This change fixes the (not uncommon) case where the IDE picks the wrong
working directory to launch the tests.
Without this PR, Quarkus throws a totally un-actionable message
regarding SmallRye Config's inability to expand the platform
properties

Fixes: #18132

Co-authored-by: Alexey Loubyansky <[email protected]>
  • Loading branch information
geoand and aloubyansky committed Jun 28, 2021
1 parent 9ce4a09 commit 9091ef3
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ private ExtensionState doJavaStart(ExtensionContext context, Class<? extends Qua
.bootstrap();
}

if (curatedApplication.getAppModel().getUserDependencies().isEmpty()) {
throw new RuntimeException(
"The tests were run against a directory that does not contain a Quarkus project. Please ensure that the test is configured to use the proper working directory.");
}

Index testClassesIndex = TestClassIndexer.indexTestClasses(requiredTestClass);
// we need to write the Index to make it reusable from other parts of the testing infrastructure that run in different ClassLoaders
TestClassIndexer.writeIndex(testClassesIndex, requiredTestClass);
Expand Down

0 comments on commit 9091ef3

Please sign in to comment.