mirror of
https://github.com/strapi/strapi.git
synced 2025-06-27 00:41:25 +00:00
Package.json script configuration per package
This commit is contained in:
parent
ee757b3276
commit
fbc9dc2382
@ -33,12 +33,15 @@ module.exports = {
|
|||||||
testPathIgnorePatterns: [
|
testPathIgnorePatterns: [
|
||||||
'/node_modules/',
|
'/node_modules/',
|
||||||
'<rootDir>/examples/getstarted/',
|
'<rootDir>/examples/getstarted/',
|
||||||
|
'<rootDir>/examples/kitchensink/',
|
||||||
'<rootDir>/packages/strapi-helper-plugin/dist/',
|
'<rootDir>/packages/strapi-helper-plugin/dist/',
|
||||||
'__tests__',
|
'__tests__',
|
||||||
],
|
],
|
||||||
setupFiles: [
|
setupFiles: [
|
||||||
'<rootDir>/test/config/front/test-bundler.js',
|
'<rootDir>/test/config/front/test-bundler.js',
|
||||||
'<rootDir>/packages/admin-test-utils/lib/mocks/LocalStorageMock.js',
|
'<rootDir>/packages/admin-test-utils/lib/mocks/LocalStorageMock.js',
|
||||||
|
'<rootDir>/packages/admin-test-utils/lib/mocks/IntersectionObserver.js',
|
||||||
|
'<rootDir>/packages/admin-test-utils/lib/mocks/ResizeObserver.js',
|
||||||
],
|
],
|
||||||
setupFilesAfterEnv: [
|
setupFilesAfterEnv: [
|
||||||
'<rootDir>/test/config/front/enzyme-setup.js',
|
'<rootDir>/test/config/front/enzyme-setup.js',
|
||||||
|
@ -1,84 +1,13 @@
|
|||||||
const IS_EE = process.env.IS_EE === 'true';
|
const baseConfigFront = require('./jest.base-config.front');
|
||||||
|
|
||||||
const moduleNameMapper = {
|
|
||||||
'.*\\.(css|less|styl|scss|sass)$': '<rootDir>/test/config/front/mocks/cssModule.js',
|
|
||||||
'.*\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$':
|
|
||||||
'<rootDir>/test/config/front/mocks/image.js',
|
|
||||||
'^ee_else_ce(/.*)$': [
|
|
||||||
'<rootDir>/packages/core/admin/admin/src$1',
|
|
||||||
'<rootDir>/packages/core/content-manager/admin/src$1',
|
|
||||||
'<rootDir>/packages/core/content-type-builder/admin/src$1',
|
|
||||||
'<rootDir>/packages/core/upload/admin/src$1',
|
|
||||||
'<rootDir>/packages/core/email/admin/src$1',
|
|
||||||
'<rootDir>/packages/plugins/*/admin/src$1',
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
if (IS_EE) {
|
|
||||||
const rootDirEE = [
|
|
||||||
'<rootDir>/packages/core/admin/ee/admin$1',
|
|
||||||
'<rootDir>/packages/core/content-manager/ee/admin/src$1',
|
|
||||||
'<rootDir>/packages/core/content-type-builder/ee/admin/src$1',
|
|
||||||
'<rootDir>/packages/core/upload/ee/admin/src$1',
|
|
||||||
'<rootDir>/packages/core/email/ee/admin/src$1',
|
|
||||||
'<rootDir>/packages/plugins/*/ee/admin/src$1',
|
|
||||||
];
|
|
||||||
|
|
||||||
Object.assign(moduleNameMapper, {
|
|
||||||
'^ee_else_ce(/.*)$': rootDirEE,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
collectCoverageFrom: [
|
...baseConfigFront,
|
||||||
'packages/core/*/admin/src/**/*.js',
|
projects: [
|
||||||
'packages/plugins/*/admin/src/**/*.js',
|
'<rootDir>/packages/core/admin/jest.config.front.js',
|
||||||
|
'<rootDir>/packages/core/content-manager/jest.config.front.js',
|
||||||
|
'<rootDir>/packages/core/content-type-builder/jest.config.front.js',
|
||||||
|
'<rootDir>/packages/core/upload/jest.config.front.js',
|
||||||
|
'<rootDir>/packages/core/email/jest.config.front.js',
|
||||||
|
'<rootDir>/packages/plugins/*/jest.config.front.js',
|
||||||
],
|
],
|
||||||
globals: {
|
|
||||||
__webpack_public_path__: 'http://localhost:4000',
|
|
||||||
strapi: {
|
|
||||||
backendURL: 'http://localhost:1337',
|
|
||||||
isEE: false,
|
|
||||||
features: [],
|
|
||||||
projectType: 'Community',
|
|
||||||
},
|
|
||||||
BACKEND_URL: 'http://localhost:1337',
|
|
||||||
ADMIN_PATH: '/admin',
|
|
||||||
NODE_ENV: 'test',
|
|
||||||
|
|
||||||
// FIXME create a clean config file
|
|
||||||
},
|
|
||||||
moduleDirectories: [
|
|
||||||
'node_modules',
|
|
||||||
'<rootDir>/packages/strapi-admin/node_modules',
|
|
||||||
'<rootDir>/test/config/front',
|
|
||||||
],
|
|
||||||
moduleNameMapper,
|
|
||||||
rootDir: process.cwd(),
|
|
||||||
setupFiles: [
|
|
||||||
'<rootDir>/test/config/front/test-bundler.js',
|
|
||||||
'<rootDir>/packages/admin-test-utils/lib/mocks/LocalStorageMock.js',
|
|
||||||
'<rootDir>/packages/admin-test-utils/lib/mocks/IntersectionObserver.js',
|
|
||||||
'<rootDir>/packages/admin-test-utils/lib/mocks/ResizeObserver.js',
|
|
||||||
],
|
|
||||||
testPathIgnorePatterns: [
|
|
||||||
'/node_modules/',
|
|
||||||
'<rootDir>/examples/getstarted/',
|
|
||||||
'<rootDir>/examples/kitchensink/',
|
|
||||||
'<rootDir>/packages/strapi-helper-plugin/dist/',
|
|
||||||
'/OLD/',
|
|
||||||
'__tests__',
|
|
||||||
],
|
|
||||||
setupFilesAfterEnv: [
|
|
||||||
'<rootDir>/test/config/front/enzyme-setup.js',
|
|
||||||
'<rootDir>/test/config/front/strapi.js',
|
|
||||||
],
|
|
||||||
testRegex: 'tests/.*\\.test\\.js$',
|
|
||||||
transform: {
|
|
||||||
'^.+\\.js$': ['@swc-node/jest', { jsx: true, dynamicImport: true }],
|
|
||||||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
|
||||||
'<rootDir>/fileTransformer.js',
|
|
||||||
},
|
|
||||||
transformIgnorePatterns: ['node_modules/(?!(react-dnd|dnd-core|react-dnd-html5-backend)/)'],
|
|
||||||
testURL: 'http://localhost:4000/admin',
|
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const baseConfig = require('./jest.base-config')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'Unit test',
|
...baseConfig,
|
||||||
testMatch: ['<rootDir>/packages/**/__tests__/?(*.)+(spec|test).js'],
|
projects: [
|
||||||
modulePathIgnorePatterns: ['.cache'],
|
'<rootDir>/packages/core/admin',
|
||||||
transform: {},
|
'<rootDir>/packages/core/content-manager',
|
||||||
setupFilesAfterEnv: ['<rootDir>/test/unit.setup.js'],
|
'<rootDir>/packages/core/content-type-builder',
|
||||||
|
'<rootDir>/packages/core/database',
|
||||||
|
'<rootDir>/packages/core/email',
|
||||||
|
'<rootDir>/packages/core/helper-plugin',
|
||||||
|
'<rootDir>/packages/core/strapi',
|
||||||
|
'<rootDir>/packages/core/upload',
|
||||||
|
'<rootDir>/packages/core/utils',
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
"prettier:other": "prettier \"**/*.{md,css,scss,yaml,yml}\"",
|
"prettier:other": "prettier \"**/*.{md,css,scss,yaml,yml}\"",
|
||||||
"test:clean": "rimraf ./coverage",
|
"test:clean": "rimraf ./coverage",
|
||||||
"test:front": "npm run test:clean && cross-env NODE_ENV=test IS_EE=true jest --config ./jest.config.front.js",
|
"test:front": "npm run test:clean && cross-env NODE_ENV=test IS_EE=true jest --config ./jest.config.front.js",
|
||||||
"test:front:watch": "cross-env NODE_ENV=test IS_EE=true jest --config ./jest.config.front.js --watchAll",
|
"test:front:watch": "cross-env NODE_ENV=test IS_EE=true jest --config ./jest.config.front.js --watch ",
|
||||||
"test:front:update": "cross-env NODE_ENV=test IS_EE=true jest --config ./jest.config.front.js --u",
|
"test:front:update": "cross-env NODE_ENV=test IS_EE=true jest --config ./jest.config.front.js --u",
|
||||||
"test:front:ce": "npm run test:clean && cross-env NODE_ENV=test IS_EE=false jest --config ./jest.config.front.js --coverage",
|
"test:front:ce": "npm run test:clean && cross-env NODE_ENV=test IS_EE=false jest --config ./jest.config.front.js --coverage",
|
||||||
"test:front:watch:ce": "cross-env NODE_ENV=test IS_EE=false jest --config ./jest.config.front.js --watchAll",
|
"test:front:watch:ce": "cross-env NODE_ENV=test IS_EE=false jest --config ./jest.config.front.js --watchAll",
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
|
|
||||||
|
const baseConfig = require('../../../jest.base-config')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
testPathIgnorePatterns: ['<rootDir>/'],
|
displayName: 'admin',
|
||||||
};
|
...baseConfig,
|
||||||
|
rootDir: '../../..',
|
||||||
|
testMatch: [`<rootDir>/packages/core/admin${baseConfig.testMatch}`]
|
||||||
|
}
|
@ -8,7 +8,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublishOnly": "node ./scripts/build.js",
|
"prepublishOnly": "node ./scripts/build.js",
|
||||||
"test": "echo \"no tests yet\"",
|
"test:front": "jest --config jest.config.front.js",
|
||||||
"develop": "cross-env NODE_ENV=development webpack serve --config webpack.config.dev.js --progress profile",
|
"develop": "cross-env NODE_ENV=development webpack serve --config webpack.config.dev.js --progress profile",
|
||||||
"develop:ce": "STRAPI_DISABLE_EE=true webpack serve --config webpack.config.dev.js --progress profile",
|
"develop:ce": "STRAPI_DISABLE_EE=true webpack serve --config webpack.config.dev.js --progress profile",
|
||||||
"analyze:bundle": "ANALYZE_BUNDLE=true webpack --config webpack.config.dev.js",
|
"analyze:bundle": "ANALYZE_BUNDLE=true webpack --config webpack.config.dev.js",
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"kind": "plugin"
|
"kind": "plugin"
|
||||||
},
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test:front": "jest --config jest.config.front.js"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sindresorhus/slugify": "1.1.0",
|
"@sindresorhus/slugify": "1.1.0",
|
||||||
"@strapi/utils": "3.6.8",
|
"@strapi/utils": "3.6.8",
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
"description": "content-type-builder.plugin.description",
|
"description": "content-type-builder.plugin.description",
|
||||||
"kind": "plugin"
|
"kind": "plugin"
|
||||||
},
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test:front": "jest --config jest.config.front.js"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sindresorhus/slugify": "1.1.0",
|
"@sindresorhus/slugify": "1.1.0",
|
||||||
"@strapi/generators": "3.6.8",
|
"@strapi/generators": "3.6.8",
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"kind": "plugin"
|
"kind": "plugin"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"no tests yet\""
|
"test:front": "jest --config jest.config.front.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash": "4.17.21",
|
"lodash": "4.17.21",
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
|
|
||||||
|
const baseConfig = require('../../../jest.base-config')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
testMatch: ['**/(*.)+(spec|test).js'],
|
displayName: 'strapi',
|
||||||
};
|
...baseConfig,
|
||||||
|
rootDir: '../../..',
|
||||||
|
testMatch: [`<rootDir>/packages/core/strapi${baseConfig.testMatch}`]
|
||||||
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"kind": "plugin"
|
"kind": "plugin"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"no tests yet\""
|
"test:front": "jest --config jest.config.front.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@strapi/helper-plugin": "3.6.8",
|
"@strapi/helper-plugin": "3.6.8",
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"kind": "plugin"
|
"kind": "plugin"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"no tests yet\""
|
"test:front": "jest --config jest.config.front.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@strapi/helper-plugin": "3.6.8",
|
"@strapi/helper-plugin": "3.6.8",
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"kind": "plugin"
|
"kind": "plugin"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"no tests yet\""
|
"test:front": "jest --config jest.config.front.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/federation": "^0.28.0",
|
"@apollo/federation": "^0.28.0",
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
"required": false,
|
"required": false,
|
||||||
"kind": "plugin"
|
"kind": "plugin"
|
||||||
},
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test:front": "jest --config jest.config.front.js"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@strapi/utils": "3.6.8",
|
"@strapi/utils": "3.6.8",
|
||||||
"lodash": "4.17.21"
|
"lodash": "4.17.21"
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
"description": "sentry.plugin.description",
|
"description": "sentry.plugin.description",
|
||||||
"kind": "plugin"
|
"kind": "plugin"
|
||||||
},
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test:front": "jest --config jest.config.front.js"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sentry/node": "6.7.1"
|
"@sentry/node": "6.7.1"
|
||||||
},
|
},
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"kind": "plugin"
|
"kind": "plugin"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"no tests yet\""
|
"test:front": "jest --config jest.config.front.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@purest/providers": "^1.0.2",
|
"@purest/providers": "^1.0.2",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user