Skip to content

Commit

Permalink
test: conversions to vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed Oct 23, 2024
1 parent 3435c99 commit 81834a5
Show file tree
Hide file tree
Showing 333 changed files with 14,678 additions and 1,218 deletions.
71 changes: 0 additions & 71 deletions clients/client-cognito-identity/karma.conf.js

This file was deleted.

3 changes: 2 additions & 1 deletion clients/client-cognito-identity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
"extract:docs": "api-extractor run --local",
"generate:client": "node ../../scripts/generate-clients/single-service --solo cognito-identity",
"test:e2e": "ts-mocha test/**/*.ispec.ts && karma start karma.conf.js"
"test:e2e": "vitest run -c vitest.config.e2e.ts",
"test:e2e:watch": "vitest watch -c vitest.config.e2e.ts"
},
"main": "./dist-cjs/index.js",
"types": "./dist-types/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
/// <reference types="mocha" />
/**
* This is the integration test that make sure the client can make request cross-platform-ly
* in NodeJS, Chromium and Firefox. This test is written in mocha.
*/
import { expect } from "chai";
import { beforeAll, describe, expect, test as it } from "vitest";

import { getIntegTestResources } from "../../../../tests/e2e/get-integ-test-resources";
import { CognitoIdentity } from "../../src/index";
// There will be default values of defaultRegion, credentials, and isBrowser variable in browser tests.
// Define the values for Node.js tests
const region: string | undefined = (globalThis as any).defaultRegion || process?.env?.AWS_SMOKE_TEST_REGION;
const IdentityPoolId =
(globalThis as any)?.window?.__env__?.AWS_SMOKE_TEST_IDENTITY_POOL_ID ||
process?.env?.AWS_SMOKE_TEST_IDENTITY_POOL_ID;

describe("@aws-sdk/client-cognito-identity", function () {
const unAuthClient = new CognitoIdentity({
region,
describe("@aws-sdk/client-cognito-identity", () => {
let unAuthClient: CognitoIdentity;
let region: string;
let IdentityPoolId: string;

beforeAll(async () => {
const integTestResourcesEnv = await getIntegTestResources();
Object.assign(process.env, integTestResourcesEnv);

region = process?.env?.AWS_SMOKE_TEST_REGION as string;
IdentityPoolId =
(globalThis as any)?.window?.__env__?.AWS_SMOKE_TEST_IDENTITY_POOL_ID ||
process?.env?.AWS_SMOKE_TEST_IDENTITY_POOL_ID;

unAuthClient = new CognitoIdentity({
region,
});
});

it("should successfully fetch Id and get credentials", async () => {
Expand Down
2 changes: 1 addition & 1 deletion clients/client-cognito-identity/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"rootDir": "src",
"useUnknownInCatchVariables": false
},
"exclude": ["test/"]
"exclude": ["test/", "vitest.*.ts"]
}
8 changes: 8 additions & 0 deletions clients/client-cognito-identity/vitest.config.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
include: ["**/*.e2e.spec.ts"],
environment: "happy-dom",
},
});
4 changes: 0 additions & 4 deletions clients/client-kinesis/jest.config.e2e.js

This file was deleted.

3 changes: 2 additions & 1 deletion clients/client-kinesis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
"extract:docs": "api-extractor run --local",
"generate:client": "node ../../scripts/generate-clients/single-service --solo kinesis",
"test:e2e": "jest --config jest.config.e2e.js"
"test:e2e": "vitest run -c vitest.config.e2e.ts",
"test:e2e:watch": "vitest watch -c vitest.config.e2e.ts"
},
"main": "./dist-cjs/index.js",
"types": "./dist-types/index.d.ts",
Expand Down
4 changes: 3 additions & 1 deletion clients/client-kinesis/test/Kinesis.e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { test as it, describe, expect } from "vitest";

import { KinesisClient, ListStreamsCommand } from "../src/index";

describe("@aws-sdk/client-kinesis", () => {
const client = new KinesisClient({});
const ONE_SECOND = 1 * 1000;

// TODO: not working in CI
xit(
it.skip(
`${ListStreamsCommand.name} should succeed`,
async () => {
const { StreamNames } = await client.send(new ListStreamsCommand({}));
Expand Down
8 changes: 8 additions & 0 deletions clients/client-kinesis/vitest.config.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
include: ["**/*.e2e.spec.ts"],
environment: "node",
},
});
5 changes: 0 additions & 5 deletions clients/client-s3/jest.config.e2e.js

This file was deleted.

74 changes: 0 additions & 74 deletions clients/client-s3/karma.conf.js

This file was deleted.

10 changes: 5 additions & 5 deletions clients/client-s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
"extract:docs": "api-extractor run --local",
"generate:client": "node ../../scripts/generate-clients/single-service --solo s3",
"test": "yarn test:unit",
"test:e2e": "yarn test:e2e:node && yarn test:e2e:browser",
"test:e2e:browser": "ts-mocha test/**/*.browser.ispec.ts && karma start karma.conf.js",
"test:e2e:node": "jest --c jest.config.e2e.js",
"test:unit": "ts-mocha test/unit/**/*.spec.ts"
"test": "vitest run",
"test:watch": "vitest watch",
"test:e2e": "vitest run -c vitest.config.e2e.ts && yarn test:browser",
"test:browser": "node ./test/browser-build/esbuild && vitest run -c vitest.config.browser.ts",
"test:e2e:watch": "vitest watch -c vitest.config.e2e.ts"
},
"main": "./dist-cjs/index.js",
"types": "./dist-types/index.d.ts",
Expand Down
Loading

0 comments on commit 81834a5

Please sign in to comment.