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

remove use-esm-workaround #28826

Merged
merged 4 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions common/tools/dev-tool/src/commands/run/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license

import { subCommand, makeCommandInfo } from "../../framework/command";
import { makeCommandInfo, subCommand } from "../../framework/command";

export const commandInfo = makeCommandInfo("run", "run scripts such as test:node");

export default subCommand(commandInfo, {
"test:node-tsx-ts": () => import("./testNodeTsxTS"),
"test:node-tsx-js": () => import("./testNodeTsxJS"),
"test:node-ts-input": () => import("./testNodeTSInput"),
"test:node-js-input": () => import("./testNodeJSInput"),
"test:browser": () => import("./testBrowser"),
Expand Down
24 changes: 3 additions & 21 deletions common/tools/dev-tool/src/commands/run/testNodeJSInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Licensed under the MIT license

import { leafCommand, makeCommandInfo } from "../../framework/command";

import concurrently from "concurrently";
import { createPrinter } from "../../util/printer";
import { isModuleProject } from "../../util/resolveProject";
import { runTestsWithProxyTool } from "../../util/testUtils";

export const commandInfo = makeCommandInfo(
Expand All @@ -17,39 +17,21 @@ export const commandInfo = makeCommandInfo(
default: false,
description: "whether to run with test-proxy",
},
"use-esm-workaround": {
shortName: "uew",
kind: "boolean",
default: false,
description:
"when true, uses the `esm` npm package for tests. Otherwise uses esm4mocha if needed",
},
},
);

export default leafCommand(commandInfo, async (options) => {
const isModule = await isModuleProject();
let esmLoaderArgs = "";

if (isModule === false) {
if (options["use-esm-workaround"] === false) {
esmLoaderArgs = "--loader=../../../common/tools/esm4mocha.mjs";
} else {
esmLoaderArgs = "-r ../../../common/tools/esm-workaround -r esm";
}
}

const reporterArgs =
"--reporter ../../../common/tools/mocha-multi-reporter.js --reporter-option output=test-results.xml";
const defaultMochaArgs = `${esmLoaderArgs} -r source-map-support/register.js ${reporterArgs} --full-trace`;
const defaultMochaArgs = `-r source-map-support/register.js ${reporterArgs} --full-trace`;
const updatedArgs = options["--"]?.map((opt) =>
opt.includes("**") && !opt.startsWith("'") && !opt.startsWith('"') ? `"${opt}"` : opt,
);
const mochaArgs = updatedArgs?.length
? updatedArgs.join(" ")
: '--timeout 5000000 "dist-esm/test/{,!(browser)/**/}/*.spec.js"';
const command = {
command: `c8 mocha ${defaultMochaArgs} ${mochaArgs}`,
command: `c8 mocha --require tsx ${defaultMochaArgs} ${mochaArgs}`,
name: "node-tests",
};

Expand Down
44 changes: 0 additions & 44 deletions common/tools/dev-tool/src/commands/run/testNodeTsxJS.ts

This file was deleted.

2 changes: 1 addition & 1 deletion sdk/appconfiguration/app-configuration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"pack": "npm pack 2>&1",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:browser": "npm run build:test && dev-tool run test:browser",
"integration-test:node": "dev-tool run test:node-tsx-js -- --timeout 180000 'dist-esm/test/**/*.spec.js'",
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 180000 'dist-esm/test/**/*.spec.js'",
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
"test": "npm run test:node && npm run test:browser",
Expand Down
2 changes: 1 addition & 1 deletion sdk/cognitivelanguage/ai-language-text/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"generate:client": "autorest --typescript swagger/README.md",
"integration-test:browser": "dev-tool run test:browser",
"integration-test:node": "dev-tool run test:node-js-input --use-esm-workaround=true -- --timeout 5000000 \"dist-esm/test/**/*.spec.js\"",
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 \"dist-esm/test/**/*.spec.js\"",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json src test --ext .ts",
Expand Down
2 changes: 1 addition & 1 deletion sdk/eventgrid/eventgrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"generate:client": "autorest --typescript ./swagger/README.md && node ./scripts/setPathToEmpty.js",
"integration-test:browser": "dev-tool run test:browser",
"integration-test:node": "dev-tool run test:node-tsx-js -- --timeout 5000000 \"dist-esm/test/**/*.spec.js\"",
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 \"dist-esm/test/**/*.spec.js\"",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js",
Expand Down
2 changes: 1 addition & 1 deletion sdk/eventhub/event-hubs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"generate-certs": "node ./scripts/generateCerts.js",
"integration-test:browser": "cross-env TEST_TARGET=live DISABLE_MULTI_VERSION_TESTING=true karma start --single-run",
"integration-test:node": "cross-env TEST_TARGET=live DISABLE_MULTI_VERSION_TESTING=true dev-tool run test:node-js-input --no-test-proxy=true --use-esm-workaround=true -- --timeout 600000 \"dist-esm/test/internal/*.spec.js\" \"dist-esm/test/public/*.spec.js\" \"dist-esm/test/public/**/*.spec.js\" \"dist-esm/test/internal/**/*.spec.js\"",
"integration-test:node": "cross-env TEST_TARGET=live DISABLE_MULTI_VERSION_TESTING=true dev-tool run test:node-js-input --no-test-proxy=true -- --timeout 600000 \"dist-esm/test/internal/*.spec.js\" \"dist-esm/test/public/*.spec.js\" \"dist-esm/test/public/**/*.spec.js\" \"dist-esm/test/internal/**/*.spec.js\"",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
"generate:client": "autorest --typescript ./swagger/README.md",
"integration-test:browser": "karma start --single-run",
"integration-test:node": "dev-tool run test:node-tsx-js --no-test-proxy=true",
"integration-test:node": "dev-tool run test:node-js-input --no-test-proxy=true",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js",
Expand Down
4 changes: 2 additions & 2 deletions sdk/keyvault/keyvault-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"generate:client": "autorest --typescript swagger/README.md",
"integration-test:browser": "echo skipped",
"integration-test:node": "dev-tool run test:node-js-input --use-esm-workaround=true -- --timeout 180000 --exclude \"dist-esm/**/*.browser.spec.js\" \"dist-esm/**/*.spec.js\"",
"integration-test:node:no-timeout": "dev-tool run test:node-js-input --use-esm-workaround=true -- --no-timeouts --full-trace --exclude \"dist-esm/**/*.browser.spec.js\" \"dist-esm/**/*.spec.js\"",
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 180000 --exclude \"dist-esm/**/*.browser.spec.js\" \"dist-esm/**/*.spec.js\"",
maorleger marked this conversation as resolved.
Show resolved Hide resolved
"integration-test:node:no-timeout": "dev-tool run test:node-js-input -- --no-timeouts --full-trace --exclude \"dist-esm/**/*.browser.spec.js\" \"dist-esm/**/*.spec.js\"",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json src --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json src --ext .ts",
Expand Down
4 changes: 2 additions & 2 deletions sdk/keyvault/keyvault-certificates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"samples-dev/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"generate:client": "autorest --typescript swagger/README.md",
"integration-test:browser": "dev-tool run test:browser",
"integration-test:node": "dev-tool run test:node-js-input --use-esm-workaround=true -- --timeout 350000 'dist-esm/**/*.spec.js'",
"integration-test:node:no-timeout": "dev-tool run test:node-js-input --use-esm-workaround=true -- --no-timeouts 'dist-esm/**/*.spec.js'",
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 350000 'dist-esm/**/*.spec.js'",
"integration-test:node:no-timeout": "dev-tool run test:node-js-input -- --no-timeouts 'dist-esm/**/*.spec.js'",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json src test --ext .ts",
Expand Down
4 changes: 2 additions & 2 deletions sdk/keyvault/keyvault-keys/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"generate:client": "autorest --typescript swagger/README.md",
"integration-test:browser": "dev-tool run test:browser",
"integration-test:node": "dev-tool run test:node-js-input --use-esm-workaround=true -- --timeout 5000000 'dist-esm/**/*.spec.js'",
"integration-test:node:no-timeout": "dev-tool run test:node-js-input --use-esm-workaround=true -- --timeout 9999999 'dist-esm/**/*.spec.js'",
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/**/*.spec.js'",
"integration-test:node:no-timeout": "dev-tool run test:node-js-input -- --timeout 9999999 'dist-esm/**/*.spec.js'",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json src test --ext .ts",
Expand Down
4 changes: 2 additions & 2 deletions sdk/keyvault/keyvault-secrets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"generate:client": "autorest --typescript swagger/README.md",
"integration-test:browser": "dev-tool run test:browser",
"integration-test:node": "dev-tool run test:node-js-input --use-esm-workaround=true -- --timeout 350000 'dist-esm/**/*.spec.js'",
"integration-test:node:no-timeout": "dev-tool run test:node-js-input --use-esm-workaround=true -- --no-timeout 'dist-esm/**/*.spec.js'",
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 350000 'dist-esm/**/*.spec.js'",
"integration-test:node:no-timeout": "dev-tool run test:node-js-input -- --no-timeout 'dist-esm/**/*.spec.js'",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json src test --ext .ts",
Expand Down
2 changes: 1 addition & 1 deletion sdk/monitor/monitor-opentelemetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"test:browser": "npm run unit-test:browser",
"unit-test:browser": "echo skipped",
"unit-test:node": "dev-tool run test:node-tsx-ts --no-test-proxy=true -- --timeout 1200000 \"test/internal/unit/**/*.test.ts\"",
"unit-test:node:debug": "dev-tool run test:node-tsx-js --no-test-proxy=true -- --inspect-brk --timeout 1200000 \"test/internal/unit/**/*.test.ts\"",
"unit-test:node:debug": "dev-tool run test:node-js-input --no-test-proxy=true -- --inspect-brk --timeout 1200000 \"test/internal/unit/**/*.test.ts\"",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"integration-test:browser": "echo skipped",
"integration-test:node": "dev-tool run test:node-ts-input --no-test-proxy=true -- \"test/internal/functional/**/*.test.ts\"",
Expand Down
2 changes: 1 addition & 1 deletion sdk/monitor/monitor-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"generate:client:metrics-namespaces": "autorest --typescript swagger/metric-namespaces.md",
"generate:client:metrics-definitions": "autorest --typescript swagger/metric-definitions.md",
"integration-test:browser": "dev-tool run test:browser",
"integration-test:node": "dev-tool run test:node-tsx-js -- --timeout 5000000 'dist-esm/test/**/*.spec.js' 'dist-esm/test/**/**/*.spec.js'",
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js' 'dist-esm/test/**/**/*.spec.js'",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json src test --format unix --ext .ts",
Expand Down
2 changes: 1 addition & 1 deletion sdk/schemaregistry/schema-registry-avro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"extract-api": "tsc -p . && api-extractor run --local",
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"integration-test:browser": "dev-tool run test:browser",
"integration-test:node": "dev-tool run test:node-js-input --use-esm-workaround=true -- --timeout 5000000 'dist-esm/test/**/*.spec.js'",
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js",
Expand Down
2 changes: 1 addition & 1 deletion sdk/web-pubsub/web-pubsub-client-protobuf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node",
"test": "npm run build:test && npm run unit-test && npm run integration-test",
"unit-test:browser": "echo skipped",
"unit-test:node": "dev-tool run test:node-js-input --use-esm-workaround=true --no-test-proxy=true",
"unit-test:node": "dev-tool run test:node-js-input --no-test-proxy=true",
"unit-test": "npm run unit-test:node && npm run unit-test:browser"
},
"files": [
Expand Down
Loading