desktop.test.ts
22.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
/**
* 图形界面这一层的离线测试。运行:npm test
*
* 界面本身不测(要点按钮),测的是它依赖的判据:默认值从哪来、目录能看见什么、
* 参数什么时候不让跑、跑完那张总结上的数字。最后两题是真跑一遍 worker:
* 一次全程不碰接口,一次确认缺 Key 时它会停下来等人,而不是闷头报错。
*/
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { describe, test } from 'node:test';
import { Worker } from 'node:worker_threads';
import {
DEFAULT_RADII, ROOT, browse, cachePathOf, configState, formIssue, jobOf,
loadState, metersOf, onlyListIssue, onlyListNotice, outputNotice, outputOf, saveState,
stageText, summaryOf,
} from '../src/desktop-core.ts';
import type { UiState } from '../src/desktop-core.ts';
import { atomicCsv } from '../src/csv-store.ts';
import type { Report } from '../src/fill.ts';
import { listHeader } from '../src/lists.ts';
import type { WorkerOut } from '../src/desktop-worker.ts';
import { DEFAULTS } from '../src/run-tool.ts';
import { HEADER, tempRoot } from './helpers.ts';
const state = (overrides: Partial<UiState> = {}): UiState => ({
input: '',
outputDir: '',
outputName: '',
cache: 'D:/cache/amap_regeo_cache.sqlite3',
onlyList: '',
workers: 20,
qps: 100,
limit: null,
inferNearby: false,
streetMeters: DEFAULT_RADII.street,
roadMeters: DEFAULT_RADII.road,
sortIncompleteLast: true,
...overrides,
});
const report = (overrides: Partial<Report> = {}): Report => ({
exit_code: 0,
rows: 100,
address_complete_rows: 60,
no_api_rows: 70,
lookup_coordinates: 30,
cache_hits: 10,
requests: 20,
nearby_rows: 0,
reconciled_rows: 0,
review_hint_rows: 0,
cells_by_source: { 表内原有: 40, 地址解析: 120, 接口缓存: 10, 地图接口: 30 },
blank_cells: 0,
statuses: { 完整: 100 },
list_rows: {},
list_files: {},
only_list_rows: 0,
elapsed_seconds: 12.5,
stop_reason: '',
output: 'D:/out/结果.已补全.csv',
log: 'D:/out/结果.已补全.处理日志.csv',
cache: 'D:/cache/amap_regeo_cache.sqlite3',
...overrides,
});
describe('界面上的默认值', () => {
test('config.json 的相对路径按配置文件所在目录展开', () => {
const root = tempRoot('desktop cfg ');
const file = path.join(root, 'config.json');
fs.writeFileSync(file, JSON.stringify({ ...DEFAULTS,
input: '资料/出险.csv', cache: 'cache/x.sqlite3' }), 'utf8');
const loaded = configState(file);
assert.equal(loaded.input, path.join(root, '资料/出险.csv'));
assert.equal(loaded.cache, path.join(root, 'cache/x.sqlite3'));
assert.equal(loaded.workers, 20);
assert.equal(loaded.inferNearby, false);
});
test('半径默认值跟着字段登记处走,不在界面上另写一份', () => {
assert.deepEqual(DEFAULT_RADII, { street: metersOf('street'), road: metersOf('road') });
assert.deepEqual([DEFAULT_RADII.street, DEFAULT_RADII.road], [300, 150]);
});
test('上次的路径与参数会盖过配置默认值', () => {
const root = tempRoot('desktop state ');
const base = state({ input: 'D:/配置/出险.csv' });
const file = path.join(root, 'ui-state.json');
saveState(state({ ...base, input: 'D:/上次/出险.csv', workers: 5, limit: 20 }), file);
const loaded = loadState(file, base);
assert.equal(loaded.input, 'D:/上次/出险.csv');
assert.equal(loaded.workers, 5);
assert.equal(loaded.limit, 20);
});
test('界面记录文件坏了或被人塞了 Key,也不能把界面卡住、不能把 Key 留下', () => {
const root = tempRoot('desktop badstate ');
const base = state();
const file = path.join(root, 'ui-state.json');
fs.writeFileSync(file, '{ 这不是 JSON', 'utf8');
assert.deepEqual(loadState(file, base), base);
fs.writeFileSync(file, JSON.stringify({ ...base, BAIDU_KEY: 'DUMMY_NOT_A_REAL_KEY' }), 'utf8');
saveState(loadState(file, base), file);
assert.doesNotMatch(fs.readFileSync(file, 'utf8'), /DUMMY_NOT_A_REAL_KEY/);
});
});
describe('目录浏览', () => {
test('只列目录和表格文件,隐藏 . 与 Excel 临时文件', () => {
const root = tempRoot('desktop browse ');
fs.mkdirSync(path.join(root, '子目录'));
fs.writeFileSync(path.join(root, '出险.csv'), '');
fs.writeFileSync(path.join(root, '说明.txt'), '');
fs.writeFileSync(path.join(root, '.隐藏.csv'), '');
fs.writeFileSync(path.join(root, '~$出险.xlsx'), '');
const listed = browse(root);
assert.deepEqual(listed.entries.map((entry) => entry.name), ['子目录', '出险.csv']);
assert.equal(listed.dir, root);
assert.equal(listed.parent, path.dirname(root));
});
test('选缓存时列 .sqlite3,不列表格', () => {
const root = tempRoot('desktop browse cache ');
fs.writeFileSync(path.join(root, '已查.sqlite3'), '');
fs.writeFileSync(path.join(root, '出险.csv'), '');
const listed = browse(root, ['.sqlite3']);
assert.deepEqual(listed.entries.map((entry) => entry.name), ['已查.sqlite3']);
});
test('目录不存在时说人话,不丢一个错误码', () => {
const root = tempRoot('desktop browse miss ');
assert.throws(() => browse(path.join(root, '没有这个目录')), { name: 'UserError' });
});
test('给到文件路径时列它所在目录', () => {
const root = tempRoot('desktop browse file ');
fs.writeFileSync(path.join(root, '出险.csv'), '');
assert.equal(browse(path.join(root, '出险.csv')).dir, root);
});
});
describe('能不能开始跑', () => {
test('没选文件、文件不认得、输出撞源文件都被挡住', () => {
assert.match(formIssue(state()), /先选择/);
const root = tempRoot('desktop form ');
const text = path.join(root, '说明.txt');
fs.writeFileSync(text, 'x');
const missing = state({ input: path.join(root, '不存在.csv') });
assert.match(formIssue(missing), /找不到文件/);
const wrong = state({ input: text });
assert.match(formIssue(wrong), /不认得的表格格式/);
const csv = path.join(root, '出险.csv');
fs.writeFileSync(csv, 'a,b');
const same = state({ input: csv, outputDir: root, outputName: '出险.csv' });
assert.match(formIssue(same), /不允许直接覆盖源文件/);
assert.equal(formIssue(state({ input: csv })), '');
});
test('邻近打开时半径要是正整数,关闭时不检查', () => {
const root = tempRoot('desktop radius ');
const csv = path.join(root, '出险.csv');
fs.writeFileSync(csv, 'a,b');
assert.match(formIssue(state({ input: csv, inferNearby: true, streetMeters: 0 })), /街道半径/);
assert.match(formIssue(state({ input: csv, inferNearby: true, roadMeters: 9000 })), /道路半径/);
assert.equal(formIssue(state({ input: csv, inferNearby: false, roadMeters: 0 })), '');
});
test('并发与限流的边界', () => {
const root = tempRoot('desktop numbers ');
const csv = path.join(root, '出险.csv');
fs.writeFileSync(csv, 'a,b');
assert.match(formIssue(state({ input: csv, workers: 0 })), /并发数量/);
assert.match(formIssue(state({ input: csv, workers: 500 })), /最大 200/);
assert.match(formIssue(state({ input: csv, qps: -1 })), /每秒请求上限/);
assert.match(formIssue(state({ input: csv, limit: 0 })), /前几行/);
});
});
/** 手工写一份工具生成的清单,界面只认这个形状;行按表头补齐空格 */
function listFile(root: string, name: string, header: string[], rows: string[][]): string {
const file = path.join(root, name);
const padded = rows.map((row) => [...row, ...Array.from({ length: header.length - row.length }, () => '')]);
atomicCsv(file, header, padded);
return file;
}
describe('续跑清单', () => {
test('留空不校验;不是 CSV、读不到、找不到都要当场说,不等跑完', () => {
const root = tempRoot('desktop list ');
assert.equal(onlyListIssue(''), '');
const other = path.join(root, '别的.xlsx');
fs.writeFileSync(other, 'x');
assert.match(onlyListIssue(other), /补齐工具生成的 CSV/);
assert.match(onlyListIssue(path.join(root, '没有.csv')), /找不到清单/);
const notList = listFile(root, '随手.限流待重试.csv', ['案件号', '街道'], [['A1', '光明']]);
assert.match(onlyListNotice(notList), /不是补齐工具生成的清单/);
});
test('界面告诉人这份清单记了多少行、按哪一列认行', () => {
const root = tempRoot('desktop list read ');
const withId = listFile(root, '限流.限流待重试.csv', listHeader(HEADER), [
['2', '4', '00000000000000000001', '', '', '', '', '', '', '', '街道、道路', '请求失败', '', '', ''],
['3', '5', '00000000000000000002', '', '', '', '', '', '', '', '道路', '请求失败', '', '', ''],
]);
assert.match(onlyListNotice(withId), /记了 2 行/);
assert.match(onlyListNotice(withId), /按「案件号」认行/);
const byLine = listFile(root, '旧清单.限流待重试.csv', listHeader(['出险地点', '经度', '纬度']), [
['2', '4', '', '', '', '街道、道路', '请求失败', '', '', ''],
['3', '5', '', '', '', '道路', '请求失败', '', '', ''],
]);
assert.match(onlyListNotice(byLine), /按「原表行号」认行/);
});
test('清单挡在开始前:坏清单不许跑,好清单原样交给 runJob', () => {
const root = tempRoot('desktop list job ');
const csv = path.join(root, '出险.csv');
fs.writeFileSync(csv, 'a,b');
const elsewhere = path.join(root, '没有.csv');
assert.match(formIssue(state({ input: csv, onlyList: elsewhere })), /找不到清单/);
const list = listFile(root, '限流.限流待重试.csv', listHeader(HEADER),
[['2', '4', '00000000000000000001', '', '', '', '', '', '', '', '', '', '', '', '']]);
assert.equal(formIssue(state({ input: csv, onlyList: list })), '');
assert.equal(jobOf(state({ input: csv, onlyList: list })).options.onlyList, list);
assert.equal(jobOf(state({ input: csv })).options.onlyList, '');
});
test('清单路径不写进上次的记录:换一张表不会带着旧清单跑', () => {
const root = tempRoot('desktop list state ');
const file = path.join(root, 'ui-state.json');
const list = path.join(root, '限流.csv');
saveState(state({ onlyList: list }), file);
assert.equal(JSON.parse(fs.readFileSync(file, 'utf8')).onlyList, undefined);
assert.equal(loadState(file, state({ onlyList: 'D:/别/的.csv' })).onlyList, '');
});
});
describe('输出文件名', () => {
test('留空按输入格式生成,落在源文件旁,只填名字补后缀', () => {
const excel = state({ input: 'D:/资料/出险.xlsx' });
assert.equal(outputOf(excel), path.join('D:/资料', 'out', '出险.已补全.xlsx'));
assert.equal(outputOf({ ...excel, outputName: '结果' }),
path.join('D:/资料', 'out', '结果.xlsx'));
assert.equal(outputOf({ ...excel, outputDir: 'D:/输出', outputName: '结果.csv' }),
path.join('D:/输出', '结果.csv'));
assert.equal(outputOf(state({ input: 'D:/资料/出险.csv' })),
path.join('D:/资料', 'out', '出险.已补全.csv'));
});
test('输出已存在时先说会覆盖,而不是跑完才发现', () => {
const root = tempRoot('desktop notice ');
const csv = path.join(root, '出险.csv');
fs.writeFileSync(csv, 'a,b');
fs.writeFileSync(path.join(root, '出险.已补全.csv'), 'old');
assert.match(outputNotice(state({ input: csv, outputDir: root })), /会覆盖/);
fs.rmSync(path.join(root, '出险.已补全.csv'));
const notice = outputNotice(state({ input: csv, outputDir: root }));
assert.match(notice, /^输出:.*日志:/);
assert.ok(notice.includes(path.join(root, '.temp')), '日志路径应指向源文件旁的 .temp');
});
test('交给跑活的参数带上了半径覆盖、全量,以及跟着源文件的 .temp', () => {
const root = tempRoot('desktop job ');
const csv = path.join(root, '出险.csv');
fs.writeFileSync(csv, 'a,b');
const job = jobOf(state({ input: csv, inferNearby: true, roadMeters: 80, limit: null }));
assert.equal(job.input, csv);
assert.equal(job.options.inferNearby, true);
assert.deepEqual(job.options.nearbyMeters, { street: DEFAULT_RADII.street, road: 80 });
assert.equal(job.options.limit, null);
assert.equal(job.options.tempDir, path.join(root, '.temp'));
const custom = jobOf(state({ input: csv, outputDir: path.join(root, '自定义输出') }));
assert.equal(path.dirname(custom.output), path.join(root, '自定义输出'));
assert.equal(custom.options.tempDir, path.join(root, '.temp'), '输出换地方,日志仍跟着源文件');
assert.equal(formIssue(state({ input: csv })), '');
});
test('缓存路径留空时跟着源文件,填了就按工具目录展开', () => {
const root = tempRoot('desktop cache path ');
const csv = path.join(root, '出险.csv');
fs.writeFileSync(csv, 'a,b');
assert.equal(cachePathOf(state({ input: csv, cache: '' })),
path.join(root, 'cache', 'amap_regeo_cache.sqlite3'));
assert.equal(cachePathOf(state({ input: '', cache: '' })), '', '还没选文件时没有可放的位置');
assert.equal(cachePathOf(state({ cache: 'cache/x.sqlite3' })),
path.join(ROOT, 'cache/x.sqlite3'));
const elsewhere = path.join(root, '移动硬盘', 'amap_regeo_cache.sqlite3');
assert.equal(cachePathOf(state({ cache: elsewhere })), elsewhere);
});
test('config.json 里 cache 留空时保持留空,交给源文件决定', () => {
const root = tempRoot('desktop cfg blank cache ');
const file = path.join(root, 'config.json');
fs.writeFileSync(file, JSON.stringify({ ...DEFAULTS, cache: '' }), 'utf8');
assert.equal(configState(file).cache, '');
});
});
describe('跑完那张总结', () => {
test('数字按人问的顺序排,接口和免费的两档分得清', () => {
const summary = summaryOf(report());
const text = summary.rows.map((row) => `${row.label}=${row.value}`).join('\n');
assert.match(text, /处理多少行=100 行/);
assert.match(text, /只靠原值和地址=60 行(这三列本来就写着,或从地址文本读出)/);
assert.match(text, /一行接口都没调=70 行(原值、地址、历史缓存与邻近推断够用,或本轮没轮到)/);
assert.match(text, /问了地图接口=20 次(要查的坐标 30 个,同一位置只问一次)/);
assert.match(text, /从已查过的坐标直接取=10 个坐标,没有花费/);
assert.doesNotMatch(text, /区名按实测订正/, '没有订正就不占一栏');
assert.doesNotMatch(text, /附近地点/, '邻近没开就不提这一档');
assert.match(text, /耗时=13 秒/);
assert.equal(summary.caution, '');
});
test('订正区名时把行数和理由写进总结', () => {
const text = summaryOf(report({ reconciled_rows: 24 })).rows
.map((row) => `${row.label}=${row.value}`).join('\n');
assert.match(text, /区名按实测订正=24 行(地址第 3 段写错区,按接口实测街道所属区订正,备注留痕)/);
});
test('推断值与空白要说清来源,停了也要说下次怎么接着跑', () => {
const nearby = summaryOf(report({
exit_code: 2, nearby_rows: 5, statuses: { 完整: 95, 部分缺失: 5 },
}));
const text = nearby.rows.map((row) => `${row.label}=${row.value}`).join('\n');
assert.match(text, /用附近地点推断=5 行/);
assert.match(nearby.caution, /部分缺失 5 行/);
const stopped = summaryOf(report({ exit_code: 130, stop_reason: '用户中断', statuses: { 未处理: 3 } }));
assert.match(stopped.caution, /停在「用户中断」/);
assert.match(stopped.caution, /已查过的不再花钱/);
});
test('正在做的事:有进度就报数,没进度只报这一件事', () => {
assert.equal(stageText('调用地图接口', 20, 100), '正在问地图接口(20 / 100)');
assert.equal(stageText('读取表格'), '正在读取表格,文件大时要等一会儿');
assert.match(stageText('准备调用接口', undefined, 1234), /1,234/);
assert.equal(stageText('写出本次清单', undefined, 2), '正在写出本次的清单');
});
test('清单的行数与文件都进总结,开没开「只跑清单」也说得清', () => {
const summary = summaryOf(report({
exit_code: 2, statuses: { 完整: 98, 请求失败: 2 },
list_rows: { 限流待重试: 2, 补不出: 1, 待复核: 0 },
list_files: {
限流待重试: 'D:/out/结果.限流待重试.csv',
补不出: 'D:/out/结果.补不出.csv',
},
only_list_rows: 2,
}));
const text = summary.rows.map((row) => `${row.label}=${row.value}`).join('\n');
assert.match(text, /本次按清单只跑=2 行/);
assert.match(text, /限流没问成=2 行(同一输入、同一缓存再点一次开始就会补上)/);
assert.match(text, /怎么跑都补不出=1 行/);
assert.doesNotMatch(text, /填上了但值得看一眼/, '没有这一类就不占总结一行');
assert.deepEqual(summary.files.map((file) => file.label),
['补齐后的表格', '处理日志', '已查坐标缓存', '限流待重试', '补不出']);
});
});
/** 真跑一遍 worker:全程用地址文本与本地缓存,不碰网络。 */
type DoneEvent = Extract<WorkerOut, { type: 'done' }>;
type ErrorEvent = Extract<WorkerOut, { type: 'error' }>;
async function runWorker(jobData: unknown, reply?: (event: WorkerOut) => string | null,
stopOn?: WorkerOut['type']) {
const events: WorkerOut[] = [];
const worker = new Worker(new URL('../src/desktop-worker.ts', import.meta.url), {
workerData: jobData,
});
await new Promise<void>((resolve, reject) => {
worker.on('message', (event: WorkerOut) => {
events.push(event);
if (stopOn !== undefined && event.type === stopOn) worker.postMessage({ type: 'stop' });
const answer = reply?.(event) ?? null;
if (answer !== null) worker.postMessage({ type: 'key', value: answer });
});
worker.on('error', reject);
worker.on('exit', () => resolve());
});
return events;
}
const findDone = (events: WorkerOut[]): DoneEvent => {
const found = events.find((event): event is DoneEvent => event.type === 'done');
assert.ok(found, '应当报一次完成');
return found;
};
function tableFile(rows: string[][]): string {
const root = tempRoot('desktop run ');
const file = path.join(root, '出险.csv');
atomicCsv(file, HEADER, rows);
return file;
}
describe('worker 真跑一遍', () => {
test('地址里三项都写着时,一次接口都不调也把表写完', async () => {
const input = tableFile([
['00000000000000000001', '广东省-深圳市-光明区-凤凰街道光源四路贝特瑞大厦', '46023.1',
'113.936672', '22.7405', '', '', ''],
['00000000000000000002', '广东省-深圳市-光明区-凤凰街道光源四路贝特瑞大厦', '46023.2',
'113.936672', '22.7405', '', '', ''],
]);
const cache = path.join(path.dirname(input), 'cache/x.sqlite3');
const temp = path.join(path.dirname(input), '.temp');
const events = await runWorker({
job: {
input, output: path.join(path.dirname(input), '结果.已补全.csv'), cache,
options: { limit: null, workers: 5, qps: 100, inferNearby: false,
nearbyMeters: DEFAULT_RADII, sortIncompleteLast: true, onlyList: '', tempDir: temp },
},
key: '',
});
const done = findDone(events);
assert.equal(done.report.rows, 2);
assert.equal(done.report.requests, 0);
assert.equal(done.report.lookup_coordinates, 0);
assert.equal(done.report.cells_by_source['地址解析'], 6);
assert.equal(done.report.blank_cells, 0);
const labels = events.flatMap((event) => (event.type === 'stage' ? [event.label] : []));
assert.deepEqual(labels.slice(0, 3), ['读取表格', '解析地址文本', '查缓存']);
assert.ok(labels.includes('写出表格'));
assert.ok(fs.existsSync(done.report.output));
assert.equal(done.report.log, path.join(temp, '结果.已补全.处理日志.csv'));
assert.ok(fs.existsSync(done.report.log));
assert.equal(fs.existsSync(path.join(path.dirname(input), '结果.已补全.处理日志.csv')), false,
'日志不落在表格旁边');
});
test('缺 Key 时停下来等人填,不闷头报错', async () => {
const input = tableFile([
['00000000000000000003', '广东省-深圳市-光明区', '46023.1', '113.936672', '22.7405', '', '', ''],
]);
const events = await runWorker({
job: {
input, output: path.join(path.dirname(input), '结果.已补全.csv'),
cache: path.join(path.dirname(input), 'cache/y.sqlite3'),
options: { limit: null, workers: 1, qps: 100, inferNearby: false,
nearbyMeters: DEFAULT_RADII, sortIncompleteLast: true, onlyList: '',
tempDir: path.join(path.dirname(input), '.temp') },
},
key: '',
}, (event) => (event.type === 'key-needed' ? '' : null));
assert.ok(events.some((event) => event.type === 'key-needed'), '应当先问人要 Key');
const failure = events.find((event): event is ErrorEvent => event.type === 'error');
assert.ok(failure, '没有 Key 应当报一条看得懂的错误');
assert.match(failure.message, /没填百度 AK/);
assert.match(failure.message, /不会再花钱/);
assert.match(failure.message, /没有写出文件/, '还没写文件,就不能说表格已经生成');
});
test('等 Key 的时候点停止,线程要退出,不挂在等 Key 上', async () => {
const input = tableFile([
['00000000000000000004', '广东省-深圳市-光明区', '46023.1', '113.936672', '22.7405', '', '', ''],
]);
const events = await runWorker({
job: {
input, output: path.join(path.dirname(input), '结果.已补全.csv'),
cache: path.join(path.dirname(input), 'cache/z.sqlite3'),
options: { limit: null, workers: 1, qps: 100, inferNearby: false,
nearbyMeters: DEFAULT_RADII, sortIncompleteLast: true, onlyList: '',
tempDir: path.join(path.dirname(input), '.temp') },
},
key: '',
}, undefined, 'key-needed');
const failure = events.find((event): event is ErrorEvent => event.type === 'error');
assert.ok(failure, '停下来也要报一条结果,而不是让页面一直转');
assert.match(failure.message, /按你的意思停下/);
assert.match(failure.message, /没有写出文件/);
});
});