Files
orca/config/scripts/mobile-test-change-scope.mjs
T
OrcaWinandm4air b5dec85a4e ci: reuse mobile web route analysis and skip unrelated mobile tests (#23329)
* ci: share mobile route analysis and scope mobile test runs

* ci: cover mobile web runner process dependencies

* test: verify mobile web selectors through the new runner

---------

Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
2026-09-26 21:37:40 -07:00

35 lines
1.1 KiB
JavaScript

import { appendFileSync, readFileSync } from 'node:fs'
import { pathToFileURL } from 'node:url'
import { isDocsOnlyPath } from './pr-code-change-scope.mjs'
const NON_TEST_FILES = new Set([
'mobile/Gemfile',
'mobile/Gemfile.lock',
'mobile/README.md',
'.github/workflows/mobile-ios-release.yml',
'config/scripts/pr-code-change-scope.mjs',
'config/scripts/pr-code-change-scope.test.mjs',
'config/scripts/mobile-release-check-scope.mjs',
'config/scripts/mobile-release-check-scope.test.mjs'
])
export function shouldRunMobileTests(files) {
return (
files.length === 0 ||
files.some(
(file) =>
file.split('/').includes('..') ||
(!isDocsOnlyPath(file) &&
!NON_TEST_FILES.has(file) &&
!file.startsWith('mobile/docs/') &&
!file.startsWith('mobile/fastlane/'))
)
)
}
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
const input = readFileSync(process.argv[2], 'utf8')
const files = input.endsWith('\0') ? input.slice(0, -1).split('\0') : []
appendFileSync(process.env.GITHUB_OUTPUT, `should_run=${shouldRunMobileTests(files)}\n`)
}