@shopify/cli
Version:
A CLI tool to build for the Shopify platform
37 lines • 1.51 kB
JavaScript
import ThemeInitTests from './tests/init.js';
import ThemePushTests from './tests/push.js';
import { createDoctorContext } from '../context.js';
import { reportTestStart, reportTestResult, reportSuiteStart, reportSummary, initReporter, } from '@shopify/cli-kit/node/doctor/reporter';
// Test suites run in order. If a test relies on another, ensure that test runs after it's dependency.
const themeSuites = [ThemeInitTests, ThemePushTests];
/**
* Run all theme doctor tests.
* Stops on first failure.
*/
export async function runThemeDoctor(options) {
const results = [];
const context = createDoctorContext(options);
// Initialize reporter with working directory
initReporter(context.workingDirectory);
// Run all test suites in order
for (const SuiteClass of themeSuites) {
const suite = new SuiteClass();
const description = SuiteClass.description ?? 'Test suite';
reportSuiteStart(SuiteClass.name, description);
// eslint-disable-next-line no-await-in-loop
const suiteResults = await suite.runSuite(context);
for (const result of suiteResults) {
reportTestStart(result.name);
reportTestResult(result);
results.push(result);
// Stop on first failure
if (result.status === 'failed') {
reportSummary(results);
return results;
}
}
}
reportSummary(results);
return results;
}
//# sourceMappingURL=runner.js.map