diff --git a/appveyor.yml b/appveyor.yml index ee51fc3e2d..d279c26474 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -92,6 +92,9 @@ test_script: - if "%RUN_TESTS%"=="true" ( echo Running test suite & npm run test -- --ci --enable-logging) - cd .. - if "%RUN_TESTS%"=="true" ( echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg ) + - echo "About to verify mksnapshot" + - if "%RUN_TESTS%"=="true" ( echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd% ) + - echo "Done verifying mksnapshot" deploy_script: - cd electron - ps: >- diff --git a/script/verify-mksnapshot.py b/script/verify-mksnapshot.py index 66f8f68c97..6bb9a3bd22 100755 --- a/script/verify-mksnapshot.py +++ b/script/verify-mksnapshot.py @@ -39,7 +39,7 @@ def main(): + context_snapshot test_path = os.path.join(SOURCE_ROOT, 'spec', 'fixtures', \ - 'snapshot-items-available.js') + 'snapshot-items-available') if sys.platform == 'darwin': bin_files = glob.glob(os.path.join(app_path, '*.bin')) @@ -64,7 +64,7 @@ def main(): except KeyboardInterrupt: print 'Other error' returncode = 0 - + print 'Returning with error code: {0}'.format(returncode) return returncode diff --git a/spec/fixtures/snapshot-items-available.js b/spec/fixtures/snapshot-items-available/main.js similarity index 64% rename from spec/fixtures/snapshot-items-available.js rename to spec/fixtures/snapshot-items-available/main.js index 03675fa668..601853a294 100644 --- a/spec/fixtures/snapshot-items-available.js +++ b/spec/fixtures/snapshot-items-available/main.js @@ -2,19 +2,25 @@ const { app } = require('electron') -app.once('ready', () => { +app.on('ready', () => { + let returnCode = 0 try { const testValue = f() // eslint-disable-line no-undef if (testValue === 86) { console.log('ok test snapshot successfully loaded.') - app.exit(0) } else { console.log('not ok test snapshot could not be successfully loaded.') - app.exit(1) + returnCode = 1 } - return } catch (ex) { console.log('Error running custom snapshot', ex) - app.exit(1) + returnCode = 1 } + setImmediate(function () { + app.exit(returnCode) + }) +}) + +process.on('exit', function (code) { + console.log('test snapshot exited with code: ' + code) }) diff --git a/spec/fixtures/snapshot-items-available/package.json b/spec/fixtures/snapshot-items-available/package.json new file mode 100644 index 0000000000..a0593c65d8 --- /dev/null +++ b/spec/fixtures/snapshot-items-available/package.json @@ -0,0 +1,4 @@ +{ + "name": "snapshot-items-available", + "main": "main.js" +}