Boost CI (#1643)
* Boost CI * Split CI tests in 2 * Try caching node modules * Try caching node modules * Try caching node modules * Improve CI * Improve CI * Improve CI * Improve CI * Improve CI * Improve CI * Separate jest tests * Fix typo * Re-order tests jobs
This commit is contained in:
@ -1,5 +1,18 @@
|
||||
const path = require('path');
|
||||
|
||||
computeStoriesGlob = () => {
|
||||
if (process.env.STORYBOOK_STORIES_FOLDER === 'pages') {
|
||||
return ['../src/pages/**/*.stories.@(js|jsx|ts|tsx)', '../src/__stories__/*.stories.@(js|jsx|ts|tsx)']
|
||||
}
|
||||
|
||||
if (process.env.STORYBOOK_STORIES_FOLDER === 'modules') {
|
||||
return ['../src/modules/**/*.stories.@(js|jsx|ts|tsx)']
|
||||
}
|
||||
|
||||
return ['../src/**/*.stories.@(js|jsx|ts|tsx)']
|
||||
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
webpackFinal: (config) => {
|
||||
config.module.rules.push({
|
||||
@ -55,7 +68,7 @@ module.exports = {
|
||||
};
|
||||
return config;
|
||||
},
|
||||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
|
||||
stories: computeStoriesGlob(),
|
||||
addons: [
|
||||
'@storybook/addon-links',
|
||||
'@storybook/addon-essentials',
|
||||
|
||||
13
front/.storybook/test-runner-jest.js
Normal file
13
front/.storybook/test-runner-jest.js
Normal file
@ -0,0 +1,13 @@
|
||||
const { getJestConfig } = require('@storybook/test-runner');
|
||||
|
||||
/**
|
||||
* @type {import('@jest/types').Config.InitialOptions}
|
||||
*/
|
||||
module.exports = {
|
||||
// The default configuration comes from @storybook/test-runner
|
||||
...getJestConfig(),
|
||||
/** Add your own overrides below
|
||||
* @see https://jestjs.io/docs/configuration
|
||||
*/
|
||||
testTimeout: process.env.STORYBOOK_STORIES_FOLDER === 'pages' ? 30000 : 15000,
|
||||
};
|
||||
20
front/nyc.config.js
Normal file
20
front/nyc.config.js
Normal file
@ -0,0 +1,20 @@
|
||||
const modulesCoverage = {
|
||||
"statements": 50,
|
||||
"lines": 50,
|
||||
"functions": 45,
|
||||
"include": [
|
||||
"src/modules/**/*",
|
||||
]
|
||||
};
|
||||
|
||||
const pagesCoverage = {
|
||||
"statements": 55,
|
||||
"lines": 55,
|
||||
"functions": 55,
|
||||
"exclude": [
|
||||
"src/generated/**/*",
|
||||
"src/modules/**/*",
|
||||
]
|
||||
};
|
||||
|
||||
module.exports = process.env.STORYBOOK_STORIES_FOLDER === 'modules' ? modulesCoverage : pagesCoverage;
|
||||
@ -69,15 +69,22 @@
|
||||
"test": "craco test",
|
||||
"coverage": "craco test --coverage .",
|
||||
"lint": "eslint src --max-warnings=0",
|
||||
"lint:setup": "cd ../packages/eslint-plugin-twenty/ && yarn && yarn build && cd ../../front/ && yarn upgrade eslint-plugin-twenty",
|
||||
"eslint-plugin:upgrade": "yarn eslint-plugin:setup && yarn upgrade eslint-plugin-twenty",
|
||||
"eslint-plugin:setup": "cd ../packages/eslint-plugin-twenty/ && yarn && yarn build && cd ../../front/",
|
||||
"storybook:dev": "storybook dev -p 6006 -s ../public",
|
||||
"storybook:test": "test-storybook",
|
||||
"storybook:test-slow": "test-storybook --maxWorkers=3",
|
||||
"storybook:build": "storybook build -s public",
|
||||
"storybook:coverage": "test-storybook --coverage --maxWorkers=3 && npx nyc report --reporter=lcov -t coverage/storybook --report-dir coverage/storybook --check-coverage",
|
||||
"storybook:modules:dev": "STORYBOOK_STORIES_FOLDER=modules yarn storybook:dev",
|
||||
"storybook:pages:dev": "STORYBOOK_STORIES_FOLDER=pages yarn storybook:dev",
|
||||
"storybook:modules:build": "STORYBOOK_STORIES_FOLDER=modules yarn storybook:build",
|
||||
"storybook:pages:build": "STORYBOOK_STORIES_FOLDER=pages yarn storybook:build",
|
||||
"storybook:modules:coverage": "STORYBOOK_STORIES_FOLDER=modules yarn storybook:coverage",
|
||||
"storybook:pages:coverage": "STORYBOOK_STORIES_FOLDER=pages yarn storybook:coverage",
|
||||
"graphql:generate": "dotenv cross-var graphql-codegen --config codegen.js",
|
||||
"chromatic": "dotenv cross-var npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN",
|
||||
"install": "yarn lint:setup"
|
||||
"install": "yarn eslint-plugin:setup"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
@ -185,13 +192,5 @@
|
||||
},
|
||||
"msw": {
|
||||
"workerDirectory": "public"
|
||||
},
|
||||
"nyc": {
|
||||
"statements": 60,
|
||||
"lines": 60,
|
||||
"functions": 60,
|
||||
"exclude": [
|
||||
"src/generated/**/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user