🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

esc-local

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esc-local

Run playwright on Docker container

latest
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

ESC-local

3Billion의 E2E 테스트 환경을 로컬에서 쉽게 구동할 수 있도록 도와주는 CLI 도구입니다. ESC 모듈 EC2 Fargate 인스턴스 환경과 동일한 테스트 환경을 Docker를 통해 구성하고 실행할 수 있습니다.

요구 사항

  • Docker
  • 사용하려는 프로젝트 내부에 playwright가 설치되어 있어야 합니다.
  • tests 디렉토리가 프로젝트의 루트에 있어야 합니다.

설치

npx install -g esc-local

Docker Image 빌드

Playwright 테스트가 설치된 프로젝트로 이동하여 다음 명령어를 실행합니다.

cd some-project
npx esc-local build

Docker Image 빌드 과정은 다음과 같습니다.

  • 프로젝트가 사용하는 Node.js 버전, 패키지 매니저(npm, pnpm, yarn) 확인
  • 프로젝트 설정에 따라 Dockerfile 생성
  • Docker Image 빌드

Test 실행

cd some-project
npx esc-local run-tests [options]

Options

  • --cpu <count>: 컨테이너에 할당할 CPU 코어 수 (기본값: 2)

  • --memory <size>: 컨테이너에 할당할 메모리 크기 (기본값: 4g)

  • 위 옵션 이 외에도, playwright의 기본 옵션은 모두 사용 가능합니다.

# firefox에서만 테스트를 하는 경우
npx esc-local run-tests --cpu --project=firefox

# trace 옵션을 키고 실행
npx esc-local run-tests --trace on

Docker Image 빌드 시간 단축

빌드 시간 단축을 위하여 tests디렉토리 내부에 test-dependencies.json을 따로 정의할 수 있습니다.

이 경우, 프로젝트 전체의 package.json을 참조하지 않고, test-dependencies.json을 참조하여 Image를 빌드하게 됩니다.

ex) some-project/tests/test-dependencies.json

{
  "@aws-sdk/client-secrets-manager": "^3.682.0",
  "@aws-sdk/credential-providers": "^3.685.0",
  "mailosaur": "^8.7.0"
}

AWS Credential

테스트 내부에서 AWS 서비스를 이용하는 경우가 종종 있습니다.

이 때문에 credential이 필요합니다.

Credential 정보는 컨테이너 실행 시 자동으로 volume mount됩니다.

디버깅

테스트시 trace 옵션을 지정하면 테스트 후 생성되는 html 리포트에서 실패하는 테스트에 대하여 디버깅을 할 수 있습니다.

npx esc-local run-tests --trace on

action tab in trace viewer

FAQs

Package last updated on 25 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts