-
-
Notifications
You must be signed in to change notification settings - Fork 947
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test glob with parent directory (#6398)
* 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
Showing
5 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...standalone-glob-parent-test/folder/another-folder/standalone-glob-parent-wildcard.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
}), | ||
); | ||
}); |
1 change: 1 addition & 0 deletions
1
lib/__tests__/standalone-glob-parent-test/folder/sibling/sibling-style.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a {} |
20 changes: 20 additions & 0 deletions
20
lib/__tests__/standalone-glob-parent-test/folder/standalone-glob-parent.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
}), | ||
); | ||
}); |
1 change: 1 addition & 0 deletions
1
lib/__tests__/standalone-glob-parent-test/parent-folder-style.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a {} |