Skip to content

Commit c1a88ab

Browse files
committed
fix: @putout/plugin-vitest: v3-apply-browser-instances: report after transform
1 parent 1be4d93 commit c1a88ab

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

packages/plugin-vitest/lib/v3-apply-browser-instances/fixture/v3-apply-browser-instances-fix.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ export default defineConfig({
22
test: {
33
browser: {
44
instances: [{
5-
instances: [{
6-
name: 'chromium',
7-
providerOptions: {
8-
launch: {
9-
devtools: true,
10-
},
5+
name: 'chromium',
6+
providerOptions: {
7+
launch: {
8+
devtools: true,
119
},
12-
}],
10+
},
1311
}],
1412
},
1513
},

packages/plugin-vitest/lib/v3-apply-browser-instances/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ module.exports.fix = ({path, properties}) => {
3636
module.exports.traverse = ({push}) => ({
3737
'defineConfig(__object)': (path) => {
3838
const {__object} = getTemplateValues(path, DEFINE_CONFIG);
39+
const [instancesPath] = traverseProperties(__object, 'instances');
40+
41+
if (instancesPath)
42+
return;
43+
3944
const [browserPath] = traverseProperties(__object, 'browser');
4045
const properties = browserPath.get('value.properties');
4146

packages/plugin-vitest/lib/v3-apply-browser-instances/index.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ test('vitest: v3-apply-browser-instances: transform', (t) => {
1818
t.transform('v3-apply-browser-instances');
1919
t.end();
2020
});
21+
22+
test('vitest: v3-apply-browser-instances: no report after transform', (t) => {
23+
t.noReportAfterTransform('v3-apply-browser-instances');
24+
t.end();
25+
});

packages/plugin-vitest/test/fixture/v3-apply-browser-instances-fix.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ export default defineConfig({
22
test: {
33
browser: {
44
instances: [{
5-
instances: [{
6-
name: 'chromium',
7-
providerOptions: {
8-
launch: {
9-
devtools: true,
10-
},
5+
name: 'chromium',
6+
providerOptions: {
7+
launch: {
8+
devtools: true,
119
},
12-
}],
10+
},
1311
}],
1412
},
1513
},

0 commit comments

Comments
 (0)