@ohos-ports/tarojs-cli 0.0.0-stage → 4.3.0-beta.1
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/LICENSE +174 -0
- package/README.md +0 -3
- package/bin/taro +7 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +252 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/customCommand.d.ts +5 -0
- package/dist/commands/customCommand.js +23 -0
- package/dist/commands/customCommand.js.map +1 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.js +10 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/packagesManagement.d.ts +19 -0
- package/dist/config/packagesManagement.js +22 -0
- package/dist/config/packagesManagement.js.map +1 -0
- package/dist/create/constants.d.ts +1 -0
- package/dist/create/constants.js +5 -0
- package/dist/create/constants.js.map +1 -0
- package/dist/create/creator.d.ts +9 -0
- package/dist/create/creator.js +31 -0
- package/dist/create/creator.js.map +1 -0
- package/dist/create/fetchTemplate.d.ts +8 -0
- package/dist/create/fetchTemplate.js +137 -0
- package/dist/create/fetchTemplate.js.map +1 -0
- package/dist/create/page.d.ts +65 -0
- package/dist/create/page.js +252 -0
- package/dist/create/page.js.map +1 -0
- package/dist/create/plugin.d.ts +16 -0
- package/dist/create/plugin.js +48 -0
- package/dist/create/plugin.js.map +1 -0
- package/dist/create/project.d.ts +80 -0
- package/dist/create/project.js +519 -0
- package/dist/create/project.js.map +1 -0
- package/dist/doctor/index.d.ts +4 -0
- package/dist/doctor/index.js +32 -0
- package/dist/doctor/index.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/presets/commands/build.d.ts +3 -0
- package/dist/presets/commands/build.js +239 -0
- package/dist/presets/commands/build.js.map +1 -0
- package/dist/presets/commands/config.d.ts +3 -0
- package/dist/presets/commands/config.js +88 -0
- package/dist/presets/commands/config.js.map +1 -0
- package/dist/presets/commands/create.d.ts +3 -0
- package/dist/presets/commands/create.js +91 -0
- package/dist/presets/commands/create.js.map +1 -0
- package/dist/presets/commands/global-config.d.ts +3 -0
- package/dist/presets/commands/global-config.js +139 -0
- package/dist/presets/commands/global-config.js.map +1 -0
- package/dist/presets/commands/help.d.ts +3 -0
- package/dist/presets/commands/help.js +29 -0
- package/dist/presets/commands/help.js.map +1 -0
- package/dist/presets/commands/info.d.ts +3 -0
- package/dist/presets/commands/info.js +79 -0
- package/dist/presets/commands/info.js.map +1 -0
- package/dist/presets/commands/init.d.ts +3 -0
- package/dist/presets/commands/init.js +59 -0
- package/dist/presets/commands/init.js.map +1 -0
- package/dist/presets/commands/inspect.d.ts +3 -0
- package/dist/presets/commands/inspect.js +118 -0
- package/dist/presets/commands/inspect.js.map +1 -0
- package/dist/presets/commands/update.d.ts +3 -0
- package/dist/presets/commands/update.js +171 -0
- package/dist/presets/commands/update.js.map +1 -0
- package/dist/presets/constant/hooks.d.ts +13 -0
- package/dist/presets/constant/hooks.js +17 -0
- package/dist/presets/constant/hooks.js.map +1 -0
- package/dist/presets/constant/index.d.ts +1 -0
- package/dist/presets/constant/index.js +18 -0
- package/dist/presets/constant/index.js.map +1 -0
- package/dist/presets/files/generateFrameworkInfo.d.ts +3 -0
- package/dist/presets/files/generateFrameworkInfo.js +30 -0
- package/dist/presets/files/generateFrameworkInfo.js.map +1 -0
- package/dist/presets/files/generateProjectConfig.d.ts +3 -0
- package/dist/presets/files/generateProjectConfig.js +40 -0
- package/dist/presets/files/generateProjectConfig.js.map +1 -0
- package/dist/presets/files/writeFileToDist.d.ts +3 -0
- package/dist/presets/files/writeFileToDist.js +17 -0
- package/dist/presets/files/writeFileToDist.js.map +1 -0
- package/dist/presets/hooks/build.d.ts +3 -0
- package/dist/presets/hooks/build.js +22 -0
- package/dist/presets/hooks/build.js.map +1 -0
- package/dist/presets/hooks/create.d.ts +3 -0
- package/dist/presets/hooks/create.js +11 -0
- package/dist/presets/hooks/create.js.map +1 -0
- package/dist/presets/index.d.ts +4 -0
- package/dist/presets/index.js +17 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/presets/platforms/plugin.d.ts +3 -0
- package/dist/presets/platforms/plugin.js +76 -0
- package/dist/presets/platforms/plugin.js.map +1 -0
- package/dist/presets/platforms/rn.d.ts +3 -0
- package/dist/presets/platforms/rn.js +101 -0
- package/dist/presets/platforms/rn.js.map +1 -0
- package/dist/util/appConfig.d.ts +11 -0
- package/dist/util/appConfig.js +25 -0
- package/dist/util/appConfig.js.map +1 -0
- package/dist/util/createPage.d.ts +9 -0
- package/dist/util/createPage.js +117 -0
- package/dist/util/createPage.js.map +1 -0
- package/dist/util/defineConfig.d.ts +17 -0
- package/dist/util/defineConfig.js +12 -0
- package/dist/util/defineConfig.js.map +1 -0
- package/dist/util/index.d.ts +23 -0
- package/dist/util/index.js +125 -0
- package/dist/util/index.js.map +1 -0
- package/dist/util/types.d.ts +58 -0
- package/dist/util/types.js +3 -0
- package/dist/util/types.js.map +1 -0
- package/global.d.ts +4 -0
- package/index.js +3 -0
- package/package.json +76 -4
- package/postinstall.js +14 -0
- package/src/__tests__/__mocks__/presets.ts +15 -0
- package/src/__tests__/build-config.spec.ts +99 -0
- package/src/__tests__/cli.spec.ts +233 -0
- package/src/__tests__/config.spec.ts +232 -0
- package/src/__tests__/doctor-config.spec.ts +805 -0
- package/src/__tests__/doctor-eslint.spec.ts +31 -0
- package/src/__tests__/doctor-recommand.spec.ts +158 -0
- package/src/__tests__/doctor.spec.ts +77 -0
- package/src/__tests__/dotenv-parse.spec.ts +105 -0
- package/src/__tests__/env/.env +2 -0
- package/src/__tests__/fixtures/default/.env +3 -0
- package/src/__tests__/fixtures/default/.env.development +1 -0
- package/src/__tests__/fixtures/default/.env.local +1 -0
- package/src/__tests__/fixtures/default/.env.pre +3 -0
- package/src/__tests__/fixtures/default/.env.production +1 -0
- package/src/__tests__/fixtures/default/.env.uat +5 -0
- package/src/__tests__/fixtures/default/.env.uat.local +1 -0
- package/src/__tests__/fixtures/default/babel.config.js +10 -0
- package/src/__tests__/fixtures/default/config/dev.js +9 -0
- package/src/__tests__/fixtures/default/config/index.js +84 -0
- package/src/__tests__/fixtures/default/config/prod.js +18 -0
- package/src/__tests__/fixtures/default/package.json +38 -0
- package/src/__tests__/fixtures/default/src/app.config.js +11 -0
- package/src/__tests__/fixtures/default/src/app.js +16 -0
- package/src/__tests__/fixtures/default/src/app.scss +0 -0
- package/src/__tests__/fixtures/default/src/index.html +19 -0
- package/src/__tests__/fixtures/default/src/pages/index/index.config.js +3 -0
- package/src/__tests__/fixtures/default/src/pages/index/index.jsx +22 -0
- package/src/__tests__/fixtures/default/src/pages/index/index.scss +0 -0
- package/src/__tests__/info.spec.ts +74 -0
- package/src/__tests__/inspect.spec.ts +163 -0
- package/src/__tests__/project.spec.ts +304 -0
- package/src/__tests__/update.spec.ts +324 -0
- package/src/__tests__/utils/index.ts +54 -0
- package/src/cli.ts +250 -0
- package/src/commands/customCommand.ts +26 -0
- package/src/config/index.ts +7 -0
- package/src/config/manifest.default.json +35 -0
- package/src/config/packagesManagement.ts +20 -0
- package/src/config/rn-stylelint.json +5 -0
- package/src/config/tsconfig.json +24 -0
- package/src/create/constants.ts +1 -0
- package/src/create/creator.ts +37 -0
- package/src/create/fetchTemplate.ts +152 -0
- package/src/create/page.ts +299 -0
- package/src/create/plugin.ts +55 -0
- package/src/create/project.ts +591 -0
- package/src/doctor/index.ts +27 -0
- package/src/index.ts +24 -0
- package/src/presets/commands/build.ts +227 -0
- package/src/presets/commands/config.ts +86 -0
- package/src/presets/commands/create.ts +105 -0
- package/src/presets/commands/global-config.ts +140 -0
- package/src/presets/commands/help.ts +19 -0
- package/src/presets/commands/info.ts +77 -0
- package/src/presets/commands/init.ts +66 -0
- package/src/presets/commands/inspect.ts +138 -0
- package/src/presets/commands/update.ts +179 -0
- package/src/presets/constant/hooks.ts +14 -0
- package/src/presets/constant/index.ts +1 -0
- package/src/presets/files/generateFrameworkInfo.ts +30 -0
- package/src/presets/files/generateProjectConfig.ts +41 -0
- package/src/presets/files/writeFileToDist.ts +17 -0
- package/src/presets/hooks/build.ts +22 -0
- package/src/presets/hooks/create.ts +11 -0
- package/src/presets/index.ts +15 -0
- package/src/presets/platforms/plugin.ts +81 -0
- package/src/presets/platforms/rn.ts +113 -0
- package/src/util/appConfig.ts +29 -0
- package/src/util/createPage.ts +132 -0
- package/src/util/defineConfig.ts +22 -0
- package/src/util/index.ts +127 -0
- package/src/util/types.ts +81 -0
- package/templates/default/.husky/commit-msg +4 -0
- package/templates/default/_editorconfig +12 -0
- package/templates/default/_env.development +2 -0
- package/templates/default/_env.production +1 -0
- package/templates/default/_env.test +1 -0
- package/templates/default/_eslintrc +11 -0
- package/templates/default/_gitignore +8 -0
- package/templates/default/babel.config.js +14 -0
- package/templates/default/commitlint.config.mjs +1 -0
- package/templates/default/config/dev.js +10 -0
- package/templates/default/config/index.js +106 -0
- package/templates/default/config/prod.js +46 -0
- package/templates/default/package.json.tmpl +158 -0
- package/templates/default/project.config.json +15 -0
- package/templates/default/src/app.config.js +11 -0
- package/templates/default/src/app.css +0 -0
- package/templates/default/src/app.js +44 -0
- package/templates/default/src/index.html +17 -0
- package/templates/default/src/pages/index/index.config.js +3 -0
- package/templates/default/src/pages/index/index.css +0 -0
- package/templates/default/src/pages/index/index.jsx +15 -0
- package/templates/default/src/pages/index/index.vue +23 -0
- package/templates/default/stylelint.config.mjs +4 -0
- package/templates/default/template_creator.js +77 -0
- package/templates/default/tsconfig.json +32 -0
- package/templates/default/types/global.d.ts +35 -0
- package/templates/default/types/solid.d.ts +12 -0
- package/templates/default/types/vue.d.ts +10 -0
- package/templates/global-config/index.json +4 -0
- package/templates/global-config/package.json +5 -0
- package/templates/plugin-compile/README.md +32 -0
- package/templates/plugin-compile/index.js +3 -0
- package/templates/plugin-compile/package.json.tmpl +43 -0
- package/templates/plugin-compile/src/index.ts +153 -0
- package/templates/plugin-compile/tsconfig.json +29 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import * as path from 'node:path'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
fs,
|
|
5
|
+
getUserHomeDir,
|
|
6
|
+
TARO_BASE_CONFIG,
|
|
7
|
+
TARO_CONFIG_FOLDER
|
|
8
|
+
} from '@tarojs/helper'
|
|
9
|
+
import {
|
|
10
|
+
CONFIG_DIR_NAME,
|
|
11
|
+
DEFAULT_CONFIG_FILE
|
|
12
|
+
} from '@tarojs/service/src/utils/constants'
|
|
13
|
+
|
|
14
|
+
import { run } from './utils'
|
|
15
|
+
|
|
16
|
+
jest.mock('@tarojs/helper', () => {
|
|
17
|
+
const helper = jest.requireActual('@tarojs/helper')
|
|
18
|
+
const fs = helper.fs
|
|
19
|
+
return {
|
|
20
|
+
__esModule: true,
|
|
21
|
+
...helper,
|
|
22
|
+
getUserHomeDir: jest.fn(),
|
|
23
|
+
fs: {
|
|
24
|
+
...fs,
|
|
25
|
+
existsSync: jest.fn(),
|
|
26
|
+
readJSONSync: jest.fn(),
|
|
27
|
+
writeJSONSync: jest.fn(),
|
|
28
|
+
ensureFileSync: jest.fn()
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const runConfig = run('config', ['commands/config'])
|
|
34
|
+
|
|
35
|
+
describe('config', () => {
|
|
36
|
+
const getUserHomeDirMocked = getUserHomeDir as jest.Mock<any>
|
|
37
|
+
const existsSyncMocked = fs.existsSync as jest.Mock<any>
|
|
38
|
+
const readJSONSyncMocked = fs.readJSONSync as jest.Mock<any>
|
|
39
|
+
const writeJSONSyncMocked = fs.writeJSONSync as jest.Mock<any>
|
|
40
|
+
const ensureFileSyncMocked = fs.ensureFileSync as jest.Mock<any>
|
|
41
|
+
const appPath = '/'
|
|
42
|
+
|
|
43
|
+
beforeEach(() => {
|
|
44
|
+
getUserHomeDirMocked.mockReturnValue(appPath)
|
|
45
|
+
// Note: 设置项目配置文件为不存在,config 指令不一定在项目内执行,故而当前测试跳过配置(与过往配置保持一致,后续可视情况调整)
|
|
46
|
+
existsSyncMocked.mockImplementation((filePath = '') =>
|
|
47
|
+
!filePath.includes(path.join(appPath, CONFIG_DIR_NAME, DEFAULT_CONFIG_FILE))
|
|
48
|
+
)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
afterEach(() => {
|
|
52
|
+
getUserHomeDirMocked.mockReset()
|
|
53
|
+
existsSyncMocked.mockReset()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('should exit because can\'t find home dir', async () => {
|
|
57
|
+
const logSpy = jest.spyOn(console, 'log')
|
|
58
|
+
logSpy.mockImplementation(() => {})
|
|
59
|
+
|
|
60
|
+
getUserHomeDirMocked.mockReturnValue('')
|
|
61
|
+
|
|
62
|
+
await runConfig(appPath)
|
|
63
|
+
|
|
64
|
+
expect(logSpy).toBeCalledWith('找不到用户根目录')
|
|
65
|
+
logSpy.mockRestore()
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it('should warn when getting config without args key', async () => {
|
|
69
|
+
const logSpy = jest.spyOn(console, 'log')
|
|
70
|
+
logSpy.mockImplementation(() => {})
|
|
71
|
+
|
|
72
|
+
await runConfig(appPath, { args: ['get'] })
|
|
73
|
+
|
|
74
|
+
expect(logSpy).toBeCalledWith('Usage: taro config get <key>')
|
|
75
|
+
logSpy.mockRestore()
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('should get config', async () => {
|
|
79
|
+
const key = 'k'
|
|
80
|
+
const value = 'v'
|
|
81
|
+
const configPath = path.join('/', `${TARO_CONFIG_FOLDER}/${TARO_BASE_CONFIG}`)
|
|
82
|
+
|
|
83
|
+
const logSpy = jest.spyOn(console, 'log')
|
|
84
|
+
logSpy.mockImplementation(() => {})
|
|
85
|
+
readJSONSyncMocked.mockImplementation(() => ({
|
|
86
|
+
[key]: value
|
|
87
|
+
}))
|
|
88
|
+
|
|
89
|
+
await runConfig(appPath, { args: ['get', key] })
|
|
90
|
+
|
|
91
|
+
expect(logSpy).nthCalledWith(1, `Config path: ${configPath}`)
|
|
92
|
+
expect(logSpy).nthCalledWith(2)
|
|
93
|
+
expect(logSpy).nthCalledWith(3, `key: ${key}, value: ${value}`)
|
|
94
|
+
|
|
95
|
+
logSpy.mockRestore()
|
|
96
|
+
readJSONSyncMocked.mockReset()
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
it('should warn when getting config without args value', async () => {
|
|
100
|
+
const logSpy = jest.spyOn(console, 'log')
|
|
101
|
+
logSpy.mockImplementation(() => {})
|
|
102
|
+
|
|
103
|
+
await runConfig(appPath, { args: ['set', 'k'] })
|
|
104
|
+
|
|
105
|
+
expect(logSpy).toBeCalledWith('Usage: taro config set <key> <value>')
|
|
106
|
+
logSpy.mockRestore()
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it('should set config', async () => {
|
|
110
|
+
const key = 'k'
|
|
111
|
+
const value = 'v'
|
|
112
|
+
const configPath = path.join('/', `${TARO_CONFIG_FOLDER}/${TARO_BASE_CONFIG}`)
|
|
113
|
+
|
|
114
|
+
const logSpy = jest.spyOn(console, 'log')
|
|
115
|
+
logSpy.mockImplementation(() => {})
|
|
116
|
+
readJSONSyncMocked.mockReturnValue({ a: 1 })
|
|
117
|
+
|
|
118
|
+
await runConfig(appPath, { args: ['set', key, value] })
|
|
119
|
+
|
|
120
|
+
expect(writeJSONSyncMocked).toBeCalledWith(configPath, {
|
|
121
|
+
a: 1,
|
|
122
|
+
[key]: value
|
|
123
|
+
})
|
|
124
|
+
expect(logSpy).nthCalledWith(1, `Config path: ${configPath}`)
|
|
125
|
+
expect(logSpy).nthCalledWith(2)
|
|
126
|
+
expect(logSpy).nthCalledWith(3, `set key: ${key}, value: ${value}`)
|
|
127
|
+
|
|
128
|
+
logSpy.mockRestore()
|
|
129
|
+
readJSONSyncMocked.mockReset()
|
|
130
|
+
writeJSONSyncMocked.mockClear()
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
it('should set config with init', async () => {
|
|
134
|
+
const key = 'k'
|
|
135
|
+
const value = 'v'
|
|
136
|
+
const configPath = path.join('/', `${TARO_CONFIG_FOLDER}/${TARO_BASE_CONFIG}`)
|
|
137
|
+
|
|
138
|
+
const logSpy = jest.spyOn(console, 'log')
|
|
139
|
+
logSpy.mockImplementation(() => {})
|
|
140
|
+
existsSyncMocked.mockReturnValue(false)
|
|
141
|
+
|
|
142
|
+
await runConfig(appPath, { args: ['set', key, value] })
|
|
143
|
+
|
|
144
|
+
expect(ensureFileSyncMocked).toBeCalledWith(configPath)
|
|
145
|
+
expect(writeJSONSyncMocked).toBeCalledWith(configPath, { [key]: value })
|
|
146
|
+
expect(logSpy).toBeCalledWith(`set key: ${key}, value: ${value}`)
|
|
147
|
+
|
|
148
|
+
logSpy.mockRestore()
|
|
149
|
+
existsSyncMocked.mockReset()
|
|
150
|
+
ensureFileSyncMocked.mockClear()
|
|
151
|
+
writeJSONSyncMocked.mockClear()
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
it('should warn when deleting config without args key', async () => {
|
|
155
|
+
const logSpy = jest.spyOn(console, 'log')
|
|
156
|
+
logSpy.mockImplementation(() => {})
|
|
157
|
+
|
|
158
|
+
await runConfig(appPath, { args: ['delete'] })
|
|
159
|
+
|
|
160
|
+
expect(logSpy).toBeCalledWith('Usage: taro config delete <key>')
|
|
161
|
+
logSpy.mockRestore()
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
it('should delete config', async () => {
|
|
165
|
+
const key = 'k'
|
|
166
|
+
const configPath = path.join('/', `${TARO_CONFIG_FOLDER}/${TARO_BASE_CONFIG}`)
|
|
167
|
+
|
|
168
|
+
const logSpy = jest.spyOn(console, 'log')
|
|
169
|
+
logSpy.mockImplementation(() => {})
|
|
170
|
+
readJSONSyncMocked.mockReturnValue({
|
|
171
|
+
a: 1,
|
|
172
|
+
[key]: 'v'
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
await runConfig(appPath, { args: ['delete', key] })
|
|
176
|
+
|
|
177
|
+
expect(writeJSONSyncMocked).toBeCalledWith(configPath, { a: 1 })
|
|
178
|
+
expect(logSpy).nthCalledWith(1, `Config path: ${configPath}`)
|
|
179
|
+
expect(logSpy).nthCalledWith(2)
|
|
180
|
+
expect(logSpy).nthCalledWith(3, `deleted: ${key}`)
|
|
181
|
+
|
|
182
|
+
logSpy.mockRestore()
|
|
183
|
+
readJSONSyncMocked.mockReset()
|
|
184
|
+
writeJSONSyncMocked.mockClear()
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
it('should list config', async () => {
|
|
188
|
+
const configPath = path.join('/', `${TARO_CONFIG_FOLDER}/${TARO_BASE_CONFIG}`)
|
|
189
|
+
const logSpy = jest.spyOn(console, 'log')
|
|
190
|
+
logSpy.mockImplementation(() => {})
|
|
191
|
+
readJSONSyncMocked.mockReturnValue({
|
|
192
|
+
a: 1,
|
|
193
|
+
b: 2
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
await runConfig(appPath, { args: ['list'] })
|
|
197
|
+
|
|
198
|
+
expect(logSpy).nthCalledWith(1, `Config path: ${configPath}`)
|
|
199
|
+
expect(logSpy).nthCalledWith(2)
|
|
200
|
+
expect(logSpy).nthCalledWith(3, 'Config info:')
|
|
201
|
+
expect(logSpy).nthCalledWith(4, 'a=1')
|
|
202
|
+
expect(logSpy).nthCalledWith(5, 'b=2')
|
|
203
|
+
|
|
204
|
+
logSpy.mockRestore()
|
|
205
|
+
readJSONSyncMocked.mockReset()
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
it('should list config in json', async () => {
|
|
209
|
+
const configPath = path.join('/', `${TARO_CONFIG_FOLDER}/${TARO_BASE_CONFIG}`)
|
|
210
|
+
const logSpy = jest.spyOn(console, 'log')
|
|
211
|
+
logSpy.mockImplementation(() => {})
|
|
212
|
+
readJSONSyncMocked.mockReturnValue({
|
|
213
|
+
a: 1,
|
|
214
|
+
b: 2
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
await runConfig(appPath, {
|
|
218
|
+
args: ['list'],
|
|
219
|
+
options: {
|
|
220
|
+
json: true
|
|
221
|
+
}
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
expect(logSpy).nthCalledWith(1, `Config path: ${configPath}`)
|
|
225
|
+
expect(logSpy).nthCalledWith(2)
|
|
226
|
+
expect(logSpy).nthCalledWith(3, 'Config info:')
|
|
227
|
+
expect(logSpy).nthCalledWith(4, JSON.stringify({ a: 1, b: 2 }, null, 2))
|
|
228
|
+
|
|
229
|
+
logSpy.mockRestore()
|
|
230
|
+
readJSONSyncMocked.mockReset()
|
|
231
|
+
})
|
|
232
|
+
})
|