test: add explicit imports for jest functions (#128)

* test: add explicit imports for `jest` functions

* add workaround for non-`.spec.ts` file
This commit is contained in:
Erik Moura
2025-04-01 03:17:05 -03:00
committed by GitHub
parent 2b67c905a6
commit 977baa4d42
5 changed files with 6 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
import * as path from 'path'; import * as path from 'path';
import { AsarMode, detectAsarMode, generateAsarIntegrity } from '../src/asar-utils'; import { AsarMode, detectAsarMode, generateAsarIntegrity } from '../src/asar-utils';
import { describe, expect, it } from '@jest/globals';
const asarsPath = path.resolve(__dirname, 'fixtures', 'asars'); const asarsPath = path.resolve(__dirname, 'fixtures', 'asars');
const appsPath = path.resolve(__dirname, 'fixtures', 'apps'); const appsPath = path.resolve(__dirname, 'fixtures', 'apps');

View File

@@ -1,6 +1,7 @@
import * as path from 'path'; import * as path from 'path';
import { AppFile, AppFileType, getAllAppFiles } from '../src/file-utils'; import { AppFile, AppFileType, getAllAppFiles } from '../src/file-utils';
import { beforeAll, describe, expect, it } from '@jest/globals';
const appsPath = path.resolve(__dirname, 'fixtures', 'apps'); const appsPath = path.resolve(__dirname, 'fixtures', 'apps');

View File

@@ -4,6 +4,7 @@ import * as path from 'path';
import { makeUniversalApp } from '../dist/cjs/index'; import { makeUniversalApp } from '../dist/cjs/index';
import { createTestApp, templateApp, VERIFY_APP_TIMEOUT, verifyApp } from './util'; import { createTestApp, templateApp, VERIFY_APP_TIMEOUT, verifyApp } from './util';
import { createPackage, createPackageWithOptions } from '@electron/asar'; import { createPackage, createPackageWithOptions } from '@electron/asar';
import { afterEach, describe, expect, it } from '@jest/globals';
const appsPath = path.resolve(__dirname, 'fixtures', 'apps'); const appsPath = path.resolve(__dirname, 'fixtures', 'apps');
const appsOutPath = path.resolve(__dirname, 'fixtures', 'apps', 'out'); const appsOutPath = path.resolve(__dirname, 'fixtures', 'apps', 'out');

View File

@@ -1,6 +1,7 @@
import * as path from 'path'; import * as path from 'path';
import { sha } from '../src/sha'; import { sha } from '../src/sha';
import { describe, expect, it } from '@jest/globals';
describe('sha', () => { describe('sha', () => {
it('should correctly hash a file', async () => { it('should correctly hash a file', async () => {

View File

@@ -7,6 +7,8 @@ import plist from 'plist';
import * as fileUtils from '../dist/cjs/file-utils'; import * as fileUtils from '../dist/cjs/file-utils';
import { getRawHeader } from '@electron/asar'; import { getRawHeader } from '@electron/asar';
declare const expect: typeof import('@jest/globals').expect;
// We do a LOT of verifications in `verifyApp` 😅 // We do a LOT of verifications in `verifyApp` 😅
// exec universal binary -> verify ALL asars -> verify ALL app dirs -> verify ALL asar integrity entries // exec universal binary -> verify ALL asars -> verify ALL app dirs -> verify ALL asar integrity entries
// plus some tests create fixtures at runtime // plus some tests create fixtures at runtime