diff --git a/jest.config.js b/jest.config.js index ade872779..901d8ed3d 100644 --- a/jest.config.js +++ b/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' } diff --git a/test/e2e.test.js b/test/e2e.test.ts similarity index 99% rename from test/e2e.test.js rename to test/e2e.test.ts index 6d1a86e12..b25543027 100644 --- a/test/e2e.test.js +++ b/test/e2e.test.ts @@ -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' }) @@ -179,6 +180,7 @@ describe('e2e', () => { await page.goto(url('/')) const flag = await page.evaluate(() => { + // @ts-ignore return window.$nuxt.$auth._custom_plugin }) diff --git a/test/tsconfig.json b/test/tsconfig.json new file mode 100644 index 000000000..3703aae00 --- /dev/null +++ b/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 + } +}