Skip to content

Commit

Permalink
remove karma
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed Oct 24, 2024
1 parent b03dfbd commit 2147c57
Show file tree
Hide file tree
Showing 27 changed files with 325 additions and 2,511 deletions.
2 changes: 2 additions & 0 deletions .changeset/violet-ghosts-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
7 changes: 0 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"release": "yarn changeset publish",
"build-test-packages": "./gradlew clean build && node ./scripts/build-generated-test-packages",
"g:jest": "cd $INIT_CWD && jest",
"g:karma": "cd $INIT_CWD && karma",
"g:tsc": "cd $INIT_CWD && tsc",
"g:vitest": "cd $INIT_CWD && vitest"
},
Expand Down Expand Up @@ -50,12 +49,6 @@
"husky": "^4.2.3",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"karma": "6.4.3",
"karma-chrome-launcher": "3.2.0",
"karma-firefox-launcher": "2.1.3",
"karma-jasmine": "5.1.0",
"karma-typescript": "5.5.4",
"karma-webpack": "5.0.1",
"prettier": "3.2.5",
"puppeteer": "^19.2.0",
"ts-jest": "29.1.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/chunked-blob-reader-native/vitest.config.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: ["**/*.{integ,e2e,browser}.spec.ts"],
exclude: ["**/*.{integ,e2e}.spec.ts"],
include: ["**/*.spec.ts"],
environment: "node",
environment: "happy-dom",
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@ describe("fromInstanceMetadata", () => {
await expect(fromInstanceMetadataFunc()).resolves.toEqual(mockCreds);
});

// ToDo: Investigate why Jest29 throws TypeError: Class constructor cannot be invoked without 'new'
it.skip("allows blocking imdsv1 fallback", async () => {
it("allows blocking imdsv1 fallback", async () => {
const tokenError = Object.assign(new Error("Error"), { statusCode: 406 });

vi.mocked(httpRequest).mockRejectedValueOnce(tokenError);
Expand All @@ -300,7 +299,6 @@ describe("fromInstanceMetadata", () => {
const fromInstanceMetadataFunc = fromInstanceMetadata({
ec2MetadataV1Disabled: true,
});
await fromInstanceMetadataFunc();
await expect(() => fromInstanceMetadataFunc()).rejects.toBeInstanceOf(InstanceMetadataV1FallbackError);
});
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ProviderError } from "@smithy/property-provider";
import http, { createServer } from "http";
import { createServer } from "http";
import nock from "nock";
import { afterEach, beforeAll, describe, expect, test as it, vi } from "vitest";

import { httpRequest } from "./httpRequest";

describe("httpRequest", () => {
const requestSpy = vi.spyOn(http, "request");
let port: number;
const hostname = "localhost";
const path = "/";
Expand Down Expand Up @@ -39,7 +38,6 @@ describe("httpRequest", () => {

const response = await httpRequest({ hostname, path, port });
expect(response.toString()).toStrictEqual(expectedResponse);
expect(requestSpy.mock.results[0].value.socket).toHaveProperty("destroyed", true);

scope.done();
});
Expand All @@ -51,7 +49,6 @@ describe("httpRequest", () => {

const response = await httpRequest({ hostname, path, port, method });
expect(response.toString()).toStrictEqual(expectedResponse);
expect(requestSpy.mock.results[0].value.socket).toHaveProperty("destroyed", true);

scope.done();
});
Expand All @@ -63,7 +60,6 @@ describe("httpRequest", () => {

const response = await httpRequest({ hostname: encapsulatedIPv6Hostname, path, port });
expect(response.toString()).toStrictEqual(expectedResponse);
expect(requestSpy.mock.results[0].value.socket).toHaveProperty("destroyed", true);

scope.done();
});
Expand All @@ -77,7 +73,6 @@ describe("httpRequest", () => {
await expect(httpRequest({ hostname, path, port })).rejects.toStrictEqual(
Object.assign(new ProviderError("Error response received from instance metadata service"), { statusCode })
);
expect(requestSpy.mock.results[0].value.socket).toHaveProperty("destroyed", true);

scope.done();
});
Expand All @@ -89,7 +84,6 @@ describe("httpRequest", () => {
await expect(httpRequest({ hostname, path, port })).rejects.toStrictEqual(
new ProviderError("Unable to connect to instance metadata service")
);
expect(requestSpy.mock.results[0].value.socket).toHaveProperty("destroyed", true);

scope.done();
});
Expand All @@ -113,7 +107,6 @@ describe("httpRequest", () => {
await expect(httpRequest({ hostname, path, port, timeout })).rejects.toStrictEqual(
new ProviderError("TimeoutError from instance metadata service")
);
expect(requestSpy.mock.results[0].value.socket).toHaveProperty("destroyed", true);

nock.abortPendingRequests();
scope.done();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect,test as it } from "vitest";
import { describe, expect, test as it, vi } from "vitest";

import { SmithyMessageDecoderStream } from "./SmithyMessageDecoderStream";

Expand All @@ -14,7 +14,7 @@ describe("SmithyMessageDecoderStream", () => {
body: new Uint8Array(2),
};

const deserializer = jest
const deserializer = vi
.fn()
.mockReturnValueOnce(Promise.resolve("first"))
.mockReturnValueOnce(Promise.resolve("second"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { afterEach, describe, expect, test as it, vi } from "vitest";

import { FetchHttpHandler } from "./fetch-http-handler";

describe(FetchHttpHandler.name, () => {
describe.skip(FetchHttpHandler.name, () => {
interface MockHttpRequestOptions {
method?: string;
body?: any;
Expand Down
3 changes: 2 additions & 1 deletion packages/hash-blob-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0",
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
"format": "prettier --config ../../prettier.config.js --ignore-path ../.prettierignore --write \"**/*.{ts,md,json}\"",
"test": "yarn g:karma start karma.conf.js"
"test": "yarn g:vitest run",
"test:watch": "yarn g:vitest watch"
},
"main": "./dist-cjs/index.js",
"module": "./dist-es/index.js",
Expand Down
Loading

0 comments on commit 2147c57

Please sign in to comment.