diff --git a/src/hooks/scenario.ts b/src/hooks/scenario.ts index 4a365947..db5c0e31 100644 --- a/src/hooks/scenario.ts +++ b/src/hooks/scenario.ts @@ -9,10 +9,10 @@ import { TestInfo } from '@playwright/test'; import parseTagsExpression from '@cucumber/tag-expressions'; import { BddWorld } from '../run/bddWorld'; -import { KeyValue } from '../playwright/types'; +import { KeyValue, PlaywrightLocation } from '../playwright/types'; import { fixtureParameterNames } from '../playwright/fixtureParameterNames'; import { callWithTimeout } from '../utils'; -import { PlaywrightLocation, getLocationByOffset } from '../playwright/getLocationInFile'; +import { getLocationByOffset } from '../playwright/getLocationInFile'; import { runStepWithCustomLocation } from '../playwright/testTypeImpl'; type ScenarioHookOptions = { diff --git a/src/playwright/getLocationInFile.ts b/src/playwright/getLocationInFile.ts index 65053386..8f425e0f 100644 --- a/src/playwright/getLocationInFile.ts +++ b/src/playwright/getLocationInFile.ts @@ -1,12 +1,6 @@ import url from 'url'; import { requirePlaywrightModule } from './utils'; - -// cucumber has also Location type, but it does not contain file and column is optional. -export interface PlaywrightLocation { - file: string; - line: number; - column: number; -} +import { PlaywrightLocation } from './types'; /** * Finds first frame in the callstack that matches provided file. diff --git a/src/playwright/types.ts b/src/playwright/types.ts index 65ba2f8c..530c3510 100644 --- a/src/playwright/types.ts +++ b/src/playwright/types.ts @@ -12,7 +12,7 @@ import { TestType, } from '@playwright/test'; import { BddFixtures } from '../run/bddFixtures'; -import { TestResult } from '@playwright/test/reporter'; +import { TestResult, Location as PlaywrightLocation } from '@playwright/test/reporter'; export type KeyValue = { [key: string]: any }; @@ -33,3 +33,8 @@ export type CustomFixtures = Omit< >; export type PwAttachment = TestResult['attachments'][0]; + +// cucumber has also Location type, but: +// - it does not contain file +// - column is optional +export { PlaywrightLocation }; diff --git a/src/run/bddDataAttachment.ts b/src/run/bddDataAttachment.ts index a2563baa..90fc56e6 100644 --- a/src/run/bddDataAttachment.ts +++ b/src/run/bddDataAttachment.ts @@ -4,12 +4,11 @@ import { StepMatchArgumentsList } from '@cucumber/messages'; import { BddWorld } from './bddWorld'; import StepDefinition from '@cucumber/cucumber/lib/models/step_definition'; -import { PlaywrightLocation } from '../playwright/getLocationInFile'; import { createTestStep } from '../cucumber/createTestStep'; import { stringifyLocation } from '../utils'; import { TestMeta } from '../gen/testMeta'; import { TestResult } from '@playwright/test/reporter'; -import { PwAttachment } from '../playwright/types'; +import { PlaywrightLocation, PwAttachment } from '../playwright/types'; const BDD_DATA_ATTACHMENT_NAME = '__bddData';