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
TiAPI: Create Node-compatible util module API #10718
Conversation
|
+ ' [prototype]: func { [constructor]: [Circular] } } }'); | ||
}); | ||
|
||
it.skip('with nested object', () => { |
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.
⚠️ tests/Resources/util.addontest.js line 385 – Unexpected skipped mocha test. (mocha/no-skipped-tests)
+ ' [length]: 1 ] }'); | ||
}); | ||
|
||
it.skip('with same object twice', () => { |
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.
⚠️ tests/Resources/util.addontest.js line 403 – Unexpected skipped mocha test. (mocha/no-skipped-tests)
debug: string => console.error(`DEBUG: ${string}`) | ||
}; | ||
|
||
util.isBuffer = () => false; // FIXME: Check for Ti.Buffer? for node/browserify buffer? |
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.
Maybe a Buffer
interface around our Ti.Buffer
?
util.isRegexp = value => util.types.isRegexp(value); | ||
|
||
// FIXME: Our String.format is not very forgiving. It sort-of is supposed to do the same thing, but blows up easily | ||
// util.format = String.format; |
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.
Can this be removed? since you wrote your own format function further down?
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.
yeah, it was a reminder as I tried to use our String.format as a placeholder and it broke right away.
return eventListeners.length !== 0; | ||
}, | ||
eventNames: () => Object.getOwnPropertyNames(listeners), | ||
emitWarning: function (warning, options, code, ctor) { |
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.
⚠️ common/Resources/ti.internal/extensions/process.js line 77 – 'ctor' is defined but never used. (no-unused-vars)
}); | ||
// TODO: don't do deeper objects like this until we support the breakLength crap? | ||
|
||
it.skip('with object', () => { |
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.
⚠️ tests/Resources/util.addontest.js line 369 – Unexpected skipped mocha test. (mocha/no-skipped-tests)
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.
Added two notes about todo/fixes which sound rather trivial and could be done right now.
Apart from that this already looks pretty damn solid for simple shimming purposes. Nice one!
…ctures that throw Error
…merable properties of objects
…roperties are removed
…, traceDeprecation, emit/on/emitWarning
…ct() output not labeled Circular
return Promise.reject(null); | ||
} | ||
const callbackified = util.callbackify(original); | ||
callbackified((err, result) => { |
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.
⚠️ tests/Resources/util.addontest.js line 881 – 'result' is defined but never used. (no-unused-vars)
expected); | ||
}); | ||
|
||
it.skip('with nested object and default depth', () => { |
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.
⚠️ tests/Resources/util.addontest.js line 636 – Unexpected skipped mocha test. (mocha/no-skipped-tests)
JIRA: https://jira.appcelerator.org/browse/TIMOB-26670
Description:
util._extends()
util.isDeepStrictEqual()
, which would be done after TiAPI: Create Node-compatible assert module API #10661 was also merged.util.inspect
options too far. We supportdepth
andshowHidden
, and to some degreebreakLength
; I didn't handleshowProxy
,compact
,maxArrayLength
,colors
,customInspect
,sorted
custom functions (just Boolean). I also assume there's lots of edge cases like WeakMaps, WeakSets, Map/Set iterators, etc that we don't properly support yet.Note that due to the way iOS proxies are set up, I can't verify the format of util.log/error/debug/puts/print messages because we cannot override
console.log
orconsole.error
.#10069 would fix that issue.