Skip to content
Snippets Groups Projects
Commit ffda1b59 authored by Jure's avatar Jure
Browse files

Merge branch 'run-integration-test-in-tmp' into 'master'

Fix failing test

See merge request pubsweet/pubsweet!69
parents eae31b5d 3fe78051
No related branches found
No related tags found
No related merge requests found
...@@ -5,10 +5,11 @@ const path = require('path') ...@@ -5,10 +5,11 @@ const path = require('path')
const fs = require('fs-extra') const fs = require('fs-extra')
const { runCommandSync, runCommandAsync } = require('./helpers/') const { runCommandSync, runCommandAsync } = require('./helpers/')
const fetch = require('isomorphic-fetch') const fetch = require('isomorphic-fetch')
const os = require('os')
const appName = 'testapp' const appName = `pubsweet-test-${Math.floor(Math.random() * 99999)}`
const dbName = 'test_db' const dbName = 'test_db'
const tempDir = path.join(__dirname, '..', 'temp') const tempDir = os.tmpdir()
const appPath = path.join(tempDir, appName) const appPath = path.join(tempDir, appName)
const dbDir = path.join(appPath, 'api', 'db') const dbDir = path.join(appPath, 'api', 'db')
const dbPath = path.join(dbDir, dbName) const dbPath = path.join(dbDir, dbName)
...@@ -47,7 +48,7 @@ describe('CLI: integration test', () => { ...@@ -47,7 +48,7 @@ describe('CLI: integration test', () => {
}) })
afterAll(() => { afterAll(() => {
fs.removeSync(tempDir) fs.removeSync(appPath)
}) })
describe('new', () => { describe('new', () => {
...@@ -59,9 +60,9 @@ describe('CLI: integration test', () => { ...@@ -59,9 +60,9 @@ describe('CLI: integration test', () => {
stdio: 'pipe', stdio: 'pipe',
}) })
expect(stderr).toContain( expect(stderr).toContain(
`destination path 'testapp' already exists and is not an empty directory`, `destination path '${appName}' already exists and is not an empty directory`,
) )
fs.emptyDirSync(tempDir) fs.removeSync(appPath)
}) })
it('runs git clone <appname> and yarn install', () => { it('runs git clone <appname> and yarn install', () => {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment