@@ -97,18 +97,23 @@ function runCoreMainProcessTests (callback) {
9797 cp . on ( 'close' , exitCode => { callback ( null , { exitCode, step : 'core-main-process' } ) } )
9898}
9999
100- function runCoreRenderProcessTests ( callback ) {
101- const testPath = path . join ( CONFIG . repositoryRootPath , 'spec' )
102- const testArguments = [
103- '--resource-path' , resourcePath ,
104- '--test' , testPath
105- ]
106- const testEnv = prepareEnv ( 'core-render-process' )
107-
108- console . log ( 'Executing core render process tests' . bold . green )
109- const cp = childProcess . spawn ( executablePath , testArguments , { stdio : 'inherit' , env : testEnv } )
110- cp . on ( 'error' , error => { callback ( error ) } )
111- cp . on ( 'close' , exitCode => { callback ( null , { exitCode, step : 'core-render-process' } ) } )
100+ // Build an array of functions, each running tests for a different rendering test
101+ const coreRenderProcessTestSuites = [ ]
102+ const testPath = path . join ( CONFIG . repositoryRootPath , 'spec' )
103+ let testFiles = glob . sync ( path . join ( testPath , '*-spec.+(js|coffee|ts|jsx|tsx|mjs)' ) )
104+ for ( let testFile of testFiles ) {
105+ coreRenderProcessTestSuites . push ( function ( callback ) {
106+
107+ const testEnv = prepareEnv ( 'core-render-process' )
108+ console . log ( `Executing core render process tests for ${ testFile } ` . bold . green )
109+ const testArguments = [
110+ '--resource-path' , resourcePath ,
111+ '--test' , testFile
112+ ]
113+ const cp = childProcess . spawn ( executablePath , testArguments , { stdio : 'inherit' , env : testEnv } )
114+ cp . on ( 'error' , error => { callback ( error ) } )
115+ cp . on ( 'close' , exitCode => { callback ( null , { exitCode, step : `core-render-process for ${ testFile } ` } ) } )
116+ } )
112117}
113118
114119// Build an array of functions, each running tests for a different bundled package
@@ -192,7 +197,7 @@ function requestedTestSuites () {
192197 suites . push ( runCoreMainProcessTests )
193198 }
194199 if ( argv . coreRenderer ) {
195- suites . push ( runCoreRenderProcessTests )
200+ suites . push ( ... coreRenderProcessTestSuites )
196201 }
197202 if ( argv . coreBenchmark ) {
198203 suites . push ( runBenchmarkTests )
@@ -205,24 +210,36 @@ function requestedTestSuites () {
205210
206211function testSuitesForPlatform ( platform ) {
207212 let suites = [ ]
208- if ( ( platform === 'darwin' ) || ( platform === 'win32' && process . arch === 'x64' ) ) {
209- const PACKAGES_TO_TEST_IN_PARALLEL = 23
210-
211- if ( process . env . ATOM_RUN_CORE_TESTS === 'true' ) {
212- suites = [ runCoreMainProcessTests , runCoreRenderProcessTests ]
213- } else if ( process . env . ATOM_RUN_PACKAGE_TESTS === '1' ) {
214- suites = packageTestSuites . slice ( 0 , PACKAGES_TO_TEST_IN_PARALLEL )
215- } else if ( process . env . ATOM_RUN_PACKAGE_TESTS === '2' ) {
216- suites = packageTestSuites . slice ( PACKAGES_TO_TEST_IN_PARALLEL )
217- } else {
218- suites = [ runCoreMainProcessTests , runCoreRenderProcessTests ] . concat ( packageTestSuites )
219- }
220- }
221- else if ( ( platform === 'linux' ) || ( platform === 'win32' && process . arch === 'x86' ) ) {
213+ // Env variable options
214+ let coreMain = process . env . ATOM_RUN_CORE_MAIN_TESTS === 'true'
215+ let coreRenderer1 = process . env . ATOM_RUN_CORE_RENDER_TESTS === '1'
216+ let coreRenderer2 = process . env . ATOM_RUN_CORE_RENDER_TESTS === '2'
217+ let coreAll = process . env . ATOM_RUN_CORE_TESTS === 'true'
218+ let packages1 = process . env . ATOM_RUN_PACKAGE_TESTS === '1'
219+ let packages2 = process . env . ATOM_RUN_PACKAGE_TESTS === '2'
220+
221+ // Operating system overrides:
222+ coreMain = coreMain || ( platform === 'linux' ) || ( platform === 'win32' && process . arch === 'x86' )
223+
224+ // split package tests (used for macos in CI)
225+ const PACKAGES_TO_TEST_IN_PARALLEL = 23
226+ // split core render test (used for windows x64 in CI)
227+ const CORE_RENDER_TO_TEST_IN_PARALLEL = 35
228+
229+ if ( coreMain ) {
222230 suites = [ runCoreMainProcessTests ]
223- }
224- else {
225- console . log ( `Unrecognized platform: ${ platform } ` )
231+ } else if ( coreRenderer1 ) {
232+ suites = coreRenderProcessTestSuites . slice ( 0 , CORE_RENDER_TO_TEST_IN_PARALLEL )
233+ } else if ( coreRenderer2 ) {
234+ suites = coreRenderProcessTestSuites . slice ( CORE_RENDER_TO_TEST_IN_PARALLEL )
235+ } else if ( coreAll ) {
236+ suites = [ runCoreMainProcessTests , ...coreRenderProcessTestSuites ]
237+ } else if ( packages1 ) {
238+ suites = packageTestSuites . slice ( 0 , PACKAGES_TO_TEST_IN_PARALLEL )
239+ } else if ( packages2 ) {
240+ suites = packageTestSuites . slice ( PACKAGES_TO_TEST_IN_PARALLEL )
241+ } else {
242+ suites = [ runCoreMainProcessTests , ...coreRenderProcessTestSuites , ...packageTestSuites ] // all
226243 }
227244
228245 if ( argv . skipMainProcessTests ) {
0 commit comments