-
Notifications
You must be signed in to change notification settings - Fork 20
Pdcl 13739 #191
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
base: master
Are you sure you want to change the base?
Pdcl 13739 #191
Conversation
…ectable test modules. pdcl-13739: integration tests. pdcl-13739: audit dependencies.
ca2e2a9
to
8c5a4c6
Compare
b0c8999
to
580db4d
Compare
…bled = false. Evict the oldest message first when the buffer of de-duped messages fills.
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.
When removing inject-loader, here's the general pattern:
old module
var depA = require('./deps/a);
var depb = require('./deps/b);
module.exports = function theThing(runtimeDep) { ... }
New pattern
var validateInjectedParams = require('./helpers/validate-expected-inject-params');
// injectableThing allows us to remove inject-loader
function injectableThing({ depA, depB}) {
return function theThing(runtimeDep) { ... }
}
var validateInjection = validateInjectedParams(injectableThing);
// since we test using the injectable factory, this ensures we export a fully-ready
// default export for production
module.exports = validateInjection({
depA: require('./dep/a'),
depB: require('./dep/b')
});
if (unit_test_mode) {
// provided for test files
module.exports.injectableThing = validateInjection;
}
}, | ||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
REACTOR_KARMA_CI_UNIT_TEST_MODE: JSON.stringify(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 is used throughout Turbine now to control if we expose injectable functions or only export the default module with the real run-time dependencies.
name: '_satellite' | ||
}, | ||
plugins: [ | ||
replace({ |
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 our production bundler. enusure REACTOR_KARMA_CI_UNIT_TEST_MODE
is gone.
* governing permissions and limitations under the License. | ||
****************************************************************************************/ | ||
|
||
describe( |
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 test file is loaded first in the unit test suite and its job is to ensure that when we call the default export of these injectable modules that they don't throw any errors from our new auto validation function that checks we've injected the right amount of params for production.
/** | ||
* Outputs a warning message to the web console. | ||
* @param {...*} arg Any argument to be logged. | ||
* Outputs a deprecation warning to the web console. |
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 was the original ask of the ticket pdcl-13979: Turbine was too chatty in a production environment because logger.deprecation was allowed to call the console even when setDebug(false) was called. This file now holds up to 100 unique log messages to de-duplicate and ignore. once the buffer fills up, the first entry is ejected to make room for a new call.
The goal here is if we see 5 unique deprecation messages over and over and over, we log each of them once and never again when outputEnabled = false
.
'use strict'; | ||
|
||
// Only run integration tests | ||
var testsContext = require.context( |
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.
The integration test allows us to really boot up Turbine and ensure it doesn't throw any errors while doing so.
…gration tests. Provide dist/engine.js during build:production.
eab607a
to
e335b5b
Compare
…engine to "desktop".
5d43346
to
37d5a4b
Compare
var logDeprecation = function () { | ||
var wasEnabled = outputEnabled; | ||
outputEnabled = true; | ||
var message = arguments[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.
It looks like turbine is already pretty good about telling where deprecation notices came from. Is this ever called by 3rd party extensions?
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, it can be called by any 3rd party extension using turbine.logger
/* eslint-disable max-len */ | ||
/* eslint-disable no-unused-vars */ | ||
|
||
const testContainer = { |
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 like the idea of having an in-browser integration test suite, but I'm not sure we should build it out beyond tests that provide more coverage than the existing unit tests.
It would be cool if it was smart enough to receive a real build that came from Forge. Maybe we can use a mock build (container) and also support providing a real build? Or perhaps they are 2 different test tasks? We could make it so integration tests could be called individually from a separate workflow.
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 we should at least come up with a few containers that hit major code paths. As an example, this will test the ...ToQueue
files because action/condition sequencing is on but this container misses testing things like createRunAction
which is synchronous.
…s scope the function name. Fix an eslint issue
…usable logic for creating sync/async containers.
Description
Turbine will overwhelm the console when a user's implementation (either directly or indirectly through an extension they installed) accesses deprecated features. This changes aims to:
Related Issue
Motivation and Context
Closes #184
How Has This Been Tested?
Screenshots (if appropriate):
Removing inject-loader
Types of changes
This is a major change that could have unforseen consequences. Must review carefully.
Checklist: