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

Update globby requirement from ^9.2.0 to ^10.0.1 #4254

Merged
merged 24 commits into from Jan 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
7 changes: 4 additions & 3 deletions lib/__tests__/ignore.test.js
Expand Up @@ -2,9 +2,10 @@

const NoFilesFoundError = require('../utils/noFilesFoundError');
const path = require('path');
const replaceBackslashes = require('./replaceBackslashes');
const standalone = require('../standalone');

const fixturesPath = path.join(__dirname, 'fixtures');
const fixturesPath = replaceBackslashes(path.join(__dirname, 'fixtures'));

test('extending config and ignoreFiles glob ignoring single glob', () => {
return standalone({
Expand Down Expand Up @@ -264,7 +265,7 @@ test('extending a config that ignores files', () => {
test('using codeFilename and ignoreFiles together', () => {
return standalone({
code: 'a {}',
codeFilename: path.join(__dirname, 'foo.css'),
codeFilename: replaceBackslashes(path.join(__dirname, 'foo.css')),
config: {
ignoreFiles: ['**/foo.css'],
rules: { 'block-no-empty': true },
Expand All @@ -281,7 +282,7 @@ test('using codeFilename and ignoreFiles together', () => {
test('using codeFilename and ignoreFiles with configBasedir', () => {
return standalone({
code: 'a {}',
codeFilename: path.join(__dirname, 'foo.css'),
codeFilename: replaceBackslashes(path.join(__dirname, 'foo.css')),
config: {
ignoreFiles: ['foo.css'],
rules: { 'block-no-empty': true },
Expand Down
11 changes: 8 additions & 3 deletions lib/__tests__/invalidScopeDisables.test.js
Expand Up @@ -2,10 +2,15 @@

const invalidScopeDisables = require('../invalidScopeDisables');
const path = require('path');
const replaceBackslashes = require('./replaceBackslashes');
const standalone = require('../standalone');
const stripIndent = require('common-tags').stripIndent;

function fixture(name) {
return replaceBackslashes(path.join(__dirname, './fixtures/disableOptions', name));
}

function source(name) {
return path.join(__dirname, './fixtures/disableOptions', name);
}

Expand Down Expand Up @@ -59,11 +64,11 @@ it('invalidScopeDisables complex case', () => {
}).then((linted) => {
expect(invalidScopeDisables(linted.results, config)).toEqual([
{
source: fixture('disabled-ranges-1.css'),
source: source('disabled-ranges-1.css'),
ranges: [{ start: 1, end: 3, unusedRule: 'color-named' }],
},
{
source: fixture('disabled-ranges-2.css'),
source: source('disabled-ranges-2.css'),
ranges: [{ start: 5, end: 5, unusedRule: 'color-named' }],
},
]);
Expand All @@ -85,7 +90,7 @@ it('invalidScopeDisables ignored case', () => {
}).then((linted) => {
expect(invalidScopeDisables(linted.results, config)).toEqual([
{
source: fixture('disabled-ranges-1.css'),
source: source('disabled-ranges-1.css'),
ranges: [{ start: 5, end: 7, unusedRule: 'block-no-empty' }],
},
]);
Expand Down
13 changes: 9 additions & 4 deletions lib/__tests__/needlessDisables.test.js
Expand Up @@ -2,13 +2,18 @@

const needlessDisables = require('../needlessDisables');
const path = require('path');
const replaceBackslashes = require('./replaceBackslashes');
const standalone = require('../standalone');
const stripIndent = require('common-tags').stripIndent;

function fixture(name) {
function source(name) {
return path.join(__dirname, './fixtures/disableOptions', name);
}

function fixture(name) {
return replaceBackslashes(path.join(__dirname, './fixtures/disableOptions', name));
}

it('needlessDisables simple case', () => {
const config = {
rules: { 'block-no-empty': true },
Expand Down Expand Up @@ -64,15 +69,15 @@ it('needlessDisables complex case', () => {
}).then((linted) => {
expect(needlessDisables(linted.results)).toEqual([
{
source: fixture('disabled-ranges-1.css'),
source: source('disabled-ranges-1.css'),
ranges: [
{ start: 1, end: 3, unusedRule: 'color-named' },
{ start: 5, end: 7, unusedRule: 'block-no-empty' },
{ start: 10, end: 10, unusedRule: 'block-no-empty' },
],
},
{
source: fixture('disabled-ranges-2.css'),
source: source('disabled-ranges-2.css'),
ranges: [
{ start: 5, end: 5, unusedRule: 'color-named' },
{ start: 6, end: 6, unusedRule: 'block-no-empty' },
Expand All @@ -98,7 +103,7 @@ it('needlessDisables ignored case', () => {
}).then((linted) => {
expect(needlessDisables(linted.results)).toEqual([
{
source: fixture('disabled-ranges-1.css'),
source: source('disabled-ranges-1.css'),
ranges: [
{ start: 1, end: 3, unusedRule: 'color-named' },
{ start: 5, end: 7, unusedRule: 'block-no-empty' },
Expand Down
5 changes: 5 additions & 0 deletions lib/__tests__/replaceBackslashes.js
@@ -0,0 +1,5 @@
'use strict';

module.exports = function replaceBackslashes(str) {
return str.replace(/\\/g, '/');
};
3 changes: 2 additions & 1 deletion lib/__tests__/standalone-cache.test.js
Expand Up @@ -5,6 +5,7 @@ const path = require('path');
const standalone = require('../standalone');
const fixturesPath = path.join(__dirname, 'fixtures');
const fs = require('fs');
const replaceBackslashes = require('./replaceBackslashes');
const { promisify } = require('util');
const unlink = promisify(fs.unlink);
const fCache = require('file-entry-cache');
Expand All @@ -24,7 +25,7 @@ const newFileDest = path.join(fixturesPath, 'cache', 'newFile.css');
// make sure config doesn't change between runs.
function getConfig() {
return {
files: path.join(fixturesPath, 'cache', '*.css'),
files: replaceBackslashes(path.join(fixturesPath, 'cache', '*.css')),
config: {
rules: { 'block-no-empty': true, 'color-no-invalid-hex': true },
},
Expand Down
5 changes: 3 additions & 2 deletions lib/__tests__/standalone-invalidScopeDisables.test.js
@@ -1,9 +1,10 @@
'use strict';

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

const fixturesPath = path.join(__dirname, 'fixtures');
const fixturesPath = replaceBackslashes(path.join(__dirname, 'fixtures'));
const config = {
quiet: true,
rules: {
Expand Down Expand Up @@ -31,7 +32,7 @@ it('standalone with input css and `reportInvalidScopeDisables`', () => {

it('standalone with input file(s) and `reportInvalidScopeDisables`', () => {
return standalone({
files: path.join(fixturesPath, 'empty-block-with-disables.css'),
files: replaceBackslashes(path.join(fixturesPath, 'empty-block-with-disables.css')),
config,
reportInvalidScopeDisables: true,
}).then((linted) => {
Expand Down
5 changes: 3 additions & 2 deletions lib/__tests__/standalone-maxWarnings.test.js
@@ -1,9 +1,10 @@
'use strict';

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

const fixturesPath = path.join(__dirname, 'fixtures');
const fixturesPath = replaceBackslashes(path.join(__dirname, 'fixtures'));

it('standalone with input css and `maxWarnings`', () => {
const config = {
Expand Down Expand Up @@ -35,7 +36,7 @@ it('standalone with input file(s) and `maxWarnings`', () => {
};

return standalone({
files: path.join(fixturesPath, 'empty-block.css'),
files: replaceBackslashes(path.join(fixturesPath, 'empty-block.css')),
config,
maxWarnings: 0,
}).then((linted) => {
Expand Down
5 changes: 3 additions & 2 deletions lib/__tests__/standalone-needlessDisables.test.js
@@ -1,9 +1,10 @@
'use strict';

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

const fixturesPath = path.join(__dirname, 'fixtures');
const fixturesPath = replaceBackslashes(path.join(__dirname, 'fixtures'));

it('standalone with input css and `reportNeedlessDisables`', () => {
const config = {
Expand Down Expand Up @@ -41,7 +42,7 @@ it('standalone with input file(s) and `reportNeedlessDisables`', () => {
};

return standalone({
files: path.join(fixturesPath, 'empty-block-with-disables.css'),
files: replaceBackslashes(path.join(fixturesPath, 'empty-block-with-disables.css')),
config,
reportNeedlessDisables: true,
}).then((linted) => {
Expand Down
5 changes: 3 additions & 2 deletions lib/__tests__/standalone-parseErrors.test.js
Expand Up @@ -3,6 +3,7 @@
const blockNoEmpty = require('../rules/block-no-empty');
const configBlockNoEmpty = require('./fixtures/config-block-no-empty');
const path = require('path');
const replaceBackslashes = require('./replaceBackslashes');
const standalone = require('../standalone');

jest.mock('../rules/block-no-empty');
Expand All @@ -29,7 +30,7 @@ test('standalone with deprecations', async () => {

test('file with correct syntax reported correctly', async () => {
const data = await standalone({
files: path.join(__dirname, 'fixtures/broken-syntax/correct-syntax.css'),
files: replaceBackslashes(path.join(__dirname, 'fixtures/broken-syntax/correct-syntax.css')),
});

expect(data.results[0]).toMatchObject({
Expand All @@ -41,7 +42,7 @@ test('file with correct syntax reported correctly', async () => {

test('file with invalid syntax reported correctly', async () => {
const data = await standalone({
files: [path.join(__dirname, 'fixtures/broken-syntax/broken-syntax.css')],
files: [replaceBackslashes(path.join(__dirname, 'fixtures/broken-syntax/broken-syntax.css'))],
});

expect(data.results[0]).toMatchObject({
Expand Down
3 changes: 2 additions & 1 deletion lib/__tests__/standalone-syntax.test.js
Expand Up @@ -2,12 +2,13 @@

const fs = require('fs');
const path = require('path');
const replaceBackslashes = require('./replaceBackslashes');
const standalone = require('../standalone');
const stringFormatter = require('../formatters/stringFormatter');
const stripAnsi = require('strip-ansi');
const { promisify } = require('util');

const fixturesPath = path.join(__dirname, 'fixtures');
const fixturesPath = replaceBackslashes(path.join(__dirname, 'fixtures'));

it('standalone with css syntax', () => {
const config = {
Expand Down
5 changes: 3 additions & 2 deletions lib/__tests__/standalone.test.js
Expand Up @@ -3,9 +3,10 @@
const configBlockNoEmpty = require('./fixtures/config-block-no-empty');
const NoFilesFoundError = require('../utils/noFilesFoundError');
const path = require('path');
const replaceBackslashes = require('./replaceBackslashes');
const standalone = require('../standalone');

const fixturesPath = path.join(__dirname, 'fixtures');
const fixturesPath = replaceBackslashes(path.join(__dirname, 'fixtures'));

describe('standalone with one input file', () => {
let output;
Expand Down Expand Up @@ -315,7 +316,7 @@ describe('standalone with config locatable from process.cwd not file', () => {

beforeEach(() => {
return standalone({
files: [path.join(__dirname, './fixtures/empty-block.css')],
files: [replaceBackslashes(path.join(__dirname, './fixtures/empty-block.css'))],
}).then((data) => (results = data.results));
});

Expand Down
6 changes: 5 additions & 1 deletion lib/__tests__/stylelintignore-test/stylelintignore.test.js
@@ -1,6 +1,7 @@
'use strict';

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

describe('stylelintignore', () => {
Expand All @@ -20,7 +21,10 @@ describe('stylelintignore', () => {
describe('standalone with .stylelintignore file ignoring one file', () => {
beforeEach(() => {
return standalone({
files: [`${fixturesPath}/empty-block.css`, `${fixturesPath}/invalid-hex.css`],
files: [
replaceBackslashes(`${fixturesPath}/empty-block.css`),
replaceBackslashes(`${fixturesPath}/invalid-hex.css`),
],
config: {
extends: [
`${fixturesPath}/config-block-no-empty`,
Expand Down