Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: print deprecation warning only when plugin is used #1744

Merged
merged 3 commits into from May 18, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion test/postcss.test.ts
Expand Up @@ -122,17 +122,19 @@ test('has deprecated method to creat plugins', () => {
}
})

equal(warn.callCount, 0)

let func1: any = postcss(plugin).plugins[0]
is(func1.postcssPlugin, 'test')
match(func1.postcssVersion, /\d+.\d+.\d+/)
equal(warn.callCount, 1)
zardoy marked this conversation as resolved.
Show resolved Hide resolved

let func2: any = postcss(plugin()).plugins[0]
equal(func2.postcssPlugin, func1.postcssPlugin)
equal(func2.postcssVersion, func1.postcssVersion)

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

let result2 = postcss(plugin).process('a{ one: 1; two: 2 }')
is(result2.css, 'a{ one: 1 }')
Expand Down