Skip to content

Commit

Permalink
jest concurrent
Browse files Browse the repository at this point in the history
  • Loading branch information
olexandr13 committed Nov 14, 2024
1 parent 8425cd0 commit 50b18c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/frameworks/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {
getLineNumber,
getEndLineNumber,
getCode,
jest,
} = require('../utils');

module.exports = (ast, file = '', source = '', opts = {}) => {
Expand Down Expand Up @@ -128,6 +129,7 @@ module.exports = (ast, file = '', source = '', opts = {}) => {
}

if (path.isIdentifier({ name: 'test' }) || path.isIdentifier({ name: 'it' })) {
if (jest.isConcurrentTest(path.parent)) path = path.parentPath;
if (!hasStringOrTemplateArgument(path.parent)) return;

let code = '';
Expand Down
7 changes: 7 additions & 0 deletions src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,19 @@ const arrayCompare = function (a, b, id) {
};
};

const jest = {
isConcurrentTest: path => {
return path.property?.name === 'concurrent';
},
};

module.exports = {
hasStringArgument,
hasTemplateQuasi,
getLineNumber,
getEndLineNumber,
getCode,
jest,
hasTemplateArgument,
getQuasiArgument,
parseComments,
Expand Down

0 comments on commit 50b18c4

Please # to comment.