Merge pull request #2619 from etiktin/ignore_native_modules_in_debug_tests_windows

Skip native modules in debug tests on Windows
This commit is contained in:
Cheng Zhao 2015-08-28 10:43:32 +08:00
commit 71d257b190
4 changed files with 40 additions and 22 deletions

1
.gitignore vendored
View file

@ -17,3 +17,4 @@ node_modules/
*.pyc *.pyc
debug.log debug.log
npm-debug.log npm-debug.log
atom/common/chrome_version.h

View file

@ -82,6 +82,15 @@ Test functionality using:
python script\test.py python script\test.py
``` ```
Tests that include native modules (e.g. `runas`) can't be executed with the
debug build (see #2558 for details), but they will work with the release build.
To run the tests with the release build use:
```powershell
python script\test.py -R
```
## Troubleshooting ## Troubleshooting
### Command xxxx not found ### Command xxxx not found

View file

@ -7,16 +7,20 @@ describe 'third-party module', ->
fixtures = path.join __dirname, 'fixtures' fixtures = path.join __dirname, 'fixtures'
temp.track() temp.track()
describe 'runas', -> # If the test is executed with the debug build on Windows, we will skip it
it 'can be required in renderer', -> # because native modules don't work with the debug build (see issue #2558).
require 'runas' if process.platform isnt 'win32' or
process.execPath.toLowerCase().indexOf('\\out\\d\\') is -1
describe 'runas', ->
it 'can be required in renderer', ->
require 'runas'
it 'can be required in node binary', (done) -> it 'can be required in node binary', (done) ->
runas = path.join fixtures, 'module', 'runas.js' runas = path.join fixtures, 'module', 'runas.js'
child = require('child_process').fork runas child = require('child_process').fork runas
child.on 'message', (msg) -> child.on 'message', (msg) ->
assert.equal msg, 'ok' assert.equal msg, 'ok'
done() done()
describe 'q', -> describe 'q', ->
Q = require 'q' Q = require 'q'

View file

@ -48,18 +48,22 @@ describe '<webview> tag', ->
webview.src = "file://#{fixtures}/pages/d.html" webview.src = "file://#{fixtures}/pages/d.html"
document.body.appendChild webview document.body.appendChild webview
it 'loads native modules when navigation happens', (done) -> # If the test is executed with the debug build on Windows, we will skip it
listener = (e) -> # because native modules don't work with the debug build (see issue #2558).
webview.removeEventListener 'did-finish-load', listener if process.platform isnt 'win32' or
listener2 = (e) -> process.execPath.toLowerCase().indexOf('\\out\\d\\') is -1
assert.equal e.message, 'function' it 'loads native modules when navigation happens', (done) ->
done() listener = (e) ->
webview.addEventListener 'console-message', listener2 webview.removeEventListener 'did-finish-load', listener
webview.reload() listener2 = (e) ->
webview.addEventListener 'did-finish-load', listener assert.equal e.message, 'function'
webview.setAttribute 'nodeintegration', 'on' done()
webview.src = "file://#{fixtures}/pages/native-module.html" webview.addEventListener 'console-message', listener2
document.body.appendChild webview webview.reload()
webview.addEventListener 'did-finish-load', listener
webview.setAttribute 'nodeintegration', 'on'
webview.src = "file://#{fixtures}/pages/native-module.html"
document.body.appendChild webview
describe 'preload attribute', -> describe 'preload attribute', ->
it 'loads the script before other scripts in window', (done) -> it 'loads the script before other scripts in window', (done) ->