MCPcopy Create free account
hub / github.com/cfworker/cfworker / execute

Method execute

packages/dev/src/cli/test-command.js:36–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34 }
35
36 async execute() {
37 if (!this.args.watch) {
38 this.bundler.on('bundle-error', () => process.exit(1));
39 if (!this.args.inspect) {
40 this.testHost.workerHost.on('worker-error', () => process.exit(1));
41 }
42 }
43
44 const siteInitialized = this.site ? this.site.init() : Promise.resolve();
45
46 await Promise.all([
47 this.bundler.bundle(),
48 this.testHost.start(),
49 siteInitialized,
50 this.kv.init()
51 ]);
52
53 const failures = await this.testHost.runTests(
54 this.bundler.code,
55 this.site ? this.site.manifest : null
56 );
57
58 if (this.args.watch) {
59 const update = () =>
60 this.testHost.runTests(
61 this.bundler.code,
62 this.site ? this.site.manifest : null
63 );
64 this.bundler.on('bundle-end', update);
65 if (this.site) {
66 this.site.on('change', update);
67 }
68 } else {
69 this.dispose();
70 process.exit(failures ? 1 : 0);
71 }
72 }
73
74 dispose() {
75 this.bundler.dispose();

Callers 3

Calls 8

disposeMethod · 0.95
onMethod · 0.80
resolveMethod · 0.80
allMethod · 0.80
bundleMethod · 0.80
runTestsMethod · 0.80
initMethod · 0.45
startMethod · 0.45

Tested by 3