ci: Fix code coverage for nodes-base (no-changelog) (#14319)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-04-01 15:03:14 +02:00
committed by GitHub
parent a245a5ca61
commit a31a55440a

View File

@@ -6,8 +6,15 @@ import type {
IVersionedNodeType,
KnownNodesAndCredentials,
LoadedClass,
LoadingDetails,
} from 'n8n-workflow';
/** This rewrites the nodes/credentials source path to load the typescript code instead of the compiled javascript code */
const fixSourcePath = (loadInfo: LoadingDetails) => {
if (!loadInfo) return;
loadInfo.sourcePath = loadInfo.sourcePath.replace(/^dist\//, './').replace(/\.js$/, '.ts');
};
@Service()
export class LoadNodesAndCredentials {
private loader: LazyPackageDirectoryLoader;
@@ -29,11 +36,13 @@ export class LoadNodesAndCredentials {
}
getCredential(credentialType: string): LoadedClass<ICredentialType> {
fixSourcePath(this.known.credentials[credentialType]);
return this.loader.getCredential(credentialType);
}
getNode(fullNodeType: string): LoadedClass<INodeType | IVersionedNodeType> {
const nodeType = fullNodeType.split('.')[1];
fixSourcePath(this.known.nodes[nodeType]);
return this.loader.getNode(nodeType);
}
}