Skip to content

Commit e6af158

Browse files
authored
Update print warning script for low priority warning (#9756)
* Add back caught error and other checks to 'lowPriorityWarning' **what is the change?:** This change makes 'lowPriorityWarning' an exact copy of 'warning.js' from https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js where before we had skipped some checks from that module. - Adds an error which we catch, in order to let people find the error and resulting stack trace when using devtools with 'pause on caught errors' checked. - Adds check that 'format' argument is passed **why make this change?:** - To maintain a closer fork to 'warning.js' - To allow easier debugging using 'pause on caught errors' - To validate inputs to 'lowPriorityWarning' **test plan:** `yarn test` **issue:** * Update 'print-warnings' script to include 'lowPriorityWarning' output **what is the change?:** We print the logs from 'lowPriorityWarning' as well as 'warning' from the 'print-warnings' script. NOTE: This PR is branching off of #9754 **why make this change?:** We want to use the same process of white/blacklisting warnings with 'lowPriorityWarning' that we do with 'warning'. **test plan:** This is not super easy to test unless we are doing a sync with FB afaik. I plan on running a sync in the next few days, or next week at latest, for the sake of not landing big things on a Friday. That will be the actual test of this. **issue:** #9398
1 parent 114b9c5 commit e6af158

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

scripts/print-warnings/print-warnings.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ function transform(file, enc, cb) {
4646
traverse(ast, {
4747
CallExpression: {
4848
exit: function(astPath) {
49-
if (astPath.get('callee').isIdentifier({name: 'warning'})) {
49+
const callee = astPath.get('callee');
50+
if (
51+
callee.isIdentifier({name: 'warning'}) ||
52+
callee.isIdentifier({name: 'lowPriorityWarning'})
53+
) {
5054
const node = astPath.node;
5155

5256
// warning messages can be concatenated (`+`) at runtime, so here's

0 commit comments

Comments
 (0)