Removed property tests for MatchersUtil#equals
These might be useful for a function with a more restricted domain. But for equals, which accepts two of literally anything, the short run was too short to catch any problems and the long run tended to exceed the CircleCi timeout.
This commit is contained in:
@@ -58,13 +58,6 @@ jobs:
|
||||
name: Run tests
|
||||
command: npm test
|
||||
|
||||
# Warning: Sometimes takes a very long time (>25 minutes) on Circle.
|
||||
# Probably not a good idea to run it from anything but a nightly.
|
||||
test_node_with_long_property_tests:
|
||||
<<: *test_node
|
||||
environment:
|
||||
JASMINE_LONG_PROPERTY_TESTS: y
|
||||
|
||||
test_browsers: &test_browsers
|
||||
executor: node14
|
||||
environment:
|
||||
@@ -133,10 +126,6 @@ workflows:
|
||||
name: test_node_16
|
||||
requires:
|
||||
- build_node_16
|
||||
- test_node_with_long_property_tests:
|
||||
executor: node14
|
||||
requires:
|
||||
- build_node_14
|
||||
- test_node:
|
||||
executor: node12
|
||||
name: test_node_12
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
"ejs": "^2.5.5",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-compat": "^3.8.0",
|
||||
"fast-check": "^1.21.0",
|
||||
"fast-glob": "^2.2.6",
|
||||
"grunt": "^1.0.4",
|
||||
"grunt-cli": "^1.3.2",
|
||||
|
||||
@@ -7,78 +7,6 @@ describe('matchersUtil', function() {
|
||||
});
|
||||
|
||||
describe('equals', function() {
|
||||
describe('Properties', function() {
|
||||
var fc;
|
||||
|
||||
beforeEach(function() {
|
||||
fc = jasmine.getEnv().requireFastCheck();
|
||||
});
|
||||
|
||||
function basicAnythingSettings() {
|
||||
return {
|
||||
key: fc.oneof(fc.string(), fc.constantFrom('k1', 'k2', 'k3')),
|
||||
// Limiting depth & number of keys allows fast-check to try
|
||||
// a lot more scalar values.
|
||||
maxDepth: 2,
|
||||
maxKeys: 5,
|
||||
withBoxedValues: true,
|
||||
withMap: true,
|
||||
withSet: true
|
||||
};
|
||||
}
|
||||
|
||||
function numRuns() {
|
||||
var many = 5000000;
|
||||
|
||||
// Be thorough but very slow when specified (usually on CI).
|
||||
if (process.env.JASMINE_LONG_PROPERTY_TESTS) {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.log(
|
||||
'Using',
|
||||
many,
|
||||
'runs of fc.assert because JASMINE_LONG_PROPERTY_TESTS was set. This may take several minutes.'
|
||||
);
|
||||
return many;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
it('is symmetric', function() {
|
||||
fc.assert(
|
||||
fc.property(
|
||||
fc.anything(basicAnythingSettings()),
|
||||
fc.anything(basicAnythingSettings()),
|
||||
function(a, b) {
|
||||
return (
|
||||
jasmineUnderTest.matchersUtil.equals(a, b) ===
|
||||
jasmineUnderTest.matchersUtil.equals(b, a)
|
||||
);
|
||||
}
|
||||
),
|
||||
{
|
||||
numRuns: numRuns(),
|
||||
examples: [[0, 5e-324]]
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('is reflexive', function() {
|
||||
var anythingSettings = basicAnythingSettings();
|
||||
anythingSettings.withMap = false;
|
||||
fc.assert(
|
||||
fc.property(fc.dedup(fc.anything(anythingSettings), 2), function(
|
||||
values
|
||||
) {
|
||||
return jasmineUnderTest.matchersUtil.equals(values[0], values[1]);
|
||||
}),
|
||||
{
|
||||
numRuns: numRuns()
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('passes for literals that are triple-equal', function() {
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil();
|
||||
expect(matchersUtil.equals(null, null)).toBe(true);
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
(function(env) {
|
||||
var NODE_JS =
|
||||
typeof process !== 'undefined' &&
|
||||
process.versions &&
|
||||
typeof process.versions.node === 'string';
|
||||
|
||||
env.requireFastCheck = function() {
|
||||
if (!NODE_JS) {
|
||||
env.pending(
|
||||
"Property tests don't run in the browser. Use `npm test` to run them."
|
||||
);
|
||||
}
|
||||
|
||||
return require('fast-check');
|
||||
};
|
||||
})(jasmine.getEnv());
|
||||
@@ -28,7 +28,6 @@ module.exports = {
|
||||
'helpers/domHelpers.js',
|
||||
'helpers/integrationMatchers.js',
|
||||
'helpers/promises.js',
|
||||
'helpers/requireFastCheck.js',
|
||||
'helpers/defineJasmineUnderTest.js'
|
||||
],
|
||||
random: true,
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
"helpers/domHelpers.js",
|
||||
"helpers/integrationMatchers.js",
|
||||
"helpers/promises.js",
|
||||
"helpers/requireFastCheck.js",
|
||||
"helpers/overrideConsoleLogForCircleCi.js",
|
||||
"helpers/nodeDefineJasmineUnderTest.js"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user