@lightdash/cli 1.34.0 → 1.36.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/dist/.tsbuildinfo +1 -1
- package/dist/handlers/apps/appCodeFiles.d.ts +4 -8
- package/dist/handlers/apps/appCodeFiles.d.ts.map +1 -1
- package/dist/handlers/apps/appCodeFiles.js +20 -8
- package/dist/handlers/apps/appCodeFiles.test.js +37 -17
- package/dist/handlers/apps/appsDownload.d.ts +36 -26
- package/dist/handlers/apps/appsDownload.d.ts.map +1 -1
- package/dist/handlers/apps/appsDownload.js +53 -33
- package/dist/handlers/apps/appsDownload.test.js +126 -36
- package/dist/handlers/download.d.ts.map +1 -1
- package/dist/handlers/download.js +50 -83
- package/dist/handlers/download.test.js +30 -0
- package/dist/index.js +3 -3
- package/dist/terminal/contentAsCodeOutput.d.ts +1 -0
- package/dist/terminal/contentAsCodeOutput.d.ts.map +1 -1
- package/dist/terminal/contentAsCodeOutput.js +24 -0
- package/dist/terminal/contentAsCodeOutput.test.js +43 -0
- package/package.json +3 -3
|
@@ -125,6 +125,49 @@ describe('content as code terminal output', () => {
|
|
|
125
125
|
vi.unstubAllEnvs();
|
|
126
126
|
vi.restoreAllMocks();
|
|
127
127
|
});
|
|
128
|
+
it('pauses the spinner around a prompt and resumes with progress text', async () => {
|
|
129
|
+
const originalIsTTY = process.stderr.isTTY;
|
|
130
|
+
Object.defineProperty(process.stderr, 'isTTY', {
|
|
131
|
+
configurable: true,
|
|
132
|
+
value: true,
|
|
133
|
+
});
|
|
134
|
+
vi.stubEnv('CI', 'false');
|
|
135
|
+
vi.stubEnv('TERM', 'xterm');
|
|
136
|
+
vi.stubEnv('NO_UNICODE', 'false');
|
|
137
|
+
const spinner = {
|
|
138
|
+
text: '',
|
|
139
|
+
start: vi.fn(),
|
|
140
|
+
succeed: vi.fn(),
|
|
141
|
+
warn: vi.fn(),
|
|
142
|
+
stop: vi.fn(),
|
|
143
|
+
fail: vi.fn(),
|
|
144
|
+
};
|
|
145
|
+
vi.spyOn(globalState_1.default, 'startSpinner').mockReturnValue(spinner);
|
|
146
|
+
const output = (0, contentAsCodeOutput_1.createContentAsCodeOutput)({
|
|
147
|
+
operation: 'upload',
|
|
148
|
+
scope: 'project',
|
|
149
|
+
});
|
|
150
|
+
output.startItem('Data apps');
|
|
151
|
+
// The spinner must be stopped BEFORE the prompt runs (a spinning
|
|
152
|
+
// repaint hides the prompt and the command looks hung).
|
|
153
|
+
const answer = await output.promptWhilePaused(() => {
|
|
154
|
+
expect(spinner.stop).toHaveBeenCalledOnce();
|
|
155
|
+
expect(spinner.start).not.toHaveBeenCalled();
|
|
156
|
+
return Promise.resolve('yes');
|
|
157
|
+
});
|
|
158
|
+
expect(answer).toBe('yes');
|
|
159
|
+
expect(spinner.start).toHaveBeenCalledOnce();
|
|
160
|
+
expect(String(spinner.start.mock.calls[0][0])).toContain('Data apps');
|
|
161
|
+
// A rejecting prompt still resumes the spinner.
|
|
162
|
+
await expect(output.promptWhilePaused(() => Promise.reject(new Error('nope')))).rejects.toThrow('nope');
|
|
163
|
+
expect(spinner.start).toHaveBeenCalledTimes(2);
|
|
164
|
+
Object.defineProperty(process.stderr, 'isTTY', {
|
|
165
|
+
configurable: true,
|
|
166
|
+
value: originalIsTTY,
|
|
167
|
+
});
|
|
168
|
+
vi.unstubAllEnvs();
|
|
169
|
+
vi.restoreAllMocks();
|
|
170
|
+
});
|
|
128
171
|
it('updates the active tree item with resource progress', () => {
|
|
129
172
|
const originalIsTTY = process.stderr.isTTY;
|
|
130
173
|
Object.defineProperty(process.stderr, 'isTTY', {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.36.0",
|
|
4
4
|
"description": "Lightdash CLI tool",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"unique-names-generator": "4.7.1",
|
|
42
42
|
"uuid": "11.1.1",
|
|
43
43
|
"yaml": "2.8.3",
|
|
44
|
-
"@lightdash/
|
|
45
|
-
"@lightdash/
|
|
44
|
+
"@lightdash/common": "1.36.0",
|
|
45
|
+
"@lightdash/warehouses": "1.36.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/inquirer": "8.2.4",
|