-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: upgrade to mocha@10 #2481
base: main
Are you sure you want to change the base?
Conversation
From mocha@7. Drop use of ts-mocha in favour of a .mocharc.yml. This mimicks the same mocha@10 update that was done in opentelemetry-js.git a long while back. Refs: open-telemetry#1826 (comment)
… the .mocharc.yml file that uses ts-node
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2481 +/- ##
==========================================
- Coverage 90.74% 90.49% -0.26%
==========================================
Files 156 151 -5
Lines 7728 7418 -310
Branches 1590 1550 -40
==========================================
- Hits 7013 6713 -300
+ Misses 715 705 -10 |
I don't know how to solve this. @david-luna If you have a chance to look at this and provide TypeScript expertise, I'd appreciate it. |
This package does not have an assigned component owner and is considered unmaintained. As such this package is in feature-freeze and this PR will be closed with 14 days unless a new owner or a sponsor (a member of @open-telemetry/javascript-approvers) for the feature is found. It is the responsibility of the author to find a sponsor for this feature. |
for some reason with this configuration the tests are not getting the router types from cd ./plugins/node/opentelemetry-instrumentation-router
npmx tsc --showConfig
{
"compilerOptions": {
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"declaration": true,
"declarationMap": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": true,
"module": "commonjs",
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"sourceMap": true,
"strict": true,
"strictNullChecks": true,
"target": "es2017",
"incremental": true,
"newLine": "lf",
"rootDir": "./",
"outDir": "./build"
},
"files": [
"./src/constants.ts",
"./src/index.ts",
"./src/instrumentation.ts",
"./src/internal-types.ts",
"./src/router.d.ts", <-- router types are included
"./src/utils.ts",
"./src/version.ts",
"./src/enums/AttributeNames.ts",
"./src/enums/LayerType.ts",
"./test/index.test.ts"
],
"include": [
"src/**/*.ts",
"test/**/*.ts"
],
"exclude": [
"../../../node_modules"
]
}
npx ts-node --showConfig
{
"ts-node": {
"cwd": "/Users/david/Documents/repos/otel/opentelemetry-js-contrib/plugins/node/opentelemetry-instrumentation-router",
"projectSearchDir": "/Users/david/Documents/repos/otel/opentelemetry-js-contrib/plugins/node/opentelemetry-instrumentation-router",
"project": "/Users/david/Documents/repos/otel/opentelemetry-js-contrib/plugins/node/opentelemetry-instrumentation-router/tsconfig.json"
},
"compilerOptions": {
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"declaration": false,
"forceConsistentCasingInFileNames": true,
"inlineSources": true,
"module": "commonjs",
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"sourceMap": true,
"strict": true,
"strictNullChecks": true,
"target": "es2017",
"incremental": true,
"newLine": "lf",
"rootDir": "./",
"outDir": "./.ts-node",
"inlineSourceMap": false,
"noEmit": false
} <-- no "files" defined in this configuration
} The easies way to have the type definitions in the test is to use triple slash directive pointing to the // file: index.test.ts
/*
* Copyright The OpenTelemetry Authors
* ...
*/
/// <reference path="../src/router.d.ts" />
import { context, trace } from '@opentelemetry/api';
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node'; |
/me sponsoring this |
Thanks! I'll try that. |
I guess this isn't the easiest way, because our lint rules say using the triple-slash-directive is an error. :) Sigh. |
FWIW a similar test failure happens with packages/opentelemetry-host-metrics. These two packages (host-metrics and instrumentation-router) are the two packages that have .d.ts files committed. A theory is that the issue relates to I'd welcome suggestions on what to do here. |
…ost-metrics package; use eslint disable comment to avoid complaint about using those triple-slash-refs
From mocha@7. Drop use of ts-mocha in favour of a .mocharc.yml.
This mimicks the same mocha@10 update that was done in opentelemetry-js.git
a long while back.
Refs: #1826 (comment)