Skip to content

Instantly share code, notes, and snippets.

View UberMouse's full-sized avatar

Taylor Lodge UberMouse

View GitHub Profile
11:18:24.972 info extension stopping host
11:18:25.315 info host ------------ starting ------------
11:18:25.343 info extension host process output: port:[43195]
11:18:25.343 info extension
11:18:25.385 info host client connected: extension { address: '127.0.0.1', family: 'IPv4', port: 43195 }
11:18:25.398 info host starting host: {"extensionFolder":"/home/taylorl/.cursor/extensions/wallabyjs.console-ninja-1.0.366","runtimeHookFile":"/home/taylorl/.cursor/extensions/wallabyjs.console-ninja-1.0.366/out/runtimeHook/tracer.js","globalErrorHandlerFile":"/home/taylorl/.cursor/extensions/wallabyjs.console-ninja-1.0.366/out/runtimeHook/errorHandler.js","networkLoggingHandlerFile":"/home/taylorl/.cursor/extensions/wallabyjs.console-ninja-1.0.366/out/runtimeHook/networkLoggingHandler.js","filesToInstrument":[{"path":"/home/taylorl/code/console-ninja-rush-test/packages/webpack-app/lib-commonjs/index.js","reason":"search"},{"path":"/home/taylorl/code/console-ninja-rush-test/packages/webpack-app/lib/index.js","reason":"
/**
* @public
*
* Wraps an xstate-tree returning Promise (generated by `import()` in an xstate-tree machine responsible for
* booting up the machine upon resolution
*
* @param factory - the factory function that returns the promise that resolves to the machine
* @param options - configure loading component and context to invoke machine with
* @returns an xstate-tree machine that wraps the promise, invoking the resulting machine when it resolves
*/
import { z } from "zod";
import { makeEndpoint, makeApi, Zodios } from "@zodios/core";
import { QueryClient } from "@tanstack/query-core";
const UserSchema = z.object({
name: z.string(),
country: z.string().nullable()
});
const getUser = makeEndpoint({
const { promisify } = require("util");
const { exec: _exec } = require("child_process");
const { resolve } = require("path");
const exec = promisify(_exec);
const PLUGIN_NAME = "FixTsconfigPathsPlugin";
class FixTsconfigPathsPlugin {
pluginName = PLUGIN_NAME;
type Arguments<TContext> = {
name: string;
successTarget: string;
id?: string;
successActions?: string[];
errorActions?: string[];
otherDoneTargets?: TransitionConfig<TContext, DoneInvokeEvent<$YesReallyAny>>[];
errorTarget?: string;
errorPredicate?: (_ctx: unknown, e: DoneInvokeEvent<$YesReallyAny>) => boolean;
};

@xstate/test model generation with zones

What is a zone?

A zone is an isolated portion of an @xstate/test model. A zone defines the events it uses, the event that causes it to be entered and the states within the zone

The zones entryEvent is added as an event handler to the zones parent initial state. If this is a root zone passed to buildTestModel this is the root state, if it's a sub zone (a state pointing at a zone), that is the initial state of the zone that state is contained in

Each state in a zone must contain a test property that validates that the state has been entered. At least one of the states requires it to be marked as the initial state of the zone with initial: true An event handler in a zone state can only refer to events defined inside of the zone

import type { Fixtures } from "@playwright/test";
import { test as base } from "@playwright/test";
import { BrowserContext, ElectronApplication, Page } from "playwright";
export { expect } from "@playwright/test";
type ElectronTestFixtures = {
electronApp: ElectronApplication;
page: Page;
context: BrowserContext;
@UberMouse
UberMouse / createDataStream.ts
Created October 29, 2020 20:53
GraphQL + Apollo + XState dump
type QueryResult<TTransformedData> =
| { type: "success"; data: TTransformedData }
| { type: "error"; errors: readonly GraphQLError[] };
type ParentEvents<TData, TId extends string = "dataLoader"> =
| { type: "dataStream.NEW_DATA"; data: TData; id: TId }
| { type: "dataStream.ERROR"; id: TId };
export function createDataStream<
TObservableFactory extends (...args: $YesReallyAny[]) => Observable<QueryResult<$YesReallyAny>>,
import { StateMachine, State } from "xstate";
type RegisteredMachine = {
machine: StateMachine<any, any, any>;
state?: State<any, any, any>;
};
const machineRegistrations: Record<string, RegisteredMachine> = {};
export function registerMachine(
machine: StateMachine<any, any, any>,
import { Observable } from "rxjs";
import { map } from "rxjs/operators";
import { Required } from "utility-types";
import { createMachine, sendParent, assign, spawn, Actor } from "xstate";
import { $YesReallyAny, assert } from "../";
import { QueryResult } from "../gql/queryResultHandler";
let id = 0;
enum Actions {