Same Code passes test in one site whereas not in another why? Project -Javascript Calculator

Not passing the tests => Codepen React App
Passing the tests Repl React Calc

You don’t have react and friends installed as resources on codepen. Try the gear on the JS pane.

Hey , its on the html header section .

I would use the JS configuration pane, but if it works, whatever. CodePen’s intent is that these resources are loaded in the JS configuration.

Looks like this is a React 18 bug. The testing bundle works when using react 17 and fails for 7 of tests on react 18. I don’t know if that’s due to react 18 or your code (which looks like react 16 class components), so you may need to audit your code to make sure it is all react 18 compatible or just use react 17.

The codepen looks different because you didn’t copy your style resources there.

Ya ,css is not there.Nice observation on the version ,
I used latest documentation for the library,
It must be testing bundle not being compatible with working of react 18.

Can’t tell without knowing your setup on repl.it but it’s definitely a problem with the newer react version. I’ve had apps with asynchronous tests break on upgrade to 18 and there should be no expectation that the test bundle should work after a major version upgrade. I would use react 17 on projects using the testing bundle.

1 Like

This was my issue thank you!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.