Skip to content

Commit

Permalink
πŸ”Š[e2e] add extra logging (#231)
Browse files Browse the repository at this point in the history
* πŸ”Š[e2e] output static pages load in logs

* πŸ”Š[e2e] add http status code
  • Loading branch information
bcaudan authored Jan 10, 2020
1 parent 5d8ad46 commit a57f144
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ const fakeBackend = require('./fake-backend')
const buildEnv = require('../../scripts/build-env')

let port = 3000

morgan.token('body', (req, res) => extractBody(req, res))
const stream = fs.createWriteStream(path.join(__dirname, 'test-server.log'))

const app = express()
app.use(cors())
app.use(morgan(':method :url :status :body', { stream }))
app.use(express.static(path.join(__dirname, '../static')))
app.use(express.static(path.join(__dirname, '../app/dist')))

Expand All @@ -23,13 +29,9 @@ if (process.env.ENV === 'development') {
app.use(middleware(webpack(withBuildEnv(logsConfig(null, { mode: 'development' })))))
} else {
// e2e tests
morgan.token('body', (req, res) => extractBody(req, res))
const stream = fs.createWriteStream(path.join(__dirname, 'test-server.log'))
app.use(morgan(':method :url :body', { stream }))
app.use(express.static(path.join(__dirname, '../../packages/logs/bundle')))
app.use(express.static(path.join(__dirname, '../../packages/rum/bundle')))
app.use(bodyParser.text())
app.use(cors())
fakeBackend(app)
}

Expand Down

0 comments on commit a57f144

Please sign in to comment.