@putout/test 11.3.1 → 11.3.2
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 +6 -6
- package/lib/eslint/eslint.mjs +7 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ const test = createTest(import.meta.url, {
|
|
|
63
63
|
Check error message (or messages) of a plugin:
|
|
64
64
|
|
|
65
65
|
```js
|
|
66
|
-
test('remove useless variables:
|
|
66
|
+
test('remove useless variables: dot', (t) => {
|
|
67
67
|
t.report('dot', 'Dot files should be added to .gitignore');
|
|
68
68
|
t.end();
|
|
69
69
|
});
|
|
@@ -72,7 +72,7 @@ test('remove useless variables: for-of', (t) => {
|
|
|
72
72
|
When you want to check that report called exact count of times pass an array of messages:
|
|
73
73
|
|
|
74
74
|
```js
|
|
75
|
-
test('remove useless variables:
|
|
75
|
+
test('remove useless variables: dot', (t) => {
|
|
76
76
|
t.report('dot', ['Dot files should be added to .gitignore']);
|
|
77
77
|
t.end();
|
|
78
78
|
});
|
|
@@ -321,12 +321,12 @@ const test = createTest(__dirname, {
|
|
|
321
321
|
'remove-console': removeConsole,
|
|
322
322
|
});
|
|
323
323
|
|
|
324
|
-
test('remove-console: report', (t) => {
|
|
324
|
+
test('remove-console: report: property-identifier', (t) => {
|
|
325
325
|
t.report('property-identifier', 'Unexpected "console" call');
|
|
326
326
|
t.end();
|
|
327
327
|
});
|
|
328
328
|
|
|
329
|
-
test('remove-console: property
|
|
329
|
+
test('remove-console: property-identifier', (t) => {
|
|
330
330
|
t.transform('property-identifier');
|
|
331
331
|
t.end();
|
|
332
332
|
});
|
|
@@ -435,7 +435,7 @@ test('eslint-config: operator-line-break', async ({comparePlaces}) => {
|
|
|
435
435
|
### `transform(name)`
|
|
436
436
|
|
|
437
437
|
```js
|
|
438
|
-
test('test: eslint: transform', (t) => {
|
|
438
|
+
test('test: eslint: transform: remove-debugger', (t) => {
|
|
439
439
|
t.transform('remove-debugger');
|
|
440
440
|
t.end();
|
|
441
441
|
});
|
|
@@ -444,7 +444,7 @@ test('test: eslint: transform', (t) => {
|
|
|
444
444
|
### `report(filename, message | []messages)`
|
|
445
445
|
|
|
446
446
|
```js
|
|
447
|
-
test('test: eslint: report', (t) => {
|
|
447
|
+
test('test: eslint: report: remove-debugger', (t) => {
|
|
448
448
|
t.report('remove-debugger', `Avoid 'debugger' statement`);
|
|
449
449
|
t.end();
|
|
450
450
|
});
|
package/lib/eslint/eslint.mjs
CHANGED
|
@@ -75,7 +75,7 @@ export const createTest = (url, plugins = {}) => {
|
|
|
75
75
|
|
|
76
76
|
return extend({
|
|
77
77
|
process: (operator) => async (name, override) => {
|
|
78
|
-
const full = join(fixtureDir, name);
|
|
78
|
+
const full = join(fixtureDir, basename(name));
|
|
79
79
|
const [resolvedName, code] = await read(full);
|
|
80
80
|
const fix = true;
|
|
81
81
|
|
|
@@ -90,12 +90,16 @@ export const createTest = (url, plugins = {}) => {
|
|
|
90
90
|
},
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
+
const fixtureName = `${full}-fix`;
|
|
94
|
+
|
|
93
95
|
if (isUpdate()) {
|
|
94
|
-
|
|
96
|
+
const fixtureNameWithExt = `${fixtureName}${extname(resolvedName)}`;
|
|
97
|
+
update(fixtureNameWithExt, source);
|
|
98
|
+
|
|
95
99
|
return operator.pass('fixture updated');
|
|
96
100
|
}
|
|
97
101
|
|
|
98
|
-
const [, fixture] = await read(
|
|
102
|
+
const [, fixture] = await read(fixtureName);
|
|
99
103
|
|
|
100
104
|
return operator.equal(source, fixture);
|
|
101
105
|
},
|