Skip to content

fix!: remove global helpers (it,describe,...)#1261

Open
KuznetsovRoman wants to merge 1 commit into
testplane@9from
TESTPLANE-188.rm_global_types
Open

fix!: remove global helpers (it,describe,...)#1261
KuznetsovRoman wants to merge 1 commit into
testplane@9from
TESTPLANE-188.rm_global_types

Conversation

@KuznetsovRoman
Copy link
Copy Markdown
Member

No description provided.

@github-actions
Copy link
Copy Markdown

✅ Testplane E2E run succeed

Report

@github-actions
Copy link
Copy Markdown

✅ Testplane browser-env run succeed

Report

Comment thread src/index.ts
import type { TestDefinition, SuiteDefinition, TestHookDefinition } from "./test-reader/test-object/types";
export type { TestDefinition, SuiteDefinition, TestHookDefinition };

declare global {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we dont pollute global by default

Comment thread src/types/globals.ts
export type GlobalTestplaneType = GlobalHelper;
export type GlobalHermioneType = GlobalHelper;

export type TestplaneGlobals = {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, we have type of testplane-related globals to use

Comment thread src/globals.ts
Comment on lines +11 to +16
export const it: GlobalItType = (globalThis as unknown as TestplaneGlobals).it;
export const describe: GlobalDescribeType = (globalThis as unknown as TestplaneGlobals).describe;
export const beforeEach: GlobalBeforeEachType = (globalThis as unknown as TestplaneGlobals).beforeEach;
export const afterEach: GlobalAfterEachType = (globalThis as unknown as TestplaneGlobals).afterEach;
export const testplane: GlobalTestplaneType = (globalThis as unknown as TestplaneGlobals).testplane;
export const hermione: GlobalHermioneType = (globalThis as unknown as TestplaneGlobals).hermione;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Types of globals are exported instead of being declared

So user could type:

import {it, describe} from "testplane";

Also same exported types will be used in "@testplane/globals"

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 25, 2026

Open in StackBlitz

npm i https://pkg.pr.new/gemini-testing/testplane@1261

commit: 035a440

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant