feat(jest): Jest 27 support

BREAKING CHANGE: `flush` will not run during cleanup

BREAKING CHANGE: angularjs-testing-library requires Node >=12

BREAKING CHANGE: Upgrade to TypeScript 4. Definitions may not match

BREAKING CHANGE: Depends on dom-testing-library@^8.5.0

Added `angularjs-testing-library/jest-circus-setup` for
`setupFilesAfterEnv` to fix `angular-mocks` loading because
`window.jasmine` is not defined with Jest Circus
master v5.0.0
Jason Staten 3 years ago
parent 00c16da0f8
commit 64b3047901

@ -0,0 +1,2 @@
// Shim for angular-mocks
window.jasmine = window.jasmine || {};

@ -4,7 +4,7 @@
"description": "Simple and complete AngularJS testing utilities that encourage good testing practices.",
"main": "lib/index.js",
"engines": {
"node": ">=10"
"node": ">=12"
},
"scripts": {
"prebuild": "rimraf lib",
@ -62,29 +62,30 @@
],
"license": "MIT",
"dependencies": {
"@testing-library/dom": "^6.3.0"
"@testing-library/dom": "^8.5.0"
},
"devDependencies": {
"@semantic-release/git": "^7.0.17",
"@testing-library/jest-dom": "^4.1.0",
"@types/angular": "^1.6.57",
"@types/angular-mocks": "^1.7.0",
"@types/jest": "^24.0.23",
"@types/jest": "^27.0.1",
"@types/node": "^12.12.16",
"@typescript-eslint/parser": "^2.11.0",
"@typescript-eslint/parser": "^4.31.1",
"angular": "^1.7.8",
"angular-mocks": "^1.7.8",
"concurrently": "^5.0.0",
"doctoc": "^1.4.0",
"eslint": "^6.7.2",
"eslint": "^7.32.0",
"husky": "^3.1.0",
"jest": "^24.9.0",
"jest-cli": "^24.9.0",
"jest": "^27.2.0",
"jest-cli": "^27.2.0",
"lint-staged": "^9.5.0",
"prettier": "^2.4.0",
"rimraf": "^3.0.0",
"semantic-release": "^15.13.30",
"ts-jest": "^24.2.0",
"typescript": "^3.7.3"
"ts-jest": "^27.0.5",
"typescript": "^4.4.3"
},
"peerDependencies": {
"angular": "*",
@ -122,7 +123,9 @@
"jest": {
"preset": "ts-jest",
"setupFilesAfterEnv": [
"@testing-library/jest-dom/extend-expect"
]
"@testing-library/jest-dom/extend-expect",
"<rootDir>/jest-circus-setup.js"
],
"testEnvironment": "jsdom"
}
}

@ -1,9 +1,4 @@
let render: (html: string) => void
beforeAll(() => {
process.env.ATL_SKIP_AUTO_CLEANUP = 'true'
const atl = require('../')
render = atl.render
})
import {render} from '../pure';
// This one verifies that if ATL_SKIP_AUTO_CLEANUP is set
// then we DON'T auto-wire up the afterEach for folks

@ -1,4 +1,4 @@
import {flush, cleanup} from './pure'
import { cleanup} from './pure'
declare function afterEach(cb: () => void): void
@ -9,7 +9,6 @@ declare function afterEach(cb: () => void): void
// or set the ATL_SKIP_AUTO_CLEANUP env variable to 'true'.
if (typeof afterEach === 'function' && !process.env.ATL_SKIP_AUTO_CLEANUP) {
afterEach(() => {
flush()
cleanup()
})
}

@ -11,7 +11,7 @@ import {
getQueriesForElement,
prettyDOM,
fireEvent as dtlFireEvent,
wait as dtlWait,
waitFor as dtlWait,
queries as dtlQueries,
Queries,
BoundFunction,

@ -2,10 +2,8 @@
"compilerOptions": {
/* Basic Options */
"incremental": true /* Enable incremental compilation */,
"target":
"es2019" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module":
"commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"target": "es2021" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
@ -41,8 +39,7 @@
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
"moduleResolution":
"node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {
// "src/*": ["/dev/null"], // Enforce relative paths

Loading…
Cancel
Save