fix: add mutex so tests can run in parallel
MODIFY
.circleci/config.yml
.circleci/config.yml
@@ -4,8 +4,8 @@ jobs:
lint: &lint
docker:
- image: node:latest
- environment:
- - TEST_SERIES: 1
+ # environment:
+ # - TEST_SERIES: 1
working_directory: ~/cli
steps:
- checkout

MODIFY
appveyor.yml
appveyor.yml
environment:
nodejs_version: "9"
- TEST_SERIES: "1"
+ # TEST_SERIES: "1"
matrix:
- TEST_TYPE: base
- TEST_TYPE: single

MODIFY
src/generators/app.ts
src/generators/app.ts
@@ -392,9 +392,11 @@ class App extends Generator {
'concurrently',
)
}
+ let yarnOpts = {} as any
+ if (process.env.YARN_MUTEX) yarnOpts.mutex = process.env.YARN_MUTEX
Promise.all([
- this.yarnInstall(devDependencies, {dev: true, ignoreScripts: true}),
- this.yarnInstall(dependencies),
+ this.yarnInstall(devDependencies, {...yarnOpts, dev: true, ignoreScripts: true}),
+ this.yarnInstall(dependencies, yarnOpts),
]).then(() => {
console.log(`\nCreated ${this.pjson.name} in ${this.destinationRoot()}`)
})

MODIFY
test/run.js
test/run.js
@@ -11,6 +11,8 @@ const {CI} = process.env
delete process.env.CI
process.env.ANYCLI_DEBUG = '1'
+process.env.YARN_MUTEX = `file:${tmp.tmpNameSync()}`
+
function generate(args) {
const run = path.join(__dirname, '../bin/run')
sh.exec(`node ${run} ${args}`)

fix: add mutex so tests can run in parallel