@putout/test 12.0.1 → 13.0.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.
Files changed (3) hide show
  1. package/README.md +3 -3
  2. package/lib/test.js +20 -7
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -58,7 +58,7 @@ const test = createTest(import.meta.url, {
58
58
  });
59
59
  ```
60
60
 
61
- ### `report(filename, message: string | string[])`
61
+ ### `report(filename, message: string | string[], plugins?: PutoutPlugin[])`
62
62
 
63
63
  Check error message (or messages) of a plugin:
64
64
 
@@ -78,7 +78,7 @@ test('remove useless variables: dot', (t) => {
78
78
  });
79
79
  ```
80
80
 
81
- ### `reportCode(input, message)`
81
+ ### `reportCode(input: string, message: string | string[], plugins?: PutoutPlugins)`
82
82
 
83
83
  Check error message of a plugin from `input` code:
84
84
 
@@ -115,7 +115,7 @@ test('remove-console: property identifier: code', (t) => {
115
115
  });
116
116
  ```
117
117
 
118
- ### `reportWithOptions(filename, options)`
118
+ ### `reportWithOptions(filename, message: string | string[], options)`
119
119
 
120
120
  Check report of `filename.js` with `options`:
121
121
 
package/lib/test.js CHANGED
@@ -473,16 +473,20 @@ const noTransformCode = currify((lint, options, t, input) => {
473
473
 
474
474
  const getMessage = ({message}) => message;
475
475
 
476
- const report = (dir, lint, options) => (t) => (name, message) => {
476
+ const report = (dir, lint, options) => (t) => (name, message, plugins) => {
477
477
  checkReport(name, message);
478
478
 
479
479
  const full = join(dir, name);
480
480
  const [source, isTS] = readFixture(full);
481
481
 
482
- return reportCode(lint, {
482
+ const addT = reportCode(lint, {
483
483
  isTS,
484
484
  ...options,
485
- }, t, source, message);
485
+ });
486
+
487
+ const run = addT(t);
488
+
489
+ return run(source, message, plugins);
486
490
  };
487
491
 
488
492
  const noReport = currify((dir, lint, options, t, name) => {
@@ -542,11 +546,15 @@ const reportWithOptions = currify((dir, lint, options, t, name, message, ruleOpt
542
546
  [rule]: ['on', ruleOptions],
543
547
  };
544
548
 
545
- return reportCode(lint, {
549
+ const addT = reportCode(lint, {
546
550
  ...options,
547
551
  rules,
548
552
  isTS,
549
- }, t, source, message);
553
+ });
554
+
555
+ const run = addT(t);
556
+
557
+ return run(source, message);
550
558
  });
551
559
 
552
560
  const noReportWithOptions = currify((dir, lint, options, t, name, ruleOptions) => {
@@ -567,10 +575,15 @@ const noReportWithOptions = currify((dir, lint, options, t, name, ruleOptions) =
567
575
  }, t, source);
568
576
  });
569
577
 
570
- const reportCode = currify((lint, options, t, source, message) => {
578
+ const reportCode = (lint, options) => (t) => (source, message, addons) => {
579
+ const {plugins} = options;
571
580
  const {places} = lint(source, {
572
581
  fix: false,
573
582
  ...options,
583
+ plugins: [{
584
+ ...toObject(plugins),
585
+ ...addons,
586
+ }],
574
587
  });
575
588
 
576
589
  const resultMessages = places.map(getMessage);
@@ -579,7 +592,7 @@ const reportCode = currify((lint, options, t, source, message) => {
579
592
  return t.deepEqual(resultMessages, message);
580
593
 
581
594
  return t.equal(resultMessages[0], message);
582
- });
595
+ };
583
596
 
584
597
  const noReportCode = currify((lint, options, t, source) => {
585
598
  const {places} = lint(source, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/test",
3
- "version": "12.0.1",
3
+ "version": "13.0.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Test runner for 🐊Putout plugins ",
@@ -46,7 +46,7 @@
46
46
  "currify": "^4.0.0",
47
47
  "montag": "^1.2.1",
48
48
  "putout": "*",
49
- "supertape": "^10.0.0",
49
+ "supertape": "^11.0.3",
50
50
  "try-catch": "^3.0.0",
51
51
  "try-to-catch": "^3.0.0"
52
52
  },
@@ -58,7 +58,7 @@
58
58
  "runner"
59
59
  ],
60
60
  "devDependencies": {
61
- "@putout/eslint-flat": "^2.0.0",
61
+ "@putout/eslint-flat": "^3.0.0",
62
62
  "@putout/formatter-dump": "*",
63
63
  "@putout/formatter-progress": "*",
64
64
  "@putout/plugin-esm": "*",
@@ -69,15 +69,15 @@
69
69
  "c8": "^10.0.0",
70
70
  "eslint": "^9.0.0",
71
71
  "eslint-plugin-n": "^17.0.0",
72
- "eslint-plugin-putout": "^25.0.1",
73
- "madrun": "^10.0.0",
72
+ "eslint-plugin-putout": "^26.0.0",
73
+ "madrun": "^11.0.0",
74
74
  "mock-require": "^3.0.3",
75
75
  "nodemon": "^3.0.1",
76
76
  "strip-ansi": "^7.1.0"
77
77
  },
78
78
  "license": "MIT",
79
79
  "engines": {
80
- "node": ">=18"
80
+ "node": ">=20"
81
81
  },
82
82
  "publishConfig": {
83
83
  "access": "public"