mock-browser icon indicating copy to clipboard operation
mock-browser copied to clipboard

Nuking global in node using [email protected]

Open joeyfigaro opened this issue 7 years ago • 0 comments

Referenced here - looks like setting this up for my tests clobbers the available global in node. console.log no longer works and the properties I've added to global (APP_CONFIG, etc.) don't exist.

test-setup.js

/*
	 eslint-disable
	import/no-unresolved,
	import/no-webpack-loader-syntax,
	no-return-assign,
	no-prototype-builtins
*/
const mockBrowser = require('mock-browser').mocks.MockBrowser;
const MockBrowser = new mockBrowser();

global.APP_CONFIG = require('!CONFIG').default;

global.__DEVELOPMENT__ = false;
global.__TESTING__ = true;
global.__PRODUCTION__ = false;
global.document = MockBrowser.createDocument();
global.window = MockBrowser.createWindow();
global.localStorage = MockBrowser.getLocalStorage();

joeyfigaro avatar Mar 17 '17 16:03 joeyfigaro