chore(v2): Add E2E test for yarn v2 (#3008)

* chore(v2): Add E2E test for yarn v2

* Remove root node_modules to prevent them from accessible in e2e test

The purpose of e2e test is to ensure that the docusaurus inited website can stand on its own. The root node_modules remain accessible according to how node resolution works and it might interfere with the test. Remove them for safety.

* Add @mdx-js/react to docusaurus init templates
This commit is contained in:
Sam Zhou 2020-07-01 06:06:03 -04:00 committed by GitHub
parent 086d1b7135
commit cf5babd5c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 3 deletions

View file

@ -11,7 +11,7 @@ on:
- master
jobs:
build:
yarn-v1:
runs-on: ubuntu-latest
strategy:
matrix:
@ -25,7 +25,42 @@ jobs:
- name: Installation
run: yarn
- name: Setup test-website project against master release
run: yarn test:build:v2
run: |
yarn test:build:v2
rm -rf node_modules
- name: Start test-website project
run: cd test-website && yarn start --no-open
env:
E2E_TEST: true
- name: Build test-website project
run: cd test-website && yarn build
env:
CI: true
yarn-v2:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Installation
run: yarn
- name: Setup test-website project against master release
run: |
KEEP_CONTAINER=true yarn test:build:v2
rm -rf node_modules
- name: Setup test-website project for Yarn v2
run: |
cd test-website
yarn set version berry
yarn config set pnpMode loose
yarn config set npmRegistryServer http://localhost:4873
yarn config set unsafeHttpWhitelist --json '["localhost"]'
yarn install
- name: Start test-website project
run: cd test-website && yarn start --no-open
env:

View file

@ -27,7 +27,7 @@ git diff --name-only -- '*.json' | sed 's, ,\\&,g' | xargs git checkout --
npm_config_registry="$CUSTOM_REGISTRY_URL" npx @docusaurus/init@"$NEW_VERSION" init test-website classic
# Stop Docker container
if ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then
if (! $KEEP_CONTAINER) && ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then
# Remove Docker container
docker container stop $CONTAINER_NAME > /dev/null
fi

View file

@ -11,6 +11,7 @@
"dependencies": {
"@docusaurus/core": "^2.0.0-alpha.58",
"@docusaurus/preset-bootstrap": "^2.0.0-alpha.58",
"@mdx-js/react": "^1.5.8",
"classnames": "^2.2.6",
"react": "^16.8.4",
"react-dom": "^16.8.4"

View file

@ -11,6 +11,7 @@
"dependencies": {
"@docusaurus/core": "^2.0.0-alpha.58",
"@docusaurus/preset-classic": "^2.0.0-alpha.58",
"@mdx-js/react": "^1.5.8",
"clsx": "^1.1.1",
"react": "^16.8.4",
"react-dom": "^16.8.4"

View file

@ -15,6 +15,7 @@
"dependencies": {
"@docusaurus/core": "^2.0.0-alpha.58",
"@docusaurus/preset-classic": "^2.0.0-alpha.58",
"@mdx-js/react": "^1.5.8",
"clsx": "^1.1.1",
"react": "^16.8.4",
"react-dom": "^16.8.4"