Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the jest-circus test runner #12974

Merged
merged 9 commits into from
May 16, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
module.exports = {
// this will become default in jest 27:
testRunner: 'jest-circus/runner',
testMatch: ['**/*.test.js'],
verbose: true,
rootDir: 'test',
modulePaths: ['<rootDir>/lib'],
globalSetup: '<rootDir>/jest-global-setup.js',
globalTeardown: '<rootDir>/jest-global-teardown.js',
setupFilesAfterEnv: ['<rootDir>/jest-setup-after-env.js'],
testEnvironment: '<rootDir>/jest-environment.js',
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"fs-extra": "9.0.0",
"get-port": "5.1.1",
"isomorphic-unfetch": "3.0.0",
"jest-circus": "26.0.1",
"jest-cli": "24.9.0",
"ky": "0.19.1",
"ky-universal": "0.6.0",
Expand Down
3 changes: 1 addition & 2 deletions test/acceptance/ReactRefresh.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* global jasmine */
/* eslint-env jest */
import { sandbox } from './helpers'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
jest.setTimeout(1000 * 60 * 5)

test('can edit a component without losing state', async () => {
const [session, cleanup] = await sandbox()
Expand Down
3 changes: 1 addition & 2 deletions test/acceptance/ReactRefreshLogBox.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* global jasmine */
/* eslint-env jest */
import { sandbox } from './helpers'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
jest.setTimeout(1000 * 60 * 5)

test('logbox: can recover from a syntax error without losing state', async () => {
const [session, cleanup] = await sandbox()
Expand Down
3 changes: 1 addition & 2 deletions test/acceptance/ReactRefreshRegression.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* global jasmine */
/* eslint-env jest */
import { sandbox } from './helpers'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
jest.setTimeout(1000 * 60 * 5)

// https://github.com/zeit/next.js/issues/12422
test('styled-components hydration mismatch', async () => {
Expand Down
3 changes: 1 addition & 2 deletions test/acceptance/ReactRefreshRequire.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* global jasmine */
/* eslint-env jest */
import { sandbox } from './helpers'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
jest.setTimeout(1000 * 60 * 5)

// https://github.com/facebook/metro/blob/b651e535cd0fc5df6c0803b9aa647d664cb9a6c3/packages/metro/src/lib/polyfills/__tests__/require-test.js#L989-L1048
test('re-runs accepted modules', async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/404-page-custom-error/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import fs from 'fs-extra'
import { join } from 'path'
import {
Expand All @@ -12,7 +12,7 @@ import {
fetchViaHTTP,
} from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
jest.setTimeout(1000 * 60 * 2)

const appDir = join(__dirname, '../')
const nextConfig = join(appDir, 'next.config.js')
Expand Down
4 changes: 2 additions & 2 deletions test/integration/404-page-ssg/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import fs from 'fs-extra'
import { join } from 'path'
import {
Expand All @@ -12,7 +12,7 @@ import {
fetchViaHTTP,
} from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
jest.setTimeout(1000 * 60 * 2)

const appDir = join(__dirname, '../')
const nextConfig = join(appDir, 'next.config.js')
Expand Down
4 changes: 2 additions & 2 deletions test/integration/404-page/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import fs from 'fs-extra'
import { join } from 'path'
import {
Expand All @@ -13,7 +13,7 @@ import {
waitFor,
} from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
jest.setTimeout(1000 * 60 * 2)

const appDir = join(__dirname, '../')
const pages404 = join(appDir, 'pages/404.js')
Expand Down
4 changes: 2 additions & 2 deletions test/integration/amp-export-validation/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-env jest */
/* global jasmine */

import { promises } from 'fs'
import { join } from 'path'
import { validateAMP } from 'amp-test-utils'
import { File, nextBuild, nextExport, runNextCommand } from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
jest.setTimeout(1000 * 60 * 2)
const { access, readFile } = promises
const appDir = join(__dirname, '../')
const outDir = join(appDir, 'out')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import { join } from 'path'
import {
nextBuild,
Expand All @@ -9,7 +9,7 @@ import {
renderViaHTTP,
} from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
jest.setTimeout(1000 * 60 * 1)

let app
let appPort
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import { join } from 'path'
import {
nextBuild,
Expand All @@ -10,7 +10,7 @@ import {
renderViaHTTP,
} from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
jest.setTimeout(1000 * 60 * 1)

let app
let appPort
Expand Down
4 changes: 2 additions & 2 deletions test/integration/amphtml-fragment-style/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import { join } from 'path'
import cheerio from 'cheerio'
import { validateAMP } from 'amp-test-utils'
Expand All @@ -11,7 +11,7 @@ import {
renderViaHTTP,
} from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60
jest.setTimeout(1000 * 60)
const appDir = join(__dirname, '../')
let appPort
let server
Expand Down
4 changes: 2 additions & 2 deletions test/integration/amphtml-ssg/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import fs from 'fs-extra'
import { join } from 'path'
import cheerio from 'cheerio'
Expand All @@ -20,7 +20,7 @@ let builtServerPagesDir
let appPort
let app

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
jest.setTimeout(1000 * 60 * 2)

const fsExists = file =>
fs
Expand Down
4 changes: 2 additions & 2 deletions test/integration/amphtml/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import { join } from 'path'
import cheerio from 'cheerio'
import webdriver from 'next-webdriver'
Expand Down Expand Up @@ -29,7 +29,7 @@ const appDir = join(__dirname, '../')
let appPort
let server
let app
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
jest.setTimeout(1000 * 60 * 5)

const context = {}

Expand Down
4 changes: 2 additions & 2 deletions test/integration/api-support/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import fs from 'fs-extra'
import { join } from 'path'
import AbortController from 'abort-controller'
Expand All @@ -15,7 +15,7 @@ import {
} from 'next-test-utils'
import json from '../big.json'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
jest.setTimeout(1000 * 60 * 2)
const appDir = join(__dirname, '../')
const nextConfig = join(appDir, 'next.config.js')
let appPort
Expand Down
4 changes: 2 additions & 2 deletions test/integration/app-aspath/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import { readFileSync, writeFileSync } from 'fs'
import webdriver from 'next-webdriver'
import { join } from 'path'
Expand All @@ -13,7 +13,7 @@ import {

let appPort
let server
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
jest.setTimeout(1000 * 60 * 5)

describe('App asPath', () => {
beforeAll(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import { join } from 'path'
import cheerio from 'cheerio'
import {
Expand All @@ -13,7 +13,7 @@ import {
killApp,
} from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60
jest.setTimeout(1000 * 60)
const appDir = join(__dirname, '../')
let appPort
let server
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import { join } from 'path'
import cheerio from 'cheerio'
import {
Expand All @@ -10,7 +10,7 @@ import {
renderViaHTTP,
} from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60
jest.setTimeout(1000 * 60)
const appDir = join(__dirname, '../')
let appPort
let server
Expand Down
4 changes: 2 additions & 2 deletions test/integration/app-document/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import { join } from 'path'
import {
renderViaHTTP,
Expand All @@ -17,7 +17,7 @@ import csp from './csp'
const context = {
output: '',
}
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
jest.setTimeout(1000 * 60 * 5)

const collectOutput = message => {
context.output += message
Expand Down
4 changes: 2 additions & 2 deletions test/integration/app-functional/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* eslint-env jest */
/* global jasmine */

import { join } from 'path'
import { renderViaHTTP, findPort, launchApp, killApp } from 'next-test-utils'

const context = {
output: '',
}
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
jest.setTimeout(1000 * 60 * 5)

const collectOutput = message => {
context.output += message
Expand Down
4 changes: 2 additions & 2 deletions test/integration/app-tree/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import path from 'path'
import fs from 'fs-extra'
import webdriver from 'next-webdriver'
Expand All @@ -13,7 +13,7 @@ import {
waitFor,
} from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
jest.setTimeout(1000 * 60 * 1)

const appDir = path.join(__dirname, '..')
const nextConfig = path.join(appDir, 'next.config.js')
Expand Down
4 changes: 2 additions & 2 deletions test/integration/auto-export-query-error/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-env jest */
/* global jasmine */

import path from 'path'
import fs from 'fs-extra'
import { nextBuild, nextExport } from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
jest.setTimeout(1000 * 60 * 1)
const appDir = path.join(__dirname, '..')
const outdir = path.join(__dirname, 'out')
const nextConfig = path.join(appDir, 'next.config.js')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-env jest */
/* global jasmine */

import fs from 'fs'
import path from 'path'
import { nextBuild } from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
jest.setTimeout(1000 * 60 * 1)
const appDir = path.join(__dirname, '..')

describe('Auto Export Error Serverless', () => {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/auto-export-serverless/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-env jest */
/* global jasmine */

import webdriver from 'next-webdriver'
import path from 'path'
import { nextBuild, nextStart, findPort, killApp } from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
jest.setTimeout(1000 * 60 * 1)
const appDir = path.join(__dirname, '..')
let appPort
let app
Expand Down
4 changes: 2 additions & 2 deletions test/integration/auto-export/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import webdriver from 'next-webdriver'
import path from 'path'
import {
Expand All @@ -10,7 +10,7 @@ import {
launchApp,
} from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
jest.setTimeout(1000 * 60 * 1)
const appDir = path.join(__dirname, '..')
let appPort
let app
Expand Down
4 changes: 2 additions & 2 deletions test/integration/babel-custom/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-env jest */
/* global jasmine */

import { join } from 'path'
import { nextBuild } from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
jest.setTimeout(1000 * 60 * 5)

describe('Babel', () => {
it('should allow setting targets.browsers', async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/babel/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-env jest */
/* global jasmine */

import { join } from 'path'
import {
renderViaHTTP,
Expand All @@ -13,7 +13,7 @@ import {
import rendering from './rendering'

const context = {}
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
jest.setTimeout(1000 * 60 * 5)

describe('Babel', () => {
beforeAll(async () => {
Expand Down