Skip to content

Commit

Permalink
Skip teardown in GH & remove stdio: []
Browse files Browse the repository at this point in the history
  • Loading branch information
BassemNKhalil committed Nov 14, 2023
1 parent e39b446 commit e30dca3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
8 changes: 2 additions & 6 deletions Commands/gitInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,13 @@ const gitInitCommand = {
try {
chalk.Message("Checking whether git is initialised");
process.chdir(folderPath);
if (
execSync("git status", { stdio: [] })
.toString()
.startsWith("On branch")
) {
if (execSync("git status").toString().startsWith("On branch")) {
chalk.Warning("git already initialised");
}
} catch (error) {
try {
chalk.Message("git initialisation started");
execSync("git init -b main", { stdio: [] });
execSync("git init -b main");
chalk.Success("git initialisation completed");
} catch (error) {
chalk.Error("git was not initialised");
Expand Down
4 changes: 1 addition & 3 deletions Jest/globalSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ const wpFolderPath = require("../Utils/folderPaths").wpFolderPath();
module.exports = function () {
// save current working dir in to revert to it in teardown
process.env.initialPath = process.cwd();
execSync("npm link", {
stdio: [],
});
execSync("npm link");

fs.mkdirSync(parentFolderPath, { recursive: true });

Expand Down
6 changes: 5 additions & 1 deletion Jest/globalTeardown.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ const execSync = require("child_process").execSync;
const parentFolderPath = require("../Utils/folderPaths").parentFolderPath();

module.exports = function () {
//skip when running in GitHub
if (process.env.GITHUB_JOB !== undefined) return;

// start teardown
process.chdir(os.homedir());

execSync("npm uninstall prettier sort-package-json --global", { stdio: [] });
execSync("npm uninstall prettier sort-package-json --global");

fs.rmSync(parentFolderPath, {
recursive: true,
Expand Down
4 changes: 2 additions & 2 deletions Utils/gitCommit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const chalk = require("./chalk");

module.exports = function (commitMessage) {
try {
execSync("git add .", { stdio: [] });
execSync(`git commit -m "` + commitMessage + `"`, { stdio: [] });
execSync("git add .");
execSync(`git commit -m "` + commitMessage + `"`);
chalk.Success("git commit: " + commitMessage);
} catch (error) {
try {
Expand Down

0 comments on commit e30dca3

Please sign in to comment.