Skip to content

Commit 2fec990

Browse files
authored
test: fix test-all-versions script (#3017)
Use `npm run --workspaces ...` rather than `nx run-many --parallel=false ...` to run test-all-versions targets.
1 parent 2300dc1 commit 2fec990

File tree

9 files changed

+21
-12
lines changed

9 files changed

+21
-12
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ jobs:
6464
- "20"
6565
- "22"
6666
- "24"
67-
include:
68-
- node: 18
69-
code-coverage: true
7067
runs-on: ubuntu-latest
7168
services:
7269
memcached:
@@ -273,6 +270,11 @@ jobs:
273270
with:
274271
name: tests-coverage-cache-${{ github.run_number }}-22
275272
path: .
273+
- name: Download Test Artifacts (24)
274+
uses: actions/download-artifact@v5
275+
with:
276+
name: tests-coverage-cache-${{ github.run_number }}-24
277+
path: .
276278
# Note: see comment in the compile job
277279
- name: Set base and head commits
278280
run: |

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
"version:update": "nx run-many -t version:update",
1515
"compile": "nx run-many -t compile",
1616
"compile:ci:affected": "nx affected -t compile",
17+
"list:affected": "nx affected -t test-all-versions --graph=stdout | jq -c '.tasks.tasks[].target.project'",
1718
"test": "nx run-many -t test",
1819
"test:ci:affected": "nx affected -t test",
1920
"test:browser": "nx run-many -t test:browser",
2021
"test:browser:ci:affected": "nx affected -t test:browser",
21-
"test-all-versions": "nx run-many --parallel=false -t test-all-versions",
22-
"test-all-versions:ci:affected": "nx affected --parallel=false -t test-all-versions",
22+
"test-all-versions": "npm run --if-present test-all-versions --workspaces",
23+
"test-all-versions:ci:affected": "npm run list:affected | tail -n +5 | xargs -I {} -t npm run --if-present test-all-versions -w {}",
2324
"test-merge-coverage:ci:affected": "nx affected -t test-merge-coverage",
2425
"test-services:start": "docker compose -f ./test/docker-compose.yaml up -d --wait",
2526
"test-services:stop": "docker compose -f ./test/docker-compose.yaml down",

packages/instrumentation-aws-sdk/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
"lint:readme": "node ../../scripts/lint-readme.js",
4040
"prepublishOnly": "npm run compile",
4141
"tdd": "npm run test -- --watch-extensions ts --watch",
42-
"test": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'",
42+
"test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'",
4343
"test-all-versions": "tav",
44+
"test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json",
4445
"version:update": "node ../../scripts/version-update.js",
4546
"watch": "tsc -w"
4647
},

packages/instrumentation-cucumber/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
"directory": "packages/instrumentation-cucumber"
1111
},
1212
"scripts": {
13-
"test": "nyc mocha 'test/**/*.test.ts'",
13+
"test": "nyc --no-clean mocha 'test/**/*.test.ts'",
1414
"test-all-versions": "tav",
15+
"test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json",
1516
"tdd": "npm run test -- --watch-extensions ts --watch",
1617
"clean": "rimraf build/*",
1718
"lint": "eslint . --ext=ts,js,mjs",

packages/instrumentation-ioredis/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"prepublishOnly": "npm run compile",
2020
"test": "nyc --no-clean mocha 'test/**/*.test.ts'",
2121
"test-all-versions": "tav",
22+
"test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json",
2223
"tdd": "npm run test -- --watch-extensions ts --watch",
2324
"test:debug": "cross-env RUN_REDIS_TESTS=true mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'",
2425
"test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test",

packages/instrumentation-mongoose/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
"test-v5-v6": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/mongoose-common.test.ts' 'test/**/mongoose-v5-v6.test.ts'",
2323
"test-v7-v8": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/mongoose-common.test.ts' 'test/**/mongoose-v7-v8.test.ts'",
2424
"test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test",
25-
"test-all-versions": "tav",
25+
"test-all-versions": "tav",
2626
"test-all-versions:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm run test-all-versions",
27+
"test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json",
2728
"test-services:start": "cd ../.. && npm run test-services:start mongodb",
2829
"test-services:stop": "cd ../.. && npm run test-services:stop mongodb",
2930
"version:update": "node ../../scripts/version-update.js"

packages/instrumentation-pg/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
"lint:readme": "node ../../scripts/lint-readme.js",
1919
"prepublishOnly": "npm run compile",
2020
"tdd": "npm run test -- --watch-extensions ts --watch",
21-
"test": "nyc mocha 'test/**/*.test.ts'",
21+
"test": "nyc --no-clean mocha 'test/**/*.test.ts'",
2222
"test:debug": "mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'",
2323
"test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test",
2424
"test-all-versions": "tav",
2525
"test-all-versions:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm run test-all-versions",
26+
"test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json",
2627
"test-services:start": "cd ../.. && npm run test-services:start postgres",
2728
"test-services:stop": "cd ../.. && npm run test-services:stop postgres",
2829
"version:update": "node ../../scripts/version-update.js",

packages/instrumentation-redis/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
"lint:readme": "node ../../scripts/lint-readme.js",
1919
"prepublishOnly": "npm run compile",
2020
"tdd": "npm run test -- --watch-extensions ts --watch",
21-
"test-v2-v3": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/v2-v3/*.test.ts'",
22-
"test": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/v4-v5/*.test.ts'",
21+
"test-v2-v3": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/v2-v3/*.test.ts'",
22+
"test": "nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/v4-v5/*.test.ts'",
2323
"test:debug": "cross-env RUN_REDIS_TESTS=true mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'",
2424
"test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test",
2525
"test-all-versions": "tav",
2626
"test-all-versions:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm run test-all-versions",
27+
"test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json",
2728
"test-services:start": "cd ../.. && npm run test-services:start redis",
2829
"test-services:stop": "cd ../.. && npm run test-services:stop redis",
2930
"version:update": "node ../../scripts/version-update.js"

packages/instrumentation-winston/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"lint:fix": "eslint . --ext=ts,js,mjs --fix",
1818
"lint:readme": "node ../../scripts/lint-readme.js",
1919
"prepublishOnly": "npm run compile",
20-
"test": "nyc mocha 'test/**/*.test.ts'",
20+
"test": "nyc --no-clean mocha 'test/**/*.test.ts'",
2121
"test-all-versions": "tav",
2222
"test-merge-coverage": "nyc merge .nyc_output coverage/coverage-final.json",
2323
"version:update": "node ../../scripts/version-update.js"

0 commit comments

Comments
 (0)