Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix[devtools/ci]: fixed incorrect condition calculation for @reactVersion annotation #26997

Merged
merged 1 commit into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import path from 'path';
import {rimrafSync} from 'rimraf';

describe('x_google_ignoreList source map extension', () => {
jest.setTimeout(30 * 1000);
jest.setTimeout(60 * 1000);

const pathToExtensionsPackage = path.resolve(__dirname, '..', '..');
const pathToChromeExtensionBuild = path.join(
Expand Down
40 changes: 19 additions & 21 deletions scripts/babel/transform-react-version-pragma.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,29 @@ 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;
}

const condition = commentStr.slice(GATE_VERSION_STR.length);
if (accumulatedCondition === null) {
return condition;
}
}
}

if (conditions !== null) {
let condition = conditions[0];
for (let i = 1; i < conditions.length; i++) {
const right = conditions[i];
condition = t.logicalExpression('&&', condition, right);
}
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