From 977baa4d42b6f0abf591e4a6fc0f3df1c46aad01 Mon Sep 17 00:00:00 2001 From: Erik Moura Date: Tue, 1 Apr 2025 03:17:05 -0300 Subject: [PATCH] test: add explicit imports for `jest` functions (#128) * test: add explicit imports for `jest` functions * add workaround for non-`.spec.ts` file --- test/asar-utils.spec.ts | 1 + test/file-utils.spec.ts | 1 + test/index.spec.ts | 1 + test/sha.spec.ts | 1 + test/util.ts | 2 ++ 5 files changed, 6 insertions(+) diff --git a/test/asar-utils.spec.ts b/test/asar-utils.spec.ts index 46ec71d..e2a0143 100644 --- a/test/asar-utils.spec.ts +++ b/test/asar-utils.spec.ts @@ -1,6 +1,7 @@ import * as path from 'path'; import { AsarMode, detectAsarMode, generateAsarIntegrity } from '../src/asar-utils'; +import { describe, expect, it } from '@jest/globals'; const asarsPath = path.resolve(__dirname, 'fixtures', 'asars'); const appsPath = path.resolve(__dirname, 'fixtures', 'apps'); diff --git a/test/file-utils.spec.ts b/test/file-utils.spec.ts index 38af5b8..b3978ea 100644 --- a/test/file-utils.spec.ts +++ b/test/file-utils.spec.ts @@ -1,6 +1,7 @@ import * as path from 'path'; import { AppFile, AppFileType, getAllAppFiles } from '../src/file-utils'; +import { beforeAll, describe, expect, it } from '@jest/globals'; const appsPath = path.resolve(__dirname, 'fixtures', 'apps'); diff --git a/test/index.spec.ts b/test/index.spec.ts index de0a7cb..ff1c88a 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -4,6 +4,7 @@ import * as path from 'path'; import { makeUniversalApp } from '../dist/cjs/index'; import { createTestApp, templateApp, VERIFY_APP_TIMEOUT, verifyApp } from './util'; import { createPackage, createPackageWithOptions } from '@electron/asar'; +import { afterEach, describe, expect, it } from '@jest/globals'; const appsPath = path.resolve(__dirname, 'fixtures', 'apps'); const appsOutPath = path.resolve(__dirname, 'fixtures', 'apps', 'out'); diff --git a/test/sha.spec.ts b/test/sha.spec.ts index 599e366..e6de90e 100644 --- a/test/sha.spec.ts +++ b/test/sha.spec.ts @@ -1,6 +1,7 @@ import * as path from 'path'; import { sha } from '../src/sha'; +import { describe, expect, it } from '@jest/globals'; describe('sha', () => { it('should correctly hash a file', async () => { diff --git a/test/util.ts b/test/util.ts index 1937317..64d9313 100644 --- a/test/util.ts +++ b/test/util.ts @@ -7,6 +7,8 @@ import plist from 'plist'; import * as fileUtils from '../dist/cjs/file-utils'; import { getRawHeader } from '@electron/asar'; +declare const expect: typeof import('@jest/globals').expect; + // We do a LOT of verifications in `verifyApp` 😅 // exec universal binary -> verify ALL asars -> verify ALL app dirs -> verify ALL asar integrity entries // plus some tests create fixtures at runtime