-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93a99f5
commit 2a91f51
Showing
39 changed files
with
161 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,8 @@ | |
"start:skip-build": "cross-env SHELL_DEBUG=true DEBUG='electron-chrome-extensions*' yarn --cwd ./packages/shell start", | ||
"test": "yarn test:extensions", | ||
"test:extensions": "yarn --cwd ./packages/electron-chrome-extensions test", | ||
"prepare": "husky" | ||
"prepare": "husky", | ||
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css}\"" | ||
}, | ||
"license": "GPL-3.0", | ||
"author": "Samuel Maddock <[email protected]>", | ||
|
@@ -41,7 +42,6 @@ | |
"prettier": { | ||
"printWidth": 100, | ||
"singleQuote": true, | ||
"jsonEnable": false, | ||
"semi": false, | ||
"endOfLine": "lf" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 39 additions & 38 deletions
77
packages/electron-chrome-extensions/script/spec-runner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,79 @@ | ||
#!/usr/bin/env node | ||
|
||
const childProcess = require('child_process'); | ||
const path = require('path'); | ||
const unknownFlags = []; | ||
const childProcess = require('child_process') | ||
const path = require('path') | ||
const unknownFlags = [] | ||
|
||
require('colors'); | ||
const pass = '✓'.green; | ||
const fail = '✗'.red; | ||
require('colors') | ||
const pass = '✓'.green | ||
const fail = '✗'.red | ||
|
||
const args = require('minimist')(process.argv, { | ||
string: ['target'], | ||
unknown: arg => unknownFlags.push(arg) | ||
}); | ||
unknown: (arg) => unknownFlags.push(arg), | ||
}) | ||
|
||
const unknownArgs = []; | ||
const unknownArgs = [] | ||
for (const flag of unknownFlags) { | ||
unknownArgs.push(flag); | ||
const onlyFlag = flag.replace(/^-+/, ''); | ||
unknownArgs.push(flag) | ||
const onlyFlag = flag.replace(/^-+/, '') | ||
if (args[onlyFlag]) { | ||
unknownArgs.push(args[onlyFlag]); | ||
unknownArgs.push(args[onlyFlag]) | ||
} | ||
} | ||
|
||
async function main () { | ||
await runElectronTests(); | ||
async function main() { | ||
await runElectronTests() | ||
} | ||
|
||
async function runElectronTests () { | ||
const errors = []; | ||
async function runElectronTests() { | ||
const errors = [] | ||
|
||
const testResultsDir = process.env.ELECTRON_TEST_RESULTS_DIR; | ||
const testResultsDir = process.env.ELECTRON_TEST_RESULTS_DIR | ||
|
||
try { | ||
console.info('\nRunning:'); | ||
console.info('\nRunning:') | ||
if (testResultsDir) { | ||
process.env.MOCHA_FILE = path.join(testResultsDir, `test-results.xml`); | ||
process.env.MOCHA_FILE = path.join(testResultsDir, `test-results.xml`) | ||
} | ||
await runMainProcessElectronTests(); | ||
await runMainProcessElectronTests() | ||
} catch (err) { | ||
errors.push([err]); | ||
errors.push([err]) | ||
} | ||
|
||
if (errors.length !== 0) { | ||
for (const err of errors) { | ||
console.error('\n\nRunner Failed:', err[0]); | ||
console.error(err[1]); | ||
console.error('\n\nRunner Failed:', err[0]) | ||
console.error(err[1]) | ||
} | ||
console.log(`${fail} Electron test runners have failed`); | ||
process.exit(1); | ||
console.log(`${fail} Electron test runners have failed`) | ||
process.exit(1) | ||
} | ||
} | ||
|
||
async function runMainProcessElectronTests () { | ||
let exe = require('electron'); | ||
const runnerArgs = ['spec', ...unknownArgs.slice(2)]; | ||
async function runMainProcessElectronTests() { | ||
let exe = require('electron') | ||
const runnerArgs = ['spec', ...unknownArgs.slice(2)] | ||
|
||
const { status, signal } = childProcess.spawnSync(exe, runnerArgs, { | ||
cwd: path.resolve(__dirname, '..'), | ||
env: process.env, | ||
stdio: 'inherit' | ||
}); | ||
stdio: 'inherit', | ||
}) | ||
if (status !== 0) { | ||
if (status) { | ||
const textStatus = process.platform === 'win32' ? `0x${status.toString(16)}` : status.toString(); | ||
console.log(`${fail} Electron tests failed with code ${textStatus}.`); | ||
const textStatus = | ||
process.platform === 'win32' ? `0x${status.toString(16)}` : status.toString() | ||
console.log(`${fail} Electron tests failed with code ${textStatus}.`) | ||
} else { | ||
console.log(`${fail} Electron tests failed with kill signal ${signal}.`); | ||
console.log(`${fail} Electron tests failed with kill signal ${signal}.`) | ||
} | ||
process.exit(1); | ||
process.exit(1) | ||
} | ||
console.log(`${pass} Electron main process tests passed.`); | ||
console.log(`${pass} Electron main process tests passed.`) | ||
} | ||
|
||
main().catch((error) => { | ||
console.error('An error occurred inside the spec runner:', error); | ||
process.exit(1); | ||
}); | ||
console.error('An error occurred inside the spec runner:', error) | ||
process.exit(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,7 @@ class RemoteControlApp { | |
resolve(ret.result) | ||
} | ||
}) | ||
} | ||
}, | ||
) | ||
req.write(js) | ||
req.end() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.