本文整理汇总了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;未经允许,请勿转载。 |
请发表评论