Skip to content

Commit

Permalink
Fix running fantom tests via buck-test (facebook#48215)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#48215

Changelog: [internal]

Reviewed By: rubennorte

Differential Revision: D66976980

fbshipit-source-id: d553c2f702d6928fb0ad88fcc2c6f04160a65d02
  • Loading branch information
mijay authored and facebook-github-bot committed Dec 11, 2024
1 parent 462fae4 commit 477489c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/react-native-fantom/runner/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import os from 'os';
// $FlowExpectedError[untyped-import]
import {SourceMapConsumer} from 'source-map';

const BUCK_ISOLATION_DIR = 'react-native-fantom-buck-out';

export function getBuckModeForPlatform(enableRelease: boolean = false): string {
const mode = enableRelease ? 'opt' : 'dev';

Expand All @@ -40,6 +42,16 @@ type SpawnResultWithOriginalCommand = {
};

export function runBuck2(args: Array<string>): SpawnResultWithOriginalCommand {
// If these tests are already running from withing a buck2 process, e.g. when
// they are scheduled by a `buck2 test` wrapper, calling `buck2` again would
// cause a daemon-level deadlock.
// To prevent this - explicitly pass custom `--isolation-dir`. Reuse the same
// dir across tests (even running in different jest processes) to properly
// employ caching.
if (process.env.BUCK2_WRAPPER != null) {
args.unshift('--isolation-dir', BUCK_ISOLATION_DIR);
}

const result = spawnSync('buck2', args, {
encoding: 'utf8',
env: {
Expand Down

0 comments on commit 477489c

Please sign in to comment.