build: convert nodejs tap output to junit and store in circleci as test results
This commit is contained in:
parent
cf2103d6e9
commit
60821c8ab0
4 changed files with 69 additions and 9 deletions
|
@ -5,6 +5,8 @@ const path = require('path')
|
|||
const BASE = path.resolve(__dirname, '../..')
|
||||
const NODE_DIR = path.resolve(BASE, 'third_party', 'electron_node')
|
||||
const NPX_CMD = process.platform === 'win32' ? 'npx.cmd' : 'npx'
|
||||
const JUNIT_DIR = process.argv[2] ? path.resolve(process.argv[2]) : null
|
||||
const TAP_FILE_NAME = 'test.tap'
|
||||
|
||||
const utils = require('./lib/utils')
|
||||
const { YARN_VERSION } = require('./yarn')
|
||||
|
@ -16,7 +18,7 @@ if (!process.mainModule) {
|
|||
async function main () {
|
||||
const DISABLED_TESTS = require('./node-disabled-tests.json')
|
||||
|
||||
const testChild = cp.spawn('python', ['tools/test.py', '--verbose', '-p', 'tap', '--logfile', 'test.tap', '--mode=debug', 'default', `--skip-tests=${DISABLED_TESTS.join(',')}`, '--shell', utils.getAbsoluteElectronExec(), '-J'], {
|
||||
const testChild = cp.spawn('python', ['tools/test.py', '--verbose', '-p', 'tap', '--logfile', TAP_FILE_NAME, '--mode=debug', 'default', `--skip-tests=${DISABLED_TESTS.join(',')}`, '--shell', utils.getAbsoluteElectronExec(), '-J'], {
|
||||
env: {
|
||||
...process.env,
|
||||
ELECTRON_RUN_AS_NODE: 'true'
|
||||
|
@ -25,7 +27,17 @@ async function main () {
|
|||
stdio: 'inherit'
|
||||
})
|
||||
testChild.on('exit', (testCode) => {
|
||||
process.exit(testCode)
|
||||
if (JUNIT_DIR) {
|
||||
fs.mkdirSync(JUNIT_DIR)
|
||||
const converterStream = require('tap-xunit')()
|
||||
fs.createReadStream(
|
||||
path.resolve(NODE_DIR, TAP_FILE_NAME)
|
||||
).pipe(converterStream).pipe(
|
||||
fs.createWriteStream(path.resolve(JUNIT_DIR, 'nodejs.xml'))
|
||||
).on('close', () => {
|
||||
process.exit(testCode)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue