• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript karma.Server类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中karma.Server的典型用法代码示例。如果您正苦于以下问题:TypeScript Server类的具体用法?TypeScript Server怎么用?TypeScript Server使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Server类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: 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


示例2: 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


示例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:

 let runTests = (err?: Error) => {
   if (!err) {
     server.refreshFiles().then(() => server._injector.get('executor').schedule());
   }
 };
开发者ID:attilacsanyi,项目名称:material2,代码行数:5,代码来源:unit-test.ts


示例10:

 let runTests = () => {
   server.refreshFiles().then(() => server._injector.get('executor').schedule());
 };
开发者ID:dharmeshpipariya,项目名称:material2,代码行数:3,代码来源:unit-test.ts



注:本文中的karma.Server类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript karma.server类代码示例发布时间:2022-05-25
下一篇:
TypeScript kaiju.h函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap