You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(we're out of date on some packages, so addMockFunctions would be the equivalent with latest.)
Since the executable schema doesn't change at all for the whole test, I'd like to run this once, cache the result, and then clone the cached version each time before adding mocks, since addMock functions mutate the existing class. There's a function called transformSchema from graphql-tools which works really well for this:
transformSchema(cachedSchema, []);
However, there doesn't seem to be an equivalent anywhere in the @graphql-tools/ packages.
Is there a function in one of the newer packages that could do this? Or, is there maybe a different solution here?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm working on improving performance for Jest tests, and the most expensive part of each one by far, at about 100-200ms:
(we're out of date on some packages, so
addMockFunctions
would be the equivalent with latest.)Since the executable schema doesn't change at all for the whole test, I'd like to run this once, cache the result, and then clone the cached version each time before adding mocks, since
addMock
functions mutate the existing class. There's a function calledtransformSchema
fromgraphql-tools
which works really well for this:However, there doesn't seem to be an equivalent anywhere in the
@graphql-tools/
packages.Is there a function in one of the newer packages that could do this? Or, is there maybe a different solution here?
Beta Was this translation helpful? Give feedback.
All reactions