How to use ts-node - 10 common examples

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 digabi / rich-text-editor / test / testRunner.js View on Github external
#!/usr/bin/env node
require('ts-node').register()

/* eslint-disable no-console */
const server = require('./testServer')
const serverInfo = server.listen(0, () => {
    setTimeout(() => {
        console.log('Server started at localhost:' + serverInfo.address().port)
        const spawn = require('child_process').spawn
        const mochaChrome = spawn('mocha-chrome', [`http://localhost:${serverInfo.address().port}/test/tests.html`])
        mochaChrome.stdout.pipe(process.stdout)
        mochaChrome.stderr.pipe(process.stderr)
        mochaChrome.on('close', code => {
            process.exit(code)
        })
        mochaChrome.on('error', err => {
            console.log(err)
            process.exit(1)
github wswebcreation / protractor-image-comparison / test / conf / protractor.shared.conf.js View on Github external
onPrepare: async () => {
		// Transpile on the fly
		require('ts-node').register({
			project: resolve(__dirname, './tsconfig.e2e.json')
		});

		// Disable Angular, because it's not an angular site
		await browser.waitForAngularEnabled(false);

		// Add the reporter
		jasmine.getEnv().addReporter(new SpecReporter({
			spec: {
				displayStacktrace: 'none',
				displayFailuresSummary: false,
				displayPendingSummary: false,
				displayPendingSpec: true,
				displaySpecDuration: true
			}
		}));
github UXAspects / UXAspects / e2e / protractor.config.js View on Github external
onPrepare: function () {

    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });

    mkdirpSync(junitDir);

    // returning the promise makes protractor wait for the reporter config before executing tests
    return browser.getProcessedConfig().then(function (config) {
      browser.driver.getCapabilities().then(function (caps) {
        browser.browserName = caps.get('browserName');
      });

      const browserName = config.capabilities.browserName;

      // Add reporter which will output results in XML format
      jasmine.getEnv().addReporter(
        new JUnitXmlReporter({
github NationalBankBelgium / stark / packages / stark-testing / protractor.conf.js View on Github external
require("ts-node").register({
	project: "e2e/tsconfig.e2e.json"
});

const helpers = require("./helpers");

exports.config = {
	baseUrl: "http://localhost:3000/",

	/**
	 * Use `npm run e2e`
	 */
	specs: [helpers.root("./e2e/src/**/**.e2e-spec.ts"), helpers.root("e2e/src/**/*.e2e-spec.ts")],
	exclude: [],

	framework: "jasmine2",
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];
github valoryteam / valory / src / lib / cli.ts View on Github external
async function compilerRunner(args: any) {
	printHeader();
	await checkRequirements();
	const start = process.hrtime();
	require("ts-node").register({
		project: Config.TSConfigPath,
		pretty: false,
		typeCheck: false,
		transpileOnly: true,
	});
	if (args.prettylog) {
		process.env.PRETTYLOG = "true";
	}
	if (Config.SourceRoutePath !== "") {
		await routeBuild(Config.ConfigData.sourceEntrypoint);
	}
	console.log(chalk.bold("Appserver Warmup"));
	await Spinner.start("Registering routes");
	let valExport: { valory: ValoryMetadata };
	try {
		require((Config.ConfigData.sourceEntrypoint !== ""
github sparkles-dev / angular-protractor-cucumber / protractor.conf.js View on Github external
onPrepare() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
   }
};
github s00d / webpack-shell-plugin-next / webpack.config.js View on Github external
require('ts-node').register({
  project: 'tsconfig.json'
});

module.exports = require('./webpack.config.ts').default;
github garrylachman / ElectroCRUD / e2e / protractor.conf.js View on Github external
beforeLaunch: function () {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
  },
  onPrepare() {
github rostag / bigpolicy_eu / protractor.conf.js View on Github external
beforeLaunch: function() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
  },
  onPrepare() {

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