Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .github/workflows/reusable-javascript-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ name: JavaScript tests

on:
workflow_call:
inputs:
disable-apparmor:
description: 'Whether to disable AppArmor.'
required: false
type: 'boolean'
default: false

# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
Expand Down Expand Up @@ -55,15 +49,6 @@ jobs:
- name: Install npm Dependencies
run: npm ci

# Older branches using outdated versions of Puppeteer fail on newer versions of the `ubuntu-24` image.
# This disables AppArmor in order to work around those failures.
#
# See https://issues.chromium.org/issues/373753919
# and https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
- name: Disable AppArmor
if: ${{ inputs.disable-apparmor }}
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns

- name: Run QUnit tests
run: npm run grunt qunit:compiled

Expand Down
27 changes: 17 additions & 10 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ module.exports = function(grunt) {
'cssmin',
'imagemin',
'jshint',
'qunit',
'uglify',
'watch'
],
Expand Down Expand Up @@ -906,7 +905,8 @@ module.exports = function(grunt) {
src: [
'tests/qunit/**/*.js',
'!tests/qunit/vendor/*',
'!tests/qunit/editor/**'
'!tests/qunit/qunit.js',
'!tests/qunit/playwright.config.js'
],
options: grunt.file.readJSON( 'tests/qunit/.jshintrc' )
},
Expand Down Expand Up @@ -1010,12 +1010,6 @@ module.exports = function(grunt) {
}
}
},
qunit: {
files: [
'tests/qunit/**/*.html',
'!tests/qunit/editor/**'
]
},
phpunit: {
'default': {
args: ['--verbose', '-c', 'phpunit.xml.dist']
Expand Down Expand Up @@ -1540,8 +1534,7 @@ module.exports = function(grunt) {
},
test: {
files: [
'tests/qunit/**',
'!tests/qunit/editor/**'
'tests/qunit/**'
],
tasks: ['qunit']
}
Expand Down Expand Up @@ -2172,6 +2165,20 @@ module.exports = function(grunt) {
}, this.async());
});

grunt.registerTask( 'qunit', 'Runs QUnit tests.', function() {
var done = this.async();
grunt.util.spawn( {
cmd: 'npx',
args: [ 'playwright', 'test', '--config', 'tests/qunit/playwright.config.js' ],
opts: { stdio: 'inherit' }
}, function( error, result, code ) {
if ( code !== 0 ) {
grunt.fail.warn( 'QUnit tests failed.' );
}
done();
} );
} );

grunt.registerTask( 'qunit:compiled', 'Runs QUnit tests on compiled as well as uncompiled scripts.',
['build', 'copy:qunit', 'qunit']
);
Expand Down
172 changes: 0 additions & 172 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"grunt-contrib-cssmin": "~5.0.0",
"grunt-contrib-imagemin": "~4.0.0",
"grunt-contrib-jshint": "3.2.0",
"grunt-contrib-qunit": "~10.1.1",
"grunt-contrib-uglify": "~5.2.2",
"grunt-contrib-watch": "~1.1.0",
"grunt-file-append": "0.0.7",
Expand Down
19 changes: 19 additions & 0 deletions tests/qunit/playwright.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Playwright configuration for QUnit tests.
*/
const path = require( 'path' );
const { defineConfig } = require( '@playwright/test' );

module.exports = defineConfig( {
testDir: __dirname,
outputDir: path.join( __dirname, '..', '..', 'artifacts', 'test-results' ),
testMatch: 'qunit.js',
timeout: 30_000,
workers: 1,
use: {
headless: true,
/* This avoids the need to run `npx playwright install` in CI. */
channel: process.env.CI ? 'chrome' : undefined,
},
reporter: process.env.CI ? 'github' : 'list',
} );
Loading
Loading