@testcollab/cli 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testcollab/cli",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Command-line interface for TestCollab operations",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -118,18 +118,25 @@ export async function createTestPlan(options) {
118
118
 
119
119
  console.log('validating project and other details...');
120
120
  try {
121
- const projectResponse = await projectsApi.getProjects({
122
- filter: JSON.stringify({
123
- id: parsedProjectId
124
- })
121
+ const projectResponse = await projectsApi.getProject({
122
+ id: parsedProjectId
125
123
  });
126
- if(!projectResponse || !projectResponse.length) {
124
+ if (!projectResponse || !projectResponse.id || projectResponse.id !== parsedProjectId) {
127
125
  console.error('❌ Error: Project not found. Ensure you have access to this project.');
128
126
  process.exit(1);
129
127
  }
130
128
  } catch (e) {
131
- console.error('❌ Error: Failed to validate project. Ensure the project ID is correct and you have access.');
132
- // console.error(e);
129
+ if (e && typeof e === 'object' && 'status' in e && 'text' in e) {
130
+ try {
131
+ const bodyText = await e.text();
132
+ console.error(`❌ Error: Failed to validate project (HTTP ${e.status} ${e.statusText || ''}${bodyText ? ` - ${bodyText}` : ''})`);
133
+ } catch {
134
+ console.error(`❌ Error: Failed to validate project (HTTP ${e.status} ${e.statusText || ''})`);
135
+ }
136
+ } else {
137
+ const message = e?.message || String(e);
138
+ console.error(`❌ Error: Failed to validate project (${message})`);
139
+ }
133
140
  process.exit(1);
134
141
  }
135
142
 
@@ -256,4 +263,3 @@ export async function createTestPlan(options) {
256
263
  }
257
264
  }
258
265
 
259
-