@@ -77,21 +77,58 @@ jobs:
77
77
- name : Build
78
78
run : npm run build
79
79
80
- - name : Run css-typed (the test)
81
- # `node dist/main.js` is executing local `css-typed` as if installed (same as `bin`)
82
- # Use `-I '//.*'` to ignore the first line (comment) which has generated path and timestamp
83
- # Test `--localsConvention` in both positions
80
+ # Run tests
81
+ #
82
+ # - Run from $RUNNER_TEMP for auto-cleanup.
83
+ # - `./dist/main.js` is executing local `css-typed` as if installed (same as `bin`).
84
+ # But it is `$GITHUB_WORKSPACE/dist/main.js` b/c we `cd $RUNNER_TEMP`.
85
+ # - Use `diff` to compare the files.
86
+ # Use `-I '//.*'` to ignore the first line (comment) which has generated path and timestamp.
87
+
88
+ - name : " Test 1: Default case"
84
89
run : |
85
- cp src/fixtures/casing/casing.css "$RUNNER_TEMP/casing.css"
90
+ cp src/fixtures/casing/casing.css $RUNNER_TEMP/casing.css
91
+ cp src/fixtures/casing/dashesOnly.d.css.ts $RUNNER_TEMP/expected.d.css.ts
86
92
87
- node dist/main.js "$RUNNER_TEMP/*.css"
88
- diff --strip-trailing-cr -uI '//.*' src/fixtures/casing/dashesOnly.d.css.ts "$RUNNER_TEMP/casing.d.css.ts"
93
+ cd $RUNNER_TEMP
94
+ $GITHUB_WORKSPACE/dist/main.js '*.css'
95
+ diff --strip-trailing-cr -uI '//.*' expected.d.css.ts casing.d.css.ts
89
96
90
- node dist/main.js "$RUNNER_TEMP/*.css" --localsConvention camelCaseOnly
91
- diff --strip-trailing-cr -uI '//.*' src/fixtures/casing/camelCaseOnly.d.css.ts "$RUNNER_TEMP/casing.d.css.ts"
97
+ - name : " Test 2: localsConvention, second position"
98
+ run : |
99
+ cp src/fixtures/casing/casing.css $RUNNER_TEMP/casing.css
100
+ cp src/fixtures/casing/camelCaseOnly.d.css.ts $RUNNER_TEMP/expected.d.css.ts
101
+
102
+ cd $RUNNER_TEMP
103
+ $GITHUB_WORKSPACE/dist/main.js '*.css' --localsConvention camelCaseOnly
104
+ diff --strip-trailing-cr -uI '//.*' expected.d.css.ts casing.d.css.ts
105
+
106
+ - name : " Test 3: localsConvention, first position"
107
+ run : |
108
+ cp src/fixtures/casing/casing.css $RUNNER_TEMP/casing.css
109
+ cp src/fixtures/casing/camelCaseOnly.d.css.ts $RUNNER_TEMP/expected.d.css.ts
110
+
111
+ cd $RUNNER_TEMP
112
+ $GITHUB_WORKSPACE/dist/main.js --localsConvention camelCaseOnly '*.css'
113
+ diff --strip-trailing-cr -uI '//.*' expected.d.css.ts casing.d.css.ts
114
+
115
+ - name : " Test 4: relative outdir"
116
+ run : |
117
+ cp src/fixtures/casing/casing.css $RUNNER_TEMP/casing.css
118
+ cp src/fixtures/casing/dashesOnly.d.css.ts $RUNNER_TEMP/expected.d.css.ts
119
+
120
+ cd $RUNNER_TEMP
121
+ $GITHUB_WORKSPACE/dist/main.js '*.css' --outdir generated
122
+ diff --strip-trailing-cr -uI '//.*' expected.d.css.ts generated/casing.d.css.ts
123
+
124
+ - name : " Test 5: absolute outdir"
125
+ run : |
126
+ cp src/fixtures/casing/casing.css $RUNNER_TEMP/casing.css
127
+ cp src/fixtures/casing/dashesOnly.d.css.ts $RUNNER_TEMP/expected.d.css.ts
92
128
93
- node dist/main.js --localsConvention camelCaseOnly "$RUNNER_TEMP/*.css"
94
- diff --strip-trailing-cr -uI '//.*' src/fixtures/casing/camelCaseOnly.d.css.ts "$RUNNER_TEMP/casing.d.css.ts"
129
+ cd $RUNNER_TEMP
130
+ $GITHUB_WORKSPACE/dist/main.js '*.css' -o $GITHUB_WORKSPACE/generated
131
+ diff --strip-trailing-cr -uI '//.*' expected.d.css.ts $GITHUB_WORKSPACE/generated/casing.d.css.ts
95
132
96
133
Publish :
97
134
if : ${{ github.ref == 'refs/heads/main' }}
0 commit comments