Transient props in Jest: Received `true` for a non-boolean attribute - jestjs

I'm using transient props in my React application per the styled-components docs: https://styled-components.com/docs/faqs#transient-props-since-51
But I still get the Received 'true' for a non-boolean attribute warning in my tests (using react-testing-library).
I'd like to get rid of all that red... any tips? Thanks!

Related

Validation pipe adds missing properties to the dto object

I am using NestJS. When I used node version 12.13, my data transfer objects had optional fields and validation pipe would just skip them. However, after I updated to node 12.20, if request body corresponding to dto doesn't contain some property, pipe will automatically add this property to object and set it as undefined, which can cause some problems later in my code. Is there a way to avoid this?
This is a side effect of class-transformer to whom your DTO gets passed during validation. You can re-activate the original behavior by passing the following option to your ValidationPipe.
new ValidationPipe({ transformOptions: { exposeUnsetFields: false } })

How do I change what is printed when a Jest test throws an Error?

Basically, quite a few of my tests use some autogenerated code. And the autogenerated code often throws an Error with a meaningless message - but it has some other fields on it that are quite meaningful.
By default, when a test in Jest throws an Error, jest seems to print the error message. I'd like to add a different handler for a particular subclass of Error that prints the more meaningful text. This will help me determine why my tests are failing faster.
Any ideas would be great!

LWC test using jest testing framework throws error - unknown public property "smalldevicesize" of element

While testing LWC in VSCode using jest script, unable to render custom LWC component, it throws an error- Unknown public property "smalldevicesize" of element . This is likely a typo on the corresponding attribute "smalldevicesize".
Here is the error screenshot
You are using a wrong attribute name smalldevicesize this should be small-device-size
Here is an example:
<lightning-layout-item small-device-size="">
Here is the Lightning Web Component documentation. I hope this should work.
change the attribute to because it supports to kebab notation.

WASSession E SessionContextMBeanAdapter findAttCausingNotSerializableException

We are getting below mentioned exception in our sysout.log file.
Please provide your help on how we can solve this.
Is there any setting which we can make into the Websphere Application Server?
000000a3 WASSession E SessionContextMBeanAdapter
findAttCausingNotSerializableException Miscellaneous data: Attribute
"EXCELEXPORTERREGISTERID" is declared to be serializable but is found
to generate exception "java.io.NotSerializableException" with message
"com.ubs.fsl.idama.action.codification.CodificationsHandler$1". Fix
the application so that the attribute "EXCELEXPORTERREGISTERID" is
correctly serializable at runtime.
We have implemented serialization where ever required in our java code.
After that it is giving the below exception.
00000078 WASSession E SessionContextMBeanAdapter
findAttCausingNotSerializableException Miscellaneous data: Attribute
"com.ubs.fsl.ca.ia.CAReceptionRoomIA" is declared to be serializable
but is found to generate exception "java.io.NotSerializableException"
with message "com.ibm.ws.webcontainer.srt.SRTServletRequest". Fix the
application so that the attribute
"com.ubs.fsl.ca.ia.CAReceptionRoomIA" is correctly serializable at
runtime.
Note : The above exceptions started when we migrated from WAS 7.0.0.31 to WAS 9.0.0.5.

Error on SimpleTemplateEngine embedded in Java: Could not instantiate custom Metaclass for class: java.util.ArrayList

I have a app where my users input a HTML template with SimpleTemplateEngine notation, and execute this template with code above, in a Java Class:
new SimpleTemplateEngine().createTemplate(templateStr).make(map).toString()
and I obtain this error:
groovy.lang.GroovyRuntimeException: Could not instantiate custom Metaclass for class: java.util.ArrayList. Reason: java.lang.NoSuchMethodException: groovy.runtime.metaclass.java.util.ArrayListMetaClass.<init>(groovy.lang.MetaClass)
I observe that error occurrs in a loop in a java.util.ArrayLIst in a JPA Entity loaded by Hibernate:
<%for(int k=0; k< Registro[i].listUsers.size();k++){%>
HTML CODE
<%}%>
Anyone can help me? I no have more ideas about this error...
Thanks!
I'm guessing that the part Registro[i] is for getting the value of a static property which name is held under the variable i (or at least that is what will happen) unless the getAt(String) method has been overloaded on Registro.
Either way I also guess that returns an object that has a listUsers property that should be at least a Collection.
Maybe the problem is with the initialization of said listUsers property.
Some Registro code could be used for better understanding.

Resources