Skip to content

Commit

Permalink
test: remove turbo from test orchestration (#6615)
Browse files Browse the repository at this point in the history
* test: remove turbo from test orchestration

* test(client-s3): build browser bundle for test
  • Loading branch information
kuhe authored Nov 1, 2024
1 parent 2bd2350 commit 3600668
Show file tree
Hide file tree
Showing 13 changed files with 174 additions and 24 deletions.
25 changes: 23 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,27 @@ login:
sync:
make -f Makefile.private.mk sync

test-unit: build-s3-browser-bundle
npx vitest run -c vitest.config.ts
npx vitest run -c vitest.config.browser.ts
npx vitest run -c vitest.config.clients.unit.ts
npx jest -c jest.config.js

test-protocols: build-s3-browser-bundle
npx vitest run -c vitest.config.protocols.integ.ts

test-integration: build-s3-browser-bundle
npx vitest run -c vitest.config.integ.ts
npx jest -c jest.config.integ.js
make test-protocols;

test-e2e: build-s3-browser-bundle
npx vitest run -c vitest.config.e2e.ts
npx vitest run -c vitest.config.browser.e2e.ts

build-s3-browser-bundle:
node ./clients/client-s3/test/browser-build/esbuild

# removes nested node_modules folders
clean-nested:
rm -rf ./lib/*/node_modules
Expand Down Expand Up @@ -55,9 +76,9 @@ tpk:
npx turbo run build --filter='./packages/*'

# Clears the Turborepo local build cache
turbo-clean:
turbo-clean:
@read -p "Are you sure you want to delete your local cache? [y/N]: " ans && [ $${ans:-N} = y ]
@echo "\nDeleted cache folders: \n--------"
@echo "\nDeleted cache folders: \n--------"
@find . -name '.turbo' -type d -prune -print -exec rm -rf '{}' + && echo '\n'

server-protocols:
Expand Down
32 changes: 28 additions & 4 deletions clients/client-sts/test/defaultRoleAssumers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,13 @@ describe("getDefaultRoleAssumer", () => {
});

it("should use the STS client config", async () => {
const logger = console;
const logger = {
trace() {},
debug() {},
info() {},
warn() {},
error() {},
};
const region = "some-region";
const handler = new NodeHttpHandler();
const roleAssumer = getDefaultRoleAssumer({
Expand Down Expand Up @@ -152,7 +158,13 @@ describe("getDefaultRoleAssumer", () => {
});

it("should use the parent client config", async () => {
const logger = console;
const logger = {
trace() {},
debug() {},
info() {},
warn() {},
error() {},
};
const region = "some-region";
const handler = new NodeHttpHandler();
const roleAssumer = getDefaultRoleAssumer({
Expand All @@ -177,7 +189,13 @@ describe("getDefaultRoleAssumer", () => {
});

it("should not pass through an Http2 requestHandler", async () => {
const logger = console;
const logger = {
trace() {},
debug() {},
info() {},
warn() {},
error() {},
};
const region = "some-region";
const handler = new NodeHttp2Handler();
const roleAssumer = getDefaultRoleAssumer({
Expand Down Expand Up @@ -250,7 +268,13 @@ describe("getDefaultRoleAssumerWithWebIdentity", () => {
});

it("should use the STS client config", async () => {
const logger = console;
const logger = {
trace() {},
debug() {},
info() {},
warn() {},
error() {},
};
const region = "some-region";
const handler = new NodeHttpHandler();
const roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ describe("getDefaultRoleAssumer", () => {
});

it("should use the STS client config", async () => {
const logger = console;
const logger = {
trace() {},
debug() {},
info() {},
warn() {},
error() {},
};
const region = "some-region";
const handler = new NodeHttpHandler();
const roleAssumer = getDefaultRoleAssumer({
Expand Down Expand Up @@ -150,7 +156,13 @@ describe("getDefaultRoleAssumer", () => {
});

it("should use the parent client config", async () => {
const logger = console;
const logger = {
trace() {},
debug() {},
info() {},
warn() {},
error() {},
};
const region = "some-region";
const handler = new NodeHttpHandler();
const roleAssumer = getDefaultRoleAssumer({
Expand All @@ -175,7 +187,13 @@ describe("getDefaultRoleAssumer", () => {
});

it("should not pass through an Http2 requestHandler", async () => {
const logger = console;
const logger = {
trace() {},
debug() {},
info() {},
warn() {},
error() {},
};
const region = "some-region";
const handler = new NodeHttp2Handler();
const roleAssumer = getDefaultRoleAssumer({
Expand Down Expand Up @@ -248,7 +266,13 @@ describe("getDefaultRoleAssumerWithWebIdentity", () => {
});

it("should use the STS client config", async () => {
const logger = console;
const logger = {
trace() {},
debug() {},
info() {},
warn() {},
error() {},
};
const region = "some-region";
const handler = new NodeHttpHandler();
const roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({
Expand Down
4 changes: 2 additions & 2 deletions jest.config.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/
module.exports = {
projects: [
"<rootDir>/clients/*/jest.config.e2e.js",
// "<rootDir>/clients/*/jest.config.e2e.js",
// "<rootDir>/lib/*/jest.config.integ.js",
"<rootDir>/packages/*/jest.config.e2e.js",
// "<rootDir>/packages/*/jest.config.e2e.js",
// "<rootDir>/private/*/jest.config.e2e.js",
],
};
2 changes: 1 addition & 1 deletion jest.config.integ.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ module.exports = {
// "<rootDir>/clients/*/jest.config.integ.js",
// "<rootDir>/lib/*/jest.config.integ.js",
"<rootDir>/packages/*/jest.config.integ.js",
"<rootDir>/private/*/jest.config.integ.js",
// "<rootDir>/private/*/jest.config.integ.js",
],
};
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@
"local-publish": "node ./scripts/verdaccio-publish/index.js",
"test:all": "yarn build:all && jest --passWithNoTests && lerna run test --scope '@aws-sdk/{fetch-http-handler,hash-blob-browser}' && yarn test:versions && yarn test:integration",
"test:ci": "lerna run test --since origin/main",
"test:e2e": "node ./scripts/turbo test:e2e --env-mode=loose && node ./tests/canary/canary",
"test:e2e": "make test-e2e && node ./tests/canary/canary",
"test:e2e:legacy": "cucumber-js --fail-fast",
"test:e2e:legacy:preview": "./tests/e2e-legacy/preview.mjs",
"test:e2e:legacy:since:release": "./tests/e2e-legacy/since-release.mjs",
"test:functional": "jest --passWithNoTests --config tests/functional/jest.config.js && lerna run test --scope \"@aws-sdk/client-*\"",
"test:integration": "node ./scripts/turbo test:integration",
"test:integration": "make test-integration",
"test:integration:legacy": "yarn test:e2e:legacy",
"test:integration:legacy:since:release": "yarn test:e2e:legacy:since:release",
"test:protocols": "yarn build:protocols && lerna run test --scope '@aws-sdk/aws-protocoltests-*'",
"test:server-protocols": "yarn build:server-protocols && lerna run test --scope '@aws-sdk/*-server'",
"test:size": "cd scripts/benchmark-size/runner && yarn && ts-node ./cli.ts",
"test:unit": "node ./scripts/turbo test",
"test:unit": "make test-unit",
"test:versions": "jest --config tests/versions/jest.config.js tests/versions/index.spec.ts",
"update:versions:default": "node --es-module-specifier-resolution=node ./scripts/update-versions/default.mjs",
"update:versions:current": "node --es-module-specifier-resolution=node ./scripts/update-versions/current.mjs"
Expand Down
9 changes: 9 additions & 0 deletions vitest.config.browser.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
exclude: ["**/*/node_modules/**/*.spec.ts"],
include: ["**/*.browser.e2e.spec.ts"],
environment: "happy-dom",
},
});
17 changes: 17 additions & 0 deletions vitest.config.browser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
exclude: ["**/*/node_modules/**/*.spec.ts"],
include: [
"packages/util-user-agent-browser/src/index.spec.ts",
"packages/util-user-agent-browser/src/index.native.spec.ts",
"packages/credential-provider-cognito-identity/src/localStorage-inmemoryStorage.spec.ts",
"packages/body-checksum-browser/src/index.spec.ts",
"packages/middleware-websocket/src/get-event-signing-stream.spec.ts",
"packages/middleware-websocket/src/EventStreamPayloadHandler.spec.ts",
"packages/credential-provider-cognito-identity/src/localStorage.spec.ts",
],
environment: "happy-dom",
},
});
9 changes: 9 additions & 0 deletions vitest.config.clients.unit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
exclude: ["**/*/node_modules/**/*.spec.ts", "**/*.{integ,e2e,browser}.spec.ts"],
include: ["clients/client-*/**/*.spec.ts"],
environment: "node",
},
});
4 changes: 2 additions & 2 deletions vitest.config.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
exclude: ["node_modules", "**/*.browser.e2e.spec.ts"],
include: ["**/*.e2e.spec.ts"],
exclude: ["**/*/node_modules/**/*.spec.ts", "**/*.browser.e2e.spec.ts"],
include: ["clients/**/*.e2e.spec.ts", "lib/**/*.e2e.spec.ts", "packages/**/*.e2e.spec.ts"],
environment: "node",
},
});
7 changes: 6 additions & 1 deletion vitest.config.integ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
exclude: ["node_modules", "**/*.{e2e,browser}.spec.ts"],
exclude: [
"**/*/node_modules/**/*.spec.ts",
"**/*.{e2e,browser}.spec.ts",
"packages/credential-providers/src/fromSSO.integ.spec.ts",
"packages/credential-provider-node/src/credential-provider-node.integ.spec.ts",
],
include: ["{clients,lib,packages,private}/**/*.integ.spec.ts"],
environment: "node",
},
Expand Down
15 changes: 15 additions & 0 deletions vitest.config.protocols.integ.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
exclude: [
"**/*/node_modules/**/*.spec.ts",
"**/*.{integ,e2e,browser}.spec.ts",
"private/aws-restjson-server/**/*.spec.ts",
"private/aws-restjson-validation-server/**/*.spec.ts",
],
include: ["private/**/*.spec.ts"],
environment: "node",
globals: true,
},
});
36 changes: 31 additions & 5 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
import { defineConfig } from "vitest/config";

/**
* AWS SDK for JavaScript test classifications:
*
* Unit tests are test scenarios that exercise a single functionality.
* Ideally, all modules other than the one being tested should be mocked.
* However, pragmiatically speaking this isn't always the case.
* Unit tests never communicate with AWS services.
*
* Integration tests involve minimal mocking and test multiple modules
* in concert. The test should use the public interfaces of our modules.
* Integration tests never communicate with AWS services.
*
* E2E tests use only the public interfaces of our code and do
* communicate with AWS services. No mocking is done for E2E tests.
* The tests run with cucumber-js are
* now considered E2E tests in this classification system.
*
* Browser tests are a separate category, require alternate configuration,
* and may be classified as unit or e2e tests.
*/
export default defineConfig({
test: {
exclude: [
"node_modules",
"**/*/node_modules/**/*.spec.ts",
"**/*.{integ,e2e,browser}.spec.ts",
"private/aws-restjson-server/**/*.spec.ts",
"private/aws-restjson-validation-server/**/*.spec.ts",
"packages/signature-v4-crt/**/*.spec.ts",
"packages/types/**/*.ts",
"packages/util-user-agent-browser/src/index.spec.ts",
"packages/util-user-agent-browser/src/index.native.spec.ts",
"packages/credential-provider-cognito-identity/src/localStorage-inmemoryStorage.spec.ts",
"packages/body-checksum-browser/src/index.spec.ts",
"packages/middleware-websocket/src/get-event-signing-stream.spec.ts",
"packages/middleware-websocket/src/EventStreamPayloadHandler.spec.ts",
"packages/credential-provider-cognito-identity/src/localStorage.spec.ts",
],
include: ["clients/client-*/**/*.spec.ts", "lib/**/*.spec.ts", "packages/**/*.spec.ts", "private/**/*.spec.ts"],
include: ["lib/**/*.spec.ts", "packages/**/*.spec.ts"],
environment: "node",
globals: true,
},
});

0 comments on commit 3600668

Please sign in to comment.