Add PHP 8.1/8.2 to unit testing matrix (https://github.com/woocommerce/woocommerce-blocks/pull/8757)
* Added PHP 8.1 to unit testing matrix * Refactor unit testing to match Gutenberg repo 🤞 * Removed Gutenberg reference from debug information * Updated image running phpunit binary * Reverted image running phpunit binary * Remove composer platform override * Bump @wordpress/env and include phpunit * Update phpunit and tests * Change prefix * Try admin context when install wc * try wc install * adjust phpunit config file * Updated phpunit.xml.dist, composer.json and package.json * Added PHP 8.1 to unit testing matrix * Refactor unit testing to match Gutenberg repo 🤞 * Removed Gutenberg reference from debug information * Updated image running phpunit binary * Reverted image running phpunit binary * Remove composer platform override * Bump @wordpress/env and include phpunit * Update phpunit and tests * Change prefix * Try admin context when install wc * try wc install * adjust phpunit config file * Updated phpunit.xml.dist, composer.json and package.json * Revert install changes * updated npm packages * updated composer lock * updated check assets flow * Updated check assets flow. Yaml file auto formatted. * Updated check assets flow. * Attempt at fixing E2E * Reverted setup permissions step * Add logging information to E2E * Reverted E2E test flow * test playwright perms fix * test e2e perms fix * test e2e perms fix * test e2e perms fix * test e2e perms fix * languages update & debug * languages update & debug * revert * force "@wordpress/env": "^4.9.0" on E2E * update package lock * update package lock --------- Co-authored-by: Mike Jolley <mike.jolley@me.com> Co-authored-by: Niels Lange <info@nielslange.de>
This commit is contained in:
parent
8de8fc917c
commit
7c25db1c80
|
@ -1,82 +1,91 @@
|
|||
name: Check Modified Assets
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build-trunk:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: trunk
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
build-trunk:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: trunk
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: Install Node dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: npm ci --no-optional
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Build Assets
|
||||
run: npm run build:check-assets
|
||||
- name: Install Node dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: npm install --no-optional --no-audit
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: assets-list
|
||||
path: ./build/assets.json
|
||||
- name: Build Assets
|
||||
run: npm run build:check-assets
|
||||
|
||||
compare-assets-with-trunk:
|
||||
needs: [build-trunk]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: assets-list
|
||||
path: ./build/assets.json
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
compare-assets-with-trunk:
|
||||
needs: [ build-trunk ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: Build Assets
|
||||
run: npm run build:check-assets
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Download assets (trunk)
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: assets-list
|
||||
path: assets-list
|
||||
- name: Compare Assets
|
||||
uses: ./.github/compare-assets
|
||||
id: compare-assets
|
||||
with:
|
||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
compare: assets-list/assets.json
|
||||
create-comment: false
|
||||
- name: Append report
|
||||
uses: ./.github/comments-aggregator
|
||||
with:
|
||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
section-id: compare-assets-with-trunk
|
||||
content: ${{steps.compare-assets.outputs.comment}}
|
||||
- name: Build Assets
|
||||
run: npm run build:check-assets
|
||||
|
||||
- name: Download assets (trunk)
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: assets-list
|
||||
path: assets-list
|
||||
- name: Compare Assets
|
||||
uses: ./.github/compare-assets
|
||||
id: compare-assets
|
||||
with:
|
||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
compare: assets-list/assets.json
|
||||
create-comment: false
|
||||
- name: Append report
|
||||
uses: ./.github/comments-aggregator
|
||||
with:
|
||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
section-id: compare-assets-with-trunk
|
||||
content: ${{steps.compare-assets.outputs.comment}}
|
||||
|
|
|
@ -1,169 +1,175 @@
|
|||
name: E2E tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [trunk]
|
||||
pull_request:
|
||||
push:
|
||||
branches: [trunk]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
JSE2EWithGutenberg:
|
||||
if: ${{ false }} # disable until we've fixed failing tests.
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
part: [1, 2, 3, 4, 5]
|
||||
name: JavaScript E2E Tests (WP latest with Gutenberg plugin)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
JSE2EWithGutenberg:
|
||||
if: ${{ false }} # disable until we've fixed failing tests.
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
part: [1, 2, 3, 4, 5]
|
||||
name: JavaScript E2E Tests (WP latest with Gutenberg plugin)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Node Dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: npm ci --no-optional
|
||||
- name: Install Node Dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: npm ci --no-optional
|
||||
|
||||
- name: Build Assets
|
||||
run: FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||
- name: Build Assets
|
||||
run: FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||
|
||||
- name: blocks.ini setup
|
||||
run: |
|
||||
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
run: |
|
||||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||
- name: blocks.ini setup
|
||||
run: |
|
||||
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
run: |
|
||||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-composer-
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.0'
|
||||
coverage: none
|
||||
tools: composer
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-composer-
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.0'
|
||||
coverage: none
|
||||
tools: composer
|
||||
|
||||
- name: Composer install
|
||||
run: |
|
||||
composer install
|
||||
- name: E2E Tests (WP latest with Gutenberg plugin)
|
||||
env:
|
||||
WOOCOMMERCE_BLOCKS_PHASE: 3
|
||||
GUTENBERG_EDITOR_CONTEXT: 'gutenberg'
|
||||
run: |
|
||||
node ./bin/wp-env-with-gutenberg.js
|
||||
npm run wp-env start
|
||||
npm run wp-env:config && npx cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --listTests > ~/.jest-e2e-tests
|
||||
npx cross-env JEST_PUPPETEER_CONFIG=tests/e2e/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --runInBand --runTestsByPath $( awk 'NR % 5 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests )
|
||||
- name: Composer install
|
||||
run: |
|
||||
composer install
|
||||
- name: E2E Tests (WP latest with Gutenberg plugin)
|
||||
env:
|
||||
WOOCOMMERCE_BLOCKS_PHASE: 3
|
||||
GUTENBERG_EDITOR_CONTEXT: 'gutenberg'
|
||||
run: |
|
||||
node ./bin/wp-env-with-gutenberg.js
|
||||
npm run wp-env start
|
||||
npm run wp-env:config && npx cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --listTests > ~/.jest-e2e-tests
|
||||
npx cross-env JEST_PUPPETEER_CONFIG=tests/e2e/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --runInBand --runTestsByPath $( awk 'NR % 5 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests )
|
||||
|
||||
- name: Upload artifacts on failure
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: e2e-with-gutenberg-test-report-${{matrix.part}}
|
||||
path: reports/e2e
|
||||
- name: Upload artifacts on failure
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: e2e-with-gutenberg-test-report-${{matrix.part}}
|
||||
path: reports/e2e
|
||||
|
||||
- name: Archive flaky tests report
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: flaky-tests-report-${{ matrix.part }}
|
||||
path: flaky-tests
|
||||
if-no-files-found: ignore
|
||||
- name: Archive flaky tests report
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: flaky-tests-report-${{ matrix.part }}
|
||||
path: flaky-tests
|
||||
if-no-files-found: ignore
|
||||
|
||||
JSE2ETests:
|
||||
name: JavaScript E2E Tests (latest)
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
part: [1, 2, 3, 4, 5]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
JSE2ETests:
|
||||
name: JavaScript E2E Tests (latest)
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
part: [1, 2, 3, 4, 5]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-modified-build-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-modified-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-modified-build-
|
||||
${{ runner.os }}-modified-
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Node Dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: npm ci --no-optional
|
||||
- name: Install Node dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
sed -i 's/"@wordpress\/env": ".*"/"@wordpress\/env": "^4.9.0"/' package.json
|
||||
npm install --no-optional --no-audit
|
||||
|
||||
- name: Build Assets
|
||||
run: FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||
- name: Build Assets
|
||||
run: FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||
|
||||
- name: blocks.ini setup
|
||||
run: |
|
||||
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
run: |
|
||||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-composer-
|
||||
- name: blocks.ini setup
|
||||
run: |
|
||||
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
run: |
|
||||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-composer-
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.0'
|
||||
coverage: none
|
||||
tools: composer
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.0'
|
||||
coverage: none
|
||||
tools: composer
|
||||
|
||||
- name: Composer install
|
||||
run: |
|
||||
composer install
|
||||
- name: Composer install
|
||||
run: |
|
||||
composer install
|
||||
|
||||
- name: E2E Tests (WP latest)
|
||||
env:
|
||||
WOOCOMMERCE_BLOCKS_PHASE: 3
|
||||
run: |
|
||||
npm run wp-env start
|
||||
npm run wp-env:config && npx cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --listTests > ~/.jest-e2e-tests
|
||||
npx cross-env JEST_PUPPETEER_CONFIG=tests/e2e/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --runInBand --runTestsByPath $( awk 'NR % 5 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests )
|
||||
- name: E2E Tests (WP latest)
|
||||
env:
|
||||
WOOCOMMERCE_BLOCKS_PHASE: 3
|
||||
run: |
|
||||
npm run wp-env start
|
||||
npm run wp-env:config && npx cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --listTests > ~/.jest-e2e-tests
|
||||
npx cross-env JEST_PUPPETEER_CONFIG=tests/e2e/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --runInBand --runTestsByPath $( awk 'NR % 5 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests )
|
||||
|
||||
- name: Upload artifacts on failure
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: e2e-test-report-${{matrix.part}}
|
||||
path: reports/e2e
|
||||
- name: Upload artifacts on failure
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: e2e-test-report-${{matrix.part}}
|
||||
path: reports/e2e
|
||||
|
||||
- name: Archive flaky tests report
|
||||
uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2
|
||||
if: always()
|
||||
with:
|
||||
name: flaky-tests-report-${{ matrix.part }}
|
||||
path: flaky-tests
|
||||
if-no-files-found: ignore
|
||||
- name: Archive flaky tests report
|
||||
uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2
|
||||
if: always()
|
||||
with:
|
||||
name: flaky-tests-report-${{ matrix.part }}
|
||||
path: flaky-tests
|
||||
if-no-files-found: ignore
|
||||
|
|
|
@ -2,7 +2,7 @@ name: Playwright Tests
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [trunk]
|
||||
branches: [ trunk ]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
|
@ -11,21 +11,51 @@ jobs:
|
|||
timeout-minutes: 60
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
cache: 'npm' # Cache npm dependencies
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Load wp-env
|
||||
run: npm run env:start
|
||||
- name: Install Playwright Browsers
|
||||
run: npx playwright install --with-deps
|
||||
- name: Run Playwright tests
|
||||
run: npx playwright test --config=tests/e2e-pw/playwright.config.ts
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: trunk
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Node dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: npm install --no-optional --no-audit
|
||||
|
||||
- name: Load wp-env
|
||||
run: npm run env:start --update
|
||||
|
||||
- name: Fix permissions # We need to figure this out https://github.com/WordPress/gutenberg/issues/22515#issuecomment-1308346256
|
||||
run: |
|
||||
WP_ENV_DIR=$(npm run wp-env install-path --silent 2>&1 | head -1)
|
||||
cd $WP_ENV_DIR
|
||||
mkdir -p tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade
|
||||
chmod -R 767 tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade
|
||||
cd -
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
run: npx playwright install --with-deps
|
||||
|
||||
- name: Run Playwright tests
|
||||
run: npx playwright test --config=tests/e2e-pw/playwright.config.ts
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
|
|
|
@ -1,163 +1,128 @@
|
|||
name: Unit tests
|
||||
name: Unit Tests
|
||||
|
||||
# Since Unit Tests are required to pass for each PR,
|
||||
# we cannot disable them for documentation-only changes.
|
||||
on:
|
||||
push:
|
||||
branches: [trunk]
|
||||
pull_request:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [trunk]
|
||||
# Allow manually triggering the workflow.
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name for pull requests
|
||||
# or the commit hash for any other events.
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
Setup:
|
||||
runs-on: ubuntu-latest
|
||||
name: Setup
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
JSUnitTests:
|
||||
name: JS Unit Tests
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'WooCommerce/WooCommerce-Blocks' || github.event_name == 'pull_request' }}
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install Node Dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: npm ci --no-optional
|
||||
- name: Use desired version of NodeJS
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: npm
|
||||
|
||||
- name: Build Assets
|
||||
run: FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||
- name: Npm install and build
|
||||
run: |
|
||||
npm ci --no-optional
|
||||
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||
|
||||
- name: Store Build Assets
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
path: build/
|
||||
- name: blocks.ini setup
|
||||
run: echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = test' > blocks.ini
|
||||
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-composer-
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "8.0" # This is not the PHP version used to run the tests, that is set by wp-env
|
||||
coverage: none
|
||||
tools: composer
|
||||
- name: Run JavaScript Unit tests
|
||||
run: npm run test
|
||||
|
||||
- name: Composer install
|
||||
run: composer install
|
||||
PHPUnitTests:
|
||||
name: PHP ${{ matrix.php }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
if: ${{ github.repository == 'WooCommerce/WooCommerce-Blocks' || github.event_name == 'pull_request' }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
php:
|
||||
- '7.4'
|
||||
- '8.0'
|
||||
- '8.1'
|
||||
- '8.2'
|
||||
|
||||
PHPUnitTests:
|
||||
name: PHP ${{ matrix.php }}
|
||||
needs: Setup
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: [ '7.4', '8.0' ]
|
||||
env:
|
||||
WP_ENV_PHP_VERSION: ${{ matrix.php }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: npm
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
##
|
||||
# This allows Composer dependencies to be installed using a single step.
|
||||
#
|
||||
# Since the tests are currently run within the Docker containers where the PHP version varies,
|
||||
# the same PHP version needs to be configured for the action runner machine so that the correct
|
||||
# dependency versions are installed and cached.
|
||||
##
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '${{ matrix.php }}'
|
||||
ini-file: development
|
||||
coverage: none
|
||||
|
||||
- name: Download Build Assets
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
# Ensure that Composer installs the correct versions of packages.
|
||||
- name: Override PHP version in composer.json
|
||||
run: |
|
||||
composer config platform.php ${{ matrix.php }}
|
||||
composer update
|
||||
|
||||
- name: blocks.ini setup
|
||||
run: echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = test' > blocks.ini
|
||||
- name: Install npm dependencies
|
||||
run: |
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
- name: Get Composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||
- name: Docker debug information
|
||||
run: |
|
||||
docker -v
|
||||
docker-compose -v
|
||||
|
||||
- name: Set up Composer caching
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-composer-dependencies
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-composer-
|
||||
- name: Install PHP deps
|
||||
run: composer install
|
||||
- name: General debug information
|
||||
run: |
|
||||
npm --version
|
||||
node --version
|
||||
curl --version
|
||||
git --version
|
||||
svn --version
|
||||
locale -a
|
||||
|
||||
- name: Setup Permissions
|
||||
run: |
|
||||
mkdir -p ./wp-content/uploads/wc-logs
|
||||
echo 'deny from all' > ./wp-content/uploads/wc-logs/.htaccess
|
||||
chmod -R 777 ./
|
||||
- name: Run PHPUnit tests
|
||||
run: |
|
||||
JSON='{"phpVersion": "${{ matrix.php }}"}'
|
||||
echo $JSON > .wp-env.override.json
|
||||
npm run wp-env start --update
|
||||
npm run test:php
|
||||
- name: Run PHPUnit tests (WooCommerce Development Version)
|
||||
run: |
|
||||
JSON='{"plugins": [".","https://downloads.wordpress.org/plugin/woocommerce.zip"], "phpVersion": "${{ matrix.php }}"}'
|
||||
echo $JSON > .wp-env.override.json
|
||||
npm run wp-env stop
|
||||
rm -rf /home/runner/wp-env/*
|
||||
npm run wp-env start --update
|
||||
npm run test:php
|
||||
JSUnitTests:
|
||||
name: JS Unit Tests
|
||||
needs: Setup
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Start Docker environment
|
||||
run: npm run wp-env start --update
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
- name: Log running Docker containers
|
||||
run: docker ps -a
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Docker container debug information
|
||||
run: |
|
||||
npm run wp-env run tests-mysql "mysql --version"
|
||||
npm run wp-env run tests-wordpress "php --version"
|
||||
npm run wp-env run tests-wordpress "php -m"
|
||||
npm run wp-env run tests-wordpress "php -i"
|
||||
npm run wp-env run tests-wordpress "locale -a"
|
||||
|
||||
- name: Download Build Assets
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
- name: blocks.ini setup
|
||||
run: echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = test' > blocks.ini
|
||||
|
||||
- name: Run JavaScript Unit tests
|
||||
run: npm run test
|
||||
- name: Run PHPUnit tests
|
||||
run: npm run test:php
|
||||
|
|
|
@ -62,3 +62,4 @@ blocks.ini
|
|||
/.wp-env.override.json
|
||||
/eslint_report.json
|
||||
/storybook/dist
|
||||
.phpunit.result.cache
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
"automattic/jetpack-autoloader": "^2.9.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"wp-phpunit/wp-phpunit": "^6.0",
|
||||
"phpunit/phpunit": "^8",
|
||||
"woocommerce/woocommerce-sniffs": "0.1.3",
|
||||
"yoast/phpunit-polyfills": "^1.0",
|
||||
"mockery/mockery": "^1.4",
|
||||
"mockery/mockery": "^1",
|
||||
"wp-hooks/generator": "^0.9.0"
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -50,7 +50,7 @@
|
|||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.4.32"
|
||||
"php": "7.4.33"
|
||||
},
|
||||
"allow-plugins": {
|
||||
"automattic/jetpack-autoloader": true,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -28,7 +28,7 @@ services:
|
|||
- WORDPRESS_DB_NAME
|
||||
- WORDPRESS_DB_USER
|
||||
- WORDPRESS_DB_PASSWORD
|
||||
- WORDPRESS_TABLE_PREFIX=wp_test_
|
||||
- WORDPRESS_TABLE_PREFIX=wptests_
|
||||
- WP_CORE_DIR=/var/www/html
|
||||
- WP_TESTS_DIR=/tmp/wordpress-tests-lib
|
||||
- WOO_VERSION
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
"@wordpress/e2e-test-utils": "10.1.0",
|
||||
"@wordpress/e2e-tests": "4.6.0",
|
||||
"@wordpress/element": "4.20.0",
|
||||
"@wordpress/env": "^4.9.0",
|
||||
"@wordpress/env": "5.16.0",
|
||||
"@wordpress/html-entities": "3.24.0",
|
||||
"@wordpress/i18n": "4.24.0",
|
||||
"@wordpress/is-shallow-equal": "4.24.0",
|
||||
|
@ -5997,9 +5997,10 @@
|
|||
"peer": true
|
||||
},
|
||||
"node_modules/@sindresorhus/is": {
|
||||
"version": "2.1.1",
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
||||
"integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
|
@ -16376,15 +16377,16 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@wordpress/env": {
|
||||
"version": "4.9.0",
|
||||
"version": "5.16.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/env/-/env-5.16.0.tgz",
|
||||
"integrity": "sha512-zx6UO8PuJBrQ34cfeedK1HlGHLFaj7oWzTo9tTt+noB79Ttqc4+a0lYwDqBLLJhlHU+cWgcyOP2lB6TboXH0xA==",
|
||||
"dev": true,
|
||||
"license": "GPL-2.0-or-later",
|
||||
"dependencies": {
|
||||
"chalk": "^4.0.0",
|
||||
"copy-dir": "^1.3.0",
|
||||
"docker-compose": "^0.22.2",
|
||||
"extract-zip": "^1.6.7",
|
||||
"got": "^10.7.0",
|
||||
"got": "^11.8.5",
|
||||
"inquirer": "^7.1.0",
|
||||
"js-yaml": "^3.13.1",
|
||||
"ora": "^4.0.2",
|
||||
|
@ -21145,15 +21147,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/cacheable-lookup": {
|
||||
"version": "2.0.1",
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz",
|
||||
"integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/keyv": "^3.1.1",
|
||||
"keyv": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
"node": ">=10.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/cacheable-request": {
|
||||
|
@ -24411,14 +24410,18 @@
|
|||
}
|
||||
},
|
||||
"node_modules/decompress-response": {
|
||||
"version": "5.0.0",
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
|
||||
"integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mimic-response": "^2.0.0"
|
||||
"mimic-response": "^3.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/dedent": {
|
||||
|
@ -25438,8 +25441,8 @@
|
|||
},
|
||||
"node_modules/duplexer3": {
|
||||
"version": "0.1.4",
|
||||
"devOptional": true,
|
||||
"license": "BSD-3-Clause"
|
||||
"license": "BSD-3-Clause",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/duplexify": {
|
||||
"version": "3.7.1",
|
||||
|
@ -28643,17 +28646,6 @@
|
|||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/github-label-sync/node_modules/@sindresorhus/is": {
|
||||
"version": "4.6.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sindresorhus/is?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/github-label-sync/node_modules/ajv": {
|
||||
"version": "8.11.0",
|
||||
"dev": true,
|
||||
|
@ -28669,14 +28661,6 @@
|
|||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/github-label-sync/node_modules/cacheable-lookup": {
|
||||
"version": "5.0.4",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/github-label-sync/node_modules/commander": {
|
||||
"version": "6.2.1",
|
||||
"dev": true,
|
||||
|
@ -28685,60 +28669,11 @@
|
|||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/github-label-sync/node_modules/decompress-response": {
|
||||
"version": "6.0.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mimic-response": "^3.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/github-label-sync/node_modules/got": {
|
||||
"version": "11.8.3",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sindresorhus/is": "^4.0.0",
|
||||
"@szmarczak/http-timer": "^4.0.5",
|
||||
"@types/cacheable-request": "^6.0.1",
|
||||
"@types/responselike": "^1.0.0",
|
||||
"cacheable-lookup": "^5.0.3",
|
||||
"cacheable-request": "^7.0.2",
|
||||
"decompress-response": "^6.0.0",
|
||||
"http2-wrapper": "^1.0.0-beta.5.2",
|
||||
"lowercase-keys": "^2.0.0",
|
||||
"p-cancelable": "^2.0.0",
|
||||
"responselike": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.19.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sindresorhus/got?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/github-label-sync/node_modules/json-schema-traverse": {
|
||||
"version": "1.0.0",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/github-label-sync/node_modules/mimic-response": {
|
||||
"version": "3.1.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/github-slugger": {
|
||||
"version": "1.4.0",
|
||||
"dev": true,
|
||||
|
@ -28928,44 +28863,30 @@
|
|||
}
|
||||
},
|
||||
"node_modules/got": {
|
||||
"version": "10.7.0",
|
||||
"version": "11.8.6",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz",
|
||||
"integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sindresorhus/is": "^2.0.0",
|
||||
"@szmarczak/http-timer": "^4.0.0",
|
||||
"@sindresorhus/is": "^4.0.0",
|
||||
"@szmarczak/http-timer": "^4.0.5",
|
||||
"@types/cacheable-request": "^6.0.1",
|
||||
"cacheable-lookup": "^2.0.0",
|
||||
"cacheable-request": "^7.0.1",
|
||||
"decompress-response": "^5.0.0",
|
||||
"duplexer3": "^0.1.4",
|
||||
"get-stream": "^5.0.0",
|
||||
"@types/responselike": "^1.0.0",
|
||||
"cacheable-lookup": "^5.0.3",
|
||||
"cacheable-request": "^7.0.2",
|
||||
"decompress-response": "^6.0.0",
|
||||
"http2-wrapper": "^1.0.0-beta.5.2",
|
||||
"lowercase-keys": "^2.0.0",
|
||||
"mimic-response": "^2.1.0",
|
||||
"p-cancelable": "^2.0.0",
|
||||
"p-event": "^4.0.0",
|
||||
"responselike": "^2.0.0",
|
||||
"to-readable-stream": "^2.0.0",
|
||||
"type-fest": "^0.10.0"
|
||||
"responselike": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
"node": ">=10.19.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sindresorhus/got?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/got/node_modules/type-fest": {
|
||||
"version": "0.10.0",
|
||||
"dev": true,
|
||||
"license": "(MIT OR CC0-1.0)",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/graceful-fs": {
|
||||
"version": "4.2.10",
|
||||
"devOptional": true,
|
||||
|
@ -38076,11 +37997,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/mimic-response": {
|
||||
"version": "2.1.0",
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
|
||||
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
|
@ -47508,14 +47430,6 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/to-readable-stream": {
|
||||
"version": "2.1.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/to-regex": {
|
||||
"version": "3.0.2",
|
||||
"dev": true,
|
||||
|
@ -55066,7 +54980,9 @@
|
|||
"peer": true
|
||||
},
|
||||
"@sindresorhus/is": {
|
||||
"version": "2.1.1",
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
||||
"integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==",
|
||||
"dev": true
|
||||
},
|
||||
"@sinonjs/commons": {
|
||||
|
@ -62485,14 +62401,16 @@
|
|||
}
|
||||
},
|
||||
"@wordpress/env": {
|
||||
"version": "4.9.0",
|
||||
"version": "5.16.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/env/-/env-5.16.0.tgz",
|
||||
"integrity": "sha512-zx6UO8PuJBrQ34cfeedK1HlGHLFaj7oWzTo9tTt+noB79Ttqc4+a0lYwDqBLLJhlHU+cWgcyOP2lB6TboXH0xA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^4.0.0",
|
||||
"copy-dir": "^1.3.0",
|
||||
"docker-compose": "^0.22.2",
|
||||
"extract-zip": "^1.6.7",
|
||||
"got": "^10.7.0",
|
||||
"got": "^11.8.5",
|
||||
"inquirer": "^7.1.0",
|
||||
"js-yaml": "^3.13.1",
|
||||
"ora": "^4.0.2",
|
||||
|
@ -65764,12 +65682,10 @@
|
|||
}
|
||||
},
|
||||
"cacheable-lookup": {
|
||||
"version": "2.0.1",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/keyv": "^3.1.1",
|
||||
"keyv": "^4.0.0"
|
||||
}
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz",
|
||||
"integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==",
|
||||
"dev": true
|
||||
},
|
||||
"cacheable-request": {
|
||||
"version": "7.0.2",
|
||||
|
@ -67966,10 +67882,12 @@
|
|||
"dev": true
|
||||
},
|
||||
"decompress-response": {
|
||||
"version": "5.0.0",
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
|
||||
"integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mimic-response": "^2.0.0"
|
||||
"mimic-response": "^3.1.0"
|
||||
}
|
||||
},
|
||||
"dedent": {
|
||||
|
@ -68663,7 +68581,7 @@
|
|||
},
|
||||
"duplexer3": {
|
||||
"version": "0.1.4",
|
||||
"devOptional": true
|
||||
"optional": true
|
||||
},
|
||||
"duplexify": {
|
||||
"version": "3.7.1",
|
||||
|
@ -70820,10 +70738,6 @@
|
|||
"octonode": "^0.10.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sindresorhus/is": {
|
||||
"version": "4.6.0",
|
||||
"dev": true
|
||||
},
|
||||
"ajv": {
|
||||
"version": "8.11.0",
|
||||
"dev": true,
|
||||
|
@ -70834,45 +70748,13 @@
|
|||
"uri-js": "^4.2.2"
|
||||
}
|
||||
},
|
||||
"cacheable-lookup": {
|
||||
"version": "5.0.4",
|
||||
"dev": true
|
||||
},
|
||||
"commander": {
|
||||
"version": "6.2.1",
|
||||
"dev": true
|
||||
},
|
||||
"decompress-response": {
|
||||
"version": "6.0.0",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mimic-response": "^3.1.0"
|
||||
}
|
||||
},
|
||||
"got": {
|
||||
"version": "11.8.3",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@sindresorhus/is": "^4.0.0",
|
||||
"@szmarczak/http-timer": "^4.0.5",
|
||||
"@types/cacheable-request": "^6.0.1",
|
||||
"@types/responselike": "^1.0.0",
|
||||
"cacheable-lookup": "^5.0.3",
|
||||
"cacheable-request": "^7.0.2",
|
||||
"decompress-response": "^6.0.0",
|
||||
"http2-wrapper": "^1.0.0-beta.5.2",
|
||||
"lowercase-keys": "^2.0.0",
|
||||
"p-cancelable": "^2.0.0",
|
||||
"responselike": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"json-schema-traverse": {
|
||||
"version": "1.0.0",
|
||||
"dev": true
|
||||
},
|
||||
"mimic-response": {
|
||||
"version": "3.1.0",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -71002,30 +70884,22 @@
|
|||
}
|
||||
},
|
||||
"got": {
|
||||
"version": "10.7.0",
|
||||
"version": "11.8.6",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz",
|
||||
"integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@sindresorhus/is": "^2.0.0",
|
||||
"@szmarczak/http-timer": "^4.0.0",
|
||||
"@sindresorhus/is": "^4.0.0",
|
||||
"@szmarczak/http-timer": "^4.0.5",
|
||||
"@types/cacheable-request": "^6.0.1",
|
||||
"cacheable-lookup": "^2.0.0",
|
||||
"cacheable-request": "^7.0.1",
|
||||
"decompress-response": "^5.0.0",
|
||||
"duplexer3": "^0.1.4",
|
||||
"get-stream": "^5.0.0",
|
||||
"@types/responselike": "^1.0.0",
|
||||
"cacheable-lookup": "^5.0.3",
|
||||
"cacheable-request": "^7.0.2",
|
||||
"decompress-response": "^6.0.0",
|
||||
"http2-wrapper": "^1.0.0-beta.5.2",
|
||||
"lowercase-keys": "^2.0.0",
|
||||
"mimic-response": "^2.1.0",
|
||||
"p-cancelable": "^2.0.0",
|
||||
"p-event": "^4.0.0",
|
||||
"responselike": "^2.0.0",
|
||||
"to-readable-stream": "^2.0.0",
|
||||
"type-fest": "^0.10.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"type-fest": {
|
||||
"version": "0.10.0",
|
||||
"dev": true
|
||||
}
|
||||
"responselike": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"graceful-fs": {
|
||||
|
@ -77388,7 +77262,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"mimic-response": {
|
||||
"version": "2.1.0",
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
|
||||
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
|
||||
"dev": true
|
||||
},
|
||||
"min-document": {
|
||||
|
@ -83789,10 +83665,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"to-readable-stream": {
|
||||
"version": "2.1.0",
|
||||
"dev": true
|
||||
},
|
||||
"to-regex": {
|
||||
"version": "3.0.2",
|
||||
"dev": true,
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
"env:stop": "npm run wp-env stop",
|
||||
"test:help": "wp-scripts test-unit-js --help",
|
||||
"test:performance": "npm run wp-env:config && cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.performance.config.js -- performance",
|
||||
"test:php": "npm run wp-env run phpunit '/var/www/html/wp-content/plugins/${PWD##*/}/vendor/bin/phpunit -c /var/www/html/wp-content/plugins/${PWD##*/}/phpunit.xml.dist'",
|
||||
"test:php": "wp-env run tests-wordpress /var/www/html/wp-content/plugins/${PWD##*/}/vendor/bin/phpunit -c /var/www/html/wp-content/plugins/${PWD##*/}/phpunit.xml.dist",
|
||||
"test:update": "wp-scripts test-unit-js --updateSnapshot --config tests/js/jest.config.json",
|
||||
"test:watch": "npm run test -- --watch",
|
||||
"ts:check": "tsc --build",
|
||||
|
@ -160,7 +160,7 @@
|
|||
"@wordpress/e2e-test-utils": "10.1.0",
|
||||
"@wordpress/e2e-tests": "4.6.0",
|
||||
"@wordpress/element": "4.20.0",
|
||||
"@wordpress/env": "^4.9.0",
|
||||
"@wordpress/env": "5.16.0",
|
||||
"@wordpress/html-entities": "3.24.0",
|
||||
"@wordpress/i18n": "4.24.0",
|
||||
"@wordpress/is-shallow-equal": "4.24.0",
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
bootstrap="tests/bootstrap.php"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="false"
|
||||
convertNoticesToExceptions="false"
|
||||
convertWarningsToExceptions="false"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
verbose="true"
|
||||
>
|
||||
<testsuites>
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPUnit bootstrap file
|
||||
*
|
||||
* @package WooCommerce Blocks
|
||||
*/
|
||||
|
||||
namespace Automattic\WooCommerce\Blocks\Tests;
|
||||
|
||||
// Require composer dependencies.
|
||||
|
@ -7,7 +13,7 @@ require_once dirname( __DIR__ ) . '/vendor/autoload.php';
|
|||
// Determine the tests directory (from a WP dev checkout).
|
||||
// Try the WP_TESTS_DIR environment variable first.
|
||||
$_wc_tests_framework_dir = dirname( dirname( __DIR__ ) ) . '/woocommerce/tests/legacy';
|
||||
$_tests_dir = getenv( 'WP_TESTS_DIR' );
|
||||
$_tests_dir = getenv( 'WP_TESTS_DIR' );
|
||||
|
||||
// Next, try the WP_PHPUNIT composer package.
|
||||
if ( ! $_tests_dir ) {
|
||||
|
@ -43,10 +49,11 @@ tests_add_filter( 'muplugins_loaded', __NAMESPACE__ . '\\manually_load_plugins'
|
|||
* Manually install plugins being tested.
|
||||
*/
|
||||
function manually_install_plugins() {
|
||||
\WC_Install::install();
|
||||
\Automattic\WooCommerce\Blocks\Package::container()->get( \Automattic\WooCommerce\Blocks\Installer::class )->maybe_create_tables();
|
||||
}
|
||||
|
||||
tests_add_filter( 'setup_theme', __NAMESPACE__ . '\\manually_install_plugins' );
|
||||
tests_add_filter( 'init', __NAMESPACE__ . '\\manually_install_plugins' );
|
||||
|
||||
// Start up the WP testing environment.
|
||||
require $_tests_dir . '/includes/bootstrap.php';
|
||||
|
|
|
@ -141,17 +141,19 @@ class BlockTemplateUtilsTest extends WP_UnitTestCase {
|
|||
* Test set_has_theme_file_if_fallback_is_available when the template file has no fallback.
|
||||
*/
|
||||
public function test_set_has_theme_file_if_fallback_is_available_no_fallback() {
|
||||
$template_file = array(
|
||||
'slug' => 'single-product',
|
||||
'theme' => 'twentytwentytwo',
|
||||
$query_result = array(
|
||||
(object) array(
|
||||
'slug' => 'single-product',
|
||||
'theme' => 'twentytwentytwo',
|
||||
),
|
||||
);
|
||||
|
||||
$query_result = (object) array(
|
||||
$template_file = (object) array(
|
||||
'slug' => 'archive-product',
|
||||
'theme' => 'twentytwentytwo',
|
||||
);
|
||||
|
||||
$this->assertFalse( BlockTemplateUtils::set_has_theme_file_if_fallback_is_available( $template_file, $query_result ) );
|
||||
$this->assertFalse( BlockTemplateUtils::set_has_theme_file_if_fallback_is_available( $query_result, $template_file ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue