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
Add memento as a dev dependency: yarn add @antoinechalifour/memento --dev or npm install --save-dev @antoinechalifour/memento
Add a .mementorc in your project.
Configure your test environment for using Memento as the API url
Import memento in your test files, and plug it into your test runner hooks
const{ Memento }=require('@antoinechalifour/memento');constmemento=Memento({cacheDirectory: path.join(__dirname,'<path to cache directory>')});beforeAll(async()=>{awaitmemento.run();});afterAll(()=>{memento.stop();});
If the requests are not in the cache on the first test run, the assertions will be made against the actual API responses. On the next runs, they will be made against the cache.