@putout/test 13.2.2 → 13.2.3
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/lib/fixture.js +8 -2
- package/lib/test.js +5 -4
- package/package.json +1 -1
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.
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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');
|