MCPcopy
hub / github.com/epicweb-dev/react-performance / main

Function main

epicshop/test.js:62–265  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60}
61
62async function main() {
63 const allApps = (await getApps()).filter((app) => app.test.type === 'script')
64
65 let selectedApps
66 let additionalArgs = []
67
68 // Parse command-line arguments
69 const argIndex = process.argv.indexOf('--')
70 if (argIndex !== -1) {
71 additionalArgs = process.argv.slice(argIndex + 1)
72 process.argv = process.argv.slice(0, argIndex)
73 }
74
75 if (process.argv[2]) {
76 const patterns = process.argv[2].toLowerCase().split(',')
77 selectedApps = allApps.filter((app) => {
78 const { exerciseNumber, stepNumber, type } = app
79
80 return patterns.some((pattern) => {
81 let [patternExercise = '*', patternStep = '*', patternType = '*'] =
82 pattern.split('.')
83
84 patternExercise ||= '*'
85 patternStep ||= '*'
86 patternType ||= '*'
87
88 return (
89 (patternExercise === '*' ||
90 exerciseNumber === Number(patternExercise)) &&
91 (patternStep === '*' || stepNumber === Number(patternStep)) &&
92 (patternType === '*' || type.includes(patternType))
93 )
94 })
95 })
96 } else {
97 const displayNameMap = new Map(
98 allApps.map((app) => [getAppDisplayName(app, allApps), app]),
99 )
100 const choices = displayNameMap.keys()
101
102 const response = await prompt({
103 type: 'autocomplete',
104 name: 'appDisplayNames',
105 message: 'Select apps to test:',
106 choices: ['All', ...choices],
107 multiple: true,
108 suggest: (input, choices) => {
109 return matchSorter(choices, input, { keys: ['name'] })
110 },
111 })
112
113 selectedApps = response.appDisplayNames.includes('All')
114 ? allApps
115 : response.appDisplayNames.map((appDisplayName) =>
116 displayNameMap.get(appDisplayName),
117 )
118
119 // Update this block to use process.argv

Callers 1

test.jsFile · 0.85

Calls 2

captureOutputFunction · 0.85
printTestSummaryFunction · 0.85

Tested by

no test coverage detected