Skip to content

Commit

Permalink
Dont fetch metafields during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aswamy committed Jan 17, 2025
1 parent e969f23 commit 2c87810
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions packages/theme-language-server-node/src/metafieldDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,25 @@ export async function fetchMetafieldDefinitionsForURI(uri: string) {
}
}

// eslint-disable-next-line no-unused-vars
async function getShopifyCliPath() {
if (isWin) {
const { stdout } = await exec(`where.exe shopify`);
const executables = stdout
.replace(/\r/g, '')
.split('\n')
.filter((exe) => exe.endsWith('bat'));
return executables.length > 0 ? executables[0] : '';
} else {
const { stdout } = await exec(`which shopify`);
return stdout.split('\n')[0].replace('\r', '');
if (process.env.NODE_ENV === 'test') {
return;
}

try {
if (isWin) {
const { stdout } = await exec(`where.exe shopify`);
const executables = stdout
.replace(/\r/g, '')
.split('\n')
.filter((exe) => exe.endsWith('bat'));
return executables.length > 0 ? executables[0] : '';
} else {
const { stdout } = await exec(`which shopify`);
return stdout.split('\n')[0].replace('\r', '');
}
} catch (_) {
// If any errors occur while trying to find the CLI, we will silently return
return;
}
}

0 comments on commit 2c87810

Please sign in to comment.