-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow passing down "null" to disable server watcher (#14208)
Co-authored-by: Bjorn Lu <[email protected]>
- Loading branch information
1 parent
68638f7
commit af5a95e
Showing
5 changed files
with
69 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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 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 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,24 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import { createServer } from '../index' | ||
|
||
const stubGetWatchedCode = /getWatched\(\) \{.+?return \{\};.+?\}/s | ||
|
||
describe('watcher configuration', () => { | ||
it('when watcher is disabled, return noop watcher', async () => { | ||
const server = await createServer({ | ||
server: { | ||
watch: null, | ||
}, | ||
}) | ||
expect(server.watcher.getWatched.toString()).toMatch(stubGetWatchedCode) | ||
}) | ||
|
||
it('when watcher is not disabled, return chokidar watcher', async () => { | ||
const server = await createServer({ | ||
server: { | ||
watch: {}, | ||
}, | ||
}) | ||
expect(server.watcher.getWatched.toString()).not.toMatch(stubGetWatchedCode) | ||
}) | ||
}) |
This file contains 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 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