Home / Function/ test() — tailwindcss Function Reference

test() — tailwindcss Function Reference

Architecture documentation for the test() function in utils.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  44ea7d66_6ac1_15b9_1cc7_d01c23a5ee04["test()"]
  7600373a_3645_efb1_bcbb_e7c3fcb813ac["utils.ts"]
  44ea7d66_6ac1_15b9_1cc7_d01c23a5ee04 -->|defined in| 7600373a_3645_efb1_bcbb_e7c3fcb813ac
  0d423473_bbc2_f623_c101_c2dd59c3ed87["predicate()"]
  44ea7d66_6ac1_15b9_1cc7_d01c23a5ee04 -->|calls| 0d423473_bbc2_f623_c101_c2dd59c3ed87
  c85d3a5a_0ffc_357f_deb3_6b2ece89fdd5["overwriteVersionsInPackageJson()"]
  44ea7d66_6ac1_15b9_1cc7_d01c23a5ee04 -->|calls| c85d3a5a_0ffc_357f_deb3_6b2ece89fdd5
  22238dde_7df7_64d5_1424_a93cf2421b15["retryAssertion()"]
  44ea7d66_6ac1_15b9_1cc7_d01c23a5ee04 -->|calls| 22238dde_7df7_64d5_1424_a93cf2421b15
  58b6ded7_4a3b_3039_cd5d_91d120586fe3["gracefullyRemove()"]
  44ea7d66_6ac1_15b9_1cc7_d01c23a5ee04 -->|calls| 58b6ded7_4a3b_3039_cd5d_91d120586fe3
  style 44ea7d66_6ac1_15b9_1cc7_d01c23a5ee04 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

integrations/utils.ts lines 81–456

export function test(
  name: string,
  config: TestConfig,
  testCallback: TestCallback,
  { only = false, skip = false, debug = false }: TestFlags = {},
) {
  return defaultTest(
    name,
    {
      timeout: config.timeout ?? TEST_TIMEOUT,
      retry: process.env.CI ? 2 : 0,
      only: only || (!process.env.CI && debug),
      skip,
      concurrent: true,
    },
    async (options) => {
      let rootDir = debug ? path.join(REPO_ROOT, '.debug') : TMP_ROOT
      await fs.mkdir(rootDir, { recursive: true })

      let root = await fs.mkdtemp(path.join(rootDir, 'tailwind-integrations'))

      if (debug) {
        console.log('Running test in debug mode. File system will be written to:')
        console.log(root)
        console.log()
      }

      let context = {
        root,
        expect: options.expect,
        parseSourceMap,
        async exec(
          command: string,
          childProcessOptions: ChildProcessOptions = {},
          execOptions: ExecOptions = {},
        ) {
          let cwd = childProcessOptions.cwd ?? root
          if (debug && cwd !== root) {
            let relative = path.relative(root, cwd)
            if (relative[0] !== '.') relative = `./${relative}`
            console.log(`> cd ${relative}`)
          }
          if (debug) console.log(`> ${command}`)
          return new Promise((resolve, reject) => {
            let child = exec(
              command,
              {
                cwd,
                ...childProcessOptions,
                env: {
                  ...process.env,
                  ...childProcessOptions.env,
                },
              },
              (error, stdout, stderr) => {
                if (error) {
                  if (execOptions.ignoreStdErr !== true) console.error(stderr)
                  if (only || debug) {
                    console.error(stdout)
                  }
                  reject(error)
                } else {
                  if (only || debug) {
                    console.log(stdout.toString() + '\n\n' + stderr.toString())
                  }
                  resolve(stdout.toString() + '\n\n' + stderr.toString())
                }
              },
            )
            if (execOptions.stdin) {
              child.stdin?.write(execOptions.stdin)
              child.stdin?.end()
            }
          })
        },
        async spawn(command: string, childProcessOptions: ChildProcessOptions = {}) {
          let resolveDisposal: (() => void) | undefined
          let rejectDisposal: ((error: Error) => void) | undefined
          let disposePromise = new Promise<void>((resolve, reject) => {
            resolveDisposal = resolve
            rejectDisposal = reject

Domain

Subdomains

Frequently Asked Questions

What does test() do?
test() is a function in the tailwindcss codebase, defined in integrations/utils.ts.
Where is test() defined?
test() is defined in integrations/utils.ts at line 81.
What does test() call?
test() calls 4 function(s): gracefullyRemove, overwriteVersionsInPackageJson, predicate, retryAssertion.

Analyze Your Own Codebase

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

Try Supermodel Free