From 52f81e15e81a98b2c1585ad3f4f1bf9725e4f892 Mon Sep 17 00:00:00 2001 From: Nikola Hristov Date: Sat, 23 Nov 2024 22:28:10 +0200 Subject: [PATCH] --- example/functions/src/api.ts | 1 + example/functions/src/ssr.ts | 4 ++-- example/infrastructure/src/index.ts | 10 +++++----- .../js/@llrt/expect/jest-asymmetric-matchers.ts | 6 +++--- llrt_core/src/modules/js/@llrt/expect/jest-expect.ts | 5 ++--- llrt_core/src/modules/js/@llrt/expect/jest-utils.ts | 1 - llrt_core/src/modules/js/@llrt/expect/stringify.ts | 2 +- llrt_core/src/modules/js/@llrt/test.ts | 1 + tests/e2e/dynamodb.e2e.test.ts | 8 ++++---- tests/unit/compile.test.ts | 2 +- tests/unit/fs.test.ts | 2 +- tests/unit/xml.test.ts | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/example/functions/src/api.ts b/example/functions/src/api.ts index 30c3dd92d0..e66909441f 100644 --- a/example/functions/src/api.ts +++ b/example/functions/src/api.ts @@ -7,6 +7,7 @@ import { ScanCommand, UpdateCommand, } from "@aws-sdk/lib-dynamodb"; + import type { Todo } from "./react/TodoList"; const uid = () => diff --git a/example/functions/src/ssr.ts b/example/functions/src/ssr.ts index d2429bb651..8e58e5b8c6 100644 --- a/example/functions/src/ssr.ts +++ b/example/functions/src/ssr.ts @@ -1,9 +1,9 @@ import fs from "fs/promises"; +import React from "react"; import ReactDOMServer from "react-dom/server"; -import App from "./react/App"; -import React from "react"; import API from "./api"; +import App from "./react/App"; type Method = "GET" | "POST" | "PUT" | "DELETE"; diff --git a/example/infrastructure/src/index.ts b/example/infrastructure/src/index.ts index cfc41935e1..2a24146668 100644 --- a/example/infrastructure/src/index.ts +++ b/example/infrastructure/src/index.ts @@ -1,12 +1,9 @@ import { execSync } from "child_process"; +import * as fs from "fs/promises"; import os from "os"; import path from "path"; import { App, - CfnOutput, - Duration, - Fn, - Stack, aws_apigatewayv2, aws_apigatewayv2_integrations, aws_cloudfront, @@ -17,8 +14,11 @@ import { aws_lambda_nodejs, aws_logs, aws_s3, + CfnOutput, + Duration, + Fn, + Stack, } from "aws-cdk-lib"; -import * as fs from "fs/promises"; const main = async () => { execSync("node build.mjs", { diff --git a/llrt_core/src/modules/js/@llrt/expect/jest-asymmetric-matchers.ts b/llrt_core/src/modules/js/@llrt/expect/jest-asymmetric-matchers.ts index b6e9a7bad9..f6761f421d 100644 --- a/llrt_core/src/modules/js/@llrt/expect/jest-asymmetric-matchers.ts +++ b/llrt_core/src/modules/js/@llrt/expect/jest-asymmetric-matchers.ts @@ -1,3 +1,6 @@ +import { equals, isA, pluralize } from "./jest-utils"; +import { stringify } from "./stringify"; + /* MIT License @@ -27,9 +30,6 @@ SOFTWARE. import ChaiPlugin = Chai.ChaiPlugin; -import { equals, isA, pluralize } from "./jest-utils"; -import { stringify } from "./stringify"; - export interface AsymmetricMatcherInterface { asymmetricMatch: (other: unknown) => boolean; toString: () => string; diff --git a/llrt_core/src/modules/js/@llrt/expect/jest-expect.ts b/llrt_core/src/modules/js/@llrt/expect/jest-expect.ts index 1377584bd8..4c58f32c96 100644 --- a/llrt_core/src/modules/js/@llrt/expect/jest-expect.ts +++ b/llrt_core/src/modules/js/@llrt/expect/jest-expect.ts @@ -25,6 +25,7 @@ SOFTWARE. // Extracted and modified from Vitest: https://github.com/vitest-dev/vitest/blob/a199ac2dd1322d7839d4d1350c983070da546805/packages/expect/src/jest-expect.ts +import type { AsymmetricMatcher } from "./jest-asymmetric-matchers"; import { arrayBufferEquality, generateToBeMessage, @@ -34,9 +35,9 @@ import { subsetEquality, typeEquality, } from "./jest-utils"; + import ChaiPlugin = Chai.ChaiPlugin; import Assertion = Chai.Assertion; -import type { AsymmetricMatcher } from "./jest-asymmetric-matchers"; // Jest Expect Compact export const JestChaiExpect: ChaiPlugin = (chai, utils) => { @@ -61,7 +62,6 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => { }; if (Array.isArray(name)) name.forEach((n) => addMethod(n)); - else addMethod(name); } @@ -211,7 +211,6 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => { }); def("toMatch", function (expected: string | RegExp) { if (typeof expected === "string") return this.include(expected); - else return this.match(expected); }); def("toContain", function (item) { diff --git a/llrt_core/src/modules/js/@llrt/expect/jest-utils.ts b/llrt_core/src/modules/js/@llrt/expect/jest-utils.ts index e30ccc2e34..13fd790b8b 100644 --- a/llrt_core/src/modules/js/@llrt/expect/jest-utils.ts +++ b/llrt_core/src/modules/js/@llrt/expect/jest-utils.ts @@ -173,7 +173,6 @@ function eq( // circular references at same depth are equal // circular reference is not equal to non-circular one if (aStack[length] === a) return bStack[length] === b; - else if (bStack[length] === b) return false; } // Add the first object to the stack of traversed objects. diff --git a/llrt_core/src/modules/js/@llrt/expect/stringify.ts b/llrt_core/src/modules/js/@llrt/expect/stringify.ts index ad830e3a21..9d2c578f3d 100644 --- a/llrt_core/src/modules/js/@llrt/expect/stringify.ts +++ b/llrt_core/src/modules/js/@llrt/expect/stringify.ts @@ -25,10 +25,10 @@ SOFTWARE. // Extracted and modified from Vitest: https://github.com/vitest-dev/vitest/blob/0f86ff98975a80191d6215b0d30ff6cd9f8388d3/packages/utils/src/stringify.ts -import type { PrettyFormatOptions } from "pretty-format"; import { format as prettyFormat, plugins as prettyFormatPlugins, + type PrettyFormatOptions, } from "pretty-format"; const { diff --git a/llrt_core/src/modules/js/@llrt/test.ts b/llrt_core/src/modules/js/@llrt/test.ts index 97f7bd4650..6663ac3ac7 100644 --- a/llrt_core/src/modules/js/@llrt/test.ts +++ b/llrt_core/src/modules/js/@llrt/test.ts @@ -1,6 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import * as chai from "chai"; + import { JestAsymmetricMatchers } from "./expect/jest-asymmetric-matchers"; import { JestChaiExpect } from "./expect/jest-expect"; diff --git a/tests/e2e/dynamodb.e2e.test.ts b/tests/e2e/dynamodb.e2e.test.ts index 9a1dd23901..67de06b9b4 100644 --- a/tests/e2e/dynamodb.e2e.test.ts +++ b/tests/e2e/dynamodb.e2e.test.ts @@ -2,22 +2,22 @@ import { BillingMode, + DynamoDB, + waitUntilTableExists, type CreateTableCommandOutput, type DeleteItemCommandOutput, type DescribeTableCommandOutput, - DynamoDB, type GetItemCommandOutput, - waitUntilTableExists, } from "@aws-sdk/client-dynamodb"; import { + DynamoDBDocument, + NumberValue, type BatchExecuteStatementCommandOutput, type BatchGetCommandOutput, type BatchWriteCommandOutput, - DynamoDBDocument, type ExecuteStatementCommandOutput, type ExecuteTransactionCommandOutput, type GetCommandOutput, - NumberValue, type PutCommandOutput, type QueryCommandOutput, type ScanCommandOutput, diff --git a/tests/unit/compile.test.ts b/tests/unit/compile.test.ts index 5fd1ae8fde..06a2c96189 100644 --- a/tests/unit/compile.test.ts +++ b/tests/unit/compile.test.ts @@ -1,6 +1,6 @@ import { spawn } from "child_process"; -import { tmpdir } from "os"; import fs from "fs/promises"; +import { tmpdir } from "os"; const spawnCapture = async (cmd: string, args: string[]) => { const child = spawn(cmd, args); diff --git a/tests/unit/fs.test.ts b/tests/unit/fs.test.ts index db457e3427..572d07f2f7 100644 --- a/tests/unit/fs.test.ts +++ b/tests/unit/fs.test.ts @@ -1,8 +1,8 @@ import defaultFsImport from "fs"; import * as namedFsImport from "fs"; +import fs from "fs/promises"; import os from "os"; import path from "path"; -import fs from "fs/promises"; describe("readdir", () => { it("should read a directory", async () => { diff --git a/tests/unit/xml.test.ts b/tests/unit/xml.test.ts index e08653d968..1343f5e835 100644 --- a/tests/unit/xml.test.ts +++ b/tests/unit/xml.test.ts @@ -1,4 +1,4 @@ -import { XMLParser, XmlNode, XmlText } from "llrt:xml"; +import { XmlNode, XMLParser, XmlText } from "llrt:xml"; describe("XMLParser options and handling", () => { it("should parse xml", () => {