From bf5c01274deb00a693d9d18f890d7f4ff8e786e3 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Wed, 29 May 2019 14:51:44 -0400 Subject: [PATCH] Fix running unit tests & running doc build script on Windows (#1971) * Set NODE_ENV=test on Windows machines for test-unit and build-docs scripts * changelog --- CHANGELOG.md | 4 ++++ package.json | 5 +++-- yarn.lock | 10 +++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50dc5b17070..27120cecdc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ - Update `caniuse-lite` version resolution ([#1970](https://github.com/elastic/eui/pull/1970)) - Add a webpack directive for naming icon chunks ([#1944])(https://github.com/elastic/eui/pull/1944)) +**Bug fixes** + +- Fixes environment setup for running `test-unit` script on Windows ([#1971](https://github.com/elastic/eui/pull/1971)) + ## [`11.2.1`](https://github.com/elastic/eui/tree/v11.2.1) **Bug fixes** diff --git a/package.json b/package.json index a101f0c4f30..d5d3ee2a3c2 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "start": "webpack-dev-server --port 8030 --inline --hot --config=src-docs/webpack.config.js", "test-docker": "docker pull $npm_package_docker_image && docker run --rm -i -e GIT_COMMITTER_NAME=test -e GIT_COMMITTER_EMAIL=test --user=$(id -u):$(id -g) -e HOME=/tmp -v $(pwd):/app -w /app $npm_package_docker_image bash -c 'npm config set spin false && /opt/yarn*/bin/yarn && npm run test && npm run build'", "sync-docs": "node ./scripts/docs-sync.js", - "build-docs": "NODE_ENV=production webpack --config=src-docs/webpack.config.js", + "build-docs": "cross-env NODE_ENV=production webpack --config=src-docs/webpack.config.js", "build": "yarn extract-i18n-strings && node ./scripts/compile-clean.js && node ./scripts/compile-eui.js && node ./scripts/compile-scss.js $npm_package_name", "compile-icons": "node ./scripts/compile-icons.js && prettier --write --loglevel=warn \"./src/components/icon/assets/**/*.js\"", "extract-i18n-strings": "node ./scripts/babel/fetch-i18n-strings", @@ -28,7 +28,7 @@ "lint-framer": "tslint -c ./tslint.yaml -p ./src-framer/tsconfig.json", "lint-framer-fix": "tslint -c ./tslint.yaml -p ./src-framer/tsconfig.json --fix", "test": "yarn lint && yarn test-unit", - "test-unit": "jest --config ./scripts/jest/config.json", + "test-unit": "cross-env NODE_ENV=test jest --config ./scripts/jest/config.json", "start-test-server": "webpack-dev-server --config src-docs/webpack.config.js --port 9999", "test-visual": "wdio test/wdio.conf.js", "yo-component": "yo ./generator-eui/app/component.js", @@ -108,6 +108,7 @@ "chokidar": "^1.7.0", "chromedriver": "2.37.0", "circular-dependency-plugin": "^5.0.2", + "cross-env": "^5.2.0", "css-loader": "^0.28.7", "cssnano": "^4.0.5", "dts-generator": "^2.1.0", diff --git a/yarn.lock b/yarn.lock index 91b8247b379..9520965b9f4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3596,6 +3596,14 @@ create-react-class@^15.5.1: loose-envify "^1.3.1" object-assign "^4.1.1" +cross-env@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.2.0.tgz#6ecd4c015d5773e614039ee529076669b9d126f2" + integrity sha512-jtdNFfFW1hB7sMhr/H6rW1Z45LFqyI431m3qU6bFXcQ3Eh7LtBuG3h74o7ohHZ3crrRkkqHlo4jYHFPcjroANg== + dependencies: + cross-spawn "^6.0.5" + is-windows "^1.0.0" + cross-spawn-async@^2.1.1: version "2.2.5" resolved "https://registry.yarnpkg.com/cross-spawn-async/-/cross-spawn-async-2.2.5.tgz#845ff0c0834a3ded9d160daca6d390906bb288cc" @@ -7705,7 +7713,7 @@ is-windows@^0.2.0: resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-0.2.0.tgz#de1aa6d63ea29dd248737b69f1ff8b8002d2108c" integrity sha1-3hqm1j6indJIc3tp8f+LgALSEIw= -is-windows@^1.0.2: +is-windows@^1.0.0, is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==