Skip to content

Commit 807d2d4

Browse files
hudochenkovai
authored andcommitted
Update dependencies (#90)
* Update PostCSS * Update Jest and lint-staged * Update globby * Remove Node 4 and add Node 8 to Travis
1 parent 80994ee commit 807d2d4

File tree

5 files changed

+1509
-560
lines changed

5 files changed

+1509
-560
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ language: node_js
22
cache: yarn
33
node_js:
44
- stable
5+
- "8"
56
- "6"
6-
- "4"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ module.exports = {
316316
Type: `string|string[]`
317317

318318
Similar to [`mixinsDir`](#mixinsdir); except, you can provide
319-
[glob](https://github.com/isaacs/node-glob) syntax to target or not target
319+
[fast-glob](https://github.com/mrmlnc/fast-glob) syntax to target or not target
320320
specific files.
321321

322322
```js

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
"license": "MIT",
1414
"repository": "postcss/postcss-mixins",
1515
"dependencies": {
16-
"globby": "^6.1.0",
17-
"postcss": "^6.0.13",
18-
"postcss-js": "^1.0.1",
16+
"globby": "^8.0.1",
17+
"postcss": "^7.0.2",
18+
"postcss-js": "^2.0.0",
1919
"postcss-simple-vars": "^4.1.0",
20-
"sugarss": "^1.0.0"
20+
"sugarss": "^1.0.1"
2121
},
2222
"devDependencies": {
2323
"eslint": "^4.9.0",
2424
"eslint-config-postcss": "^2.0.2",
25-
"jest": "^21.2.1",
26-
"lint-staged": "^4.3.0",
25+
"jest": "^23.4.2",
26+
"lint-staged": "^7.2.0",
2727
"pre-commit": "^1.2.2"
2828
},
2929
"scripts": {
@@ -44,7 +44,8 @@
4444
"global": {
4545
"statements": 100
4646
}
47-
}
47+
},
48+
"testEnvironment": "node"
4849
},
4950
"lint-staged": {
5051
"*.js": "eslint"

test/test.test.js

Lines changed: 59 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@ var path = require('path');
44
var mixins = require('../');
55

66
function run(input, output, opts) {
7-
return postcss([ mixins(opts) ]).process(input).then(result => {
8-
expect(result.css).toEqual(output);
9-
expect(result.warnings().length).toBe(0);
10-
return result;
11-
});
7+
return postcss([ mixins(opts) ])
8+
.process(input, { from: undefined })
9+
.then(result => {
10+
expect(result.css).toEqual(output);
11+
expect(result.warnings().length).toBe(0);
12+
return result;
13+
});
1214
}
1315

1416
it('throws error on unknown mixin', () => {
15-
return postcss(mixins).process('@mixin A').catch(err => {
16-
expect(err.reason).toEqual('Undefined mixin A');
17-
});
17+
return postcss(mixins)
18+
.process('@mixin A', { from: undefined })
19+
.catch(err => {
20+
expect(err.reason).toEqual('Undefined mixin A');
21+
});
1822
});
1923

2024
it('cans remove unknown mixin on request', () => {
@@ -106,10 +110,12 @@ it('throws on unknown mixin type', done => {
106110
a: 1
107111
}
108112
};
109-
return postcss([ mixins(opts) ]).process('@mixin a').catch(e => {
110-
expect(e.message).toEqual('Wrong a mixin type number');
111-
done();
112-
});
113+
return postcss([ mixins(opts) ])
114+
.process('@mixin a', { from: undefined })
115+
.catch(e => {
116+
expect(e.message).toEqual('Wrong a mixin type number');
117+
done();
118+
});
113119
});
114120

115121
it('supports CSS mixins', () => {
@@ -234,33 +240,39 @@ it('loads mixins from dir with parent options', () => {
234240
parent: path.join(__dirname, 'a.js')
235241
}
236242
).then(result => {
237-
expect(result.messages).toEqual([
238-
{
239-
file: path.join(__dirname, 'mixins/a.js'),
240-
type: 'dependency',
241-
parent: parent
242-
},
243-
{
244-
file: path.join(__dirname, 'mixins/b.json'),
245-
type: 'dependency',
246-
parent: parent
247-
},
248-
{
249-
file: path.join(__dirname, 'mixins/c.CSS'),
250-
type: 'dependency',
251-
parent: parent
252-
},
253-
{
254-
file: path.join(__dirname, 'mixins/d.sss'),
255-
type: 'dependency',
256-
parent: parent
257-
},
258-
{
259-
file: path.join(__dirname, 'mixins/e.pcss'),
260-
type: 'dependency',
261-
parent: parent
262-
}
263-
]);
243+
// Array could have files sorted in non-alphabetical order.
244+
// Check array length, and that it contains all required items,
245+
// regardless they order within array.
246+
expect(result.messages).toHaveLength(5);
247+
expect(result.messages).toEqual(
248+
expect.arrayContaining([
249+
{
250+
file: path.join(__dirname, 'mixins/a.js'),
251+
type: 'dependency',
252+
parent: parent
253+
},
254+
{
255+
file: path.join(__dirname, 'mixins/b.json'),
256+
type: 'dependency',
257+
parent: parent
258+
},
259+
{
260+
file: path.join(__dirname, 'mixins/c.CSS'),
261+
type: 'dependency',
262+
parent: parent
263+
},
264+
{
265+
file: path.join(__dirname, 'mixins/d.sss'),
266+
type: 'dependency',
267+
parent: parent
268+
},
269+
{
270+
file: path.join(__dirname, 'mixins/e.pcss'),
271+
type: 'dependency',
272+
parent: parent
273+
}
274+
])
275+
);
264276
});
265277
});
266278

@@ -313,9 +325,11 @@ it('coverts mixins values', () => {
313325
}
314326
}
315327
}));
316-
return proccessor.process('a{ @mixin empty; }').then(result => {
317-
expect(typeof result.root.first.first.value).toEqual('string');
318-
});
328+
return proccessor
329+
.process('a{ @mixin empty; }', { from: undefined })
330+
.then(result => {
331+
expect(typeof result.root.first.first.value).toEqual('string');
332+
});
319333
});
320334

321335
it('supports nested mixins', () => {
@@ -358,7 +372,9 @@ it('supports default arguments in nested mixins', () => {
358372
it('works in sync mode on no option', () => {
359373
var input = '@define-mixin a { a: 1 }; @mixin a';
360374
var output = 'a: 1';
361-
expect(postcss(mixins()).process(input).css).toEqual(output);
375+
expect(
376+
postcss(mixins()).process(input, { from: undefined }).css
377+
).toEqual(output);
362378
});
363379

364380
it('cans remove unknown mixin on request', () => {

0 commit comments

Comments
 (0)