How to use the ts-node/dist.register function in ts-node

To help you get started, we’ve selected a few ts-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github svi3c / jasmine-ts / src / index.ts View on Github external
"getFile",
  "fileExists",
  "compilerOptions",
  "transpileOnly",
  "typeCheck",
];

const tsNodeOptions = Object.assign({}, ...TS_NODE_OPTIONS.map((option) => {
  if (argv[option]) {
    return (option === "compilerOptions")
      ? {compilerOptions: parse(argv[option] as string)}
      : {[option]: argv[option]};
  }
}));

register(tsNodeOptions);

const Jasmine = require("jasmine");
const Command = require("jasmine/lib/command");

const jasmine = new Jasmine({ projectBaseDir: path.resolve() });
const examplesDir = path.join("node_modules", "jasmine-core", "lib", "jasmine-core", "example", "node_example");
const command = new Command(path.resolve(), examplesDir, console.log);
const configPath = argv.config || process.env.JASMINE_CONFIG_PATH || "spec/support/jasmine.json";

const initReporters = (config: any) => {
  if (config.reporters && config.reporters.length > 0) {
    jasmine.env.clearReporters();
    config.reporters.forEach((reporter: {name: string, options: any}) => {
      const parts = reporter.name.split("#");
      const name = parts[0];
      const member = parts[1];

ts-node

TypeScript execution environment and REPL for node.js, with source map support

MIT
Latest version published 4 months ago

Package Health Score

90 / 100
Full package analysis