Browse Source

fix: don't include spec files when loading job/event files

Kristian Vos 9 months ago
parent
commit
ce7d0b41d9
2 changed files with 4 additions and 0 deletions
  1. 2 0
      backend/src/BaseModule.ts
  2. 2 0
      backend/src/modules/DataModule.ts

+ 2 - 0
backend/src/BaseModule.ts

@@ -100,6 +100,7 @@ export default abstract class BaseModule {
 		}
 
 		await forEachIn(jobs, async jobFile => {
+			if (jobFile.includes(".spec.")) return;
 			const { default: Job } = await import(
 				`./modules/${this.constructor.name}/jobs/${jobFile}`
 			);
@@ -169,6 +170,7 @@ export default abstract class BaseModule {
 		}
 
 		await forEachIn(events, async eventFile => {
+			if (eventFile.includes(".spec.")) return;
 			const { default: EventClass } = await import(
 				`./modules/${this.constructor.name}/events/${eventFile}`
 			);

+ 2 - 0
backend/src/modules/DataModule.ts

@@ -361,6 +361,8 @@ export class DataModule extends BaseModule {
 			}
 
 			await forEachIn(jobs, async jobFile => {
+				if (jobFile.includes(".spec.")) return;
+
 				const { default: Job } = await import(
 					`./${this.constructor.name}/models/${modelName}/jobs/${jobFile}`
 				);