Allow custom object formatters to be added in beforeAll

Fixes #1876.
This commit is contained in:
Steve Gravrock
2021-03-13 13:49:30 -08:00
parent 46e7158c77
commit 76f34e90dc
2 changed files with 4 additions and 1 deletions

View File

@@ -42,7 +42,7 @@ describe('Custom object formatters', function() {
});
env.describe('with custom pretty-printer', function() {
env.beforeEach(function() {
env.beforeAll(function() {
env.addCustomObjectFormatter(function(obj) {
return 'custom(' + obj + ')';
});

View File

@@ -424,6 +424,9 @@ getJasmineRequireObj().Env = function(j$) {
resources.customAsyncMatchers = j$.util.clone(
runnableResources[parentRunnableId].customAsyncMatchers
);
resources.customObjectFormatters = j$.util.clone(
runnableResources[parentRunnableId].customObjectFormatters
);
resources.defaultStrategyFn =
runnableResources[parentRunnableId].defaultStrategyFn;
}