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

TypeScript source-map-support.install函数代码示例

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

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



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

示例1: enableSourceMaps

export function enableSourceMaps() {
  sourceMapSupport.install({
    environment: 'node',
    handleUncaughtExceptions: false,
    retrieveSourceMap,
  })

  const AnyError = Error as any
  // We want to keep `source-map-support`s `prepareStackTrace` around to use
  // later, but our cheaper `prepareStackTrace` should be the default.
  prepareStackTraceWithSourceMap = AnyError.prepareStackTrace
  AnyError.prepareStackTrace = prepareStackTrace
}
开发者ID:Aj-ajaam,项目名称:desktop,代码行数:13,代码来源:source-map-support.ts


示例2: installSourceMapSupport

function installSourceMapSupport(filesystem: typeof fs) {
  sourceMapSupport.install({
    // NOTE: If https://github.com/evanw/node-source-map-support/pull/149
    // lands we can be less aggressive and explicitly invalidate the source
    // map cache when Webpack recompiles.
    emptyCacheBetweenOperations: true,
    retrieveFile(source) {
      try {
        return filesystem.readFileSync(source, "utf8");
      } catch (ex) {
        // Doesn't exist
        return "";
      }
    }
  });
}
开发者ID:leebenson,项目名称:cli,代码行数:16,代码来源:hotServerMiddleware.ts


示例3: run

export async function run(_testRoot: string, callback: TestRunnerCallback) {
    // Enable source map support. This is done in the original Mocha test runner,
    // so do it here. It is not clear if this is having any effect.
    sourceMapSupport.install();

    // Forward logging from Jest to the Debug Console.
    forwardStdoutStderrStreams();

    try {
        const { results } = await runCLI(jestConfig as any, [rootDir]);

        const failures = collectTestFailureMessages(results);

        if (failures.length > 0) {
            callback(null, failures);
            return;
        }

        callback(null);
    } catch (e) {
        callback(e);
    }
}
开发者ID:Jason-Rev,项目名称:vscode-spell-checker,代码行数:23,代码来源:jest-test-runner.ts


示例4:

'use strict';

import * as fs from 'fs';
import * as path from 'path';
import * as util from 'util';

import * as P from 'parsimmon';
import * as glob from 'glob';
import * as sms from 'source-map-support';

import * as chai from 'chai';

let assert = chai.assert;

sms.install();

import * as DH from '../../src/';

let testDir = path.resolve(__dirname, '..');
let repoDir = path.join(testDir, '..', 'repo');

describe('full repo', () => {
	if (!fs.existsSync(repoDir)) {
		return;
	}

	let files = glob.sync('*/*.d.ts', {
		cwd: repoDir
	});

	files.sort();
开发者ID:rakatyal,项目名称:definition-header,代码行数:31,代码来源:repo.test.ts


示例5: Thinker

import * as readLine from "readline";
import RequestScope from "../core/communication/RequestScope";
import Thinker from "../core/think/Thinker";
import DataStore from "../core/data/DataStore";
import User from "../core/data/model/User";

import * as smp from "source-map-support";
smp.install();

const data = DataStore.createFromSettings();
const thinker = new Thinker();
data.open();

const user = new User();
data.save(user).then( () => {
    let reader = readLine.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    reader.on('line', function (line) {
        const rs = new RequestScope(user.id, line,new Date, 0 );
        thinker.think(rs, data)
            .then(() => {
                for(let i in rs.meshinatorMessages){
                    console.log(rs.meshinatorMessages[i]);
                }
            })
            .catch( e => console.log(e));

    });
    process.stdin.on('end', function () {
开发者ID:Huruikagi,项目名称:Meshinator,代码行数:31,代码来源:consoleTest.ts


示例6: runTestInternal


//.........这里部分代码省略.........
    changedFiles: context && context.changedFiles,
    collectCoverage: globalConfig.collectCoverage,
    collectCoverageFrom: globalConfig.collectCoverageFrom,
    collectCoverageOnlyFrom: globalConfig.collectCoverageOnlyFrom,
  });

  const start = Date.now();

  const sourcemapOptions: SourceMapOptions = {
    environment: 'node',
    handleUncaughtExceptions: false,
    retrieveSourceMap: source => {
      const sourceMaps = runtime && runtime.getSourceMaps();
      const sourceMapSource = sourceMaps && sourceMaps[source];

      if (sourceMapSource) {
        try {
          return {
            map: JSON.parse(fs.readFileSync(sourceMapSource, 'utf8')),
            url: source,
          };
        } catch (e) {}
      }
      return null;
    },
  };

  // For tests
  runtime
    .requireInternalModule(
      require.resolve('source-map-support'),
      'source-map-support',
    )
    .install(sourcemapOptions);

  // For runtime errors
  sourcemapSupport.install(sourcemapOptions);

  if (
    environment.global &&
    environment.global.process &&
    environment.global.process.exit
  ) {
    const realExit = environment.global.process.exit;

    environment.global.process.exit = function exit(...args: Array<any>) {
      const error = new ErrorWithStack(
        `process.exit called with "${args.join(', ')}"`,
        exit,
      );

      const formattedError = formatExecError(
        error,
        config,
        {noStackTrace: false},
        undefined,
        true,
      );

      process.stderr.write(formattedError);

      return realExit(...args);
    };
  }

  try {
开发者ID:Volune,项目名称:jest,代码行数:67,代码来源:runTest.ts


示例7:

import fs from 'fs'
import { app, screen, ipcMain, BrowserWindow } from 'electron'
import DB from 'sqlite3-helper/no-generators'
import { install as initSourceMapSupport } from 'source-map-support'
import { start as initPrettyError } from 'pretty-error'

import MainMenu from './MainMenu'
// import Usb from './usb'
import config from '../common/config'
import Watch from './watch'
import { init as initBackgroundService } from './BackgroundService'
import { init as initForegroundClient } from './ForegroundClient'


initSourceMapSupport()
initPrettyError()

let initDbPromise: Promise<void> | null = null
let mainWindow: BrowserWindow | null = null


if (!fs.existsSync(config.dotAnsel))
    fs.mkdirSync(config.dotAnsel)


app.on('window-all-closed', () => {
    // if (process.platform !== 'darwin')
    app.quit()
})

app.on('ready', () => {
开发者ID:m0g,项目名称:ansel,代码行数:31,代码来源:entry.ts


示例8:

import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import * as Bluebird from "bluebird";
import * as sourceMapSupport from "source-map-support";

Bluebird.longStackTraces();
sourceMapSupport.install({
    handleUncaughtExceptions: false
});

chai.use(chaiAsPromised);
开发者ID:SierraSoftworks,项目名称:Iridium,代码行数:11,代码来源:chai.ts


示例9: Koa

"use strict";
import * as sourceMap from "source-map-support";
import * as Koa from "koa";
import { RouterBuilder } from "./Routes/RouterBuilder";
import * as bodyParser from "koa-bodyparser";
import * as Router from "koa-router";
import { activator } from "./DependencyInjection/Activator";
import { generateMiddleware } from "./DependencyInjection/KoaActivatorExtension";
import { A, B } from "./InjectionTest";
import "./Controllers";


sourceMap.install();

const app = new Koa();
const builder = new RouterBuilder();

activator.addSingleton("a1", A)
    .addScoped("a2", A)
    .addTransient("a3", A)
    .addTransient("b", B);

app.use(generateMiddleware(activator));

app.use(bodyParser());

app.use(builder.routes());
app.use(builder.allowedMethods());

app.listen(9001);
开发者ID:Norgerman,项目名称:Koa-ts,代码行数:30,代码来源:app.ts


示例10:

/// <reference path="../typings/main.d.ts" />

import { install as sourcemapSupport } from 'source-map-support';
import 'mocha';

sourcemapSupport({ handleUncaughtExceptions: false });

export { expect } from 'chai';
开发者ID:leonadler,项目名称:leons-restquest-bot,代码行数:8,代码来源:tests-base.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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