Skip to content

Commit fb896f4

Browse files
Fix nodjesapp dir validation bug
1 parent 5b93071 commit fb896f4

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

__tests__/api/BundleContent/BundleMocked.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,15 @@ describe("MockedFilesystemTests", () => {
144144
if (path.endsWith("nodejsapps")) {
145145
return false;
146146
}
147+
if (path.endsWith(".nodejsapp")) {
148+
return false;
149+
}
147150
if (path.endsWith("cics.xml")) {
148151
return false;
149152
}
153+
if (path.endsWith(".profile")) {
154+
return false;
155+
}
150156
if (path.endsWith(".zosattributes")) {
151157
return false;
152158
}
@@ -205,7 +211,7 @@ describe("MockedFilesystemTests", () => {
205211
expect(err).toBeDefined();
206212
expect(err.message).toContain("cics-deploy requires write permission to: ");
207213
});
208-
it.skip("should detect unwritable nodejsapps directory", () => {
214+
it("should detect unwritable nodejsapps directory", () => {
209215
jest.spyOn(fs, "existsSync").mockImplementation((path: string) => {
210216
if (path.endsWith("nodejsapps")) {
211217
return false;

src/api/BundleContent/NodejsappBundlePart.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,15 @@ export class NodejsappBundlePart extends BundlePart {
160160
catch (err) {
161161
throw new Error("cics-deploy requires write permission to: " + this.bundleDirectory);
162162
}
163-
return;
163+
// Do we have write permission to the nodejsapp dir?
164+
try {
165+
BundlePart.fs.accessSync(this.nodejsappsDir, BundlePart.fs.constants.W_OK);
166+
}
167+
catch (err) {
168+
throw new Error("cics-deploy requires write permission to: " + this.nodejsappsDir);
169+
}
164170
}
165171

166-
// Do we have write permission to the nodejsapp dir?
167-
try {
168-
BundlePart.fs.accessSync(this.nodejsappsDir, BundlePart.fs.constants.W_OK);
169-
}
170-
catch (err) {
171-
throw new Error("cics-deploy requires write permission to: " + this.nodejsappsDir);
172-
}
173172

174173
// Does the .nodejsapp appear to be saveable?
175174
BundlePart.ensureFileSaveable(this.nodejsappFile, this.overwrite);

0 commit comments

Comments
 (0)