async run() {
    const { flags } = await this.parse(PluginTestCommand);
    const dbname = flags.database ? flags.database : "saltcorn_test";
    let env = null;
    const db = require("@saltcorn/data/db");
    if (db.isSQLite) {
      const testdbpath = "/tmp/sctestdb";
      await db.changeConnection({ sqlite_path: testdbpath });
      env = { ...process.env, SQLITE_FILEPATH: testdbpath };
    } else if (db.connectObj.database !== dbname) {
      await db.changeConnection({ database: dbname });
      env = { ...process.env, PGDATABASE: dbname };
    }
    let jestStatus = null;
    try {
      if (flags.directory) {
        console.log(`Testing local plugin in '${flags.directory}'`);
        jestStatus = await testLocalPlugin(
          flags.directory,
          env,
          flags.backupFile
        );
      } else if (flags.name) {
        console.log(`Testing released plugin '${flags.name}'`);
        jestStatus = await testReleasedPlugin(
          flags.name,
          env,
          flags.backupFile
        );
      }
    } catch (error) {
      console.log(error);
      removePluginsDir();
      process.exit(1);
    }
    removePluginsDir();
    if (jestStatus === 0) {
      console.log("Tests passed");
      process.exit(0);
    } else {
      console.log("Tests failed");
      process.exit(1);
    }
  }
Install a plugin, spawn 'npm run test' in the install dir and check the return code