Skip to content

Commit ca93060

Browse files
test(module): use get-port
1 parent e8bcfb4 commit ca93060

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
"description": "ESLint will run on saving.",
55
"license": "MIT",
66
"contributors": [
7-
{
8-
"name": "Ricardo Gobbo de Souza <ricardogobbosouza@yahoo.com.br>"
9-
}
7+
"Ricardo Gobbo de Souza <ricardogobbosouza@yahoo.com.br>"
108
],
119
"main": "lib/module.js",
1210
"repository": "https://github.com/nuxt-community/eslint-module",
@@ -42,6 +40,7 @@
4240
"eslint-plugin-promise": "latest",
4341
"eslint-plugin-standard": "latest",
4442
"eslint-plugin-vue": "latest",
43+
"get-port": "latest",
4544
"husky": "latest",
4645
"jest": "latest",
4746
"nuxt-edge": "latest",

test/module.test.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
jest.setTimeout(60000)
2-
process.env.PORT = process.env.PORT || 5060
32

43
const { Nuxt, Builder } = require('nuxt-edge')
54
const request = require('request-promise-native')
5+
const getPort = require('get-port')
66

77
const config = require('../example/nuxt.config')
88

9-
const url = path => `http://localhost:${process.env.PORT}${path}`
10-
const get = path => request(url(path))
9+
let nuxt, port
1110

12-
describe('basic', () => {
13-
let nuxt
11+
const url = path => `http://localhost:${port}${path}`
12+
const get = path => request(url(path))
1413

14+
describe('module', () => {
1515
beforeAll(async () => {
1616
config.dev = true
1717
config.debug = true
1818
nuxt = new Nuxt(config)
1919
await new Builder(nuxt).build()
20-
await nuxt.listen(process.env.PORT)
20+
port = await getPort()
21+
await nuxt.listen(port)
2122
})
2223

2324
afterAll(async () => {

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -4108,6 +4108,11 @@ get-pkg-repo@^1.0.0:
41084108
parse-github-repo-url "^1.3.0"
41094109
through2 "^2.0.0"
41104110

4111+
get-port@latest:
4112+
version "4.1.0"
4113+
resolved "https://registry.yarnpkg.com/get-port/-/get-port-4.1.0.tgz#93eb3d5552c197497d76e9c389a6ac9920e20192"
4114+
integrity sha512-4/fqAYrzrzOiqDrdeZRKXGdTGgbkfTEumGlNQPeP6Jy8w0PzN9mzeNQ3XgHaTNie8pQ3hOUkrwlZt2Fzk5H9mA==
4115+
41114116
get-stdin@5.0.1:
41124117
version "5.0.1"
41134118
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398"

0 commit comments

Comments
 (0)