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
wct-mocha browser code (PR for review only) #718
Conversation
…hub UI that represents the wct-mocha code as moved files from wct.)
@@ -17,7 +17,7 @@ | |||
"test:all:parallel": "npm run test:unit && npm run test:integration:parallel", | |||
"test:integration": "lerna run test:integration --stream --concurrency 1", | |||
"test:integration:parallel": "lerna run test:integration --stream --parallel", | |||
"test:integration:windows": "lerna run test:integration --stream --ignore web-component-tester --ignore @polymer/esm-amd-loader --parallel", | |||
"test:integration:windows": "lerna run test:integration --stream --ignore web-component-tester --ignore @polymer/esm-amd-loader --concurrency 1", |
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.
is the concurrency 1 change intentional?
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.
I noticed some timeouts on appveyor when wct-mocha integration tests competed with wct integration tests on windows. By eliminating parallelism on multiple selenium processes, this eliminated the randomness of the contention. WCT's integration tests are flaky enough as it is, so this was intentional in the sense I was hoping to reduce the number of flaky runs on Windows which are made worse by introducing yet-another-selenium-integration-suite to the collection.
@@ -42,6 +42,9 @@ | |||
"chai": "^4.1.2", | |||
"clang-format": "^1.2.4", | |||
"mocha": "^5.2.0", | |||
"rollup": "^0.64.1", |
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.
Why is this at the top-level? I see the comment in #702, but not sure I understand. How is generating browser.js going to work? Why does it need rollup? Why couldn't be directly emitted by tsc?
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.
Rollup is used to produce a single .js asset from multiple .js assets. tsc only produces a single .js file for each .ts file. I put rollup at the top level because the same process is going to be used for wct-browser-legacy and wct-sinon and web-component-tester
packages/wct-mocha/README.md
Outdated
$ npm install --global web-component-tester | ||
``` | ||
|
||
## Run `wct` |
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.
add: or polymer test
?
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.
Added.
packages/wct-mocha/README.md
Outdated
## Run `wct` | ||
|
||
```bash | ||
$ wct --wct-package-name wct-mocha |
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.
What does --wct-package-name
do?
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 is out-dated. I updated in the main branch but forgot to copy changes into this review branch. Will update. --wct-package-name
is actually no longer needed. The line should read only wct --npm
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.
Updated README
packages/wct-mocha/README.md
Outdated
<meta charset="utf-8"> | ||
<script src="../node_modules/mocha/mocha.js"></script> | ||
<script src="../node_modules/chai/chai.js"></script> | ||
<script src="../node_modules/wct-mocha/browser.js"></script> |
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.
is it possible to pick a different name for browser.js now, or would that cause too much churn? maybe wct-mocha.js?
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.
It might not be too hard, I'll look into the effect of this...
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.
+1 on this idea.
Also, even if mocha and chai can't be modules, this should be, no?
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.
Done: #738
@@ -0,0 +1,157 @@ | |||
/** | |||
* @license | |||
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
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.
2018, or is this not new code?
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.
Actually, this stacktrace directory is all literally imported from https://github.com/googlearchive/stacky... There was no way to demonstrate that in the diff that I guess.
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.
Well. Except I added typings to everything.
@@ -0,0 +1,63 @@ | |||
/** | |||
* @license | |||
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
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.
2018 or not new?
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.
All updated to 2018
@@ -0,0 +1,100 @@ | |||
/** | |||
* @license | |||
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
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.
2018 or not new?
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.
.
@@ -0,0 +1,22 @@ | |||
{ | |||
"name": "wct-mocha-test", |
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.
add private: true so we can't accidentally publish
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.
Oh cool never thought of that. Added.
packages/wct-mocha/tsconfig.json
Outdated
@@ -11,20 +11,21 @@ | |||
"strictNullChecks": false, | |||
"removeComments": false, | |||
"preserveConstEnums": true, | |||
"skipDefaultLibCheck": true, | |||
"skipLibCheck": true, |
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 has a lot of unstrict things, can they be removed?
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.
Okay I was able to remove these after adjusting declarations file a little. Couldn't get rid of all the unstrict stuff tho
- "strictNullChecks": false,
- "skipDefaultLibCheck": true,
- "skipLibCheck": true,
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.
I think these are legitimate issues, though. If you enable all of the strict options, most of the errors seem to be null checks. For example, in util.ts
, you call done()
even though it is an optional parameter so could be undefined in reality.
It would probably be worth turning them on and seeing if there's any easy fixes you can do to keep at least things like noUnusedLocals
and what not on.
Here's what I tried it with:
"alwaysStrict": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
packages/wct-mocha/README.md
Outdated
<meta charset="utf-8"> | ||
<script src="../node_modules/mocha/mocha.js"></script> | ||
<script src="../node_modules/chai/chai.js"></script> | ||
<script src="../node_modules/wct-mocha/browser.js"></script> |
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.
+1 on this idea.
Also, even if mocha and chai can't be modules, this should be, no?
packages/wct-mocha/README.md
Outdated
<awesome-element id="fixture"></awesome-element> | ||
<script type="module"> | ||
import {AwesomeElement} from '../src/awesome-element.js'; | ||
suite('<awesome-element>', function() { |
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.
nit: function() {
=> () => {
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.
Adjusted
packages/wct-mocha/README.md
Outdated
|
||
### Web Server | ||
|
||
If you prefer not to use WCT's command line tool, you can also run WCT 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.
I think this section needs more information. Why would you do this? If you're already loading mocha and chai, what does including even wct-mocha do for you?
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.
I moved this to the bottom of the readme which allows it to make a case for why you'd want wct-mocha in the first place, since it will have described all of the features by that point.
packages/wct-mocha/README.md
Outdated
|
||
## Polymer | ||
|
||
By default, WCT will defer tests until `WebComponentsReady` has fired. This |
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.
Change to "until the WebComponentsReady
event has fired"
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.
Rewrote to:
By default, WCT will defer tests until the WebComponentsReady
event has been
emitted by @webcomponents/webcomponents-loader.js
or one of its polyfill
bundles. This saves you from having to wait for elements to upgrade and all
that yourself.
If you need to test something that occurs before that event, the
testImmediate
helper
can be used.
Alternately, if you are not using the @webcomponents/webcomponentjs
polyfills
or loader or otherwise simply want tests to run as soon as possible, you can
disable this delay by setting WCT.waitForFrameworks = false
(though, they are
still async due to Mocha).
|
||
WCT supports Mocha's [TDD][mocha-tdd] (`suite`/`test`/etc) and [BDD][mocha-bdd] | ||
(`describe`/`it`/etc) interfaces, and will call `mocha.setup`/`mocha.run` for | ||
you. Just write your tests, and you're set. |
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.
Where did we land on not calling mocha.setup
/mocha.run
automatically? Can that just be a part of wct-browser-legacy?
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.
IMO wct-mocha should continue to behave as existing WCT client so we can keep confusion, complication, risk and maintenance cost down dealing with multiple behaviors in WCT client code. Plus it allows wct-mocha to be a drop-in-replacement.
packages/wct-mocha/src/index.ts
Outdated
// We need the reporter so that we can report errors during load. | ||
suites.loadJsSuites(reporter, (error) => { | ||
// Let our parent know that we're about to start the tests. | ||
if (current) |
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.
add curly braces. Was this file not picked up in format?
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.
clang-format doesn't lint for us though. I am adding tslint script to wct-mocha. Using the top-level tslint.json I get a lot of errors to fix:
ERROR: /packages/wct-mocha/src/childrunner.ts[35, 35]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/childrunner.ts[123, 22]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/childrunner.ts[165, 18]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/childrunner.ts[191, 17]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/childrunner.ts[225, 29]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/clisocket.ts[87, 35]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/clisocket.ts[101, 30]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/clisocket.ts[111, 47]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/environment/errors.ts[15, 26]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/environment/helpers.ts[28, 45]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/environment/helpers.ts[55, 12]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/environment/helpers.ts[74, 12]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/environment/helpers.ts[86, 20]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/index.ts[63, 29]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/mocha/extend.ts[25, 18]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/mocha/extend.ts[41, 57]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/mocha/extend.ts[48, 46]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/mocha/extend.ts[48, 74]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/reporters.ts[61, 34]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/reporters.ts[61, 50]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/reporters/console.ts[101, 59]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/reporters/html.ts[22, 38]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/reporters/multi.ts[51, 8]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/reporters/multi.ts[64, 32]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/reporters/multi.ts[138, 30]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/reporters/multi.ts[193, 59]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/reporters/multi.ts[235, 61]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/stacktrace/formatting.ts[90, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/formatting.ts[90, 7]: Identifier 'result' is never reassigned; use 'const' instead of 'var'.
ERROR: /packages/wct-mocha/src/stacktrace/formatting.ts[91, 8]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/formatting.ts[110, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/formatting.ts[110, 7]: Identifier 'result' is never reassigned; use 'const' instead of 'var'.
ERROR: /packages/wct-mocha/src/stacktrace/formatting.ts[112, 5]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/formatting.ts[122, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/formatting.ts[123, 8]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/formatting.ts[131, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/formatting.ts[132, 8]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/formatting.ts[140, 10]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/formatting.ts[150, 10]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/normalization.ts[47, 10]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/normalization.ts[52, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/normalization.ts[57, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/normalization.ts[57, 7]: Identifier 'cleanErr' is never reassigned; use 'const' instead of 'var'.
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[22, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[22, 7]: Identifier 'rawLines' is never reassigned; use 'const' instead of 'var'.
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[24, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[24, 7]: Identifier 'stackyLines' is never reassigned; use 'const' instead of 'var'.
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[28, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[28, 7]: Identifier 'v8Lines' is never reassigned; use 'const' instead of 'var'.
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[32, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[32, 7]: Identifier 'geckoLines' is never reassigned; use 'const' instead of 'var'.
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[43, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[43, 7]: Identifier 'match' is never reassigned; use 'const' instead of 'var'.
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[60, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[60, 7]: Identifier 'outer' is never reassigned; use 'const' instead of 'var'.
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[64, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[64, 7]: Identifier 'inner' is never reassigned; use 'const' instead of 'var'.
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[68, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[83, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[83, 7]: Identifier 'match' is never reassigned; use 'const' instead of 'var'.
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[97, 3]: Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /packages/wct-mocha/src/stacktrace/parsing.ts[97, 7]: Identifier 'result' is never reassigned; use 'const' instead of 'var'.
ERROR: /packages/wct-mocha/src/suites.ts[77, 20]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/suites.ts[129, 67]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/util.ts[53, 57]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/util.ts[82, 36]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/util.ts[236, 60]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/util.ts[238, 54]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/util.ts[241, 34]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/util.ts[242, 21]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
ERROR: /packages/wct-mocha/src/util.ts[259, 30]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
Fixing now...
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.
However none of those errors are about curly braces... reviewing our top-level tslint.json we don't actually have that rule.
Adding that rule. curly: true
packages/wct-mocha/src/index.ts
Outdated
throw error; | ||
|
||
// Emit any errors we've encountered up til now | ||
errors.globalErrors.forEach(function onError(error) { |
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.
arrow function
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.
Arrow'd!
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.
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.
Please see #733
} | ||
|
||
interface HTMLElement { | ||
isConnected: boolean; |
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.
maybe this belongs on Element
?
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.
Unfortunately it doesn't inherit properly and tsc wont build if I move it to Element:
> tsc
src/declarations.ts:66:5 - error TS2687: All declarations of 'isConnected' must have identical modifiers.
66 isConnected?: boolean;
~~~~~~~~~~~
src/more-declarations.ts:50:3 - error TS2687: All declarations of 'isConnected' must have identical modifiers.
50 isConnected: boolean;
~~~~~~~~~~~
src/reporters/html.ts:20:29 - error TS2345: Argument of type 'HTMLDivElement' is not assignable to parameter of type 'Node'.
Property 'isConnected' is optional in type 'HTMLDivElement' but required in type 'Node'.
20 document.body.appendChild(output);
~~~~~~
src/reporters/html.ts:70:27 - error TS2345: Argument of type 'HTMLStyleElement' is not assignable to parameter of type 'Node'.
Property 'isConnected' is optional in type 'HTMLStyleElement' but required in type 'Node'.
70 document.head.appendChild(style);
~~~~~
src/reporters/title.ts:74:31 - error TS2345: Argument of type 'HTMLLinkElement' is not assignable to parameter of type 'Node'.
74 document.head.appendChild(link);
~~~~
src/util.ts:60:29 - error TS2345: Argument of type 'HTMLScriptElement' is not assignable to parameter of type 'Node'.
Property 'isConnected' is optional in type 'HTMLScriptElement' but required in type 'Node'.
60 document.head.appendChild(script);
~~~~~~
src/util.ts:75:29 - error TS2345: Argument of type 'HTMLLinkElement' is not assignable to parameter of type 'Node'.
Property 'isConnected' is optional in type 'HTMLLinkElement' but required in type 'Node'.
75 document.head.appendChild(link);
~~~~
src/util.ts:296:18 - error TS2344: Type 'HTMLScriptElement' does not satisfy the constraint 'Node'.
296 NodeListOf<HTMLScriptElement>;
~~~~~~~~~~~~~~~~~
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.
Turns out we declared the Element interface in two places and that was the reason I couldn't just override it in the one. Have removed the redundancy and now its fine. So yeah, we only have to update Element. Fixed.
@@ -140,7 +140,7 @@ export function getParams(query?: string): Params { | |||
return {}; | |||
|
|||
const result: {[param: string]: string[]} = {}; | |||
query.split('&').forEach(function(part) { | |||
query.split('&').forEach((part) => { |
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.
er, isn't there a browser API for this?
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.
Yes, supported in everything but IE. (Can it just die already?)
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.
#Wontfix IE
"build:compile": "tsc", | ||
"format": "find src -name \"*.ts\" | xargs clang-format --style=file -i", | ||
"test": "npm run test:integration", | ||
"test:integration": "cd test && npm run test:wct" |
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.
does there need to be an npm i
to install the test dependencies?
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.
That happens through lerna bootstrapping because packages/wct-mocha/test is actually a lerna-managed package called wct-mocha-test
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack | ||
const GECKO_LINE = /^(?:([^@]*)@)?(.*?):(\d+)(?::(\d+))?$/; | ||
|
||
export function parseGeckoLine(line: string): ParsedLine { |
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.
these returns probably want to be ParsedLine|null
. i understand this is copied from an older repo, though, so fine if you wanna leave it be.
Merged #702 so closing this. |
To make it easier to see what is going on in #702 I created a simple PR here that squashes the wct-mocha addition and then a subsequent commit to remove all of wct's browser code so the things that I copied over to wct-mocha show as moved and the actual changes I made are clear in the diffs.
NOTE: Tests wont pass because WCT won't build without its browser code. This PR is just here for the diffs and review comments.