Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Update Bar unit tests to use Jest #324

Merged
merged 24 commits into from
Jan 8, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
npm run lint
- name: Testing Project
run: |
npm run karma
npm run jest
wdio:
runs-on: ubuntu-latest

Expand Down
12 changes: 7 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ const jestConfig = require('@cerner/jest-config-terra');

module.exports = {
...jestConfig,
setupFiles: [
'./jest.enzymeSetup.js',
],
snapshotSerializers: [
'enzyme-to-json/serializer',
testMatch: [
'**/carbon-graphs/tests/unit/controls/Bar/(*.)(test.js)',
// The patterns below are temporarily commented out as not all tests are updated to work with Jest.
// Updating them is currently a work in progress.
// '**/tests/unit/**/(*.)(test.js)',
// '**/tests/unit/**/**/(*.)(test.js)',
],
};

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0",
"description": "terra-graphs",
"engines": {
"node": "^10.0.0 || ^12.0.0 || ^14.0.0"
"node": "10 || 12 || 14"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -36,7 +36,7 @@
"@babel/runtime": "^7.10.4",
"@cerner/browserslist-config-terra": "^3.0.0",
"@cerner/eslint-config-terra": "^5.0.0",
"@cerner/jest-config-terra": "^1.0.0",
"@cerner/jest-config-terra": "2",
"@cerner/stylelint-config-terra": "^4.0.0",
"@cerner/terra-cli": "^1.6.0",
"@cerner/terra-dev-site": "8",
Expand Down Expand Up @@ -72,7 +72,8 @@
"eslint-plugin-standard": "^4.0.1",
"glob": "^7.1.1",
"html-webpack-plugin": "^4.3.0",
"jest": "^26.6.3",
"jest": "27",
"jest-environment-jsdom": "27",
"jsdoc": "^3.6.4",
"ky": "^0.12.0",
"lerna": "^6.4.1",
Expand Down Expand Up @@ -120,7 +121,7 @@
"danger": "danger ci",
"dev": "node packages/carbon-graphs/webpack/dev-server.js",
"heroku-postbuild": "npm install --only=dev && npm run compile:prod",
"jest": "jest",
"jest": "jest --no-coverage",
"jest:coverage": "jest --coverage",
"link-parent-bin": "link-parent-bin",
"lint": "npm run lint:js && npm run lint:scss",
Expand All @@ -133,7 +134,7 @@
"start-heroku": "terra express-server --port $PORT --site build",
"start-prod": "webpack-dev-server --env.disableHotReloading -p",
"start-static": "npm run compile:prod && terra express-server --site ./build",
"test": "npm run lint && npm run jest && npm run karma && npm run wdio-default",
"test": "npm run lint && npm run jest && npm run wdio-default",
"test:docker": "npm run lint && npm run jest && && npm run karma && npm run wdio-default:docker",
"karma": "karma start ./packages/carbon-graphs/karma.config.js --single-run --no-auto-watch",
"wdio": "npm run compile && npm run wdio-default",
Expand Down
20 changes: 20 additions & 0 deletions packages/carbon-graphs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = (api) => {
api.cache(false);
api.assertVersion('^7.4.4');

const presets = [
'@babel/preset-env',
'@babel/preset-react',
];

const plugins = [
'@babel/plugin-proposal-object-rest-spread',
Copy link

@kenk2 kenk2 Jan 8, 2024

Choose a reason for hiding this comment

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

Maybe not in this PR but I believe this is the deprecated version of this plugin. If you're continuing work on this it might be a good idea to use @babel/plugin-transform-object-rest-spread like we're doing here with the other babel plugins.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing that out! I'll make that change in the next PR.

'@babel/plugin-transform-object-assign',
'@babel/plugin-transform-runtime',
];

return {
presets,
plugins,
};
};
12 changes: 12 additions & 0 deletions packages/carbon-graphs/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const jestConfig = require('@cerner/jest-config-terra');

module.exports = {
...jestConfig,
testMatch: [
'**/tests/unit/controls/Bar/(*.)(test.js)',
// The patterns below are temporarily commented out as not all tests are updated to work with Jest.
// Updating them is currently a work in progress.
// '**/tests/unit/**/(*.)(test.js)',
// '**/tests/unit/**/**/(*.)(test.js)',
],
};
Loading
Loading