{
"scripts": {
"dev": "egg-bin dev",
"test-local": "egg-bin test",
"test": "npm run lint -- --fix && npm run test-local",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov"
}
}
Command
All the commands support these specific options:
--inspect
--inspect-brk
--typescript / --ts enable typescript support. Auto detect from package.json‘s pkg.egg.typescript,
or pkg.dependencies.typescript/pkg.devDependencies.typescript.
--base / --baseDir application’s root path, default to process.cwd().
--require will add to execArgv, support multiple. Also support read from package.json‘s pkg.egg.require
--dry-run / -d whether dry-run the test command, just show the command
Start dev cluster on local env, it will start a master, an agent and a worker.
egg-bin dev
dev options
--framework egg web framework root path.
--port server port. If not specified, the port is obtained in the following order: egg.js configurationconfig/config.*.js > process.env.EGG_BIN_DEFAULT_PORT > 7001 > other available ports.
--workers worker process number, default to 1 worker at local mode.
--sticky start a sticky cluster server, default to false.
egg-bin
egg developer tool, extends @artus-cli/artus-cli.
Install
Usage
Add
egg-bintopackage.jsonscripts:Command
All the commands support these specific options:
--inspect--inspect-brk--typescript/--tsenable typescript support. Auto detect frompackage.json‘spkg.egg.typescript, orpkg.dependencies.typescript/pkg.devDependencies.typescript.--base/--baseDirapplication’s root path, default toprocess.cwd().--requirewill add toexecArgv, support multiple. Also support read frompackage.json‘spkg.egg.require--dry-run/-dwhether dry-run the test command, just show the commanddev
Start dev cluster on
localenv, it will start a master, an agent and a worker.dev options
--frameworkegg web framework root path.--portserver port. If not specified, the port is obtained in the following order: egg.js configurationconfig/config.*.js>process.env.EGG_BIN_DEFAULT_PORT> 7001 > other available ports.--workersworker process number, default to1worker at local mode.--stickystart a sticky cluster server, default tofalse.debug/inspect on VSCode
Create
.vscode/launch.jsonfile:test
Using mocha to run test.
filesis optional, default totest/**/*.test.tstest/fixtures,test/node_modulesis always exclude.auto require
test/.setup.tsIf
test/.setup.tsfile exists, it will be auto require as the first test file.test options
You can pass any mocha argv.
--timeoutmilliseconds, default to 60000--changed/-conly test changed test files(test files means files that match${pwd}/test/**/*.test.(js|ts))--parallelenable mocha parallel mode, default tofalse.--auto-agentauto start agent in mocha master agent.--jobsnumber of jobs to run in parallel, default toos.cpus().length - 1.--mochawesomeenable mochawesome reporter, default totrue.test environment
Environment is also support, will use it if options not provide.
You can set
TESTSenv to set the tests directory, it support glob grammar.And the reporter can set by the
TEST_REPORTERenv, default isspec.The test timeout can set by
TEST_TIMEOUTenv, default is60000ms.cov
Using mocha and [c8] to run code coverage, it support all test params above.
Coverage reporter will output text-summary, json and lcov.
cov options
You can pass any mocha argv.
-xadd dir ignore coverage, support multiple argv--prerequireprerequire files for coverage instrument, you can use this options if load files slowly when callmm.appormm.cluster--typescript/--tsenable typescript support. If true, will auto add.tsextension and ignoretypingsandd.ts.--c8c8 instruments passthrough. you can use this to overwrite egg-bin’s default c8 instruments and add additional ones.cov environment
You can set
COV_EXCLUDESenv to add dir ignore coverage.Custom egg-bin for your team
See https://artus-cli.github.io
License
MIT
Contributors
Made with contributors-img.