Skip to content

Commit aa76ecb

Browse files
committed
feature: @putout/plugin-tape: remove-only: exclude not Identifier
1 parent ee4b52b commit aa76ecb

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const emitter = supertape.test.only(message1, fn1, {
2+
quiet: true,
3+
});

packages/plugin-tape/lib/remove-only/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ module.exports.replace = () => ({
88
});
99

1010
module.exports.filter = (path) => {
11-
const {name} = path.node.callee.object;
12-
return name.startsWith('test');
11+
const objectPath = path.get('callee.object');
12+
13+
if (!objectPath.isIdentifier())
14+
return false;
15+
16+
return objectPath.node.name.startsWith('test');
1317
};

packages/plugin-tape/lib/remove-only/index.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ test('plugin-remove-only: transform: other-name', (t) => {
3333
t.transform('other-name');
3434
t.end();
3535
});
36+
37+
test('plugin-remove-only: no report: member', (t) => {
38+
t.noReport('member');
39+
t.end();
40+
});

0 commit comments

Comments
 (0)