build: speedy tests on circle by splitting the test files into multiple jobs (#21015)
* build: let circleci divide our test suites in two * well our tests rely on side affects, thats cool I guess
This commit is contained in:
parent
bbfb32b136
commit
24939e8fa4
18 changed files with 51 additions and 80 deletions
|
@ -1221,7 +1221,8 @@ steps-tests: &steps-tests
|
||||||
command: |
|
command: |
|
||||||
cd src
|
cd src
|
||||||
export ELECTRON_OUT_DIR=Default
|
export ELECTRON_OUT_DIR=Default
|
||||||
(cd electron && node script/yarn test -- --enable-logging)
|
(cd electron && node script/yarn test --runners=main --enable-logging --files $(circleci tests glob spec-main/*-spec.ts | circleci tests split))
|
||||||
|
(cd electron && node script/yarn test --runners=remote --enable-logging --files $(circleci tests glob spec/*-spec.js | circleci tests split))
|
||||||
- run:
|
- run:
|
||||||
name: Check test results existence
|
name: Check test results existence
|
||||||
command: |
|
command: |
|
||||||
|
@ -1766,6 +1767,7 @@ jobs:
|
||||||
<<: *env-linux-medium
|
<<: *env-linux-medium
|
||||||
<<: *env-headless-testing
|
<<: *env-headless-testing
|
||||||
<<: *env-stack-dumping
|
<<: *env-stack-dumping
|
||||||
|
parallelism: 3
|
||||||
<<: *steps-tests
|
<<: *steps-tests
|
||||||
|
|
||||||
linux-x64-testing-nan:
|
linux-x64-testing-nan:
|
||||||
|
@ -1815,6 +1817,7 @@ jobs:
|
||||||
<<: *env-ia32
|
<<: *env-ia32
|
||||||
<<: *env-headless-testing
|
<<: *env-headless-testing
|
||||||
<<: *env-stack-dumping
|
<<: *env-stack-dumping
|
||||||
|
parallelism: 3
|
||||||
<<: *steps-tests
|
<<: *steps-tests
|
||||||
|
|
||||||
linux-ia32-testing-nan:
|
linux-ia32-testing-nan:
|
||||||
|
@ -1867,6 +1870,7 @@ jobs:
|
||||||
environment:
|
environment:
|
||||||
<<: *env-mac-large
|
<<: *env-mac-large
|
||||||
<<: *env-stack-dumping
|
<<: *env-stack-dumping
|
||||||
|
parallelism: 2
|
||||||
<<: *steps-tests
|
<<: *steps-tests
|
||||||
|
|
||||||
osx-release-tests:
|
osx-release-tests:
|
||||||
|
@ -1896,6 +1900,7 @@ jobs:
|
||||||
environment:
|
environment:
|
||||||
<<: *env-mac-large
|
<<: *env-mac-large
|
||||||
<<: *env-stack-dumping
|
<<: *env-stack-dumping
|
||||||
|
parallelism: 2
|
||||||
<<: *steps-tests
|
<<: *steps-tests
|
||||||
|
|
||||||
mas-release-tests:
|
mas-release-tests:
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import * as chai from 'chai'
|
import { expect } from 'chai'
|
||||||
import * as chaiAsPromised from 'chai-as-promised'
|
|
||||||
import * as cp from 'child_process'
|
import * as cp from 'child_process'
|
||||||
import * as https from 'https'
|
import * as https from 'https'
|
||||||
import * as net from 'net'
|
import * as net from 'net'
|
||||||
|
@ -13,10 +12,6 @@ import split = require('split')
|
||||||
|
|
||||||
const features = process.electronBinding('features')
|
const features = process.electronBinding('features')
|
||||||
|
|
||||||
const { expect } = chai
|
|
||||||
|
|
||||||
chai.use(chaiAsPromised)
|
|
||||||
|
|
||||||
const fixturesPath = path.resolve(__dirname, '../spec/fixtures')
|
const fixturesPath = path.resolve(__dirname, '../spec/fixtures')
|
||||||
|
|
||||||
describe('electron module', () => {
|
describe('electron module', () => {
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
import * as chai from 'chai'
|
import { expect } from 'chai'
|
||||||
import * as ChildProcess from 'child_process'
|
import * as ChildProcess from 'child_process'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import { emittedOnce } from './events-helpers'
|
import { emittedOnce } from './events-helpers'
|
||||||
import { BrowserView, BrowserWindow } from 'electron'
|
import { BrowserView, BrowserWindow } from 'electron'
|
||||||
import { closeWindow } from './window-helpers'
|
import { closeWindow } from './window-helpers'
|
||||||
import dirtyChai = require('dirty-chai')
|
|
||||||
|
|
||||||
const { expect } = chai
|
|
||||||
chai.use(dirtyChai)
|
|
||||||
|
|
||||||
describe('BrowserView module', () => {
|
describe('BrowserView module', () => {
|
||||||
const fixtures = path.resolve(__dirname, '..', 'spec', 'fixtures')
|
const fixtures = path.resolve(__dirname, '..', 'spec', 'fixtures')
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import * as chai from 'chai'
|
import { expect } from 'chai'
|
||||||
import * as chaiAsPromised from 'chai-as-promised'
|
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
|
@ -11,12 +10,6 @@ import { app, BrowserWindow, BrowserView, ipcMain, OnBeforeSendHeadersListenerDe
|
||||||
import { emittedOnce } from './events-helpers'
|
import { emittedOnce } from './events-helpers'
|
||||||
import { ifit, ifdescribe } from './spec-helpers'
|
import { ifit, ifdescribe } from './spec-helpers'
|
||||||
import { closeWindow } from './window-helpers'
|
import { closeWindow } from './window-helpers'
|
||||||
import dirtyChai = require('dirty-chai')
|
|
||||||
|
|
||||||
const { expect } = chai
|
|
||||||
|
|
||||||
chai.use(chaiAsPromised)
|
|
||||||
chai.use(dirtyChai)
|
|
||||||
|
|
||||||
const fixtures = path.resolve(__dirname, '..', 'spec', 'fixtures')
|
const fixtures = path.resolve(__dirname, '..', 'spec', 'fixtures')
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
import * as chai from 'chai'
|
import { expect } from 'chai'
|
||||||
import * as chaiAsPromised from 'chai-as-promised'
|
|
||||||
import { BrowserWindow, ipcMain, IpcMainInvokeEvent } from 'electron'
|
import { BrowserWindow, ipcMain, IpcMainInvokeEvent } from 'electron'
|
||||||
|
|
||||||
const { expect } = chai
|
|
||||||
|
|
||||||
chai.use(chaiAsPromised)
|
|
||||||
|
|
||||||
describe('ipc module', () => {
|
describe('ipc module', () => {
|
||||||
describe('invoke', () => {
|
describe('invoke', () => {
|
||||||
let w = (null as unknown as BrowserWindow)
|
let w = (null as unknown as BrowserWindow)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import * as chai from 'chai'
|
import { expect } from 'chai'
|
||||||
import { AddressInfo } from 'net'
|
import { AddressInfo } from 'net'
|
||||||
import * as chaiAsPromised from 'chai-as-promised'
|
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as http from 'http'
|
import * as http from 'http'
|
||||||
|
@ -10,10 +9,6 @@ import { emittedOnce } from './events-helpers'
|
||||||
import { closeAllWindows } from './window-helpers'
|
import { closeAllWindows } from './window-helpers'
|
||||||
import { ifdescribe, ifit } from './spec-helpers'
|
import { ifdescribe, ifit } from './spec-helpers'
|
||||||
|
|
||||||
const { expect } = chai
|
|
||||||
|
|
||||||
chai.use(chaiAsPromised)
|
|
||||||
|
|
||||||
const fixturesPath = path.resolve(__dirname, '..', 'spec', 'fixtures')
|
const fixturesPath = path.resolve(__dirname, '..', 'spec', 'fixtures')
|
||||||
const features = process.electronBinding('features')
|
const features = process.electronBinding('features')
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import * as chai from 'chai'
|
import { expect } from 'chai'
|
||||||
import * as chaiAsPromised from 'chai-as-promised'
|
|
||||||
import { BrowserWindow, WebContents, session, ipcMain, app, protocol, webContents } from 'electron'
|
import { BrowserWindow, WebContents, session, ipcMain, app, protocol, webContents } from 'electron'
|
||||||
import { emittedOnce } from './events-helpers'
|
import { emittedOnce } from './events-helpers'
|
||||||
import { closeAllWindows } from './window-helpers'
|
import { closeAllWindows } from './window-helpers'
|
||||||
|
@ -14,11 +13,8 @@ import { promisify } from 'util'
|
||||||
import { ifit, ifdescribe } from './spec-helpers'
|
import { ifit, ifdescribe } from './spec-helpers'
|
||||||
import { AddressInfo } from 'net'
|
import { AddressInfo } from 'net'
|
||||||
|
|
||||||
const { expect } = chai
|
|
||||||
|
|
||||||
const features = process.electronBinding('features')
|
const features = process.electronBinding('features')
|
||||||
|
|
||||||
chai.use(chaiAsPromised)
|
|
||||||
const fixturesPath = path.resolve(__dirname, '..', 'spec', 'fixtures')
|
const fixturesPath = path.resolve(__dirname, '..', 'spec', 'fixtures')
|
||||||
|
|
||||||
describe('reporting api', () => {
|
describe('reporting api', () => {
|
||||||
|
|
|
@ -43,6 +43,7 @@ app.whenReady().then(() => {
|
||||||
|
|
||||||
const argv = require('yargs')
|
const argv = require('yargs')
|
||||||
.boolean('ci')
|
.boolean('ci')
|
||||||
|
.array('files')
|
||||||
.string('g').alias('g', 'grep')
|
.string('g').alias('g', 'grep')
|
||||||
.boolean('i').alias('i', 'invert')
|
.boolean('i').alias('i', 'invert')
|
||||||
.argv
|
.argv
|
||||||
|
@ -86,15 +87,27 @@ app.whenReady().then(() => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const baseElectronDir = path.resolve(__dirname, '..')
|
||||||
|
|
||||||
walker.on('end', () => {
|
walker.on('end', () => {
|
||||||
testFiles.sort()
|
testFiles.sort()
|
||||||
sortToEnd(testFiles, f => f.includes('crash-reporter')).forEach((file) => mocha.addFile(file))
|
sortToEnd(testFiles, f => f.includes('crash-reporter')).forEach((file) => {
|
||||||
|
if (!argv.files || argv.files.includes(path.relative(baseElectronDir, file))) {
|
||||||
|
mocha.addFile(file)
|
||||||
|
}
|
||||||
|
})
|
||||||
const cb = () => {
|
const cb = () => {
|
||||||
// Ensure the callback is called after runner is defined
|
// Ensure the callback is called after runner is defined
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
process.exit(runner.failures)
|
process.exit(runner.failures)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set up chai in the correct order
|
||||||
|
const chai = require('chai')
|
||||||
|
chai.use(require('chai-as-promised'))
|
||||||
|
chai.use(require('dirty-chai'))
|
||||||
|
|
||||||
const runner = mocha.run(cb)
|
const runner = mocha.run(cb)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const chai = require('chai')
|
const { expect } = require('chai')
|
||||||
const dirtyChai = require('dirty-chai')
|
|
||||||
const { nativeImage } = require('electron')
|
const { nativeImage } = require('electron')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const { expect } = chai
|
|
||||||
chai.use(dirtyChai)
|
|
||||||
|
|
||||||
describe('nativeImage module', () => {
|
describe('nativeImage module', () => {
|
||||||
const ImageFormat = {
|
const ImageFormat = {
|
||||||
PNG: 'png',
|
PNG: 'png',
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const chai = require('chai')
|
const { expect } = require('chai')
|
||||||
const dirtyChai = require('dirty-chai')
|
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const { resolveGetters } = require('./expect-helpers')
|
const { resolveGetters } = require('./expect-helpers')
|
||||||
const { ifdescribe } = require('./spec-helpers')
|
const { ifdescribe } = require('./spec-helpers')
|
||||||
|
|
||||||
const { remote, ipcRenderer } = require('electron')
|
const { remote, ipcRenderer } = require('electron')
|
||||||
const { ipcMain, BrowserWindow } = remote
|
const { ipcMain, BrowserWindow } = remote
|
||||||
const { expect } = chai
|
|
||||||
|
|
||||||
const features = process.electronBinding('features')
|
const features = process.electronBinding('features')
|
||||||
|
|
||||||
chai.use(dirtyChai)
|
|
||||||
|
|
||||||
const comparePaths = (path1, path2) => {
|
const comparePaths = (path1, path2) => {
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
path1 = path1.toLowerCase()
|
path1 = path1.toLowerCase()
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const chai = require('chai')
|
const { expect } = require('chai')
|
||||||
const dirtyChai = require('dirty-chai')
|
|
||||||
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
@ -7,9 +6,6 @@ const os = require('os')
|
||||||
const http = require('http')
|
const http = require('http')
|
||||||
const { shell } = require('electron')
|
const { shell } = require('electron')
|
||||||
|
|
||||||
const { expect } = chai
|
|
||||||
chai.use(dirtyChai)
|
|
||||||
|
|
||||||
describe('shell module', () => {
|
describe('shell module', () => {
|
||||||
const fixtures = path.resolve(__dirname, 'fixtures')
|
const fixtures = path.resolve(__dirname, 'fixtures')
|
||||||
const shortcutOptions = {
|
const shortcutOptions = {
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
const chai = require('chai')
|
const { expect } = require('chai')
|
||||||
const dirtyChai = require('dirty-chai')
|
|
||||||
const { webFrame } = require('electron')
|
const { webFrame } = require('electron')
|
||||||
|
|
||||||
const { expect } = chai
|
|
||||||
chai.use(dirtyChai)
|
|
||||||
|
|
||||||
describe('webFrame module', function () {
|
describe('webFrame module', function () {
|
||||||
it('supports setting the visual and layout zoom level limits', function () {
|
it('supports setting the visual and layout zoom level limits', function () {
|
||||||
expect(() => {
|
expect(() => {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const chai = require('chai')
|
const { expect } = require('chai')
|
||||||
const dirtyChai = require('dirty-chai')
|
|
||||||
const ChildProcess = require('child_process')
|
const ChildProcess = require('child_process')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
@ -9,9 +8,6 @@ const nativeImage = require('electron').nativeImage
|
||||||
|
|
||||||
const features = process.electronBinding('features')
|
const features = process.electronBinding('features')
|
||||||
|
|
||||||
const { expect } = chai
|
|
||||||
chai.use(dirtyChai)
|
|
||||||
|
|
||||||
async function expectToThrowErrorWithCode (func, code) {
|
async function expectToThrowErrorWithCode (func, code) {
|
||||||
let error
|
let error
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const chai = require('chai')
|
const { expect } = require('chai')
|
||||||
const dirtyChai = require('dirty-chai')
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const http = require('http')
|
const http = require('http')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
@ -11,9 +10,6 @@ const { emittedOnce } = require('./events-helpers')
|
||||||
const { resolveGetters } = require('./expect-helpers')
|
const { resolveGetters } = require('./expect-helpers')
|
||||||
const features = process.electronBinding('features')
|
const features = process.electronBinding('features')
|
||||||
|
|
||||||
const { expect } = chai
|
|
||||||
chai.use(dirtyChai)
|
|
||||||
|
|
||||||
/* Most of the APIs here don't use standard callbacks */
|
/* Most of the APIs here don't use standard callbacks */
|
||||||
/* eslint-disable standard/no-callback-literal */
|
/* eslint-disable standard/no-callback-literal */
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
const ChildProcess = require('child_process')
|
const ChildProcess = require('child_process')
|
||||||
const chai = require('chai')
|
const { expect } = require('chai')
|
||||||
const { expect } = chai
|
|
||||||
const dirtyChai = require('dirty-chai')
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
|
@ -11,8 +9,6 @@ const features = process.electronBinding('features')
|
||||||
const { emittedOnce } = require('./events-helpers')
|
const { emittedOnce } = require('./events-helpers')
|
||||||
const { ifit } = require('./spec-helpers')
|
const { ifit } = require('./spec-helpers')
|
||||||
|
|
||||||
chai.use(dirtyChai)
|
|
||||||
|
|
||||||
describe('node feature', () => {
|
describe('node feature', () => {
|
||||||
const fixtures = path.join(__dirname, 'fixtures')
|
const fixtures = path.join(__dirname, 'fixtures')
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,8 @@
|
||||||
if (query.grep) mocha.grep(query.grep)
|
if (query.grep) mocha.grep(query.grep)
|
||||||
if (query.invert) mocha.invert()
|
if (query.invert) mocha.invert()
|
||||||
|
|
||||||
|
const files = query.files ? query.files.split(',') : undefined
|
||||||
|
|
||||||
// Read all test files.
|
// Read all test files.
|
||||||
const walker = require('walkdir').walk(path.dirname(__dirname), {
|
const walker = require('walkdir').walk(path.dirname(__dirname), {
|
||||||
no_recurse: true
|
no_recurse: true
|
||||||
|
@ -73,9 +75,20 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const baseElectronDir = path.resolve(__dirname, '..', '..')
|
||||||
|
|
||||||
walker.on('end', () => {
|
walker.on('end', () => {
|
||||||
testFiles.sort()
|
testFiles.sort()
|
||||||
testFiles.forEach((file) => mocha.addFile(file))
|
testFiles.forEach((file) => {
|
||||||
|
if (!files || files.includes(path.relative(baseElectronDir, file))) {
|
||||||
|
mocha.addFile(file)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Set up chai in the correct order
|
||||||
|
const chai = require('chai')
|
||||||
|
chai.use(require('chai-as-promised'))
|
||||||
|
chai.use(require('dirty-chai'))
|
||||||
|
|
||||||
const runner = mocha.run(() => {
|
const runner = mocha.run(() => {
|
||||||
// Ensure the callback is called after runner is defined
|
// Ensure the callback is called after runner is defined
|
||||||
|
|
|
@ -11,6 +11,7 @@ const v8 = require('v8')
|
||||||
|
|
||||||
const argv = require('yargs')
|
const argv = require('yargs')
|
||||||
.boolean('ci')
|
.boolean('ci')
|
||||||
|
.array('files')
|
||||||
.string('g').alias('g', 'grep')
|
.string('g').alias('g', 'grep')
|
||||||
.boolean('i').alias('i', 'invert')
|
.boolean('i').alias('i', 'invert')
|
||||||
.argv
|
.argv
|
||||||
|
@ -133,7 +134,8 @@ app.on('ready', function () {
|
||||||
window.loadFile('static/index.html', {
|
window.loadFile('static/index.html', {
|
||||||
query: {
|
query: {
|
||||||
grep: argv.grep,
|
grep: argv.grep,
|
||||||
invert: argv.invert ? 'true' : ''
|
invert: argv.invert ? 'true' : '',
|
||||||
|
files: argv.files ? argv.files.join(',') : undefined
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
window.on('unresponsive', function () {
|
window.on('unresponsive', function () {
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
const chai = require('chai')
|
const { expect } = require('chai')
|
||||||
const dirtyChai = require('dirty-chai')
|
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const http = require('http')
|
const http = require('http')
|
||||||
const url = require('url')
|
const url = require('url')
|
||||||
const { ipcRenderer } = require('electron')
|
const { ipcRenderer } = require('electron')
|
||||||
const { emittedOnce, waitForEvent } = require('./events-helpers')
|
const { emittedOnce, waitForEvent } = require('./events-helpers')
|
||||||
|
|
||||||
const { expect } = chai
|
|
||||||
chai.use(dirtyChai)
|
|
||||||
|
|
||||||
const features = process.electronBinding('features')
|
const features = process.electronBinding('features')
|
||||||
const nativeModulesEnabled = process.env.ELECTRON_SKIP_NATIVE_MODULE_TESTS
|
const nativeModulesEnabled = process.env.ELECTRON_SKIP_NATIVE_MODULE_TESTS
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue