Attempt to fix tests on github (#1236)

Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/1236

I'm not quite sure why tests are failing on GitHub on Windows and Linux, while working well on MacOS. I cannot reproduce fail on my Windows machine. So will use this diff for debugging.

Reviewed By: jknoxville

Differential Revision: D21954828

fbshipit-source-id: bc88a67c4974c8453dcecee3128b354f0b1cb694
This commit is contained in:
Anton Nikolaev
2020-06-10 09:15:47 -07:00
committed by Facebook GitHub Bot
parent 2a5d1d8ff9
commit ce6f8eea90

View File

@@ -7,9 +7,9 @@
* @format
*/
import mockfs from 'mock-fs';
import fs from 'fs-extra';
import path from 'path';
import mockfs from 'mock-fs';
import {consoleMock} from 'flipper-test-utils';
import {finishPendingPluginInstallations} from '../pluginInstaller';
import {
@@ -17,25 +17,6 @@ import {
pluginInstallationDir,
} from '../pluginPaths';
jest.mock('../pluginPaths', () => {
return {
pluginInstallationDir: path.join(
'',
'Users',
'mock',
'.flipper',
'thirdparty',
),
pluginPendingInstallationDir: path.join(
'',
'Users',
'mock',
'.flipper',
'pending',
),
};
});
describe('pluginInstaller', () => {
const realConsole = global.console;
global.console = consoleMock as any;
@@ -44,9 +25,7 @@ describe('pluginInstaller', () => {
global.console = realConsole;
});
beforeEach(() => {
mockfs({});
});
beforeEach(() => {});
afterEach(() => {
mockfs.restore();
@@ -63,11 +42,13 @@ describe('pluginInstaller', () => {
},
'flipper-plugin-test2': {
'0.3.0': {
'index.js': '<0.3.0>',
'index.js': '',
'0.3.0.js': '',
'package.json': '',
},
'0.2.0': {
'index.js': '<0.2.0>',
'index.js': '',
'0.2.0.js': '',
'package.json': '',
},
},
@@ -83,6 +64,7 @@ describe('pluginInstaller', () => {
"flipper-plugin-test2",
]
`);
expect(
await fs.readdir(
path.join(pluginInstallationDir, 'flipper-plugin-test1'),
@@ -93,23 +75,19 @@ describe('pluginInstaller', () => {
"package.json",
]
`);
expect(
await fs.readdir(
path.join(pluginInstallationDir, 'flipper-plugin-test2'),
),
).toMatchInlineSnapshot(`
Array [
"0.3.0.js",
"index.js",
"package.json",
]
`);
expect(
(
await fs.readFile(
path.join(pluginInstallationDir, 'flipper-plugin-test2', 'index.js'),
)
).toString(),
).toBe('<0.3.0>');
expect(
await fs.readdir(pluginPendingInstallationDir),
).toMatchInlineSnapshot(`Array []`);