Commit 99fa00f 0 parents commit 99fa00f Copy full SHA for 99fa00f
File tree 14 files changed +4966
-0
lines changed
14 files changed +4966
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ # Created by https://www.gitignore.io/api/node
3
+
4
+ # ## Node ###
5
+ # Logs
6
+ logs
7
+ * .log
8
+ npm-debug.log *
9
+ yarn-debug.log *
10
+ yarn-error.log *
11
+
12
+ # Runtime data
13
+ pids
14
+ * .pid
15
+ * .seed
16
+ * .pid.lock
17
+
18
+ # Directory for instrumented libs generated by jscoverage/JSCover
19
+ lib-cov
20
+
21
+ # Coverage directory used by tools like istanbul
22
+ coverage
23
+
24
+ # nyc test coverage
25
+ .nyc_output
26
+
27
+ # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
28
+ .grunt
29
+
30
+ # Bower dependency directory (https://bower.io/)
31
+ bower_components
32
+
33
+ # node-waf configuration
34
+ .lock-wscript
35
+
36
+ # Compiled binary addons (http://nodejs.org/api/addons.html)
37
+ build /Release
38
+
39
+ # Dependency directories
40
+ node_modules /
41
+ jspm_packages /
42
+
43
+ # Typescript v1 declaration files
44
+ typings /
45
+
46
+ # Optional npm cache directory
47
+ .npm
48
+
49
+ # Optional eslint cache
50
+ .eslintcache
51
+
52
+ # Optional REPL history
53
+ .node_repl_history
54
+
55
+ # Output of 'npm pack'
56
+ * .tgz
57
+
58
+ # Yarn Integrity file
59
+ .yarn-integrity
60
+
61
+ # dotenv environment variables file
62
+ .env
63
+
64
+
65
+ # End of https://www.gitignore.io/api/node
Original file line number Diff line number Diff line change
1
+ language : node_js
2
+
3
+ node_js :
4
+ - " node"
5
+ - " lts/*"
6
+
7
+ install :
8
+ - yarn
9
+
10
+ cache :
11
+ directories :
12
+ - " node_modules"
13
+ - ~/.npm
14
+
15
+ notifications :
16
+ email : false
17
+
18
+ jobs :
19
+ include :
20
+ - stage : test
21
+ script :
22
+ - yarn test
23
+ after_success :
24
+ - bash <(curl -s https://codecov.io/bash)
25
+ - stage : release
26
+ script :
27
+ - npm run release
28
+ after_sucess : skip
29
+
30
+ stages :
31
+ - test
32
+ - name : release
33
+ if : branch = master AND type = push AND fork = false
34
+
35
+ branches :
36
+ except :
37
+ - /^v\d+\.\d+\.\d+$/
Original file line number Diff line number Diff line change
1
+ [ ![ Build Status] ( https://travis-ci.org/keplersj/jest-runner-stylelint.svg?branch=master )] ( https://travis-ci.org/keplersj/jest-runner-stylelint )
2
+ [ ![ npm version] ( https://badge.fury.io/js/jest-runner-stylelint.svg )] ( https://badge.fury.io/js/jest-runner-stylelint )
3
+ [ ![ codecov] ( https://codecov.io/gh/keplersj/jest-runner-stylelint/branch/master/graph/badge.svg )] ( https://codecov.io/gh/keplersj/jest-runner-stylelint )
4
+
5
+ <div align =" center " >
6
+ <!-- replace with accurate logo e.g from https://worldvectorlogo.com/ -->
7
+ <a href =" https://stylelint.io/ " >
8
+ <img width="150" height="150" vspace="" hspace="25" src="https://cdn.worldvectorlogo.com/logos/stylelint.svg">
9
+ </a >
10
+ <a href =" https://facebook.github.io/jest/ " >
11
+ <img width="150" height="150" vspace="" hspace="25" src="https://cdn.worldvectorlogo.com/logos/jest.svg">
12
+ </a >
13
+ <h1 >jest-runner-prettier</h1 >
14
+ <p >Prettier runner for Jest</p >
15
+ </div >
16
+
17
+ <div align =" center " >
18
+ <!-- <img src="https://user-images.githubusercontent.com/574806/30197438-9681385c-941c-11e7-80a8-2b11f15bd412.gif">-->
19
+ <!-- TODO: Create GIF showing off runner -->
20
+ </div >
21
+
22
+ ## Usage
23
+
24
+ ### Install
25
+
26
+ Install ` jest ` _ (it needs Jest 21+)_ and ` jest-runner-stylelint `
27
+
28
+ ``` bash
29
+ yarn add --dev jest jest-runner-stylelint
30
+
31
+ # or with NPM
32
+
33
+ npm install --save-dev jest jest-runner-stylelint
34
+ ```
35
+
36
+ ### Add it to your Jest config
37
+
38
+ In your ` package.json `
39
+
40
+ ``` json
41
+ {
42
+ "jest" : {
43
+ "runner" : " jest-runner-stylelint" ,
44
+ "moduleFileExtensions" : [
45
+ " css"
46
+ ],
47
+ "testMatch" : [
48
+ " **/*.css"
49
+ ]
50
+ }
51
+ }
52
+ ```
53
+
54
+ Or in ` jest.config.js `
55
+
56
+ ``` js
57
+ module .exports = {
58
+ runner: " jest-runner-stylelint" ,
59
+ moduleFileExtensions: [
60
+ " css"
61
+ ],
62
+ testMatch: [
63
+ " **/*.css"
64
+ ]
65
+ };
66
+ ```
67
+
68
+ ### Run Jest
69
+
70
+ ``` bash
71
+ yarn jest
72
+ ```
Original file line number Diff line number Diff line change
1
+ module . exports = { extends : [ "@commitlint/config-conventional" ] } ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " jest-runner-stylelint" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " Stylelint runner for Jest" ,
5
+ "main" : " src/index.js" ,
6
+ "repository" : " https://github.com/keplersj/jest-runner-stylelint" ,
7
+ "author" :
" Kepler Sticka-Jones <[email protected] >" ,
8
+ "license" : " MIT" ,
9
+ "private" : false ,
10
+ "scripts" : {
11
+ "test" : " jest" ,
12
+ "commitmsg" : " commitlint -e $GIT_PARAMS" ,
13
+ "precommit" : " lint-staged" ,
14
+ "release" : " semantic-release"
15
+ },
16
+ "lint-staged" : {
17
+ "*" : [" jest --bail --findRelatedTests" ]
18
+ },
19
+ "release" : {
20
+ "verifyConditions" : " @semantic-release/github"
21
+ },
22
+ "jest" : {
23
+ "collectCoverage" : true
24
+ },
25
+ "dependencies" : {
26
+ "create-jest-runner" : " ^0.1.1" ,
27
+ "stylelint" : " ^8.3.1"
28
+ },
29
+ "devDependencies" : {
30
+ "@commitlint/cli" : " ^5.1.1" ,
31
+ "@commitlint/config-conventional" : " ^5.1.3" ,
32
+ "husky" : " ^0.14.3" ,
33
+ "jest" : " ^21.2.1" ,
34
+ "lint-staged" : " ^5.0.0" ,
35
+ "semantic-release" : " 11" ,
36
+ "stylelint-config-standard" : " ^18.0.0"
37
+ }
38
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends" : [" config:base" ],
3
+ "automerge" : true ,
4
+ "automergeType" : " branch-push" ,
5
+ "major" : {
6
+ "automerge" : false
7
+ }
8
+ }
Original file line number Diff line number Diff line change
1
+ img {
2
+ width : 0px ;
3
+ height : 0px ;
4
+ }
Original file line number Diff line number Diff line change
1
+ img {
2
+ width : 0 ;
3
+ height : 0 ;
4
+ }
Original file line number Diff line number Diff line change
1
+ module . exports = {
2
+ extends : "stylelint-config-standard"
3
+ } ;
Original file line number Diff line number Diff line change
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports [` jest-runner-stylelint failing fixture matches snapshot 1` ] = `
4
+ Object {
5
+ " console" : null ,
6
+ " failureMessage" : "
7
+ [4msrc/__fixtures__/bad.css[24m
8
+ [2m2 :11 [22m [31m [31m ✖[31m [39m Unexpected unit [2mlength - zero - no - unit [22m
9
+ [2m3 :12 [22m [31m [31m ✖[31m [39m Unexpected unit [2mlength - zero - no - unit [22m
10
+ [2m4 :1 [22m [31m [31m ✖[31m [39m Unexpected missing end - of - source newline [2mno - missing - end - of - source - newline [22m
11
+
12
+ " ,
13
+ " numFailingTests" : 1 ,
14
+ " numPassingTests" : 0 ,
15
+ " numPendingTests" : 0 ,
16
+ " skipped" : undefined ,
17
+ " snapshot" : Object {
18
+ " added" : 0 ,
19
+ " fileDeleted" : false ,
20
+ " matched" : 0 ,
21
+ " unchecked" : 0 ,
22
+ " unmatched" : 0 ,
23
+ " updated" : 0 ,
24
+ },
25
+ " sourceMaps" : Object {},
26
+ " testExecError" : null ,
27
+ " testResults" : Array [
28
+ Object {
29
+ " ancestorTitles" : Array [],
30
+ " failureMessages" : Array [
31
+ "
32
+ [4msrc/__fixtures__/bad.css[24m
33
+ [2m2 :11 [22m [31m [31m ✖[31m [39m Unexpected unit [2mlength - zero - no - unit [22m
34
+ [2m3 :12 [22m [31m [31m ✖[31m [39m Unexpected unit [2mlength - zero - no - unit [22m
35
+ [2m4 :1 [22m [31m [31m ✖[31m [39m Unexpected missing end - of - source newline [2mno - missing - end - of - source - newline [22m
36
+
37
+ " ,
38
+ ],
39
+ " fullName" : undefined ,
40
+ " numPassingAsserts" : 1 ,
41
+ " status" : " failed" ,
42
+ " title" : " " ,
43
+ },
44
+ ],
45
+ }
46
+ ` ;
47
+
48
+ exports[` jest - runner - stylelint passing fixture matches snapshot 1 ` ] = `
49
+ Object {
50
+ " console" : null ,
51
+ " failureMessage" : undefined ,
52
+ " numFailingTests" : 0 ,
53
+ " numPassingTests" : 1 ,
54
+ " numPendingTests" : 0 ,
55
+ " skipped" : undefined ,
56
+ " snapshot" : Object {
57
+ " added" : 0 ,
58
+ " fileDeleted" : false ,
59
+ " matched" : 0 ,
60
+ " unchecked" : 0 ,
61
+ " unmatched" : 0 ,
62
+ " updated" : 0 ,
63
+ },
64
+ " sourceMaps" : Object {},
65
+ " testExecError" : null ,
66
+ " testResults" : Array [
67
+ Object {
68
+ " ancestorTitles" : Array [],
69
+ " failureMessages" : Array [
70
+ undefined ,
71
+ ],
72
+ " fullName" : undefined ,
73
+ " numPassingAsserts" : 0 ,
74
+ " status" : " passed" ,
75
+ " title" : " " ,
76
+ },
77
+ ],
78
+ }
79
+ ` ;
Original file line number Diff line number Diff line change
1
+ const { createJestRunner } = require ( "create-jest-runner" ) ;
2
+ module . exports = createJestRunner ( require . resolve ( "./run" ) ) ;
Original file line number Diff line number Diff line change
1
+ const { pass, fail } = require ( "create-jest-runner" ) ;
2
+ const stylelint = require ( "stylelint" ) ;
3
+
4
+ module . exports = ( { testPath, config, globalConfig } ) => {
5
+ const start = new Date ( ) ;
6
+
7
+ return stylelint
8
+ . lint ( {
9
+ files : testPath ,
10
+ formatter : "string"
11
+ } )
12
+ . then ( data => {
13
+ if ( data . errored ) {
14
+ return fail ( {
15
+ start,
16
+ end : new Date ( ) ,
17
+ test : {
18
+ path : testPath ,
19
+ errorMessage : data . output
20
+ }
21
+ } ) ;
22
+ }
23
+
24
+ return pass ( {
25
+ start,
26
+ end : new Date ( ) ,
27
+ test : { path : testPath }
28
+ } ) ;
29
+ } )
30
+ . catch ( err => {
31
+ throw err ;
32
+ } ) ;
33
+ } ;
You can’t perform that action at this time.
0 commit comments