Skip to content
Draft
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
7 changes: 3 additions & 4 deletions packages/config/src/env/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import { removeFalsy } from '../utils/remove_falsy.js'
// git is optional and there might be not git repository.
// We purposely keep this decoupled from the git utility.
export const getGitEnv = async function (buildDir, branch) {
const [COMMIT_REF, CACHED_COMMIT_REF] = await Promise.all([
git(['rev-parse', 'HEAD'], buildDir),
git(['rev-parse', 'HEAD^'], buildDir),
])
const COMMIT_REF = await git(['rev-parse', 'HEAD'], buildDir)
// `HEAD^` is not available on the first commit, so we fallback to `HEAD`.
const CACHED_COMMIT_REF = (await git(['rev-parse', 'HEAD^'], buildDir)) || COMMIT_REF
const gitEnv = { BRANCH: branch, HEAD: branch, COMMIT_REF, CACHED_COMMIT_REF, PULL_REQUEST: 'false' }
const gitEnvA = removeFalsy(gitEnv)
return gitEnvA
Expand Down
3 changes: 3 additions & 0 deletions packages/config/src/types/error_monitor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type ErrorMonitor = {
notify: (error: Error, callback?: (event: any) => void) => void
}
13 changes: 13 additions & 0 deletions packages/config/src/types/test_options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { ErrorMonitor } from './error_monitor.js'

export type TestOptions = {
errorMonitor?: ErrorMonitor
host?: string
env?: boolean
pluginsListUrl?: string
skipPluginList?: boolean
telemetryOrigin?: string
telemetryTimeout?: number
silentLingeringProcesses?: boolean
scheme?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { join } from 'path'

import { type Extension, getExtensions } from '../../api/site_info.js'
import { type ModeOption } from '../../types/options.js'
import { type TestOptions } from '../../types/test_options.js'

import { fetchAutoInstallableExtensionsMeta, installExtension } from './utils.js'

Expand All @@ -17,14 +18,14 @@ function getPackageJSON(directory: string) {
}

interface AutoInstallOptions {
featureFlags: any
featureFlags: Record<string, boolean>
siteId: string
accountId: string
token: string
buildDir: string
extensions: Extension[]
offline: boolean
testOpts: any
testOpts: TestOptions
mode: ModeOption
extensionApiBaseUrl: string
debug?: boolean
Expand Down
Binary file modified packages/config/tests/api/snapshots/tests.js.snap
Binary file not shown.
14 changes: 10 additions & 4 deletions packages/config/tests/context/snapshots/tests.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,12 @@ Generated by [AVA](https://avajs.dev).
],␊
"value": "0"␊
},␊
"CACHED_COMMIT_REF": {␊
"sources": [␊
"general"␊
],␊
"value": "HEXADECIMAL_ID"␊
},␊
"COMMIT_REF": {␊
"sources": [␊
"general"␊
Expand Down Expand Up @@ -1814,7 +1820,7 @@ Generated by [AVA](https://avajs.dev).
"siteInfo": {}␊
}`

## Context with branch wildcard pattern feat/\*
## Context with branch wildcard pattern feat/*

> Snapshot 1

Expand Down Expand Up @@ -2225,7 +2231,7 @@ Generated by [AVA](https://avajs.dev).
"siteInfo": {}␊
}`

## Context with nested branch wildcard pattern feat/nested/\*
## Context with nested branch wildcard pattern feat/nested/*

> Snapshot 1

Expand Down Expand Up @@ -2362,7 +2368,7 @@ Generated by [AVA](https://avajs.dev).
"siteInfo": {}␊
}`

## Context with branch wildcard pattern feature/\*
## Context with branch wildcard pattern feature/*

> Snapshot 1

Expand Down Expand Up @@ -2499,7 +2505,7 @@ Generated by [AVA](https://avajs.dev).
"siteInfo": {}␊
}`

## Context with branch wildcard pattern feat\* without slash
## Context with branch wildcard pattern feat* without slash

> Snapshot 1

Expand Down
Binary file modified packages/config/tests/context/snapshots/tests.js.snap
Binary file not shown.
6 changes: 6 additions & 0 deletions packages/config/tests/load/snapshots/tests.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ Generated by [AVA](https://avajs.dev).
],␊
"value": "0"␊
},␊
"CACHED_COMMIT_REF": {␊
"sources": [␊
"general"␊
],␊
"value": "HEXADECIMAL_ID"␊
},␊
"COMMIT_REF": {␊
"sources": [␊
"general"␊
Expand Down
Binary file modified packages/config/tests/load/snapshots/tests.js.snap
Binary file not shown.
Loading