본문으로 건너뛰기
Skillpedia
테스트40k · #7318

pester-migration

하는 일

이 도구는 새 버전의 PowerShell에 맞게 소프트웨어 테스트(Pester라고 부릅니다)를 업데이트하도록 돕습니다. 새 버전에서 올바르게 작동하도록 테스트 작성과 실행 방식을 조정합니다.

사용하는 경우

  • ✓개발 환경을 새 주요 PowerShell 버전으로 업데이트할 때.
  • ✓업데이트 후 기존 Pester 테스트가 작동하지 않을 때.
  • ✓소프트웨어 테스트가 최신 도구 버전과 맞도록 하고 싶을 때.

스킬 링크

https://github.com/github/awesome-copilot/blob/main/skills/pester-migration/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/pester-migration/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“Pester 테스트를 버전 4에서 버전 5로 업데이트해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 기존 테스트를 분석하고, 문법과 구조에 필요한 변경을 적용합니다. 각 버전 업데이트마다 정해진 가이드를 따라 변경이 올바르게 이루어지도록 합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Pester Migration

Pester is the test framework for PowerShell. Test files end in *.Tests.ps1 and use Describe / Context / It blocks with Should assertions. This skill upgrades an existing suite from one major Pester version to the next and gets it green again.

Mental model: each major jump has a different character. v3→v4 is mostly a syntax rename. v4→v5 is a fundamental runtime change (the Discovery/Run split) and is the hard one. v5→v6 is largely backwards-compatible — a handful of previously-deprecated things now throw. Migrate one major at a time; never skip a version.

Detailed, symptom-driven guides live in references/ — load the one(s) for the jump you are doing.

References

Reference When to load
v3-to-v4.md Should Be → Should -Be, Contain → FileContentMatch, Assert-VerifiableMocks → Assert-VerifiableMock, array-assertion edge cases.
v4-to-v5.md The big one. Discovery/Run phases, BeforeAll setup, $PSScriptRoot, BeforeDiscovery, -ForEach, mock scoping, Should -Throw wildcards, Invoke-Pester → New-PesterConfiguration.
v5-to-v6.md PowerShell 5.1/7.4+ only, per-file discovery+run, empty -ForEach throws, duplicate setup blocks throw, name <...> templates evaluate, Assert-MockCalled removed, mocks no longer fall through, code-coverage tracer, legacy Invoke-Pester params removed.

Canonical source: the official migration guides at https://pester.dev/docs/migrations/ — this skill mirrors them. When in doubt, prefer the website.

Step 0 — Detect where you are and where you're going

Find the installed version(s) and the version the tests were written for. These can differ.

# Installed Pester version(s) on this machine
Get-Module Pester -ListAvailable | Select-Object Name, Version, Path

# Version currently imported in the session
(Get-Module Pester).Version

Tell the source version from the test code with these heuristics:

You see in *.Tests.ps1 / build scripts Suite was written for
Should Be / Should Contain (no dash) v3 or earlier → start at v3-to-v4
$MyInvocation.MyCommand.Path + dot-source at the top of the file; arbitrary code directly under Describe v4 → v4-to-v5
Assert-MockCalled, Assert-VerifiableMock, Set-ItResult -Pending v4 / early-v5 (these are removed in v6)
Invoke-Pester -Script … -OutputFile … -CodeCoverage … (legacy params) v4 invocation → map to config
BeforeAll { . $PSScriptRoot/… }, New-PesterConfiguration, Should -Invoke already v5-style → v5-to-v6

Install the target version when ready:

# Latest stable v5 — pin the major to avoid installing Pester 6
Install-Module Pester -MaximumVersion 5.99.99 -Force

# Pester 6
Install-Module Pester -Force

On Windows PowerShell 5.1 the OS ships a Microsoft-signed built-in Pester 3 that PowerShellGet won't overwrite with the differently-signed newer Pester — add -SkipPublisherCheck there to install side-by-side. Not needed on PowerShell 7+. See https://pester.dev/docs/introduction/installation.

Migration workflow

Run this loop for each major jump. Do not jump two majors at once — go v4→v5, then v5→v6.

  1. Baseline. Run the suite on the current version first and record pass/fail. You need a known-good (or known) starting point so you can tell migration regressions apart from pre-existing failures.
    # Bare Invoke-Pester works on every major; exact parameters differ
    # (v3/v4: -Script/-OutputFile; v5+/v6: -Path/-Output).
    Invoke-Pester
    
  2. Read the reference for this jump (table above) so you know the full scope before editing.
  3. Edit file by file. Apply the mechanical changes (see per-jump cheat sheets below and in the reference). Keep changes small and reviewable — one file or one concern at a time.
  4. Switch versions with Install-Module (Step 0), then re-import: Remove-Module Pester; Import-Module Pester (or start a fresh session).
  5. Run and fix. Re-run with -Output Detailed; use -Output Diagnostic (v4→v5) or read the explicit v6 error messages to locate problems. Match each failure to the symptom → fix tables in the reference.

…

자주 묻는 질문

Pester는 무엇인가요?

PowerShell로 작성된 코드를 위한 자동화 테스트를 작성하는 프레임워크입니다. 코드가 기대대로 작동하는지 확인하도록 돕습니다.

Pester 테스트는 왜 업데이트해야 하나요?

다른 소프트웨어와 마찬가지로 Pester도 발전합니다. 새 버전은 이전 버전용 테스트와 맞지 않는 변경을 도입할 수 있습니다. 업데이트하면 테스트가 계속 작동하고 새 기능도 활용할 수 있습니다.

업데이트할 때 버전을 건너뛰어도 되나요?

권장하지 않습니다. 변경을 더 효과적으로 관리하고 복잡한 오류를 피하려면, 한 번에 주요 버전 하나씩 업데이트하는 것이 좋습니다(예: v3에서 v4로, 그다음 v4에서 v5로).

상세 정보

작성자의 원본 설명

Pester migration skill for upgrading PowerShell Pester test suites across major versions — v3→v4, v4→v5, and v5→v6. Covers the Discovery/Run two-phase model, moving setup into BeforeAll, $PSScriptRoot vs $MyInvocation, mock changes (Assert-MockCalled → Should -Invoke, removed fall-through), Invoke-Pester parameters → PesterConfiguration, data-driven -ForEach/-TestCases, and the v6 breaking changes

repo: github/awesome-copilot

인기도

GitHub 스타
40k
순위
#7318
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬