Skip to content

Commit

Permalink
[FEATURE] Introduce UnitTests for JavaScript
Browse files Browse the repository at this point in the history
This patch introduce UnitTests for JavaSscript.
It uses karma as test runner and jasmine as testing framework.
The tests running on travis with PhantomJS. Locally other browsers like Chrome,
Firefox, Safari or IE can be used as well.

Resolves: #76590
Releases: master
Change-Id: I171ed5f50943f8c30d71c7035b86814cf9cbcbbe
Reviewed-on: https://review.typo3.org/48557
Reviewed-by: Andreas Fernandez <[email protected]>
Tested-by: Andreas Fernandez <[email protected]>
Reviewed-by: Susanne Moog <[email protected]>
Tested-by: Susanne Moog <[email protected]>
  • Loading branch information
NeoBlack authored and susannemoog committed Jun 20, 2016
1 parent 577886f commit ba0ffe3
Show file tree
Hide file tree
Showing 9 changed files with 726 additions and 15 deletions.
41 changes: 27 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
language: php

node_js:
- "0.10"

matrix:
fast_finish: true

include:
- php: 7
env: UNIT_TESTS=yes FUNCTIONAL_TESTS=yes ACCEPTANCE_TESTS=no PHP_LINT=yes XLF_CHECK=yes SUBMODULE_TEST=yes EXCEPTIONCODE_TEST=yes
env: UNIT_TESTS=yes FUNCTIONAL_TESTS=yes ACCEPTANCE_TESTS=no JSUNIT_TESTS=yes PHP_LINT=yes XLF_CHECK=yes SUBMODULE_TEST=yes EXCEPTIONCODE_TEST=yes

sudo: false

Expand Down Expand Up @@ -61,6 +64,10 @@ before_script:
- export typo3DatabaseUsername="root"
- export typo3DatabasePassword=""

before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

script:
- >
if [[ "$UNIT_TESTS" == "yes" ]]; then
Expand All @@ -69,35 +76,41 @@ script:
- >
if [[ "$FUNCTIONAL_TESTS" == "yes" ]]; then
find . -wholename '*typo3/sysext/*/Tests/Functional/*Test.php' | parallel --jobs 6 --gnu 'echo; echo "Running functional test suite {}"; ./bin/phpunit -c typo3/sysext/core/Build/FunctionalTests.xml {}'
find . -wholename '*typo3/sysext/*/Tests/Functional/*Test.php' | parallel --jobs 6 --gnu 'echo; echo "Running functional test suite {}"; ./bin/phpunit -c typo3/sysext/core/Build/FunctionalTests.xml {}'
fi
- >
if [[ "$ACCEPTANCE_TESTS" == "yes" ]]; then
./bin/codecept run Acceptance -c typo3/sysext/core/Build/AcceptanceTests.yml --debug
./bin/codecept run Acceptance -c typo3/sysext/core/Build/AcceptanceTests.yml --debug
fi
- >
if [[ "$JSUNIT_TESTS" == "yes" ]]; then
cd Build && npm install && cd ..
./Build/node_modules/karma/bin/karma start typo3/sysext/core/Build/Configuration/JSUnit/karma.conf.js --single-run
fi
- >
if [[ "$PHP_LINT" == "yes" ]]; then
find typo3/ -name \*.php -not -path "vendor/*" | parallel --jobs 6 --gnu php -d display_errors=stderr -l {} > /dev/null \;
find typo3/ -name \*.php -not -path "vendor/*" | parallel --jobs 6 --gnu php -d display_errors=stderr -l {} > /dev/null \;
fi
- >
if [[ "$XLF_CHECK" == "yes" ]]; then
./typo3/sysext/core/Build/Scripts/xlfcheck.sh
./typo3/sysext/core/Build/Scripts/xlfcheck.sh
fi
- >
if [[ "$SUBMODULE_TEST" == "yes" ]]; then
/bin/bash -c "
if [[ `git submodule status 2>&1 | wc -l` -ne 0 ]]; then
echo \"Found a submodule definition in repository\";
exit 99;
fi
"
fi
if [[ "$SUBMODULE_TEST" == "yes" ]]; then
/bin/bash -c "
if [[ `git submodule status 2>&1 | wc -l` -ne 0 ]]; then
echo \"Found a submodule definition in repository\";
exit 99;
fi
"
fi
- >
if [[ "$EXCEPTIONCODE_TEST" == "yes" ]]; then
./typo3/sysext/core/Build/Scripts/duplicateExceptionCodeCheck.sh
./typo3/sysext/core/Build/Scripts/duplicateExceptionCodeCheck.sh
fi
14 changes: 13 additions & 1 deletion Build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,21 @@
"grunt-contrib-less": "~1.0.0",
"grunt-contrib-uglify": "0.9.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-copy": "*",
"grunt-npm-install": "^0.2.0",
"grunt-postcss": "^0.7.1",
"grunt-svgmin": "2.0.1",
"grunt-copy": "*"
"jasmine-core": "^2.4.1",
"karma": "^0.13.22",
"karma-chrome-launcher": "^1.0.1",
"karma-firefox-launcher": "^1.0.0",
"karma-ie-launcher": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-opera-launcher": "^1.0.0",
"karma-phantomjs-launcher": "^1.0.0",
"karma-requirejs": "^1.0.0",
"karma-safari-launcher": "^1.0.0",
"phantomjs-prebuilt": "^2.1.7",
"requirejs": "^2.2.0"
}
}
Loading

0 comments on commit ba0ffe3

Please sign in to comment.