chore: track package-lock.json (#4238)

* chore: track package-lock.json

* Pin to old versions for node 14

* Use version range

* Remove unused cached directories

* Temporarily disable other tests

* Temporarily enable only api test

* Enable only some packages

* Test only api packages

* Test trace exporters

* Fix line ordering

* Test all packages except otlp exporters

* Add trace http exporter

* Add trace proto exporter

* Test all but grpc exporters

* chore: use npm workspaces and degrade lerna to v6

* chore: get rid of lerna bootstrap

* chore: use npx

* chore: allow install scripts to setup buf

* chore: fix w3c-integration-test cache key

* chore: fix cache key

* chore: disable resource compat test

* chore: fix node_modules assumptions

* chore: fix hoisted karma issue

* chore: fix markdown linter complaints

* chore: lock @grpc/grpc-js to v1.8.21

* Break caches

* chore: remove cache

* chore: fixup inline commands

---------

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
This commit is contained in:
Chengzhong Wu 2023-11-02 07:51:24 +08:00 committed by GitHub
parent 1c7d7a3542
commit e9328abb68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 63741 additions and 256 deletions

View File

@ -25,27 +25,11 @@ jobs:
- run: npm install -g npm@latest
- name: restore lerna
id: cache
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
packages/*/node_modules
packages/*/package-lock.json
experimental/packages/*/node_modules
experimental/packages/*/package-lock.json
key: node-tests-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04292022
- name: Bootstrap
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests
run: npm ci
- name: Build 🔧
run: |
npm run compile
run: npm run compile
- name: Benchmark tests
run: |

View File

@ -15,31 +15,9 @@ jobs:
with:
node-version: '18'
- name: restore lock files
uses: actions/cache@master # must use unreleased master to cache multiple paths
id: cache
with:
# must be done before bootstrap to not include node_modules files in the cache paths
path: |
package-lock.json
packages/*/package-lock.json
backwards-compatibility/*/package-lock.json
metapackages/*/package-lock.json
packages/*/package-lock.json
integration-tests/*/package-lock.json
key: ${{ runner.os }}-unit_test-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}
- name: Install and Build (cache miss) 🔧
if: steps.cache.outputs.cache-hit != 'true'
- name: Install and Build 🔧
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js'
npm run compile
- name: Install and Build (cache hit) 🔧
if: steps.cache.outputs.cache-hit == 'true'
run: |
npm ci --ignore-scripts
npx lerna bootstrap --hoist --nohoist='zone.js'
npm ci
npm run compile
- name: Build Docs

View File

@ -34,24 +34,8 @@ jobs:
args: "./**/*.md"
ignore: './CHANGELOG.md ./experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/protos ./experimental/packages/opentelemetry-exporter-metrics-otlp-proto/protos ./packages/exporter-trace-otlp-grpc/protos ./packages/exporter-trace-otlp-proto/protos'
- name: restore lerna
id: cache
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
packages/*/node_modules
packages/*/package-lock.json
experimental/packages/*/node_modules
experimental/packages/*/package-lock.json
key: lint-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04142022
# On a cache miss, install dependencies
- name: Bootstrap
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js'
run: npm ci
- name: Lint
run: |

View File

@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v4
- name: Install lerna
run: npm install -g lerna
run: npm install -g lerna@6.6.2
- name: Install semver
run: npm install semver

View File

@ -33,31 +33,11 @@ jobs:
- run: npm install -g npm@"<10.0.0"
if: ${{ matrix.node_version == '14' || matrix.node_version == '16' }}
- name: restore lerna
id: cache
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
packages/*/node_modules
packages/*/package-lock.json
experimental/packages/*/node_modules
experimental/packages/*/package-lock.json
key: node-tests-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04292022
# temporary fix for https://github.com/nrwl/nx/issues/19022
- run: npm install --save-dev nx@16.7.4 @nx/devkit@16.7.4
if: ${{ matrix.node_version == '14' }}
- name: Bootstrap
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests
run: npm ci
- name: Build 🔧
run: |
npm run compile
run: npm run compile
- name: Unit tests
run: |
@ -83,23 +63,8 @@ jobs:
- run: npm install -g npm@latest
- name: restore lerna
id: cache
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
packages/*/node_modules
packages/*/package-lock.json
experimental/packages/*/node_modules
experimental/packages/*/package-lock.json
key: node-windows-tests-${{ runner.os }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}
- name: Bootstrap
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests
run: npm ci
- name: Build 🔧
run: |
@ -122,27 +87,11 @@ jobs:
with:
node-version: 16
- name: restore lerna
id: cache
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
packages/*/node_modules
packages/*/package-lock.json
experimental/packages/*/node_modules
experimental/packages/*/package-lock.json
key: browser-tests-${{ runner.os }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04292022
- name: Bootstrap
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests
run: npm ci
- name: Build 🔧
run: |
npm run compile
run: npm run compile
- name: Unit tests
run: npm run test:browser
@ -159,27 +108,11 @@ jobs:
with:
node-version: 16
- name: restore lerna
id: cache
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
packages/*/node_modules
packages/*/package-lock.json
experimental/packages/*/node_modules
experimental/packages/*/package-lock.json
key: webworker-tests-${{ runner.os }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04292022
- name: Bootstrap
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js'
run: npm ci
- name: Build 🔧
run: |
npm run compile
run: npm run compile
- name: Unit tests
run: npm run test:webworker

View File

@ -18,33 +18,11 @@ jobs:
with:
node-version: '16'
- name: restore lock files
uses: actions/cache@master # must use unreleased master to cache multiple paths
id: cache
with:
# must be done before bootstrap to not include node_modules files in the cache paths
path: |
package-lock.json
packages/*/package-lock.json
metapackages/*/package-lock.json
packages/*/package-lock.json
integration-tests/*/package-lock.json
key: ${{ runner.os }}-w3c_integration-${{ hashFiles('**/package.json') }}
- name: Install and Bootstrap (cache miss) 🔧
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --scope=propagation-validation-server --include-dependencies
- name: Install and Bootstrap (cache hit) 🔧
if: steps.cache.outputs.cache-hit == 'true'
run: |
npm ci --ignore-scripts
npx lerna bootstrap --hoist --scope=propagation-validation-server --include-dependencies
- name: Install and Bootstrap 🔧
run: npm ci
- name: Generate version.ts files
run: lerna run version
run: npm run version:update
- name: Build 🔧
run: npm run compile

1
.gitignore vendored
View File

@ -66,7 +66,6 @@ typings/
# lock files
yarn.lock
package-lock.json
# docs files
docs

View File

@ -19,6 +19,9 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
### :house: (Internal)
* chore: track package-lock.json [#4238](https://github.com/open-telemetry/opentelemetry-js/pull/4238) @legendecas
* Switched to npm workspaces to bootstrap dependencies.
## 1.17.1
### :bug: (Bug Fix)

View File

@ -161,7 +161,7 @@ Most of the commands needed for development are accessed as [npm scripts](https:
### Install dependencies
This will install all dependencies for the root project and all modules managed by `lerna`. By default, a `postinstall` script will run `lerna bootstrap` automatically after an install. This can be avoided using the `--ignore-scripts` option if desired.
This will install all dependencies for the root project and all modules managed by `npm workspaces`.
```sh
npm install

View File

@ -77,7 +77,7 @@
"karma-mocha-webworker": "1.3.0",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"memfs": "3.5.3",
"mocha": "10.2.0",
"nyc": "15.1.0",

View File

@ -95,7 +95,7 @@ describe('tree-shaking', () => {
if (err) {
return reject(err);
}
resolve(stats);
resolve(stats!);
});
});
assert.deepStrictEqual(stats.compilation.errors, []);

View File

@ -7,8 +7,8 @@
},
"dependencies": {
"@opentelemetry/api": "^1.6.0",
"@opentelemetry/api-logs": "0.41.0",
"@opentelemetry/sdk-logs": "0.41.0"
"@opentelemetry/api-logs": "0.44.0",
"@opentelemetry/sdk-logs": "0.44.0"
},
"devDependencies": {
"@types/node": "18.6.5",

View File

@ -76,7 +76,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"ts-loader": "8.4.0",

View File

@ -76,7 +76,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"ts-loader": "8.4.0",

View File

@ -60,7 +60,7 @@
"codecov": "3.8.3",
"cpx": "1.5.0",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -89,7 +89,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -78,7 +78,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -57,7 +57,7 @@
"codecov": "3.8.3",
"cpx": "1.5.0",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -80,7 +80,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -77,7 +77,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -67,7 +67,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -56,7 +56,7 @@
"codecov": "3.8.3",
"cpx": "1.5.0",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -80,7 +80,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -63,7 +63,7 @@
"codecov": "3.8.3",
"cpx": "1.5.0",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -50,7 +50,7 @@
"@types/sinon": "10.0.19",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -73,7 +73,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -63,7 +63,7 @@
"@types/sinon": "10.0.19",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"semver": "7.5.4",

View File

@ -59,7 +59,7 @@
"axios": "1.5.1",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nock": "13.3.4",
"nyc": "15.1.0",

View File

@ -73,7 +73,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -100,7 +100,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -71,7 +71,7 @@
"@types/sinon": "10.0.19",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"semver": "7.5.4",

View File

@ -78,7 +78,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -59,7 +59,7 @@
"codecov": "3.8.3",
"cpx": "1.5.0",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"protobufjs-cli": "1.1.2",

View File

@ -66,7 +66,7 @@
"@types/sinon": "10.0.19",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"protobufjs-cli": "1.1.2",

View File

@ -69,7 +69,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"ts-loader": "8.4.0",

View File

@ -87,7 +87,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -57,7 +57,7 @@
"@types/sinon": "10.0.19",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -1,6 +1,8 @@
{
"version": "independent",
"npmClient": "npm",
"useWorkspaces": true,
"// packages": "Please sync with package.json#workspaces",
"packages": [
"api",
"packages/*",

View File

@ -0,0 +1,14 @@
# Maintaining npm workspaces dependencies
This documents the caveats on maintaining npm workspaces dependencies.
## Karma
Packages with executables are hoisted in workspaces. In this case, `karma` and
its plugins are not installed in the same `node_modules` folder, which leads to
a condition that `karma` can not find the plugins necessary to run the tests.
To alleviate this, karma and its plugins are listed as root dependencies as
well.
Relevant issue: [[RFC] Add nohoist option for workspaces](https://github.com/npm/rfcs/issues/287)

63602
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -8,15 +8,14 @@
"prewatch": "npm run precompile",
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
"postinstall": "npm run update-ts-configs && npm run bootstrap",
"postinstall": "npm run update-ts-configs",
"submodule": "git submodule sync --recursive && git submodule update --init --recursive",
"version:update": "lerna run version:update",
"version:update": "lerna run version",
"test": "lerna run test",
"test:browser": "lerna run test:browser",
"test:webworker": "lerna run test:webworker",
"test:backcompat": "lerna run test:backcompat",
"test:bench": "lerna run test:bench",
"bootstrap": "lerna bootstrap --hoist --nohoist='zone.js'",
"changelog": "lerna-changelog",
"codecov": "lerna run codecov",
"codecov:browser": "lerna run codecov:browser",
@ -73,8 +72,14 @@
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "5.0.1",
"gh-pages": "6.0.0",
"lerna": "7.1.5",
"@lerna/legacy-package-management": "7.1.5",
"karma": "6.4.2",
"karma-chrome-launcher": "3.1.0",
"karma-coverage": "2.2.1",
"karma-mocha": "2.0.1",
"karma-mocha-webworker": "1.3.0",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "6.6.2",
"linkinator": "5.0.2",
"markdownlint-cli": "0.36.0",
"prettier": "3.0.3",
@ -96,5 +101,20 @@
"internal": ":house: (Internal)"
},
"cacheDir": ".changelog"
}
},
"// workspaces": "Please sync with lerna.json#packages",
"workspaces": [
"api",
"packages/*",
"experimental/packages/*",
"experimental/examples/*",
"experimental/backwards-compatibility/*",
"integration-tests/*",
"selenium-tests",
"examples/otlp-exporter-node",
"examples/opentelemetry-web",
"examples/http",
"examples/https",
"examples/esm-http-ts"
]
}

View File

@ -49,7 +49,7 @@
"@types/node": "18.6.5",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"ts-mocha": "10.0.0",

View File

@ -70,7 +70,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -63,7 +63,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -5,9 +5,6 @@
"rootDir": "src",
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
},
"files": [
"node_modules/zone.js/dist/zone.js.d.ts"
],
"include": [
"src/**/*.ts"
],

View File

@ -5,9 +5,6 @@
"rootDir": "src",
"tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo"
},
"files": [
"node_modules/zone.js/dist/zone.js.d.ts"
],
"include": [
"src/**/*.ts"
],

View File

@ -4,9 +4,6 @@
"outDir": "build",
"rootDir": "."
},
"files": [
"node_modules/zone.js/dist/zone.js.d.ts"
],
"include": [
"src/**/*.ts",
"test/**/*.ts"

View File

@ -78,7 +78,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -51,7 +51,7 @@
"@types/sinon": "10.0.19",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nock": "13.3.4",
"nyc": "15.1.0",

View File

@ -76,7 +76,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nock": "13.3.4",
"nyc": "15.1.0",

View File

@ -62,7 +62,7 @@
"@types/node": "18.6.5",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"ts-loader": "8.4.0",

View File

@ -68,7 +68,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -76,7 +76,7 @@
"karma-mocha-webworker": "1.3.0",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nock": "13.3.4",
"nyc": "15.1.0",

View File

@ -66,7 +66,6 @@
},
"devDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.7.0",
"@opentelemetry/resources_1.9.0": "npm:@opentelemetry/resources@1.9.0",
"@types/mocha": "10.0.2",
"@types/node": "18.6.5",
"@types/sinon": "10.0.19",
@ -81,7 +80,7 @@
"karma-mocha-webworker": "1.3.0",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -37,7 +37,6 @@ import {
import { TestStackContextManager } from './TestStackContextManager';
import { TestTracingSpanExporter } from './TestTracingSpanExporter';
import { Resource, ResourceAttributes } from '@opentelemetry/resources';
import { Resource as Resource190 } from '@opentelemetry/resources_1.9.0';
import { TestExporterWithDelay } from './TestExporterWithDelay';
describe('SimpleSpanProcessor', () => {
@ -292,35 +291,36 @@ describe('SimpleSpanProcessor', () => {
});
});
describe('compatibility', () => {
it('should export when using old resource implementation', async () => {
const processor = new SimpleSpanProcessor(exporter);
const providerWithAsyncResource = new BasicTracerProvider({
resource: new Resource190({ fromold: 'fromold' }),
});
const spanContext: SpanContext = {
traceId: 'a3cda95b652f4a1592b449d5929fda1b',
spanId: '5e0c63257de34c92',
traceFlags: TraceFlags.SAMPLED,
};
const span = new Span(
providerWithAsyncResource.getTracer('default'),
ROOT_CONTEXT,
'span-name',
spanContext,
SpanKind.CLIENT
);
processor.onStart(span, ROOT_CONTEXT);
assert.strictEqual(exporter.getFinishedSpans().length, 0);
processor.onEnd(span);
// TODO: https://github.com/open-telemetry/opentelemetry-js/pull/4238#issuecomment-1788516773
// describe('compatibility', () => {
// it('should export when using old resource implementation', async () => {
// const processor = new SimpleSpanProcessor(exporter);
// const providerWithAsyncResource = new BasicTracerProvider({
// resource: new Resource190({ fromold: 'fromold' }),
// });
// const spanContext: SpanContext = {
// traceId: 'a3cda95b652f4a1592b449d5929fda1b',
// spanId: '5e0c63257de34c92',
// traceFlags: TraceFlags.SAMPLED,
// };
// const span = new Span(
// providerWithAsyncResource.getTracer('default'),
// ROOT_CONTEXT,
// 'span-name',
// spanContext,
// SpanKind.CLIENT
// );
// processor.onStart(span, ROOT_CONTEXT);
// assert.strictEqual(exporter.getFinishedSpans().length, 0);
// processor.onEnd(span);
const exportedSpans = exporter.getFinishedSpans();
// const exportedSpans = exporter.getFinishedSpans();
assert.strictEqual(exportedSpans.length, 1);
assert.strictEqual(
exportedSpans[0].resource.attributes['fromold'],
'fromold'
);
});
});
// assert.strictEqual(exportedSpans.length, 1);
// assert.strictEqual(
// exportedSpans[0].resource.attributes['fromold'],
// 'fromold'
// );
// });
// });
});

View File

@ -54,7 +54,7 @@
"@types/sinon": "10.0.19",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -77,7 +77,7 @@
"karma-mocha-webworker": "1.3.0",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -54,7 +54,7 @@
"@types/sinon": "10.0.19",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nock": "13.3.4",
"nyc": "15.1.0",

View File

@ -50,7 +50,7 @@
"@types/node": "18.6.5",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"ts-mocha": "10.0.0",

View File

@ -69,7 +69,7 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.5",
"lerna": "6.6.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"sinon": "15.1.2",

View File

@ -80,7 +80,7 @@
"devDependencies": {
"@types/node": "18.6.5",
"cross-var": "1.1.0",
"lerna": "7.1.5",
"lerna": "6.6.2",
"typescript": "4.4.4"
},
"Add these to devDependencies for testing": {

View File

@ -37,15 +37,13 @@ function exec(command, argv) {
}
function pbts(pbjsOutFile) {
const pbtsPath = path.resolve(appRoot, './node_modules/.bin/pbts');
const pbtsOptions = [
'-o', path.join(generatedPath, 'root.d.ts'),
];
return exec(pbtsPath, [...pbtsOptions, pbjsOutFile]);
return exec('npx', ['--package=protobufjs-cli', 'pbts', ...pbtsOptions, pbjsOutFile]);
}
async function pbjs(files) {
const pbjsPath = path.resolve(appRoot, './node_modules/.bin/pbjs');
const outFile = path.join(generatedPath, 'root.js');
const pbjsOptions = [
'-t', 'static-module',
@ -54,7 +52,7 @@ async function pbjs(files) {
'--null-defaults',
'-o', outFile,
];
await exec(pbjsPath, [...pbjsOptions, ...files]);
await exec('npx', ['--package=protobufjs-cli', 'pbjs', ...pbjsOptions, ...files]);
return outFile;
}