From 67109bc4b2230dc1ac72d54058d11285dc26bd87 Mon Sep 17 00:00:00 2001
From: CrazyMax <crazy-max@users.noreply.github.com>
Date: Fri, 13 Jan 2023 13:23:43 +0100
Subject: [PATCH] test: move envs to jest config

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
---
 dev.Dockerfile |  4 ----
 jest.config.ts | 10 ++++++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/dev.Dockerfile b/dev.Dockerfile
index 2198d3a..35cb91e 100644
--- a/dev.Dockerfile
+++ b/dev.Dockerfile
@@ -66,10 +66,6 @@ FROM docker:${DOCKER_VERSION} as docker
 FROM docker/buildx-bin:${BUILDX_VERSION} as buildx
 
 FROM deps AS test
-ENV RUNNER_TEMP=/tmp/github_runner
-ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
-ENV GITHUB_REPOSITORY=docker/build-push-action
-ENV GITHUB_RUN_ID=123456789
 RUN --mount=type=bind,target=.,rw \
   --mount=type=cache,target=/src/node_modules \
   --mount=type=bind,from=docker,source=/usr/local/bin/docker,target=/usr/bin/docker \
diff --git a/jest.config.ts b/jest.config.ts
index 5630755..60d168a 100644
--- a/jest.config.ts
+++ b/jest.config.ts
@@ -1,5 +1,15 @@
+process.env = Object.assign({}, process.env, {
+  RUNNER_TEMP: '/tmp/github_runner',
+  RUNNER_TOOL_CACHE: '/tmp/github_tool_cache',
+  GITHUB_REPOSITORY: 'docker/build-push-action',
+  GITHUB_RUN_ID: '123456789'
+}) as {
+  [key: string]: string;
+};
+
 module.exports = {
   clearMocks: false,
+  testEnvironment: 'node',
   moduleFileExtensions: ['js', 'ts'],
   setupFiles: ['dotenv/config'],
   testMatch: ['**/*.test.ts'],