Skip to content

Commit f5d531c

Browse files
gdalleKristofferC
authored andcommitted
Improve docs for test-specific deps with workspace approach (#4490)
(cherry picked from commit ca5b089)
1 parent e6bf97e commit f5d531c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

docs/src/creating-packages.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,20 +297,28 @@ projects = ["test"]
297297
(HelloWorld) pkg> activate ./test
298298
[ Info: activating environment at `~/HelloWorld/test/Project.toml`.
299299
300-
(HelloWorld/test) pkg> add Test
300+
(HelloWorld/test) pkg> dev . # add current package to test dependencies using its path
301+
Resolving package versions...
302+
Updating `~/HelloWorld/test/Project.toml`
303+
[8dfed614] + HelloWorld v0.1.0 `..`
304+
305+
(HelloWorld/test) pkg> add Test # add other test dependencies
301306
Resolving package versions...
302307
Updating `~/HelloWorld/test/Project.toml`
303308
[8dfed614] + Test
304309
```
305310

306311
When using workspaces, the package manager resolves dependencies for all projects in the workspace together, and creates a single `Manifest.toml` next to the base `Project.toml`. This provides better dependency resolution and makes it easier to manage test-specific dependencies.
307312

313+
!!! warning
314+
Unlike some earlier test dependency workflows, this one explicitly requires adding `HelloWorld` (the parent package) to your `test/Project.toml`.
315+
308316
You can now use `Test` in the test script:
309317

310318
```julia-repl
311319
julia> write("test/runtests.jl",
312320
"""
313-
using Test
321+
using HelloWorld, Test
314322
@test 1 == 1
315323
""");
316324

0 commit comments

Comments
 (0)