mix ymer_node.consumer_check (Ymer Node v0.5.0)

Copy Markdown View Source

Proves the way a script author's own repository takes the node: a project depending on this checkout under runtime: false, where none of the node's applications start, tests a script through YmerNode.Script.Test and starts the run tree through YmerNode.Script.Harness.

Usage

mix ymer_node.consumer_check

No options and no arguments. The node's own suite cannot prove this: it boots the node's application, so the run tree is up in every test there, and a setup that starts it raises instead — start_supervised!/1 fails loudly on the collision rather than returning a value.

What it runs

The fixture project is committed under consumer_check/ — its configuration, its tests, and one script that declares a throttle and a secret — and every run copies it fresh into _build/consumer_check/project, beside a mix.exs this task writes: the node by path under runtime: false, and Req for runtime, the shape a consumer's own project takes. The mix.exs is written here rather than committed, so the only project file in the repository that carries a version is the node's own.

The copy takes this checkout's mix.lock, so it resolves to exactly the versions the node is built with, and reads its dependencies from this checkout's deps/ (MIX_DEPS_PATH): once mix deps.get has run here, the fixture's own deps.get downloads no package, though it still resolves against the hex registry. It builds under _build/consumer_check/build (MIX_BUILD_ROOT), so the node it compiles is its own and never this checkout's build.

The fixture's mix runs on the Elixir and Erlang this task runs on — their bin directories lead its PATH — so it never depends on how the shell resolves a toolchain for a directory with no configuration of its own. MIX_TEST_PARTITION is unset for it, so its tests read the unpartitioned names under its own tmp/.

Not part of mix precommit: a run compiles the node and every dependency into the fixture's build, about twenty seconds on a first run.

The module is wrapped in if Mix.env() in [:dev, :test], like mix ymer_node.build, so a consumer's build of the node — dependencies compile under :prod — never contains it.