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

nuxt.test.ts — tailwindcss Source File

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

File typescript Oxide 5 imports

Entity Profile

Dependency Diagram

graph LR
  33de5a73_75eb_f88c_8c35_a7e2e41d559e["nuxt.test.ts"]
  7600373a_3645_efb1_bcbb_e7c3fcb813ac["utils.ts"]
  33de5a73_75eb_f88c_8c35_a7e2e41d559e --> 7600373a_3645_efb1_bcbb_e7c3fcb813ac
  ce18acb2_833c_61a7_166d_0fd7613ce1c0["candidate"]
  33de5a73_75eb_f88c_8c35_a7e2e41d559e --> ce18acb2_833c_61a7_166d_0fd7613ce1c0
  522399f9_a5a8_fa94_794a_917ab0d0a66d["fetchStyles"]
  33de5a73_75eb_f88c_8c35_a7e2e41d559e --> 522399f9_a5a8_fa94_794a_917ab0d0a66d
  22238dde_7df7_64d5_1424_a93cf2421b15["retryAssertion"]
  33de5a73_75eb_f88c_8c35_a7e2e41d559e --> 22238dde_7df7_64d5_1424_a93cf2421b15
  44ea7d66_6ac1_15b9_1cc7_d01c23a5ee04["test"]
  33de5a73_75eb_f88c_8c35_a7e2e41d559e --> 44ea7d66_6ac1_15b9_1cc7_d01c23a5ee04
  style 33de5a73_75eb_f88c_8c35_a7e2e41d559e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { candidate, css, fetchStyles, html, json, retryAssertion, test, ts } from '../utils'

const SETUP = {
  fs: {
    'package.json': json`
      {
        "type": "module",
        "dependencies": {
          "@tailwindcss/vite": "workspace:^",
          "nuxt": "3.16.0",
          "nitropack": "2.11.0",
          "tailwindcss": "workspace:^",
          "vue": "latest"
        },
        "pnpm": {
          "overrides": {
            "nuxi": "3.28.0"
          }
        }
      }
    `,
    'nuxt.config.ts': ts`
      import tailwindcss from '@tailwindcss/vite'

      // https://nuxt.com/docs/api/configuration/nuxt-config
      export default defineNuxtConfig({
        vite: {
          plugins: [tailwindcss()],
        },

        css: ['~/assets/css/main.css'],
        devtools: { enabled: true },
        compatibilityDate: '2024-08-30',
      })
    `,
    'app.vue': html`
        <template>
        <div class="underline">Hello world!</div>
      </template>
      `,
    'assets/css/main.css': css`@import 'tailwindcss';`,
  },
}

test('dev mode', SETUP, async ({ fs, spawn, expect }) => {
  let process = await spawn('pnpm nuxt dev', {
    env: {
      TEST: 'false', // VERY IMPORTANT OTHERWISE YOU WON'T GET OUTPUT
      NODE_ENV: 'development',
    },
  })

  let url = ''
  await process.onStdout((m) => {
    let match = /Local:\s*(http.*)\//.exec(m)
    if (match) url = match[1]
    return Boolean(url)
  })

  await process.onStdout((m) => m.includes('server warmed up in'))

  await retryAssertion(async () => {
    let css = await fetchStyles(url)
    expect(css).toContain(candidate`underline`)
  })

  await retryAssertion(async () => {
    await fs.write(
      'app.vue',
      html`
        <template>
          <div class="underline font-bold">Hello world!</div>
        </template>
      `,
    )

    let css = await fetchStyles(url)
    expect(css).toContain(candidate`underline`)
    expect(css).toContain(candidate`font-bold`)
  })
})

test('build', SETUP, async ({ spawn, exec, expect }) => {
  await exec('pnpm nuxt build')
  // The Nuxt preview server does not automatically assign a free port if 3000
  // is taken, so we use a random port instead.
  let process = await spawn(`pnpm nuxt preview --port 8724`, {
    env: {
      TEST: 'false',
      NODE_ENV: 'development',
    },
  })

  let url = ''
  await process.onStdout((m) => {
    let match = /Listening on\s*(http.*)\/?/.exec(m)
    if (match) url = match[1].replace('http://[::]', 'http://127.0.0.1')
    return m.includes('Listening on')
  })

  await retryAssertion(async () => {
    let css = await fetchStyles(url)
    expect(css).toContain(candidate`underline`)
  })
})

Domain

Frequently Asked Questions

What does nuxt.test.ts do?
nuxt.test.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the Oxide domain.
What does nuxt.test.ts depend on?
nuxt.test.ts imports 5 module(s): candidate, fetchStyles, retryAssertion, test, utils.ts.
Where is nuxt.test.ts in the architecture?
nuxt.test.ts is located at integrations/vite/nuxt.test.ts (domain: Oxide, directory: integrations/vite).

Analyze Your Own Codebase

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

Try Supermodel Free