Skip to content

Commit

Permalink
fix: parallel on wsl
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Sep 5, 2019
1 parent 527a055 commit 5eb631d
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 12 deletions.
51 changes: 51 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,54 @@ jobs:
- script: curl -s https://codecov.io/bash | bash -s -- -t $(CODECOV_TOKEN)
condition: succeededOrFailed()
displayName: 'Submit coverage data to codecov'

# WSL
- job: WSL
pool:
vmImage: windows-2019
strategy:
maxParallel: 4
matrix:
node-8:
node_version: ^8.9.0
webpack_version: latest
steps:
- powershell: |
choco install wsl-ubuntu-1804
wsl -l -v
displayName: 'Install WSL'
runAsRoot: true
- script: 'git config --global core.autocrlf input'
displayName: 'Config git core.autocrlf'
- checkout: self
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js $(node_version)'
- task: Npm@1
inputs:
command: custom
customCommand: i -g npm@latest
displayName: 'Install latest NPM'
- script: |
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
inputs:
command: custom
customCommand: ci
displayName: 'Install dependencies'
- script: npm i webpack@$(webpack_version)
displayName: 'Install "webpack@$(webpack_version)"'
- script: npm run test:coverage -- --ci --reporters="default" --reporters="jest-junit" || $(continue_on_error)
displayName: 'Run tests with coverage'
- task: PublishTestResults@2
inputs:
testRunTitle: 'Linux with Node.js $(node_version)'
testResultsFiles: '**/junit.xml'
condition: succeededOrFailed()
displayName: 'Publish test results'
- script: curl -s https://codecov.io/bash | bash -s -- -t $(CODECOV_TOKEN)
condition: succeededOrFailed()
displayName: 'Submit coverage data to codecov'
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"dependencies": {
"cacache": "^12.0.3",
"find-cache-dir": "^3.0.0",
"is-wsl": "^2.1.0",
"jest-worker": "^24.9.0",
"schema-utils": "^2.2.0",
"serialize-javascript": "^2.1.0",
Expand Down
7 changes: 1 addition & 6 deletions src/TaskRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import cacache from 'cacache';
import findCacheDir from 'find-cache-dir';
import Worker from 'jest-worker';
import serialize from 'serialize-javascript';
import isWsl from 'is-wsl';

import minify from './minify';

Expand All @@ -28,11 +27,7 @@ export default class TaskRunner {
// https://github.com/nodejs/node/issues/19022
const cpus = os.cpus() || { length: 1 };

// WSL sometimes freezes, error seems to be on the WSL side
// https://github.com/webpack-contrib/terser-webpack-plugin/issues/21
return isWsl
? 1
: parallel === true
return parallel === true
? cpus.length - 1
: Math.min(Number(parallel) || 0, cpus.length - 1);
}
Expand Down

0 comments on commit 5eb631d

Please sign in to comment.