Skip to content

Commit

Permalink
test: use ts-jest
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoPedroAS51 committed Oct 17, 2020
1 parent 9934021 commit 0c2183b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
7 changes: 7 additions & 0 deletions jest.config.js
@@ -1,5 +1,12 @@
module.exports = {
preset: 'ts-jest',
globals: {
'ts-jest': {
tsConfig: './test/tsconfig.json'
}
},
testEnvironment: 'node',
testMatch: ['**/test/**/*.ts', '**/?(*.)+(spec|test).ts'],
transform: {
'^.+\\.js$': 'babel-jest'
}
Expand Down
2 changes: 2 additions & 0 deletions test/e2e.test.js → test/e2e.test.ts
Expand Up @@ -31,6 +31,7 @@ describe('e2e', () => {
const page = await browser.newPage()
await page.goto(url('/'))

// @ts-ignore
const state = await page.evaluate(() => window.__NUXT__.state)
expect(state.auth).toEqual({ user: null, loggedIn: false, strategy: 'local' })

Expand Down Expand Up @@ -179,6 +180,7 @@ describe('e2e', () => {
await page.goto(url('/'))

const flag = await page.evaluate(() => {
// @ts-ignore
return window.$nuxt.$auth._custom_plugin
})

Expand Down
23 changes: 23 additions & 0 deletions test/tsconfig.json
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"lib": [
"dom"
],
"esModuleInterop": true,
"allowJs": true,
"noEmit": true,
"baseUrl": ".",
"types": [
"@types/node",
"@types/jest",
"@types/puppeteer",
"@nuxt/types",
"@nuxtjs/axios",
"../src/index"
],
"skipLibCheck": true
}
}

0 comments on commit 0c2183b

Please sign in to comment.