We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b1075d6 commit 91ff4bdCopy full SHA for 91ff4bd
1 file changed
packages/typespec-ts/src/index.ts
@@ -390,7 +390,18 @@ export async function $onEmit(context: EmitContext) {
390
const shouldGenerateMetadata =
391
option.generateMetadata === true ||
392
(option.generateMetadata === undefined && !hasPackageFile);
393
- // TODO detect whether test folder exists. If yes generateTest should be false.
+ const existingTestFolderPath = join(
394
+ dpgContext.generationPathDetail?.metadataDir ?? "",
395
+ "test"
396
+ );
397
+ const hasTestFolder = await existsSync(existingTestFolderPath);
398
+ if (option.azureSdkForJs && option.generateTest === undefined) {
399
+ if (hasTestFolder) {
400
+ option.generateTest = false;
401
+ } else {
402
+ option.generateTest = true;
403
+ }
404
405
if (shouldGenerateMetadata) {
406
const commonBuilders = [
407
buildRollupConfig,
0 commit comments