I’ve found that the legacy testing suites (such as the one kindly shared by @spencercorwin) don’t work for my Metric-Imperial Converter; whenever I run the tests they all fail and I only get an
error: error message, which isn’t very useful to me. I’d love to hear if others have had the same issue (it appears to be a CORS one, but I haven’t poked at it very much).
While exploring the boilerplate code at the start of my project, and trying to make heads or tails of it, I did figure out that the tests in the boilerplate code are enabled by defining the .env variable
As soon as you add the
NODE_ENV="test" variable (or un-comment it if you typed it in earlier), the FCC testing code in the boilerplate will run, providing lots of information in the server console.
When I first “activated” the tests, only 10/21 of the unit and functional tests were passing for me. After working through the error messages from the test suite with the help of lots of console.logs, I was able to get them all to pass.