Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@ const logSpy = jest.spyOn(common, 'logManualInstallation');

jest.mock('execa', () => jest.fn());

// TODO remove when androidSDK starts getting gradle.build path from config
jest.mock('../../../../tools/config/findProjectRoot', () => () => '.');

describe('androidSDK', () => {
beforeEach(() => {
writeFiles('', {
'android/build.gradle': `
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
}
}
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {HealthCheckInterface} from '../types';
import findProjectRoot from '../../../tools/config/findProjectRoot';

const getBuildToolsVersion = (): string => {
// TODO use config
const projectRoot = findProjectRoot();
const gradleBuildFilePath = path.join(projectRoot, 'android/build.gradle');

Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/tools/config/findProjectRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {CLIError} from '@react-native-community/cli-tools';
*/
export default function findProjectRoot(cwd = process.cwd()): string {
const packageLocation = findUp.sync('package.json', {cwd});

/**
* It is possible that `package.json` doesn't exist
* in the tree. In that case, we want to throw an error.
Expand Down