-
Notifications
You must be signed in to change notification settings - Fork 532
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
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)
…ost-metrics package; use eslint disable comment to avoid complaint about using those triple-slash-refs
TAV errors
it is failing because
Maybe we should check if there is an option to narrow the compilation to test files only. |
This surfaces one thing we may want to address. The normal flow is to compile 1st then test so what is happening is that we're running I did some changes in configuration and it seems to work. Here is a summary:
This way the diff diff --git a/plugins/node/instrumentation-cucumber/test/cucumber.test.ts b/plugins/node/instrumentation-cucumber/test/cucumber.test.ts
index deffbef3..08203277 100644
--- a/plugins/node/instrumentation-cucumber/test/cucumber.test.ts
+++ b/plugins/node/instrumentation-cucumber/test/cucumber.test.ts
@@ -35,7 +35,7 @@ import * as assert from 'assert';
import * as fs from 'fs';
import * as semver from 'semver';
-import { CucumberInstrumentation, AttributeNames } from '../src';
+import { CucumberInstrumentation, AttributeNames } from '../build/src';
const LIB_VERSION = require('@cucumber/cucumber/package.json').version;
const hasRunAttempt = semver.gte(LIB_VERSION, '8.8.0');
@@ -45,11 +45,12 @@ instrumentation.enable();
instrumentation.disable();
import {
- IConfiguration,
loadConfiguration,
loadSupport,
runCucumber,
} from '@cucumber/cucumber/api';
+import { IConfiguration } from './types';
+
import { PassThrough } from 'stream';
describe('CucumberInstrumentation', () => {
diff --git a/plugins/node/instrumentation-cucumber/tsconfig.json b/plugins/node/instrumentation-cucumber/tsconfig.json
index c8752378..85b93860 100644
--- a/plugins/node/instrumentation-cucumber/tsconfig.json
+++ b/plugins/node/instrumentation-cucumber/tsconfig.json
@@ -4,5 +4,5 @@
"rootDir": ".",
"outDir": "build"
},
- "include": ["src/**/*.ts", "test/**/*.ts"]
+ "include": ["src/**/*.ts"]
} NOTE: test sources are compiled each time we test a version but I think there is no way to skip this |
Idea when working with David on this: See if we can change .mocharc.yml to point to our own wrapper around |
This resolves issues with types issues when testing against older versions of some instrumented packages in TAV tests
The browser tests failed in CI with this error message: Error: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related to optional dependencies (npm/cli#4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
…o longer need this
@@ -0,0 +1 @@ | |||
require: 'ts-node/register/transpile-only' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewer note: ts-node offers this way to specify the transpileOnly: true
setting (which is what ts-mocha was using)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice finding 🎉
7f6a5e4 was to fix an issue (in package-lock.json) due to an npm bug that blew away binary build packages for rollup. It looks to me like there is the same issue with binary build packages for esbuild, e.g.:
and
However, none of the tests are failing. I'd expect the A total guess is because the browser tests in CI are only run with node 16, and perhaps the older npm uses the second half of the package-lock file (which we have pinned to lockfileVersion=2 to support older npm versions), and perhaps the second half of the package-lock file (the part for bwcompat) doesn't have this npm bug where the optional deps for other platforms are removed. |
I think that guess is wrong. I ran the browser tests in CI with Node.js 22 and they passed. So either:
(Or I'm missing something.) And same for |
oof, 36 conflicts in package-lock.json. No way to manually merge that. |
There were 36 conflicts in package-lock.json. I dropped all package-lock changes from this PR and will attempt to regenerate them.
…or packages Also add mocha to the top-level devDeps. This had a huge impact on the package-lock layout: instead of a mocha install in EVERY workspace subfolder, we get one at the top. This also resolves some errors in `npm ls` currently on main, that were introduced in open-telemetry#2269, e.g.: ``` $ npm ls ├─┬ @opentelemetry/propagator-instana@0.3.2 -> ./propagators/opentelemetry-propagator-instana │ ├── @types/sinon@17.0.3 invalid: "10.0.20" from propagators/opentelemetry-propagator-instana │ ├── karma-chrome-launcher@3.1.1 invalid: "3.1.0" from propagators/opentelemetry-propagator-instana ... ├─┬ @opentelemetry/propagator-ot-trace@0.27.2 -> ./propagators/opentelemetry-propagator-ot-trace │ ├── @types/sinon@17.0.3 invalid: "10.0.20" from propagators/opentelemetry-propagator-ot-trace ... ```
…ch package's package.json Is this okay? We effectively do the same for eslint.
package-lock.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewer note: As is common, most of the diff is in the package-lock file. This 22k line diff is down from a larger ~100k line diff in some of the earlier commits.
Grokking package-lock changes is very painful. I wrote a quick package-lock-diff
tool that attempts to make it a bit easier to see changes in which packages were installed where (and changes in version, "dev=true"). The tool is here: https://github.com/trentm/npm-tools/blob/main/bin/package-lock-diff
The package-lock-diff for this PR is:
https://gist.github.com/trentm/a510921555cfb194fa607b265a0c83dc
That may still not help anyone reviewing. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the diff was due to moving mocha to the top level package.json
.
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.
node_modules/
). There is prior art:eslint
deps are only at the top-level.Refs: #1826 (comment)
This also resolves some errors in
npm ls
currently on main, thatwere introduced in #2269, e.g.: