-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the test runner for JS tests
PhantomJS is not maintained anymore and the setup was broken. The new setup uses `@web/test-runner` to run the QUnit tests in an actual browser.
- Loading branch information
Showing
5 changed files
with
51 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,7 @@ env: | |
jobs: | ||
test: | ||
name: PHP ${{ matrix.php-version }} + Symfony ${{ matrix.symfony-version }} | ||
# TODO find a different setup for the JS testsuite as phantomjs is abandoned and is not available on newer runner images | ||
runs-on: 'ubuntu-20.04' | ||
runs-on: 'ubuntu-latest' | ||
continue-on-error: ${{ matrix.allowed-to-fail }} | ||
|
||
strategy: | ||
|
@@ -44,7 +43,7 @@ jobs: | |
symfony-version: latest | ||
steps: | ||
- name: "Checkout code" | ||
uses: actions/checkout@v2.3.3 | ||
uses: actions/checkout@v4.1.7 | ||
|
||
- name: "Install PHP with extensions" | ||
uses: shivammathur/[email protected] | ||
|
@@ -77,8 +76,23 @@ jobs: | |
- name: "Run unit tests" | ||
run: vendor/bin/phpunit --coverage-text --verbose | ||
|
||
- name: "Run phantomjs tests" | ||
run: phantomjs Resources/js/run-qunit.js file://`pwd`/Resources/js/index.html | ||
test_js: | ||
name: JS tests | ||
runs-on: ubuntu-latest | ||
|
||
- name: "Run phantomjs tests ES5" | ||
run: phantomjs Resources/js/run-qunit.js file://`pwd`/Resources/js/index-with-es5-shim.html | ||
steps: | ||
- name: "Checkout code" | ||
uses: actions/[email protected] | ||
|
||
- name: "Setup node" | ||
uses: actions/[email protected] | ||
with: | ||
node-version: 'lts/*' | ||
|
||
- name: "Install dependencies" | ||
run: npm install | ||
working-directory: Resources | ||
|
||
- name: "Run tests" | ||
run: npm tests | ||
working-directory: Resources |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export default { | ||
nodeResolve: true, | ||
// Our QUnit tests expect the translator to be loaded globally so we need to inject it in the runner HTML | ||
testRunnerHtml: testFramework => | ||
` | ||
<!DOCTYPE html> | ||
<html lang="fr"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSTranslationBundle Unit Tests</title> | ||
<script src="node_modules/intl-messageformat/intl-messageformat.iife.js"></script> | ||
<script src="js/translator.js"></script> | ||
</head> | ||
<body> | ||
<script type="module" src="${testFramework}"></script> | ||
</body> | ||
</html> | ||
`, | ||
testFramework: { | ||
path: './node_modules/web-test-runner-qunit/dist/autorun.js', | ||
config: {} | ||
} | ||
} |