ocaml/dune

Ability to control the meaning of :standard dirs at workspace level.

Open

#3,271 opened on Mar 16, 2020

 (11 comments) (0 reactions) (0 assignees)OCaml (478 forks)github user discovery
enhancementgood first issue

Repository metrics

Stars
 (1,882 stars)
PR merge metrics
 (Avg merge 1d 20h) (345 merged PRs in 30d)

Description

Currently directories with leading underscores are ignored by dune by default, even in cases when specifying (include_subdirs unqualified). There is a pattern in the JS community with the most popular testing library (Jest), where developers put a directory called __tests__ right next to the code that it tests. That pattern doesn't translate to Dune because it ignores all directories with a leading underscore. There are ways around it, but there are some downsides to those workarounds.

  • Each dune file that has tests has to remember to include __tests__ in its (dirs).
  • (dirs) isn't respected when it is generated using the "include" or Tuareg mode features.

I might suggest it would be better if Dune was not so opinionated to ignore directories starting with underscore, but that's probably a more invasive breaking change.

Instead, could we allow projects to specify at the dune-project or dune-workspace level, the meaning of :standard dirs? For example, you could override the default definition of :standard. Right now standard is a regex [^_\.].*, but this could be overridden so be .* for this Jest style pattern.

Contributor guide