Skip to content
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

Run tests in production #4223

Merged
merged 2 commits into from
Mar 13, 2016
Merged

Run tests in production #4223

merged 2 commits into from
Mar 13, 2016

Conversation

pangratz
Copy link
Member

@pangratz pangratz commented Mar 9, 2016

This adds a new test helper testInDebug which executes a test via QUnit.test if we are not in the production environment. If the tests are executed in production environment though, then the test is skipped via QUnit.skip.

The tests are now also run on TravisCI via ember test --environment=production.

This addresses #4203.

TODO

@bmac
Copy link
Member

bmac commented Mar 9, 2016

@pangratz do you mind rebasing this pr?

import RecordReference from './references/record';
import BelongsToReference from './references/belongs-to';
import HasManyReference from './references/has-many';
import RecordReference from 'ember-data/-private/system/references/record';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relative should work correctly, if it does not that is a bug in the build we need to fix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. Let's wait until that is resolved, then I will rebase and remove this commit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this has been resolved with #4215 🎉

This test contains assertions for correctly rejected records in
coalesced requests AND an assertion that a warning is logged.

This commit splits the test into two: the first tests the correct
behavior for rejected records and the second tests that the warning for
missing records is logged.

The splitting is necessary since in an upcoming commit the tests are run
in production too: since in that environment tests which check for
assertions are stripped, currently we would lose this test. That's why
this test is split beforehand so the behavior is tested in production
build as well.
This adds a `testInDebug` helper, which skips tests when run in
production. This helper either runs the tests normally via QUnit.test if
we are not in a production environment. If the test is executed within
production however, QUnit.skip is used instead so the test is skipped.

This allows us to skip tests which don't make sense in the production
environment: this are tests which check for warnings and assertions
thrown within code. Since those assertions/warnings are stripped from
production code, it doesn't make sense to run those tests in that
environment.
bmac added a commit that referenced this pull request Mar 13, 2016
@bmac bmac merged commit b3eb9c0 into emberjs:master Mar 13, 2016
@bmac
Copy link
Member

bmac commented Mar 13, 2016

Thanks @pangratz

@pangratz pangratz deleted the run-tests-in-production branch March 18, 2016 21:28
@pangratz pangratz restored the run-tests-in-production branch March 22, 2016 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants