Skip to content

Commit

Permalink
Refactored tests
Browse files Browse the repository at this point in the history
# Conflicts:
#	gulpfile.js
#	tests/tests.bash
  • Loading branch information
Pierstoval committed Apr 9, 2017
1 parent 803ebf2 commit b00a69d
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 14 deletions.
10 changes: 5 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
There here is YOUR config
This var is an example of the assets you can use in your own application.
The array KEYS correspond to the OUTPUT files/directories,
The array VALUES contain a LIST OF SOURCE FILES
*/
* There here is YOUR config
* This var is an example of the assets you can use in your own application.
* The array KEYS correspond to the OUTPUT files/directories,
* The array VALUES contain a LIST OF SOURCE FILES
*/
const config = {

// The base output directory for all your assets
Expand Down
2 changes: 1 addition & 1 deletion tests/output_expected/css.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
body{background:#fff}
body{background:#fff}
2 changes: 1 addition & 1 deletion tests/output_expected/js.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
!function(e){e("#element").hide()}(jQuery);
!function(e){e("#element").hide()}(jQuery);
2 changes: 1 addition & 1 deletion tests/output_expected/less.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
body{border-radius:3px;color:#333}
body{border-radius:3px;color:#333}
2 changes: 1 addition & 1 deletion tests/output_expected/sass.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
body{border-radius:3px;color:#333}
body{border-radius:3px;color:#333}
4 changes: 2 additions & 2 deletions tests/prepare_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ var gulpfileContents = fs
.readFileSync(testsDir+'/../gulpfile.js')
.toString()
.replace(
/var config =(?:[^£]+)(\*)+ End config/g,
'var config = ' + JSON.stringify(config, null, 4) + ";\n"+ '/$1 End config'
/const config =(?:[^£]+)(\*+) End config \*/g,
'const config = ' + JSON.stringify(config, null, 4) + ";\n"+ '/$1 End config *'
)
;

Expand Down
16 changes: 13 additions & 3 deletions tests/tests.bash
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/bin/bash

set -e

# Go back to root project directory
cd `dirname $0`/../

echo "Directory: `pwd`"

REINSTALL=0

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

rm tests/output_tests/*
rm tests/gulpfile.js
rm -f tests/output_tests/*
test -f tests/gulpfile.js && rm tests/gulpfile.js

echo "Preparing tests..."
node tests/prepare_tests.js

echo "Executing gulp dump..."
./node_modules/.bin/gulp --gulpfile tests/gulpfile.js dump --prod
node node_modules/gulp/bin/gulp.js --gulpfile tests/gulpfile.js dump --prod

echo "Test expected files are correctly dumped"
echo -e " > css.css\c" && cmp tests/output_expected/css.css tests/output_tests/css.css && echo -e " > OK"
echo -e " > js.js\c" && cmp tests/output_expected/js.js tests/output_tests/js.js && echo -e " > OK"
echo -e " > less.css\c" && cmp tests/output_expected/less.css tests/output_tests/less.css && echo -e " > OK"
echo -e " > sass.css\c" && cmp tests/output_expected/sass.css tests/output_tests/sass.css && echo -e " > OK"

0 comments on commit b00a69d

Please sign in to comment.