Skip to content

A fresh clone's tests fail until the lexicons are generated, and the failures do not say so #1419

Closed

Description

@lex00

A fresh clone of chant cannot run its own tests until the generated lexicon output exists, and the failures do not say so.

What happens

$ git clone https://github.com/INTENTIUS/chant && cd chant && npm install
$ npx vitest run lexicons/aws/src
Test Files  6 failed | 95 passed (101)
     → Cannot find module '/…/lexicons/aws/dist/meta.json'

$ npx vitest run lexicons/k8s/src/lifecycle-integration.test.ts
Tests  7 failed | 12 passed (19)
     → expected undefined to be 'K8s::Apps::Deployment'

Neither message names the cause. Cannot find module … meta.json at least points somewhere; the k8s ones are ordinary assertion failures against a lexicon whose generated types are absent, which reads as a broken test rather than a missing build step.

The fix in both cases is npm run generate && npm run bundle in the lexicon directory. prepack runs both, so a published package is fine and only a working copy is affected — which is exactly the case a new contributor is in.

Why it is worth fixing rather than documenting

I hit this twice in one session, on two different lexicons, and both times spent a minute deciding whether I had broken something. The second time I only recognised it because of the first. Someone arriving without that context reasonably concludes the suite is red on main.

Options

  • A pretest that generates when the output is missing. Costs a check per run and nothing else; the generate step is cached after the first.
  • A guard in the test setup that fails with one clear line — "run npm run generate in lexicons/ first" — instead of eleven assertion failures.
  • just bootstrap or equivalent, named in CONTRIBUTING, if the preference is to keep the test command dumb.

The second is the smallest and probably enough. What matters is that the failure names its cause; which mechanism does that is a taste call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area:dxbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions