Does Jest Swallow Console.Log Statements How to Change This

How to mock window.location.href with Jest + Vuejs?

You can try:

global.window = Object.create(window);
const url = "http://dummy.com";
Object.defineProperty(window, 'location', {
value: {
href: url
}
});
expect(window.location.href).toEqual(url);

Have a look at the Jest Issue for that problem:

Jest Issue

Is there a way to watch all .graphql file extensions while running jest --watch?

At the root of your project, you can add a jest.config.js. Here you can provide what extensions your project depends on, using prop moduleFileExtensions By default its ["js", "json", "jsx", "ts", "tsx", "node"]



Related Topics



Leave a reply



Submit