Skip to content

Commit

Permalink
fix(clone): won't execute clipboard write if environment is test
Browse files Browse the repository at this point in the history
  • Loading branch information
zxf4399 committed Mar 25, 2023
1 parent 01e3af4 commit 11e0183
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/commands/clone.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { execa } from "execa"
import GitUrlParse from "git-url-parse"

import { MGRE_CONIFG_FIELDS, mgreConfig } from "#config"
import { DEFAULT_CONFIG, MGRE_CONFIG_FILE_PATH } from "#constant"
import { DEFAULT_CONFIG, isTest, MGRE_CONFIG_FILE_PATH } from "#constant"
import db from "#db"

class CloneCommand {
Expand Down Expand Up @@ -208,7 +208,7 @@ class CloneCommand {

db.add(localRepoPath)

if (!this.isOptionsFromImport) {
if (!this.isOptionsFromImport && !isTest) {
await clipboard.write(`cd ${localRepoPath}`)

console.log(
Expand Down
2 changes: 2 additions & 0 deletions src/utils/constant.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ export const MGRE_CONFIG_FILE_PATH = join(
export const DB_FILE_PATH = join(DEFAULT_CONFIG.root, "mgre.db")

export const FIND_OUTPUT_FILE_PATH = join(DEFAULT_CONFIG.root, "output.txt")

export const isTest = process.env.NODE_ENV === "test"

0 comments on commit 11e0183

Please sign in to comment.