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

Add component feature testing #156

Merged
merged 11 commits into from
Sep 24, 2024
15 changes: 10 additions & 5 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches: [ main ]

env:
HUSKY: 0
GITHUB_DEPLOY_KEY: ${{ secrets.GH_DEPLOY_KEY }}
ECR_NAME: ${{ secrets.ECR_NAME }}
KUBE_CLUSTER: ${{ secrets.KUBE_CLUSTER }}
Expand Down Expand Up @@ -44,15 +45,19 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: mojds-package
path: package
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Test Sass can be compiled
- name: npm install
run: npm install
- name: Run JS tests
run: npm run test:js
- uses: actions/download-artifact@v4
with:
name: mojds-package
path: package
- name: Test that sass can be compiled
run: npm run test:sass

deploy:
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,19 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: mojds-package
path: package
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Test Sass can be compiled
- name: npm install
run: npm install
- name: Run JS tests
run: npm run test:js
- uses: actions/download-artifact@v4
with:
name: mojds-package
path: package
- name: Test that sass can be compiled
run: npm run test:sass

publish:
Expand Down
5 changes: 5 additions & 0 deletions .husky/install.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Skip Husky install in production and CI
if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') {
process.exit(0)
}
const husky = (await import('husky')).default
4 changes: 2 additions & 2 deletions gulp/build-javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gulp.task('build:javascript', () => {
'src/moj/namespace.js',
'src/moj/helpers.js',
'src/moj/all.js',
'src/moj/components/**/*.js'
'src/moj/components/**/!(*.spec).js'
])
.pipe(concat('all.js'))
.pipe(umd({
Expand All @@ -29,7 +29,7 @@ gulp.task('build:javascript-with-jquery', () => {
'src/moj/namespace.js',
'src/moj/helpers.js',
'src/moj/all.js',
'src/moj/components/**/*.js',
'src/moj/components/**/!(*.spec).js',
])
.pipe(concat('all.jquery.min.js'))
.pipe(umd({
Expand Down
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const config = {
testEnvironment: "jsdom",
setupFilesAfterEnv: ["./jest.setup.js"],
};
module.exports = config;
7 changes: 7 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require("@testing-library/jest-dom");
require("./src/moj/vendor/jquery");

const { toHaveNoViolations } = require("jest-axe");
expect.extend(toHaveNoViolations);

MOJFrontend = {};
Loading