mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
fix: 处理create-fes-app中丢失.npmrc问题 & 升级plugin-jest支持tsx? (#216)
This commit is contained in:
parent
c7dc4363df
commit
33b76940d8
packages
create-fes-app
fes-plugin-jest
fes-plugin-layout
fes-plugin-locale
fes-plugin-qiankun
examples
package.jsonfes-template-vite
fes-template
fes-utils/src
@ -1,12 +1,10 @@
|
||||
import { Generator } from '@fesjs/utils';
|
||||
|
||||
export default class AppGenerator extends Generator {
|
||||
constructor({
|
||||
cwd, args, path, targetDir
|
||||
}) {
|
||||
constructor({ cwd, args, path, targetDir }) {
|
||||
super({
|
||||
cwd,
|
||||
args
|
||||
args,
|
||||
});
|
||||
this.path = path;
|
||||
this.targetDir = targetDir;
|
||||
@ -15,10 +13,10 @@ export default class AppGenerator extends Generator {
|
||||
async writing() {
|
||||
this.copyDirectory({
|
||||
context: {
|
||||
version: require('../../package.json').version
|
||||
version: require('../../package.json').version,
|
||||
},
|
||||
path: this.path,
|
||||
target: this.targetDir
|
||||
target: this.targetDir,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
"@fesjs/plugin-layout": "^5.0.0",
|
||||
"@fesjs/plugin-model": "^3.0.0",
|
||||
"@fesjs/plugin-enums": "^3.0.0",
|
||||
"@fesjs/fes-design": "^0.7.23",
|
||||
"@fesjs/fes-design": "^0.8.0",
|
||||
"@fesjs/builder-webpack": "^3.0.0",
|
||||
"vue": "^3.2.47",
|
||||
"core-js": "^3.29.1"
|
||||
|
@ -1,10 +1,8 @@
|
||||
const babelJest = require('babel-jest').default;
|
||||
|
||||
module.exports = babelJest.createTransformer({
|
||||
presets: [
|
||||
['@babel/preset-env', { targets: { node: 'current' } }]
|
||||
],
|
||||
presets: [['@babel/preset-env', { targets: { node: 'current' } }]],
|
||||
plugins: ['@vue/babel-plugin-jsx'],
|
||||
babelrc: false,
|
||||
configFile: false
|
||||
configFile: false,
|
||||
});
|
||||
|
@ -36,12 +36,12 @@
|
||||
"@babel/core": "^7.21.3",
|
||||
"@babel/preset-env": "^7.15.0",
|
||||
"@vue/babel-plugin-jsx": "^1.0.6",
|
||||
"babel-jest": "^27.0.6",
|
||||
"jest": "^27.0.6",
|
||||
"babel-jest": "^29.0.0",
|
||||
"jest": "^29.0.0",
|
||||
"jest-transform-stub": "^2.0.0",
|
||||
"jest-watch-typeahead": "^2.2.2",
|
||||
"ts-jest": "^27.0.4",
|
||||
"ts-jest": "^29.1.0",
|
||||
"typescript": "^5.0.4",
|
||||
"vue3-jest": "^27.0.0-alpha.1"
|
||||
"@vue/vue3-jest": "^29.2.0"
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ export default (cwd, args) => {
|
||||
const hasSrc = existsSync(join(cwd, 'src'));
|
||||
return {
|
||||
collectCoverageFrom: [
|
||||
'index.{js,jsx,vue}',
|
||||
hasSrc && 'src/**/*.{js,jsx,vue}',
|
||||
'index.{js,ts,jsx,tsx,vue}',
|
||||
hasSrc && 'src/**/*.{js,ts,jsx,tsx,vue}',
|
||||
'!**/.fes/**',
|
||||
'!**/typings/**',
|
||||
'!**/types/**',
|
||||
@ -21,16 +21,25 @@ export default (cwd, args) => {
|
||||
moduleFileExtensions: [
|
||||
'js',
|
||||
'jsx',
|
||||
'ts',
|
||||
'tsx',
|
||||
'json',
|
||||
// tell Jest to handle *.vue files
|
||||
'vue',
|
||||
],
|
||||
transform: {
|
||||
// process *.vue files with vue-jest
|
||||
'^.+\\.vue$': require.resolve('vue3-jest'),
|
||||
'.+\\.(css|styl|less|sass|scss|jpg|jpeg|png|svg|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
||||
require.resolve('jest-transform-stub'),
|
||||
// process *.vue files with vue-jest
|
||||
'^.+\\.vue$': require.resolve('@vue/vue3-jest'),
|
||||
'^.+\\.jsx?$': require.resolve('../helpers/transformers/javascript'),
|
||||
// process *.ts files with ts-jest
|
||||
'^.+\\.tsx?$': [
|
||||
require.resolve('ts-jest'),
|
||||
{
|
||||
// ts-jest configuration goes here
|
||||
},
|
||||
],
|
||||
},
|
||||
transformIgnorePatterns: ['/node_modules/'],
|
||||
// support the same @ -> src alias mapping in source code
|
||||
@ -39,7 +48,9 @@ export default (cwd, args) => {
|
||||
},
|
||||
testMatch: [`**/tests/**/*.(${testMatchTypes.join('|')}).[jt]s?(x)`, '**/__tests__/**/*.[jt]s?(x)'],
|
||||
// https://github.com/facebook/jest/issues/6766
|
||||
testURL: 'http://localhost/',
|
||||
testEnvironmentOptions: {
|
||||
url: 'http://localhost/',
|
||||
},
|
||||
watchPlugins: [require.resolve('jest-watch-typeahead/filename'), require.resolve('jest-watch-typeahead/testname')],
|
||||
verbose: true,
|
||||
};
|
||||
|
@ -12,611 +12,535 @@ export const docs = 'Documentation: https://jestjs.io/';
|
||||
export const options = {
|
||||
all: {
|
||||
description:
|
||||
'The opposite of `onlyChanged`. If `onlyChanged` is set by '
|
||||
+ 'default, running jest with `--all` will force Jest to run all tests '
|
||||
+ 'instead of running only tests related to changed files.',
|
||||
type: 'boolean'
|
||||
'The opposite of `onlyChanged`. If `onlyChanged` is set by ' +
|
||||
'default, running jest with `--all` will force Jest to run all tests ' +
|
||||
'instead of running only tests related to changed files.',
|
||||
type: 'boolean',
|
||||
},
|
||||
automock: {
|
||||
description: 'Automock all files by default.',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
bail: {
|
||||
alias: 'b',
|
||||
description:
|
||||
'Exit the test suite immediately after `n` number of failing tests.',
|
||||
type: 'boolean'
|
||||
description: 'Exit the test suite immediately after `n` number of failing tests.',
|
||||
type: 'boolean',
|
||||
},
|
||||
browser: {
|
||||
description:
|
||||
'Respect the "browser" field in package.json '
|
||||
+ 'when resolving modules. Some packages export different versions '
|
||||
+ 'based on whether they are operating in node.js or a browser.',
|
||||
type: 'boolean'
|
||||
'Respect the "browser" field in package.json ' +
|
||||
'when resolving modules. Some packages export different versions ' +
|
||||
'based on whether they are operating in node.js or a browser.',
|
||||
type: 'boolean',
|
||||
},
|
||||
cache: {
|
||||
description:
|
||||
'Whether to use the transform cache. Disable the cache '
|
||||
+ 'using --no-cache.',
|
||||
type: 'boolean'
|
||||
description: 'Whether to use the transform cache. Disable the cache ' + 'using --no-cache.',
|
||||
type: 'boolean',
|
||||
},
|
||||
cacheDirectory: {
|
||||
description:
|
||||
'The directory where Jest should store its cached '
|
||||
+ ' dependency information.',
|
||||
type: 'string'
|
||||
description: 'The directory where Jest should store its cached ' + ' dependency information.',
|
||||
type: 'string',
|
||||
},
|
||||
changedFilesWithAncestor: {
|
||||
description:
|
||||
'Runs tests related to the current changes and the changes made in the '
|
||||
+ 'last commit. Behaves similarly to `--onlyChanged`.',
|
||||
type: 'boolean'
|
||||
description: 'Runs tests related to the current changes and the changes made in the ' + 'last commit. Behaves similarly to `--onlyChanged`.',
|
||||
type: 'boolean',
|
||||
},
|
||||
changedSince: {
|
||||
description:
|
||||
'Runs tests related to the changes since the provided branch. If the '
|
||||
+ 'current branch has diverged from the given branch, then only changes '
|
||||
+ 'made locally will be tested. Behaves similarly to `--onlyChanged`.',
|
||||
'Runs tests related to the changes since the provided branch. If the ' +
|
||||
'current branch has diverged from the given branch, then only changes ' +
|
||||
'made locally will be tested. Behaves similarly to `--onlyChanged`.',
|
||||
nargs: 1,
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
},
|
||||
ci: {
|
||||
description:
|
||||
'Whether to run Jest in continuous integration (CI) mode. '
|
||||
+ 'This option is on by default in most popular CI environments. It will '
|
||||
+ 'prevent snapshots from being written unless explicitly requested.',
|
||||
type: 'boolean'
|
||||
'Whether to run Jest in continuous integration (CI) mode. ' +
|
||||
'This option is on by default in most popular CI environments. It will ' +
|
||||
'prevent snapshots from being written unless explicitly requested.',
|
||||
type: 'boolean',
|
||||
},
|
||||
clearCache: {
|
||||
description:
|
||||
'Clears the configured Jest cache directory and then exits. '
|
||||
+ 'Default directory can be found by calling jest --showConfig',
|
||||
type: 'boolean'
|
||||
description: 'Clears the configured Jest cache directory and then exits. ' + 'Default directory can be found by calling jest --showConfig',
|
||||
type: 'boolean',
|
||||
},
|
||||
clearMocks: {
|
||||
description:
|
||||
'Automatically clear mock calls and instances between every '
|
||||
+ 'test. Equivalent to calling jest.clearAllMocks() between each test.',
|
||||
type: 'boolean'
|
||||
description: 'Automatically clear mock calls and instances between every ' + 'test. Equivalent to calling jest.clearAllMocks() between each test.',
|
||||
type: 'boolean',
|
||||
},
|
||||
collectCoverage: {
|
||||
description: 'Alias for --coverage.',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
collectCoverageFrom: {
|
||||
description:
|
||||
'A glob pattern relative to <rootDir> matching the files that coverage '
|
||||
+ 'info needs to be collected from.',
|
||||
type: 'string'
|
||||
description: 'A glob pattern relative to <rootDir> matching the files that coverage ' + 'info needs to be collected from.',
|
||||
type: 'string',
|
||||
},
|
||||
collectCoverageOnlyFrom: {
|
||||
description: 'Explicit list of paths coverage will be restricted to.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
color: {
|
||||
description:
|
||||
'Forces test results output color highlighting (even if '
|
||||
+ 'stdout is not a TTY). Set to false if you would like to have no colors.',
|
||||
type: 'boolean'
|
||||
description: 'Forces test results output color highlighting (even if ' + 'stdout is not a TTY). Set to false if you would like to have no colors.',
|
||||
type: 'boolean',
|
||||
},
|
||||
colors: {
|
||||
description: 'Alias for `--color`.',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
config: {
|
||||
alias: 'c',
|
||||
description:
|
||||
'The path to a jest config file specifying how to find '
|
||||
+ 'and execute tests. If no rootDir is set in the config, the directory '
|
||||
+ 'containing the config file is assumed to be the rootDir for the project.'
|
||||
+ 'This can also be a JSON encoded value which Jest will use as configuration.',
|
||||
type: 'string'
|
||||
'The path to a jest config file specifying how to find ' +
|
||||
'and execute tests. If no rootDir is set in the config, the directory ' +
|
||||
'containing the config file is assumed to be the rootDir for the project.' +
|
||||
'This can also be a JSON encoded value which Jest will use as configuration.',
|
||||
type: 'string',
|
||||
},
|
||||
coverage: {
|
||||
description:
|
||||
'Indicates that test coverage information should be '
|
||||
+ 'collected and reported in the output.',
|
||||
type: 'boolean'
|
||||
description: 'Indicates that test coverage information should be ' + 'collected and reported in the output.',
|
||||
type: 'boolean',
|
||||
},
|
||||
coverageDirectory: {
|
||||
description: 'The directory where Jest should output its coverage files.',
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
},
|
||||
coveragePathIgnorePatterns: {
|
||||
description:
|
||||
'An array of regexp pattern strings that are matched '
|
||||
+ 'against all file paths before executing the test. If the file path'
|
||||
+ 'matches any of the patterns, coverage information will be skipped.',
|
||||
'An array of regexp pattern strings that are matched ' +
|
||||
'against all file paths before executing the test. If the file path' +
|
||||
'matches any of the patterns, coverage information will be skipped.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
coverageProvider: {
|
||||
choices: ['babel', 'v8'],
|
||||
description: 'Select between Babel and V8 to collect coverage'
|
||||
description: 'Select between Babel and V8 to collect coverage',
|
||||
},
|
||||
coverageReporters: {
|
||||
description:
|
||||
'A list of reporter names that Jest uses when writing '
|
||||
+ 'coverage reports. Any istanbul reporter can be used.',
|
||||
description: 'A list of reporter names that Jest uses when writing ' + 'coverage reports. Any istanbul reporter can be used.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
coverageThreshold: {
|
||||
description:
|
||||
'A JSON string with which will be used to configure '
|
||||
+ 'minimum threshold enforcement for coverage results',
|
||||
type: 'string'
|
||||
description: 'A JSON string with which will be used to configure ' + 'minimum threshold enforcement for coverage results',
|
||||
type: 'string',
|
||||
},
|
||||
debug: {
|
||||
description: 'Print debugging info about your jest config.',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
detectLeaks: {
|
||||
description:
|
||||
'**EXPERIMENTAL**: Detect memory leaks in tests. After executing a '
|
||||
+ 'test, it will try to garbage collect the global object used, and fail '
|
||||
+ 'if it was leaked',
|
||||
type: 'boolean'
|
||||
'**EXPERIMENTAL**: Detect memory leaks in tests. After executing a ' +
|
||||
'test, it will try to garbage collect the global object used, and fail ' +
|
||||
'if it was leaked',
|
||||
type: 'boolean',
|
||||
},
|
||||
detectOpenHandles: {
|
||||
description:
|
||||
'Print out remaining open handles preventing Jest from exiting at the '
|
||||
+ 'end of a test run. Implies `runInBand`.',
|
||||
type: 'boolean'
|
||||
description: 'Print out remaining open handles preventing Jest from exiting at the ' + 'end of a test run. Implies `runInBand`.',
|
||||
type: 'boolean',
|
||||
},
|
||||
env: {
|
||||
description:
|
||||
'The test environment used for all tests. This can point to '
|
||||
+ 'any file or node module. Examples: `jsdom`, `node` or '
|
||||
+ '`path/to/my-environment.js`',
|
||||
type: 'string'
|
||||
'The test environment used for all tests. This can point to ' +
|
||||
'any file or node module. Examples: `jsdom`, `node` or ' +
|
||||
'`path/to/my-environment.js`',
|
||||
type: 'string',
|
||||
},
|
||||
errorOnDeprecated: {
|
||||
description: 'Make calling deprecated APIs throw helpful error messages.',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
expand: {
|
||||
alias: 'e',
|
||||
description: 'Use this flag to show full diffs instead of a patch.',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
filter: {
|
||||
description:
|
||||
'Path to a module exporting a filtering function. This method receives '
|
||||
+ 'a list of tests which can be manipulated to exclude tests from '
|
||||
+ 'running. Especially useful when used in conjunction with a testing '
|
||||
+ 'infrastructure to filter known broken tests.',
|
||||
type: 'string'
|
||||
'Path to a module exporting a filtering function. This method receives ' +
|
||||
'a list of tests which can be manipulated to exclude tests from ' +
|
||||
'running. Especially useful when used in conjunction with a testing ' +
|
||||
'infrastructure to filter known broken tests.',
|
||||
type: 'string',
|
||||
},
|
||||
findRelatedTests: {
|
||||
description:
|
||||
'Find related tests for a list of source files that were '
|
||||
+ 'passed in as arguments. Useful for pre-commit hook integration to run '
|
||||
+ 'the minimal amount of tests necessary.',
|
||||
type: 'boolean'
|
||||
'Find related tests for a list of source files that were ' +
|
||||
'passed in as arguments. Useful for pre-commit hook integration to run ' +
|
||||
'the minimal amount of tests necessary.',
|
||||
type: 'boolean',
|
||||
},
|
||||
forceExit: {
|
||||
description:
|
||||
'Force Jest to exit after all tests have completed running. '
|
||||
+ 'This is useful when resources set up by test code cannot be '
|
||||
+ 'adequately cleaned up.',
|
||||
type: 'boolean'
|
||||
'Force Jest to exit after all tests have completed running. ' +
|
||||
'This is useful when resources set up by test code cannot be ' +
|
||||
'adequately cleaned up.',
|
||||
type: 'boolean',
|
||||
},
|
||||
globalSetup: {
|
||||
description: 'The path to a module that runs before All Tests.',
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
},
|
||||
globalTeardown: {
|
||||
description: 'The path to a module that runs after All Tests.',
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
},
|
||||
globals: {
|
||||
description:
|
||||
'A JSON string with map of global variables that need '
|
||||
+ 'to be available in all test environments.',
|
||||
type: 'string'
|
||||
description: 'A JSON string with map of global variables that need ' + 'to be available in all test environments.',
|
||||
type: 'string',
|
||||
},
|
||||
haste: {
|
||||
description:
|
||||
'A JSON string with map of variables for the haste module system',
|
||||
type: 'string'
|
||||
description: 'A JSON string with map of variables for the haste module system',
|
||||
type: 'string',
|
||||
},
|
||||
init: {
|
||||
description: 'Generate a basic configuration file',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
injectGlobals: {
|
||||
description: 'Should Jest inject global variables or not',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
json: {
|
||||
description:
|
||||
'Prints the test results in JSON. This mode will send all '
|
||||
+ 'other test output and user messages to stderr.',
|
||||
type: 'boolean'
|
||||
description: 'Prints the test results in JSON. This mode will send all ' + 'other test output and user messages to stderr.',
|
||||
type: 'boolean',
|
||||
},
|
||||
lastCommit: {
|
||||
description:
|
||||
'Run all tests affected by file changes in the last commit made. '
|
||||
+ 'Behaves similarly to `--onlyChanged`.',
|
||||
type: 'boolean'
|
||||
description: 'Run all tests affected by file changes in the last commit made. ' + 'Behaves similarly to `--onlyChanged`.',
|
||||
type: 'boolean',
|
||||
},
|
||||
listTests: {
|
||||
description:
|
||||
'Lists all tests Jest will run given the arguments and '
|
||||
+ 'exits. Most useful in a CI system together with `--findRelatedTests` '
|
||||
+ 'to determine the tests Jest will run based on specific files',
|
||||
type: 'boolean'
|
||||
'Lists all tests Jest will run given the arguments and ' +
|
||||
'exits. Most useful in a CI system together with `--findRelatedTests` ' +
|
||||
'to determine the tests Jest will run based on specific files',
|
||||
type: 'boolean',
|
||||
},
|
||||
logHeapUsage: {
|
||||
description:
|
||||
'Logs the heap usage after every test. Useful to debug '
|
||||
+ 'memory leaks. Use together with `--runInBand` and `--expose-gc` in '
|
||||
+ 'node.',
|
||||
type: 'boolean'
|
||||
description: 'Logs the heap usage after every test. Useful to debug ' + 'memory leaks. Use together with `--runInBand` and `--expose-gc` in ' + 'node.',
|
||||
type: 'boolean',
|
||||
},
|
||||
maxConcurrency: {
|
||||
description:
|
||||
'Specifies the maximum number of tests that are allowed to run'
|
||||
+ 'concurrently. This only affects tests using `test.concurrent`.',
|
||||
type: 'number'
|
||||
description: 'Specifies the maximum number of tests that are allowed to run' + 'concurrently. This only affects tests using `test.concurrent`.',
|
||||
type: 'number',
|
||||
},
|
||||
maxWorkers: {
|
||||
alias: 'w',
|
||||
description:
|
||||
'Specifies the maximum number of workers the worker-pool '
|
||||
+ 'will spawn for running tests. This defaults to the number of the '
|
||||
+ 'cores available on your machine. (its usually best not to override '
|
||||
+ 'this default)',
|
||||
type: 'string'
|
||||
'Specifies the maximum number of workers the worker-pool ' +
|
||||
'will spawn for running tests. This defaults to the number of the ' +
|
||||
'cores available on your machine. (its usually best not to override ' +
|
||||
'this default)',
|
||||
type: 'string',
|
||||
},
|
||||
moduleDirectories: {
|
||||
description:
|
||||
'An array of directory names to be searched recursively '
|
||||
+ "up from the requiring module's location.",
|
||||
description: 'An array of directory names to be searched recursively ' + "up from the requiring module's location.",
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
moduleFileExtensions: {
|
||||
description:
|
||||
'An array of file extensions your modules use. If you '
|
||||
+ 'require modules without specifying a file extension, these are the '
|
||||
+ 'extensions Jest will look for. ',
|
||||
'An array of file extensions your modules use. If you ' +
|
||||
'require modules without specifying a file extension, these are the ' +
|
||||
'extensions Jest will look for. ',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
moduleNameMapper: {
|
||||
description:
|
||||
'A JSON string with a map from regular expressions to '
|
||||
+ 'module names or to arrays of module names that allow to stub '
|
||||
+ 'out resources, like images or styles with a single module',
|
||||
type: 'string'
|
||||
'A JSON string with a map from regular expressions to ' +
|
||||
'module names or to arrays of module names that allow to stub ' +
|
||||
'out resources, like images or styles with a single module',
|
||||
type: 'string',
|
||||
},
|
||||
modulePathIgnorePatterns: {
|
||||
description:
|
||||
'An array of regexp pattern strings that are matched '
|
||||
+ 'against all module paths before those paths are to be considered '
|
||||
+ '"visible" to the module loader.',
|
||||
'An array of regexp pattern strings that are matched ' +
|
||||
'against all module paths before those paths are to be considered ' +
|
||||
'"visible" to the module loader.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
modulePaths: {
|
||||
description:
|
||||
'An alternative API to setting the NODE_PATH env variable, '
|
||||
+ 'modulePaths is an array of absolute paths to additional locations to '
|
||||
+ 'search when resolving modules.',
|
||||
'An alternative API to setting the NODE_PATH env variable, ' +
|
||||
'modulePaths is an array of absolute paths to additional locations to ' +
|
||||
'search when resolving modules.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
noStackTrace: {
|
||||
description: 'Disables stack trace in test results output',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
notify: {
|
||||
description: 'Activates notifications for test results.',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
notifyMode: {
|
||||
description: 'Specifies when notifications will appear for test results.',
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
},
|
||||
onlyChanged: {
|
||||
alias: 'o',
|
||||
description:
|
||||
'Attempts to identify which tests to run based on which '
|
||||
+ "files have changed in the current repository. Only works if you're "
|
||||
+ 'running tests in a git or hg repository at the moment.',
|
||||
type: 'boolean'
|
||||
'Attempts to identify which tests to run based on which ' +
|
||||
"files have changed in the current repository. Only works if you're " +
|
||||
'running tests in a git or hg repository at the moment.',
|
||||
type: 'boolean',
|
||||
},
|
||||
onlyFailures: {
|
||||
alias: 'f',
|
||||
description: 'Run tests that failed in the previous execution.',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
outputFile: {
|
||||
description:
|
||||
'Write test results to a file when the --json option is '
|
||||
+ 'also specified.',
|
||||
type: 'string'
|
||||
description: 'Write test results to a file when the --json option is ' + 'also specified.',
|
||||
type: 'string',
|
||||
},
|
||||
passWithNoTests: {
|
||||
description:
|
||||
'Will not fail if no tests are found (for example while using `--testPathPattern`.)',
|
||||
type: 'boolean'
|
||||
description: 'Will not fail if no tests are found (for example while using `--testPathPattern`.)',
|
||||
type: 'boolean',
|
||||
},
|
||||
preset: {
|
||||
description: "A preset that is used as a base for Jest's configuration.",
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
},
|
||||
prettierPath: {
|
||||
description: 'The path to the "prettier" module used for inline snapshots.',
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
},
|
||||
projects: {
|
||||
description:
|
||||
'A list of projects that use Jest to run all tests of all '
|
||||
+ 'projects in a single instance of Jest.',
|
||||
description: 'A list of projects that use Jest to run all tests of all ' + 'projects in a single instance of Jest.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
reporters: {
|
||||
description: 'A list of custom reporters for the test suite.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
resetMocks: {
|
||||
description:
|
||||
'Automatically reset mock state between every test. '
|
||||
+ 'Equivalent to calling jest.resetAllMocks() between each test.',
|
||||
type: 'boolean'
|
||||
description: 'Automatically reset mock state between every test. ' + 'Equivalent to calling jest.resetAllMocks() between each test.',
|
||||
type: 'boolean',
|
||||
},
|
||||
resetModules: {
|
||||
description:
|
||||
'If enabled, the module registry for every test file will '
|
||||
+ 'be reset before running each individual test.',
|
||||
type: 'boolean'
|
||||
description: 'If enabled, the module registry for every test file will ' + 'be reset before running each individual test.',
|
||||
type: 'boolean',
|
||||
},
|
||||
resolver: {
|
||||
description: 'A JSON string which allows the use of a custom resolver.',
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
},
|
||||
restoreMocks: {
|
||||
description:
|
||||
'Automatically restore mock state and implementation between every test. '
|
||||
+ 'Equivalent to calling jest.restoreAllMocks() between each test.',
|
||||
type: 'boolean'
|
||||
'Automatically restore mock state and implementation between every test. ' + 'Equivalent to calling jest.restoreAllMocks() between each test.',
|
||||
type: 'boolean',
|
||||
},
|
||||
rootDir: {
|
||||
description:
|
||||
'The root directory that Jest should scan for tests and '
|
||||
+ 'modules within.',
|
||||
type: 'string'
|
||||
description: 'The root directory that Jest should scan for tests and ' + 'modules within.',
|
||||
type: 'string',
|
||||
},
|
||||
roots: {
|
||||
description:
|
||||
'A list of paths to directories that Jest should use to '
|
||||
+ 'search for files in.',
|
||||
description: 'A list of paths to directories that Jest should use to ' + 'search for files in.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
runInBand: {
|
||||
alias: 'i',
|
||||
description:
|
||||
'Run all tests serially in the current process (rather than '
|
||||
+ 'creating a worker pool of child processes that run tests). This '
|
||||
+ 'is sometimes useful for debugging, but such use cases are pretty '
|
||||
+ 'rare.',
|
||||
type: 'boolean'
|
||||
'Run all tests serially in the current process (rather than ' +
|
||||
'creating a worker pool of child processes that run tests). This ' +
|
||||
'is sometimes useful for debugging, but such use cases are pretty ' +
|
||||
'rare.',
|
||||
type: 'boolean',
|
||||
},
|
||||
runTestsByPath: {
|
||||
description:
|
||||
'Used when provided patterns are exact file paths. This avoids '
|
||||
+ 'converting them into a regular expression and matching it against '
|
||||
+ 'every single file.',
|
||||
type: 'boolean'
|
||||
'Used when provided patterns are exact file paths. This avoids ' +
|
||||
'converting them into a regular expression and matching it against ' +
|
||||
'every single file.',
|
||||
type: 'boolean',
|
||||
},
|
||||
runner: {
|
||||
description:
|
||||
"Allows to use a custom runner instead of Jest's default test runner.",
|
||||
type: 'string'
|
||||
description: "Allows to use a custom runner instead of Jest's default test runner.",
|
||||
type: 'string',
|
||||
},
|
||||
selectProjects: {
|
||||
description:
|
||||
'Run only the tests of the specified projects.'
|
||||
+ 'Jest uses the attribute `displayName` in the configuration to identify each project.',
|
||||
description: 'Run only the tests of the specified projects.' + 'Jest uses the attribute `displayName` in the configuration to identify each project.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
setupFiles: {
|
||||
description:
|
||||
'A list of paths to modules that run some code to configure or '
|
||||
+ 'set up the testing environment before each test. ',
|
||||
description: 'A list of paths to modules that run some code to configure or ' + 'set up the testing environment before each test. ',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
setupFilesAfterEnv: {
|
||||
description:
|
||||
'A list of paths to modules that run some code to configure or '
|
||||
+ 'set up the testing framework before each test ',
|
||||
description: 'A list of paths to modules that run some code to configure or ' + 'set up the testing framework before each test ',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
showConfig: {
|
||||
description: 'Print your jest config and then exits.',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
silent: {
|
||||
description: 'Prevent tests from printing messages through the console.',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
skipFilter: {
|
||||
description:
|
||||
'Disables the filter provided by --filter. Useful for CI jobs, or '
|
||||
+ 'local enforcement when fixing tests.',
|
||||
type: 'boolean'
|
||||
description: 'Disables the filter provided by --filter. Useful for CI jobs, or ' + 'local enforcement when fixing tests.',
|
||||
type: 'boolean',
|
||||
},
|
||||
snapshotSerializers: {
|
||||
description:
|
||||
'A list of paths to snapshot serializer modules Jest should '
|
||||
+ 'use for snapshot testing.',
|
||||
description: 'A list of paths to snapshot serializer modules Jest should ' + 'use for snapshot testing.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
testEnvironment: {
|
||||
description: 'Alias for --env',
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
},
|
||||
testEnvironmentOptions: {
|
||||
description:
|
||||
'Test environment options that will be passed to the testEnvironment. '
|
||||
+ 'The relevant options depend on the environment.',
|
||||
type: 'string' // Object
|
||||
description: 'Test environment options that will be passed to the testEnvironment. ' + 'The relevant options depend on the environment.',
|
||||
type: 'string', // Object
|
||||
},
|
||||
testFailureExitCode: {
|
||||
description: 'Exit code of `jest` command if the test run failed',
|
||||
type: 'string' // number
|
||||
type: 'string', // number
|
||||
},
|
||||
testLocationInResults: {
|
||||
description: 'Add `location` information to the test results',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
testMatch: {
|
||||
description: 'The glob patterns Jest uses to detect test files.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
testNamePattern: {
|
||||
alias: 't',
|
||||
description: 'Run only tests with a name that matches the regex pattern.',
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
},
|
||||
testPathIgnorePatterns: {
|
||||
description:
|
||||
'An array of regexp pattern strings that are matched '
|
||||
+ 'against all test paths before executing the test. If the test path '
|
||||
+ 'matches any of the patterns, it will be skipped.',
|
||||
'An array of regexp pattern strings that are matched ' +
|
||||
'against all test paths before executing the test. If the test path ' +
|
||||
'matches any of the patterns, it will be skipped.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
testPathPattern: {
|
||||
description:
|
||||
'A regexp pattern string that is matched against all tests '
|
||||
+ 'paths before executing the test.',
|
||||
description: 'A regexp pattern string that is matched against all tests ' + 'paths before executing the test.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
testRegex: {
|
||||
description:
|
||||
'A string or array of string regexp patterns that Jest uses to detect test files.',
|
||||
description: 'A string or array of string regexp patterns that Jest uses to detect test files.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
testResultsProcessor: {
|
||||
description:
|
||||
'Allows the use of a custom results processor. '
|
||||
+ 'This processor must be a node module that exports '
|
||||
+ 'a function expecting as the first argument the result object.',
|
||||
type: 'string'
|
||||
'Allows the use of a custom results processor. ' +
|
||||
'This processor must be a node module that exports ' +
|
||||
'a function expecting as the first argument the result object.',
|
||||
type: 'string',
|
||||
},
|
||||
testRunner: {
|
||||
description:
|
||||
'Allows to specify a custom test runner. The default is'
|
||||
+ ' `jest-circus/runner`. A path to a custom test runner can be provided:'
|
||||
+ ' `<rootDir>/path/to/testRunner.js`.',
|
||||
type: 'string'
|
||||
'Allows to specify a custom test runner. The default is' +
|
||||
' `jest-circus/runner`. A path to a custom test runner can be provided:' +
|
||||
' `<rootDir>/path/to/testRunner.js`.',
|
||||
type: 'string',
|
||||
},
|
||||
testSequencer: {
|
||||
description:
|
||||
'Allows to specify a custom test sequencer. The default is '
|
||||
+ '`@jest/test-sequencer`. A path to a custom test sequencer can be '
|
||||
+ 'provided: `<rootDir>/path/to/testSequencer.js`',
|
||||
type: 'string'
|
||||
'Allows to specify a custom test sequencer. The default is ' +
|
||||
'`@jest/test-sequencer`. A path to a custom test sequencer can be ' +
|
||||
'provided: `<rootDir>/path/to/testSequencer.js`',
|
||||
type: 'string',
|
||||
},
|
||||
testTimeout: {
|
||||
description: 'This option sets the default timeouts of test cases.',
|
||||
type: 'number'
|
||||
type: 'number',
|
||||
},
|
||||
testURL: {
|
||||
description: 'This option sets the URL for the jsdom environment.',
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
},
|
||||
timers: {
|
||||
description:
|
||||
'Setting this value to fake allows the use of fake timers '
|
||||
+ 'for functions such as setTimeout.',
|
||||
type: 'string'
|
||||
description: 'Setting this value to fake allows the use of fake timers ' + 'for functions such as setTimeout.',
|
||||
type: 'string',
|
||||
},
|
||||
transform: {
|
||||
description:
|
||||
'A JSON string which maps from regular expressions to paths '
|
||||
+ 'to transformers.',
|
||||
type: 'string'
|
||||
description: 'A JSON string which maps from regular expressions to paths ' + 'to transformers.',
|
||||
type: 'string',
|
||||
},
|
||||
transformIgnorePatterns: {
|
||||
description:
|
||||
'An array of regexp pattern strings that are matched '
|
||||
+ 'against all source file paths before transformation.',
|
||||
description: 'An array of regexp pattern strings that are matched ' + 'against all source file paths before transformation.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
unmockedModulePathPatterns: {
|
||||
description:
|
||||
'An array of regexp pattern strings that are matched '
|
||||
+ 'against all modules before the module loader will automatically '
|
||||
+ 'return a mock for them.',
|
||||
'An array of regexp pattern strings that are matched ' +
|
||||
'against all modules before the module loader will automatically ' +
|
||||
'return a mock for them.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
updateSnapshot: {
|
||||
alias: 'u',
|
||||
description:
|
||||
'Use this flag to re-record snapshots. '
|
||||
+ 'Can be used together with a test suite pattern or with '
|
||||
+ '`--testNamePattern` to re-record snapshot for test matching '
|
||||
+ 'the pattern',
|
||||
type: 'boolean'
|
||||
'Use this flag to re-record snapshots. ' +
|
||||
'Can be used together with a test suite pattern or with ' +
|
||||
'`--testNamePattern` to re-record snapshot for test matching ' +
|
||||
'the pattern',
|
||||
type: 'boolean',
|
||||
},
|
||||
useStderr: {
|
||||
description: 'Divert all output to stderr.',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
verbose: {
|
||||
description:
|
||||
'Display individual test results with the test suite hierarchy.',
|
||||
type: 'boolean'
|
||||
description: 'Display individual test results with the test suite hierarchy.',
|
||||
type: 'boolean',
|
||||
},
|
||||
version: {
|
||||
alias: 'v',
|
||||
description: 'Print the version and exit',
|
||||
type: 'boolean'
|
||||
type: 'boolean',
|
||||
},
|
||||
watch: {
|
||||
description:
|
||||
'Watch files for changes and rerun tests related to '
|
||||
+ 'changed files. If you want to re-run all tests when a file has '
|
||||
+ 'changed, use the `--watchAll` option.',
|
||||
type: 'boolean'
|
||||
'Watch files for changes and rerun tests related to ' +
|
||||
'changed files. If you want to re-run all tests when a file has ' +
|
||||
'changed, use the `--watchAll` option.',
|
||||
type: 'boolean',
|
||||
},
|
||||
watchAll: {
|
||||
description:
|
||||
'Watch files for changes and rerun all tests. If you want '
|
||||
+ 'to re-run only the tests related to the changed files, use the '
|
||||
+ '`--watch` option.',
|
||||
type: 'boolean'
|
||||
'Watch files for changes and rerun all tests. If you want ' +
|
||||
'to re-run only the tests related to the changed files, use the ' +
|
||||
'`--watch` option.',
|
||||
type: 'boolean',
|
||||
},
|
||||
watchPathIgnorePatterns: {
|
||||
description:
|
||||
'An array of regexp pattern strings that are matched '
|
||||
+ 'against all paths before trigger test re-run in watch mode. '
|
||||
+ 'If the test path matches any of the patterns, it will be skipped.',
|
||||
'An array of regexp pattern strings that are matched ' +
|
||||
'against all paths before trigger test re-run in watch mode. ' +
|
||||
'If the test path matches any of the patterns, it will be skipped.',
|
||||
string: true,
|
||||
type: 'array'
|
||||
type: 'array',
|
||||
},
|
||||
watchman: {
|
||||
description:
|
||||
'Whether to use watchman for file crawling. Disable using '
|
||||
+ '--no-watchman.',
|
||||
type: 'boolean'
|
||||
}
|
||||
description: 'Whether to use watchman for file crawling. Disable using ' + '--no-watchman.',
|
||||
type: 'boolean',
|
||||
},
|
||||
};
|
||||
|
@ -32,7 +32,7 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@fesjs/fes": "^3.1.2",
|
||||
"@fesjs/fes-design": "^0.7.0",
|
||||
"@fesjs/fes-design": ">=0.7.0",
|
||||
"vue": "^3.2.47",
|
||||
"vue-router": "^4.0.1"
|
||||
},
|
||||
|
@ -33,7 +33,7 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@fesjs/fes": "^3.0.1",
|
||||
"@fesjs/fes-design": "^0.7.0",
|
||||
"@fesjs/fes-design": ">=0.7.0",
|
||||
"vue": "^3.2.47"
|
||||
},
|
||||
"typings": "./types.d.ts"
|
||||
|
@ -44,10 +44,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.2.47",
|
||||
"@fesjs/fes": "^3.0.0-rc.0",
|
||||
"@fesjs/builder-vite": "^3.0.0-rc.4",
|
||||
"@fesjs/plugin-qiankun": "3.0.0-rc.0",
|
||||
"@fesjs/fes-design": "^0.7.0"
|
||||
"@fesjs/fes": "^3.0.0",
|
||||
"@fesjs/builder-vite": "^3.0.0",
|
||||
"@fesjs/plugin-qiankun": "^3.0.0",
|
||||
"@fesjs/fes-design": "^0.8.0"
|
||||
},
|
||||
"private": true
|
||||
}
|
@ -43,11 +43,11 @@
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fesjs/fes": "^3.0.0-rc.0",
|
||||
"@fesjs/builder-vite": "^3.0.0-rc.4",
|
||||
"@fesjs/plugin-qiankun": "3.0.0-rc.0",
|
||||
"@fesjs/fes": "^3.0.0",
|
||||
"@fesjs/builder-vite": "^3.0.0",
|
||||
"@fesjs/plugin-qiankun": "^3.0.0",
|
||||
"vue": "^3.2.47",
|
||||
"@fesjs/fes-design": "^0.7.0"
|
||||
"@fesjs/fes-design": "^0.8.0"
|
||||
},
|
||||
"private": true
|
||||
}
|
@ -43,12 +43,12 @@
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fesjs/fes": "^3.0.0-rc.0",
|
||||
"@fesjs/builder-webpack": "^3.0.0-rc.5",
|
||||
"@fesjs/plugin-qiankun": "3.0.0-rc.0",
|
||||
"@fesjs/plugin-watermark": "3.0.0-rc.0",
|
||||
"@fesjs/fes": "^3.0.0",
|
||||
"@fesjs/builder-webpack": "^3.0.0",
|
||||
"@fesjs/plugin-qiankun": "^3.0.0",
|
||||
"@fesjs/plugin-watermark": "^3.0.0",
|
||||
"vue": "^3.2.47",
|
||||
"@fesjs/fes-design": "^0.7.0"
|
||||
"@fesjs/fes-design": "^0.8.0"
|
||||
},
|
||||
"private": true
|
||||
}
|
@ -43,12 +43,12 @@
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fesjs/fes": "^3.0.0-rc.0",
|
||||
"@fesjs/builder-webpack": "^3.0.0-rc.5",
|
||||
"@fesjs/plugin-qiankun": "3.0.0-rc.0",
|
||||
"@fesjs/plugin-watermark": "3.0.0-rc.0",
|
||||
"@fesjs/fes": "^3.0.0",
|
||||
"@fesjs/builder-webpack": "^3.0.0",
|
||||
"@fesjs/plugin-qiankun": "^3.0.0",
|
||||
"@fesjs/plugin-watermark": "^3.0.0",
|
||||
"vue": "^3.2.47",
|
||||
"@fesjs/fes-design": "^0.7.0"
|
||||
"@fesjs/fes-design": "^0.8.0"
|
||||
},
|
||||
"private": true
|
||||
}
|
@ -43,7 +43,7 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@fesjs/fes": "^3.0.0",
|
||||
"@fesjs/fes-design": "^0.7.20",
|
||||
"@fesjs/fes-design": ">=0.7.20",
|
||||
"vue": "^3.2.47"
|
||||
},
|
||||
"typings": "./types.d.ts"
|
||||
|
@ -46,7 +46,7 @@
|
||||
"@fesjs/builder-vite": "workspace:*",
|
||||
"@fesjs/builder-webpack": "workspace:*",
|
||||
"@fesjs/fes": "workspace:*",
|
||||
"@fesjs/fes-design": "^0.7.0",
|
||||
"@fesjs/fes-design": "^0.8.0",
|
||||
"@fesjs/plugin-access": "workspace:*",
|
||||
"@fesjs/plugin-enums": "workspace:*",
|
||||
"@fesjs/plugin-icon": "workspace:*",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import sum from '@/utils/sum';
|
||||
import sum from '@/utils/sum.ts';
|
||||
|
||||
test('adds 1 + 2 to equal 3', () => {
|
||||
expect(sum(1, 2)).toBe(3);
|
||||
|
@ -61,7 +61,7 @@
|
||||
"@fesjs/plugin-watermark": "workspace:*",
|
||||
"@fesjs/plugin-windicss": "workspace:*",
|
||||
"@fesjs/plugin-swc": "workspace:*",
|
||||
"@fesjs/fes-design": "^0.7.20",
|
||||
"@fesjs/fes-design": "^0.8.0",
|
||||
"core-js": "3.29.1",
|
||||
"pinia": "^2.0.33",
|
||||
"vue": "^3.2.47"
|
||||
|
@ -1,3 +0,0 @@
|
||||
export default function sum(a, b) {
|
||||
return a + b;
|
||||
}
|
3
packages/fes-template/src/utils/sum.ts
Normal file
3
packages/fes-template/src/utils/sum.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export default function sum(a: number, b: number) {
|
||||
return a + b;
|
||||
}
|
@ -41,17 +41,16 @@ class Generator {
|
||||
const absFile = join(opts.path, file);
|
||||
if (statSync(absFile).isDirectory()) return;
|
||||
if (file.endsWith('.tpl')) {
|
||||
this.copyTpl({
|
||||
return this.copyTpl({
|
||||
templatePath: absFile,
|
||||
target: join(opts.target, file.replace(/\.tpl$/, '')),
|
||||
context: opts.context,
|
||||
});
|
||||
} else {
|
||||
console.log(`${chalk.green('Copy: ')} ${file}`);
|
||||
const absTarget = join(opts.target, file);
|
||||
mkdirp.sync(dirname(absTarget));
|
||||
copyFileSync(absFile, absTarget);
|
||||
}
|
||||
console.log(`${chalk.green('Copy: ')} ${file}`);
|
||||
const absTarget = join(opts.target, file);
|
||||
mkdirp.sync(dirname(absTarget));
|
||||
copyFileSync(absFile, absTarget);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
1627
pnpm-lock.yaml
generated
1627
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user