diff --git a/src/commands/export-dynamic-plugin/check-heavy-deps.test.ts b/src/commands/export-dynamic-plugin/check-heavy-deps.test.ts index cf5cb5b..de4ad73 100644 --- a/src/commands/export-dynamic-plugin/check-heavy-deps.test.ts +++ b/src/commands/export-dynamic-plugin/check-heavy-deps.test.ts @@ -66,11 +66,13 @@ describe('checkHeavyDependencies', () => { expect(logSpy).toHaveBeenCalledTimes(2); expect(logSpy.mock.calls[0][0]).toContain( - 'WARNING: Found heavy dependency @backstage/backend-defaults', + 'WARNING: Found heavy dependency', ); + expect(logSpy.mock.calls[0][0]).toContain('@backstage/backend-defaults'); expect(logSpy.mock.calls[1][0]).toContain( - 'WARNING: Found heavy dependency @backstage/backend-app-api', + 'WARNING: Found heavy dependency', ); + expect(logSpy.mock.calls[1][0]).toContain('@backstage/backend-app-api'); expect(logSpy.mock.calls[0][0]).toContain( 'Should not be used in backend plugins', ); @@ -95,7 +97,10 @@ describe('checkHeavyDependencies', () => { ); expect(logSpy).toHaveBeenCalledTimes(1); expect(logSpy.mock.calls[0][0]).toContain( - 'WARNING: Found heavy dependency @backstage/backend-test-utils', + 'WARNING: Found heavy dependency', + ); + expect(logSpy.mock.calls[0][0]).toContain( + '@backstage/backend-test-utils', ); }); @@ -157,13 +162,18 @@ describe('checkHeavyDependencies', () => { expect(logSpy).toHaveBeenCalledTimes(3); expect(logSpy.mock.calls[0][0]).toContain( - 'WARNING: Found heavy dependency @backstage/core-app-api', + 'WARNING: Found heavy dependency', ); + expect(logSpy.mock.calls[0][0]).toContain('@backstage/core-app-api'); expect(logSpy.mock.calls[1][0]).toContain( - 'WARNING: Found heavy dependency @backstage/frontend-defaults', + 'WARNING: Found heavy dependency', + ); + expect(logSpy.mock.calls[1][0]).toContain('@backstage/frontend-defaults'); + expect(logSpy.mock.calls[2][0]).toContain( + 'WARNING: Found heavy dependency', ); expect(logSpy.mock.calls[2][0]).toContain( - 'WARNING: Found heavy dependency @backstage/frontend-test-utils', + '@backstage/frontend-test-utils', ); }); diff --git a/src/commands/package-dynamic-plugins/command.test.ts b/src/commands/package-dynamic-plugins/command.test.ts index b174ca3..b128d29 100644 --- a/src/commands/package-dynamic-plugins/command.test.ts +++ b/src/commands/package-dynamic-plugins/command.test.ts @@ -21,15 +21,18 @@ import { command } from './command'; describe('package-dynamic-plugins command', () => { let tmpDir: string; + let originalCwd: string; beforeEach(() => { // Create a fresh temp directory for each test tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'rhdh-cli-test-')); // Change to temp directory for tests + originalCwd = process.cwd(); process.chdir(tmpDir); }); afterEach(() => { + process.chdir(originalCwd); // Clean up temp directory if (tmpDir && fs.existsSync(tmpDir)) { fs.removeSync(tmpDir);