-
-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: test parallelization ⚡️ (#3319)
- Loading branch information
Showing
5 changed files
with
81 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,47 @@ | ||
const path = require('path'); | ||
const minimist = require('minimist'); | ||
|
||
const { | ||
_: [_node, _mocha, ...args], // _ contains the node binary, the mocha binary, and any positional args | ||
...flags | ||
} = minimist(process.argv); | ||
|
||
process.env.LINK_FORGE_DEPENDENCIES_ON_INIT = true; | ||
|
||
let testGlob; | ||
|
||
/** | ||
* Determine which sets of tests to run. Priority goes: | ||
* 1. If positional arguments are passed in, run those files. | ||
* 2. If `--suite` is either slow or fast, run slow or fast test. | ||
* 3. Otherwise, run all spec tests. | ||
*/ | ||
if (args.length === 0) { | ||
if (flags.suite === 'fast') { | ||
testGlob = 'packages/**/*_spec.ts'; | ||
} else if (flags.suite === 'slow') { | ||
testGlob = 'packages/**/*_spec_slow.ts'; | ||
} else { | ||
testGlob = 'packages/**/**/*_spec*'; | ||
} | ||
} | ||
|
||
// In CI, use the JUnit reporter to upload results to CircleCI. | ||
// Locally, use the default 'spec' reporter. | ||
const reporterConfig = process.env.CI | ||
? { | ||
reporter: 'mocha-junit-reporter', | ||
'reporter-option': ['mochaFile=./reports/test_output.xml'], | ||
} | ||
: {}; | ||
|
||
module.exports = { | ||
const opts = { | ||
extension: ['ts'], | ||
require: ['ts-node/register', path.join(__dirname, 'tools', 'test-setup.ts')], | ||
spec: testGlob, | ||
timeout: 800000, | ||
recursive: true, | ||
...reporterConfig, | ||
}; | ||
|
||
module.exports = opts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.