PeachScript / vue-infinite-loading

An infinite scroll plugin for Vue.js.
https://peachscript.github.io/vue-infinite-loading/
MIT License
2.66k stars 366 forks source link

PhantomJS 2.1.1 (Windows 8) ERROR #330

Open ghost opened 1 year ago

ghost commented 1 year ago

Version

6.7.0

Vue.js version

2.7.14

Steps to reproduce

npm run test

Description

It may have something to do with this SyntaxError: Unexpected token 'const' · Issue #14650 · ariya/phantomjs. How do I get the test to run correctly?

What is actually happening?

C:\vue-infinite-loading\vue-infinite-loading>npm run test

> vue-infinite-loading@2.4.5 test
> BABEL_ENV=test karma start scripts/karma.conf.js

(node:3588) Warning: Accessing non-existent property 'VERSION' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
i 「wdm」: Compiled successfully.
02 06 2023 08:22:30.258:INFO [karma-server]: Karma v6.4.2 server started at http://localhost:9876/
02 06 2023 08:22:30.261:INFO [launcher]: Launching browsers PhantomJS with concurrency unlimited
02 06 2023 08:22:30.281:INFO [launcher]: Starting browser PhantomJS
02 06 2023 08:22:34.393:INFO [PhantomJS 2.1.1 (Windows 8)]: Connected on socket G34mpHBC5SYw29HOAAAB with id 18829373
PhantomJS 2.1.1 (Windows 8) ERROR
  SyntaxError: Unexpected token 'const'
  at C:/vue-infinite-loading/test/unit/index.js:1241:0

PhantomJS 2.1.1 (Windows 8): Executed 0 of 0 ERROR (0.185 secs / 0 secs)
ghost commented 1 year ago

it looks like further development has been suspended. soI replaced karma-phantomjs-launcher with karma-chrome-launcher.

diff --git a/package.json b/package.json
index 53c3c83..8841ac2 100644
--- a/package.json
+++ b/package.json
@@ -62,8 +62,9 @@
     "focus-visible": "^4.1.5",
     "html-webpack-plugin": "^3.2.0",
     "husky": "^0.14.3",
-    "karma": "^3.0.0",
+    "karma": "^3.1.4",
     "karma-chai": "^0.1.0",
+    "karma-chrome-launcher": "^3.2.0",
     "karma-coverage": "^1.1.1",
     "karma-mocha": "^1.3.0",
     "karma-phantomjs-launcher": "^1.0.4",
diff --git a/scripts/karma.conf.js b/scripts/karma.conf.js
index 23e7023..b5d63b9 100644
--- a/scripts/karma.conf.js
+++ b/scripts/karma.conf.js
@@ -12,7 +12,7 @@ module.exports = function(config) {
     preprocessors: {
       '../test/unit/index.js': 'webpack'
     },
-    browsers: ['PhantomJS'],
+    browsers: ['ChromeHeadless'],
     reporters: ['spec', 'coverage'],
     coverageReporter: {
       dir: '../test/unit/coverage',
i 「wdm」: Compiled successfully.
02 06 2023 17:30:32.644:INFO [karma-server]: Karma v3.1.4 server started at http://0.0.0.0:9876/
02 06 2023 17:30:32.649:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
02 06 2023 17:30:32.658:INFO [launcher]: Starting browser ChromeHeadless
02 06 2023 17:30:33.393:INFO [HeadlessChrome 114.0.5735 (Windows 10.0.0)]: Connected on socket KEYQl8j5rgqxQIe5AAAA with id 64818680
HeadlessChrome 114.0.5735 (Windows 10.0.0) INFO LOG: 'Download the Vue Devtools extension for a better development experience:
https://github.com/vuejs/vue-devtools'

  vue-infinite-loading:component
    √ should always load data until fill up the container
      (use div as the container and circles spinner)
    √ should works properly with scroll plugins through the `infinite-wrapper` property
    √ should not works when deactivated by the `keep-alive` feature
      (use top direction and use div as the container)
    √ should still works properly with the deprecated property `:on-infinite` but throw warning
    √ should interpolate custom spinner slot
    √ should remove slot styles if does not configure with `template` tag
    √ should throttle properly for the scroll event handler
      (use div as the container and wave dots spinner)
    √ should still works properly with the $refs.component.$emit but throw warning
    √ should find my forcible element as scroll wrapper when using `force-use-infinite-wrapper` property
    √ should throw error when the component be in a infinite loop caused by a wrapper with unfixed height
    √ should search scroll wrapper again when change the `force-use-infinite-wrapper` property
    √ should find my forcible element as scroll wrapper when using `force-use-infinite-wrapper` as seletor
    √ should be reset if received `reset` event or change `identifier`, and throw warning if use the event way
    √ should display error message and support retry when load failed
    √ should support use a component as the default spinner
    √ should support use a string as the default spinner
    √ should save and restore scroll bar when using top direction

  vue-infinite-loading:index
    √ should register component automatically if there has global Vue
    √ should register component, sync app running mode from Vue, and override config when using the plugin install API

  vue-infinite-loading:component
    √ should complete a standard life circle
      (init -> loading -> loaded -> complete)
    √ should not trigger load again before the last load is complete
      (use div as the container and spiral spinner)
    √ should works again when reset it after a completion
      (use top direction and bubbles spinner)

HeadlessChrome 114.0.5735 (Windows 10.0.0): Executed 22 of 22 SUCCESS (1.657 secs / 1.542 secs)
TOTAL: 22 SUCCESS

=============================== Coverage summary ===============================
Statements   : 99.41% ( 168/169 )
Branches     : 100% ( 107/107 )
Functions    : 98.31% ( 58/59 )
Lines        : 99.4% ( 167/168 )
================================================================================