Add tests for replaceClass()

While writing this test, also added a chai helper to
enable stack traces for failing tests.
Use chai helper throughout test suite

This enables stack traces on all tests if they fail.