Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into ts-migration-core
Browse files Browse the repository at this point in the history
# Conflicts:
#	yarn.lock
  • Loading branch information
scottrippey committed Jun 2, 2022
2 parents 6e5fa9f + 7d65367 commit 30a39f6
Show file tree
Hide file tree
Showing 78 changed files with 387 additions and 12,593 deletions.
22 changes: 7 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Use [Yarn](https://yarnpkg.com/) to install dependencies:
$ yarn install
```

> *Note*: We use Yarn 1 and not the newer, different Yarn 2+ projects. Please use at least the minimum `yarn` version specified in `package.json:engines.yarn`.
> _Note_: We use Yarn 1 and not the newer, different Yarn 2+ projects. Please use at least the minimum `yarn` version specified in `package.json:engines.yarn`.
Run a development server and check out the demos. This command will also build and watch `lib/` and `es/` directories in all packages, so your demos will always be in sync with code changes.

Expand All @@ -60,32 +60,24 @@ $ lerna exec --scope victory-core -- yarn nps build-libs

## Checks, Tests

When running a development server, tests will be served automatically at http://localhost:3001/test/client/test.html

Tests may also be run in the terminal with:
Tests can be run in the terminal with:

```sh
# Build and run all tests.
$ yarn nps test

# Run just Karma tests (packages must be already built).
$ yarn nps karma
$ KARMA_CAPTURE_CONSOLE=true yarn nps karma # Same, but enable console logging in CLI
# Run a watch script for tests and packages.
$ yarn nps test.watch
```

If your terminal is under a proxy, you should turn off the proxy, or ChromeHeadless will not start properly.

If you are debugging tests with Karma, it's usually easier to debug in a real browser. An example workflow:
You can also run the watch script in a separate terminal window to add arguments or isolate specific tests.

```sh
# In one terminal run a watch on library files
$ yarn nps watch

# In another terminal the browser Karma server
$ yarn nps server.test

# Open a browser
$ open http://localhost:3001/test/client/test.html
# In another terminal the jest script
$ yarn nps "jest <module> --watch"
```

Victory uses eslint and prettier to maintain code style consistency. Before creating a pull request, please lint and format your changes with the following commands:
Expand Down
28 changes: 0 additions & 28 deletions config/karma/karma.conf.coverage.js

This file was deleted.

46 changes: 0 additions & 46 deletions config/karma/karma.conf.dev.js

This file was deleted.

56 changes: 0 additions & 56 deletions config/karma/karma.conf.js

This file was deleted.

23 changes: 0 additions & 23 deletions config/webpack/webpack.config.coverage.js

This file was deleted.

23 changes: 9 additions & 14 deletions package-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,20 @@ module.exports = {
hot: "webpack serve --config ./config/webpack/demo/webpack.config.hot.js --inline --hot --content-base demo/js",
test: "webpack serve --config ./config/webpack/webpack.config.test.js"
},
karma: {
ci: "karma start --browsers ChromeHeadlessCustom,Firefox ./config/karma/karma.conf.coverage.js",
cov: "karma start ./config/karma/karma.conf.coverage.js",
watch: "karma start --auto-watch ./config/karma/karma.conf.js",
default: "karma start ./config/karma/karma.conf.js"
},
jest: {
native: "jest --config=jest-native-config.js",
default: "cross-env BABEL_ENV=commonjs jest --config=jest-config.js"
default: "cross-env BABEL_ENV=commonjs jest --config=jest-config.js",
watch:
"cross-env BABEL_ENV=commonjs jest --watch --config=jest-config.js",
cov: "cross-env BABEL_ENV=commonjs jest --coverage --config=jest-config.js"
},
"test-node": {
default: "mocha ./test/node"
default: "jest ./test/node"
},
test: {
cov: npsUtils.series.nps("build-package-libs", "karma.cov"),
dev: "karma start ./config/karma/karma.conf.dev.js",
watch: npsUtils.concurrent.nps("watch", "karma.watch"),
default: npsUtils.series.nps("build-package-libs", "karma")
cov: npsUtils.series.nps("build-package-libs", "jest.default"),
watch: npsUtils.concurrent.nps("watch", "jest.watch"),
default: npsUtils.series.nps("build-package-libs", "jest.cov")
},
storybook: {
server: "start-storybook -p 6006",
Expand Down Expand Up @@ -91,8 +87,7 @@ module.exports = {
"build-package-dists",
"test-node",
"jest",
"jest.native",
"karma.ci"
"jest.native"
),
cov: npsUtils.series.nps("lint", "test.cov"),
dev: npsUtils.series.nps("lint", "test.dev"),
Expand Down
23 changes: 2 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"@storybook/react": "^6.5.5",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.2",
"@testing-library/react-native": "^9.1.0",
"@types/jest": "^27.5.1",
"@types/lodash": "^4.14.149",
"@types/react": "^16.14.26",
Expand All @@ -79,47 +80,28 @@
"babel-plugin-lodash": "^3.1.2",
"babel-plugin-module-resolver": "^4.1.0",
"babel-preset-react-native": "^4.0.1",
"chai": "^3.5.0",
"chromatic": "^5.0.0",
"cross-env": "^7.0.3",
"emotion-theming": "^10.0.27",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"eslint": "^7.32.0",
"eslint-config-formidable": "^2.0.1",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-filenames": "^1.2.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jest": "^25.2.2",
"eslint-plugin-mocha": "^5.0.0",
"eslint-plugin-react": "^7.0.0",
"eslint-plugin-react-hooks": "^4.2.0",
"glob": "7.1.2",
"immutable": "^3.8.2",
"istanbul": "^0.4.5",
"istanbul-instrumenter-loader": "^3.0.0",
"jest": "^28.1.0",
"jest-environment-jsdom": "^28.1.0",
"json-loader": "^0.5.4",
"karma": "^6.3.19",
"karma-benchmark": "^1.0.4",
"karma-benchmarkjs-reporter": "^1.0.0",
"karma-chrome-launcher": "^3.1.1",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-firefox-launcher": "^2.1.2",
"karma-ie-launcher": "^1.0.0",
"karma-mocha": "^2.0.1",
"karma-safari-launcher": "^1.0.0",
"karma-sauce-launcher": "^4.1.5",
"karma-spec-reporter": "0.0.34",
"karma-webpack": "^5.0.0",
"lerna": "^3.22.0",
"link-parent-bin": "^2.0.0",
"lodash": "^4.17.19",
"lodash-webpack-plugin": "^0.11.6",
"metro-react-native-babel-preset": "0.66.2",
"mocha": "^5.0.0",
"node-polyfill-webpack-plugin": "^1.1.4",
"nps": "^5.9.0",
"nps-utils": "^1.5.0",
Expand All @@ -128,10 +110,9 @@
"react": "^16.14.0",
"react-dom": "^16.13.1",
"react-hot-loader": "v2.0.0-alpha-4",
"react-test-renderer": "^16.13.1",
"rimraf": "^3.0.2",
"seedrandom": "^2.4.3",
"sinon": "^11.1.2",
"sinon-chai": "^3.7.0",
"storybook-addon-performance": "^0.10.0",
"ts-jest": "^28.0.3",
"ts-loader": "^9.3.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/victory-core/src/victory-util/add-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import * as Events from "./events";
import isEqual from "react-fast-compare";
import VictoryTransition from "../victory-transition/victory-transition";

// DISCLAIMER:
// This file is not currently tested, and it is first on the list of files
// to refactor in our current refactoring effort. Please do not make changes
// to this file without manual testing and/or refactoring and adding tests.

const datumHasXandY = (datum) => {
return !isNil(datum._x) && !isNil(datum._y);
};
Expand Down
5 changes: 5 additions & 0 deletions packages/victory-shared-events/src/victory-shared-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ import {
import isEqual from "react-fast-compare";
import stringify from "json-stringify-safe";

// DISCLAIMER:
// This file is not currently tested, and it is first on the list of files
// to refactor in our current refactoring effort. Please do not make changes
// to this file without manual testing and/or refactoring and adding tests.

export default class VictorySharedEvents extends React.Component {
static displayName = "VictorySharedEvents";

Expand Down
7 changes: 3 additions & 4 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"extends": ["../.eslintrc.js"],
"env": { "mocha": true },
"plugins": ["mocha"],
"env": { "jest": true },
"rules": {
"react/sort-comp": "off",
"mocha/no-exclusive-tests": 2,
"no-magic-numbers": 0,
"max-statements": 0,
"import/no-unresolved": 0
"import/no-unresolved": 0,
"no-undef": "off"
},
"globals": { "expect": false }
}
Loading

0 comments on commit 30a39f6

Please sign in to comment.