guard-minitest runs ALL tests not just the ones for the target file changed - minitest

I stripped my Guardfile down to this. If I edit a controller guard starts ALL tests.
guard :minitest, all_on_start: false, all_after_pass: false, spring: true do
watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/controllers/#{m[1]}_controller_test.rb" }
end
Am I missing something here?

Related

Changing anyMatch default for Filter.JS in ExtJS for MultiSelect search

I have a multiselect bound to a store in which I implemented use of anyMatch: true to allow for True to allow any match - no regex start/end line anchors will be added (as per the comment in Filter.js). My problem is that I need to implement this as per the answer to multiselect-search-whole-string, in particular the solution provided in this fiddle https://fiddle.sencha.com/#fiddle/jf5
What I want to do is just set anyMatch: true, regardless, so I set it in Filter.js, but this has no effect on use of it. I searched the entire codebase for other instances of anyMatch: false and the only other one is in ext-all-debug.js. Why isn't setting these values having any effect? I don't see where else this default value could be set?
EDIT 1
I tried a different override, and while it is not exhibiting the right behavior, it is actually doing something this time. I figured that since the chunk of code that does work when embedded in the search attribute within the MultiSelector control was pretty much what was found in the MultiSelectorSearch's search method, that this was what I needed to focus on for the override. Any suggestions on tweaking this would be most welcome:
Ext.define('Ext.overrides.view.MultiSelectorSearch', {
override: 'Ext.view.MultiSelectorSearch',
search: function (text, me) {
var filter = me.searchFilter,
filters = me.getSearchStore().getFilters();
if (text) {
filters.beginUpdate();
if (filter) {
filter.setValue(text);
} else {
me.searchFilter = filter = new Ext.util.Filter({
id: 'search',
property: me.field,
value: text,
anyMatch: true
});
}
filters.add(filter);
filters.endUpdate();
} else if (filter) {
filters.remove(filter);
}
}
});
EDIT 2
Got it! The key was that originally, since this code was embedded in a singleton, I could reference the method by passing me from the calling form.panel. This did not work globally as an override, and required me to define the method as
search: function (text) {
var me = this,
I hope this helps someone out there!
Changing in ext-all-debug.js is not safe, when you do a production build this file will not get included.
Best way is to override the Filter class, here is how you can do it.
Ext.define('Ext.overrides.util.Filter', {
override: 'Ext.util.Filter',
anyMatch: true
});
And import this class in Application.js
Ext.require([
'Ext.overrides.util.Filter'
]);

browserify without sourcemaps

I'm using Browserify programmatically, through node, like so:
var options = {
debug: true,
cache: {},
packageCache: {},
fullPaths: true,
noParse: []
};
var b = browserify( 'index.js', options );
b.on('data', customFunction);
b.bundle();
My customFunction doesn't modify the data anyhow, just reads it.
It runs a regex on the first line, to detect the file name of the code that comes on the following lines.
The thing is, when i set options.debug to false, to get rid of the sourcemaps, the customFunction behaves in a very different way (the regex doesn't get half the file names) and i can't seem to figure out the pattern for that difference. I assume that turning debug to false, does more than turning off the sourcemaps.
I just want to turn off the sourcemaps on browserify, with no other side-effects, is this possible?
You could try to extract the source maps with a separate tool like exorcist https://github.com/thlorenz/exorcist

Cucumber with #IntegrationTest

I want to run cucumber for my test, but without run first my api rest, for this reason I include #IntegrationTest in my RunCakes. class, but when I run my integration test, the application don't start.
#RunWith(Cucumber.class)
#CucumberOptions(format = { "pretty", "html:target/cucumber-html- report" }, dryRun = false, strict = true, features = { "classpath:features" })
#IntegrationTest({ "server.port=9001", "spring.cloud.config.server.git.uri=file:./target/repos/configuration-sample",
"spring.cloud.config.server.bootstrap=false", "ldap.uri=" , "security.ignored="})
public class RunCukesIT {
}
You're most likely looking for #WebIntegrationTest instead of #IntegrationTest.

Different lint.xml for different build types in Android Studio?

I want to use different lint.xml files for release and debug build types in Android Studio. So, how can this be achieved?
When I place lint.xml in someModule/src/debug and someModule/src/release folders (also, these folders contain only that lint.xml file and nothing more) gradle reacts as there is no any lint.xml file, If I place single lint.xml file under core module folder (someModule/)- gradle recognizes it, but in this case I can't use different settings depending on build type...
Here's what worked for me:
tasks.whenTaskAdded { task ->
if (task.name.startsWith("lint")) {
if (task.name.toLowerCase().endsWith("release")) {
task.doFirst {
android.lintOptions.abortOnError = true
}
} else {
task.doFirst {
android.lintOptions.abortOnError = false
}
}
}
}
In my case I needed to turn on abortOnError for release builds so that I can develop freely but catch lint errors quickly on my CI (if they slipped).
I did not try it, but maybe something like this could help you.
tasks.whenTaskAdded { task ->
if (task.name == 'lintDebug') {
task.ext.lintXmlFileName = "lint-debug.xml"
} else if (task.name == 'lintDemo') {
task.ext.lintXmlFileName = "lint-demo.xml"
}
}
EDIT: comments feedback:
task.ext.xxxx is a custom name space for you to use: see https://docs.gradle.org/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html
"lintXmlFileName" is a made up name. You won't find doc about it.
in android{... lintOptions {... lintConfig file("lint.xml")}} you need to read "lintXmlFileName" using ".ext.get("lintXmlFileName")" and set it for "lintConfig file()"
I did not test it, but I assume the "whenTaskAdded" goes outside of "android" in your app's build.gradle.
With kotlin build scripts (build.gradle.kts):
tasks.withType<LintBaseTask>().configureEach {
// doFirst is required else we get a Null Pointer Exception on lintOption
doFirst {
// This will override the lintOptions from the android extension
lintOptions.run {
if (name.toLowerCase().contains("debug")) {
// Do your configuration here
// isAbortOnError = true
// baselineFile = file("baseline.xml")
// isWarningsAsErrors = true
// isCheckDependencies = true
// ignore("MissingTranslation")
// setLintConfig(file("lint.xml"))
}
}
}
}
This is summary from Android studio new build system guide, lint support.
Lint support
As of version 0.7.0, you can run lint for a specific variant, or for all variants, in which case it produces a report which describes which specific variants a given issue applies to.
You can configure lint by adding a lintOptions section like following. You typically only specify a few of these; this section shows all the available options.
android {
lintOptions {
// set to true to turn off analysis progress reporting by lint
quiet true
// if true, stop the gradle build if errors are found
abortOnError false
// if true, only report errors
ignoreWarnings true
// if true, emit full/absolute paths to files with errors (true by default)
//absolutePaths true
// if true, check all issues, including those that are off by default
checkAllWarnings true
// if true, treat all warnings as errors
warningsAsErrors true
// turn off checking the given issue id's
disable 'TypographyFractions','TypographyQuotes'
// turn on the given issue id's
enable 'RtlHardcoded','RtlCompat', 'RtlEnabled'
// check *only* the given issue id's
check 'NewApi', 'InlinedApi'
// if true, don't include source code lines in the error output
noLines true
// if true, show all locations for an error, do not truncate lists, etc.
showAll true
// Fallback lint configuration (default severities, etc.)
lintConfig file("default-lint.xml")
// if true, generate a text report of issues (false by default)
textReport true
// location to write the output; can be a file or 'stdout'
textOutput 'stdout'
// if true, generate an XML report for use by for example Jenkins
xmlReport false
// file to write report to (if not specified, defaults to lint-results.xml)
xmlOutput file("lint-report.xml")
// if true, generate an HTML report (with issue explanations, sourcecode, etc)
htmlReport true
// optional path to report (default will be lint-results.html in the builddir)
htmlOutput file("lint-report.html")
// set to true to have all release builds run lint on issues with severity=fatal
// and abort the build (controlled by abortOnError above) if fatal issues are found
checkReleaseBuilds true
// Set the severity of the given issues to fatal (which means they will be
// checked during release builds (even if the lint target is not included)
fatal 'NewApi', 'InlineApi'
// Set the severity of the given issues to error
error 'Wakelock', 'TextViewEdits'
// Set the severity of the given issues to warning
warning 'ResourceAsColor'
// Set the severity of the given issues to ignore (same as disabling the check)
ignore 'TypographyQuotes'
}
}
EDIT: add the real and workable example
As we all know, the new Android build system is based on gradle. The core component of the gradle build system is task. There are different lint tasks if you project has different build variant. You can get those tasks from android studio All task list, or from commandline ./gradlew tasks. A example show as following, two build flavors demo and full.
lint - Runs lint on all variants.
lintDemoDebug - Runs lint on the DemoDebug build
lintDemoRelease - Runs lint on the DemoRelease build
lintFullDebug - Runs lint on the FullDebug build
lintFullRelease - Runs lint on the FullRelease build
These lint task are dependency on other tasks, here let's say preBuild.
Before run the lint task, it will run the task preBuild firstly. The task preBuild is an already existing task, but we can manipulate this pre-defined task and add more action to this task. android lintOptions property will be added and modified dynamically based on different build variants as the following code demonstrate in the file app/build.gradle.
preBuild.doFirst {
android.applicationVariants.each { variant ->
if (variant.name == 'demoDebug') {
println variant.name
android.lintOptions.quiet = true
android.lintOptions.lintConfig = new File('app/lint_demo_debug.xml')
// you can add more properties
} else if (variant.name == 'fullDebug') {
println variant.name
android.lintOptions.quiet = false
android.lintOptions.lintConfig = new File('app/lint_full_debug.xml')
// you can add more properties
} // more variants...
}
In order to run the code above successfully, the corresponding lint configuration file must exist under app directory.

How set class to input on error using jQuery-validation-engine

I'm using the jquery-validation-engine plugin and after validate I need to add a class to the inputs with the error promt to add for example a red border or something like that, is there a way using the plugin configuration to setup this?
I alsow use that same plugin.
Do you have the last verion off the plug-in ?
In the file: jquery.validationEngine.js
you will find almost at the bottom:
InvalidFields: [],
onFieldSuccess: false,
onFieldFailure: false,
onSuccess: false,
onFailure: false,
addSuccessCssClassToField: false,
addFailureCssClassToField: false,
These are the 'master' settings for the options you are looking for.
My current setup is like:
InvalidFields: [],
onFieldSuccess: true,
onFieldFailure: true,
onFormSuccess: false,
onFormFailure: false,
addSuccessCssClassToField: 'inputbox-success',
addFailureCssClassToField: 'inputbox-error',
And then the two css classes in youre css file ( 'inputbox-error' & 'inputbox-succes').
This works just fine over here..
Good Luck...
And if you have any more question about this plugin or other functions off it just ask .. :P
Greets,
Marco

Resources