testblocks 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -40,6 +40,7 @@ const path = __importStar(require("path"));
40
40
  const glob_1 = require("glob");
41
41
  const executor_1 = require("./executor");
42
42
  const reporters_1 = require("./reporters");
43
+ const startServer_1 = require("../server/startServer");
43
44
  const program = new commander_1.Command();
44
45
  program
45
46
  .name('testblocks')
@@ -229,7 +230,7 @@ program
229
230
  'test:junit': 'testblocks run tests/**/*.testblocks.json -r junit -o reports',
230
231
  },
231
232
  devDependencies: {
232
- testblocks: '^1.0.0',
233
+ testblocks: '^0.3.0',
233
234
  },
234
235
  };
235
236
  fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2));
@@ -340,7 +341,8 @@ Thumbs.db
340
341
  console.log(' 1. cd ' + (directory === '.' ? '' : directory));
341
342
  console.log(' 2. npm install');
342
343
  console.log(' 3. npm test\n');
343
- console.log('Or open the folder in TestBlocks web editor to create tests visually.\n');
344
+ console.log('To open the visual test editor:');
345
+ console.log(' testblocks serve\n');
344
346
  });
345
347
  program
346
348
  .command('list')
@@ -372,6 +374,24 @@ program
372
374
  process.exit(1);
373
375
  }
374
376
  });
377
+ program
378
+ .command('serve')
379
+ .description('Start the TestBlocks web UI')
380
+ .option('-p, --port <port>', 'Port to run on', '3000')
381
+ .option('--plugins-dir <dir>', 'Plugins directory', './plugins')
382
+ .option('--globals-dir <dir>', 'Globals directory (where globals.json is located)', '.')
383
+ .option('-o, --open', 'Open browser automatically', false)
384
+ .action(async (options) => {
385
+ const port = parseInt(options.port, 10);
386
+ const pluginsDir = path.resolve(options.pluginsDir);
387
+ const globalsDir = path.resolve(options.globalsDir);
388
+ await (0, startServer_1.startServer)({
389
+ port,
390
+ pluginsDir,
391
+ globalsDir,
392
+ open: options.open,
393
+ });
394
+ });
375
395
  function createReporter(type, outputDir) {
376
396
  switch (type) {
377
397
  case 'json':