Log from Jenkins:
nx run-many --target=test --projects=a,b,c,d,e,f,g,h --ci --runInBand
> nx run a:test --ci=true --runInBand=true
PASS a/component.spec.ts
PASS a/another-component.spec.ts
> nx run b:test --ci=true --runInBand=true
PASS b/file.spec.ts (147.183 s)
PASS b/another-file.spec.ts (5.116 s)
Test Suites: 54 passed, 54 total
Tests: 277 passed, 277 total
Snapshots: 0 total
Time: 240.571 s
Ran all test suites.
So after running the test for project a, it does not show the output. It is always a bit consistent with 2 projects where the tests run fine.
Maybe it is failing silently somewhere?
Related
I have a cucumber test suite which has some tests
I run the tests using command
sbt "testOnly <cucumber_class_name>"
And one of the cucumber tests fail an assertion and console shows
Failed scenarios:
classpath:features/my_cucumber_scenario.feature:31# <my test description>
19 Scenarios (1 failed, 18 passed)
88 Steps (1 failed, 87 passed)sts 214s
3m18.224s
But in the end the console shows
Total 80, Failed 0, Errors 0, Passed 80
Since one of the tests failed, in the final output it should have shown
Failed 1 (Or something like that). But it is showing all passed instead due to which my build on travis is not failing.
How to solve this problem ? Is there a solution in cucumber ?
My dependencies are
"io.cucumber" % "cucumber-core" % "5.7.0",
"io.cucumber" % "cucumber-junit" % "5.7.0"
"io.cucumber" %% "cucumber-scala" % "5.7.0"
This problem is solved by cucumber team in
https://github.com/cucumber/cucumber-jvm-scala/releases/tag/v6.2.2
I am using Jest for testing mu nodejs code an after commiting my code the pipeline runs and Jest test case is throwing error but pipeline is not failing.
In test case it shows there are not expected results and so test case is failing but is not forcing the gitlab pipeline to fail. Any help?
✓ (10 ms)
✓ Test case for creating patient form testing (12 ms)
Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 3.174 s
Ran all test suites matching /patient_create.test.js/i.
(node:18484) UnhandledPromiseRejectionWarning: Error: expect(received).not.toBeDefined()
Received: [Error: expect(received).toBe(expected) // Object.is equality·
Expected: 200
Received: 404]```
package.json script block in file:
"scripts": {
...
"test:schema": "./src/schemas/schema-test.sh"
}
.gitlab-ci.yml file contents:
image: node:12
stages:
- lint
- test
# - build
.yarn_install:
before_script:
- yarn config set #private:registry https://npm.private.io
- echo "//npm.private.io/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- yarn install
- export PATH="./node_modules/.bin:${PATH}"
prettier:
stage: lint
script:
- yarn config set #private:registry https://npm.private.io
- echo "//npm.private.io/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- yarn add prettier
- yarn lint
schema test:
stage: test
script:
- yarn test:schema
variables:
GIT_DEPTH: 10
schema-test.sh file contents:
#/usr/bin/env bash
# Test all file ends with schema.json via ajv
CURRENT_DIR=`dirname "$0"`
cd $CURRENT_DIR
for SCHEMA_FILE in *.schema.json
do
SAMPLE_FILE=samples/${SCHEMA_FILE/schema/sample}
echo Schema file: $SCHEMA_FILE
if [ -f $SAMPLE_FILE ]
then
echo Found sample file: $SAMPLE_FILE
npx ajv -s $SCHEMA_FILE -d $SAMPLE_FILE
else
echo "*NO* sample file found for $SCHEMA_FILE"
fi
done
Gitlab CI error message:
...
51 $ export PATH="./node_modules/.bin:${PATH}"
52 $ yarn test:schema
53 yarn run v1.21.1
54 $ ./src/schemas/schema-test.sh
55 ./src/schemas/schema-test.sh: 11: ./src/schemas/schema-test.sh: Bad substitution
56 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
57 error Command failed with exit code 2.
61 ERROR: Job failed: command terminated with exit code 1
The CI error said there was a problem with line 11 of the schema-test.Sh file, but I didn't see the problem.
They work well in a MacOS environment, and my guess is that CI's Docker image is Linux, causing some compatibility issues.
Or is it just a matter of the ' / ' symbol not being Escape Code? I'm confused.
Thank you for all of your help!
==================================================
According to #chepner said to make changes, but the test is still a problem
23 $ yarn test:schema
24 yarn run v1.21.1
25 $ ./src/schemas/schema-test.sh
26 Schema file: dev-assistant.schema.json
27 Found sample file: samples/dev-assistant.sample.json
28 npx: installed 6 in 1.124s
29 command not found: ajv
30 Schema file: form.schema.json
31 *NO* sample file found for form.schema.json
32 Schema file: news.schema.json
33 *NO* sample file found for news.schema.json
34 Schema file: repos.schema.json
35 Found sample file: samples/repos.sample.json
36 npx: installed 6 in 0.911s
37 command not found: ajv
38 Schema file: team-members.schema.json
39 Found sample file: samples/team-members.sample.json
40 npx: installed 6 in 0.902s
41 command not found: ajv
42 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
43 error Command failed with exit code 1.
47 ERROR: Job failed: command terminated with exit code 1
Your script isn't executed with bash, so don't use bash-specific features. Assuming you want to change foo.schema.json to foo.sample.json, you can use instead
SAMPLE_FILE=samples/${SCHEMA_FILE%.schema.json}.sample.json
This removes .schema.json from the expansion of SCHEMA_FILE, then adds .sample.json back explicitly.
I get an error the following after run make test command in preCICE on Centos 7. Did anyone encounter this problem?
Thank you...
cmake parameters when building
cmake3 .. -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug -DMPI=ON
-DMPIEXEC_EXECUTABLE=/opt/ohpc/pub/mpi/openmpi3-gnu8/3.1.4/bin/mpiexec
-DCMAKE_INSTALL_PREFIX=/opt $PRECICE_ROOT
[root#headnode build]# make test
Running tests...
Test project /opt/precice-1.6.1/build
Start 1: precice.Base
1/4 Test #1: precice.Base .....................***Failed 0.01 sec
Start 2: precice.MPI_Ports
2/4 Test #2: precice.MPI_Ports ................***Failed 0.01 sec
Start 3: precice.PetRBFParallel
3/4 Test #3: precice.PetRBFParallel ...........***Failed 0.01 sec
Start 4: precice.NoMPI
4/4 Test #4: precice.NoMPI .................... Passed 4.09 sec
25% tests passed, 3 tests failed out of 4
Label Time Summary:
canfail = 0.02 sec*proc (2 tests)
Total Test time (real) = 4.14 sec
The following tests FAILED:
1 - precice.Base (Failed)
2 - precice.MPI_Ports (Failed)
3 - precice.PetRBFParallel (Failed)
Errors while running CTest
make: *** [test] Error 8
Before running test as root enter following :
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
export OMPI_ALLOW_RUN_AS_ROOT=1
I created a simple webpack project for a Typescript library : https://github.com/lbar/test-webpackts-issue
On linux, npm run build finishes successfully:
> rimraf dist && webpack --progress --profile
10% 0/1 build modulests-loader: Using typescript#1.8.10 and /tmp/testwebpack/tsconfig.json 8030ms1217ms optimi5ms emit
Hash: 8eac1502f3b7a9a19be2
Version: webpack 1.13.1
Time: 2596ms
Asset Size Chunks Chunk Names
index.js 816 bytes 0 [emitted] index
index.js.map 6.07 kB 0 [emitted] index
/tmp/testwebpack/dist/index.d.ts 31 bytes [emitted]
/tmp/testwebpack/dist/src/info.d.ts 49 bytes [emitted]
+ 2 hidden modules
On Windows, npm run build is blocked during 'emit' phase. The output is :
> rimraf dist && webpack --progress --profile
10% 0/1 build modulests-loader: Using typescript#1.8.10 and C:\tmp\testwebpack\tsconfig.jso
1836ms build modules
3ms seal
7ms optimize
3ms hashing
7ms create chunk assets
79ms additional chunk assets
19ms optimize chunk assets
837ms optimize assets
95% emit
The version of node differs: 6.2.2 on Windows and 4.4.5 on Linux. I don't know if it may be the cause.
Has anyone an idea about the problem? Issue in webpack, ts-loader or typescript?
One more thing, call to tsc is working on both systems.
Thanks for your help
This problem is caused by an issue in ts-loader: https://github.com/TypeStrong/ts-loader/issues/185
A Pull Request is waiting fixes for project core team.
Webpack can use "awesome-typescript-loader" to avoid this issue.