Skip to content

Commit

Permalink
upgrade version for test-recorder and test-credential && support RECO…
Browse files Browse the repository at this point in the history
…RDINGS_RELATIVE_PATH in vitest.browser.config.ts (#2528)

* upgrade version for esm

* update

* update

* update

* update

* update
  • Loading branch information
kazrael2119 committed Jun 13, 2024
1 parent ed17e14 commit 43d8054
Show file tree
Hide file tree
Showing 73 changed files with 178 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
"mkdirp": "^3.0.1",
"typescript": "~5.4.5",
"@azure/core-util": "^1.0.0",
"@azure-tools/test-credential": "^1.1.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"autorest": "latest",
"@azure-tools/test-credential": "^1.1.0",
"@azure-tools/test-recorder": "^3.0.0",
"nyc": "^15.1.0",
"mocha": "^10.0.0",
"@types/mocha": "^10.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
"mkdirp": "^3.0.1",
"typescript": "~5.4.5",
"@azure/core-util": "^1.0.0",
"@azure-tools/test-credential": "^1.1.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"autorest": "latest",
"@azure-tools/test-credential": "^1.1.0",
"@azure-tools/test-recorder": "^3.0.0",
"nyc": "^15.1.0",
"mocha": "^10.0.0",
"@types/mocha": "^10.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
"mkdirp": "^3.0.1",
"typescript": "~5.4.5",
"@azure/core-util": "^1.0.0",
"@azure-tools/test-credential": "^1.1.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"autorest": "latest",
"@azure-tools/test-credential": "^1.1.0",
"@azure-tools/test-recorder": "^3.0.0",
"nyc": "^15.1.0",
"mocha": "^10.0.0",
"@types/mocha": "^10.0.0",
Expand Down
9 changes: 8 additions & 1 deletion packages/rlc-common/src/metadata/buildVitestConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ const nodeConfig = `export default defineConfig({

const browserConfig = (options: {
isAzureSdkForJs: boolean;
}) => `export default defineConfig({
}) => `process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();
export default defineConfig({
"define": {
"process.env": process.env
},
Expand Down Expand Up @@ -103,6 +105,11 @@ export function buildVitestConfig(
namedImports: ["defineConfig"]
});

configFile.addImportDeclaration({
moduleSpecifier: "@azure-tools/test-recorder",
namedImports: ["relativeRecordingsPath"]
});

return {
path: filePath,
content: configFile.getFullText()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ function getAzurePackageCjsDevDependencies({
return {};
}
const testDevDependencies = {
"@azure-tools/test-credential": "^1.1.0",
"@azure-tools/test-recorder": "^3.0.0",
nyc: "^15.1.0",
mocha: "^10.0.0",
"@types/mocha": "^10.0.0",
Expand Down Expand Up @@ -140,7 +142,9 @@ function getAzurePackageEsmDevDependencies({
"@vitest/browser": "^1.3.1",
"@vitest/coverage-istanbul": "^1.3.1",
playwright: "^1.41.2",
vitest: "^1.3.1"
vitest: "^1.3.1",
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.0.0"
};
}

Expand All @@ -153,9 +157,7 @@ export function getAzurePackageDevDependencies(config: AzurePackageInfoConfig) {

const testDevDependencies = {
"@azure/core-util": "^1.0.0",
"@azure-tools/test-credential": "^1.1.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0"
"@azure/identity": "^4.0.1"
};

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ function getEsmScripts({ moduleKind }: AzureMonorepoInfoConfig) {
"npm run clean && tshy && npm run unit-test:node && npm run integration-test:node",
test: "npm run clean && tshy && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test",
"unit-test:browser":
"npm run build:test && dev-tool run test:vitest --no-test-proxy --browser",
"unit-test:node": "dev-tool run test:vitest --no-test-proxy"
"npm run build:test && dev-tool run test:vitest --browser",
"unit-test:node": "dev-tool run test:vitest"
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/rlc-common/test/integration/packageJson.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,11 @@ describe("Package file generation", () => {
);
expect(packageFile.scripts).to.have.property(
"unit-test:browser",
"npm run build:test && dev-tool run test:vitest --no-test-proxy --browser"
"npm run build:test && dev-tool run test:vitest --browser"
);
expect(packageFile.scripts).to.have.property(
"unit-test:node",
"dev-tool run test:vitest --no-test-proxy"
"dev-tool run test:vitest"
);
expect(packageFile.scripts).to.have.property(
"clean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@
"typescript": "~5.4.5",
"tshy": "1.11.1",
"@azure/core-util": "^1.0.0",
"@azure-tools/test-credential": "^1.1.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"@vitest/browser": "^1.3.1",
"@vitest/coverage-istanbul": "^1.3.1",
"playwright": "^1.41.2",
"vitest": "^1.3.1"
"vitest": "^1.3.1",
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.0.0"
},
"scripts": {
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();

export default defineConfig({
define: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

export default defineConfig({
test: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@
"typescript": "~5.4.5",
"tshy": "1.11.1",
"@azure/core-util": "^1.0.0",
"@azure-tools/test-credential": "^1.1.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"@vitest/browser": "^1.3.1",
"@vitest/coverage-istanbul": "^1.3.1",
"playwright": "^1.41.2",
"vitest": "^1.3.1"
"vitest": "^1.3.1",
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.0.0"
},
"scripts": {
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();

export default defineConfig({
define: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

export default defineConfig({
test: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@
"typescript": "~5.4.5",
"tshy": "1.11.1",
"@azure/core-util": "^1.0.0",
"@azure-tools/test-credential": "^1.1.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"@vitest/browser": "^1.3.1",
"@vitest/coverage-istanbul": "^1.3.1",
"playwright": "^1.41.2",
"vitest": "^1.3.1"
"vitest": "^1.3.1",
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.0.0"
},
"scripts": {
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();

export default defineConfig({
define: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

export default defineConfig({
test: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@
"typescript": "~5.4.5",
"tshy": "1.11.1",
"@azure/core-util": "^1.0.0",
"@azure-tools/test-credential": "^1.1.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"@vitest/browser": "^1.3.1",
"@vitest/coverage-istanbul": "^1.3.1",
"playwright": "^1.41.2",
"vitest": "^1.3.1"
"vitest": "^1.3.1",
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.0.0"
},
"scripts": {
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();

export default defineConfig({
define: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

export default defineConfig({
test: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@
"typescript": "~5.4.5",
"tshy": "1.11.1",
"@azure/core-util": "^1.0.0",
"@azure-tools/test-credential": "^1.1.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"@vitest/browser": "^1.3.1",
"@vitest/coverage-istanbul": "^1.3.1",
"playwright": "^1.41.2",
"vitest": "^1.3.1"
"vitest": "^1.3.1",
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.0.0"
},
"scripts": {
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();

export default defineConfig({
define: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

export default defineConfig({
test: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@
"typescript": "~5.4.5",
"tshy": "1.11.1",
"@azure/core-util": "^1.0.0",
"@azure-tools/test-credential": "^1.1.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"@vitest/browser": "^1.3.1",
"@vitest/coverage-istanbul": "^1.3.1",
"playwright": "^1.41.2",
"vitest": "^1.3.1"
"vitest": "^1.3.1",
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.0.0"
},
"scripts": {
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();

export default defineConfig({
define: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

export default defineConfig({
test: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
"typescript": "~5.4.5",
"tshy": "1.11.1",
"@azure/core-util": "^1.0.0",
"@azure-tools/test-credential": "^1.1.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"@vitest/browser": "^1.3.1",
"@vitest/coverage-istanbul": "^1.3.1",
"playwright": "^1.41.2",
"vitest": "^1.3.1"
"vitest": "^1.3.1",
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.0.0"
},
"scripts": {
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();

export default defineConfig({
define: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

export default defineConfig({
test: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@
"typescript": "~5.4.5",
"tshy": "1.11.1",
"@azure/core-util": "^1.0.0",
"@azure-tools/test-credential": "^1.1.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"@vitest/browser": "^1.3.1",
"@vitest/coverage-istanbul": "^1.3.1",
"playwright": "^1.41.2",
"vitest": "^1.3.1"
"vitest": "^1.3.1",
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.0.0"
},
"scripts": {
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();

export default defineConfig({
define: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license.

import { defineConfig } from "vitest/config";
import { relativeRecordingsPath } from "@azure-tools/test-recorder";

export default defineConfig({
test: {
Expand Down
Loading

0 comments on commit 43d8054

Please sign in to comment.