Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import {transform} from '@babel/core';
import electronRequiresMainPlugin = require('../electron-requires-main');
const electronRequiresMainPlugin = require('../electron-requires-main');

const babelOptions = {
ast: true,
Expand Down
16 changes: 8 additions & 8 deletions desktop/pkg-lib/src/__tests__/getPluginDetails.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@
*/

import fs from 'fs-extra';
import {mocked} from 'ts-jest/utils';
import getPluginDetails from '../getPluginDetails';

jest.mock('fs-extra');
const fsMock = mocked(fs, true);

test('getPluginDetailsV1', async () => {
const pluginV1 = {
name: 'flipper-plugin-test',
Expand All @@ -22,7 +18,8 @@ test('getPluginDetailsV1', async () => {
main: 'src/index.tsx',
gatekeeper: 'GK_flipper_plugin_test',
};
fsMock.readJson.mockImplementation(() => pluginV1);
jest.mock('fs-extra', () => jest.fn());
fs.readJson = jest.fn().mockImplementation(() => pluginV1);
const details = await getPluginDetails('./plugins/flipper-plugin-test');
expect(details).toMatchInlineSnapshot(`
Object {
Expand Down Expand Up @@ -52,7 +49,8 @@ test('getPluginDetailsV2', async () => {
flipperBundlerEntry: 'src/index.tsx',
gatekeeper: 'GK_flipper_plugin_test',
};
fsMock.readJson.mockImplementation(() => pluginV2);
jest.mock('fs-extra', () => jest.fn());
fs.readJson = jest.fn().mockImplementation(() => pluginV2);
const details = await getPluginDetails('./plugins/flipper-plugin-test');
expect(details).toMatchInlineSnapshot(`
Object {
Expand Down Expand Up @@ -82,7 +80,8 @@ test('id used as title if the latter omited', async () => {
flipperBundlerEntry: 'src/index.tsx',
gatekeeper: 'GK_flipper_plugin_test',
};
fsMock.readJson.mockImplementation(() => pluginV2);
jest.mock('fs-extra', () => jest.fn());
fs.readJson = jest.fn().mockImplementation(() => pluginV2);
const details = await getPluginDetails('./plugins/flipper-plugin-test');
expect(details).toMatchInlineSnapshot(`
Object {
Expand Down Expand Up @@ -111,7 +110,8 @@ test('name without "flipper-plugin-" prefix is used as title if the latter omite
flipperBundlerEntry: 'src/index.tsx',
gatekeeper: 'GK_flipper_plugin_test',
};
fsMock.readJson.mockImplementation(() => pluginV2);
jest.mock('fs-extra', () => jest.fn());
fs.readJson = jest.fn().mockImplementation(() => pluginV2);
const details = await getPluginDetails('./plugins/flipper-plugin-test');
expect(details).toMatchInlineSnapshot(`
Object {
Expand Down
2 changes: 1 addition & 1 deletion desktop/pkg-lib/src/getPluginDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function getPluginDetailsV1(
dir: pluginDir,
name: packageJson.name,
version: packageJson.version,
main: path.join('dist', 'index.js'),
main: 'dist/index.js',
source: packageJson.main,
id: packageJson.name,
gatekeeper: packageJson.gatekeeper,
Expand Down