spago publish reports used test dependencies as unused when setting pedanticPackages

Open
#1,428 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Domain
build-system

Research direction

Start by tracing the publish path where hasTests is set to false and how package.test.pedanticPackages is checked; the issue does not name specific files or tests. Reproduce with the listed commands on the v6.0.1 tag of purescript-unsafe-coerce. Done when publishing checks production dependencies without flagging the excluded test dependencies, while normal builds and tests still check both.

Written by the indexing model from the issue text.

Description

I found this while releasing unsafe-coerce with Spago 1.0.5 — that library has no production dependencies, but its tests use console, effect, and prelude, with package.test.pedanticPackages: true. Both spago build and spago test pass, but spago publish fails:

Tests for package 'unsafe-coerce' declare unused dependencies - please remove them from the project config:
  - console
  - effect
  - prelude

You can reproduce this from the v6.0.1 tag of purescript/purescript-unsafe-coerce, using Spago 1.0.5:

npm install
npx spago build
npx spago test
npx spago publish --offline

Publishing excludes test sources by setting hasTests to false, but the build still checks test dependencies because package.test.pedanticPackages is enabled. With no test imports in the source graph, it then incorrectly reports every test dependency as unused. Instead, IMO publishing should check production dependencies without checking dependencies of tests it deliberately excluded. Normal builds and tests should continue checking both.

Dominant language
PureScript
Stars
829
Forks
138
Avg merge
1d 10h
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from purescript/spago

All issues in purescript/spago

Similar issues

More Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.