當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Server.start方法代碼示例

本文整理匯總了TypeScript中karma.Server.start方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Server.start方法的具體用法?TypeScript Server.start怎麽用?TypeScript Server.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在karma.Server的用法示例。


在下文中一共展示了Server.start方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: Promise

 return new Promise((resolve, reject) => {
     const server = new karma.Server(config);
     server.on("run_complete", (browsers, results) => {
         resolve(results);
     });
     server.start();
 });
開發者ID:SignalR,項目名稱:SignalR,代碼行數:7,代碼來源:run-tests.ts

示例2: task

task('test', [':test:build'], () => {
  let patternRoot = join(packagesDir, '**/*');
  // Load karma not outside. Karma pollutes Promise with a different implementation.
  let karma = require('karma');

  // Configure the Karma server and override the autoWatch and singleRun just in case.
  let server = new karma.Server({
    configFile: join(projectDir, 'test/karma.conf.js'),
    autoWatch: false,
    singleRun: false
  });

  // Refreshes Karma's file list and schedules a test run.
  // Tests will only run if TypeScript compilation was successful.
  let runTests = (err?: Error) => {
    if (!err) {
      server.refreshFiles().then(() => server._injector.get('executor').schedule());
    }
  };

  // Boot up the test server and run the tests whenever a new browser connects.
  server.start();
  server.on('browser_register', () => runTests());

  // Whenever a file change has been recognized, rebuild and re-run the tests.
  watch(patternRoot + '.+(ts|scss|html)', () => runSequence(':test:build', runTests));
});
開發者ID:attilacsanyi,項目名稱:material2,代碼行數:27,代碼來源:unit-test.ts

示例3: runTests

gulp.task('test', [':test:deps'], () => {
  let patternRoot = path.join(COMPONENTS_DIR, '**/*');

  // Configure the Karma server and override the autoWatch and singleRun just in case.
  let server = new karma.Server({
    configFile: path.join(PROJECT_ROOT, 'test/karma.conf.js'),
    autoWatch: false,
    singleRun: false
  });

  // Refreshes Karma's file list and schedules a test run.
  // Tests will only run if TypeScript compilation was successful.
  let runTests = (err?: Error) => {
    if (!err) {
      server.refreshFiles().then(() => server._injector.get('executor').schedule());
    }
  };

  // Boot up the test server and run the tests whenever a new browser connects.
  server.start();
  server.on('browser_register', () => runTests());

  // Watch for file changes, rebuild and run the tests.
  gulp.watch(patternRoot + '.ts', () => runSequence(':build:components:ts:spec', runTests));
  gulp.watch(patternRoot + '.scss', () => runSequence(':build:components:scss', runTests));
  gulp.watch(patternRoot + '.html', () => runSequence(':build:components:assets', runTests));
});
開發者ID:Promact,項目名稱:md2,代碼行數:27,代碼來源:unit-test.ts

示例4: init

    protected init(cb: any) {
        const karma = require('karma')

        const server = new karma.Server(
            options,
            this.finish.bind(this, cb)
        )

        server.start()

        cb()
    }
開發者ID:ifedu,項目名稱:speedseed-multi-tic-tac-toe,代碼行數:12,代碼來源:spec.ts

示例5: Server

  return new Promise<number>(resolve => {
    const server = new Server(karmaConfig, exitCode => {
      debug(`Karma finished.`);
      if (sauceConnectProcess) {
        debug(`Tries to close Sauce Connect.`);
        sauceConnectProcess.close(() => {
          debug(`Closed Sauce Connect.`);
          resolve(exitCode);
        });
      } else {
        resolve(exitCode);
      }
    });

    debug(`Start Karma.`);
    server.start();
  });
開發者ID:otbe,項目名稱:ws,代碼行數:17,代碼來源:karma.ts

示例6: resolve

 return new Promise<boolean>((resolve, reject) => {
     const karmaServer = new karma.Server({
         port: 9876,
         configFile: process.cwd() + '/karma.conf.js',
         singleRun: true,
         client: {
             host,
             port,
             baseURL: `http://${host}:${port}`,
             mainModule
         }
     }, exitCode => {
         console.log(`Karma server finished with exit code ${exitCode}`);
     });
     karmaServer.on('run_complete', (browsers, result) => {
         resolve(!result.error)
     });
     karmaServer.start();
 });
開發者ID:kleopatra999,項目名稱:bundless,代碼行數:19,代碼來源:karma-server.ts

示例7: resolve

            return new Promise<boolean>((resolve, reject) => {

                const karmaServer = new karma.Server({
                    port: karmaPort,
                    configFile: process.cwd() + '/karma.conf.js',
                    singleRun: true,
                    browserNoActivityTimeout: 100000,
                    client: {
                        baseURL: `http://${host}:${port}${basePath}`,
                        mainModule
                    }
                }, exitCode => {
                    console.log(`Karma server finished with exit code ${exitCode}`);
                });
                karmaServer.on('run_complete', (browsers, result) => {
                    if(result.exitCode === 0) {
                        resolve(!result.error);
                    } else {
                        reject(`Karma exited with code ${result.exitCode}`);
                    }
                });
                karmaServer.start();
            });
開發者ID:wix,項目名稱:bundless,代碼行數:23,代碼來源:karma-server.ts

示例8: return

  return () => {
    const patternRoot = join(buildConfig.packagesDir, '**/*');
    // Note: Karma shouldn't be required from the outside, because it
    // pollutes the global Promise with a custom implementation.
    const karma = require('karma');

    // Configure the Karma server and override the autoWatch and singleRun just in case.
    const server = new karma.Server({...defaultOptions, ...options});

    // Refreshes Karma's file list and schedules a test run.
    // Tests will only run if TypeScript compilation was successful.
    const runTests = (error?: Error) => {
      if (!error) {
        server.refreshFiles().then(() => server._injector.get('executor').schedule());
      }
    };

    // Boot up the test server and run the tests whenever a new browser connects.
    server.start();
    server.on('browser_register', () => runTests());

    // Whenever a file change has been recognized, rebuild and re-run the tests.
    watch(patternRoot + '.+(ts|scss|html)', () => runSequence(':test:build', runTests));
  };
開發者ID:GuzmanPI,項目名稱:material2,代碼行數:24,代碼來源:unit-test.ts

示例9: require

});


karma.runner.run({port: 9876}, (exitCode: number) => {
  console.log('Karma has exited with ' + exitCode);
  process.exit(exitCode);
});


var Server = require('karma').Server;
var server = new Server({port: 9876}, function(exitCode: number) {
    console.log('Karma has exited with ' + exitCode);
    process.exit(exitCode);
});

server.start();

server.refreshFiles();

server.on('browser_register', function (browser: any) {
    console.log('A new browser was registered');
});

var runner = require('karma').runner;
runner.run({port: 9876}, function(exitCode: number) {
    console.log('Karma has exited with ' + exitCode);
    process.exit(exitCode);
});

//
開發者ID:ErykB2000,項目名稱:DefinitelyTyped,代碼行數:30,代碼來源:karma-tests.ts


注:本文中的karma.Server.start方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。