twolfson / karma-electron

Karma launcher and preprocessor for Electron
The Unlicense
59 stars 21 forks source link

Doesn't recognize electron-prebuilt on window #9

Closed fallenleavesguy closed 8 years ago

fallenleavesguy commented 8 years ago

it Doesn't recognize electron-prebuilt on window, but work right on osx. it said:

21 06 2016 11:06:54.203:ERROR [plugin]: Error during loading "c:\node_modules/karma-electron" plugin:
  Unexpected token ILLEGAL
21 06 2016 11:06:54.218:ERROR [preprocess]: Can not load "electron", it is not registered!
  Perhaps you are missing some plugin?
21 06 2016 11:06:54.281:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
21 06 2016 11:06:54.281:INFO [launcher]: Launching [ 'CustomElectron' ] Infinity
21 06 2016 11:06:54.296:ERROR [karma]: Found 2 load errors
npm ERR! Test failed.  See above for more details.
fallenleavesguy commented 8 years ago

"c:\node_modules/karma-electron" looks strange

twolfson commented 8 years ago

Are you using a custom path? We test on Windows via Appveyor with electron-prebuilt so it sounds exclusive to your machine =/

fallenleavesguy commented 8 years ago

I didn't use a custom path.I also use electron-prebuilt that installed by npm. and my system is windows 10

twolfson commented 8 years ago

As a sanity check, can you try cloning this repository and running its tests?

# Clone this repository
git clone https://github.com/twolfson/karma-electron
cd karma-electron

# Install its dependencies
npm install

# Run its Windows tests
npm run test-windows
fallenleavesguy commented 8 years ago

> karma-electron@3.2.1 test-windows c:\work\karma-electron
> npm run test-karma-all

> karma-electron@3.2.1 test-karma-all c:\work\karma-electron
> npm run test-karma-single-run && npm run test-karma-failure && npm run test-karma-uncaught-exception && npm run test-karma-karma && npm run test-karma-phantomjs && npm run test-karma-eof-comment && npm run test-karma-source-map

> karma-electron@3.2.1 test-karma-single-run c:\work\karma-electron
> karma start test/integration-test/karma.conf.js --single-run

21 06 2016 19:47:28.767:ERROR [config]: Error in config file!
 [SyntaxError: Unexpected token ILLEGAL]
SyntaxError: Unexpected token ILLEGAL
    at Function (native)
    at Function.compile (c:\work\karma-electron\node_modules\minstache\index.js:79:10)
    at Object.<anonymous> (c:\work\karma-electron\lib\karma-electron-preprocessor.js:17:26)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (c:\work\karma-electron\lib\index.js:7:3)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)

npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test-karma-single-run"
npm ERR! node v5.9.0
npm ERR! npm  v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! karma-electron@3.2.1 test-karma-single-run: `karma start test/integration-test/karma.conf.js --single-run`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the karma-electron@3.2.1 test-karma-single-run script 'karma start test/integration-test/karma.conf.js --single-run'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the karma-electron package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     karma start test/integration-test/karma.conf.js --single-run
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs karma-electron
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls karma-electron
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\work\karma-electron\npm-debug.log

npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test-karma-all"
npm ERR! node v5.9.0
npm ERR! npm  v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! karma-electron@3.2.1 test-karma-all: `npm run test-karma-single-run && npm run test-karma-failure && npm run test-karma-uncaught-exception && npm run test-karma-karma && npm run test-karma-phantomjs && npm run test-karma-eof-comment && npm run test-karma-source-map`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the karma-electron@3.2.1 test-karma-all script 'npm run test-karma-single-run && npm run test-karma-failure && npm run test-karma-uncaught-exception && npm run test-karma-karma && npm run test-karma-phantomjs && npm run test-karma-eof-comment && npm run test-karma-source-map'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the karma-electron package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run test-karma-single-run && npm run test-karma-failure && npm run test-karma-uncaught-exception && npm run test-karma-karma && npm run test-karma-phantomjs && npm run test-karma-eof-comment && npm run test-karma-source-map
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs karma-electron
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls karma-electron
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\work\karma-electron\npm-debug.log

npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test-windows"
npm ERR! node v5.9.0
npm ERR! npm  v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! karma-electron@3.2.1 test-windows: `npm run test-karma-all`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the karma-electron@3.2.1 test-windows script 'npm run test-karma-all'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the karma-electron package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run test-karma-all
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs karma-electron
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls karma-electron
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\work\karma-electron\npm-debug.log
twolfson commented 8 years ago

Strange, I don't have time at the moment to debug on Windows. Do you think you could give it a shot?

fallenleavesguy commented 8 years ago

It doesn't matter.if I know where is wrong,I'll tell you or make a pull request.thank you very much.

dwelle commented 8 years ago

Ran into the same problem. the electron must be capitalized: browsers: [ 'Electron' ]

twolfson commented 8 years ago

Ah, nice catch @dwelle. For reference, our casing is consistent with Karma's conventions:

http://karma-runner.github.io/1.0/config/browsers.html

http://karma-runner.github.io/1.0/config/preprocessors.html

fallenleavesguy commented 8 years ago

I have solved this by using karma-electron 4.0.