diff --git a/desktop/app/src/utils/__tests__/sideEffect.node.tsx b/desktop/app/src/utils/__tests__/sideEffect.node.tsx index 4ef6a3259..59897f046 100644 --- a/desktop/app/src/utils/__tests__/sideEffect.node.tsx +++ b/desktop/app/src/utils/__tests__/sideEffect.node.tsx @@ -59,8 +59,7 @@ describe('sideeffect', () => { console.error = origError; }); - // TODO(T93353978): Re-enable. - test.skip('can run a basic effect', async () => { + test.local('can run a basic effect', async () => { unsubscribe = sideEffect( store, {name: 'test', throttleMs: 1}, diff --git a/desktop/flipper-plugin/src/ui/data-inspector/__tests__/DataInspector.node.tsx b/desktop/flipper-plugin/src/ui/data-inspector/__tests__/DataInspector.node.tsx index e137f3a66..3c9827f5a 100644 --- a/desktop/flipper-plugin/src/ui/data-inspector/__tests__/DataInspector.node.tsx +++ b/desktop/flipper-plugin/src/ui/data-inspector/__tests__/DataInspector.node.tsx @@ -71,8 +71,7 @@ test('can manually collapse properties', async () => { }); }); -// TODO(T95985157): Flaky in open source. -test.skip('can filter for data', async () => { +test.local('can filter for data', async () => { const res = render( , ); diff --git a/desktop/flipper-plugin/src/utils/__tests__/shallowSerialization.node.tsx b/desktop/flipper-plugin/src/utils/__tests__/shallowSerialization.node.tsx index babf952e7..3f6520e3e 100644 --- a/desktop/flipper-plugin/src/utils/__tests__/shallowSerialization.node.tsx +++ b/desktop/flipper-plugin/src/utils/__tests__/shallowSerialization.node.tsx @@ -225,8 +225,10 @@ test('test serialize and deserializeShallowObject function for non Object input' ); }); -if (process.platform !== 'win32') { - test('test makeObjectSerializable and deserializeShallowObject function for Date input', () => { +// dates on windows don't support changed timezones +test.unix( + 'test makeObjectSerializable and deserializeShallowObject function for Date input', + () => { const date = new Date(2021, 1, 29, 10, 31, 7, 205); expect(makeShallowSerializable(date)).toMatchInlineSnapshot(` Object { @@ -237,8 +239,8 @@ if (process.platform !== 'win32') { expect(deserializeShallowObject(makeShallowSerializable(date))).toEqual( date, ); - }); -} + }, +); test('test makeObjectSerializable and deserializeShallowObject function for Map of Sets', () => { const map = new Map([ diff --git a/desktop/jest.config.js b/desktop/jest.config.js index 9cfd95007..4bd0a1067 100644 --- a/desktop/jest.config.js +++ b/desktop/jest.config.js @@ -13,6 +13,7 @@ module.exports = { '\\.(js|tsx?)$': '/scripts/jest-transform.js', }, setupFiles: ['/scripts/jest-setup.js'], + setupFilesAfterEnv: ['/scripts/jest-setup-after.js'], moduleNameMapper: { '^flipper$': '/app/src', '^flipper-plugin$': '/flipper-plugin/src', diff --git a/desktop/scripts/jest-setup-after.js b/desktop/scripts/jest-setup-after.js new file mode 100644 index 000000000..21aac4e1a --- /dev/null +++ b/desktop/scripts/jest-setup-after.js @@ -0,0 +1,33 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +// jest-setup-after will run after Jest has been initialized, so that it can be adapted. + +const test = global.test; +if (!test) { + throw new Error('Failed jest test object'); +} +/** + * This test will not be executed on Github / SandCastle, + * since, for example, it relies on precise timer reliability + */ +test.local = function local() { + const fn = process.env.SANDCASTLE || process.env.CI ? test.skip : test; + // eslint-disable-next-line + return fn.apply(null, arguments); +}; + +/** + * This test will only run on non-windows machines + */ +test.unix = function local() { + const fn = process.platform === 'win32' ? test.skip : test; + // eslint-disable-next-line + return fn.apply(null, arguments); +}; diff --git a/desktop/types/index.d.ts b/desktop/types/index.d.ts index 41b409a7e..3745ea231 100644 --- a/desktop/types/index.d.ts +++ b/desktop/types/index.d.ts @@ -26,3 +26,4 @@ /// /// /// +/// diff --git a/desktop/types/jest-extensions.d.ts b/desktop/types/jest-extensions.d.ts new file mode 100644 index 000000000..7043d44fb --- /dev/null +++ b/desktop/types/jest-extensions.d.ts @@ -0,0 +1,22 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +declare namespace jest { + interface It { + /** + * This test will not be executed on Github / SandCastle, + * since, for example, it relies on precise timer reliability + */ + local: jest.It; + /** + * This test will only run on non-windows machines + */ + unix: jest.It; + } +}