@putout/test 13.2.2 → 13.3.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/README.md CHANGED
@@ -201,7 +201,7 @@ test('putout: plugin: declare-undefined-variables: transform: assign: dismiss',
201
201
  });
202
202
  ```
203
203
 
204
- ### `noReport(filename)`
204
+ ### `noReport(filename [, plugins])`
205
205
 
206
206
  Check error message of a plugin not produces
207
207
 
@@ -212,6 +212,17 @@ test('plugin-putout: check-replace-code: no report: typescript', (t) => {
212
212
  });
213
213
  ```
214
214
 
215
+ with plugins:
216
+
217
+ ```js
218
+ test('plugin-putout: check-replace-code: no report: hello', (t) => {
219
+ t.noReport('typescript', [
220
+ ['plugin', plugin],
221
+ ]);
222
+ t.end();
223
+ });
224
+ ```
225
+
215
226
  ### `noReportCode(filename)`
216
227
 
217
228
  Check error message of a plugin not produces
package/lib/fixture.js CHANGED
@@ -43,12 +43,17 @@ module.exports.readFixture = (name, extension) => {
43
43
  throw eJS;
44
44
  };
45
45
 
46
- module.exports.writeFixture = ({full, code, extension}) => {
46
+ module.exports.writeFixFixture = ({full, code, extension}) => {
47
47
  const {writeFileSync} = global.__putout_test_fs;
48
48
  writeFileSync(`${full}-fix.${extension}`, code);
49
49
  };
50
50
 
51
- module.exports.rmFixture = (name) => {
51
+ module.exports.writeFixture = ({full, code, extension}) => {
52
+ const {writeFileSync} = global.__putout_test_fs;
53
+ writeFileSync(`${full}.${extension}`, code);
54
+ };
55
+
56
+ module.exports.rmFixture = (name, extension) => {
52
57
  const {unlinkSync} = global.__putout_test_fs;
53
58
 
54
59
  if (!isUpdate())
@@ -56,4 +61,5 @@ module.exports.rmFixture = (name) => {
56
61
 
57
62
  tryCatch(unlinkSync, `${name}.js`);
58
63
  tryCatch(unlinkSync, `${name}.ts`);
64
+ tryCatch(unlinkSync, `${name}.${extension}`);
59
65
  };
package/lib/test.js CHANGED
@@ -22,6 +22,7 @@ const {preTest} = require('./pre-test');
22
22
  const {
23
23
  readFixture,
24
24
  writeFixture,
25
+ writeFixFixture,
25
26
  rmFixture,
26
27
  } = require('./fixture');
27
28
 
@@ -320,7 +321,7 @@ const transform = currify((dir, linterOptions, options, t, name, transformed = n
320
321
  return fail(t, `'input' === 'output', use 'noTransform()'`);
321
322
 
322
323
  if (isUpdate() && !isStr) {
323
- writeFixture({
324
+ writeFixFixture({
324
325
  full,
325
326
  code,
326
327
  extension: currentExtension,
@@ -352,7 +353,7 @@ const transformWithOptions = currify((dir, linterOptions, options, t, name, plug
352
353
  });
353
354
 
354
355
  if (isUpdate()) {
355
- writeFixture({
356
+ writeFixFixture({
356
357
  full,
357
358
  code,
358
359
  extension: currentExtension,
@@ -410,7 +411,7 @@ const noTransform = currify((dir, linterOptions, options, t, name, addons = {})
410
411
  rmFixture(`${full}-fix`);
411
412
 
412
413
  const {plugins} = options;
413
- const [input, isTS] = readFixture(full, extension);
414
+ const [input, isTS, currentExtension] = readFixture(full, extension);
414
415
 
415
416
  const {code} = lint(input, {
416
417
  isTS,
@@ -425,7 +426,7 @@ const noTransform = currify((dir, linterOptions, options, t, name, addons = {})
425
426
  writeFixture({
426
427
  full,
427
428
  code,
428
- extension,
429
+ extension: currentExtension,
429
430
  });
430
431
 
431
432
  return t.pass('source fixture updated');
@@ -470,7 +471,8 @@ const report = (dir, linterOptions, options) => (t) => (name, message, plugins)
470
471
  return run(source, message, plugins);
471
472
  };
472
473
 
473
- const noReport = currify((dir, linterOptions, options, t, name) => {
474
+ const noReport = (dir, linterOptions, options) => (t) => (name, addons = []) => {
475
+ const {plugins} = options;
474
476
  const {lint, extension} = linterOptions;
475
477
  const full = join(dir, name);
476
478
  const [source, isTS] = readFixture(full, extension);
@@ -480,8 +482,12 @@ const noReport = currify((dir, linterOptions, options, t, name) => {
480
482
  return noReportCode(lint, {
481
483
  isTS,
482
484
  ...options,
485
+ plugins: [{
486
+ ...toObject(plugins),
487
+ ...toObject(addons),
488
+ }],
483
489
  }, t, source);
484
- });
490
+ };
485
491
 
486
492
  module.exports._createNoReport = noReport;
487
493
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/test",
3
- "version": "13.2.2",
3
+ "version": "13.3.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 ",