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

[CCI] Add bluebird replaces for src/dev #4027

Closed

Conversation

Nicksqain
Copy link
Contributor

Description

Issues Resolved

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
    • yarn test:ftr
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Signed-off-by: Alexei Karikov <karikov.alist.ru@gmail.com>
const bluebird = require('bluebird');
bluebird.Promise.setScheduler(function (fn) {
global.setImmediate.call(global, fn);
queueMicrotask(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't quite figured it out, so I'm not sure what the right solution is, can you tell me what the right solution should be?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could just removing Bluebird here. The scheduler will no longer be set to use setImmediate, and will use the default native Promise scheduling instead. Unless the code depends on the specific scheduling behavior of Bluebird, this should not be a problem.

const MutationObserver = require('mutation-observer');
Object.defineProperty(window, 'MutationObserver', { value: MutationObserver });

require('whatwg-fetch');

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anan is right; being a Jest polyfill, we will know if we have a problem instantly due to test failures.

@codecov
Copy link

codecov bot commented May 14, 2023

Codecov Report

Merging #4027 (6002f59) into main (0188d05) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #4027      +/-   ##
==========================================
+ Coverage   66.44%   66.46%   +0.02%     
==========================================
  Files        3229     3229              
  Lines       62067    62066       -1     
  Branches     9599     9599              
==========================================
+ Hits        41238    41253      +15     
+ Misses      18526    18510      -16     
  Partials     2303     2303              
Flag Coverage Δ
Linux 66.38% <100.00%> (-0.01%) ⬇️
Windows 66.41% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/dev/notice/bundled_notices.js 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

@abbyhu2000 abbyhu2000 added the OSCI Open Source Contributor Initiative label May 16, 2023
@@ -62,7 +62,7 @@ describe('dev/mocha/junit report generation', () => {

mocha.addFile(resolve(PROJECT_DIR, 'test.js'));
await new Promise((resolve) => mocha.run(resolve));
const report = await fcb((cb) => parseString(readFileSync(XML_PATH), cb));
const report = await promisify(parseString)(readFileSync(XML_PATH));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should just use readFile from fs/promises and parseStringPromise from xml2js.

Suggested change
const report = await promisify(parseString)(readFileSync(XML_PATH));
const report = await parseStringPromise(await readFile(XML_PATH));

return Promise.all(
paths.map(async (path) => ({
path,
text: await fcb((cb) => readFile(path, 'utf8', cb)),
text: await promisify(readFile)(path, 'utf8'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use fs/promises

@@ -44,7 +44,7 @@ import { File } from '../file';
export async function getFilesForCommit() {
const simpleGit = new SimpleGit(REPO_ROOT);

const output = await fcb((cb) => simpleGit.diff(['--name-status', '--cached'], cb));
const output = await promisify(simpleGit.diff)(['--name-status', '--cached']);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docs, we should be able to do this without promisify, like this:

Suggested change
const output = await promisify(simpleGit.diff)(['--name-status', '--cached']);
const output = await simpleGit.diff(['--name-status', '--cached']);

@ananzh ananzh assigned ananzh and unassigned joshuarrrr May 31, 2023
@ananzh ananzh added v2.9.0 technical debt If not paid, jeapardizes long-term success and maintainability of the repository. backport 2.x labels May 31, 2023
@joshuarrrr joshuarrrr added the needs more info Requires more information from poster label Jun 13, 2023
@ananzh ananzh added v2.10.0 and removed v2.9.0 labels Jul 5, 2023
@abbyhu2000
Copy link
Member

Convert to draft for now, can be marked as ready once the comments are addressed.

@abbyhu2000 abbyhu2000 marked this pull request as draft July 25, 2023 19:16
@ananzh
Copy link
Member

ananzh commented Jul 25, 2024

@Nicksqain Due to an extended period without updates, we're going to close this issue for now. We appreciate your contribution and understand that priorities and availability can change. Please feel free to reopen this issue when you have the opportunity to revisit it. Thank you for your understanding.

@ananzh ananzh closed this Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info Requires more information from poster OSCI Open Source Contributor Initiative repeat-contributor technical debt If not paid, jeapardizes long-term success and maintainability of the repository.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Eliminate Bluebird in favor of native async functionality
5 participants