8000 fix tests · postcss/postcss@2295e28 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2295e28

Browse files
committed
fix tests
1 parent fc19f1b commit 2295e28

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

test/postcss.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ test('has deprecated method to creat plugins', () => {
121121
})
122122
}
123123
})
124-
equal(warn.callCount, 1)
125-
match(warn.calls[0][0], /postcss\.plugin was deprecated/)
126124

127125
let func1: any = postcss(plugin).plugins[0]
128126
is(func1.postcssPlugin, 'test')
@@ -134,9 +132,13 @@ test('has deprecated method to creat plugins', () => {
134132

135133
let result1 = postcss(plugin('one')).process('a{ one: 1; two: 2 }')
136134
is(result1.css, 'a{ two: 2 }')
135+
equal(warn.callCount, 1)
137136

138137
let result2 = postcss(plugin).process('a{ one: 1; two: 2 }')
139138
is(result2.css, 'a{ one: 1 }')
139+
140+
equal(warn.callCount, 1)
141+
match(warn.calls[0][0], /postcss\.plugin was deprecated/)
140142
})
141143

142144
test('creates a shortcut to process css', async () => {
@@ -148,7 +150,6 @@ test('creates a shortcut to process css', async () => {
148150
})
149151
}
150152
})
151-
equal(warn.callCount, 1)
152153

153154
let result1 = plugin.process('a{value:foo}')
154155
is(result1.css, 'a{value:bar}')
@@ -159,6 +160,8 @@ test('creates a shortcut to process css', async () => {
159160
let result = await plugin.process('a{value:foo}', { from: 'a' }, 'baz')
160161
equal(result.opts, { from: 'a' })
161162
is(result.css, 'a{value:baz}')
163+
164+
equal(warn.callCount, 1)
162165
})
163166

164167
test('does not call plugin constructor', () => {
@@ -169,13 +172,14 @@ test('does not call plugin constructor', () => {
169172
return () => {}
170173
})
171174
is(calls, 0)
172-
equal(warn.callCount, 1)
173175

174176
postcss(plugin).process('a{}')
175177
is(calls, 1)
176178

177179
postcss(plugin()).process('a{}')
178180
is(calls, 2)
181+
182+
equal(warn.callCount, 1)
179183
})
180184

181185
test.run()

test/processor.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,8 @@ test('checks plugin compatibility', () => {
390390
throw new Error('Er')
391391
}
392392
})
393-
equal(warn.callCount, 1)
394393
let func = plugin()
394+
equal(warn.callCount, 1)
395395
func.postcssVersion = '2.1.5'
396396

397397
function processBy(version: string): void {
@@ -562,9 +562,9 @@ test('supports plugins returning processors', () => {
562562
let other: any = (postcss as any).plugin('test', () => {
563563
return new Processor([a])
564564
})
565-
equal(warn.callCount, 1)
566565
processor.use(other)
567566
equal(processor.plugins, [a])
567+
equal(warn.callCount, 1)
568568
})
569569

570570
test('supports plugin creators returning processors', () => {

0 commit comments

Comments
 (0)
0