File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,6 +162,23 @@ describe('error-tracking project picker report', () => {
162162} ) ;
163163
164164describe ( 'error-tracking ciPreRun' , ( ) => {
165+ test ( 'stops when no framework is detected' , async ( ) => {
166+ vi . mocked ( detectFramework ) . mockResolvedValue ( undefined ) ;
167+ const session = {
168+ installDir : '/tmp/error-tracking-ci' ,
169+ frameworkContext : { } ,
170+ } as unknown as WizardSession ;
171+
172+ await errorTrackingConfig . ciPreRun ?.( session ) ;
173+
174+ expect ( wizardAbort ) . toHaveBeenCalledWith (
175+ expect . objectContaining ( { code : ErrorCodes . DetectNoFramework } ) ,
176+ ) ;
177+ expect ( session . integration ) . toBeUndefined ( ) ;
178+ expect ( session . frameworkConfig ) . toBeUndefined ( ) ;
179+ expect ( session . skillId ) . toBeUndefined ( ) ;
180+ } ) ;
181+
165182 test ( 'stops KMP before it sets the framework' , async ( ) => {
166183 vi . mocked ( detectFramework ) . mockResolvedValue ( Integration . kmp ) ;
167184 const session = {
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import { preinstallPostHogCliOnce } from '@lib/programs/shared/posthog-cli-prein
1717import { analytics } from '@utils/analytics' ;
1818import { wizardAbort } from '@utils/wizard-abort' ;
1919import { ErrorCodes } from '@shared/errors' ;
20+ import { abortNoFrameworkDetected } from '@lib/programs/shared/abort-no-framework' ;
2021
2122const ERROR_TRACKING_REPORT_FILE = 'posthog-error-tracking-report.md' ;
2223const ERROR_TRACKING_DOCS_URL = 'https://posthog.com/docs/error-tracking' ;
@@ -184,10 +185,7 @@ export const errorTrackingConfig: ProgramConfig = {
184185
185186 const integration = await detectFramework ( session . installDir ) ;
186187 if ( ! integration ) {
187- await wizardAbort ( {
188- code : ErrorCodes . DetectNoFramework ,
189- message : 'Could not auto-detect your framework for this project.' ,
190- } ) ;
188+ await abortNoFrameworkDetected ( ) ;
191189 return ;
192190 }
193191 if ( ERROR_TRACKING_UNSUPPORTED . has ( integration ) ) {
You can’t perform that action at this time.
0 commit comments