Skip to content

Commit 7c0ad6c

Browse files
authored
test: giving steroids to the test suite 💪 (#122)
* purely test suite on steroids * verify stuff * more fun verifies * ok ok ok I'm done * extend timeout and consolidate to constant for easier usage across tests * PR feedback :) Remove warnings by adding transform regex to `ts-jest` and `testMatch`. * cleanup * cleanup * PR feedback & converting `export function` to `export const` in `util.ts`
1 parent d76ca76 commit 7c0ad6c

6 files changed

Lines changed: 748 additions & 132 deletions

File tree

jest.config.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ module.exports = {
33
preset: 'ts-jest',
44
testEnvironment: 'node',
55
transform: {
6-
'.': [
6+
'^.+\\.ts?$': [
77
'ts-jest',
88
{
9-
tsconfig: 'tsconfig.jest.json'
10-
}
11-
]
9+
tsconfig: 'tsconfig.jest.json',
10+
},
11+
],
1212
},
13+
testMatch: ['<rootDir>/test/**/*.spec.ts'],
1314
globalSetup: './jest.setup.ts',
1415
testTimeout: 10000,
15-
};
16+
};

jest.setup.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,6 @@
1-
import { downloadArtifact } from '@electron/get';
2-
import * as zip from 'cross-zip';
31
import * as fs from 'fs-extra';
42
import * as path from 'path';
5-
6-
const asarsDir = path.resolve(__dirname, 'test', 'fixtures', 'asars');
7-
const appsDir = path.resolve(__dirname, 'test', 'fixtures', 'apps');
8-
9-
const templateApp = async (
10-
name: string,
11-
arch: string,
12-
modify: (appPath: string) => Promise<void>,
13-
) => {
14-
const electronZip = await downloadArtifact({
15-
artifactName: 'electron',
16-
version: '27.0.0',
17-
platform: 'darwin',
18-
arch,
19-
});
20-
const appPath = path.resolve(appsDir, name);
21-
zip.unzipSync(electronZip, appsDir);
22-
await fs.rename(path.resolve(appsDir, 'Electron.app'), appPath);
23-
await fs.remove(path.resolve(appPath, 'Contents', 'Resources', 'default_app.asar'));
24-
await modify(appPath);
25-
};
3+
import { appsDir, asarsDir, templateApp } from './test/util';
264

275
export default async () => {
286
await fs.remove(appsDir);

src/asar-utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ export const mergeASARs = async ({
8484
}: MergeASARsOptions): Promise<void> => {
8585
d(`merging ${x64AsarPath} and ${arm64AsarPath}`);
8686

87-
const x64Files = new Set(asar.listPackage(x64AsarPath).map(toRelativePath));
88-
const arm64Files = new Set(asar.listPackage(arm64AsarPath).map(toRelativePath));
87+
const x64Files = new Set(asar.listPackage(x64AsarPath, { isPack: false }).map(toRelativePath));
88+
const arm64Files = new Set(
89+
asar.listPackage(arm64AsarPath, { isPack: false }).map(toRelativePath),
90+
);
8991

9092
//
9193
// Build set of unpacked directories and files

0 commit comments

Comments
 (0)