javascript - Jest --runTestsByPath iki veya daha fazla farklı yol


Testlerimi çalıştırmak için jest cli kullanıyorum. Jest'in, testlerimin nerede olduğunu belirtmek için kullandığım --runTestsByPath adında bir cli seçeneği var.

Birimde testlerim farklı dizinlerde depomda dağılmış durumda, ama hepsini tek bir komutla çalıştırmak istiyorum. Bir seçenek farklı jest komutlarını && ile birleştirmektir:

{
  "name": "node-project",
  "version": "0.0.0",
  "scripts": {
    "test": "jest --runTestsByPath ./__tests__/tests/over/here/*_test.ts && jest --runTestsByPath ./tests/over/__tests__/here/*_test.ts",
  },
  "devDependencies": {
    "jest": "24.8.0",
    "ts-jest": "24.0.2",
    "ts-node": "8.3.0",
    "typescript": "2.9.2"
  }
}

Ama sonra, hepsini tek bir jest komutundan çalıştırırken aldığım kapsama gibi işlevselliği kaybediyorum.

Merak ediyorum, çünkü bununla ilgili hiçbir yerde dokümantasyon yok ya da burada SO'da cevaplanmamış, --runTestsByPath'e iki veya daha fazla farklı yolu nasıl geçirebilirim?

Cevap #1

Birden fazla yolu jest'in --runTestsByPath komut satırı seçeneğine geçirebiliriz:

jest --runTestsByPath ./__tests__/tests/over/here/*_test.ts ./tests/over/__tests__/here/*_test.ts

İlgili makaleler