Improve the nmp setup process to install e2e tests only explicitly

Use the "install-subset" package to define a subset of the nmp
dependencies that doesn't include the e2e testing infrastructure.
Also define a new npm "install:no-e2e" command, and modify the
post-merge hook to use it instead of the full install.
This commit is contained in:
Nestor Soriano 2021-01-26 12:23:24 +01:00
parent 0f4ccb836e
commit f239075b2f
2 changed files with 26 additions and 3 deletions

View File

@ -9,5 +9,5 @@ runOnChange() {
fi
}
runOnChange "package-lock.json" "npm install"
runOnChange "package-lock.json" "npm run install:no-e2e"
runOnChange "composer.lock" "composer install"

View File

@ -13,7 +13,10 @@
"wp_org_slug": "woocommerce"
},
"scripts": {
"install": "lerna bootstrap --hoist",
"check:subset-installed": "npm list --depth 1 install-subset > /dev/null 2>&1",
"install:subset-only": "npm install --no-package-lock --no-save install-subset",
"install:no-e2e": "npm run check:subset-installed --silent || npm run install:subset-only && npx install-subset i no-e2e",
"install:e2e": "npx lerna bootstrap --hoist && npm run check:subset-installed --silent || npm run install:subset-only && npx install-subset i e2e",
"build": "./bin/build-zip.sh",
"build:core": "grunt && npm run makepot",
"build:dev": "npm run build:core && npm run build:packages",
@ -125,5 +128,25 @@
"> 0.1%",
"ie 8",
"ie 9"
]
],
"subsets": {
"no-e2e": {
"exclude": [
"@woocommerce/api",
"@woocommerce/e2e-core-tests",
"@woocommerce/e2e-environment",
"@woocommerce/e2e-utils",
"@wordpress/e2e-test-utils"
]
},
"e2e": {
"include": [
"@woocommerce/api",
"@woocommerce/e2e-core-tests",
"@woocommerce/e2e-environment",
"@woocommerce/e2e-utils",
"@wordpress/e2e-test-utils"
]
}
}
}