From 4ce1543740afebc661200e9f3d13ae22ed41f301 Mon Sep 17 00:00:00 2001 From: David Hunt Date: Sun, 15 Dec 2024 11:02:08 +1300 Subject: [PATCH] feat: add "data" property to World interface and variable --- .changeset/mean-steaks-sin.md | 5 +++++ packages/main/src/world.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/mean-steaks-sin.md diff --git a/.changeset/mean-steaks-sin.md b/.changeset/mean-steaks-sin.md new file mode 100644 index 0000000..a6d2b5b --- /dev/null +++ b/.changeset/mean-steaks-sin.md @@ -0,0 +1,5 @@ +--- +"quickpickle": patch +--- + +added "data" property to World interface and variable diff --git a/packages/main/src/world.ts b/packages/main/src/world.ts index 7a8aed0..ddb692e 100644 --- a/packages/main/src/world.ts +++ b/packages/main/src/world.ts @@ -28,7 +28,8 @@ export interface QuickPickleWorldInterface { isComplete: boolean // (read only) whether the Scenario is on the last step config: QuickPickleConfig // (read only) configuration for QuickPickle worldConfig: QuickPickleConfig['worldConfig'] // (read only) configuration for the World - common: Common // Common data shared across tests in one Feature file --- USE SPARINGLY + data: {[key:string]:any} // Data limited to the current Scenario + common: Common // Common data shared across ALL tests in one Feature file --- USE SPARINGLY init: () => Promise // function called by QuickPickle when the world is created tagsMatch(tags: string[]): string[]|null // function to check if the Scenario tags match the given tags } @@ -39,6 +40,7 @@ export class QuickPickleWorld implements QuickPickleWorldInterface { info: QuickPickleWorldInterface['info'] common: QuickPickleWorldInterface['common'] context: TestContext + data = {} constructor(context:TestContext, info:InfoConstructor) { this.context = context this.common = info.common