From bfc1f4d55d02553f761fbc9acc5ed15103455149 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 27 Jan 2022 18:26:21 +0100 Subject: build: Add test-utils package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added as a common devDependency, this lets us handle test utility code from one place. For now, the main reason for its existence is the workaround code for importing jest-each from ESM. Signed-off-by: Kristóf Marussy --- packages/main/package.json | 2 +- .../resources/impl/__tests__/getDistResources.spec.ts | 6 +----- packages/main/tsconfig.json | 3 +++ 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'packages/main') diff --git a/packages/main/package.json b/packages/main/package.json index ea10b84..4f4a6cb 100644 --- a/packages/main/package.json +++ b/packages/main/package.json @@ -27,6 +27,7 @@ }, "devDependencies": { "@jest/globals": "^27.4.6", + "@sophie/test-utils": "workspace:*", "@types/deep-equal": "^1.0.1", "@types/electron-devtools-installer": "^2.2.1", "@types/lodash-es": "^4.17.5", @@ -38,7 +39,6 @@ "esbuild": "^0.14.14", "git-repo-info": "^2.1.1", "jest": "^27.4.7", - "jest-each": "^27.4.6", "jest-mock": "^27.4.6", "source-map-support": "^0.5.21" } diff --git a/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts b/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts index d045e54..e7e9d71 100644 --- a/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts +++ b/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts @@ -20,15 +20,11 @@ import os from 'node:os'; -import eachModule from 'jest-each'; +import { each } from '@sophie/test-utils'; import Resources from '../../Resources'; import getDistResources from '../getDistResources'; -// Workaround for jest ESM loader incorrectly wrapping the import in another layer of `default`. -const each = - (eachModule as Partial).default ?? eachModule; - const defaultDevServerURL = 'http://localhost:3000/'; const [ diff --git a/packages/main/tsconfig.json b/packages/main/tsconfig.json index dad597d..e18e7d3 100644 --- a/packages/main/tsconfig.json +++ b/packages/main/tsconfig.json @@ -10,6 +10,9 @@ }, { "path": "../shared/tsconfig.build.json" + }, + { + "path": "../test-utils/tsconfig.build.json" } ], "include": [ -- cgit v1.2.3-54-g00ecf