Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow require mocha from outside #204

Merged
merged 2 commits into from
Jan 9, 2023
Merged

feat: allow require mocha from outside #204

merged 2 commits into from
Jan 9, 2023

Conversation

fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Jan 8, 2023

const Mocha = require('egg-bin').requireMocha();
Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

```js
const Mocha = require('egg-bin').requireMocha();
```
if (typeof fsPromises.cp === 'function') {
return await fsPromises.cp(src, target, { force: true, recursive: true });
}
return execSync(`cp -R ${src} ${target}`);

Check warning

Code scanning / CodeQL

Shell command built from environment values

This shell command depends on an uncontrolled [absolute path](1). This shell command depends on an uncontrolled [absolute path](2). This shell command depends on an uncontrolled [absolute path](3). This shell command depends on an uncontrolled [absolute path](4). This shell command depends on an uncontrolled [absolute path](5). This shell command depends on an uncontrolled [absolute path](6). This shell command depends on an uncontrolled [absolute path](7). This shell command depends on an uncontrolled [absolute path](8).
@atian25
Copy link
Member

atian25 commented Jan 8, 2023

其实我当时倾向于 egg-bin 不要内置 mocha 这些,而仅仅作为 mocha opts 文件的生成器,这样的话 vscode 等的 mocha 插件就能用上了。https://github.com/artus-cli/artus-cli/blob/master/.mocharc.cjs

@codecov
Copy link

codecov bot commented Jan 8, 2023

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (1f00ed9) compared to base (dda64a5).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #204   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           12        12           
  Lines           93        93           
  Branches        16        16           
=========================================
  Hits            93        93           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@fengmk2
Copy link
Member Author

fengmk2 commented Jan 8, 2023

其实我当时倾向于 egg-bin 不要内置 mocha 这些,而仅仅作为 mocha opts 文件的生成器,这样的话 vscode 等的 mocha 插件就能用上了。https://github.com/artus-cli/artus-cli/blob/master/.mocharc.cjs

不内置对应用开发者又得感知 mocha 的升级,不好的。

@atian25
Copy link
Member

atian25 commented Jan 8, 2023

其实我当时倾向于 egg-bin 不要内置 mocha 这些,而仅仅作为 mocha opts 文件的生成器,这样的话 vscode 等的 mocha 插件就能用上了。https://github.com/artus-cli/artus-cli/blob/master/.mocharc.cjs

不内置对应用开发者又得感知 mocha 的升级,不好的。

可以内置依赖,但运行的时候,不是 egg-bin -> fork mocha,而可以是 mocharc 文件驱动的 mocha -> --require=egg-bin/test 这样,就能跟 IDE 协同了

@fengmk2
Copy link
Member Author

fengmk2 commented Jan 8, 2023

其实我当时倾向于 egg-bin 不要内置 mocha 这些,而仅仅作为 mocha opts 文件的生成器,这样的话 vscode 等的 mocha 插件就能用上了。https://github.com/artus-cli/artus-cli/blob/master/.mocharc.cjs

不内置对应用开发者又得感知 mocha 的升级,不好的。

可以内置依赖,但运行的时候,不是 egg-bin -> fork mocha,而可以是 mocharc 文件驱动的 mocha -> --require=egg-bin/test 这样,就能跟 IDE 协同了

来个 pr 重构起来。

@fengmk2 fengmk2 merged commit 6f59f6e into master Jan 9, 2023
@fengmk2 fengmk2 deleted the export-mocha branch January 9, 2023 17:50
atian25 pushed a commit that referenced this pull request Jan 9, 2023
[skip ci]

## [5.12.0](v5.11.3...v5.12.0) (2023-01-09)

### Features

* allow require mocha from outside ([#204](#204)) ([6f59f6e](6f59f6e))
@github-actions
Copy link

github-actions bot commented Jan 9, 2023

🎉 This PR is included in version 5.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants