diff options
| author | William Boman <william@redwill.se> | 2022-12-26 17:24:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-26 17:24:39 +0100 |
| commit | 5f6a3a30f40721bed47cc288c5516c8b2790103e (patch) | |
| tree | 58af65bec8c51b459839eb4243fc322d6d8b3fde /tests | |
| parent | feat(expr): add tbl_interpolate() (#805) (diff) | |
| download | mason-5f6a3a30f40721bed47cc288c5516c8b2790103e.tar mason-5f6a3a30f40721bed47cc288c5516c8b2790103e.tar.gz mason-5f6a3a30f40721bed47cc288c5516c8b2790103e.tar.bz2 mason-5f6a3a30f40721bed47cc288c5516c8b2790103e.tar.lz mason-5f6a3a30f40721bed47cc288c5516c8b2790103e.tar.xz mason-5f6a3a30f40721bed47cc288c5516c8b2790103e.tar.zst mason-5f6a3a30f40721bed47cc288c5516c8b2790103e.zip | |
refactor(installer): write debug log file after installation finishes (#806)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mason-core/installer/installer_spec.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/mason-core/installer/installer_spec.lua b/tests/mason-core/installer/installer_spec.lua index 421de34b..c9c44d24 100644 --- a/tests/mason-core/installer/installer_spec.lua +++ b/tests/mason-core/installer/installer_spec.lua @@ -1,3 +1,4 @@ +local stub = require "luassert.stub" local spy = require "luassert.spy" local match = require "luassert.match" local fs = require "mason-core.fs" @@ -111,4 +112,22 @@ describe("installer", function() assert.spy(capture).was_called_with(match.instanceof(InstallContext), "two", "three") end) ) + + it( + "should write log files if debug is true", + async_test(function() + spy.on(fs.async, "write_file") + local handle = InstallHandleGenerator "dummy" + stub(handle.package.spec, "install", function(ctx) + ctx.stdio_sink.stdout "Hello stdout!\n" + ctx.stdio_sink.stderr "Hello " + ctx.stdio_sink.stderr "stderr!" + ctx.receipt:with_primary_source { type = "unmanaged" } + end) + installer.execute(handle, { debug = true }) + assert + .spy(fs.async.write_file) + .was_called_with(path.package_prefix "dummy/mason-debug.log", "Hello stdout!\nHello stderr!") + end) + ) end) |
