Get all platform unit tests to run
This commit is contained in:
parent
5544c57c37
commit
b8baae7c25
@ -16,6 +16,7 @@ module.exports = {
|
||||
],
|
||||
babelrcRoots: ["./platform/*", "./extensions/*"],
|
||||
plugins: [
|
||||
"inline-react-svg",
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-object-rest-spread",
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
|
||||
30
jest.config.base.js
Normal file
30
jest.config.base.js
Normal file
@ -0,0 +1,30 @@
|
||||
const path = require("path");
|
||||
|
||||
module.exports = {
|
||||
verbose: true,
|
||||
roots: ["<rootDir>/src"],
|
||||
transform: {
|
||||
"^.+\\.js$": "babel-jest"
|
||||
},
|
||||
testMatch: ["<rootDir>/src/**/*.test.js"],
|
||||
testPathIgnorePatterns: ["<rootDir>/node_modules/"],
|
||||
moduleFileExtensions: ["js", "jsx"],
|
||||
moduleNameMapper: {
|
||||
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
|
||||
"<rootDir>/src/__mocks__/fileMock.js",
|
||||
"\\.(css|less)$": "identity-obj-proxy"
|
||||
},
|
||||
// Setup
|
||||
// setupFiles: ["jest-canvas-mock/lib/index.js"],
|
||||
// Coverage
|
||||
reporters: ["default", "jest-junit"],
|
||||
collectCoverage: false,
|
||||
collectCoverageFrom: [
|
||||
"<rootDir>/src/**/*.{js,jsx}",
|
||||
// Not
|
||||
"!<rootDir>/src/**/*.test.js",
|
||||
"!**/node_modules/**",
|
||||
"!**/__tests__/**",
|
||||
"!<rootDir>/dist/**"
|
||||
]
|
||||
};
|
||||
16
jest.config.js
Normal file
16
jest.config.js
Normal file
@ -0,0 +1,16 @@
|
||||
// Initiate all tests from root, but allow tests from each package root.
|
||||
// Share as much config as possible to reduce duplication.
|
||||
//
|
||||
// Borrowing from here:
|
||||
// https://github.com/facebook/jest/issues/3112#issuecomment-398581705
|
||||
const base = require("./jest.config.base.js");
|
||||
|
||||
module.exports = {
|
||||
...base,
|
||||
// https://jestjs.io/docs/en/configuration#projects-array-string-projectconfig
|
||||
projects: [
|
||||
// "<rootDir>/extensions/*/jest.config.js",
|
||||
"<rootDir>/platform/*/jest.config.js"
|
||||
],
|
||||
coverageDirectory: "<rootDir>/coverage/"
|
||||
};
|
||||
@ -11,8 +11,10 @@
|
||||
"yarn": "^1.16.0"
|
||||
},
|
||||
"scripts": {
|
||||
"cm": "npx git-cz",
|
||||
"start": "lerna run lerna:start --parallel",
|
||||
"build": "lerna run lerna:build --parallel",
|
||||
"test": "jest --ci --runInBand --collectCoverage",
|
||||
"test:unit": "lerna run lerna:test:unit --parallel",
|
||||
"new-version": "lerna version --conventional-commits --yes",
|
||||
"build:pwa:ci": ""
|
||||
@ -27,6 +29,7 @@
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"babel-eslint": "^10.0.2",
|
||||
"babel-loader": "^8.0.6",
|
||||
"babel-plugin-inline-react-svg": "1.1.0",
|
||||
"babel-plugin-module-resolver": "^3.2.0",
|
||||
"copy-webpack-plugin": "^5.0.3",
|
||||
"cross-env": "^5.2.0",
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
const base = require('../../jest.config.base.js');
|
||||
const pkg = require('./package');
|
||||
|
||||
module.exports = {
|
||||
verbose: true,
|
||||
testPathIgnorePatterns: ["<rootDir>/node_modules/"],
|
||||
testMatch: ["<rootDir>/src/**/*.test.js"],
|
||||
//
|
||||
collectCoverage: false,
|
||||
collectCoverageFrom: [
|
||||
"**/*.{js,jsx}",
|
||||
"!**/node_modules/**",
|
||||
"!<rootDir>/dist/**"
|
||||
],
|
||||
reporters: ["default", "jest-junit"]
|
||||
...base,
|
||||
name: pkg.name,
|
||||
displayName: pkg.name,
|
||||
// rootDir: "../.."
|
||||
// testMatch: [
|
||||
// //`<rootDir>/platform/${pack.name}/**/*.spec.js`
|
||||
// "<rootDir>/platform/viewer/**/*.test.js"
|
||||
// ]
|
||||
};
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
@ -1 +0,0 @@
|
||||
10.15.3
|
||||
@ -1,9 +0,0 @@
|
||||
{
|
||||
"trailingComma": "es5",
|
||||
"printWidth": 80,
|
||||
"proseWrap": "always",
|
||||
"tabWidth": 2,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"endOfLine": "lf"
|
||||
}
|
||||
10
platform/ui/jest.config.js
Normal file
10
platform/ui/jest.config.js
Normal file
@ -0,0 +1,10 @@
|
||||
const base = require("../../jest.config.base.js");
|
||||
const pkg = require("./package");
|
||||
|
||||
const esModules = ["react-dnd"];
|
||||
|
||||
module.exports = {
|
||||
...base,
|
||||
name: pkg.name,
|
||||
displayName: pkg.name
|
||||
};
|
||||
@ -15,14 +15,12 @@
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"cm": "npx git-cz",
|
||||
"lerna:test:unit": "jest --ci --runInBand --collectCoverage && codecov -F ui",
|
||||
"dev": "docz dev",
|
||||
"test": "cross-env CI=1 react-scripts test --env=jsdom --transformIgnorePatterns \"node_modules/(?!react-dnd)/\"",
|
||||
"test:watch": "react-scripts test --env=jsdom --transformIgnorePatterns \"node_modules/(?!react-dnd)/\"",
|
||||
"lerna:build": "webpack --config config/webpack.prod.js -w -d",
|
||||
"build": "rollup -c",
|
||||
"start": "rollup -c -w",
|
||||
"lint": "eslint -c .eslintrc --fix src && prettier --single-quote --write src/**/*.{js,jsx,json,css}",
|
||||
"prepare": "yarn build",
|
||||
"prepublishOnly": "yarn build",
|
||||
"generateStaticSite": "docz build",
|
||||
@ -57,10 +55,7 @@
|
||||
"@mdx-js/tag": "^0.20.3",
|
||||
"all-contributors-cli": "6.7.0",
|
||||
"autoprefixer": "^9.6.0",
|
||||
"babel-plugin-inline-react-svg": "1.1.0",
|
||||
"commitizen": "3.0.7",
|
||||
"cpx": "1.5.0",
|
||||
"cross-env": "^5.2.0",
|
||||
"cz-conventional-changelog": "2.1.0",
|
||||
"docz": "1.2.0",
|
||||
"docz-core": "1.2.0",
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
import * as ReactViewerbase from './index.js';
|
||||
|
||||
describe('Top level exports', () => {
|
||||
test('have not changed', () => {
|
||||
const expectedExports = [
|
||||
'ICONS',
|
||||
//
|
||||
'CineDialog',
|
||||
'Dropdown',
|
||||
'ExpandableToolMenu',
|
||||
'ExampleDropTarget',
|
||||
'Icon',
|
||||
'LayoutButton',
|
||||
'LayoutChooser',
|
||||
'LayoutManager',
|
||||
'LayoutPanelDropTarget',
|
||||
'MeasurementTable',
|
||||
'MeasurementTableItem',
|
||||
'Overlay',
|
||||
'OverlayTrigger',
|
||||
'PlayClipButton',
|
||||
'QuickSwitch',
|
||||
'RoundedButtonGroup',
|
||||
'ScrollableArea',
|
||||
'SelectTree',
|
||||
'SimpleDialog',
|
||||
'StudyBrowser',
|
||||
'StudyList',
|
||||
'TableList',
|
||||
'TableListItem',
|
||||
'ThumbnailEntry',
|
||||
'Toolbar',
|
||||
'ToolbarButton',
|
||||
'ToolbarSection',
|
||||
'Tooltip',
|
||||
'AboutModal',
|
||||
'UserPreferences',
|
||||
'UserPreferencesModal',
|
||||
'ViewerbaseDragDropContext',
|
||||
].sort();
|
||||
|
||||
const exports = Object.keys(ReactViewerbase).sort();
|
||||
|
||||
expect(exports).toEqual(expectedExports);
|
||||
});
|
||||
});
|
||||
@ -1,22 +1,22 @@
|
||||
const webpack = require('webpack');
|
||||
const merge = require('webpack-merge');
|
||||
const path = require('path');
|
||||
const common = require('./webpack.common');
|
||||
const webpack = require("webpack");
|
||||
const merge = require("webpack-merge");
|
||||
const path = require("path");
|
||||
const common = require("./webpack.common");
|
||||
|
||||
const SRC_DIR = path.join(__dirname, '../src');
|
||||
const DIST_DIR = path.join(__dirname, '../dist');
|
||||
const INDEX = path.join(DIST_DIR, 'index.html');
|
||||
const SRC_DIR = path.join(__dirname, "../src");
|
||||
const DIST_DIR = path.join(__dirname, "../dist");
|
||||
const INDEX = path.join(DIST_DIR, "index.html");
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
const commonConfig = common(env, argv);
|
||||
|
||||
return merge(commonConfig, {
|
||||
mode: 'development',
|
||||
devtool: 'cheap-module-source-map',
|
||||
mode: "development",
|
||||
devtool: "cheap-module-source-map",
|
||||
output: {
|
||||
path: DIST_DIR,
|
||||
publicPath: '/',
|
||||
filename: '[name].bundle.js',
|
||||
publicPath: "/",
|
||||
filename: "[name].bundle.js"
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
@ -24,26 +24,26 @@ module.exports = (env, argv) => {
|
||||
test: /\.(gif|jp?g|png|svg|ico)$/i,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
loader: "file-loader",
|
||||
options: {
|
||||
name: '[path][name].[ext]',
|
||||
context: SRC_DIR,
|
||||
},
|
||||
},
|
||||
],
|
||||
name: "[path][name].[ext]",
|
||||
context: SRC_DIR
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.(ttf|eot|woff|woff2)$/i,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
loader: "file-loader",
|
||||
options: {
|
||||
name: '[name].[ext]',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
name: "[name].[ext]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [new webpack.HotModuleReplacementPlugin()],
|
||||
devServer: {
|
||||
@ -52,11 +52,12 @@ module.exports = (env, argv) => {
|
||||
compress: false,
|
||||
// contentBase: DIST_DIR,
|
||||
open: true,
|
||||
port: 3001,
|
||||
port: 3000,
|
||||
writeToDisk: true,
|
||||
historyApiFallback: {
|
||||
index: '/',
|
||||
},
|
||||
},
|
||||
historyApiFallback: true
|
||||
// {
|
||||
// index: '/',
|
||||
// },
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@ -1,26 +1,14 @@
|
||||
const path = require("path");
|
||||
const base = require("../../jest.config.base.js");
|
||||
const pkg = require("./package");
|
||||
|
||||
module.exports = {
|
||||
verbose: true,
|
||||
testMatch: ["<rootDir>/src/**/*.test.js"],
|
||||
//
|
||||
collectCoverage: false,
|
||||
collectCoverageFrom: [
|
||||
"<rootDir>/src/**/*.{js,jsx}",
|
||||
"!<rootDir>/src/**/*.test.js",
|
||||
"!**/node_modules/**",
|
||||
"!**/__tests__/**"
|
||||
],
|
||||
reporters: ["default", "jest-junit"],
|
||||
//
|
||||
transform: {
|
||||
"^.+\\.js$": path.resolve(__dirname, "./jestBabelTransform.js")
|
||||
},
|
||||
moduleNameMapper: {
|
||||
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
|
||||
"<rootDir>/src/__mocks__/fileMock.js",
|
||||
"\\.(css|less)$": "identity-obj-proxy"
|
||||
},
|
||||
setupFiles: ["<rootDir>../../node_modules/jest-canvas-mock/lib/index.js"],
|
||||
setupTestFrameworkScriptFile: "<rootDir>/src/__tests__/globalSetup.js"
|
||||
...base,
|
||||
name: pkg.name,
|
||||
displayName: pkg.name,
|
||||
setupFilesAfterEnv: ["<rootDir>/src/__tests__/globalSetup.js"]
|
||||
// rootDir: "../.."
|
||||
// testMatch: [
|
||||
// //`<rootDir>/platform/${pack.name}/**/*.spec.js`
|
||||
// "<rootDir>/platform/viewer/**/*.test.js"
|
||||
// ]
|
||||
};
|
||||
|
||||
@ -14,15 +14,13 @@
|
||||
"proxy": "http://localhost:8042",
|
||||
"scripts": {
|
||||
"lerna:start": "cross-env NODE_ENV=development webpack-dev-server --config config/webpack.dev.js --mode development -w -d",
|
||||
"lerna:test:unit": "jest --ci --runInBand --collectCoverage --reporters=default --reporters=jest-junit && codecov",
|
||||
"cm": "npx git-cz",
|
||||
"lerna:test:unit": "jest --ci --runInBand --collectCoverage && codecov -F viewer",
|
||||
"dev": "yarn run preBuild && react-scripts start",
|
||||
"dev:debug": "react-scripts start",
|
||||
"build:package": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c",
|
||||
"build:package:ci": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c",
|
||||
"build:web": "yarn run preBuild && react-scripts --max_old_space_size=4096 build",
|
||||
"build:demo:ci": "yarn run preBuild && cross-env PUBLIC_URL=/ REACT_APP_CONFIG=config/demo.js react-scripts --max_old_space_size=4096 build",
|
||||
"lint": "eslint -c .eslintrc --fix src && prettier --single-quote --write src/**/*.{js,jsx,json,css}",
|
||||
"test:unit": "jest",
|
||||
"test:e2e:ci": "start-server-and-test start http://localhost:5000 cy:run:ci",
|
||||
"start": "yarn run dev",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user