Skip to content

Commit 1672473

Browse files
committed
fix: fix typos
1 parent 84c0d79 commit 1672473

File tree

2 files changed

+64
-46
lines changed

2 files changed

+64
-46
lines changed

docs/reference/testplane-events.mdx

+26-15
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,27 @@ Or as follows: see the [example](#new_worker_process_usage) from the description
272272
The test runner has a `registerWorkers` method which registers the plugin code for parallel execution in the Testplane workers. The method takes the following parameters:
273273

274274
<table>
275-
<thead>
276-
<tr><td>**Parameter**</td><td>**Type**</td><td>**Description**</td></tr>
277-
</thead>
278-
<tbody>
279-
<tr><td>workerFilepath</td><td>String</td><td>Absolute path to the worker.</td></tr>
280-
<tr><td>exportedMethods</td><td>String[]</td><td>List of exported methods.</td></tr>
281-
282-
</tbody>
275+
<thead>
276+
<tr>
277+
<td>**Parameter**</td>
278+
<td>**Type**</td>
279+
<td>**Description**</td>
280+
</tr>
281+
</thead>
282+
<tbody>
283+
<tr>
284+
<td>workerFilepath</td>
285+
<td>String</td>
286+
<td>Absolute path to the worker.</td>
287+
</tr>
288+
<tr>
289+
<td>exportedMethods</td>
290+
<td>String[]</td>
291+
<td>List of exported methods.</td>
292+
</tr>
293+
294+
</tbody>
295+
283296
</table>
284297

285298
It returns an object which contains asynchronous functions with names from exported methods.
@@ -421,13 +434,13 @@ Click to see the code
421434
</summary>
422435

423436
```javascript
424-
const http = require('http');
425-
const parseConfig = require('./config');
437+
const http = require("http");
438+
const parseConfig = require("./config");
426439

427440
module.exports = (testplane, opts) => {
428441
const pluginConfig = parseConfig(opts);
429442

430-
if (!pluginConfig.enabled</td></tr> testplane.isWorker()) {
443+
if (!pluginConfig.enabled || testplane.isWorker()) {
431444
// either the plugin is disabled, or we are in the worker context – exit
432445
return;
433446
}
@@ -436,12 +449,10 @@ module.exports = (testplane, opts) => {
436449

437450
testplane.on(testplane.events.INIT, () => {
438451
// content served by the dev-server
439-
const content = '<h1>Hello, World!</h1>';
452+
const content = "<h1>Hello, World!</h1>";
440453

441454
// create a server and start listening on port 3000
442-
http
443-
.createServer((req, res) => res.end(content))
444-
.listen(3000);
455+
http.createServer((req, res) => res.end(content)).listen(3000);
445456

446457
// at http://localhost:3000/index.html it will serve: <h1>Hello, World!</h1>
447458
});

i18n/ru/docusaurus-plugin-content-docs/current/reference/testplane-events.mdx

+38-31
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,25 @@ module.exports = (testplane, opts) => {
273273
У раннера тестов есть метод `registerWorkers`, который регистрирует код плагина для параллельного выполнения в воркерах testplane. Метод принимает следующие параметры:
274274

275275
<table>
276-
<thead>
277-
<tr><td>**Параметр**</td><td>**Тип**</td><td>**Описание**</td></tr>
278-
</thead>
279-
<tbody>
280-
<tr><td>workerFilepath</td><td>String</td><td>Абсолютный путь к воркеру.</td></tr>
281-
<tr><td>exportedMethods</td><td>String[]</td><td>Список экспортируемых методов.</td></tr>
282-
283-
</tbody>
276+
<thead>
277+
<tr>
278+
<td>>**Параметр**</td>
279+
<td>**Тип**</td>
280+
<td>**Описание**</td>
281+
</tr>
282+
</thead>
283+
<tbody>
284+
<tr>
285+
<td>>workerFilepath</td>
286+
<td>String</td>
287+
<td>Абсолютный путь к воркеру.</td>
288+
</tr>
289+
<tr>
290+
<td>>exportedMethods</td>
291+
<td>String[]</td>
292+
<td>Список экспортируемых методов.</td>
293+
</tr>
294+
</tbody>
284295
</table>
285296

286297
При этом возвращает объект, который содержит асинхронные функции с именами из экспортированных методов.
@@ -360,22 +371,22 @@ testplane.on(testplane.events.CLI, cli => {
360371
</summary>
361372

362373
```javascript
363-
const parseConfig = require('./config');
374+
const parseConfig = require("./config");
364375

365376
module.exports = (testplane, opts) => {
366377
const pluginConfig = parseConfig(opts);
367378

368-
if (!pluginConfig.enabled <tr><td>testplane.isWorker()) {
379+
if (!pluginConfig.enabled || testplane.isWorker()) {
369380
// или плагин отключен, или мы находимся в контексте воркера – уходим
370381
return;
371382
}
372383

373-
testplane.on(testplane.events.CLI, (cli) => {
384+
testplane.on(testplane.events.CLI, cli => {
374385
// добавляем опцию --repeat
375386
cli.option(
376-
'--repeat <number>',
377-
'how many times tests should be repeated regardless of the result',
378-
(value) => parseNonNegativeInteger(value, 'repeat')
387+
"--repeat <number>",
388+
"how many times tests should be repeated regardless of the result",
389+
value => parseNonNegativeInteger(value, "repeat"),
379390
);
380391
});
381392

@@ -422,13 +433,13 @@ testplane.on(testplane.events.INIT, async () => {
422433
</summary>
423434

424435
```javascript
425-
const http = require('http');
426-
const parseConfig = require('./config');
436+
const http = require("http");
437+
const parseConfig = require("./config");
427438

428439
module.exports = (testplane, opts) => {
429440
const pluginConfig = parseConfig(opts);
430441

431-
if (!pluginConfig.enabled</td></tr> testplane.isWorker()) {
442+
if (!pluginConfig.enabled || testplane.isWorker()) {
432443
// или плагин отключен, или мы находимся в контексте воркера – уходим
433444
return;
434445
}
@@ -437,12 +448,10 @@ module.exports = (testplane, opts) => {
437448

438449
testplane.on(testplane.events.INIT, () => {
439450
// контент, который отдает dev-сервер
440-
const content = '<h1>Hello, World!</h1>';
451+
const content = "<h1>Hello, World!</h1>";
441452

442453
// создаем сервер и начинаем слушать порт 3000
443-
http
444-
.createServer((req, res) => res.end(content))
445-
.listen(3000);
454+
http.createServer((req, res) => res.end(content)).listen(3000);
446455

447456
// по адресу http://localhost:3000/index.html будет отдаваться: <h1>Hello, World!</h1>
448457
});
@@ -1495,45 +1504,43 @@ module.exports = (testplane, opts) => {
14951504
**Код плагина**
14961505

14971506
```javascript
1498-
const http = require('http');
1499-
const parseConfig = require('./config');
1507+
const http = require("http");
1508+
const parseConfig = require("./config");
15001509

15011510
module.exports = (testplane, opts) => {
15021511
const pluginConfig = parseConfig(opts);
15031512

1504-
if (!pluginConfig.enabled <tr><td>testplane.isWorker()) {
1513+
if (!pluginConfig.enabled || testplane.isWorker()) {
15051514
// или плагин отключен, или мы находимся в контексте воркера – уходим
15061515
return;
15071516
}
15081517

15091518
let program;
15101519

1511-
testplane.on(testplane.events.CLI, (cli) => {
1520+
testplane.on(testplane.events.CLI, cli => {
15121521
// нужно сохранить ссылку на инстанс commander'а (https://github.com/tj/commander.js),
15131522
// чтобы потом проверить наличие опции
15141523
program = cli;
15151524
// добавляем к testplane опцию --dev-server,
15161525
// чтобы пользователь мог явно указывать, когда надо запустить dev-сервер
1517-
cli.option('--dev-server', 'run dev-server');
1526+
cli.option("--dev-server", "run dev-server");
15181527
});
15191528

15201529
testplane.on(testplane.events.INIT, () => {
15211530
// dev-сервер может быть запущен как через указание опции --dev-server
15221531
// при запуске testplane, так и в настройках плагина
1523-
const devServer = program && program.devServer</td></tr> pluginConfig.devServer;
1532+
const devServer = (program && program.devServer) || pluginConfig.devServer;
15241533

15251534
if (!devServer) {
15261535
// если dev-сервер запускать не нужно – уходим
15271536
return;
15281537
}
15291538

15301539
// контент, который отдает dev-сервер
1531-
const content = '<h1>Hello, World!</h1>';
1540+
const content = "<h1>Hello, World!</h1>";
15321541

15331542
// создаем сервер и начинаем слушать порт 3000
1534-
http
1535-
.createServer((req, res) => res.end(content))
1536-
.listen(3000);
1543+
http.createServer((req, res) => res.end(content)).listen(3000);
15371544

15381545
// по адресу http://localhost:3000/index.html будет отдаваться: <h1>Hello, World!</h1>
15391546
});

0 commit comments

Comments
 (0)