Skip to content
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

[engsys] upgrade mocha to v9 for some core libraries #21696

Closed
wants to merge 2 commits into from

Conversation

jeremymeng
Copy link
Member

  • mocha to ^9.2.0 and @types/mocha to ^9.0.0

Currently ts-node doesn't support ESM. It's recommended to set

TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }'

See details at https://github.com/mochajs/mocha-examples/blob/443a3e3b3591206b94fabc55739cc384f39d13f6/packages/typescript/README.md#es-modules

- mocha to ^9.2.0 and @types/mocha to ^9.0.0

Currently ts-node doesn't support ESM. It's recommended to set

```
TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }'
```

See details at https://github.com/mochajs/mocha-examples/blob/443a3e3b3591206b94fabc55739cc384f39d13f6/packages/typescript/README.md#es-modules
@xirzec
Copy link
Member

xirzec commented Apr 29, 2022

I thought the -r esm was adding support? Also the readme mentions direct support is possible: https://github.com/TypeStrong/ts-node#native-ecmascript-modules

@jeremymeng
Copy link
Member Author

I thought the -r esm was adding support? Also the readme mentions direct support is possible: https://github.com/TypeStrong/ts-node#native-ecmascript-modules

It didn't work for me. It looks that we need to either use ts-node CLI, or use node CLI and pass the --loader ts-node/esm option

@azure-sdk
Copy link
Collaborator

API change check for @azure/abort-controller

API changes are not detected in this pull request for @azure/abort-controller

@azure-sdk
Copy link
Collaborator

API change check for @azure/core-amqp

API changes are not detected in this pull request for @azure/core-amqp

@azure-sdk
Copy link
Collaborator

API change check for @azure/core-auth

API changes are not detected in this pull request for @azure/core-auth

@azure-sdk
Copy link
Collaborator

API change check for @azure/core-client

API changes are not detected in this pull request for @azure/core-client

@azure-sdk
Copy link
Collaborator

API change check for @azure/core-lro

API changes are not detected in this pull request for @azure/core-lro

@azure-sdk
Copy link
Collaborator

API change check for @azure/core-paging

API changes are not detected in this pull request for @azure/core-paging

@azure-sdk
Copy link
Collaborator

API change check for @azure/core-tracing

API changes are not detected in this pull request for @azure/core-tracing

@azure-sdk
Copy link
Collaborator

API change check for @azure/core-xml

API changes are not detected in this pull request for @azure/core-xml

@azure-sdk
Copy link
Collaborator

API change check for @azure/core-util

API changes are not detected in this pull request for @azure/core-util

@azure-sdk
Copy link
Collaborator

API change check for @azure/logger

API changes are not detected in this pull request for @azure/logger

@azure-sdk
Copy link
Collaborator

API change check for @azure/core-http-compat

API changes are not detected in this pull request for @azure/core-http-compat

@jeremymeng
Copy link
Member Author

It is also possible to specify the loader option in mocharc: mochajs/mocha#4726 (comment)

@jeremymeng
Copy link
Member Author

set to draft mode. This fails on node 12 (and 17)

@jeremymeng jeremymeng marked this pull request as draft April 29, 2022 16:44
@@ -26,7 +26,7 @@
"test:node": "npm run clean && tsc -p . && npm run unit-test:node && npm run integration-test:node",
"test": "npm run clean && tsc -p . && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test",
"unit-test:browser": "karma start --single-run",
"unit-test:node": "mocha -r esm -r ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace --exclude \"test/**/browser/*.spec.ts\" \"test/**/*.spec.ts\"",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reporter is removed?

@HarshaNalluru
Copy link
Member

Looks like windows doesn't like these updates?

@xirzec
Copy link
Member

xirzec commented May 2, 2022

Not sure if it's helpful or not but I was able to get mocha to work with native ESM support here:

xirzec/cadl-ts@9533fd5

I didn't know before but you can put mocha config into package.json to avoid having a long commandline in your npm script. Also ts-node can be configured in your root tsconfig.

@jeremymeng
Copy link
Member Author

I didn't know before but you can put mocha config into package.json to avoid having a long commandline in your npm script. Also ts-node can be configured in your root tsconfig.

Nice to know! I think it may be better if we can re-use some centralized mocha config or shared command-line via dev-tool, so we can reduce code churn for every package in the future when we need to adjust the settings.

@ghost ghost added the no-recent-activity There has been no recent activity on this issue. label Jul 15, 2022
@ghost
Copy link

ghost commented Jul 15, 2022

Hi @jeremymeng. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days.

@ghost ghost closed this Jul 22, 2022
@ghost
Copy link

ghost commented Jul 22, 2022

Hi @jeremymeng. Thank you for your contribution. Since there hasn't been recent engagement, we're going to close this out. Feel free to respond with a comment containing "/reopen" if you'd like to continue working on these changes. Please be sure to use the command to reopen or remove the "no-recent-activity" label; otherwise, this is likely to be closed again with the next cleanup pass.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core dev-tool Issues related to the Azure SDK for JS dev-tool eslint plugin no-recent-activity There has been no recent activity on this issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants