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
  7e8f1331_e824_8a13_f1ad_47710a6fb07e["args.test.ts"]
  f680db01_c2c6_090b_99ee_9df802d112b2["args.ts"]
  7e8f1331_e824_8a13_f1ad_47710a6fb07e --> f680db01_c2c6_090b_99ee_9df802d112b2
  1aa953df_1d07_87e9_0511_dceb7d1d33bf["args"]
  7e8f1331_e824_8a13_f1ad_47710a6fb07e --> 1aa953df_1d07_87e9_0511_dceb7d1d33bf
  f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3["vitest"]
  7e8f1331_e824_8a13_f1ad_47710a6fb07e --> f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3
  style 7e8f1331_e824_8a13_f1ad_47710a6fb07e 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 CommandLineInterface 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: CommandLineInterface, 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