From 3e64ce331031391c161cd1aaebd22e947d72986e Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Sat, 3 Jul 2021 08:32:55 -0700 Subject: [PATCH] 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. --- .circleci/config.yml | 11 ---- package.json | 1 - spec/core/matchers/matchersUtilSpec.js | 72 -------------------------- spec/helpers/requireFastCheck.js | 16 ------ spec/support/jasmine-browser.js | 1 - spec/support/jasmine.json | 1 - 6 files changed, 102 deletions(-) delete mode 100644 spec/helpers/requireFastCheck.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 5eee1065..f2ac69ba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/package.json b/package.json index 354d5c6f..521249e7 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/spec/core/matchers/matchersUtilSpec.js b/spec/core/matchers/matchersUtilSpec.js index 369f6b5a..465ac7c5 100644 --- a/spec/core/matchers/matchersUtilSpec.js +++ b/spec/core/matchers/matchersUtilSpec.js @@ -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); diff --git a/spec/helpers/requireFastCheck.js b/spec/helpers/requireFastCheck.js deleted file mode 100644 index 140b8e80..00000000 --- a/spec/helpers/requireFastCheck.js +++ /dev/null @@ -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()); diff --git a/spec/support/jasmine-browser.js b/spec/support/jasmine-browser.js index 4d52f913..ef717010 100644 --- a/spec/support/jasmine-browser.js +++ b/spec/support/jasmine-browser.js @@ -28,7 +28,6 @@ module.exports = { 'helpers/domHelpers.js', 'helpers/integrationMatchers.js', 'helpers/promises.js', - 'helpers/requireFastCheck.js', 'helpers/defineJasmineUnderTest.js' ], random: true, diff --git a/spec/support/jasmine.json b/spec/support/jasmine.json index f87d05dd..5dc9aad6 100644 --- a/spec/support/jasmine.json +++ b/spec/support/jasmine.json @@ -15,7 +15,6 @@ "helpers/domHelpers.js", "helpers/integrationMatchers.js", "helpers/promises.js", - "helpers/requireFastCheck.js", "helpers/overrideConsoleLogForCircleCi.js", "helpers/nodeDefineJasmineUnderTest.js" ],