Skip to content

Commit b00a69d

Browse files
committed
Refactored tests
# Conflicts: # gulpfile.js # tests/tests.bash
1 parent 803ebf2 commit b00a69d

File tree

7 files changed

+24
-14
lines changed

7 files changed

+24
-14
lines changed

gulpfile.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
2-
There here is YOUR config
3-
This var is an example of the assets you can use in your own application.
4-
The array KEYS correspond to the OUTPUT files/directories,
5-
The array VALUES contain a LIST OF SOURCE FILES
6-
*/
2+
* There here is YOUR config
3+
* This var is an example of the assets you can use in your own application.
4+
* The array KEYS correspond to the OUTPUT files/directories,
5+
* The array VALUES contain a LIST OF SOURCE FILES
6+
*/
77
const config = {
88

99
// The base output directory for all your assets

tests/output_expected/css.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
body{background:#fff}
1+
body{background:#fff}

tests/output_expected/js.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
!function(e){e("#element").hide()}(jQuery);
1+
!function(e){e("#element").hide()}(jQuery);

tests/output_expected/less.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
body{border-radius:3px;color:#333}
1+
body{border-radius:3px;color:#333}

tests/output_expected/sass.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
body{border-radius:3px;color:#333}
1+
body{border-radius:3px;color:#333}

tests/prepare_tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ var gulpfileContents = fs
3232
.readFileSync(testsDir+'/../gulpfile.js')
3333
.toString()
3434
.replace(
35-
/var config =(?:[^£]+)(\*)+ End config/g,
36-
'var config = ' + JSON.stringify(config, null, 4) + ";\n"+ '/$1 End config'
35+
/const config =(?:[^£]+)(\*+) End config \*/g,
36+
'const config = ' + JSON.stringify(config, null, 4) + ";\n"+ '/$1 End config *'
3737
)
3838
;
3939

tests/tests.bash

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#!/bin/bash
22

3+
set -e
4+
35
# Go back to root project directory
46
cd `dirname $0`/../
57

8+
echo "Directory: `pwd`"
9+
610
REINSTALL=0
711

812
while test $# -gt 0
@@ -23,11 +27,17 @@ if [[ ${REINSTALL} == 1 ]]; then
2327
npm install
2428
fi
2529

26-
rm tests/output_tests/*
27-
rm tests/gulpfile.js
30+
rm -f tests/output_tests/*
31+
test -f tests/gulpfile.js && rm tests/gulpfile.js
2832

2933
echo "Preparing tests..."
3034
node tests/prepare_tests.js
3135

3236
echo "Executing gulp dump..."
33-
./node_modules/.bin/gulp --gulpfile tests/gulpfile.js dump --prod
37+
node node_modules/gulp/bin/gulp.js --gulpfile tests/gulpfile.js dump --prod
38+
39+
echo "Test expected files are correctly dumped"
40+
echo -e " > css.css\c" && cmp tests/output_expected/css.css tests/output_tests/css.css && echo -e " > OK"
41+
echo -e " > js.js\c" && cmp tests/output_expected/js.js tests/output_tests/js.js && echo -e " > OK"
42+
echo -e " > less.css\c" && cmp tests/output_expected/less.css tests/output_tests/less.css && echo -e " > OK"
43+
echo -e " > sass.css\c" && cmp tests/output_expected/sass.css tests/output_tests/sass.css && echo -e " > OK"

0 commit comments

Comments
 (0)