((res) => {
6 | const ws = new WebSocket(
7 | "wss://ws-ap1.pusher.com:443/app/78a7f9604f977d235435",
8 | );
9 | ws.onopen = () => res();
10 | });
11 | return (
12 | <>
13 | server: success
14 |
15 | >
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/test/next/tests/default.spec.ts:
--------------------------------------------------------------------------------
1 | import { expect, test } from "@playwright/test";
2 |
3 | test("default", async ({ page }) => {
4 | await page.goto("http://localhost:3000/");
5 | await expect(page.getByText("server: success")).toBeVisible();
6 | await expect(page.getByText("client: success")).toBeVisible();
7 | });
8 |
--------------------------------------------------------------------------------
/test/next/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "noEmit": true,
9 | "esModuleInterop": true,
10 | "module": "esnext",
11 | "moduleResolution": "bundler",
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "jsx": "preserve",
15 | "incremental": true,
16 | "plugins": [
17 | {
18 | "name": "next"
19 | }
20 | ],
21 | "paths": {
22 | "@/*": ["./src/*"]
23 | }
24 | },
25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
26 | "exclude": ["node_modules"]
27 | }
28 |
--------------------------------------------------------------------------------
/test/node/index.js:
--------------------------------------------------------------------------------
1 | const { WebSocket } = require("isows");
2 |
3 | const ws = new WebSocket(
4 | "wss://ws-ap1.pusher.com:443/app/78a7f9604f977d235435",
5 | );
6 | ws.onopen = () => process.exit(0);
7 |
--------------------------------------------------------------------------------
/test/node/index.mjs:
--------------------------------------------------------------------------------
1 | import { WebSocket } from "isows";
2 |
3 | const ws = new WebSocket(
4 | "wss://ws-ap1.pusher.com:443/app/78a7f9604f977d235435",
5 | );
6 | ws.onopen = () => process.exit(0);
7 |
--------------------------------------------------------------------------------
/test/node/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test-node",
3 | "private": true,
4 | "scripts": {
5 | "test": "node index.js && node index.mjs"
6 | },
7 | "dependencies": {
8 | "isows": "file:../../src/"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/sveltekit/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /build
4 | /.svelte-kit
5 | /package
6 | .env
7 | .env.*
8 | !.env.example
9 | vite.config.js.timestamp-*
10 | vite.config.ts.timestamp-*
11 |
12 | .vercel
13 |
--------------------------------------------------------------------------------
/test/sveltekit/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test-sveltekit",
3 | "private": true,
4 | "type": "module",
5 | "scripts": {
6 | "dev": "vite dev",
7 | "build": "vite build",
8 | "preview": "vite preview",
9 | "test": "playwright test"
10 | },
11 | "dependencies": {
12 | "isows": "file:../../src/"
13 | },
14 | "devDependencies": {
15 | "@playwright/test": "1.52.0",
16 | "@sveltejs/adapter-vercel": "^3.0.3",
17 | "@sveltejs/kit": "^1.20.4",
18 | "isows": "^1.0.7",
19 | "svelte": "^4.0.5",
20 | "svelte-check": "^3.4.3",
21 | "tslib": "^2.4.1",
22 | "typescript": "^5.2.2",
23 | "vite": "^4.4.2"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/test/sveltekit/playwright.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig, devices } from "@playwright/test";
2 |
3 | /**
4 | * Read environment variables from file.
5 | * https://github.com/motdotla/dotenv
6 | */
7 | // require('dotenv').config();
8 |
9 | /**
10 | * See https://playwright.dev/docs/test-configuration.
11 | */
12 | export default defineConfig({
13 | testDir: "./tests",
14 | retries: 3,
15 | projects: [
16 | {
17 | name: "chromium",
18 | use: { ...devices["Desktop Chrome"] },
19 | },
20 |
21 | {
22 | name: "firefox",
23 | use: { ...devices["Desktop Firefox"] },
24 | },
25 |
26 | {
27 | name: "webkit",
28 | use: { ...devices["Desktop Safari"] },
29 | },
30 | ],
31 | webServer: {
32 | command: "bun run build && bun run preview",
33 | port: 4173,
34 | },
35 | });
36 |
--------------------------------------------------------------------------------
/test/sveltekit/src/app.d.ts:
--------------------------------------------------------------------------------
1 | // See https://kit.svelte.dev/docs/types#app
2 | // for information about these interfaces
3 | declare global {
4 | namespace App {
5 | // interface Error {}
6 | // interface Locals {}
7 | // interface PageData {}
8 | // interface Platform {}
9 | }
10 | }
11 |
12 | export type {};
13 |
--------------------------------------------------------------------------------
/test/sveltekit/src/app.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | %sveltekit.head%
8 |
9 |
10 | %sveltekit.body%
11 |
12 |
13 |
--------------------------------------------------------------------------------
/test/sveltekit/src/routes/+page.svelte:
--------------------------------------------------------------------------------
1 |
14 |
15 | server: success
16 |
17 | {#await promise}
18 | Loading...
19 | {:then blockNumber}
20 | client: success
21 | {:catch error}
22 | Error: {error.message}.
23 | {/await}
24 |
--------------------------------------------------------------------------------
/test/sveltekit/src/routes/+page.ts:
--------------------------------------------------------------------------------
1 | import { WebSocket } from "isows";
2 |
3 | export async function load() {
4 | await new Promise((res) => {
5 | const ws = new WebSocket(
6 | "wss://ws-ap1.pusher.com:443/app/78a7f9604f977d235435",
7 | );
8 | ws.onopen = () => res();
9 | });
10 |
11 | return {
12 | success: true,
13 | };
14 | }
15 |
--------------------------------------------------------------------------------
/test/sveltekit/src/routes/edge/+page.svelte:
--------------------------------------------------------------------------------
1 |
4 |
5 | server: success {data.success}
--------------------------------------------------------------------------------
/test/sveltekit/src/routes/edge/+page.ts:
--------------------------------------------------------------------------------
1 | import { WebSocket } from "isows";
2 |
3 | export const config = {
4 | runtime: "edge",
5 | };
6 |
7 | export async function load() {
8 | await new Promise((res) => {
9 | const ws = new WebSocket(
10 | "wss://ws-ap1.pusher.com:443/app/78a7f9604f977d235435",
11 | );
12 | ws.onopen = () => res();
13 | });
14 |
15 | return {
16 | success: true,
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/test/sveltekit/src/routes/node16/+page.svelte:
--------------------------------------------------------------------------------
1 |
4 |
5 | server: success {data.success}
--------------------------------------------------------------------------------
/test/sveltekit/src/routes/node16/+page.ts:
--------------------------------------------------------------------------------
1 | import { WebSocket } from "isows";
2 |
3 | export const config = {
4 | runtime: "nodejs16.x",
5 | };
6 |
7 | export async function load() {
8 | await new Promise((res) => {
9 | const ws = new WebSocket(
10 | "wss://ws-ap1.pusher.com:443/app/78a7f9604f977d235435",
11 | );
12 | ws.onopen = () => res();
13 | });
14 |
15 | return {
16 | success: true,
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/test/sveltekit/src/routes/node18/+page.svelte:
--------------------------------------------------------------------------------
1 |
4 |
5 | server: success {data.success}
--------------------------------------------------------------------------------
/test/sveltekit/src/routes/node18/+page.ts:
--------------------------------------------------------------------------------
1 | import { WebSocket } from "isows";
2 |
3 | export const config = {
4 | runtime: "nodejs18.x",
5 | };
6 |
7 | export async function load() {
8 | await new Promise((res) => {
9 | const ws = new WebSocket(
10 | "wss://ws-ap1.pusher.com:443/app/78a7f9604f977d235435",
11 | );
12 | ws.onopen = () => res();
13 | });
14 |
15 | return {
16 | success: true,
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/test/sveltekit/static/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wevm/isows/871b9251a89b422002c65d070bce8be12fb3d6d4/test/sveltekit/static/favicon.png
--------------------------------------------------------------------------------
/test/sveltekit/svelte.config.js:
--------------------------------------------------------------------------------
1 | import adapter from "@sveltejs/adapter-vercel";
2 | import { vitePreprocess } from "@sveltejs/kit/vite";
3 |
4 | /** @type {import('@sveltejs/kit').Config} */
5 | const config = {
6 | // Consult https://kit.svelte.dev/docs/integrations#preprocessors
7 | // for more information about preprocessors
8 | preprocess: vitePreprocess(),
9 |
10 | kit: {
11 | // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
12 | // If your environment is not supported or you settled on a specific environment, switch out the adapter.
13 | // See https://kit.svelte.dev/docs/adapters for more information about adapters.
14 | adapter: adapter(),
15 | },
16 | };
17 |
18 | export default config;
19 |
--------------------------------------------------------------------------------
/test/sveltekit/tests/default.spec.ts:
--------------------------------------------------------------------------------
1 | import { expect, test } from "@playwright/test";
2 |
3 | test("default", async ({ page }) => {
4 | await page.goto("http://localhost:4173/");
5 | await expect(page.getByText("server: success")).toBeVisible();
6 | await expect(page.getByText("client: success")).toBeVisible();
7 | });
8 |
--------------------------------------------------------------------------------
/test/sveltekit/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./.svelte-kit/tsconfig.json",
3 | "compilerOptions": {
4 | "allowJs": true,
5 | "checkJs": true,
6 | "esModuleInterop": true,
7 | "forceConsistentCasingInFileNames": true,
8 | "resolveJsonModule": true,
9 | "skipLibCheck": true,
10 | "sourceMap": true,
11 | "strict": true
12 | }
13 | // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
14 | //
15 | // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
16 | // from the referenced tsconfig.json - TypeScript does not merge them in
17 | }
18 |
--------------------------------------------------------------------------------
/test/sveltekit/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { sveltekit } from "@sveltejs/kit/vite";
2 | import { defineConfig } from "vite";
3 |
4 | export default defineConfig({
5 | plugins: [sveltekit()],
6 | });
7 |
--------------------------------------------------------------------------------
/test/tsc/.gitignore:
--------------------------------------------------------------------------------
1 | dist
2 | node_modules
--------------------------------------------------------------------------------
/test/tsc/index.ts:
--------------------------------------------------------------------------------
1 | import { WebSocket } from "isows";
2 |
3 | const ws = new WebSocket(
4 | "wss://ws-ap1.pusher.com:443/app/78a7f9604f977d235435",
5 | );
6 | ws.onopen = () => process.exit(0);
7 |
--------------------------------------------------------------------------------
/test/tsc/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test-tsc",
3 | "private": true,
4 | "type": "module",
5 | "scripts": {
6 | "test": "tsc --module commonjs --verbatimModuleSyntax false && tsc --module es2015 && tsc --module es2020 && tsc --module esnext && tsc --module node16 --moduleResolution nodenext && tsc --module nodenext --moduleResolution nodenext"
7 | },
8 | "dependencies": {
9 | "isows": "file:../../src/",
10 | "typescript": "^5.2.2"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/test/tsc/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "include": ["index.ts"],
3 | "compilerOptions": {
4 | /* Visit https://aka.ms/tsconfig to read more about this file */
5 |
6 | /* Projects */
7 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
8 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
9 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
10 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
11 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
12 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
13 |
14 | /* Language and Environment */
15 | "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
16 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
17 | // "jsx": "preserve", /* Specify what JSX code is generated. */
18 | // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
19 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
20 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
21 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
22 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
23 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
24 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
25 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
26 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
27 |
28 | /* Modules */
29 | "module": "ESNext" /* Specify what module code is generated. */,
30 | // "rootDir": "./", /* Specify the root folder within your source files. */
31 | "moduleResolution": "Node" /* Specify how TypeScript looks up a file from a given module specifier. */,
32 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
33 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
34 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
35 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
36 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */
37 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
38 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
39 | // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
40 | // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
41 | // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
42 | // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
43 | // "resolveJsonModule": true, /* Enable importing .json files. */
44 | // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
45 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */
46 |
47 | /* JavaScript Support */
48 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
49 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
50 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
51 |
52 | /* Emit */
53 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
54 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */
55 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
56 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
57 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
58 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
59 | "outDir": "./dist" /* Specify an output folder for all emitted files. */,
60 | // "removeComments": true, /* Disable emitting comments. */
61 | // "noEmit": true, /* Disable emitting files from a compilation. */
62 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
63 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
64 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
65 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
66 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
67 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
68 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
69 | // "newLine": "crlf", /* Set the newline character for emitting files. */
70 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
71 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
72 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
73 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
74 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
75 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
76 |
77 | /* Interop Constraints */
78 | "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */,
79 | "verbatimModuleSyntax": true /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */,
80 | "allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
81 | "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
82 | "preserveSymlinks": true /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */,
83 | "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
84 |
85 | /* Type Checking */
86 | "strict": true /* Enable all strict type-checking options. */,
87 | "noImplicitAny": true /* Enable error reporting for expressions and declarations with an implied 'any' type. */,
88 | "strictNullChecks": true /* When type checking, take into account 'null' and 'undefined'. */,
89 | "strictFunctionTypes": true /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */,
90 | "strictBindCallApply": true /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */,
91 | "strictPropertyInitialization": true /* Check for class properties that are declared but not set in the constructor. */,
92 | "noImplicitThis": true /* Enable error reporting when 'this' is given the type 'any'. */,
93 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
94 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
95 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
96 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
97 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
98 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
99 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
100 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
101 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
102 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
103 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
104 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
105 |
106 | /* Completeness */
107 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
108 | "skipLibCheck": true /* Skip type checking all .d.ts files. */
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/test/vite/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite + TS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/test/vite/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test-vite",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite --port 5173",
8 | "test": "playwright test"
9 | },
10 | "dependencies": {
11 | "isows": "file:../../src/"
12 | },
13 | "devDependencies": {
14 | "@playwright/test": "1.52.0",
15 | "@types/node": "^20.8.3",
16 | "typescript": "^5.2.2",
17 | "vite": "^4.4.5"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/test/vite/playwright.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig, devices } from "@playwright/test";
2 |
3 | /**
4 | * Read environment variables from file.
5 | * https://github.com/motdotla/dotenv
6 | */
7 | // require('dotenv').config();
8 |
9 | /**
10 | * See https://playwright.dev/docs/test-configuration.
11 | */
12 | export default defineConfig({
13 | testDir: "./tests",
14 | retries: 3,
15 | projects: [
16 | {
17 | name: "chromium",
18 | use: { ...devices["Desktop Chrome"] },
19 | },
20 |
21 | {
22 | name: "firefox",
23 | use: { ...devices["Desktop Firefox"] },
24 | },
25 |
26 | {
27 | name: "webkit",
28 | use: { ...devices["Desktop Safari"] },
29 | },
30 | ],
31 | webServer: {
32 | command: "bun run dev",
33 | },
34 | });
35 |
--------------------------------------------------------------------------------
/test/vite/src/main.ts:
--------------------------------------------------------------------------------
1 | import { WebSocket } from "isows";
2 |
3 | const ws = new WebSocket(
4 | "wss://ws-ap1.pusher.com:443/app/78a7f9604f977d235435",
5 | );
6 | ws.onopen = () => (document.getElementById("app")!.innerText = "success");
7 |
--------------------------------------------------------------------------------
/test/vite/tests/default.spec.ts:
--------------------------------------------------------------------------------
1 | import { expect, test } from "@playwright/test";
2 |
3 | test("default", async ({ page }) => {
4 | await page.goto("http://localhost:5173/");
5 | await expect(page.getByText("success")).toBeVisible();
6 | });
7 |
--------------------------------------------------------------------------------
/test/vite/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "module": "ESNext",
6 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
7 | "skipLibCheck": true,
8 |
9 | /* Bundler mode */
10 | "moduleResolution": "bundler",
11 | "allowImportingTsExtensions": true,
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "noEmit": true,
15 |
16 | /* Linting */
17 | "strict": true,
18 | "noUnusedLocals": true,
19 | "noUnusedParameters": true,
20 | "noFallthroughCasesInSwitch": true
21 | },
22 | "include": ["src"]
23 | }
24 |
--------------------------------------------------------------------------------
/tsconfig.base.json:
--------------------------------------------------------------------------------
1 | {
2 | // This tsconfig file contains the shared config for the build (tsconfig.build.json) and type checking (tsconfig.json) config.
3 | "include": [],
4 | "compilerOptions": {
5 | // Incremental builds
6 | // NOTE: Enabling incremental builds speeds up `tsc`. Keep in mind though that it does not reliably bust the cache when the `tsconfig.json` file changes.
7 | "incremental": true,
8 |
9 | // Type checking
10 | "strict": true,
11 | "useDefineForClassFields": true, // Not enabled by default in `strict` mode unless we bump `target` to ES2022.
12 | "noFallthroughCasesInSwitch": true, // Not enabled by default in `strict` mode.
13 | "noImplicitReturns": true, // Not enabled by default in `strict` mode.
14 | "useUnknownInCatchVariables": true, // TODO: This would normally be enabled in `strict` mode but would require some adjustments to the codebase.
15 | "noImplicitOverride": true, // Not enabled by default in `strict` mode.
16 | "noUnusedLocals": true, // Not enabled by default in `strict` mode.
17 | "noUnusedParameters": true, // Not enabled by default in `strict` mode.
18 |
19 | // JavaScript support
20 | "allowJs": false,
21 | "checkJs": false,
22 |
23 | // Interop constraints
24 | "esModuleInterop": false,
25 | "allowSyntheticDefaultImports": false,
26 | "forceConsistentCasingInFileNames": true,
27 | "verbatimModuleSyntax": true,
28 | "importHelpers": true, // This is only used for build validation. Since we do not have `tslib` installed, this will fail if we accidentally make use of anything that'd require injection of helpers.
29 |
30 | // Language and environment
31 | "moduleResolution": "NodeNext",
32 | "module": "NodeNext",
33 | "target": "ES2021", // Setting this to `ES2021` enables native support for `Node v16+`: https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping.
34 | "lib": ["ES2022", "DOM"],
35 |
36 | // Skip type checking for node modules
37 | "skipLibCheck": true
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | // This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files.
3 | "extends": "./tsconfig.base.json",
4 | "include": ["src"],
5 | "exclude": [
6 | "src/**/*.test.ts",
7 | "src/**/*.test-d.ts"
8 | ],
9 | "compilerOptions": {
10 | "sourceMap": true,
11 | "rootDir": "./src"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | // This configuration is used for local development and type checking.
3 | "extends": "./tsconfig.base.json",
4 | "include": ["src"],
5 | "references": [{ "path": "./scripts/tsconfig.json" }]
6 | }
7 |
--------------------------------------------------------------------------------