Skip to content

Commit

Permalink
Test glob with parent directory (#6398)
Browse files Browse the repository at this point in the history
* Add unit tests that have globs with a parent directory ('../style.css') and paren + wildcard directory ('../**/style.css')

* Add new unit test folder to .prettierignore to prevent those styles from causing a formatter error
  • Loading branch information
sjarva committed Oct 13, 2022
1 parent df83ebc commit b24d34f
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
Expand Up @@ -13,3 +13,5 @@
scripts/**/*.css
system-tests/**/*.css
system-tests/**/*.scss
# This unit test required a parent directory stucture and therefore is not inside /fixtures/globs
**/standalone-glob-parent-test/**/*.css
@@ -0,0 +1,20 @@
'use strict';

const standalone = require('../../../../standalone');

it('glob contains a parent directory and ** wildcard', async () => {
const { results } = await standalone({
files: '../**/sibling-style.css',
config: { rules: { 'block-no-empty': true } },
cwd: __dirname,
});

expect(results).toHaveLength(1);
expect(results[0].errored).toBe(true);
expect(results[0].warnings[0]).toEqual(
expect.objectContaining({
rule: 'block-no-empty',
severity: 'error',
}),
);
});
@@ -0,0 +1 @@
a {}
@@ -0,0 +1,20 @@
'use strict';

const standalone = require('../../../standalone');

it('glob has parent directory', async () => {
const { results } = await standalone({
files: '../parent-folder-style.css',
config: { rules: { 'block-no-empty': true } },
cwd: __dirname,
});

expect(results).toHaveLength(1);
expect(results[0].errored).toBe(true);
expect(results[0].warnings[0]).toEqual(
expect.objectContaining({
rule: 'block-no-empty',
severity: 'error',
}),
);
});
@@ -0,0 +1 @@
a {}

0 comments on commit b24d34f

Please sign in to comment.