NikolayRys / Likely

The social sharing buttons that aren’t shabby
ISC License
395 stars 61 forks source link

Fix erratic test #168

Closed NikolayRys closed 4 years ago

NikolayRys commented 4 years ago

One test fails randomly, that's inconvenient and requires investigation:

> npm run build
> ilyabirman-likely@2.4.0 build /home/travis/build/NikolayRys/Likely
> cross-env NODE_ENV=production webpack -p
Hash: 50430ee21b7a828cd266
Version: webpack 2.7.0
Time: 1690ms
                       Asset     Size  Chunks             Chunk Names
./release/likely-commonjs.js  20.3 kB       0  [emitted]  likely-commonjs
         ./release/likely.js  20.4 kB       1  [emitted]  likely
        ./release/likely.css  10.4 kB    0, 1  [emitted]  likely-commonjs, likely
   [0] ./source/utils.js 5.33 kB {0} {1} [built]
   [1] ./source/dom.js 3.12 kB {0} {1} [built]
   [2] ./source/config.js 84 bytes {0} {1} [built]
   [3] ./source/services/index.js 804 bytes {0} {1} [built]
   [4] ./source/index.js 4.05 kB {0} {1} [built]
   [5] ./source/button.js 7.43 kB {0} {1} [built]
   [7] ./source/fetch.js 719 bytes {0} {1} [built]
   [8] ./source/history.js 1.05 kB {0} {1} [built]
  [18] ./source/widget.js 3.64 kB {0} {1} [built]
  [19] ./source/index.styl 41 bytes {0} {1} [built]
  [20] ./source/likely.js 411 bytes {1} [built]
  [21] multi ./source/index.js 28 bytes {0} [built]
  [22] ./~/css-loader/dist/cjs.js!./~/stylus-loader!./source/index.styl 11.1 kB [built]
  [23] ./~/css-loader/dist/runtime/api.js 2.52 kB [built]
  [24] ./~/style-loader/addStyles.js 6.91 kB [built]
    + 10 hidden modules
Child extract-text-webpack-plugin:
       [0] ./~/css-loader/dist/runtime/api.js 2.52 kB {0} [built]
       [1] ./~/css-loader/dist/cjs.js!./~/stylus-loader!./source/index.styl 11.1 kB {0} [built]
> ilyabirman-likely@2.4.0 integration-tests /home/travis/build/NikolayRys/Likely
> mocha --exit test/index.js
  Likely
    initialization
      ✓ should initialize without arguments (63ms)
      ✓ should initialize when only options are passed (1536ms)
      ✓ should initialize a single node passed (40ms)
      ✓ should initialize a single node passed with options (407ms)
      ✓ should initialize multiple nodes passed (57ms)
      ✓ should initialize multiple nodes passed with options (735ms)
    changing configuration after being initialized
      ✓ should change the shared URL when the new options are passed as a JS object (371ms)
      ✓ should change the shared URL when the new URL is specified on the node (354ms)
      ✓ should change the shared URL when the new URL is specified as <link rel="canonical"> (359ms)
    fetching counters
      1) should fetch the counters for Facebook
      ✓ should fetch the counters for Odnoklassniki
      ✓ should fetch the counters for Pinterest
      ✓ should fetch the counters for VK
    opening sharing dialogs
      ✓ should open the sharing dialog for Facebook (983ms)
      ✓ should open the sharing dialog for Odnoklassniki (2570ms)
      ✓ should open the sharing dialog for Pinterest (1159ms)
      ✓ should open the sharing dialog for Telegram (971ms)
      ✓ should open the sharing dialog for Twitter (315ms)
      ✓ should open the sharing dialog for VK (2249ms)
      ✓ should open the sharing dialog for LinkedIn (928ms)
    configuration
      ✓ should change the shared URL when `<link rel="canonical">` is specified (341ms)
      ✓ should change the shared URL when `data-url` is specified (329ms)
      ✓ should change the shared title when `data-title` is specified (339ms)
      ✓ should set the `via` when `data-via` on the Twitter button is specified (373ms)
      ✓ should set the shared text when `data-text` on the Telegram button is specified (331ms)
      ✓ should open popup for Pinterest (857ms)
    history
      ✓ should change the shared URL when history.pushState() is called (391ms)
      ✓ should change the shared URL when history.replaceState() is called (374ms)
      ✓ should change the shared URL when the browser’s back button is clicked (447ms)
    bugs
      ✓ should get a correct title when the script is placed before the title element [#67] (1406ms)
    execute outside browser enviroment
      ✓ should require without errors
  30 passing (20s)
  1 failing
  1) Likely
       fetching counters
         should fetch the counters for Facebook:
      AssertionError: expected '' to equal '10'
      + expected - actual
      +10

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ilyabirman-likely@2.4.0 integration-tests: `mocha --exit test/index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ilyabirman-likely@2.4.0 integration-tests script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/travis/.npm/_logs/2020-02-19T04_00_42_044Z-debug.log
npm ERR! Test failed.  See above for more details.
The command "npm test" exited with 1.
cache.2
store build cache
Done. Your build exited with 1.