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

Refactor lib/__tests__/ignoreDisables.test.js #5283

Merged
merged 1 commit into from
May 12, 2021
Merged
Changes from all commits
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
61 changes: 31 additions & 30 deletions lib/__tests__/ignoreDisables.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,31 @@

const postcssPlugin = require('../postcssPlugin');
const standalone = require('../standalone');
const stripIndent = require('common-tags').stripIndent;

const config = {
rules: { 'block-no-empty': true },
};

const css = stripIndent`
/* stylelint-disable */
a {}
/* stylelint-enable */
a {
b {} /* stylelint-disable-line block-no-empty */
}`;
const css = `
/* stylelint-disable */
a {}
/* stylelint-enable */
a {
b {} /* stylelint-disable-line block-no-empty */
}`;

describe('ignoreDisables with postcssPlugins', () => {
let result;

beforeEach(() => {
return postcssPlugin
.process(
css,
{ from: undefined },
{
config,
ignoreDisables: true,
},
)
.then((data) => (result = data));
beforeEach(async () => {
result = await postcssPlugin.process(
css,
{ from: undefined },
{
config,
ignoreDisables: true,
},
);
});

it('expected number of warnings', () => {
Expand All @@ -48,12 +45,14 @@ describe('ignoreDisables with postcssPlugins', () => {
describe('ignoreDisables with standalone', () => {
let results;

beforeEach(() => {
return standalone({
config,
code: css,
ignoreDisables: true,
}).then((data) => (results = data.results));
beforeEach(async () => {
results = (
await standalone({
config,
code: css,
ignoreDisables: true,
})
).results;
});

it('expected number of warnings', () => {
Expand All @@ -72,11 +71,13 @@ describe('ignoreDisables with standalone', () => {
describe('ignoreDisables with config', () => {
let results;

beforeEach(() => {
return standalone({
config: { ignoreDisables: true, ...config },
code: css,
}).then((data) => (results = data.results));
beforeEach(async () => {
results = (
await standalone({
config: { ignoreDisables: true, ...config },
code: css,
})
).results;
});

it('expected number of warnings', () => {
Expand Down