samedi 1 août 2020

Directory structure of tests / unit-tests?

  1. Which directory structure do you prefer and why?
  2. Which one is the best practice or commonly preferred?
  3. Would you suggest other way?

Structure 1 (nearest location)

/src
  /__tests__
    module-a.spec.ts
    module-b.spec.tsx
  /module-c
    /__tests__
      module-c-1.spec.ts
      module-c-2.spec.ts
    module-c-1.ts
    module-c-2.ts
  /module-d
    /__tests__
      module-d-1.spec.tsx
      module-d-2.spec.tsx
    module-d-1.tsx
    module-d-2.tsx
  module-a.ts
  module-b.tsx

Structure 2 (complete isolation)

/src
  /__tests__
    module-a.spec.ts
    module-b.spec.tsx
    /module-c
      module-c-1.spec.ts
      module-c-2.spec.ts
    /module-d
      module-d-1.spec.tsx
      module-d-2.spec.tsx
  /module-c
    module-c-1.ts
    module-c-2.ts
  /module-d
    module-d-1.tsx
    module-d-2.tsx
  module-a.ts
  module-b.tsx

Aucun commentaire:

Enregistrer un commentaire