Skip to content
New issue

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

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

Already on GitHub? # to your account

MNT Get JS tests passing again #256

Merged
merged 1 commit into from
Feb 13, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('CampaignAdminItem', () => {
beforeEach(() => {
props = {
sectionConfig: {
reactRoutePath: '',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is new for CMS 5 and isn't allowed to be missing.

publishEndpoint: {
url: '/',
method: 'get',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import React from 'react';
import { Component as CampaignAdminList } from '../CampaignAdminList';
import Enzyme, { shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { setImmediate } from 'core-js';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://stackoverflow.com/a/68724767/10936596
Fixes ReferenceError: setImmediate is not defined which is test-specific.


Enzyme.configure({ adapter: new Adapter() });

Expand All @@ -16,7 +17,9 @@ describe('CampaignAdminList', () => {

beforeEach(() => {
props = {
sectionConfig: {},
sectionConfig: {
reactRoutePath: '',
},
itemListViewEndpoint: { url: '', method: 'POST' },
record: {
ID: 3,
Expand Down
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"node": "^18.x"
},
"scripts": {
"build": "yarn && yarn lint && rm -rf client/dist/* && NODE_ENV=production webpack --mode production --bail --progress",
"build": "yarn && yarn lint && yarn test && rm -rf client/dist/* && NODE_ENV=production webpack --mode production --bail --progress",
"dev": "NODE_ENV=development webpack --progress",
"watch": "yarn && NODE_ENV=development webpack --watch --progress",
"css": "yarn && WEBPACK_CHILD=css webpack -p --bail --progress",
Expand Down Expand Up @@ -57,6 +57,9 @@
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.7",
"jest-cli": "^29.3.0",
"jest-environment-jsdom": "^29.3.1",
"react-16": "npm:react@^16.14.0",
"react-dom-16": "npm:react-dom@^16.14.0",
"toposort": "^2.0.2",
"validator": "^13.7.0",
"webpack": "^5.74.0",
Expand All @@ -69,9 +72,15 @@
"defaults"
],
"jest": {
"testEnvironment": "jsdom",
"roots": [
"client/src"
],
"moduleNameMapper": {
"^react-dom/client$": "react-dom-16",
"^react-dom((/.*)?)$": "react-dom-16$1",
"^react((/.*)?)$": "react-16$1"
},
"modulePaths": [
"client/src",
"../admin/client/src",
Expand All @@ -85,11 +94,5 @@
"transform": {
".*": "babel-jest"
}
},
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-react"
]
}
}
Loading