Cucumber-js: v7μ—μ„œ 더 이상 μ‹œλ‚˜λ¦¬μ˜€λ₯Ό κ±΄λ„ˆλ›Έ 수 μ—†μŠ΅λ‹ˆλ‹€.

에 λ§Œλ“  2021λ…„ 01μ›” 01일  Β·  3μ½”λ©˜νŠΈ  Β·  좜처: cucumber/cucumber-js

V6μ—μ„œλŠ” μ‹œλ‚˜λ¦¬μ˜€λ₯Ό κ±΄λ„ˆλ›°κΈ° μœ„ν•΄ Before each μ‹œλ‚˜λ¦¬μ˜€ 후크λ₯Ό μ‚¬μš©ν–ˆμŠ΅λ‹ˆλ‹€.

Before({ tags: '<strong i="6">@ignore</strong>' }, async function () {
  return 'skipped';
});

이 λ™μΌν•œ μ½”λ“œλŠ” typescriptλ₯Ό μ‚¬μš©ν•˜λŠ” v7μ—μ„œ 더 이상 μ»΄νŒŒμΌλ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

error TS2769: No overload matches this call.
  Overload 1 of 3, '(tags: string, code: TestCaseHookFunction): void', gave the following error.
    Argument of type '{ tags: string; }' is not assignable to parameter of type 'string'.
  Overload 2 of 3, '(options: IDefineTestCaseHookOptions, code: TestCaseHookFunction): void', gave the following error.
    Argument of type '(this: CustomWorld) => Promise<string>' is not assignable to parameter of type 'TestCaseHookFunction'.
      Type '(this: CustomWorld) => Promise<string>' is not assignable to type 'TestCaseHookFunctionWithoutParameter'.
        Type 'Promise<string>' is not assignable to type 'void | Promise<void>'.
          Type 'Promise<string>' is not assignable to type 'Promise<void>'.

v7μ—μ„œ μ‹œλ‚˜λ¦¬μ˜€λ₯Ό κ±΄λ„ˆλ›°λŠ” μ˜¬λ°”λ₯Έ 방법은 λ¬΄μ—‡μž…λ‹ˆκΉŒ?

감사 ν•΄μš”

bug since-7

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

Serenity/JS 에 Cucumber v7에 λŒ€ν•œ 지원을 μΆ”κ°€ν•˜λŠ” λ™μ•ˆ λ˜‘κ°™μ€ λ¬Έμ œκ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.

v6μ—μ„œ μ‚¬μš©ν–ˆλ˜ 것과 λ˜‘κ°™μ€ λ°©μ‹μœΌλ‘œ μž‘λ™ν•˜λŠ” μ‹€μ œ κΈ°λŠ₯λ³΄λ‹€λŠ” μœ ν˜• μ •μ˜μ˜ 문제인 것 κ°™μŠ΅λ‹ˆλ‹€.

@charlierudolph / @davidjgoss , μ•„λž˜ 제 생각이 λ§žλŠ”μ§€ 확인해 μ£Όμ‹œκ² μŠ΅λ‹ˆκΉŒ?

support_code_library_builder/types.ts μ—λŠ” λ‹€μŒκ³Ό 같은 μ •μ˜κ°€ μžˆμŠ΅λ‹ˆλ‹€.

export type TestCaseHookFunctionWithoutParameter = () => void | Promise<void>
export type TestCaseHookFunctionWithParameter = (
  arg: ITestCaseHookParameter
) => void | Promise<void>

CucumberλŠ” 후크가 void , string of 'skipped' λ˜λŠ” 'pending' λ˜λŠ” ν•΄λ‹Ή κ²°κ³Ό 쀑 ν•˜λ‚˜λ₯Ό ν¬ν•¨ν•˜λŠ” Promise λ₯Ό λ°˜ν™˜ν•˜λ„λ‘ ν—ˆμš©ν•©λ‹ˆλ‹€. , κ°œμ„ λœ κ΅¬ν˜„μ€ λ‹€μŒκ³Ό 같이 보일 수 μžˆμŠ΅λ‹ˆλ‹€.

export type TestCaseHookFunctionResult = 'skipped' | 'pending' | void
export type TestCaseHookFunctionWithoutParameter = () => TestCaseHookFunctionResult | Promise<TestCaseHookFunctionResult>
export type TestCaseHookFunctionWithParameter = (
  arg: ITestCaseHookParameter
) => TestCaseHookFunctionResult | Promise<TestCaseHookFunctionResult>

이와 μœ μ‚¬ν•œ λ³€κ²½ 사항이 λ„μž…λ  λ•ŒκΉŒμ§€ 이 λ¬Έμ œμ— λŒ€ν•œ ν•΄κ²° 방법은 λ‹€μŒκ³Ό 같이 ν…ŒμŠ€νŠΈ 후크λ₯Ό μ§€μ •ν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€.

import { Before } from '@cucumber/cucumber';

Before({ tags: '<strong i="25">@ignore</strong>' }, function () {
    return 'skipped' as any;
});

λͺ¨λ“  3 λŒ“κΈ€

Serenity/JS 에 Cucumber v7에 λŒ€ν•œ 지원을 μΆ”κ°€ν•˜λŠ” λ™μ•ˆ λ˜‘κ°™μ€ λ¬Έμ œκ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.

v6μ—μ„œ μ‚¬μš©ν–ˆλ˜ 것과 λ˜‘κ°™μ€ λ°©μ‹μœΌλ‘œ μž‘λ™ν•˜λŠ” μ‹€μ œ κΈ°λŠ₯λ³΄λ‹€λŠ” μœ ν˜• μ •μ˜μ˜ 문제인 것 κ°™μŠ΅λ‹ˆλ‹€.

@charlierudolph / @davidjgoss , μ•„λž˜ 제 생각이 λ§žλŠ”μ§€ 확인해 μ£Όμ‹œκ² μŠ΅λ‹ˆκΉŒ?

support_code_library_builder/types.ts μ—λŠ” λ‹€μŒκ³Ό 같은 μ •μ˜κ°€ μžˆμŠ΅λ‹ˆλ‹€.

export type TestCaseHookFunctionWithoutParameter = () => void | Promise<void>
export type TestCaseHookFunctionWithParameter = (
  arg: ITestCaseHookParameter
) => void | Promise<void>

CucumberλŠ” 후크가 void , string of 'skipped' λ˜λŠ” 'pending' λ˜λŠ” ν•΄λ‹Ή κ²°κ³Ό 쀑 ν•˜λ‚˜λ₯Ό ν¬ν•¨ν•˜λŠ” Promise λ₯Ό λ°˜ν™˜ν•˜λ„λ‘ ν—ˆμš©ν•©λ‹ˆλ‹€. , κ°œμ„ λœ κ΅¬ν˜„μ€ λ‹€μŒκ³Ό 같이 보일 수 μžˆμŠ΅λ‹ˆλ‹€.

export type TestCaseHookFunctionResult = 'skipped' | 'pending' | void
export type TestCaseHookFunctionWithoutParameter = () => TestCaseHookFunctionResult | Promise<TestCaseHookFunctionResult>
export type TestCaseHookFunctionWithParameter = (
  arg: ITestCaseHookParameter
) => TestCaseHookFunctionResult | Promise<TestCaseHookFunctionResult>

이와 μœ μ‚¬ν•œ λ³€κ²½ 사항이 λ„μž…λ  λ•ŒκΉŒμ§€ 이 λ¬Έμ œμ— λŒ€ν•œ ν•΄κ²° 방법은 λ‹€μŒκ³Ό 같이 ν…ŒμŠ€νŠΈ 후크λ₯Ό μ§€μ •ν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€.

import { Before } from '@cucumber/cucumber';

Before({ tags: '<strong i="25">@ignore</strong>' }, function () {
    return 'skipped' as any;
});

μ•ˆλ…•ν•˜μ„Έμš” @jan-molakλ‹˜, ν”Όλ“œλ°± μ£Όμ…”μ„œ κ°μ‚¬ν•©λ‹ˆλ‹€. ν•΄κ²° 방법이 μ™„λ²½ν•˜κ²Œ μž‘λ™ν•©λ‹ˆλ‹€!

@jan-molak ν•΄κ²° 방법에 κ°μ‚¬λ“œλ¦½λ‹ˆλ‹€. 곧 이 문제λ₯Ό μ‚΄νŽ΄λ³΄κ² μŠ΅λ‹ˆλ‹€.

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰