MCPcopy
hub / github.com/tailwindlabs/tailwindcss / test

Function test

integrations/utils.ts:92–554  ·  view source on GitHub ↗
(
  name: string,
  config: TestConfig,
  testCallback: TestCallback,
  { only = false, skip = false, debug = false, concurrent = false }: TestFlags = {},
)

Source from the content-addressed store, hash-verified

90 process.env.CI && IS_WINDOWS ? path.dirname(process.env.GITHUB_WORKSPACE!) : tmpdir()
91
92export function test(
93 name: string,
94 config: TestConfig,
95 testCallback: TestCallback,
96 { only = false, skip = false, debug = false, concurrent = false }: TestFlags = {},
97) {
98 return defaultTest(
99 name,
100 {
101 timeout: config.timeout ?? TEST_TIMEOUT,
102 retry: config.retry ?? (process.env.CI ? 2 : 0),
103 only: only || (!process.env.CI && debug),
104 skip,
105 concurrent,
106 },
107 async (options) => {
108 let rootDir = debug ? path.join(REPO_ROOT, '.debug') : TMP_ROOT
109 await fs.mkdir(rootDir, { recursive: true })
110
111 let root = await fs.mkdtemp(path.join(rootDir, 'tailwind-integrations'))
112
113 if (debug) {
114 console.log('Running test in debug mode. File system will be written to:')
115 console.log(root)
116 console.log()
117 }
118
119 let context = {
120 root,
121 expect: options.expect,
122 parseSourceMap,
123 async exec(
124 command: string,
125 childProcessOptions: ChildProcessOptions = {},
126 execOptions: ExecOptions = {},
127 ) {
128 let cwd = childProcessOptions.cwd ?? root
129 let originalCommand = command
130
131 // Avoid `pnpm exec upgrade` on Windows because the upgrader runs
132 // `pnpm add`, which rewrites Windows `.cmd` shims while the current
133 // shim is still executing.
134 //
135 // Pretty sure this is a pnpm v11 bug on Windows.
136 if (IS_WINDOWS && command.includes('pnpm exec upgrade')) {
137 for (let base = cwd; ; base = path.dirname(base)) {
138 let upgradeBin = path.join(
139 base,
140 'node_modules',
141 '@tailwindcss',
142 'upgrade',
143 'dist',
144 'index.mjs',
145 )
146
147 try {
148 await fs.access(upgradeBin)
149 command = command.replace('pnpm exec upgrade', `node "${upgradeBin}"`)

Callers 15

index.test.tsFile · 0.90
next.test.tsFile · 0.90
multi-root.test.tsFile · 0.90
source.test.tsFile · 0.90
config.test.tsFile · 0.90
plugins.test.tsFile · 0.90
workers.test.tsFile · 0.90
index.test.tsFile · 0.90
config.test.tsFile · 0.90
plugins.test.tsFile · 0.90

Calls 3

execMethod · 0.80
errorMethod · 0.80
entriesMethod · 0.45

Tested by

no test coverage detected