How do you debug your tests?
See original GitHub issueI’m trying to debug the following simple test. My tests run just fine and pass but I never get an opportunity to debug anything. What exactly is app.client.debug() supposed to do? It doesn’t seem to do anything for me. Am I supposed to connect a debugger externally somehow instead? Here is my test file:
const Application = require('spectron').Application
const path = require('path')
const chai = require('chai')
const chaiAsPromised = require('chai-as-promised')
let appPath = path.join(__dirname, '..', 'Gistbar-darwin-x64', 'Gistbar.app', 'Contents', 'MacOS', 'Gistbar')
if (process.platform === 'win32') {
appPath += '.cmd'
}
const app = new Application({
path: appPath,
})
global.before(function () {
chai.should()
chai.use(chaiAsPromised)
})
describe('Base Tests', function () {
beforeEach(function () {
return app.start()
})
afterEach(function () {
return app.stop()
})
it('opens a window', function () {
app.client.debug()
return app.client.waitUntilWindowLoaded()
.getWindowCount().should.eventually.equal(1)
})
})
Can anybody shed some light on how to properly debug spectron tests? I think that the documentation around “How to debug tests” could be improved a bit. I wouldn’t mind submitting a PR for “How to debug tests” to the main readme if someone teaches me how first 😃
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
c# - Stepping through and debugging code in Unit tests
UnitTesting, go to 'Test' in the main menu of VS 2010, click submenu 'Debug' -> 'tests in current context'. Right-clicking on the test-code...
Read more >Debugging Tests - Overview | TestComplete Documentation
Debugging refers to halting the test execution on a certain keyword test operation or script line and then running through the test in...
Read more >Debugging a Test Script - Micro Focus
To debug a specific test case from the active script, click Run > Testcase. Then select a test a test case from the...
Read more >3 Easy Ways to Debug Jest Tests - JavaScript in Plain English
1. native node inspect + Chrome DevTools. This way requires first launching the command to run the test in an “inspect mode” and...
Read more >Debugging Unit Tests - Developer Documentation
Within Eclipse¶ · Go to Run->Debug Configurations · Create a new Debug Configuration. · For me, it worked best using the “Standard Create...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can also do:
Using VSCode this is my launch.json entry for testing spectron tests:
Hope this helps.