-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: consider file URLs in WebSocket URL creation #2890
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2890 +/- ##
==========================================
- Coverage 92.61% 90.77% -1.85%
==========================================
Files 38 38
Lines 1246 1246
Branches 324 324
==========================================
- Hits 1154 1131 -23
- Misses 87 107 +20
- Partials 5 8 +3
Continue to review full report at Codecov.
|
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.
Good fix, but we really need test for this
Thanks. I tried to check tests (as codecov is failing for this PR), but at the glance did not find what and where, so kind of skipped. 😕
Please advise. |
@ylemkimon maybe you can help with tests? I think we need one good e2e tests to we can improve more them in future |
Co-authored-by: ylemkimon <[email protected]>
Unit tests are currently done in:
I think file URL conversion can be tested with: - describe('client', () => {
+ describe.each([['http'], ['file']])('client (%s)', (protocol) => {
it('should open, receive message, and close', (done) => {
socketServer.on('connection', (connection) => {
connection.send('hello world');
setTimeout(() => {
connection.close();
}, 1000);
});
- const client = new WebsocketClient(`http://localhost:${port}/ws-server`);
+ const client = new WebsocketClient(`${protocol}://localhost:${port}/ws-server`); Note you can run tests and update snapshots via E2E tests are in
-function runBrowser(config) {
+function runBrowser(config, args) {
const options = {
viewport: {
width: 500,
height: 500,
},
userAgent: '',
...config,
};
return new Promise((resolve, reject) => {
let page;
let browser;
puppeteer
.launch({
headless: true,
// args come from: https://github.com/alixaxel/chrome-aws-lambda/blob/master/source/index.js
- args: puppeteerArgs,
+ args: args ? puppeteerArgs.concat(args) : puppeteerArgs, and then you can run puppeteer with custom arguments, e.g., |
@ylemkimon thanks for the direction. I tried wrapping my head around your infrastructure. Failed to achieve passing tests. Also, for the test to check all cases it should include 3 protocols, HTTP, HTTPS, FILE describe.each([['http'], ['https'], ['file']])('client (%s)', (protocol) => { /* ... */}); I'm at a point, where I have the feeling (as I cannot pinpoint at all lines in the code I scrolled over 😄 ) that to achieve more than HTTP test would require quite a lot of work. However, as in some of the aspects I have limited experience I could be wrong. Currently as you know it only checks HTTP. I'm still stuck at
and tracing back through |
Sorry for delay, can we continue? |
Changes are implemented in #2954. E2E test needs to be added, though. |
Fixed |
For Bugs and Features; did you add new tests?
No.
However here's a test repo https://github.com/kroko/webpacktest-devserver-v4-case03 which shows
Motivation / Use-Case
The use case is not easy to explain in short, but
--allow-file-access-from-files
,--disable-web-security
,--autoplay-policy=no-user-gesture-required
, etc.file://
protocol, that is browser opens i.e.file:///some/path/to/public/index.html
)file://
protocol 😄Breaking Changes
None
Additional Info