#52689 closed defect (bug) (fixed)
Error with `npm run build` as `verify:source-maps` task runs in `build/wp-content`
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
Apparently since r50441 there are new assertions that run after the build is finished. https://wordpress.slack.com/archives/C02RQBWTW/p1614633511079100
This results in an error and script aborting depending upon the contents of build/wp-content
this can be in any of the subfolders. In my case I have a number of inactive plugins in build/wp-content/plugins
.
It would seem skipping some of these tests in build/wp-content
would be a solution.
Pinging @johnbillion and @desrosj
Change History (10)
This ticket was mentioned in PR #1061 on WordPress/wordpress-develop by johnbillion.
4 years ago
#4
- Keywords has-patch has-unit-tests added; needs-patch removed
https://core.trac.wordpress.org/ticket/52689
In [50441] the tests were switched to run against src
by default instead of build
.
This introduced one issue, the test_php_and_js_shortcode_attribute_regexes_match()
now fails when run against build
because it assumes the js/_enqueues/wp/shortcode.js
file exists, which it does not in build
. Running the tests against build
is still possible so we should fix this, especially as existing contributors will see this unless (or until) they switch to using src
for their tests.
## To test:
- Delete the
build
directory if you have one - Change
ABSPATH
inwp-tests-config.php
to point tosrc
- Run
npm run env:restart
- Run
npm run test:php -- --filter test_php_and_js_shortcode_attribute_regexes_match
and confirm it passes - Change
ABSPATH
inwp-tests-config.php
to point tobuild
- Run
npm run env:restart
- Run
npm run build
- Run
npm run test:php -- --filter test_php_and_js_shortcode_attribute_regexes_match
and confirm it passes
johnbillion commented on PR #1061:
4 years ago
#5
This ticket was mentioned in PR #1252 on WordPress/wordpress-develop by ryelle.
4 years ago
#6
This switches the verify:source-maps
command to only check core files, by using the buildFiles
array. It will only check JS files in 'wp-includes/**', 'wp-admin/**', 'wp-content/themes/twenty*/**', 'wp-content/plugins/akismet/**'
, instead of all build/**/*.js
.
Currently, if you have a plugin in build/
that has sourcemaps, it will flag the npm run build
process as incomplete/aborted, for example:
Running "verify:source-maps" task Warning: The build/wp-content/plugins/demo/index.js file must not contain a sourceMappingURL. Use --force to continue. Aborted due to warnings.
With this PR, it won't pick up that plugin file, but would flag a sourcemap in a core file. You can test by running npx grunt build:js
to build the files, then npx grunt verify:source-maps
; that will leave sourcemaps, and trigger the warning. npm run build
removes the sourcemaps and should complete successfully.
Trac ticket: https://core.trac.wordpress.org/ticket/52689
#7
@
4 years ago
This is a build/test tool update, which can be committed during the beta cycle. Leaving in 5.8 for now.
#8
@
4 years ago
- Owner set to desrosj
- Resolution set to fixed
- Status changed from new to closed
In 51173:
What gets skipped should technically match what's inNo this is not true because that would defeat the point of scanning the build dir..gitignore
I think.I've used gitignore-globs successfully in the past for this.