-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add test to check browser import doesn't use any node api's * Move protocol version comparison functions into './utils.ts' + update `ProtocolVersion` interface
- Loading branch information
Showing
5 changed files
with
96 additions
and
38 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
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,57 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
|
||
for (const nodeModule of [ | ||
"assert", | ||
"async_hooks", | ||
"buffer", | ||
"child_process", | ||
"cluster", | ||
"console", | ||
"constants", | ||
"crypto", | ||
"dgram", | ||
"dns", | ||
"domain", | ||
"events", | ||
"fs", | ||
"http", | ||
"http2", | ||
"https", | ||
"inspector", | ||
"module", | ||
"net", | ||
"os", | ||
"path", | ||
"perf_hooks", | ||
"process", | ||
"punycode", | ||
"querystring", | ||
"readline", | ||
"repl", | ||
"stream", | ||
"string_decoder", | ||
"timers", | ||
"tls", | ||
"trace_events", | ||
"tty", | ||
"url", | ||
"util", | ||
"v8", | ||
"vm", | ||
"worker_threads", | ||
"zlib", | ||
]) { | ||
jest.mock(nodeModule, () => { | ||
throw new Error(`Cannot use node module '${nodeModule}' in browser`); | ||
}); | ||
} | ||
|
||
import {_CodecsRegistry} from "../src/index.browser"; | ||
|
||
test("create codec registry", () => { | ||
const registry = new _CodecsRegistry(); | ||
|
||
expect(registry instanceof _CodecsRegistry).toBe(true); | ||
}); |