MCPcopy
hub / github.com/meteor/meteor / doTestCommand

Function doTestCommand

tools/cli/commands.js:1652–1912  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

1650});
1651
1652function doTestCommand(options) {
1653 // This "metadata" is accessed in a few places. Using a global
1654 // variable here was more expedient than navigating the many layers
1655 // of abstraction across the the build process.
1656 //
1657 // As long as the Meteor CLI runs a single command as part of each
1658 // process, this should be safe.
1659 global.testCommandMetadata = {};
1660
1661 Console.setVerbose(!!options.verbose);
1662 if (options.headless) {
1663 Console.setHeadless(true);
1664 }
1665
1666 const runTargets = parseRunTargets(_.intersection(
1667 Object.keys(options), ['ios', 'ios-device', 'android', 'android-device']));
1668
1669 const { parsedServerUrl, parsedMobileServerUrl, parsedCordovaServerPort } =
1670 parseServerOptionsForRunCommand(options, runTargets);
1671
1672 // Make a temporary app dir (based on the test runner app). This will be
1673 // cleaned up on process exit. Using a temporary app dir means that we can
1674 // run multiple "test-packages" commands in parallel without them stomping
1675 // on each other.
1676 let testRunnerAppDir;
1677 const testAppPath = options['test-app-path'];
1678 if (testAppPath) {
1679 const absTestAppPath = files.pathResolve(testAppPath);
1680 try {
1681 if (files.mkdir_p(absTestAppPath, 0o700)) {
1682 testRunnerAppDir = absTestAppPath;
1683 } else {
1684 Console.error(
1685 'The specified --test-app-path directory could not be used, as ' +
1686 `"${testAppPath}" already exists and it is not a directory.`
1687 );
1688 return 1;
1689 }
1690 } catch (error) {
1691 Console.error(
1692 'Unable to create the specified --test-app-path directory of ' +
1693 `"${testAppPath}".`
1694 );
1695 throw error;
1696 }
1697 }
1698
1699 if (!testRunnerAppDir) {
1700 testRunnerAppDir = files.mkdtemp('meteor-test-run');
1701 }
1702
1703 // Download packages for our architecture, and for the deploy server's
1704 // architecture if we're deploying.
1705 var serverArchitectures = [archinfo.host()];
1706 if (options.deploy && DEPLOY_ARCH !== archinfo.host()) {
1707 serverArchitectures.push(DEPLOY_ARCH);
1708 }
1709

Callers 1

commands.jsFile · 0.85

Calls 15

parseRunTargetsFunction · 0.85
getTestPackageNamesFunction · 0.85
copyDirIntoTestRunnerAppFunction · 0.85
prepareCordovaProjectFunction · 0.85
runTestAppForPackagesFunction · 0.85
setVerboseMethod · 0.80
installMethod · 0.80
indexOfMethod · 0.80
mapMethod · 0.80
isEmptyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…