MCPcopy Create free account
hub / github.com/ccxt/ccxt / testExchange

Function testExchange

run-tests.js:274–409  ·  view source on GitHub ↗
(exchange)

Source from the content-addressed store, hash-verified

272const percentsDone = () => ((numExchangesTested / exchanges.length) * 100).toFixed (0) + '%';
273
274const testExchange = async (exchange) => {
275
276 // no need to test alias classes
277 if (exchange.alias) {
278 numExchangesTested++;
279 log.bright (('[' + percentsDone() + ']').dim, 'Tested', exchange.cyan, wsFlag, '[Skipped alias]'.yellow)
280 return [];
281 }
282
283 if (
284 skipSettings[exchange] &&
285 (
286 (skipSettings[exchange].skip && !wsFlag)
287 ||
288 (skipSettings[exchange].skipWs && wsFlag)
289 )
290 ) {
291 if (!('until' in skipSettings[exchange]) || new Date(skipSettings[exchange].until) > new Date()) {
292 numExchangesTested++;
293 const reason = ('until' in skipSettings[exchange]) ? ' till ' + skipSettings[exchange].until : '';
294 log.bright (('[' + percentsDone() + ']').dim, 'Tested', exchange.cyan, wsFlag, ('[Skipped]' + reason).yellow)
295 return [];
296 }
297 }
298
299 // Run tests for all/selected languages (in parallel) //
300 let args = [exchange];
301 if (symbol !== undefined && symbol !== 'all') {
302 args.push(symbol);
303 }
304 if (method !== undefined) {
305 args.push(method);
306 }
307 args = args.concat(exchangeOptions)
308 // pass it to the test(ts/py/php) script too
309 if (debugKeys['--info']) {
310 args.push ('--info')
311 }
312 let allTests = [
313 { key: '--js', language: 'JavaScript', exec: ['node', 'js/src/test/tests.init.js', ...args] },
314 { key: '--python-async', language: 'Python Async', exec: ['python3', 'python/ccxt/test/tests_init.py', ...args] },
315 { key: '--php-async', language: 'PHP Async', exec: ['php', '-f', 'php/test/tests_init.php', ...args] },
316 { key: '--csharp', language: 'C#', exec: ['dotnet', 'run', '--project', 'cs/tests/tests.csproj', ...args] },
317 { key: '--ts', language: 'TypeScript', exec: ['node', '--import', 'tsx', 'ts/src/test/tests.init.ts', ...args] },
318 { key: '--python', language: 'Python', exec: ['python3', 'python/ccxt/test/tests_init.py', '--sync', ...args] },
319 { key: '--php', language: 'PHP', exec: ['php', '-f', 'php/test/tests_init.php', '--', '--sync', ...args] },
320 { key: '--go', language: 'GO', exec: [ 'go', 'run', '-C', 'go', './tests/main.go', ...args] },
321 { key: '--java', language: 'Java', exec: [ './java/gradlew', '-p', 'java', 'tests:run', getJavaArgs(args)] },
322 ];
323
324 // select tests based on cli arguments
325 let selectedTests = [];
326 const langsAreProvided = (Object.values (langKeys).filter (x => x===true)).length > 0;
327 if (langsAreProvided) {
328 selectedTests = allTests.filter (t => langKeys[t.key]);
329 } else {
330 selectedTests = allTests.filter (t => t.key !== '--ts'); // exclude TypeScript when running all tests without specific languages
331 }

Callers 1

testAllExchangesFunction · 0.85

Calls 11

percentsDoneFunction · 0.85
getJavaArgsFunction · 0.85
sequentialMapFunction · 0.85
execFunction · 0.85
pushMethod · 0.80
findMethod · 0.80
indentMethod · 0.80
concatMethod · 0.45
filterMethod · 0.45
valuesMethod · 0.45
reduceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…