wpaccessibility / wp-theme-auditor Goto Github PK
View Code? Open in Web Editor NEWAccessibility auditing tools for WordPress themes.
License: GNU General Public License v2.0
Accessibility auditing tools for WordPress themes.
License: GNU General Public License v2.0
Currently, the postinstall
command added in 7287f64 tries to run when installing dependencies for development within this project. It only needs to be run when this package is added to a theme using npm install --save-dev wpaccessability/wp-theme-auditor
. I'm not sure about the best way of achieving this.
Hi from WC EU!
Note from user: Would be nice to have in readme that there needs to be package.json
file. You can do that by running npm init
.
Also note that these commands needs to be run inside you theme root folder.
At the contributor day of WordCmap London we (@Netzberufler @GaryJones @rianrietveld) tested the auditor.
Test environment:
Local site http://one.wordpress.test/ running on VVV
Node: v10.15.1
Npm: 6.9.0
Installed the a11y-theme-unit-test
Used the twentynineteen theme
Followed the install instructions like in the readme.
We run into the following issue while running npm run test:axe
:
The tests are run, relevant axe data is shown in the terminal but at the end the script crashes:
Test Suites: 53 failed, 53 total
Tests: 53 failed, 53 total
Snapshots: 0 total
Time: 78.189s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test:axe: `npx wp-scripts test-e2e`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test:axe script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/rianrietveld/.npm/_logs/2019-04-05T11_54_33_198Z-debug.log
And in the /Users/rianrietveld/.npm/_logs/2019-04-05T11_54_33_198Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'test:axe' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pretest:axe', 'test:axe', 'posttest:axe' ]
5 info lifecycle [email protected]~pretest:axe: [email protected]
6 info lifecycle [email protected]~test:axe: [email protected]
7 verbose lifecycle [email protected]~test:axe: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~test:axe: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/$
9 verbose lifecycle [email protected]~test:axe: CWD: /Users/rianrietveld/vagrant-local/www/wordpress-one/public_html/wp-content$
10 silly lifecycle [email protected]~test:axe: Args: [ '-c', 'wp-scripts test-e2e' ]
11 silly lifecycle [email protected]~test:axe: Returned: code: 1 signal: null
12 info lifecycle [email protected]~test:axe: Failed to exec test:axe script
13 verbose stack Error: [email protected] test:axe: `wp-scripts test-e2e`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:189:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/rianrietveld/vagrant-local/www/wordpress-one/public_html/wp-content/themes/twentynineteen
16 verbose Darwin 18.5.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test:axe"
18 verbose node v10.15.1
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] test:axe: `wp-scripts test-e2e`
22 error Exit status 1
23 error Failed at the [email protected] test:axe script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Running the same with sudo gives the same result.
When trying to create test cases this happened:
➜ dhg_tw git:(master) ✗ npm run create-test-cases
> create-test-cases
> create-test-cases
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'shelljs'
Require stack:
- /Users/eduwass/Sites/dhg/app/public/wp-content/themes/dhg_tw/node_modules/wp-theme-auditor/bin/create-test-cases.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/Users/eduwass/Sites/dhg/app/public/wp-content/themes/dhg_tw/node_modules/wp-theme-auditor/bin/create-test-cases.js:6:15)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/eduwass/Sites/dhg/app/public/wp-content/themes/dhg_tw/node_modules/wp-theme-auditor/bin/create-test-cases.js'
]
}
Was resolved after adding shelljs
to the theme root with:
npm install shelljs --save-dev
Is this expected?
The report added in #23 needs some improvement. Primarily:
Seems like a really great tool, any thoughts on bringing this to a plugin to use with WP sites already deployed to a server? Thanks!
See: https://github.com/wpaccessibility/a11y-theme-unit-test/
The text
Then you'll need to add more test cases. You can do this interactively by running npm run create-test-case
from your theme's root directory.
Should be
Then you'll need to add more test cases. You can do this interactively by running npm run create-test-cases
from your theme's root directory.
With an s added to the case :-)
Also ran into this error:
➜ dhg_tw git:(master) ✗ npm run test
> test
> npm run -s test:axe
Error: Could not resolve a module for a custom reporter.
Module name: ./node_modules/jest-html-reporter
at /Users/eduwass/Sites/dhg/app/public/wp-content/themes/dhg_tw/node_modules/@wordpress/e2e-tests/node_modules/jest-config/build/normalize.js:567:15
at Array.map (<anonymous>)
at normalizeReporters (/Users/eduwass/Sites/dhg/app/public/wp-content/themes/dhg_tw/node_modules/@wordpress/e2e-tests/node_modules/jest-config/build/normalize.js:549:33)
at normalize (/Users/eduwass/Sites/dhg/app/public/wp-content/themes/dhg_tw/node_modules/@wordpress/e2e-tests/node_modules/jest-config/build/normalize.js:642:5)
at readConfig (/Users/eduwass/Sites/dhg/app/public/wp-content/themes/dhg_tw/node_modules/@wordpress/e2e-tests/node_modules/jest-config/build/index.js:220:68)
at async readConfigs (/Users/eduwass/Sites/dhg/app/public/wp-content/themes/dhg_tw/node_modules/@wordpress/e2e-tests/node_modules/jest-config/build/index.js:401:26)
at async runCLI (/Users/eduwass/Sites/dhg/app/public/wp-content/themes/dhg_tw/node_modules/@wordpress/e2e-tests/node_modules/@jest/core/build/cli/index.js:198:59)
at async Object.run (/Users/eduwass/Sites/dhg/app/public/wp-content/themes/dhg_tw/node_modules/@wordpress/e2e-tests/node_modules/jest-cli/build/cli/index.js:173:37)
Fixed by adding the jest-html-reporter
package to theme root, with:
npm install jest-html-reporter --save-dev
npm install fails to create bin/postinstall.js file. I'm using npm version 6.9.0
If the bin/postinstall.js file is run from node modules node node_modules/wp-theme-auditor/bin/postinstall.js
it creates an folder named 'undefined'.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.