Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 1.12 KB

passing-arguments-to-your-test-files.md

File metadata and controls

38 lines (28 loc) · 1.12 KB

역자주

이 문서는 passing-arguments-to-your-test-files.md의 한국어 번역입니다. 이곳에서 AVA의 master 브랜치와 이 문서의 차이를 확인할 수 있습니다. (만약 차이가 없다면 문서가 최신 버전임을 의미합니다)


테스트 파일들에 인자(arguments) 넘겨주기

테스트 파일에 커맨드 라인 인자를 넘겨줄 수 있습니다.

-- argument terminator를 사용해, AVA의 인자와 당신의 인자를 분리하도록 하세요.

// test.js
import test from 'ava';

test('argv', t => {
	t.deepEqual(process.argv.slice(2), ['--hello', 'world']);
});
$ npx ava -- --hello world

만약 npm test 스크립트 내부에서, AVA를 호출하려고 하는 경우, 두 개의 -- argument terminators가 필요합니다.

{
	"scripts": {
		"test": "ava"
	}
}
$ npm test -- -- --hello world