From 7c11c58faf8840ab97b6449c98da0296a60dddd8 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 15 Nov 2021 12:14:57 +0800 Subject: [PATCH] workflow: separate unit and e2e tests --- package.json | 4 +++- packages/vue/__tests__/TransitionGroup.spec.ts | 2 +- scripts/filter-e2e.js | 11 +++++++++++ scripts/filter-unit.js | 9 +++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 scripts/filter-e2e.js create mode 100644 scripts/filter-unit.js diff --git a/package.json b/package.json index fcfd1f52..ad57f52b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,9 @@ "size-baseline": "node scripts/build.js runtime-dom runtime-core reactivity shared -f esm-bundler && cd packages/size-check && vite build", "lint": "eslint --ext .ts packages/*/src/**.ts", "format": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"", - "test": "node scripts/build.js vue -f global -d && jest --runInBand", + "test": "run-s test-unit test-e2e", + "test-unit": "jest --filter ./scripts/filter-unit.js", + "test-e2e": "node scripts/build.js vue -f global -d && jest --filter ./scripts/filter-e2e.js --runInBand", "test-dts": "node scripts/build.js shared reactivity runtime-core runtime-dom -dt -f esm-bundler && npm run test-dts-only", "test-dts-only": "tsc -p ./test-dts/tsconfig.json && tsc -p ./test-dts/tsconfig.build.json", "release": "node scripts/release.js", diff --git a/packages/vue/__tests__/TransitionGroup.spec.ts b/packages/vue/__tests__/TransitionGroup.spec.ts index 6ba05763..38d74253 100644 --- a/packages/vue/__tests__/TransitionGroup.spec.ts +++ b/packages/vue/__tests__/TransitionGroup.spec.ts @@ -346,7 +346,7 @@ describe('e2e: TransitionGroup', () => { ) // not sure why but we just have to wait really long for this to // pass consistently :/ - await transitionFinish(duration * 4) + await transitionFinish(duration * 4 + buffer) expect(await html('#container')).toBe( `
a
` + `
b
` + diff --git a/scripts/filter-e2e.js b/scripts/filter-e2e.js new file mode 100644 index 00000000..bbc36022 --- /dev/null +++ b/scripts/filter-e2e.js @@ -0,0 +1,11 @@ +const e2eTests = ['/Transition', '/TransitionGroup', '/examples/'] + +module.exports = list => { + return { + filtered: list + .filter(t => e2eTests.some(tt => t.includes(tt))) + .map(test => ({ test })) + } +} + +module.exports.e2eTests = e2eTests diff --git a/scripts/filter-unit.js b/scripts/filter-unit.js new file mode 100644 index 00000000..d7528079 --- /dev/null +++ b/scripts/filter-unit.js @@ -0,0 +1,9 @@ +const { e2eTests } = require('./filter-e2e') + +module.exports = list => { + return { + filtered: list + .filter(t => !e2eTests.some(tt => t.includes(tt))) + .map(test => ({ test })) + } +}