Skip to content

Commit

Permalink
fix: fix dynamic import on windows (#41)
Browse files Browse the repository at this point in the history
Fixes #40
  • Loading branch information
nolanlawson authored Jan 13, 2022
1 parent 7ec7aab commit a63d5f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import path from 'path'
import { formatResult } from './format.js'
import chalk from 'chalk'
import { createWriteStream } from 'fs'
import { pathToFileURL } from 'url'
import { AbortController as AbortControllerPolyfill } from 'node-abort-controller'

if (typeof AbortController !== 'function') {
Expand Down Expand Up @@ -38,13 +39,13 @@ async function main () {
const { signal } = controller
let scenario
if (options.scenario) {
scenario = await import(path.resolve(process.cwd(), options.scenario))
scenario = await import(pathToFileURL(path.resolve(process.cwd(), options.scenario)))
} else {
scenario = defaultScenario
}
if (options.setup) {
// override whatever setup function is defined on the scenario
const { setup } = await import(path.resolve(process.cwd(), options.setup))
const { setup } = await import(pathToFileURL(path.resolve(process.cwd(), options.setup)))
scenario = {
...scenario,
setup
Expand Down

0 comments on commit a63d5f6

Please sign in to comment.