diff --git a/__tests__/__packages__/cli-test-utils/CHANGELOG.md b/__tests__/__packages__/cli-test-utils/CHANGELOG.md index bc707aabe..2218f50df 100644 --- a/__tests__/__packages__/cli-test-utils/CHANGELOG.md +++ b/__tests__/__packages__/cli-test-utils/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe CLI test utils package will be documented in this file. +## Recent Changes + +- BugFix: Improved the error message shown on MacOS when `runCliScript` method fails to run script that is missing shebang line. [#2314](https://github.com/zowe/zowe-cli/pull/2314) + ## `8.1.1` - BugFix: Updated peer dependencies to `^8.0.0`, dropping support for versions tagged `next`. [#2287](https://github.com/zowe/zowe-cli/pull/2287) diff --git a/__tests__/__packages__/cli-test-utils/src/TestUtils.ts b/__tests__/__packages__/cli-test-utils/src/TestUtils.ts index 1c47f617c..90cb8be95 100644 --- a/__tests__/__packages__/cli-test-utils/src/TestUtils.ts +++ b/__tests__/__packages__/cli-test-utils/src/TestUtils.ts @@ -10,6 +10,7 @@ */ import * as fs from "fs"; +import * as path from "path"; import { spawnSync, SpawnSyncReturns, ExecFileException } from "child_process"; import { ITestEnvironment } from "./environment/doc/response/ITestEnvironment"; import { ICommandDefinition, IHandlerParameters } from "@zowe/imperative"; @@ -55,12 +56,16 @@ export function runCliScript(scriptPath: string, testEnvironment: ITestEnvironme } catch { fs.chmodSync(scriptPath, "755"); } - return spawnSync(scriptPath, args, { + const response = spawnSync(scriptPath, args, { cwd: testEnvironment.workingDir, env: childEnv, encoding: "buffer" }); + if (process.platform === "darwin" && (response.error as ExecFileException)?.errno === -8) { + throw new Error(`The script file ${path.basename(scriptPath)} failed to execute. Check that it starts with a shebang line.`); + } + return response; } else { throw new Error(`The script file ${scriptPath} doesn't exist`); diff --git a/jest.config.js b/jest.config.js index c3077263a..0e05bcca5 100644 --- a/jest.config.js +++ b/jest.config.js @@ -133,14 +133,11 @@ module.exports = { ...projectConfig, "reporters": [ "default", + "jest-stare", ["jest-junit", { "outputDirectory": "__tests__/__results__", "reportTestSuiteErrors": true }], - ["jest-stare", { - "coverageLink": "../unit/coverage/lcov-report/index.html", - "resultDir": "__tests__/__results__/jest-stare" - }], ["github-actions", { "silent": false } ] ], "testResultsProcessor": "jest-sonar-reporter", diff --git a/package.json b/package.json index 1339c31a7..dc705bb40 100644 --- a/package.json +++ b/package.json @@ -82,5 +82,13 @@ }, "jestSonar": { "reportPath": "__tests__/__results__/jest-sonar" + }, + "jest-stare": { + "additionalResultsProcessors": [ + "jest-junit", + "jest-sonar-reporter" + ], + "coverageLink": "../unit/coverage/lcov-report/index.html", + "resultDir": "__tests__/__results__/jest-stare" } } diff --git a/packages/zosjobs/__tests__/__system__/GetJobs.system.test.ts b/packages/zosjobs/__tests__/__system__/GetJobs.system.test.ts index 5ca70448c..3e966c7f3 100644 --- a/packages/zosjobs/__tests__/__system__/GetJobs.system.test.ts +++ b/packages/zosjobs/__tests__/__system__/GetJobs.system.test.ts @@ -719,8 +719,7 @@ describe("Get Jobs - System Tests", () => { it("should be able to get a job that was submitted and get proper error when the job is deleted", async () => { const job = await SubmitJobs.submitJcl(REAL_SESSION, JCL); - const jobStatus = await GetJobs.getStatusForJob(REAL_SESSION, job); - + await wait(3000); await DeleteJobs.deleteJobForJob(REAL_SESSION, job); await wait(3000); // make sure jobs is deleted let error; @@ -978,6 +977,7 @@ describe("Get Jobs - System Tests", () => { describe("invalid request error handling", () => { it("should detect and surface an error for getting JCL that doesnt exist", async () => { const job = await SubmitJobs.submitJcl(REAL_SESSION, JCL); + await wait(3000); await DeleteJobs.deleteJobForJob(REAL_SESSION, job); await wait(3000); let error;