mirror of
				https://github.com/MichMich/MagicMirror.git
				synced 2025-10-31 02:36:47 +00:00 
			
		
		
		
	Fix some eslint issues in the tests
This commit is contained in:
		| @@ -4,39 +4,41 @@ const vm = require("vm"); | ||||
|  | ||||
| const basedir = path.join(__dirname, "../../.."); | ||||
|  | ||||
| beforeAll(function () { | ||||
| 	const fileName = "js/app.js"; | ||||
| 	const filePath = path.join(basedir, fileName); | ||||
| 	const code = fs.readFileSync(filePath); | ||||
|  | ||||
| 	sandbox = { | ||||
| 		module: {}, | ||||
| 		__dirname: path.dirname(filePath), | ||||
| 		global: {}, | ||||
| 		process: { | ||||
| 			on: function () {}, | ||||
| 			env: {} | ||||
| 		} | ||||
| 	}; | ||||
|  | ||||
| 	sandbox.require = function (filename) { | ||||
| 		// This modifies the global slightly, | ||||
| 		// but supplies vm with essential code | ||||
| 		if (filename === "logger") { | ||||
| 			return require("../mocks/logger.js"); | ||||
| 		} else { | ||||
| 			try { | ||||
| 				return require(filename); | ||||
| 			} catch { | ||||
| 				// ignore | ||||
| 			} | ||||
| 		} | ||||
| 	}; | ||||
|  | ||||
| 	vm.runInNewContext(code, sandbox, fileName); | ||||
| }); | ||||
|  | ||||
| describe("Default modules set in modules/default/defaultmodules.js", function () { | ||||
| 	let sandbox = null; | ||||
|  | ||||
| 	beforeAll(function () { | ||||
| 		const fileName = "js/app.js"; | ||||
| 		const filePath = path.join(basedir, fileName); | ||||
| 		const code = fs.readFileSync(filePath); | ||||
|  | ||||
| 		sandbox = { | ||||
| 			module: {}, | ||||
| 			__dirname: path.dirname(filePath), | ||||
| 			global: {}, | ||||
| 			process: { | ||||
| 				on: function () {}, | ||||
| 				env: {} | ||||
| 			} | ||||
| 		}; | ||||
|  | ||||
| 		sandbox.require = function (filename) { | ||||
| 			// This modifies the global slightly, | ||||
| 			// but supplies vm with essential code | ||||
| 			if (filename === "logger") { | ||||
| 				return require("../mocks/logger.js"); | ||||
| 			} else { | ||||
| 				try { | ||||
| 					return require(filename); | ||||
| 				} catch (ignore) { | ||||
| 					// ignore | ||||
| 				} | ||||
| 			} | ||||
| 		}; | ||||
|  | ||||
| 		vm.runInNewContext(code, sandbox, fileName); | ||||
| 	}); | ||||
|  | ||||
| 	const expectedDefaultModules = require("../../../modules/default/defaultmodules"); | ||||
|  | ||||
| 	for (const defaultModule of expectedDefaultModules) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user