Skip to content

Commit 98296a8

Browse files
committed
chore: remove console output testing
1 parent 5ede5ff commit 98296a8

File tree

2 files changed

+3
-35
lines changed

2 files changed

+3
-35
lines changed

test/basic.test.ts

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,14 @@
1-
import { useTestContext } from '@nuxt/test-utils'
2-
import { describe, test, expect, vi, afterAll } from 'vitest'
1+
import { describe, test, expect } from 'vitest'
32
import { getVfsFile, r, setupNuxtTailwind } from './utils'
43

54
describe('tailwindcss module', async () => {
6-
// Consola will by default set the log level to warn in test, we trick it into thinking we're in debug mode
7-
process.env.DEBUG = 'nuxt:*'
8-
// // Running dev environment for setup in test-utils to test dev options
9-
// process.env.NUXT_TEST_DEV = true
10-
11-
const spyStderr = vi.spyOn(process.stderr, 'write').mockImplementation(() => undefined!)
12-
const spyStdout = vi.spyOn(process.stdout, 'write').mockImplementation(() => undefined!)
13-
14-
afterAll(() => {
15-
spyStderr.mockRestore()
16-
spyStdout.mockRestore()
17-
})
18-
195
await setupNuxtTailwind({
206
exposeConfig: { level: 2, alias: '#twcss' },
217
quiet: false,
228
// viewer: { endpoint: '_tw' },
239
cssPath: r('tailwind.css'),
2410
})
2511

26-
test('include custom tailwind.css file in project css', () => {
27-
const nuxt = useTestContext().nuxt!
28-
29-
expect(nuxt.options.css).toHaveLength(1)
30-
expect(nuxt.options.css[0]).toEqual(
31-
// @ts-expect-error tailwindcss is not typed
32-
(nuxt.options.tailwindcss.cssPath as string).replace(/\\/g /* windows protocol */, '/'),
33-
)
34-
35-
expect(spyStdout.mock.calls.some(c => (c[0] as string).includes('Using Tailwind CSS from ~/tailwind.css'))).toBeTruthy()
36-
})
37-
3812
test('default js config is merged in', () => {
3913
const vfsFile = getVfsFile('test-tailwind.config.mjs')
4014
// set from default config tailwind.config.js

test/configs.test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,8 @@ describe('tailwindcss module configs', async () => {
5454
},
5555
})
5656

57-
test('throws error about malformed config', () => {
58-
const output = spyStderr.mock.calls.map(m => m[0].toString().split('\n')[0].replace(/\(node:\d+\) /, ''))
59-
60-
// TODO: investigate warning on Node v22 (possibly generated by loading tailwind.config?)
61-
// Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
62-
// expect(output).toContain('Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.')
63-
64-
expect(output).toContain('[warn] [nuxt:tailwindcss] Failed to load config `./malformed-tailwind.config.js` due to the error below. Skipping..')
57+
test('malformed config is not read', () => {
58+
expect(getVfsFile('tailwind.config.cjs')).not.contains('malformed-tailwind.config')
6559
})
6660

6761
test('ts config file is loaded and merged', () => {

0 commit comments

Comments
 (0)