Skip to content

Commit dbd8a42

Browse files
Improve testing (#104)
1 parent c54f91d commit dbd8a42

File tree

24 files changed

+37
-5
lines changed

24 files changed

+37
-5
lines changed

.eslintignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
test
1+
/test/*/**

.github/workflows/test.yml

+3
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ jobs:
2828

2929
- name: Run tests
3030
run: npm test
31+
32+
- name: Check if generated files are up to date
33+
run: npm run diff-check

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@
33

44
# Packages
55
/node_modules
6-
7-
# Generated test files
8-
/test/*/dest

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
"test-default": "cd test/default && node ../../bin/buildozer build",
4848
"test-copy": "cd test/copy && node ../../bin/buildozer build",
4949
"test-sass-module": "cd test/sass-module && node ../../bin/buildozer build",
50-
"test-2": "cd test/config-search && node ../../bin/buildozer build"
50+
"test-config-search": "cd test/config-search && node ../../bin/buildozer build",
51+
"diff-check": "node test/check-diff.js"
5152
},
5253
"files": [
5354
"/lib",

test/check-diff.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env node
2+
3+
const {exec} = require('child_process');
4+
5+
exec('git status -s', (error, stdout) => {
6+
if (stdout) {
7+
exec('git diff', (error, stdout) => {
8+
console.log(stdout);
9+
throw new Error('Generated test files differ from git. Diff is logged above.');
10+
});
11+
}
12+
13+
if (error) {
14+
throw new Error(error);
15+
}
16+
});

test/config-search/dest/css/main.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
body{background:#00f}

test/config-search/dest/img/test.jpg

571 KB
Loading

test/config-search/dest/img/test.png

26.6 KB
Loading

test/config-search/dest/img/test.svg

+1
Loading

test/config-search/dest/js/all.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"use strict";var q=3,test=function(t){console.log(t)};test(q);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"use strict";var b=3,test2=function(t){console.log(t)};test2(b);

test/config-search/dest/js/test.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"use strict";var q=3,test=function(t){console.log(t)};test(q);

test/copy/dest/test.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello world!

test/default/dest/css/main.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/default/dest/img/test.jpg

571 KB
Loading

test/default/dest/img/test.png

26.6 KB
Loading

test/default/dest/img/test.svg

+1
Loading

test/default/dest/js/all.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/default/dest/js/concat/test.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"use strict";var q=3,test=function(t){console.log(t)};test(q);

test/default/dest/js/concat/test2.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"use strict";var b=3,test2=function(t){console.log(t)};test2(b);

test/default/dest/js/test.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"use strict";var q=3,test=function(t){console.log(t)};test(q);

test/sass-module/dest/css/main.css

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
body{color:#00f}

0 commit comments

Comments
 (0)