Skip to content

Commit 5b93401

Browse files
authored
feat: display the resolved expose values in the resolved config ui (#33322)
* feat: display the resolved expose values in the resolved config ui * changelog
1 parent babb713 commit 5b93401

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

cli/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ _Released 01/27/2026 (PENDING)_
1212
- Introduced a new [`cy.env()`](https://docs.cypress.io/api/commands/env) command that can be used to asynchronously and securely access Cypress environment variables. Addressed in [#33181](https://github.com/cypress-io/cypress/pull/33181).
1313
- Added a [`allowCypressEnv`](https://docs.cypress.io/app/references/configuration#Global) configuration option that disallows use of the deprecated `Cypress.env()` API. Addressed in [#33181](https://github.com/cypress-io/cypress/pull/33181).
1414
- Introduced the new `Cypress.expose()` API, intended for use of public configuration of non-sensitive values. Addressed in [#33238](https://github.com/cypress-io/cypress/pull/33238).
15+
- Displays the resolved `expose` values in the App's resolved configuration user interface. Addressed in [#33322](https://github.com/cypress-io/cypress/pull/33322).
1516

1617
**Bugfixes:**
1718

packages/app/cypress/e2e/settings.cy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ describe('App: Settings', () => {
256256
cy.get('[data-cy-config="env"]').contains('INTERNAL_GRAPHQL_PORT')
257257
cy.get('[data-cy-config="cli"]').contains('fromCli')
258258
cy.get('[data-cy-config="cli"]').contains('4455')
259+
cy.get('[data-cy-config="expose"]').contains('INTERNAL_E2E_TESTING_SELF')
260+
cy.get('[data-cy-config="expose"]').contains('value').should('not.exist')
259261
})
260262
})
261263

packages/data-context/src/sources/ProjectDataSource.ts

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os from 'os'
22
import chokidar from 'chokidar'
3-
import type { ResolvedFromConfig, RESOLVED_FROM, TestingType, SpecWithRelativeRoot } from '@packages/types'
3+
import type { ResolvedFromConfig, TestingType, SpecWithRelativeRoot } from '@packages/types'
44
import minimatch from 'minimatch'
55
import _ from 'lodash'
66
import path from 'path'
@@ -558,26 +558,13 @@ export class ProjectDataSource {
558558
async getResolvedConfigFields (): Promise<ResolvedFromConfig[]> {
559559
const config = this.ctx.lifecycleManager.loadedFullConfig?.resolved ?? {}
560560

561-
interface ResolvedFromWithField extends ResolvedFromConfig {
562-
field: typeof RESOLVED_FROM[number]
563-
}
564-
565-
const mapEnvResolvedConfigToObj = (config: ResolvedFromConfig): ResolvedFromWithField => {
566-
return Object.entries(config).reduce<ResolvedFromWithField>((acc, [field, value]) => {
561+
return Object.entries(config ?? {}).map(([key, value]) => {
562+
if ((key === 'env' || key === 'expose') && value) {
567563
return {
568-
...acc,
569-
value: { ...acc.value, [field]: value.value },
564+
field: key,
565+
from: key,
566+
value: Object.fromEntries(Object.entries(value).map(([field, { value }]) => [field, value])),
570567
}
571-
}, {
572-
value: {},
573-
field: 'env',
574-
from: 'env',
575-
})
576-
}
577-
578-
return Object.entries(config ?? {}).map(([key, value]) => {
579-
if (key === 'env' && value) {
580-
return mapEnvResolvedConfigToObj(value)
581568
}
582569

583570
return { ...value, field: key }

0 commit comments

Comments
 (0)