Skip to content

Commit

Permalink
[full ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Edney committed Sep 7, 2023
1 parent 54c38bd commit 08e0d77
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ const HERMES_INSTRUCTIONS = `You are running a version of React Native that we c
`

const BUGSNAG_CLI_INSTRUCTIONS = `bugsnag:upload-android task added to your package.json - run this task to upload Android source maps after a build.
See https://docs.bugsnag.com/platforms/react-native/react-native/showing-full-stacktraces for details.
`

export default async function run (projectRoot: string, urls: OnPremiseUrls): Promise<boolean> {
try {
const { iosIntegration } = await prompts({
Expand Down Expand Up @@ -76,13 +82,20 @@ export default async function run (projectRoot: string, urls: OnPremiseUrls): Pr
const { packageJsonIntegration } = await prompts({
type: 'confirm',
name: 'packageJsonIntegration',
message: 'Do you want to add an NPM task to your package.json to upload Android source maps?',
message: 'Do you want to add an NPM task to your package.json that you can run to upload Android source maps?',
initial: true
}, { onCancel })

if (packageJsonIntegration) {
await writeToPackageJson(join(projectRoot, 'package.json'), urls[UrlType.UPLOAD], urls[UrlType.BUILD])
}

await prompts({
type: 'text',
name: 'bugsnagCliInstructions',
message: BUGSNAG_CLI_INSTRUCTIONS,
initial: 'Hit enter to continue …'
}, { onCancel })
}

return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Scenario: successfully modify project
When I input a return interactively
Then I wait for the shell to output a match for the regex "@bugsnag/cli dependency is installed" to stdout
When RN version is 0.68 or lower dismiss the warning message
And I wait for the current stdout line to match the regex "Do you want to add an NPM task to your package.json to upload Android source maps\?"
And I wait for the current stdout line to match the regex "Do you want to add an NPM task to your package.json that you can run to upload Android source maps\?"
When I input "n" interactively
Then the last interactive command exited successfully
And bugsnag cli library is in the package.json file
Expand Down Expand Up @@ -74,7 +74,7 @@ Scenario: successfully modify project, choosing source-maps version
When I input "1.1.8" interactively
Then I wait for the shell to output a match for the regex "@bugsnag/cli dependency is installed" to stdout
When RN version is 0.68 or lower dismiss the warning message
And I wait for the current stdout line to match the regex "Do you want to add an NPM task to your package.json to upload Android source maps\?"
And I wait for the current stdout line to match the regex "Do you want to add an NPM task to your package.json that you can run to upload Android source maps\?"
When I input "n" interactively
Then the last interactive command exited successfully
And bugsnag cli library version "^1.1.8" is in the package.json file
Expand Down Expand Up @@ -119,7 +119,7 @@ Scenario: successfully modify project with custom endpoints
When I input a return interactively
Then I wait for the shell to output a match for the regex "@bugsnag/cli dependency is installed" to stdout
When RN version is 0.68 or lower dismiss the warning message
And I wait for the current stdout line to match the regex "Do you want to add an NPM task to your package.json to upload Android source maps\?"
And I wait for the current stdout line to match the regex "Do you want to add an NPM task to your package.json that you can run to upload Android source maps\?"
When I input "n" interactively
Then the last interactive command exited successfully
And bugsnag cli library is in the package.json file
Expand Down Expand Up @@ -195,7 +195,7 @@ Scenario: opt not to modify the iOS project
When I input a return interactively
Then I wait for the shell to output a match for the regex "@bugsnag/cli dependency is installed" to stdout
When RN version is 0.68 or lower dismiss the warning message
And I wait for the current stdout line to match the regex "Do you want to add an NPM task to your package.json to upload Android source maps\?"
And I wait for the current stdout line to match the regex "Do you want to add an NPM task to your package.json that you can run to upload Android source maps\?"
When I input "n" interactively
Then the last interactive command exited successfully
And bugsnag cli library is in the package.json file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ if {[expr $rnVersionInt3 < 0.68]} {
send -- \r
}

expect "Do you want to add an NPM task to your package.json to upload Android source maps?"
expect "Do you want to add an NPM task to your package.json that you can run to upload Android source maps?"
send -- \r

expect "See https://docs.bugsnag.com/platforms/react-native/react-native/showing-full-stacktraces for details."
send -- \r

expect eof

0 comments on commit 08e0d77

Please sign in to comment.