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, IVersionedNodeType,
KnownNodesAndCredentials, KnownNodesAndCredentials,
LoadedClass, LoadedClass,
LoadingDetails,
} from 'n8n-workflow'; } 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() @Service()
export class LoadNodesAndCredentials { export class LoadNodesAndCredentials {
private loader: LazyPackageDirectoryLoader; private loader: LazyPackageDirectoryLoader;
@@ -29,11 +36,13 @@ export class LoadNodesAndCredentials {
} }
getCredential(credentialType: string): LoadedClass<ICredentialType> { getCredential(credentialType: string): LoadedClass<ICredentialType> {
fixSourcePath(this.known.credentials[credentialType]);
return this.loader.getCredential(credentialType); return this.loader.getCredential(credentialType);
} }
getNode(fullNodeType: string): LoadedClass<INodeType | IVersionedNodeType> { getNode(fullNodeType: string): LoadedClass<INodeType | IVersionedNodeType> {
const nodeType = fullNodeType.split('.')[1]; const nodeType = fullNodeType.split('.')[1];
fixSourcePath(this.known.nodes[nodeType]);
return this.loader.getNode(nodeType); return this.loader.getNode(nodeType);
} }
} }