Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e testing + nodejs ci #155

Merged
merged 6 commits into from Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/node-ci.yml
@@ -0,0 +1,47 @@
name: JS Continuous Integration

on:
pull_request:
branches: [ develop, trunk ]
workflow_dispatch:

jobs:
build:
name: Build plugin
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm run build --if-present


tests:
name: E2E testing
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup environment to use the desired version of NodeJS
uses: actions/setup-node@v3

- name: Installing NPM dependencies
run: npm install

- name: Installing wp-env
run: npm -g i @wordpress/env

- name: Starting the WordPress Environment
run: wp-env start

- name: Running the tests
run: npm run test
16 changes: 0 additions & 16 deletions .github/workflows/php-ci.yml
Expand Up @@ -70,19 +70,3 @@ jobs:
enable_warnings: true
use_local_config: true

build:
name: Build plugin
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm run build --if-present
18 changes: 18 additions & 0 deletions jest.config.js
@@ -0,0 +1,18 @@
const jestConfig = {
verbose: true,
preset: '@wordpress/jest-preset-default',
setupFilesAfterEnv: ['expect-puppeteer'],
projects: [
{
displayName: 'unit',
testMatch: ['<rootDir>/tests/jsunit/**/*.test.js'],
},
{
displayName: 'e2e',
preset: 'jest-puppeteer',
testMatch: ['<rootDir>/tests/jse2e/**/*.test.js'],
},
],
};

module.exports = jestConfig;