question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Default example doesn't work on windows machine.

See original GitHub issue

Thanks for the great tool there !

When I install mocha, and run the default example, it doesn’t work on my windows machine, In order for it to work I had to do the 2 things.

  1. Get the Electron Path
  2. Also add the default path to my Electron App as a First Argument.

Shouldn’t the default example include that ? i.e

var Application = require('spectron').Application;
var assert      = require('assert');
var path        = require('path');


describe('application launch', ()=> {
    this.timeout(10000)

    beforeEach(()=> {
        this.app = new Application({
            path: getElectronPath(),
            args: [path.join(__dirname, '..')]
        })
        return this.app.start();
    });

    afterEach(()=> {
        if (this.app && this.app.isRunning()) {
            return this.app.stop()
        }
    })


    it('shows an initial window', ()=> {
        return this.app.client.getWindowCount().then(function (count) {
            assert.equal(count, 1)
        });
    })

    function getElectronPath() {
        let electronPath = path.join(__dirname, '..', 'node_modules', '.bin', 'electron');
        if (process.platform === 'win32')  electronPath += '.cmd';
        return electronPath;
    }
});

I would gladly do a PR if you agree necessary

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
hovancikcommented, Oct 10, 2016

There is a better way: https://github.com/electron/spectron/issues/86 and it works on all platforms


let electronPath = require('electron')
....

    this.app = new Application({
      path: electronPath,
      args: [
        path.join(__dirname, '..', 'app')
      ]
    })

2reactions
co-lcommented, Oct 18, 2016

OH god, thanks for this… I was about to throw my debugger in the trash.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Default apps are not working in Windows 10
In Windows 10 my default apps example: Xbox, music, calendar open then close I cant use any of my default apps Original title:...
Read more >
7 Ways to Fix “Default Gateway Is Not Available” Error
How to Fix the Error. Solution 1: Remove any and all of the MacAfee programs from your PC. One of the reasons for...
Read more >
How to Fix Set Default Location Button Not Working ... - YouTube
When you click on this default location option, it does nothing on Windows 11. Even if you enable the location and let apps...
Read more >
[Fixed] No Sound on Windows 10 - Quickly & Easily
To fix, just click them, click Set Default, then click OK and test whether you have sound. Set default speakers Windows 10
Read more >
Changing default startup directory for command prompt in ...
(Moral of the story: only change system files you know how to fix! Eventually after a Windows update it repaired itself.) What I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found