Data path "['build']" should have required property 'builder' - angular7

Schema validation failed with the following errors:
Data path "['build']" should have required property 'builder'.
Error: Schema validation failed with the following errors:
Data path "['build']" should have required property 'builder'.

Add below in angular.json under main project schema.
"build": {
"builder": "#angular-devkit/build-angular:browser",
...
}

Related

I'm trying to set build name based on package.json file in jenkins but I just got an error

I want to set in my build name the version of the package.json file. I have my environment with the plugins "Build Name and Description Setter 2.2.0" and "token macro 293.v283932a_0a_b_49" when I ran my pipeline jobs I got the following error:
Failed to evaluate name macro:org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens
This is my Build Name in the job: SQ_${JSON, file="./package.json", path="version"}
You can try something like -
def package = readJSON file: 'package.json'
def version = package.version
currentBuild.displayName = "${BUILD_NUMBER} - ${version}"
Ref - https://www.jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#readjson-read-json-from-files-in-the-workspace

Jest configuration setupFilesAfterEnv option was not found

I'm trying to make Jest work again on a project developped 1 year ago and not maintained.
I have an error with path of setupFilesAfterEnvor transform.
the error i get when i run "yarn test"
$ jest __testsv2__ --config=./jest.config.js
● Validation Error:
Module <rootDir>/jest/setup.js in the setupFilesAfterEnv option was not found.
<rootDir> is: /Users/alain/dev/ddf/release
Configuration Documentation:
https://jestjs.io/docs/configuration.html
error Command failed with exit code 1.
my filesystem, in /Users/alain/dev/ddf/release/ i have
babel.config.js
jest.config.js
/jest
/setup
setup.js ( so full path is : /Users/alain/dev/ddf/release/jest/setup.js )
staticFileAssetTransform.js ( so full path is : /Users/alain/dev/ddf/release/jest/staticFileAssetTransform.js )
My package.json
{ ...
"scripts": {
"test": "jest __testsv2__ --config=./jest.config.js"
...
}
}
babel.config.js
module.exports = function(api) {
api.cache(false);
const presets = ['#babel/preset-env', '#babel/preset-react'];
const plugins = [['#babel/proposal-object-rest-spread'],];
return {
presets, plugins, sourceMaps: "inline",
ignore: [(process.env.NODE_ENV !== 'test' ? "**/*.test.js" : null) ].filter(n => n)
};
};
jest.config.js
module.exports = {
resolver: 'browser-resolve',
clearMocks: true,
moduleNameMapper: { '\\.(css|less|styl|md)$': 'identity-obj-proxy' },
// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: ['./jest/setup.js'], // don't work too
setupFilesAfterEnv: ['<rootDir>/jest/setup.js'],
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/node_modules/', '/__gql_mocks__/'],
// A map from regular expressions to paths to transformers
transform: {
'^.+\\.js$': './jest/babelRootModeUpwardTransform.js',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/jest/staticFileAssetTransform.js',
},
};
You might want to delete your node modules, package-lock.json and run npm i again, I had a similar issue and that was a fix for me. Also try npm cache clean --force
For those coming here, make sure you prefix the path with <rootDir>
Like this:
setupFilesAfterEnv: ['<rootDir>/node_modules/#hirez_io/observer-spy/dist/setup-auto-unsubscribe.js']

Jenkins Pipeline - Upload to Artifactory: Failed to deploy file / Parent must be a folder

I have a Jenkins job which generate a zip file I want to updload to Artifactory. I have an issue setting the version of the artifact to be uploaded.
By convention, I use the timestamp has version. I want to upload file to my/group/timestamp/file.zip. The url of the file would be http://ArtifactoryAdress/foo/my/group/timestamp/file.zip
Here is my pipeline code
def serverArtifactory = Artifactory.server 'NameArtificatory'
def uploadSpec = """{
"files": [
{
"pattern": "file.zip",
"target": "my/group/${timestamp}/"
}
]
}"""
serverArtifactory.upload(uploadSpec)
I get the following error from Jenkins Job
java.lang.RuntimeException: java.io.IOException: Failed to deploy
file. Status code: 400 Response message: Artifactory returned the
following errors:
Parent my/group/timestampValue must be a folder Status code: 400
I looked around buildInfo but was not able to find how to set a version.
By the way, I am also agree with a solution without the timestamp but only group name.
Finally, this error is clear and simple.
As mentioned, a file with path my/group/timestampValue already exists. You have to delete it on Artifactory.
Don't forget it's still groovy use ${}. I used below code and it's work
def uploadSpec = """{
"files": [
{
"pattern": "**/target/*.war",
"target": "local-release/${APP_REPO}/${version.trim()}/${timestamp}.zip"
}
]}"""
server.upload(uploadSpec)
#Edit. And I just thought about it. Print please your ${timestamp}. Maybe it's contains characters with spaces, or something like this which Artifactory not allowed in directory name. Try trim your timestamp.trim()

java.lang.IllegalStateException: No Datastore Session bound to thread, and configuration does not allow creation of non-transactional one here

am getting the below error when i run grails app in my local
file:/home/schepuri/grails/2.4.4/projects/my-app/plugins/excel-import-0.9.6/lib/xmlbeans-2.3.0-without-w3c.jar
-------------------------------------------------------------
java.lang.IllegalStateException: No Datastore Session bound to thread, and configuration does not allow creation of non-transactional one here
at org.grails.datastore.mapping.core.DatastoreUtils.doGetSession(DatastoreUtils.java:149)
at org.grails.datastore.mapping.core.AbstractDatastore.getCurrentSession(AbstractDatastore.java:141)
at org.grails.datastore.gorm.GormStaticApi.createCriteria(GormStaticApi.groovy:297)
Here is my BuildConfig.groovy file
dependencies {
compile 'org.grails:grails-datastore-gorm-plugin-support:3.1.3.RELEASE'
compile 'org.grails:grails-datastore-gorm:3.1.3.RELEASE'
compile 'org.grails:grails-datastore-core:3.1.3.RELEASE'
}
plugins {
compile (":mongodb:3.0.2") {
excludes 'grails-datastore-gorm-plugin-support'
excludes 'grails-datastore-gorm'
excludes 'grails-datastore-core'
}
}
Am i missing any dependency plugins in my buildconfig file or

Clarification on grunt-protractor-coverage syntax for rails app backend?

Background
I'm trying to use the grunt-protractor-coverage in my grunt script to get code coverage for protractor functional e2e tests. To get started, I utilized this tutorial, with some minor modifications and it works perfectly. Using this as a guide, I created a new gruntfile, substituting the "express" app with a rails app backend.
The Problem
When running my gruntfile, I get the following stack trace:
../dummy/node_modules/grunt-protractor-coverage/node_modules/protractor/node_modules/glob/glob.js:130
throw new Error("must provide pattern")
^
Error: must provide pattern
at new Glob (../dummy/node_modules/grunt-protractor-coverage/node_modules/protractor/node_modules/glob/glob.js:130:11)
at glob ../dummy/node_modules/grunt-protractor-coverage/node_modules/protractor/node_modules/glob/glob.js:57:11)
at Function.globSync [as sync] (../dummy/node_modules/grunt-protractor-coverage/node_modules/protractor/node_modules/glob/glob.js:76:10)
at Function.ConfigParser.resolveFilePatterns (../dummy/node_modules/grunt-protractor-coverage/node_modules/protractor/lib/configParser.js:89:26)
at Runner.run (../dummy/node_modules/grunt-protractor-coverage/node_modules/protractor/lib/runner.js:323:24)
at process.<anonymous> (../dummy/node_modules/grunt-protractor-coverage/node_modules/protractor/lib/runFromLauncher.js:32:14)
at process.EventEmitter.emit (events.js:98:17)
at handleMessage (child_process.js:318:10)
at Pipe.channel.onread (child_process.js:345:11)
[launcher] Runner Process Exited With Error Code: 8
Tracing through the code in grunt's task.js file via [node-inspector] (https://github.com/node-inspector/node-inspector), it seems there are two possible issues:
I'm missing some parameter from my config file which would correctly retrieve the files needed
There is a syntax issue
Any idea why it's throwing this error?
My Config File
protractor_coverage: {
options: {
configFile: '/usr/local/lib/node_modules/protractor/referenceConf.js', // Default config file
keepAlive: true, // If false, the grunt process stops when the test fails.
noColor: false, // If true, protractor will not use colors in its output.
coverageDir: '<%= dirs.instrumentedE2E %>',
args: {}
},
phantom: {
options: {
args: {
baseUrl: 'http://localhost:3000/',
// Arguments passed to the command
'browser': 'phantomjs'
}
}
},
chrome: {
options: {
args: {
baseUrl: 'http://localhost:3000/',
// Arguments passed to the command
'browser': 'chrome'
}
}
}
},
This error means that the plugin was unable to locate your spec files. There were a couple of bugs related to this that have been fixed in recent releases.
You'll generally want your protractorConf.js to be part of your projects. I generally put it in a directory called 'tests'.
So your options would then look like:
options: {
configFile: 'tests/protractorConf.js',
keepAlive: true, // If false, the grunt process stops when the test fails.
noColor: false, // If true, protractor will not use colors in its output.
coverageDir: '<%= dirs.instrumentedE2E %>',
args: {}
},
You could then put your specs in a 'tests/specs' directory, and in this protractorConf.js, reference them as:
specs: [
'tests/specs/**/*.spec.js',
'!**/exclude.spec.js'
],
This would get any file that ends with .spec.js in /tests/specs and any subdirectories therein, unless the file is named exclude.spec.js.
I had this issue also, for me in my protractorConf file I had to change where my path was.
I originally had
specs: [
'./e2e/**/*.spec.js'
],
which worked fine with protractor, and grunt-protractor-runner
But for some reason, the protractor-coverage, this did not run. I changed it to
specs: [
'test/e2e/**/*.spec.js'
],
and this solved my issue. Basically protractor-coverage looks at the path from the base rather then from the config file.

Resources