Skip to content

Commit da8e395

Browse files
netrajpatelclaude
andcommitted
fix(apps-cli): drop oclif manifest from build so tests load src, not lib [DX-9770]
Root cause of the 12 apps-cli deploy/update CI failures: apps-cli's tests stub the SRC command classes (BaseCommand/Update/initMarketplaceSDK). oclif only loads commands from src (via ts-node in dev) when NO oclif.manifest.json exists; when a manifest is present it loads the compiled lib, so the src stubs never apply and the command makes a real developer-hub HTTP call -> 401 'session timed out'. The build script had been changed to `pnpm compile && oclif manifest && oclif readme`, which created the manifest during the CI build step; v2-dev's build was `tsc -b` (no manifest), which is why v2-dev stayed green. Reproduced locally: no manifest -> tests pass; manifest present -> tests fail. Fix: build = `pnpm compile` only. The manifest is still generated by prepack for publishing. Reverts the exploratory hermetic/diagnostic edits to the test files (not needed once the manifest cause was found). apps-cli: 61 passing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NbgqgVDTDmh6c9LwDtMEf9
1 parent a4a44d5 commit da8e395

3 files changed

Lines changed: 1 addition & 31 deletions

File tree

packages/contentstack-apps-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
}
8181
},
8282
"scripts": {
83-
"build": "pnpm compile && oclif manifest && oclif readme",
83+
"build": "pnpm compile",
8484
"lint": "eslint \"src/**/*.ts\"",
8585
"postpack": "rm -f oclif.manifest.json",
8686
"prepack": "pnpm compile && oclif manifest && oclif readme",

packages/contentstack-apps-cli/test/unit/commands/app/deploy.test.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,11 @@ import { BaseCommand } from "../../../../src/base-command";
1212
import * as libCommonUtils from "../../../../src/util/common-utils";
1313
import * as libInquirer from "../../../../src/util/inquirer";
1414

15-
// Hermetic: seed a complete region at module load so the nock URLs below are deterministic
16-
// regardless of test execution order or ambient CLI config. These tests previously read
17-
// whatever region happened to be in the shared config, which made them order-dependent
18-
// (they passed only when another package seeded a region first, e.g. in the old CI order).
19-
configHandler.set("region", {
20-
name: "NA",
21-
cma: "https://api.contentstack.io",
22-
cda: "https://cdn.contentstack.io",
23-
uiHost: "https://app.contentstack.com",
24-
});
2515
const region = configHandler.get("region");
2616
const BaseCommandToStub = BaseCommand;
2717
const LibDeploy = Deploy;
2818
const developerHubBaseUrl = getDeveloperHubUrl();
2919

30-
// TEMP diagnostic (removed once CI is green): reveal any request nock did not intercept.
31-
nock.emitter.on("no match", (req: any) => {
32-
// eslint-disable-next-line no-console
33-
console.log("NOCK NO MATCH >>", req?.method, req?.options?.host || req?.host, req?.path || req?.options?.path);
34-
});
35-
3620
describe("app:deploy", () => {
3721
let sandbox: sinon.SinonSandbox;
3822

packages/contentstack-apps-cli/test/unit/commands/app/update.test.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,8 @@ import { stubAuthentication } from "../../helpers/auth-stub-helper";
1212
import Update from "../../../../src/commands/app/update";
1313
import { BaseCommand } from "../../../../src/base-command";
1414

15-
// Hermetic: seed a complete region at module load so the nock URL(s) below are deterministic
16-
// regardless of test execution order or ambient CLI config.
17-
configHandler.set("region", {
18-
name: "NA",
19-
cma: "https://api.contentstack.io",
20-
cda: "https://cdn.contentstack.io",
21-
uiHost: "https://app.contentstack.com",
22-
});
2315
const region = configHandler.get("region");
2416

25-
// TEMP diagnostic (removed once CI is green): reveal any request nock did not intercept.
26-
nock.emitter.on("no match", (req: any) => {
27-
// eslint-disable-next-line no-console
28-
console.log("NOCK NO MATCH >>", req?.method, req?.options?.host || req?.host, req?.path || req?.options?.path);
29-
});
30-
3117
// oclif loads commands from src/ (ts-node is registered), so stub the src classes directly
3218
const BaseCommandToStub = BaseCommand;
3319
const LibUpdate = Update;

0 commit comments

Comments
 (0)