-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(CLI-integ-tests): cli integ tests cannot use local CDK framework #31131
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,13 +75,14 @@ const YARN_MONOREPO_CACHE: Record<string, any> = {}; | |
* | ||
* Cached in YARN_MONOREPO_CACHE. | ||
*/ | ||
async function findYarnPackages(root: string): Promise<Record<string, string>> { | ||
export async function findYarnPackages(root: string): Promise<Record<string, string>> { | ||
if (!(root in YARN_MONOREPO_CACHE)) { | ||
const output: YarnWorkspacesOutput = JSON.parse(await shell(['yarn', 'workspaces', '--silent', 'info'], { | ||
const outputDataString: string = JSON.parse(await shell(['yarn', 'workspaces', '--json', 'info'], { | ||
captureStderr: false, | ||
cwd: root, | ||
show: 'error', | ||
})); | ||
})).data; | ||
const output: YarnWorkspacesOutput = JSON.parse(outputDataString); | ||
|
||
const ret: Record<string, string> = {}; | ||
for (const [k, v] of Object.entries(output)) { | ||
|
@@ -96,7 +97,7 @@ async function findYarnPackages(root: string): Promise<Record<string, string>> { | |
* Find the root directory of the repo from the current directory | ||
*/ | ||
export async function autoFindRoot() { | ||
const found = await findUp('release.json'); | ||
const found = findUp('release.json'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Odd that this was ever awaited. Looking in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TS compiler said it's not needed, so I removed it. It doesn't return a promise, so there's no need to await anything here. |
||
if (!found) { | ||
throw new Error(`Could not determine repository root: 'release.json' not found from ${process.cwd()}`); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to parse the shell output again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we first need to parse the output of
yarn workspaces
, which includes adata
object. Thatdata
object is an escaped JSON string, which needs to be parsed again.