From d93a22e64b0c6cb21eac52c09c4b2d06117ef50a Mon Sep 17 00:00:00 2001 From: Pierre Cavin Date: Sun, 29 Dec 2024 03:26:35 +0100 Subject: [PATCH] test: use toMatch instead of snapshots --- .../mix/__snapshots__/artifacts.spec.ts.snap | 90 ------------------- lib/modules/manager/mix/artifacts.spec.ts | 11 ++- 2 files changed, 8 insertions(+), 93 deletions(-) diff --git a/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap index 189207db4766b4..5f208c42a5a9fd 100644 --- a/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap @@ -100,93 +100,3 @@ exports[`modules/manager/mix/artifacts returns updated mix.lock 1`] = ` }, ] `; - -exports[`modules/manager/mix/artifacts returns updated mix.lock in subdir 1`] = ` -[ - { - "cmd": "docker ps --filter name=renovate_sidecar -aq", - "options": { - "encoding": "utf-8", - }, - }, - { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo/subdir" ghcr.io/containerbase/sidecar bash -l -c "install-tool erlang 25.0.0.0 && install-tool elixir 1.13.4 && mix deps.update plug"", - "options": { - "cwd": "/tmp/github/some/repo/subdir", - "encoding": "utf-8", - "env": { - "CONTAINERBASE_CACHE_DIR": "/tmp/cache/containerbase", - "HOME": "/home/user", - "HTTPS_PROXY": "https://example.com", - "HTTP_PROXY": "http://example.com", - "LANG": "en_US.UTF-8", - "LC_ALL": "en_US", - "NO_PROXY": "localhost", - "PATH": "/tmp/path", - }, - "maxBuffer": 10485760, - "timeout": 900000, - }, - }, -] -`; - -exports[`modules/manager/mix/artifacts returns updated mix.lock in umbrella project 1`] = ` -[ - { - "cmd": "docker ps --filter name=renovate_sidecar -aq", - "options": { - "encoding": "utf-8", - }, - }, - { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo/apps/foo" ghcr.io/containerbase/sidecar bash -l -c "install-tool erlang 25.0.0.0 && install-tool elixir 1.13.4 && mix deps.update plug"", - "options": { - "cwd": "/tmp/github/some/repo/apps/foo", - "encoding": "utf-8", - "env": { - "CONTAINERBASE_CACHE_DIR": "/tmp/cache/containerbase", - "HOME": "/home/user", - "HTTPS_PROXY": "https://example.com", - "HTTP_PROXY": "http://example.com", - "LANG": "en_US.UTF-8", - "LC_ALL": "en_US", - "NO_PROXY": "localhost", - "PATH": "/tmp/path", - }, - "maxBuffer": 10485760, - "timeout": 900000, - }, - }, -] -`; - -exports[`modules/manager/mix/artifacts supports lockFileMaintenance 1`] = ` -[ - { - "cmd": "docker ps --filter name=renovate_sidecar -aq", - "options": { - "encoding": "utf-8", - }, - }, - { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" ghcr.io/containerbase/sidecar bash -l -c "install-tool erlang 25.0.0.0 && install-tool elixir 1.13.4 && mix deps.get"", - "options": { - "cwd": "/tmp/github/some/repo", - "encoding": "utf-8", - "env": { - "CONTAINERBASE_CACHE_DIR": "/tmp/cache/containerbase", - "HOME": "/home/user", - "HTTPS_PROXY": "https://example.com", - "HTTP_PROXY": "http://example.com", - "LANG": "en_US.UTF-8", - "LC_ALL": "en_US", - "NO_PROXY": "localhost", - "PATH": "/tmp/path", - }, - "maxBuffer": 10485760, - "timeout": 900000, - }, - }, -] -`; diff --git a/lib/modules/manager/mix/artifacts.spec.ts b/lib/modules/manager/mix/artifacts.spec.ts index 16c3406a9cb859..22073ded664e61 100644 --- a/lib/modules/manager/mix/artifacts.spec.ts +++ b/lib/modules/manager/mix/artifacts.spec.ts @@ -320,7 +320,8 @@ describe('modules/manager/mix/artifacts', () => { }, }, ]); - expect(execSnapshots).toMatchSnapshot(); + expect(execSnapshots[1]?.cmd).toMatch('mix deps.update plug'); + expect(execSnapshots[1]?.options?.cwd).toBe('/tmp/github/some/repo/subdir'); }); it('returns updated mix.lock in umbrella project', async () => { @@ -360,7 +361,10 @@ describe('modules/manager/mix/artifacts', () => { }, }, ]); - expect(execSnapshots).toMatchSnapshot(); + expect(execSnapshots[1]?.cmd).toMatch('mix deps.update plug'); + expect(execSnapshots[1]?.options?.cwd).toBe( + '/tmp/github/some/repo/apps/foo', + ); }); it('supports lockFileMaintenance', async () => { @@ -398,7 +402,8 @@ describe('modules/manager/mix/artifacts', () => { }, }, ]); - expect(execSnapshots).toMatchSnapshot(); + expect(execSnapshots[1]?.cmd).toMatch('mix deps.get'); + expect(execSnapshots[1]?.options?.cwd).toBe('/tmp/github/some/repo'); }); it('lockFileMaintenance returns null if unchanged', async () => {