-
Notifications
You must be signed in to change notification settings - Fork 605
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
2316 refactor mocha tests to qunit #2330
Conversation
{{content-for "test-body-footer"}} | ||
</body> | ||
</html> | ||
|
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.
are changes in this file necessary?
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 in this file fixed route /tests when you run it with "ember s", so I believe that the change in this file is valid.
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.
Now I see, qunit needs some element it can hook into, so we should probably just go back to the old index.html
file and add this below test-body block:
<div id="qunit"></div>
<div id="qunit-fixture">
<div id="ember-testing-container">
<div id="ember-testing"></div>
</div>
</div>
"@glimmer/component": "^1.0.0", | ||
"@glimmer/tracking": "^1.0.0", | ||
"babel-eslint": "^10.1.0", | ||
"broccoli-asset-rev": "^3.0.0", | ||
"chai": "^4.1.0", | ||
"chai": "^4.3.4", |
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.
chai is a part of mocha, so we want to remove it as well.
@@ -31,11 +31,13 @@ | |||
}, | |||
"devDependencies": { | |||
"@ember/optional-features": "^1.3.0", | |||
"@ember/test-helpers": "^2.4.2", | |||
"@embroider/test-setup": "^0.43.5", |
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.
Embroider test setup is not needed for the migration
"@glimmer/component": "^1.0.0", | ||
"@glimmer/tracking": "^1.0.0", | ||
"babel-eslint": "^10.1.0", | ||
"broccoli-asset-rev": "^3.0.0", | ||
"chai": "^4.1.0", | ||
"chai": "^4.3.4", | ||
"ember-cli": "~3.18.0", | ||
"ember-cli-blueprint-test-helpers": "^0.19.2", | ||
"ember-cli-chai": "^0.5.0", |
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.
chai ✂️
85aafb9
to
c595c8c
Compare
🎉 Yay! Could we implement the strategy for getting CI green that we discussed first though so we can merge this with a green CI? |
Hi,
I have two branches.
1. 2316-refactor-mocha-tests-to-qunit CI green from ember-3.0 to
ember-lts-3.24
2. ember-4 - CI green from ember-3.8 to ember-canary
I believe that I should only remove ember-beta and ember-canary from the
first branch and then everything will be green.
What do you think?
…On Wed, 20 Oct 2021 at 15:42, Marco Otte-Witte ***@***.***> wrote:
🎉 Yay!
Could we implement the strategy for getting CI green that we discussed
first though so we can merge this with a green CI?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2330 (comment)>,
or unsubscribe
<https:/notifications/unsubscribe-auth/AFT6GQB4XO24CL7KVON7A7DUH3BLVANCNFSM5FLSHR6Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
--
S pozdravom
Stanislav Dunajčan
e-mail: ***@***.***
|
@candunaj so in our call recently we talked about the strategy for making things work with the current Torii situation. Can we make a separate PR for implementing that first? We can't just not run tests for ember-beta to "fix" CI :) |
27c3c4f
to
8702ed2
Compare
8702ed2
to
3cd3507
Compare
3cd3507
to
142c23a
Compare
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.
Very nice work 🙌
I found some things that I think still should be addressed but I'm looking forward getting this merged!
One general thing I recognized is that this replaces the nested describe
blocks with a flat structure with just one module
and test
s nested directly into that (at least in some of the test files).Can we use nested module
s instead? I feel a flat list of tests is much harder to navigate (plus, in a nested structure it's much easier to build up preconditions for tests in nested blocks incrementally).
.github/workflows/ci.yml
Outdated
@@ -56,8 +56,6 @@ jobs: | |||
- classic-test-app | |||
- test-app | |||
test-suite: | |||
- test:one ember-3.0 | |||
- test:one ember-lts-3.4 |
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 does this change? Can we not support 3.0 and 3.4 when using QUnit?
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.
Sorry, I wanted to write ember-qunit 5. ember-qunit 5 supports ember 3.8+.
https:/emberjs/ember-qunit
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.
Can we use a version of ember-qunit that supports Ember 3.0 as well? I'd rather upgrade to ember-qunit 5 (and drop support for Ember < 3.8) in a separate PR then.
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, I can use ember-qunit 4 with some change in the source code. I will do it.
@@ -70,4 +68,4 @@ | |||
"cssstyle": "~1.2.2", | |||
"jsdom": "^11.10.0" | |||
} | |||
} | |||
} |
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.
this seems unrelated anyway
// test files | ||
files: ['tests/**/*-test.{js,ts}'], | ||
extends: ['plugin:qunit/recommended'], | ||
}, |
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.
See above – I assume this should go into the config that previously contained the Mocha linting settings?
@@ -1,4 +1,4 @@ | |||
import { alias, oneWay } from '@ember/object/computed'; | |||
import { alias, readOnly } from '@ember/object/computed'; |
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 seems unrelated?
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 are 2 unit tests which expect three properties in session service to be readOnly and fail when set. So I have changed properties isAuthenticated, data and store to readOnly.
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.
But oneWay
should be the same? My point is migrating the tests from Mocha to Qunit shouldn't require any changes in the tested 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.
oneWay will not throw an error when set. I have found the bug in mocha tests so the bug was always there.
it('is read-only', function() {
expect(() => {
sessionService.set('store', 'some other store');
}).to.throw;
});
it should be
}).to.throw();
Change isAuthenticated from oneWay to readOnly has fixed 3 tests, but it can be considered as breaking change. So maybe we should remove these 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.
Hm, we should definitely move that into a separate PR to not also mix actual changes to the behavior into this – it's already a huge PR (necessarily) so I'd keep it as limited as possible :)
@@ -1,52 +1,51 @@ | |||
|
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.
packages/test-app/package.json
Outdated
@@ -73,4 +71,4 @@ | |||
"cssstyle": "~1.2.2", | |||
"jsdom": "^11.10.0" | |||
} | |||
} | |||
} |
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.
} | |
} | |
// eslint-disable-next-line node/no-missing-require | ||
najax = require('najax'); | ||
} catch (err) { | ||
// ignore the 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.
Why is this error ignored?
packages/test-app/tests/index.html
Outdated
{{content-for "test-body-footer"}} | ||
</body> | ||
|
||
</html> |
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.
Seems like this diff of this file is a bit messed up because of the reformatting (and now missing indentation)?
I went through the changes and there isn't anything from my side apart from what Marco's pointed out. Though again, it probably makes sense as it's what we need to do for Ember 4.0 anyway. |
69a2dd9
to
e9d4eb7
Compare
@@ -14,24 +14,22 @@ | |||
"test:fastboot": "ember fastboot:test" | |||
}, | |||
"devDependencies": { | |||
"@ember/jquery": "^2.0.0", |
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 this related?
'token_type_hint': 'refresh_token', | ||
'token': 'refresh token!' | ||
}); | ||
if (body.token_type_hint === 'refresh_token') { |
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.
@candunaj I assume the if
could just be dropped?
f78d5d6
to
5b35bbd
Compare
5b35bbd
to
ee701a8
Compare
ee701a8
to
57f659e
Compare
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.
great job 🎉
Removed mocha. Added Qunit. Refactored unit tests.