Skip to content

Commit

Permalink
fix(emit): don't emit test files
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhduy1407 committed Dec 13, 2024
1 parent c88fc02 commit 1f5676b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/compiler/transpile/run-program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,18 @@ export const runTsProgram = async (
const typesOutputTarget = config.outputTargets.filter(isOutputTargetDistTypes);
const emittedDts: string[] = [];
const emitCallback: ts.WriteFileCallback = (emitFilePath, data, _w, _e, tsSourceFiles) => {
if (emitFilePath.endsWith('.js') || emitFilePath.endsWith('js.map')) {
updateModule(config, compilerCtx, buildCtx, tsSourceFiles[0], data, emitFilePath, tsTypeChecker, null);
} else if (
emitFilePath.endsWith('.e2e.d.ts') ||
emitFilePath.endsWith('.spec.d.ts') ||
emitFilePath === 'e2e.d.ts' ||
emitFilePath === 'spec.d.ts'
if (
emitFilePath.includes('e2e.') ||
emitFilePath.includes('spec.') ||
emitFilePath.endsWith('e2e.d.ts') ||
emitFilePath.endsWith('spec.d.ts')
) {
// we don't want to write these to disk!
return;
}

if (emitFilePath.endsWith('.js') || emitFilePath.endsWith('js.map')) {
updateModule(config, compilerCtx, buildCtx, tsSourceFiles[0], data, emitFilePath, tsTypeChecker, null);
} else if (emitFilePath.endsWith('.d.ts')) {
const srcDtsPath = normalizePath(tsSourceFiles[0].fileName);
const relativeEmitFilepath = getRelativeDts(config, srcDtsPath, emitFilePath);
Expand Down

0 comments on commit 1f5676b

Please sign in to comment.