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