module.exports = function supportsWorker() {
	try {
		// eslint-disable-next-line node/no-unsupported-features/node-builtins
		return require("worker_threads") !== undefined;
	} catch (e) {
		return false;
	}
};

const nodeVersion = process.versions.node.split(".").map(Number);

module.exports = function supportsWorker() {
	// Verify that in the current node version new Worker() accepts URL as the first parameter:
	// https://nodejs.org/api/worker_threads.html#worker_threads_new_worker_filename_options
	if (nodeVersion[0] >= 14) {
		return true;
	} else if (nodeVersion[0] === 13 && nodeVersion[1] >= 12) {
		return true;
	} else if (nodeVersion[0] === 12 && nodeVersion[1] >= 17) {
		return true;
	}
	return false;
};

Fix new Worker() compatibility check in unit tests for older node versions
Fix new Worker() compatibility check in unit tests for older node versions
