Home / File/ args.test.ts — tailwindcss Source File

args.test.ts — tailwindcss Source File

Architecture documentation for args.test.ts, a typescript file in the tailwindcss codebase. 3 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  178128be_b200_b167_fd45_771e707a3af7["args.test.ts"]
  9bf716c1_a944_1eb2_180b_5c0151e992ba["args.ts"]
  178128be_b200_b167_fd45_771e707a3af7 --> 9bf716c1_a944_1eb2_180b_5c0151e992ba
  e9feacff_172e_20e8_5e0f_c6ccfd22ac0e["args"]
  178128be_b200_b167_fd45_771e707a3af7 --> e9feacff_172e_20e8_5e0f_c6ccfd22ac0e
  696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"]
  178128be_b200_b167_fd45_771e707a3af7 --> 696bd648_5f24_1b59_8e8b_7a97a692869e
  style 178128be_b200_b167_fd45_771e707a3af7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { expect, it } from 'vitest'
import { args, type Arg } from './args'

it('should be possible to parse a single argument', () => {
  expect(
    args(
      {
        '--input': { type: 'string', description: 'Input file' },
      },
      ['--input', 'input.css'],
    ),
  ).toMatchInlineSnapshot(`
    {
      "--input": "input.css",
      "_": [],
    }
  `)
})

it('should only return the last value for duplicate arguments', () => {
  expect(
    args(
      {
        '--output': { type: 'string', description: 'Output file' },
      },
      ['--output', 'output.css', '--output', 'override.css'],
    ),
  ).toMatchInlineSnapshot(`
    {
      "--output": "override.css",
      "_": [],
    }
  `)
})

it('uses last value when flag with "-" is supplied multiple times', () => {
  let result = args(
    {
      '--output': { type: 'string', description: 'Output file', alias: '-o' },
    },
    ['--output', 'output.css', '--output', '-'],
  )

  expect(result).toMatchInlineSnapshot(`
    {
      "--output": "-",
      "_": [],
    }
  `)
})

it('should fallback to the default value if no flag is passed', () => {
  expect(
    args(
      {
        '--input': { type: 'string', description: 'Input file', default: 'input.css' },
      },
      ['--other'],
    ),
  ).toMatchInlineSnapshot(`
// ... (96 more lines)

Dependencies

Frequently Asked Questions

What does args.test.ts do?
args.test.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the BuildIntegrations domain.
What does args.test.ts depend on?
args.test.ts imports 3 module(s): args, args.ts, vitest.
Where is args.test.ts in the architecture?
args.test.ts is located at packages/@tailwindcss-cli/src/utils/args.test.ts (domain: BuildIntegrations, directory: packages/@tailwindcss-cli/src/utils).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free