Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
test: don't use --runInBand and improve execution performance (#2007)
backport from #2005 to master branch
- Loading branch information
Showing
with
395 additions
and 168 deletions.
- +6 −1 .babelrc
- +32 −0 globalSetupTest.js
- +1 −0 jest.config.js
- +75 −30 package-lock.json
- +3 −1 package.json
- +4 −2 test/cli/cli.test.js
- +3 −2 test/client/clients/SockJSClient.test.js
- +7 −6 test/e2e/Client.test.js
- +43 −35 test/e2e/ClientOptions.test.js
- +2 −1 test/integration/MultiCompiler.test.js
- +2 −1 test/integration/UniversalCompiler.test.js
- +51 −0 test/ports-map.js
- +7 −4 test/server/Server.test.js
- +2 −2 test/server/__snapshots__/Server.test.js.snap
- +2 −0 test/server/after-option.test.js
- +2 −0 test/server/before-option.test.js
- +4 −1 test/server/compress-option.test.js
- +10 −0 test/server/contentBase-option.test.js
- +3 −0 test/server/headers-option.test.js
- +7 −0 test/server/historyApiFallback-option.test.js
- +13 −7 test/server/host-option.test.js
- +7 −6 test/server/hot-option.test.js
- +3 −2 test/server/hotOnly-option.test.js
- +5 −1 test/server/http2-option.test.js
- +7 −2 test/server/https-option.test.js
- +11 −12 test/server/inline-option.test.js
- +3 −0 test/server/lazy-option.test.js
- +3 −0 test/server/liveReload-option.test.js
- +4 −0 test/server/mimeTypes-option.test.js
- +2 −0 test/server/onListening-option.test.js
- +8 −6 test/server/open-option.test.js
- +2 −1 test/server/port-option.test.js
- +19 −14 test/server/proxy-option.test.js
- +9 −3 test/server/serverMode-option.test.js
- +3 −2 test/server/servers/SockJSServer.test.js
- +5 −3 test/server/sockPath-option.test.js
- +5 −3 test/server/stats-option.test.js
- +18 −19 test/server/utils/createDomain.test.js
- +2 −1 test/server/utils/routes.test.js
| @@ -1,3 +1,8 @@ | ||
| { | ||
| "presets": ["@babel/preset-env"] | ||
| "presets": ["@babel/preset-env"], | ||
| "env": { | ||
| "test": { | ||
| "plugins": ["@babel/plugin-transform-runtime"] | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,32 @@ | ||
| 'use strict'; | ||
|
|
||
| // eslint-disable-next-line import/no-extraneous-dependencies | ||
| const tcpPortUsed = require('tcp-port-used'); | ||
| const ports = require('./test/ports-map'); | ||
|
|
||
| async function validatePorts() { | ||
| const samples = []; | ||
|
|
||
| Object.keys(ports).forEach((key) => { | ||
| const value = ports[key]; | ||
| const arr = Array.isArray(value) ? value : [value]; | ||
|
|
||
| arr.forEach((port) => { | ||
| const check = tcpPortUsed.check(port, 'localhost').then((inUse) => { | ||
| if (inUse) throw new Error(`${port} has already used. [${key}]`); | ||
| }); | ||
|
|
||
| samples.push(check); | ||
| }); | ||
| }); | ||
|
|
||
| try { | ||
| await Promise.all(samples); | ||
| } catch (e) { | ||
| // eslint-disable-next-line no-console | ||
| console.error(e); | ||
| process.exit(1); | ||
| } | ||
| } | ||
|
|
||
| module.exports = validatePorts; |
Oops, something went wrong.