Modify npm scripts for Flowzone

Replace test with test:base to make sure integration tests don't run in CI.
Integration tests for the Supervisor fail when not run in container, leading
to an error-exit and cause the Flowzone CI job for Node to fail.

By returning true, the Flowzone Node CI job succeeds, and this is fine even if tests
fail because they will be caught in the Docker job anyway.

Also, combine original npm test script with test:node.

Signed-off-by: Christina Ying Wang <christina@balena.io>
This commit is contained in:
Christina Ying Wang 2022-09-12 15:10:17 -07:00 committed by Felipe Lalanne
parent 728724ce46
commit 82b4a7fe1e
3 changed files with 5 additions and 6 deletions

View File

@ -106,7 +106,7 @@ COPY test ./test
# most likely fail.
# For now this also runs the legacy tests, that are slow, this is a
# forcing function to finish the split between unit/integration
RUN npm run test:base
RUN npm run test
# When running tests from a container built from this stage,
# skip the mocha-pod setup

View File

@ -182,7 +182,7 @@ integration tests require a containerized environment with the right dependencie
To run type checks, and unit tests, you can use:
```
npm run test:base
npm run test
```
The supervisor runs on Node v12.16.2, so using that specific
@ -190,7 +190,7 @@ version will ensure tests run in the same environment as
production.
In order to run all tests, unit and integration, [docker-compose](https://docs.docker.com/compose/) is required.
The following command will build the image for an `amd64` target (running `test:base` during the build) and setup
The following command will build the image for an `amd64` target (running `test` during the build) and setup
the necessary dependencies for running integration tests.
```
@ -216,7 +216,7 @@ docker exec -ti $(docker ps -q --filter="name=_sut") sh
And then run all tests using
```
npm run test
npm run test:node
```
For more information about testing the Supervisor, see the [testing README](test/README.md).

View File

@ -18,8 +18,7 @@
"test:node": "npm run test:unit && npm run test:integration && npm run test:legacy",
"test:env": "docker-compose -f docker-compose.test.yml -f docker-compose.dev.yml up --build; npm run compose:down",
"test:compose": "docker-compose -f docker-compose.yml -f docker-compose.test.yml up --build --remove-orphans --exit-code-from=sut ; npm run compose:down",
"test:base": "npm run lint && npm run test:build && npm run test:unit && npm run test:legacy",
"test": "npm run lint && npm run test:build && npm run test:node",
"test": "npm run lint && npm run test:build && npm run test:unit && npm run test:legacy",
"compose:down": "docker-compose -f docker-compose.test.yml down",
"prettify": "balena-lint -e ts -e js --typescript --fix src/ test/ typings/ build-utils/ webpack.config.js",
"release": "tsc --project tsconfig.release.json && mv build/src/* build",