Skip to content

Commit

Permalink
PR review comments, revert changes for UNIFY-1705
Browse files Browse the repository at this point in the history
  • Loading branch information
tgriesser committed May 26, 2022
1 parent d404b47 commit b70f346
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/config/src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const validationRules = createIndex(options, 'name', 'validation')
const testConfigOverrideOptions = createIndex(options, 'name', 'canUpdateDuringTestTime')
const restartOnChangeOptionsKeys = _.filter(options, 'requireRestartOnChange')

let issuedWarnings = new Set()
const issuedWarnings = new Set()

export type BreakingErrResult = {
name: string
Expand All @@ -54,7 +54,7 @@ type ErrorHandler = (
) => void

export function resetIssuedWarnings () {
issuedWarnings = new Set()
issuedWarnings.clear()
}

const validateNoBreakingOptions = (breakingCfgOptions: BreakingOption[], cfg: any, onWarning: ErrorHandler, onErr: ErrorHandler, testingType?: TestingType) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/data-context/src/actions/ProjectActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface ProjectApiShape {
insertProjectToCache(projectRoot: string): Promise<void>
removeProjectFromCache(projectRoot: string): Promise<void>
getProjectRootsFromCache(): Promise<string[]>
insertProjectPreferencesToCache(projectTitle: string, preferences: Preferences): Promise<unknown>
insertProjectPreferencesToCache(projectTitle: string, preferences: Preferences): void
getProjectPreferencesFromCache(): Promise<Record<string, Preferences>>
clearLatestProjectsCache(): Promise<unknown>
clearProjectPreferences(projectTitle: string): Promise<unknown>
Expand Down Expand Up @@ -318,12 +318,12 @@ export class ProjectActions {
this.ctx.lifecycleManager.git?.setSpecs(specs.map((s) => s.absolute))
}

async setProjectPreferences (args: MutationSetProjectPreferencesArgs) {
setProjectPreferences (args: MutationSetProjectPreferencesArgs) {
if (!this.ctx.currentProject) {
throw Error(`Cannot save preferences without currentProject.`)
}

await this.api.insertProjectPreferencesToCache(this.ctx.lifecycleManager.projectTitle, args)
this.api.insertProjectPreferencesToCache(this.ctx.lifecycleManager.projectTitle, args)
}

async codeGenSpec (codeGenCandidate: string, codeGenType: CodeGenType, erroredCodegenCandidate?: string | null): Promise<NexusGenUnions['GeneratedSpecResult']> {
Expand Down
4 changes: 2 additions & 2 deletions packages/data-context/src/data/ProjectLifecycleManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export class ProjectLifecycleManager {
return b.name === prefs.lastBrowser!.name && b.channel === prefs.lastBrowser!.channel
})) || browsers[0]

await this.ctx.actions.browser.setActiveBrowser(browser)
this.ctx.actions.browser.setActiveBrowser(browser)
}

private async setActiveBrowserByNameOrPath (nameOrPath: string) {
Expand All @@ -324,7 +324,7 @@ export class ProjectLifecycleManager {

this.ctx.debug('browser found to set', browser.name)

await this.ctx.actions.browser.setActiveBrowser(browser)
this.ctx.actions.browser.setActiveBrowser(browser)
} catch (e) {
const error = e as CypressError

Expand Down
3 changes: 1 addition & 2 deletions packages/launchpad/cypress/e2e/global-mode.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,7 @@ describe('Launchpad: Global Mode', () => {
cy.addProject('todos')
cy.visitLaunchpad()
cy.contains('[data-cy="project-card"]', 'todos').should('be.visible')
cy.contains('[data-cy="project-card"]', 'config-with-import-error').should('be.visible')
cy.contains('[data-cy="project-card"]', 'config-with-import-error').click()
cy.contains('[data-cy="project-card"]', 'config-with-import-error').should('be.visible').click()
cy.get('h1').contains('Cypress configuration error')
cy.get('a').contains('Projects').click()
cy.get('body').should('not.contain', 'Cypress configuration error')
Expand Down
6 changes: 4 additions & 2 deletions packages/server/lib/makeDataContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ export function makeDataContext (options: MakeDataContextOptions): DataContext {
clearAllProjectPreferences () {
return cache.removeAllProjectPreferences()
},
async insertProjectPreferencesToCache (projectTitle: string, preferences: Preferences) {
await cache.insertProjectPreferences(projectTitle, preferences)
insertProjectPreferencesToCache (projectTitle: string, preferences: Preferences) {
// FIXME: this should be awaited (since it writes to disk asynchronously) but is not
// https://cypress-io.atlassian.net/browse/UNIFY-1705
cache.insertProjectPreferences(projectTitle, preferences)
},
removeProjectFromCache (path: string) {
return cache.removeProject(path)
Expand Down

0 comments on commit b70f346

Please sign in to comment.