From f2b20c8eb85aadbcc981649654a2a638a1fa6799 Mon Sep 17 00:00:00 2001 From: zazzaz Date: Tue, 12 Jan 2021 11:00:37 +0800 Subject: [PATCH] test: add ssr test (#1261) * test: add ssr test * chore: update --- .../azure-pipelines.yml | 0 .github/workflows/{yarn.js.yml => unit-test.yml} | 4 ++-- packages/element-plus/__tests__/ssr.spec.ts | 15 +++++++++++++++ scripts/build.sh | 2 -- 4 files changed, 17 insertions(+), 4 deletions(-) rename azure-pipelines.yml => .github/azure-pipelines.yml (100%) rename .github/workflows/{yarn.js.yml => unit-test.yml} (94%) create mode 100644 packages/element-plus/__tests__/ssr.spec.ts diff --git a/azure-pipelines.yml b/.github/azure-pipelines.yml similarity index 100% rename from azure-pipelines.yml rename to .github/azure-pipelines.yml diff --git a/.github/workflows/yarn.js.yml b/.github/workflows/unit-test.yml similarity index 94% rename from .github/workflows/yarn.js.yml rename to .github/workflows/unit-test.yml index bc4991c415..52795f7ac2 100644 --- a/.github/workflows/yarn.js.yml +++ b/.github/workflows/unit-test.yml @@ -1,10 +1,10 @@ -name: CI +name: Unit Test on: pull_request jobs: build: - name: Test + name: Unit Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/packages/element-plus/__tests__/ssr.spec.ts b/packages/element-plus/__tests__/ssr.spec.ts new file mode 100644 index 0000000000..de059a7f8c --- /dev/null +++ b/packages/element-plus/__tests__/ssr.spec.ts @@ -0,0 +1,15 @@ +/** + * @jest-environment node + */ + +describe('SSR', () => { + test('require', () => { + try { + process.env.VUE_ENV = 'server' + require('../index') + } catch (e) { + throw Error(e) + } + expect('pass').toBe('pass') + }) +}) diff --git a/scripts/build.sh b/scripts/build.sh index 1956c7334d..9fa16451ce 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -6,8 +6,6 @@ # *utils, __mocks__ directives hooks locale theme* # which means the result will not contain folder name includes utils -yarn bootstrap - yarn clean:lib yarn build:esm-bundle tar --exclude=index.esm.js -zcvf ./es.gz ./lib