Skip to content

Commit

Permalink
actually dont import - causes issues
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss committed Sep 18, 2021
1 parent 8037766 commit 83e513b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ import HttpStream from '../formatter/http_stream'
import { promisify } from 'util'
import { Writable } from 'stream'
import { pathToFileURL } from 'url'
import importer from '../importer'

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { importer } = require('../importer')
const { incrementing, uuid } = IdGenerator

export interface ICliRunResult {
Expand Down
3 changes: 2 additions & 1 deletion src/formatter/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import { IParsedArgvFormatOptions } from '../cli/argv_parser'
import { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax'
import HtmlFormatter from './html_formatter'
import { pathToFileURL } from 'url'
import importer from '../importer'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { importer } = require('../importer')

interface IGetStepDefinitionSnippetBuilderOptions {
cwd: string
Expand Down
12 changes: 5 additions & 7 deletions src/importer.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
/*
Provides the async `import()` function to source code that needs it,
without having it transpiled down to commonjs `require()` by TypeScript.
See https://github.com/microsoft/TypeScript/issues/43329.
*/

/**
* Provides the async `import()` function to source code that needs it,
* without having it transpiled down to commonjs `require()` by TypeScript.
* See https://github.com/microsoft/TypeScript/issues/43329.
*
* @param {any} descriptor - A URL or path for the module to load
* @return {Promise<any>} Promise that resolves to the loaded module
*/
async function importer(descriptor) {
return await import(descriptor)
}

module.exports = importer
module.exports = { importer }
3 changes: 2 additions & 1 deletion src/runtime/parallel/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import { IRuntimeOptions } from '../index'
import { PredictableTestRunStopwatch, RealTestRunStopwatch } from '../stopwatch'
import { duration } from 'durations'
import { pathToFileURL } from 'url'
import importer from '../../importer'

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { importer } = require('../../importer')
const { uuid } = IdGenerator

type IExitFunction = (exitCode: number, error?: Error, message?: string) => void
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"allowJs": true,
"esModuleInterop": true,
"lib": ["es2019"],
"module": "commonjs",
Expand Down

0 comments on commit 83e513b

Please sign in to comment.