jest-os-detection
Advanced tools
Comparing version 1.1.1 to 1.2.0
"use strict"; | ||
var _os = _interopRequireDefault(require("os")); | ||
var _patchJest = require("./patch-jest"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const currentPlatform = _os.default.platform(); | ||
(0, _patchJest.patch)(currentPlatform); | ||
exports.__esModule = true; | ||
var os_1 = require("os"); | ||
var patch_jest_1 = require("./patch-jest"); | ||
var currentPlatform = os_1.platform(); | ||
patch_jest_1.patch(currentPlatform); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.patch = patch; | ||
const AVAILABLE_PLATFORMS = { | ||
onWindows: ['win32'], | ||
onMac: ['darwin'], | ||
onLinux: ['linux'], | ||
skipWindows: ['linux', 'darwin'], | ||
skipMac: ['linux', 'win32'], | ||
skipLinux: ['darwin', 'win32'] | ||
exports.__esModule = true; | ||
exports.patch = void 0; | ||
var AVAILABLE_PLATFORMS = { | ||
onWindows: ['win32'], | ||
onMac: ['darwin'], | ||
onLinux: ['linux'], | ||
skipWindows: ['linux', 'darwin'], | ||
skipMac: ['linux', 'win32'], | ||
skipLinux: ['darwin', 'win32'] | ||
}; | ||
var methodOperations = ['skip', 'only']; | ||
function patch(currentPlatform) { | ||
function newDefinition(method, expectedPlatform, fallbackImplem) { | ||
if (AVAILABLE_PLATFORMS[expectedPlatform] && AVAILABLE_PLATFORMS[expectedPlatform].includes(currentPlatform)) { | ||
return method; | ||
} else { | ||
return fallbackImplem; | ||
function newDefinition(method, expectedPlatform, fallbackImplem) { | ||
var _a; | ||
if (((_a = AVAILABLE_PLATFORMS[expectedPlatform]) === null || _a === void 0 ? void 0 : _a.indexOf(currentPlatform)) !== -1) { | ||
return method; | ||
} | ||
else { | ||
return fallbackImplem; | ||
} | ||
} | ||
} | ||
Object.keys(AVAILABLE_PLATFORMS).forEach(platform => { | ||
; | ||
[describe, it, test].forEach(method => { | ||
method[platform] = newDefinition(method, platform, method.skip); | ||
method[platform].each = newDefinition(method.each, platform, method.skip.each); | ||
['skip', 'only'].forEach(mode => { | ||
method[platform][mode] = newDefinition(method[mode], platform, method.skip); | ||
method[platform][mode] = newDefinition(method[mode], platform, method.skip.each); | ||
}); | ||
Object.keys(AVAILABLE_PLATFORMS).forEach(function (platform) { | ||
; | ||
[describe, it, test].forEach(function (method) { | ||
method[platform] = newDefinition(method, platform, method.skip); | ||
method[platform].each = newDefinition(method.each, platform, method.skip.each); | ||
methodOperations.forEach(function (mode) { | ||
method[platform][mode] = newDefinition(method[mode], platform, method.skip); | ||
method[platform][mode].each = newDefinition(method[mode].each, platform, method.skip.each); | ||
}); | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
exports.patch = patch; |
{ | ||
"name": "jest-os-detection", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Allow to specify on which platform to run jest tests", | ||
@@ -8,5 +8,6 @@ "main": "lib/index.js", | ||
"repository": "github:doctolib/jest-os-detection", | ||
"types": "index.d.ts", | ||
"scripts": { | ||
"test": "jest", | ||
"version": "babel src --out-dir lib" | ||
"version": "tsc --declaration src/* --outDir lib" | ||
}, | ||
@@ -29,3 +30,6 @@ "author": "qmenoret", | ||
"@babel/preset-env": "^7.0.0", | ||
"@babel/preset-typescript": "^7.10.4", | ||
"@babel/register": "^7.0.0", | ||
"@types/jest": "^26.0.4", | ||
"@types/node": "^14.0.23", | ||
"babel-core": "^7.0.0-bridge.0", | ||
@@ -35,3 +39,4 @@ "babel-jest": "^24.1.0", | ||
"jest": "^24.9.0", | ||
"prettier": "^1.19.1" | ||
"prettier": "^1.19.1", | ||
"typescript": "^3.9.7" | ||
}, | ||
@@ -38,0 +43,0 @@ "jest": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21
255
165541
15
1