Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nice GQL tests config #854

Merged
merged 10 commits into from Aug 13, 2018
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/core-graphql/__tests__/__support__/config/peers.json
@@ -0,0 +1,12 @@
{
"minimumVersion": ">=1.1.1",
"minimumNetworkReach": 5,
"globalTimeout": 5000,
"coldStart": 30,
"whiteList":[],
"blackList": [],
"list": [{
"ip": "127.0.0.1",
"port": 4000
}]
}
22 changes: 22 additions & 0 deletions packages/core-graphql/__tests__/__support__/config/plugins.js
@@ -0,0 +1,22 @@
module.exports = {
'@arkecosystem/core-config': {},
'@arkecosystem/core-logger': {},
'@arkecosystem/core-logger-winston': {
transports: {
console: {
options: {
colorize: true,
level: process.env.ARK_LOG_LEVEL || 'debug'
}
},
dailyRotate: {
options: {
filename: process.env.ARK_LOG_FILE || `${process.env.ARK_PATH_DATA}/logs/core/${process.env.ARK_NETWORK_NAME}/%DATE%.log`,
datePattern: 'YYYY-MM-DD',
level: process.env.ARK_LOG_LEVEL || 'debug',
zippedArchive: true
}
}
}
}
}
14 changes: 4 additions & 10 deletions packages/core-graphql/__tests__/__support__/setup.js
Expand Up @@ -4,21 +4,15 @@ const path = require('path')
const container = require('@arkecosystem/core-container')

exports.setUp = async () => {
jest.setTimeout(60000)

process.env.ARK_GRAPHQL_ENABLED = true
process.env.ARK_GRAPHQL_HOST = 'localhost'
process.env.ARK_GRAPHQL_PORT = 4005

await container.setUp({
data: '~/.ark',
config: path.resolve(__dirname, '../../../core/lib/config/testnet'),
token: 'ark',
network: 'testnet'
config: path.resolve(__dirname, './config'),
network: 'testnet',
token: 'ark'
}, {
})

return container
}

exports.tearDown = async () => container.tearDown()
exports.tearDown = () => container.tearDown()
11 changes: 7 additions & 4 deletions packages/core-graphql/__tests__/graphql.test.js
@@ -1,14 +1,17 @@
const app = require('./__support__/setup')

let graphql
let container

beforeAll(async () => {
container = await app.setUp()
graphql = container.resolvePlugin('graphql')
const container = await app.setUp()
graphql = await require('../lib').plugin.register(container, {
enabled: true,
host: 'localhost',
port: 4005
})
})

afterAll(async () => {
afterAll(() => {
app.tearDown()
})

Expand Down
2 changes: 1 addition & 1 deletion packages/core-graphql/package.json
Expand Up @@ -9,7 +9,7 @@
"main": "lib/index.js",
"scripts": {
"build:docs": "../../node_modules/.bin/jsdoc -c jsdoc.json",
"test": "cross-env ARK_ENV=test jest --runInBand --detectOpenHandles",
"test": "cross-env ARK_ENV=test jest --runInBand --forceExit",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still wrong, forceExit is replaced by detectOpenHandles.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you suggest?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said, use --detectOpenHandles instead of --forceExit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works locally now with proper plugin management (doesnt hang with detectopenhandles)

"test:coverage": "cross-env ARK_ENV=test jest --coverage --runInBand --detectOpenHandles",
"test:debug": "cross-env ARK_ENV=test node --inspect-brk ../../node_modules/.bin/jest --runInBand --watch",
"test:watch": "cross-env ARK_ENV=test jest --runInBand --watch",
Expand Down