Skip to content

Commit

Permalink
chore(test): configure jest & puppeteer
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Mar 22, 2019
1 parent 63d93e2 commit 3f8bee6
Show file tree
Hide file tree
Showing 7 changed files with 2,379 additions and 483 deletions.
8 changes: 7 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@ module.exports = {
},
extends: [
'@nuxtjs'
]
],
globals: {
page: true,
browser: true,
context: true,
jestPuppeteer: true,
},
}
4 changes: 2 additions & 2 deletions demo/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path'
const path = require('path')

export default {
module.exports = {
srcDir: path.resolve(__dirname),
rootDir: path.resolve(__dirname, '..'),
head: {
Expand Down
5 changes: 5 additions & 0 deletions jest-puppeteer.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
launch: {
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
}
}
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'preset': 'jest-puppeteer'
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"dev": "nuxt dev demo",
"lint": "eslint --ext .js,.vue .",
"test": "nuxt-edge build demo --no-lock && jest",
"release": "standard-version $* && git push --follow-tags && npm publish"
},
"files": [
Expand All @@ -19,12 +20,15 @@
"eslint": "^5.15.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jest": "^22.3.0",
"eslint-plugin-jest": "^22.4.1",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^5.2.2",
"nuxt-edge": "^2.5.0-25860970.be89ea1b",
"jest": "^24.5.0",
"jest-puppeteer": "^4.1.0",
"nuxt-edge": "^3.0.0-25882567.ca1ecf0e",
"puppeteer": "^1.13.0",
"standard-version": "^5.0.1"
},
"dependencies": {
Expand Down
22 changes: 22 additions & 0 deletions test/module.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const { Nuxt } = require('nuxt-edge')
const config = require('../demo/nuxt.config')
const url = path => `http://localhost:3000${path}`

let nuxt
beforeAll(async () => {
nuxt = new Nuxt(config)
await nuxt.listen(3000)
}, 60000)

afterAll(async () => {
await nuxt.close()
})

describe('Test module', () => {
beforeEach(async () => {
await page.goto(url('/'))
})
test('true', () => {
expect(true).toEqual(true)
})
})
Loading

0 comments on commit 3f8bee6

Please sign in to comment.