Skip to content

Commit

Permalink
try using require
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiller1990 committed Feb 13, 2023
1 parent 86f4c02 commit b2f6343
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/scaffold-config/src/ct-detect-third-party.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from 'path'
import { pathToFileURL } from 'url'
import globby from 'globby'
import { z } from 'zod'
import Debug from 'debug'
Expand Down Expand Up @@ -34,15 +33,16 @@ const CT_FRAMEWORK_GLOB = path.join('node_modules', 'cypress-ct-*', 'package.jso
// is used (e.g. module=node16). To change this, we would also have to change the ts-node behavior when requiring the
// Cypress config file. This hack for keeping dynamic imports from being converted works across all
// of our supported node versions
const _dynamicImport = new Function('specifier', 'return import(specifier)')

const dynamicImport = <T>(module: string) => {
return _dynamicImport(module) as Promise<T>
}
// const _dynamicImport = new Function('specifier', 'return import(specifier)')

const dynamicAbsoluteImport = (filePath: string) => {
return dynamicImport(pathToFileURL(filePath).href) as Promise<any>
}
// const dynamicImport = <T>(module: string) => {
// return _dynamicImport(module) as Promise<T>
// }

// const dynamicAbsoluteImport = (filePath: string) => {
// return dynamicImport(pathToFileURL(filePath).href) as Promise<any>
// }

/**
* When compiling CJS -> ESM, TS can produce:
Expand Down Expand Up @@ -94,7 +94,9 @@ export async function detectThirdPartyCTFrameworks (

debug('Resolve successful: %s', modulePath)

const m = await dynamicAbsoluteImport(modulePath)
debug('require(%s)', modulePath)

const m = require(modulePath)

debug('Imported %o', m)

Expand Down

4 comments on commit b2f6343

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on b2f6343 Feb 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.6.0/linux-arm64/feature/ct-public-api-b2f6343ab7ae088c3907f38acdc10a73aafc517b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on b2f6343 Feb 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.6.0/linux-x64/feature/ct-public-api-b2f6343ab7ae088c3907f38acdc10a73aafc517b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on b2f6343 Feb 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.6.0/darwin-x64/feature/ct-public-api-b2f6343ab7ae088c3907f38acdc10a73aafc517b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on b2f6343 Feb 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.6.0/darwin-arm64/feature/ct-public-api-b2f6343ab7ae088c3907f38acdc10a73aafc517b/cypress.tgz

Please sign in to comment.