@cmflow/cli 0.73.6 → 0.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cm-changelog.js +3 -2
- package/bin/cm-clean.js +3 -2
- package/bin/cm-config.js +4 -3
- package/bin/cm-deploy.js +3 -2
- package/bin/cm-fetch.js +3 -2
- package/bin/cm-finish.js +3 -2
- package/bin/cm-merge.js +3 -2
- package/bin/cm-publish-pages.js +3 -2
- package/bin/cm-publish.js +3 -2
- package/bin/cm-push.js +3 -2
- package/bin/cm-rebase.js +3 -2
- package/bin/cm-republish.js +3 -2
- package/bin/cm-start.js +3 -2
- package/bin/cm.js +7 -2
- package/bin/cmrelease.js +3 -1
- package/package.json +15 -17
- package/release.config.js +1 -1
- package/semantic.js +1 -1
- package/src/commands/clean.js +1 -2
- package/src/commands/config.js +1 -1
- package/src/commands/deploy.js +2 -2
- package/src/commands/fetch.js +1 -1
- package/src/commands/finish.js +3 -3
- package/src/commands/index.js +11 -11
- package/src/commands/merge.js +2 -2
- package/src/commands/prompts/branches.js +1 -1
- package/src/commands/publish-pages.js +1 -1
- package/src/commands/push.js +2 -2
- package/src/commands/rebase.js +5 -5
- package/src/commands/release.js +2 -18
- package/src/commands/republish.js +2 -2
- package/src/commands/start.js +5 -5
- package/src/commands/tasks/merge-branch.js +1 -1
- package/src/commands/tasks/push-branch.js +1 -1
- package/src/commands/tasks/rebase-all-branches.js +1 -1
- package/src/commands/tasks/refresh-repository.js +2 -3
- package/src/commands/tasks/run-test.js +1 -1
- package/src/commands/tasks/update-branch.js +1 -1
- package/src/commands/tasks/update-dependencies.js +3 -3
- package/src/commands/utils/check-install.js +2 -3
- package/src/common/cli/cli.js +2 -4
- package/src/common/cli/docker.js +1 -1
- package/src/common/cli/docker.test.js +13 -6
- package/src/common/cli/git.js +1 -1
- package/src/common/cli/git.test.js +9 -5
- package/src/common/cli/heroku.js +1 -1
- package/src/common/cli/heroku.test.js +10 -4
- package/src/common/cli/lerna.js +1 -1
- package/src/common/cli/lerna.test.js +9 -4
- package/src/common/cli/npm.js +4 -4
- package/src/common/cli/npm.test.js +10 -4
- package/src/common/cli/yarn.js +4 -4
- package/src/common/cli/yarn.test.js +9 -4
- package/src/common/configure-git-workspace.js +1 -1
- package/src/common/get-config.js +4 -24
- package/src/common/index.js +10 -10
- package/src/common/run-command.js +2 -2
- package/src/common/run-command.test.js +8 -4
- package/src/index.js +1 -1
- package/src/main.js +5 -5
- package/src/semantic-release/actions/analyze-commits.js +4 -2
- package/src/semantic-release/actions/fail.js +2 -2
- package/src/semantic-release/actions/generate-notes.js +3 -2
- package/src/semantic-release/actions/index.js +8 -8
- package/src/semantic-release/actions/prepare.js +7 -5
- package/src/semantic-release/actions/publish.js +3 -3
- package/src/semantic-release/actions/success.js +5 -3
- package/src/semantic-release/actions/verify-conditions.js +3 -2
- package/src/semantic-release/actions/verify-release.js +4 -2
- package/src/semantic-release/get-semantic-config.js +2 -2
- package/src/semantic-release/utils/bump-packages-version.test.js +4 -1
- package/src/semantic-release/utils/calculate-snapshot-version.js +1 -1
- package/src/semantic-release/utils/calculate-snapshot-version.test.js +10 -3
- package/src/semantic-release/utils/display-package-info.js +1 -1
- package/src/semantic-release/utils/display-release-info.js +1 -1
- package/src/semantic-release/utils/docker-clean-tags.js +1 -1
- package/src/semantic-release/utils/docker-clean-tags.test.js +12 -3
- package/src/semantic-release/utils/docker-publish.js +5 -2
- package/src/semantic-release/utils/docker-publish.test.js +33 -17
- package/src/semantic-release/utils/ghpages-publish.js +1 -1
package/bin/cm-changelog.js
CHANGED
package/bin/cm-clean.js
CHANGED
package/bin/cm-config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { commands, release, runCommand } from '../src/index.js'
|
|
3
|
+
|
|
4
|
+
import commander from 'commander'
|
|
4
5
|
|
|
5
6
|
commander
|
|
6
7
|
.usage('cmconfig')
|
|
@@ -11,4 +12,4 @@ commander
|
|
|
11
12
|
runCommand(commands.Config, {
|
|
12
13
|
verbose: commander.verbose
|
|
13
14
|
})
|
|
14
|
-
|
|
15
|
+
release()
|
package/bin/cm-deploy.js
CHANGED
package/bin/cm-fetch.js
CHANGED
package/bin/cm-finish.js
CHANGED
package/bin/cm-merge.js
CHANGED
package/bin/cm-publish-pages.js
CHANGED
package/bin/cm-publish.js
CHANGED
package/bin/cm-push.js
CHANGED
package/bin/cm-rebase.js
CHANGED
package/bin/cm-republish.js
CHANGED
package/bin/cm-start.js
CHANGED
package/bin/cm.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import commander from 'commander'
|
|
4
|
+
import fs from 'fs-extra'
|
|
5
|
+
import url from 'url'
|
|
6
|
+
import path from 'path'
|
|
7
|
+
|
|
8
|
+
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
|
9
|
+
const cliPkg = fs.readJsonSync(path.join(__dirname, '../package.json'))
|
|
5
10
|
|
|
6
11
|
commander
|
|
7
12
|
.version(cliPkg.version)
|
package/bin/cmrelease.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmflow/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.0",
|
|
4
4
|
"description": "An awesome Git Flow",
|
|
5
5
|
"author": "camfou",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"email": "camfou@gmail.com",
|
|
8
8
|
"main": "./src/index.js",
|
|
9
9
|
"module": "./src/main.js",
|
|
10
|
+
"type": "module",
|
|
10
11
|
"private": false,
|
|
11
12
|
"bin": {
|
|
12
13
|
"cm": "./bin/cm.js",
|
|
@@ -32,7 +33,6 @@
|
|
|
32
33
|
"commander": "5.1.0",
|
|
33
34
|
"conventional-changelog": "3.1.25",
|
|
34
35
|
"conventional-changelog-cli": "2.2.2",
|
|
35
|
-
"esm": "3.2.25",
|
|
36
36
|
"execa": "5.1.1",
|
|
37
37
|
"figures": "3.2.0",
|
|
38
38
|
"fs-extra": "^10.1.0",
|
|
@@ -41,23 +41,21 @@
|
|
|
41
41
|
"inquirer": "7.3.3",
|
|
42
42
|
"listr": "0.14.3",
|
|
43
43
|
"lodash": "4.17.20",
|
|
44
|
-
"rxjs": "
|
|
45
|
-
"semantic-release": "
|
|
44
|
+
"rxjs": "7.8.1",
|
|
45
|
+
"semantic-release": "22.0.7",
|
|
46
46
|
"semver": "7.3.7",
|
|
47
47
|
"split": "1.0.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"eslint": "7.15.0",
|
|
54
|
-
"eslint-config-standard": "16.0.2",
|
|
55
|
-
"eslint-plugin-import": "2.22.1",
|
|
50
|
+
"eslint": "8.53.0",
|
|
51
|
+
"eslint-config-standard": "17.1.0",
|
|
52
|
+
"eslint-plugin-import": "2.29.0",
|
|
56
53
|
"eslint-plugin-node": "11.1.0",
|
|
57
|
-
"eslint-plugin-promise": "
|
|
58
|
-
"eslint-plugin-standard": "
|
|
54
|
+
"eslint-plugin-promise": "6.1.1",
|
|
55
|
+
"eslint-plugin-standard": "5.0.0",
|
|
56
|
+
"eslint-plugin-n": "16.3.0",
|
|
59
57
|
"husky": "4.3.6",
|
|
60
|
-
"jest": "^
|
|
58
|
+
"jest": "^29.7.0",
|
|
61
59
|
"jest-junit": "^11.0.1",
|
|
62
60
|
"lint-staged": "10.5.3"
|
|
63
61
|
},
|
|
@@ -79,10 +77,10 @@
|
|
|
79
77
|
},
|
|
80
78
|
"scripts": {
|
|
81
79
|
"test": "yarn lint && yarn test_unit",
|
|
82
|
-
"test_unit": "jest",
|
|
83
|
-
"lint": "eslint -c .eslintrc src
|
|
84
|
-
"lint_ci": "eslint -c .eslintrc src
|
|
85
|
-
"lint_fix": "eslint -c .eslintrc src
|
|
80
|
+
"test_unit": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
81
|
+
"lint": "eslint -c .eslintrc {src,bin}/**/*.js",
|
|
82
|
+
"lint_ci": "eslint -c .eslintrc {src,bin}/**/*.js --format junit --output-file ./reports/eslint.xml",
|
|
83
|
+
"lint_fix": "eslint -c .eslintrc {src,bin}/**/*.js --fix",
|
|
86
84
|
"release": "node bin/cmrelease.js",
|
|
87
85
|
"release_dry_run": "node bin/cmrelease.js --dry-run",
|
|
88
86
|
"build_changelog": "node bin/cm-changelog.js"
|
package/release.config.js
CHANGED
package/semantic.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export * from './src/semantic-release/actions/index.js'
|
package/src/commands/clean.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
1
|
import chalk from 'chalk'
|
|
3
2
|
import figures from 'figures'
|
|
4
|
-
import { dockerCleanTags } from '../semantic-release/utils/docker-clean-tags'
|
|
3
|
+
import { dockerCleanTags } from '../semantic-release/utils/docker-clean-tags.js'
|
|
5
4
|
|
|
6
5
|
export class Clean {
|
|
7
6
|
mapContext (commander, context) {
|
package/src/commands/config.js
CHANGED
package/src/commands/deploy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
import figures from 'figures'
|
|
3
|
-
import { deployOnDockerHub, deployOnHeroku } from '../semantic-release/utils/docker-publish'
|
|
4
|
-
import { getConfig } from '../common'
|
|
3
|
+
import { deployOnDockerHub, deployOnHeroku } from '../semantic-release/utils/docker-publish.js'
|
|
4
|
+
import { getConfig } from '../common/index.js'
|
|
5
5
|
|
|
6
6
|
export class Deploy {
|
|
7
7
|
mapContext (commander, context) {
|
package/src/commands/fetch.js
CHANGED
package/src/commands/finish.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
import figures from 'figures'
|
|
3
|
-
import { Rebase } from './rebase'
|
|
4
|
-
import { git } from '../common/cli/git'
|
|
5
|
-
import { pushBranch } from './tasks/push-branch'
|
|
3
|
+
import { Rebase } from './rebase.js'
|
|
4
|
+
import { git } from '../common/cli/git.js'
|
|
5
|
+
import { pushBranch } from './tasks/push-branch.js'
|
|
6
6
|
|
|
7
7
|
export class Finish extends Rebase {
|
|
8
8
|
mapContext (commander, context) {
|
package/src/commands/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from './changelog'
|
|
2
|
-
export * from './finish'
|
|
3
|
-
export * from './fetch'
|
|
4
|
-
export * from './push'
|
|
5
|
-
export * from './start'
|
|
6
|
-
export * from './republish'
|
|
7
|
-
export * from './rebase'
|
|
8
|
-
export * from './publish-pages'
|
|
9
|
-
export * from './clean'
|
|
10
|
-
export * from './deploy'
|
|
11
|
-
export * from './merge'
|
|
1
|
+
export * from './changelog.js'
|
|
2
|
+
export * from './finish.js'
|
|
3
|
+
export * from './fetch.js'
|
|
4
|
+
export * from './push.js'
|
|
5
|
+
export * from './start.js'
|
|
6
|
+
export * from './republish.js'
|
|
7
|
+
export * from './rebase.js'
|
|
8
|
+
export * from './publish-pages.js'
|
|
9
|
+
export * from './clean.js'
|
|
10
|
+
export * from './deploy.js'
|
|
11
|
+
export * from './merge.js'
|
package/src/commands/merge.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
import figures from 'figures'
|
|
3
|
-
import { mergeBranch } from './tasks/merge-branch'
|
|
4
|
-
import { git } from '../common'
|
|
3
|
+
import { mergeBranch } from './tasks/merge-branch.js'
|
|
4
|
+
import { git } from '../common/cli/git.js'
|
|
5
5
|
|
|
6
6
|
export class Merge {
|
|
7
7
|
getTasks (context) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
import figures from 'figures'
|
|
3
|
-
import { ghPagesPublish } from '../semantic-release/utils/ghpages-publish'
|
|
3
|
+
import { ghPagesPublish } from '../semantic-release/utils/ghpages-publish.js'
|
|
4
4
|
|
|
5
5
|
export class PublishPages {
|
|
6
6
|
mapContext (commander, context) {
|
package/src/commands/push.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
import figures from 'figures'
|
|
3
|
-
import { Rebase } from './rebase'
|
|
4
|
-
import { pushBranch } from './tasks/push-branch'
|
|
3
|
+
import { Rebase } from './rebase.js'
|
|
4
|
+
import { pushBranch } from './tasks/push-branch.js'
|
|
5
5
|
|
|
6
6
|
export class Push extends Rebase {
|
|
7
7
|
mapContext (commander, context) {
|
package/src/commands/rebase.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
import figures from 'figures'
|
|
3
|
-
import { Fetch } from './fetch'
|
|
4
|
-
import { git } from '../common/cli/git'
|
|
5
|
-
import { updateBranch } from './tasks/update-branch'
|
|
6
|
-
import { updateDependencies } from './tasks/update-dependencies'
|
|
7
|
-
import { runTest } from './tasks/run-test'
|
|
3
|
+
import { Fetch } from './fetch.js'
|
|
4
|
+
import { git } from '../common/cli/git.js'
|
|
5
|
+
import { updateBranch } from './tasks/update-branch.js'
|
|
6
|
+
import { updateDependencies } from './tasks/update-dependencies.js'
|
|
7
|
+
import { runTest } from './tasks/run-test.js'
|
|
8
8
|
|
|
9
9
|
export class Rebase extends Fetch {
|
|
10
10
|
mapContext (commander, context) {
|
package/src/commands/release.js
CHANGED
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
const getNextVersion = require('semantic-release/lib/get-next-version')
|
|
3
|
-
const { calculateSnapshotVersion } = require('../semantic-release/utils/calculate-snapshot-version')
|
|
4
|
-
|
|
5
|
-
require.cache[require.resolve('semantic-release/lib/get-config')].exports = async (context, cliOptions) => {
|
|
6
|
-
context.config = require('../common/get-config').getConfig()
|
|
7
|
-
|
|
8
|
-
return getConfig(context, cliOptions)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
require.cache[require.resolve('semantic-release/lib/get-next-version')].exports = (context) => {
|
|
12
|
-
if (context.branch.type === 'prerelease') {
|
|
13
|
-
return calculateSnapshotVersion(context)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return getNextVersion(context)
|
|
17
|
-
}
|
|
1
|
+
import semantic_release from 'semantic-release'
|
|
18
2
|
|
|
19
3
|
delete process.env.CIRCLE_PR_NUMBER
|
|
20
4
|
delete process.env.CIRCLE_PULL_REQUEST
|
|
21
5
|
delete process.env.CI_PULL_REQUEST
|
|
22
6
|
|
|
23
7
|
export function release (options = {}) {
|
|
24
|
-
|
|
8
|
+
semantic_release({
|
|
25
9
|
dryRun: process.argv.includes('--dry-run'),
|
|
26
10
|
ci: false,
|
|
27
11
|
noCi: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
import figures from 'figures'
|
|
3
|
-
import { Fetch } from './fetch'
|
|
4
|
-
import { rebaseAllBranches } from './tasks/rebase-all-branches'
|
|
3
|
+
import { Fetch } from './fetch.js'
|
|
4
|
+
import { rebaseAllBranches } from './tasks/rebase-all-branches.js'
|
|
5
5
|
|
|
6
6
|
export class Republish extends Fetch {
|
|
7
7
|
mapContext (commander, context) {
|
package/src/commands/start.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
import figures from 'figures'
|
|
3
|
-
import { git } from '../common/cli/git'
|
|
4
|
-
import { branches } from './prompts/branches'
|
|
5
|
-
import { Fetch } from './fetch'
|
|
3
|
+
import { git } from '../common/cli/git.js'
|
|
4
|
+
import { branches } from './prompts/branches.js'
|
|
5
|
+
import { Fetch } from './fetch.js'
|
|
6
6
|
|
|
7
|
-
import { updateDependencies } from './tasks/update-dependencies'
|
|
8
|
-
import { WORKFLOW_CONFIGURATION } from '../workflow'
|
|
7
|
+
import { updateDependencies } from './tasks/update-dependencies.js'
|
|
8
|
+
import { WORKFLOW_CONFIGURATION } from '../workflow/index.js'
|
|
9
9
|
|
|
10
10
|
function sanitize (name) {
|
|
11
11
|
return name.replace(/[/\\_|. ]/gi, '-').split('-').filter(Boolean).join('-')
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { EMPTY } from 'rxjs'
|
|
2
|
-
import { catchError } from 'rxjs/operators'
|
|
1
|
+
import { EMPTY, catchError } from 'rxjs'
|
|
3
2
|
import Listr from 'listr'
|
|
4
|
-
import { git } from '../../common'
|
|
3
|
+
import { git } from '../../common/index.js'
|
|
5
4
|
|
|
6
5
|
function pipe (observable, output) {
|
|
7
6
|
observable.pipe(catchError((err) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
import Listr from 'listr'
|
|
3
|
-
import { git } from '../../common/cli/git'
|
|
3
|
+
import { git } from '../../common/cli/git.js'
|
|
4
4
|
|
|
5
5
|
async function checkBranchRemoteStatus ({ featureBranch, origin, force }) {
|
|
6
6
|
const isBranchExists = git.branchExists(featureBranch, origin)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { npm, yarn } from '../../common'
|
|
2
|
-
import { refreshMetadata, shouldReinstall } from '../utils/check-install'
|
|
1
|
+
import { npm, yarn } from '../../common/index.js'
|
|
2
|
+
import { refreshMetadata, shouldReinstall } from '../utils/check-install.js'
|
|
3
3
|
import Listr from 'listr'
|
|
4
|
-
import { catchError } from 'rxjs
|
|
4
|
+
import { catchError } from 'rxjs'
|
|
5
5
|
|
|
6
6
|
export const updateDependencies = ({ useYarn }) => {
|
|
7
7
|
const manager = useYarn ? yarn : npm
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import isEqual from 'lodash/isEqual'
|
|
2
|
-
import { getPackageJson } from '../../common/
|
|
3
|
-
import { git } from '../../common'
|
|
1
|
+
import isEqual from 'lodash/isEqual.js'
|
|
2
|
+
import { getPackageJson, git } from '../../common/index.js'
|
|
4
3
|
|
|
5
4
|
function getDeps () {
|
|
6
5
|
const pkg = getPackageJson()
|
package/src/common/cli/cli.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import 'any-observable/register/rxjs-all' // eslint-disable-line import/no-unassigned-import
|
|
1
|
+
import 'any-observable/register/rxjs-all.js' // eslint-disable-line import/no-unassigned-import
|
|
2
2
|
import execa from 'execa'
|
|
3
3
|
import streamToObservable from '@samverschueren/stream-to-observable'
|
|
4
|
-
import { filter, merge } from 'rxjs
|
|
4
|
+
import { filter, merge } from 'rxjs'
|
|
5
5
|
import split from 'split'
|
|
6
6
|
import { spawnSync } from 'child_process'
|
|
7
|
-
|
|
8
7
|
export class Cli {
|
|
9
8
|
constructor (cmd) {
|
|
10
9
|
this.cmd = cmd
|
|
@@ -74,7 +73,6 @@ export class Cli {
|
|
|
74
73
|
|
|
75
74
|
promise.sync = (opt) => {
|
|
76
75
|
isPromise = false
|
|
77
|
-
|
|
78
76
|
return execa.sync(cmd, args, {
|
|
79
77
|
cwd: process.cwd(),
|
|
80
78
|
stdio: 'inherit',
|
package/src/common/cli/docker.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import execa from 'execa'
|
|
3
|
-
import { docker } from './docker'
|
|
4
|
-
import { Cli } from './cli'
|
|
1
|
+
import { beforeEach, describe, expect, it, jest } from '@jest/globals'
|
|
5
2
|
|
|
6
|
-
jest.
|
|
7
|
-
jest.
|
|
3
|
+
jest.unstable_mockModule('axios', () => {
|
|
4
|
+
return { default: jest.fn() }
|
|
5
|
+
})
|
|
6
|
+
jest.unstable_mockModule('execa', () => {
|
|
7
|
+
const execaMock = jest.fn()
|
|
8
|
+
execaMock.sync = jest.fn()
|
|
9
|
+
return { default: execaMock }
|
|
10
|
+
})
|
|
11
|
+
const { default: execa } = await import('execa')
|
|
12
|
+
const { default: axios } = await import('axios')
|
|
13
|
+
const { docker } = await import('./docker.js')
|
|
14
|
+
const { Cli } = await import('./cli.js')
|
|
8
15
|
|
|
9
16
|
execa.mockReturnValue({})
|
|
10
17
|
|
package/src/common/cli/git.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { git } from './git'
|
|
3
|
-
import { Cli } from './cli'
|
|
4
|
-
|
|
5
|
-
jest.mock('execa')
|
|
1
|
+
import { beforeEach, describe, expect, it, jest } from '@jest/globals'
|
|
6
2
|
|
|
3
|
+
jest.unstable_mockModule('execa', () => {
|
|
4
|
+
const execaMock = jest.fn()
|
|
5
|
+
execaMock.sync = jest.fn()
|
|
6
|
+
return { default: execaMock }
|
|
7
|
+
})
|
|
8
|
+
const { default: execa } = await import('execa')
|
|
9
|
+
const { git } = await import('./git.js')
|
|
10
|
+
const { Cli } = await import('./cli.js')
|
|
7
11
|
execa.sync.mockImplementation((...args) => {
|
|
8
12
|
return {
|
|
9
13
|
stdout: `CMD: ${[].concat(...args.filter(arg => typeof arg === 'string' || Array.isArray(arg))).join(' ')}`
|
package/src/common/cli/heroku.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Cli } from './cli'
|
|
3
|
-
import { heroku } from './heroku'
|
|
1
|
+
import { beforeEach, describe, expect, it, jest } from '@jest/globals'
|
|
4
2
|
|
|
5
|
-
jest.
|
|
3
|
+
jest.unstable_mockModule('execa', () => {
|
|
4
|
+
const execaMock = jest.fn()
|
|
5
|
+
execaMock.sync = jest.fn()
|
|
6
|
+
return { default: execaMock }
|
|
7
|
+
})
|
|
8
|
+
const { default: execa } = await import('execa')
|
|
9
|
+
|
|
10
|
+
const { Cli } = await import('./cli.js')
|
|
11
|
+
const { heroku } = await import('./heroku.js')
|
|
6
12
|
|
|
7
13
|
execa.sync.mockImplementation((...args) => {
|
|
8
14
|
return {
|