Options
All
  • Public
  • Public/Protected
  • All
Menu

Package acceptance-tests

Type aliases

ExecResult

ExecResult: object | Error & object

PackageEntry

PackageEntry: Map<string, object>

PackageRegistry

PackageRegistry: Map<string, PackageEntry>

PackageRunDriver

PackageRunDriver: function

Type declaration

RunFunction

RunFunction: function

Type declaration

    • (__namedParameters: object): void
    • Parameters

      • __namedParameters: object
        • path: string
        • run: function
        • source: function
            • (script: string, callDefinition?: Record<string, any>): Promise<Record<string, any>>
            • Parameters

              • script: string
              • Optional callDefinition: Record<string, any>

              Returns Promise<Record<string, any>>

      Returns void

Variables

Const IS_WIN32

IS_WIN32: boolean = process.platform === `win32`

createTemporaryFolder

createTemporaryFolder: createTemporaryFolder

Const deepResolve

deepResolve: any = require('super-resolve')

execFile

execFile: execFile

generatePkgDriver

generatePkgDriver: generatePkgDriver

getPackageRegistry

getPackageRegistry: getPackageRegistry

Const mte

mte: PackageDriver = generatePkgDriver({getName() {return `yarn`;},async runDriver(path,[command, ...args],{cwd, projectFolder, registryUrl, env, ...config},) {const rcEnv: Record<string, any> = {};for (const [key, value] of Object.entries(config))rcEnv[`YARN_${key.replace(/([A-Z])/g, `_$1`).toUpperCase()}`] = Array.isArray(value) ? value.join(`;`) : value;const nativePath = npath.fromPortablePath(path);const tempHomeFolder = npath.fromPortablePath(await createTemporaryFolder());const cwdArgs = typeof projectFolder !== `undefined`? [projectFolder]: [];const yarnBinary = require.resolve(`${__dirname}/../../../../yarnpkg-cli/bundles/yarn.js`);const res = await execFile(process.execPath, [yarnBinary, ...cwdArgs, command, ...args], {cwd: cwd || path,env: {[`HOME`]: tempHomeFolder,[`USERPROFILE`]: tempHomeFolder,[`PATH`]: `${nativePath}/bin${delimiter}${process.env.PATH}`,[`TEST_ENV`]: `true`,[`YARN_GLOBAL_FOLDER`]: `${nativePath}/.yarn/global`,[`YARN_NPM_REGISTRY_SERVER`]: registryUrl,[`YARN_UNSAFE_HTTP_WHITELIST`]: new URL(registryUrl).hostname,// Otherwise the tests would break when C:\tmp is on a different drive than the repo[`YARN_ENABLE_ABSOLUTE_VIRTUALS`]: `true`,// Otherwise the output isn't stable between runs[`YARN_ENABLE_TIMERS`]: `false`,[`YARN_ENABLE_PROGRESS_BARS`]: `false`,// Otherwise the output wouldn't be the same on CI vs non-CI[`YARN_ENABLE_INLINE_BUILDS`]: `false`,// Otherwise we would more often test the fallback rather than the real logic[`YARN_PNP_FALLBACK_MODE`]: `none`,...rcEnv,...env,},});if (process.env.JEST_LOG_SPAWNS) {console.log(`===== stdout:`);console.log(res.stdout);console.log(`===== stderr:`);console.log(res.stderr);}return res;},})

Let packageRegistryPromise

packageRegistryPromise: Promise<PackageRegistry> | null = null

Let packageServerUrl

packageServerUrl: string | null = null

startPackageServer

startPackageServer: startPackageServer

Const staticServer

staticServer: Handler = serveStatic(npath.fromPortablePath(require(`pkg-tests-fixtures`)))

Let whitelist

whitelist: Map<any, any> = new Map()

writeFile

writeFile: writeFile

writeJson

writeJson: writeJson

Functions

Const chmod

Const createTemporaryFile

Const createTemporaryFolder

Const execFile

Const filePatternMatch

  • filePatternMatch(filePath: string, patterns: Array<string>, __namedParameters?: object): boolean

Const generatePkgDriver

Const getPackageArchiveHash

  • getPackageArchiveHash(name: string, version: string): Promise<string | Buffer>

Const getPackageArchivePath

  • getPackageArchivePath(name: string, version: string): Promise<string>

Const getPackageArchiveStream

  • getPackageArchiveStream(name: string, version: string): Promise<Gzip>

Const getPackageDirectoryPath

  • getPackageDirectoryPath(name: string, version: string): Promise<string>

Const getPackageEntry

  • getPackageEntry(name: string): Promise<PackageEntry | undefined>

Const getPackageHttpArchivePath

  • getPackageHttpArchivePath(name: string, version: string): Promise<string>

Const getPackageRegistry

Const makeFakeBinary

  • makeFakeBinary(target: PortablePath, __namedParameters?: object): Promise<void>

Const mkdirp

Const packToFile

Const packToStream

  • packToStream(source: PortablePath, __namedParameters?: object): Gzip

Const parseJsonStream

  • parseJsonStream(stream: string, key?: undefined | string): any

Const readFile

  • readFile(source: PortablePath, encoding?: undefined | string): Promise<any>

Const readJson

Const realpath

Const setPackageWhitelist

  • setPackageWhitelist(packages: Map<string, Set<string>>, fn: function): Promise<void>

Const startPackageServer

  • startPackageServer(): Promise<string>

Const stringPatternMatch

  • stringPatternMatch(string: string, patterns: Array<string>, __namedParameters?: object): boolean

Const testIf

  • testIf(condition: function, name: string, execute?: jest.ProvidesCallback | undefined, timeout?: number | undefined): void

Const unpackToDirectory

Const walk

Const writeFile

  • writeFile(target: PortablePath, body: string | Buffer): Promise<void>

Const writeJson

  • writeJson(target: PortablePath, object: any): Promise<void>

Generated using TypeDoc