Skip to content

docs: Example in the "Testing with file routes and islands" section of Testing is incomplete #3383

@KlaasSkelteAtEnatom

Description

@KlaasSkelteAtEnatom

The example my-app.test.ts contains the following:

import { createBuilder } from "vite";
const builder = await createBuilder({
  // config omitted for brevity
});
await builder.build();

This doesn't compile. Using a freshly initialized fresh 2.0 project, creating a test with the same content as the example (adjusted for the paths) causes a compilation error:

$ deno test -A tests/
Check file:///[...]/fresh-project/tests/test.test.ts
TS2554 [ERROR]: Expected 1 arguments, but got 0.
await builder.build();
              ~~~~~
    at file:///[...]/fresh-project/tests/test.test.ts:10:15

    An argument for 'environment' was not provided.
      build(environment: BuildEnvironment): Promise<RollupOutput | RollupOutput[] | RollupWatcher>;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        at file:///[...]/fresh-project/node_modules/.deno/vite@7.1.5/node_modules/vite/dist/node/index.d.ts:2181:9

error: Type checking failed.

  info: The program failed type-checking, but it still might work correctly.
  hint: Re-run with --no-check to skip type-checking.

Unsurprisingly, running with --no-check fails as vite attempts to access its properties.

It seems to be a left-over of when the legacy builder was used (https://fresh.deno.dev/docs/advanced/builder). That example uses a similar argument-less call to builder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions