Skip to content

Commit

Permalink
fix[devtools/ci]: fixed incorrect condition calculation for @reactVer…
Browse files Browse the repository at this point in the history
…sion annotation
  • Loading branch information
hoxyq committed Jun 23, 2023
1 parent 70e998a commit e77934e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
35 changes: 15 additions & 20 deletions scripts/babel/transform-react-version-pragma.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,26 @@ function transform(babel) {
return null;
}

let conditions = null;
for (const line of comments) {
const commentStr = line.value.trim();
if (commentStr.startsWith(GATE_VERSION_STR)) {
const condition = t.stringLiteral(
commentStr.slice(GATE_VERSION_STR.length)
);
if (conditions === null) {
conditions = [condition];
} else {
conditions.push(condition);
}
const resultingCondition = comments.reduce((accumulatedCondition, commentLine) => {
const commentStr = commentLine.value.trim();

if (!commentStr.startsWith(GATE_VERSION_STR)) {
return accumulatedCondition;
}
}

if (conditions !== null) {
let condition = conditions[0];
for (let i = 1; i < conditions.length; i++) {
const right = conditions[i];
condition = t.logicalExpression('&&', condition, right);
const condition = commentStr.slice(GATE_VERSION_STR.length);
if (accumulatedCondition === null) {
return condition;
}
return condition;
} else {

return accumulatedCondition.concat(' ', condition);
}, null);

if (resultingCondition === null) {
return null;
}

return t.stringLiteral(resultingCondition);
}

return {
Expand Down
2 changes: 1 addition & 1 deletion scripts/circleci/run_devtools_e2e_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function runTestShell() {
// Assume the test shell server failed to start.
logError('Testing shell server failed to start');
exitWithCode(1);
}, 30000);
}, 60 * 1000);

logBright('Starting testing shell server');

Expand Down

0 comments on commit e77934e

Please sign in to comment.