-
Notifications
You must be signed in to change notification settings - Fork 3.3k
chore: convert server/lib/plugins files from JS to TS #32337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
305e55a
chore: convert server/lib/plugins files from JS to TS
jennifer-shehane b51f17a
consolidate error types
jennifer-shehane f45d895
update anys to unknowns where we don't know the args
jennifer-shehane 77f36e1
add module esports
jennifer-shehane 2ffd781
Merge branch 'develop' into server-plugins-to-ts
jennifer-shehane dc93331
forgot to push this I guess
jennifer-shehane b0c89da
Merge branch 'server-plugins-to-ts' of https://github.com/cypress-io/…
jennifer-shehane 086e3c8
Update so this isn't always true
jennifer-shehane b89ab39
add some utils to a JS file
jennifer-shehane 32bf1a0
remove duplicate ts file
jennifer-shehane 4d81bea
remove dead code
jennifer-shehane c61416b
remove module.exports = API
jennifer-shehane aa49345
Merge branch 'develop' into server-plugins-to-ts
jennifer-shehane 09cb9b1
chore: fix exports of run events and adapt CJS tests importing TS mod…
AtofStryker a64c21d
fix another preprocessor default call
jennifer-shehane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import '../cwd' | ||
|
||
import { EventEmitter } from 'events' | ||
import debug from 'debug' | ||
import * as plugins from '../plugins' | ||
import type { FullConfig, SpecWithRelativeRoot, PluginIpcHandler } from '@packages/types' | ||
|
||
const debugFn = debug('cypress:ct:dev-server') | ||
|
||
const baseEmitter = new EventEmitter() | ||
|
||
interface SpecsChangedOptions { | ||
neededForJustInTimeCompile?: boolean | ||
} | ||
|
||
interface SpecsChangedData { | ||
specs: SpecWithRelativeRoot[] | ||
options?: SpecsChangedOptions | ||
} | ||
|
||
interface CompileSuccessData { | ||
specFile?: string | ||
} | ||
|
||
plugins.registerHandler((ipc: PluginIpcHandler) => { | ||
baseEmitter.on('dev-server:specs:changed', (specsAndOptions: SpecsChangedData) => { | ||
ipc.send('dev-server:specs:changed', specsAndOptions) | ||
}) | ||
|
||
ipc.on('dev-server:compile:success', ({ specFile }: CompileSuccessData = {}) => { | ||
baseEmitter.emit('dev-server:compile:success', { specFile }) | ||
}) | ||
}) | ||
|
||
// for simpler stubbing from unit tests | ||
interface DevServerAPI { | ||
emitter: EventEmitter | ||
start: (options: { specs: Cypress.Spec[], config: FullConfig }) => Promise<Cypress.ResolvedDevServerConfig> | ||
updateSpecs: (specs: SpecWithRelativeRoot[], options?: SpecsChangedOptions) => void | ||
close: () => void | ||
} | ||
|
||
const API: DevServerAPI = { | ||
emitter: baseEmitter, | ||
|
||
start ({ specs, config }: { specs: Cypress.Spec[], config: FullConfig }) { | ||
return plugins.execute('dev-server:start', { specs, config }) | ||
}, | ||
|
||
updateSpecs (specs: SpecWithRelativeRoot[], options?: SpecsChangedOptions) { | ||
baseEmitter.emit('dev-server:specs:changed', { specs, options }) | ||
}, | ||
|
||
close () { | ||
debugFn('close dev-server') | ||
baseEmitter.removeAllListeners() | ||
}, | ||
} | ||
|
||
export default API | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason we have both
module.exports
andexport default
here @jennifer-shehane ? Since the code is internal we should just needexport default API
and any play this is required we just change therequire('dev-server')
torequire('dev-server').default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yah I think they were being used in tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be some leftover code from me trying to get the utils to work, I’ll revisit next week
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests fail with this change: https://app.circleci.com/pipelines/github/cypress-io/cypress/74232/workflows/357d572b-99d6-4b0a-944d-11a1e5e823e7/jobs/3106827/tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jennifer-shehane it's likely stubbing something that is now exported on the
default
. i'll pull the branch down and check