-
Notifications
You must be signed in to change notification settings - Fork 919
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
Conversation
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(() => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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');
There was a problem hiding this comment.
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 Report
@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -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)); |
There was a problem hiding this comment.
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
.
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'), |
There was a problem hiding this comment.
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']); |
There was a problem hiding this comment.
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:
const output = await promisify(simpleGit.diff)(['--name-status', '--cached']); | |
const output = await simpleGit.diff(['--name-status', '--cached']); |
Convert to draft for now, can be marked as ready once the comments are addressed. |
@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. |
Description
Issues Resolved
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr