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


TypeScript http-server.createServer函數代碼示例

本文整理匯總了TypeScript中http-server.createServer函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript createServer函數的具體用法?TypeScript createServer怎麽用?TypeScript createServer使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: test

        test('when a non-sourcemapped script is skipped via regex, it can be unskipped', async () => {
            // Using this program, but run with sourcemaps disabled
            const testProjectRoot = path.join(DATA_ROOT, 'calls-between-sourcemapped-files');
            const sourceA = path.join(testProjectRoot, 'out/sourceA.js');
            const sourceB = path.join(testProjectRoot, 'out/sourceB.js');

            server = createServer({ root: testProjectRoot });
            server.listen(7890);

            const url = 'http://localhost:7890/index.html';

            // Skip the full B generated script via launch config
            const skipFiles = ['sourceB.js'];
            const bpLineA = 5;
            await dc.hitBreakpointUnverified({ url, sourceMaps: false, skipFiles, webRoot: testProjectRoot }, { path: sourceA, line: bpLineA });

            // Step in, verify B sources are skipped
            await dc.stepInRequest();
            await dc.assertStoppedLocation('step', { path: sourceA, line: 2 });
            await dc.send('toggleSkipFileStatus', { path: sourceB });

            // Continue back to A, step in, should land in B
            await dc.continueRequest();
            await dc.assertStoppedLocation('breakpoint', { path: sourceA, line: bpLineA });
            await dc.stepInRequest();
            await dc.assertStoppedLocation('step', { path: sourceB, line: 2 });
        });
開發者ID:snailuncle,項目名稱:vscode-chrome-debug,代碼行數:27,代碼來源:stepping.test.ts

示例2: createServer

(async() => {
  let passed = 0, failed = 0;

  const server = createServer({ root: "./build/website" });
  server.listen();
  const port = server.server.address().port;

  const browser = await puppeteer.launch({
    args: ["--no-sandbox", "--disable-setuid-sandbox"],
    headless: !debug && !testdl
  });

  for (let i = 0; i < TESTS.length; i++) {
    const test = TESTS[i];
    if (await runTest(browser, port, test)) {
      passed++;
    } else {
      failed++;
    }
  }

  if (debug) {
    await new Promise((res) => process.stdin.once("data", res));
  }

  await browser.close();
  server.close();

  console.log(`DONE. passed: ${passed}, failed: ${failed}`);
  if (failed > 0) {
    process.exit(1);
  }
})();
開發者ID:Befirst-Solutions,項目名稱:propel,代碼行數:33,代碼來源:test_browser.ts

示例3: test

        test('Column BP is hit on correct column', async () => {
            const testProjectRoot = path.join(DATA_ROOT, 'columns');
            const scriptPath = path.join(testProjectRoot, 'src/script.ts');

            server = createServer({ root: testProjectRoot });
            server.listen(7890);

            const url = 'http://localhost:7890/index.html';

            const bpLine = 4;
            const bpCol = 16;
            await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol });
        });
開發者ID:snailuncle,項目名稱:vscode-chrome-debug,代碼行數:13,代碼來源:breakpoints.test.ts

示例4: test

        test('Hits a single breakpoint in a file on load', async () => {
            const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_javaScript');
            const scriptPath = path.join(testProjectRoot, 'src/script.js');

            server = createServer({ root: testProjectRoot });
            server.listen(7890);

            const url = 'http://localhost:7890/index.html';

            const bpLine = 3;
            const bpCol = 12;

            await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol });
        });
開發者ID:snailuncle,項目名稱:vscode-chrome-debug,代碼行數:14,代碼來源:breakOnLoad.test.ts

示例5: test

        test('should stop on debugger statement in http://localhost', () => {
            const testProjectRoot = path.join(DATA_ROOT, 'intervalDebugger');
            const breakFile = path.join(testProjectRoot, 'src/app.ts');
            const DEBUGGER_LINE = 2;

            const server = createServer({ root: testProjectRoot });
            server.listen(7890);

            return Promise.all([
                dc.configurationSequence(),
                dc.launch({ url: 'http://localhost:7890', webRoot: testProjectRoot }),
                dc.assertStoppedLocation('debugger_statement', { path: breakFile, line: DEBUGGER_LINE } )
            ])
            .then(
                () => server.close(),
                e => {
                    server.close();
                    throw e;
                });
        });
開發者ID:snailuncle,項目名稱:vscode-chrome-debug,代碼行數:20,代碼來源:adapter.test.ts


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