add prettier and eslint
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
(function(env) {
|
||||
function browserVersion(matchFn) {
|
||||
var userAgent = jasmine.getGlobal().navigator.userAgent;
|
||||
if (!userAgent) { return void 0; }
|
||||
if (!userAgent) {
|
||||
return void 0;
|
||||
}
|
||||
|
||||
var match = matchFn(userAgent);
|
||||
|
||||
@@ -11,5 +13,4 @@
|
||||
env.firefoxVersion = browserVersion(function(userAgent) {
|
||||
return /Firefox\/([0-9]{0,})/.exec(userAgent);
|
||||
});
|
||||
|
||||
})(jasmine.getEnv());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(function(env) {
|
||||
function getAsyncCtor() {
|
||||
try {
|
||||
eval("var func = async function(){};");
|
||||
eval('var func = async function(){};');
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
@@ -15,13 +15,12 @@
|
||||
|
||||
env.makeAsyncAwaitFunction = function() {
|
||||
var AsyncFunction = getAsyncCtor();
|
||||
return new AsyncFunction("");
|
||||
return new AsyncFunction('');
|
||||
};
|
||||
|
||||
env.requireAsyncAwait = function() {
|
||||
if (!hasAsyncAwaitSupport()) {
|
||||
env.pending("Environment does not support async/await functions");
|
||||
env.pending('Environment does not support async/await functions');
|
||||
}
|
||||
};
|
||||
})(jasmine.getEnv());
|
||||
|
||||
|
||||
@@ -1,37 +1,46 @@
|
||||
(function(env) {
|
||||
function hasFunctioningMaps() {
|
||||
if (typeof Map === 'undefined') { return false; }
|
||||
if (typeof Map === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
var s = new Map();
|
||||
s.set('a',1);
|
||||
s.set('b',2);
|
||||
s.set('a', 1);
|
||||
s.set('b', 2);
|
||||
|
||||
if (s.size !== 2) { return false; }
|
||||
if (s.has('a') !== true) { return false; }
|
||||
if (s.size !== 2) {
|
||||
return false;
|
||||
}
|
||||
if (s.has('a') !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var iterations = 0;
|
||||
var ifForEachWorking = true;
|
||||
s.forEach(function(value, key, map) {
|
||||
ifForEachWorking = ifForEachWorking && map === s;
|
||||
if (key==='a') {
|
||||
ifForEachWorking = ifForEachWorking && value===1;
|
||||
if (key === 'a') {
|
||||
ifForEachWorking = ifForEachWorking && value === 1;
|
||||
}
|
||||
iterations++;
|
||||
});
|
||||
if (iterations !== 2) { return false; }
|
||||
if (ifForEachWorking !== true) { return false; }
|
||||
if (iterations !== 2) {
|
||||
return false;
|
||||
}
|
||||
if (ifForEachWorking !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
env.requireFunctioningMaps = function() {
|
||||
if (!hasFunctioningMaps()) {
|
||||
env.pending("Browser has incomplete or missing support for Maps");
|
||||
env.pending('Browser has incomplete or missing support for Maps');
|
||||
}
|
||||
};
|
||||
|
||||
})(jasmine.getEnv());
|
||||
|
||||
@@ -1,41 +1,50 @@
|
||||
(function(env) {
|
||||
function hasFunctioningSets() {
|
||||
if (typeof Set === 'undefined') { return false; }
|
||||
if (typeof Set === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
var s = new Set();
|
||||
s.add(1);
|
||||
s.add(2);
|
||||
|
||||
if (s.size !== 2) { return false; }
|
||||
if (s.has(1) !== true) { return false; }
|
||||
if (s.size !== 2) {
|
||||
return false;
|
||||
}
|
||||
if (s.has(1) !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var iterations = 0;
|
||||
var isForEachWorking = true;
|
||||
s.forEach(function(value, key, set) {
|
||||
isForEachWorking = isForEachWorking && set === s;
|
||||
|
||||
if (iterations===0) {
|
||||
isForEachWorking = isForEachWorking && (key===value) && value===1;
|
||||
} else if (iterations===1) {
|
||||
isForEachWorking = isForEachWorking && (key===value) && value===2;
|
||||
if (iterations === 0) {
|
||||
isForEachWorking = isForEachWorking && key === value && value === 1;
|
||||
} else if (iterations === 1) {
|
||||
isForEachWorking = isForEachWorking && key === value && value === 2;
|
||||
}
|
||||
|
||||
iterations++;
|
||||
});
|
||||
if (iterations !== 2) { return false; }
|
||||
if (isForEachWorking !== true) { return false; }
|
||||
if (iterations !== 2) {
|
||||
return false;
|
||||
}
|
||||
if (isForEachWorking !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
env.requireFunctioningSets = function() {
|
||||
if (!hasFunctioningSets()) {
|
||||
env.pending("Browser has incomplete or missing support for Sets");
|
||||
env.pending('Browser has incomplete or missing support for Sets');
|
||||
}
|
||||
};
|
||||
|
||||
})(jasmine.getEnv());
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
|
||||
env.requireFunctioningSymbols = function() {
|
||||
if (!hasFunctioningSymbols()) {
|
||||
env.pending("Browser has incomplete or missing support for Symbols");
|
||||
env.pending('Browser has incomplete or missing support for Symbols');
|
||||
}
|
||||
};
|
||||
|
||||
})(jasmine.getEnv());
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
(function(env) {
|
||||
function hasFunctioningTypedArrays() {
|
||||
if (typeof Uint32Array === 'undefined') { return false; }
|
||||
if (typeof Uint32Array === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
var a = new Uint32Array([1, 2, 3]);
|
||||
if (a.length !== 3) { return false; }
|
||||
if (a.length !== 3) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
env.requireFunctioningTypedArrays = function() {
|
||||
if (!hasFunctioningTypedArrays()) {
|
||||
env.pending("Browser has incomplete or missing support for typed arrays");
|
||||
env.pending('Browser has incomplete or missing support for typed arrays');
|
||||
}
|
||||
};
|
||||
|
||||
})(jasmine.getEnv());
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
(function(env) {
|
||||
env.registerIntegrationMatchers = function() {
|
||||
jasmine.addMatchers({
|
||||
toHaveFailedExpectationsForRunnable: function (util, customeEqualityTesters) {
|
||||
toHaveFailedExpectationsForRunnable: function(
|
||||
util,
|
||||
customeEqualityTesters
|
||||
) {
|
||||
return {
|
||||
compare: function (actual, fullName, expectedFailures) {
|
||||
var foundRunnable = false, expectations = true, foundFailures = [];
|
||||
compare: function(actual, fullName, expectedFailures) {
|
||||
var foundRunnable = false,
|
||||
expectations = true,
|
||||
foundFailures = [];
|
||||
for (var i = 0; i < actual.calls.count(); i++) {
|
||||
var args = actual.calls.argsFor(i)[0];
|
||||
|
||||
@@ -19,8 +24,12 @@
|
||||
var failure = foundFailures[j];
|
||||
var expectedFailure = expectedFailures[j];
|
||||
|
||||
if (Object.prototype.toString.call(expectedFailure) === '[object RegExp]') {
|
||||
expectations = expectations && expectedFailure.test(failure);
|
||||
if (
|
||||
Object.prototype.toString.call(expectedFailure) ===
|
||||
'[object RegExp]'
|
||||
) {
|
||||
expectations =
|
||||
expectations && expectedFailure.test(failure);
|
||||
} else {
|
||||
expectations = expectations && failure === expectedFailure;
|
||||
}
|
||||
@@ -31,8 +40,14 @@
|
||||
|
||||
return {
|
||||
pass: foundRunnable && expectations,
|
||||
message: !foundRunnable ? 'The runnable "' + fullName + '" never finished' :
|
||||
'Expected runnable "' + fullName + '" to have failures ' + jasmine.pp(expectedFailures) + ' but it had ' + jasmine.pp(foundFailures)
|
||||
message: !foundRunnable
|
||||
? 'The runnable "' + fullName + '" never finished'
|
||||
: 'Expected runnable "' +
|
||||
fullName +
|
||||
'" to have failures ' +
|
||||
jasmine.pp(expectedFailures) +
|
||||
' but it had ' +
|
||||
jasmine.pp(foundFailures)
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -40,4 +55,3 @@
|
||||
});
|
||||
};
|
||||
})(jasmine.getEnv());
|
||||
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
(function() {
|
||||
var path = require("path"),
|
||||
fg = require("fast-glob");
|
||||
var path = require('path'),
|
||||
fg = require('fast-glob');
|
||||
|
||||
var jasmineUnderTestRequire = require(path.join(__dirname, "../../src/core/requireCore.js"));
|
||||
var jasmineUnderTestRequire = require(path.join(
|
||||
__dirname,
|
||||
'../../src/core/requireCore.js'
|
||||
));
|
||||
|
||||
global.getJasmineRequireObj = function () {
|
||||
global.getJasmineRequireObj = function() {
|
||||
return jasmineUnderTestRequire;
|
||||
};
|
||||
|
||||
function extend(destination, source) {
|
||||
for (var property in source) destination[property] = source[property];
|
||||
return destination;
|
||||
}
|
||||
|
||||
function getSourceFiles() {
|
||||
var src_files = ['core/**/*.js', 'version.js'].map(function(file) {
|
||||
return path.join(__dirname, "../../", 'src/', file);
|
||||
return path.join(__dirname, '../../', 'src/', file);
|
||||
});
|
||||
|
||||
fg.sync(src_files).forEach(function(resolvedFile) {
|
||||
@@ -24,5 +22,7 @@
|
||||
}
|
||||
|
||||
getSourceFiles();
|
||||
global.jasmineUnderTest = jasmineUnderTestRequire.core(jasmineUnderTestRequire);
|
||||
global.jasmineUnderTest = jasmineUnderTestRequire.core(
|
||||
jasmineUnderTestRequire
|
||||
);
|
||||
})();
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
(function(env) {
|
||||
env.requirePromises = function() {
|
||||
if (typeof Promise !== 'function') {
|
||||
env.pending("Environment does not support promises");
|
||||
env.pending('Environment does not support promises');
|
||||
}
|
||||
};
|
||||
})(jasmine.getEnv());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user