Skip to content

Commit

Permalink
fix: add mutex so tests can run in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 2, 2018
1 parent bf719e4 commit b03b605
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Expand Up @@ -4,8 +4,8 @@ jobs:
lint: &lint
docker:
- image: node:latest
environment:
- TEST_SERIES: 1
# environment:
# - TEST_SERIES: 1
working_directory: ~/cli
steps:
- checkout
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
@@ -1,6 +1,6 @@
environment:
nodejs_version: "9"
TEST_SERIES: "1"
# TEST_SERIES: "1"
matrix:
- TEST_TYPE: base
- TEST_TYPE: single
Expand Down
6 changes: 4 additions & 2 deletions src/generators/app.ts
Expand Up @@ -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()}`)
})
Expand Down
2 changes: 2 additions & 0 deletions test/run.js
Expand Up @@ -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}`)
Expand Down

0 comments on commit b03b605

Please sign in to comment.