Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: transpile suites to latest target #195

Merged
merged 1 commit into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,8 @@ async function prepareSuites(inputs: string[]) {
} else {
/**
* Preload modules before running the suites
* we support `.ts` files out of the box by invoking
* the `ts-node` via `transpile-only` mode which only compiles
* TS files without doing any extensive type checks
*/
const modules = ['ts-node/register/transpile-only']
.concat(program.require || [])
.filter(Boolean);
const modules = [].concat(program.require || []).filter(Boolean);
for (const name of modules) {
if (isDepInstalled(name)) {
require(name);
Expand All @@ -135,7 +130,21 @@ async function prepareSuites(inputs: string[]) {
}
}
/**
* Handled piped files by reading the STDIN
* Transform `.ts` files out of the box by invoking
* the `ts-node` via `transpile-only` mode that compiles
* TS files without doing any extensive type checks
*/
/* eslint-disable-next-line @typescript-eslint/no-var-requires */
require('ts-node').register({
transpileOnly: true,
compilerOptions: {
esModuleInterop: true,
allowJs: true,
target: 'es2018',
},
});
/**
* Handle piped files by reading the STDIN
* ex: ls example/suites/*.js | npx @elastic/synthetics
*/
const files =
Expand Down
11 changes: 8 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ import { runner } from './core';
import { RunOptions } from './core/runner';
import { setLogger } from './core/logger';
import { parseArgs } from './parse_args';

/* eslint-disable @typescript-eslint/no-var-requires */
require('source-map-support').install();
import sourceMapSupport from 'source-map-support';

export async function run(options: RunOptions) {
/**
* Install source map support
*/
sourceMapSupport.install({
environment: 'node',
});

const cliArgs = parseArgs();
/**
* Use the NODE_ENV variable to control the environment if its not explicity
Expand Down