Skip to content

Commit 477489c

Browse files
mijayfacebook-github-bot
authored andcommitted
Fix running fantom tests via buck-test (facebook#48215)
Summary: Pull Request resolved: facebook#48215 Changelog: [internal] Reviewed By: rubennorte Differential Revision: D66976980 fbshipit-source-id: d553c2f702d6928fb0ad88fcc2c6f04160a65d02
1 parent 462fae4 commit 477489c

File tree

1 file changed

+12
-0
lines changed
  • packages/react-native-fantom/runner

1 file changed

+12
-0
lines changed

packages/react-native-fantom/runner/utils.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import os from 'os';
1616
// $FlowExpectedError[untyped-import]
1717
import {SourceMapConsumer} from 'source-map';
1818

19+
const BUCK_ISOLATION_DIR = 'react-native-fantom-buck-out';
20+
1921
export function getBuckModeForPlatform(enableRelease: boolean = false): string {
2022
const mode = enableRelease ? 'opt' : 'dev';
2123

@@ -40,6 +42,16 @@ type SpawnResultWithOriginalCommand = {
4042
};
4143

4244
export function runBuck2(args: Array<string>): SpawnResultWithOriginalCommand {
45+
// If these tests are already running from withing a buck2 process, e.g. when
46+
// they are scheduled by a `buck2 test` wrapper, calling `buck2` again would
47+
// cause a daemon-level deadlock.
48+
// To prevent this - explicitly pass custom `--isolation-dir`. Reuse the same
49+
// dir across tests (even running in different jest processes) to properly
50+
// employ caching.
51+
if (process.env.BUCK2_WRAPPER != null) {
52+
args.unshift('--isolation-dir', BUCK_ISOLATION_DIR);
53+
}
54+
4355
const result = spawnSync('buck2', args, {
4456
encoding: 'utf8',
4557
env: {

0 commit comments

Comments
 (0)