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
Enable real browser test #146
Conversation
1. Undo editor auto format to make test happy 2. temporary disable prefer-regex-literals
1. [test] Move `ava` to `mocha+chai` to test in real browser. (sindresorhus#105) (sindresorhus#140) (sindresorhus#142) 2. [test] seprate non special-protocol-schemes(sindresorhus#147) 3. [doc] Update readme
1.[tests] Allow less strict invalid URL check 2.[tests] Provide useful msg on left to get feedback from userland
Seperate slash test add after v4, to identify problems.
1. use reverse + js-RegExp-Lookahead + reverse as fallback to js-RegExp-lookbehind 2. 2 runtime logics times, two period of test, 4 situations are tested, fully backward compact
…hind)` prevent syntax error breaks user code. - [source] Use `reverse-lookahead-reverse` as fallback when not support `JsRegexpLookbehind`. - [source] Add URLSearchParameters.sort ponyfill as fallback. - [source] Add options `preferJsRegexpLookbehind` and `preferURLSearchParamsSort` to run fallback logic in modern runtime. - [types] Add above two options to `.d.ts`. - [source] Move `normalizeUrl(options)` options validation to most top. - [source] Treat custom protocol as .defaultProtocol, to prevent host as part of pathname. - [source] Change back custom protocol after `urlObject.toString`, to prevent pathname changed again. - [workflow] Add karma to enable automate headless browser tests. - [workflow] Add rollup to transform `regexp named-capturing-groups` and bundle tests for browser. - [tests] Change `ava` to `mocha+chai`, enable to test it in Node.js / Headless Chrome / Headless Firefox / Any real browsr. - [tests] Update prev `invalid urls` to match more than Node.js env. - [tests] Seperate some long tests in to small parts to easy identify problems.
Safari support was fixed in https://github.com/sindresorhus/normalize-url/releases/tag/v7.0.1. I'm not interested in browser tests, browser-specific options, or the |
Hi, @sindresorhus
But how can you guarantee this library works in browser, without testing it in browser? Eg: issue#147
I know that you may not like that option, so I did try to remove it.
I'm kind of non professional newbie. |
FYI, there are something I found so far.
Have a nice day @sindresorhus 😊 |
I never made it for the browser. But it doesn't use anything specific to Node.js, so if it works in Node.js, it should work in modern browsers too. |
|
Not sure what you mean? |
Old browser support is not a concern for this package. It's up to you to use Babel and polyfill if you need to use it in older browsers. I only merged the Safari fix as it applies to latest Safari. |
Not sure for that pull, but existing today- |
function normalizeUrl(urlString, options) {
// ...code
if (options.forceHttp && options.forceHttps) {
throw new Error('The `forceHttp` and `forceHttps` options cannot be used together');
}
// ...code
}
function normalizeUrl(urlString, options) {
if (options.forceHttp && options.forceHttps) {
throw new Error('The `forceHttp` and `forceHttps` options cannot be used together');
}
// ...code
// ...code
} |
But your "this child" seems to be also used in browser from recent issues? |
I'm not interested in browser testing. |
|
But I saw issues related to browser, may it give a try, decrease future potential issues? |
Users
There are two ways if you want to test version >= 7.0.0 in real browser,
Changes
/JsRegexpLookbehind/
tonew RegExp(JsRegexpLookbehind)
, prevent syntax error breaks user code.reverse-lookahead-reverse
as fallback when not supportJsRegexpLookbehind
.preferJsRegexpLookbehind
andpreferURLSearchParamsSort
to run fallback logic in modern runtime..d.ts
.normalizeUrl(options)
options validation to most top.urlObject.toString
, to prevent pathname changed again.regexp named-capturing-groups
and bundle tests for browser.ava
tomocha+chai
, enable to test it in Node.js / Headless Chrome / Headless Firefox / Any real browsr.invalid urls
to match more than Node.js env.Test Status
(32/32) Test passed with