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 Bug That Skips doiuse When Used With An Empty Configuration #170

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions exports/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ import DoIUse from '../lib/DoIUse.js';
export default function index(...options) {
return new DoIUse(...options);
}

index.postcss = new DoIUse().postcss;
52 changes: 50 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"eslint-plugin-unicorn": "^47.0.0",
"mock-fs": "^4.14.0",
"postcss-import": "^14.1.0",
"postcss-load-config": "^4.0.1",
"rollup": "^2.79.1",
"safe-regex": "^2.1.1",
"tap": "^16.3.4",
Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/.postcssrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"plugins": {
"doiuse": {}
}
}
9 changes: 9 additions & 0 deletions test/postcss-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import postcss from 'postcss';
import atImport from 'postcss-import';
import { test } from 'tap';

import postcssrc from 'postcss-load-config';
import DoIUse from '../lib/DoIUse.js';

import { hasKeys } from './utils.js';
Expand Down Expand Up @@ -149,3 +150,11 @@ test('info with no browserslist file or browsers config', (t) => {

t.end();
});

test('loads postcss plugin with an empty configuration object using postcss-load-config', async (t) => {
const { plugins } = await postcssrc(null, fileURLToPath(`${import.meta.url}/../fixtures/.postcssrc.json`));
const { messages } = await postcss(plugins).process('html { display: flex }');

t.equal(messages[0].text, 'CSS Flexible Box Layout Module only partially supported by: IE (11) (flexbox)');
t.end();
});