Skip to content

Commit 1ffd365

Browse files
authored
Merge pull request #12 from jedmao/updates
Gut gulp, introduce ava
2 parents 98d960f + 2cdd5d7 commit 1ffd365

20 files changed

+109
-247
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ indent_style = tab
55
end_of_line = lf
66
trim_trailing_whitespace = true
77
insert_final_newline = true
8+
9+
[{package.json,*.yml}]
10+
indent_style = space
11+
indent_size = 2

.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
*.log
2-
.vs/
3-
build/**/*.js
4-
build/**/*.ts
5-
coverage/
6-
dist/
7-
node_modules/
1+
*.log
2+
.vscode/
3+
dist/
4+
node_modules/

.istanbul.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.npmignore

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
1-
.*
2-
!.d.ts
3-
*.sln*
4-
*.suo
5-
build/
6-
coverage/
7-
lib/
8-
test/
9-
!dist/lib
10-
!dist/d.ts/lib
11-
scripts/
12-
typings/chai/
13-
typings/mocha/
14-
typings/sinon/
15-
typings/sinon-chai/
16-
appveyor.yml
17-
gulpfile.babel.js
18-
jsconfig.json
19-
tsconfig.json
20-
tsd.json
21-
tslint.json
1+
.*
2+
lib/
3+
test/
4+
!dist/lib
5+
appveyor.yml
6+
jsconfig.json
7+
tsconfig.json
8+
tslint.json

.tasks/gulp-clean.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

.tasks/gulp-copy.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

.tasks/gulp-tslint.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ language: node_js
22

33
node_js:
44
- "node"
5-
- "4"
5+
- "6"
66

77
notifications:
88
email:

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ postcss([ require('postcss-nested-props') ]);
7575
### TypeScript
7676

7777
```ts
78-
///<reference path="node_modules/postcss-nested-props/.d.ts" />
7978
import * as postcssNestedProps from 'postcss-nested-props';
8079

8180
postcss([ postcssNestedProps ]);

build/.eslintrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

build/test/.eslintrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

gulpfile.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

jsconfig.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

package.json

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,25 @@
33
"version": "1.1.5",
44
"description": "PostCSS plugin to unwrap nested properties.",
55
"main": "dist/lib/plugin.js",
6-
"typings": "dist/lib/plugin.d.ts",
6+
"types": "dist/lib/plugin.d.ts",
77
"scripts": {
8-
"prepublish": "gulp && npm run tsc && gulp copy",
8+
"ava": "ava",
9+
"build": "npm run tsc",
10+
"build:watch": "npm run tsc -- --watch",
11+
"lint": "npm run tslint",
12+
"prepublish": "npm run lint && npm run build",
913
"tsc": "tsc",
10-
"test": "gulp && npm run tsc && npm run mocha",
11-
"mocha": "mocha",
12-
"watch": "sh scripts/watch"
14+
"test": "npm run tsc && npm run ava",
15+
"test:watch": "npm run ava -- --watch",
16+
"tslint": "tslint --project tsconfig.json"
17+
},
18+
"ava": {
19+
"files": [
20+
"dist/test/**/*.js"
21+
],
22+
"source": [
23+
"dist/**/*.js"
24+
]
1325
},
1426
"repository": {
1527
"type": "git",
@@ -31,39 +43,14 @@
3143
},
3244
"homepage": "https://github.com/jedmao/postcss-nested-props#readme",
3345
"dependencies": {
34-
"postcss": "^5.2.11",
46+
"postcss": "^5.2.15",
3547
"pseudo-classes": "^1.0.0",
3648
"pseudo-elements": "^1.0.0"
3749
},
3850
"devDependencies": {
39-
"@types/chai": "^3.4.34",
40-
"@types/glob": "^5.0.30",
41-
"@types/glob-stream": "^3.1.30",
42-
"@types/gulp": "^3.8.32",
43-
"@types/minimatch": "^2.0.29",
44-
"@types/mocha": "^2.2.38",
45-
"@types/node": "^7.0.0",
46-
"@types/orchestrator": "0.0.30",
47-
"@types/q": "0.0.32",
48-
"@types/sinon": "^1.16.34",
49-
"@types/sinon-chai": "^2.7.27",
50-
"@types/vinyl": "^2.0.0",
51-
"@types/vinyl-fs": "0.0.28",
52-
"chai": "^3.5.0",
53-
"gulp": "^3.9.1",
54-
"gulp-filter": "^5.0.0",
55-
"gulp-istanbul": "^1.1.1",
56-
"gulp-mocha": "^3.0.1",
57-
"gulp-plumber": "^1.1.0",
58-
"gulp-rimraf": "^0.2.1",
59-
"gulp-tslint": "^7.0.1",
60-
"gulp-typescript": "^3.1.4",
61-
"istanbul": "^0.4.5",
62-
"merge2": "^1.0.3",
63-
"mocha": "^3.2.0",
64-
"through2": "^2.0.3",
65-
"ts-node": "^2.0.0",
66-
"tslint": "^4.3.1",
67-
"typescript": "^2.1.5"
51+
"@types/node": "^7.0.5",
52+
"ava": "^0.18.2",
53+
"tslint": "^4.4.2",
54+
"typescript": "^2.2.1"
6855
}
6956
}

scripts/watch

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/mocha.opts

Lines changed: 0 additions & 5 deletions
This file was deleted.

test/plugin.ts

Lines changed: 56 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,73 @@
1-
import { expect } from 'chai';
2-
import * as plugin from '../lib/plugin';
3-
import * as postcss from 'postcss';
1+
import test, { ContextualTestContext } from 'ava';
2+
import * as postcss from 'postcss';
43
const pseudoClasses = require('pseudo-classes');
54
const pseudoElements = require('pseudo-elements');
65

7-
describe('postcss-nested-props plugin', () => {
6+
import * as plugin from '../lib/plugin';
87

9-
it('unwraps a nested property', () => {
10-
check(
11-
'a{b:{c:d}}',
12-
'a{b-c:d}'
13-
);
14-
});
8+
test('unwraps a nested property', scenario(
9+
'a{b:{c:d}}',
10+
'a{b-c:d}'
11+
));
1512

16-
it('unwraps a deeply nested property', () => {
17-
check(
18-
'a{b:{c:{d:{e:{f:g}}}}}',
19-
'a{b-c-d-e-f:g}'
20-
);
21-
});
13+
test('unwraps a deeply nested property', scenario(
14+
'a{b:{c:{d:{e:{f:g}}}}}',
15+
'a{b-c-d-e-f:g}'
16+
));
2217

23-
it('unwraps two nested properties in the same rule', () => {
24-
check(
25-
'a{b:{c:{d:e}}f:{g:{h:i}}}',
26-
'a{b-c-d:e;f-g-h:i}'
27-
);
28-
});
18+
test('unwraps two nested properties in the same rule', scenario(
19+
'a{b:{c:{d:e}}f:{g:{h:i}}}',
20+
'a{b-c-d:e;f-g-h:i}'
21+
));
2922

30-
it('unwraps a property namespace paired with a value', () => {
31-
check(
32-
'a{b:c{d:e}}',
33-
'a{b:c;b-d:e}'
34-
);
35-
});
23+
test('unwraps a property namespace paired with a value', scenario(
24+
'a{b:c{d:e}}',
25+
'a{b:c;b-d:e}'
26+
));
3627

37-
it('preserves nested rules w/o a colon in the selector', () => {
38-
check(
39-
'a{b{c{d:e}}}',
40-
'a{b{c{d:e}}}'
41-
);
42-
});
28+
test('preserves nested rules w/o a colon in the selector', scenario(
29+
'a{b{c{d:e}}}',
30+
'a{b{c{d:e}}}'
31+
));
4332

44-
it('preserves a rule with a :global pseudo-selector', () => {
45-
check(
46-
`:global .a{b:c;d:e;}`,
47-
`:global .a{b:c;d:e;}`
48-
);
49-
});
33+
test('preserves a rule with a :global pseudo-selector', scenario(
34+
`:global .a{b:c;d:e;}`,
35+
`:global .a{b:c;d:e;}`
36+
));
5037

51-
it('preserves a rule with a :local pseudo-selector', () => {
52-
check(
53-
`:local .a{b:c;d:e;}`,
54-
`:local .a{b:c;d:e;}`
55-
);
56-
});
38+
test('preserves a rule with a :local pseudo-selector', scenario(
39+
`:local .a{b:c;d:e;}`,
40+
`:local .a{b:c;d:e;}`
41+
));
5742

58-
describe('pseudo classes', () => {
59-
pseudoClasses().forEach((pseudoClass: string) => {
60-
it(`preserves the :${pseudoClass}() pseudo-class`, () => {
61-
check(
62-
`a{b:${pseudoClass}(c){d:e}}`,
63-
`a{b:${pseudoClass}(c){d:e}}`
64-
);
65-
});
66-
});
67-
});
68-
69-
describe('pseudo elements', () => {
70-
pseudoElements().forEach((pseudoElement: string) => {
71-
it(`preserves the ::${pseudoElement} pseudo-element`, () => {
72-
check(
73-
`a{b::${pseudoElement}{c:d}}`,
74-
`a{b::${pseudoElement}{c:d}}`
75-
);
76-
});
77-
});
78-
});
43+
pseudoClasses().forEach((pseudoClass: string) => {
44+
test(`preserves the :${pseudoClass}() pseudo-class`, scenario(
45+
`a{b:${pseudoClass}(c){d:e}}`,
46+
`a{b:${pseudoClass}(c){d:e}}`
47+
));
48+
});
7949

80-
describe('vendor pseudo elements', () => {
81-
[
82-
'-ms-clear',
83-
'-webkit-progress-bar',
84-
'-moz-focus-outer'
85-
].forEach(vendorPseudoElement => {
86-
it(`preserves the ::${vendorPseudoElement} pseudo-element`, () => {
87-
check(
88-
`a{b::${vendorPseudoElement}{c:d}}`,
89-
`a{b::${vendorPseudoElement}{c:d}}`
90-
);
91-
});
92-
});
93-
});
50+
pseudoElements().forEach((pseudoElement: string) => {
51+
test(`preserves the ::${pseudoElement} pseudo-element`, scenario(
52+
`a{b::${pseudoElement}{c:d}}`,
53+
`a{b::${pseudoElement}{c:d}}`
54+
));
55+
});
9456

57+
[
58+
'-ms-clear',
59+
'-webkit-progress-bar',
60+
'-moz-focus-outer'
61+
].forEach(vendorPseudoElement => {
62+
test(`preserves the ::${vendorPseudoElement} pseudo-element`, scenario(
63+
`a{b::${vendorPseudoElement}{c:d}}`,
64+
`a{b::${vendorPseudoElement}{c:d}}`
65+
));
9566
});
9667

97-
function check(input: string, output: string) {
68+
function scenario(input: string, expectedOutput: string) {
9869
const processor = postcss([plugin()]);
99-
expect(processor.process(input).css).to.equal(output);
70+
return (t: ContextualTestContext) => {
71+
t.is(processor.process(input).css, expectedOutput);
72+
};
10073
}

0 commit comments

Comments
 (0)