@gasket/plugin-jest
Advanced tools
Comparing version 7.0.1-canary.12 to 7.0.1
@@ -1,2 +0,2 @@ | ||
const nextJest = require('next/jest'); | ||
import nextJest from 'next/jest.js'; | ||
const pathToApp = 'pages'; | ||
@@ -13,2 +13,2 @@ const createJestConfig = nextJest(pathToApp); | ||
module.exports = createJestConfig(customJestConfig); | ||
export default createJestConfig(customJestConfig); |
@@ -0,5 +1,8 @@ | ||
import type { Plugin } from '@gasket/core'; | ||
export default { | ||
const plugin: Plugin = { | ||
name: '@gasket/plugin-jest', | ||
hooks: {} | ||
}; | ||
export = plugin; |
/// <reference types="@gasket/core" /> | ||
/// <reference types="create-gasket-app" /> | ||
/// <reference types="@gasket/plugin-metadata" /> | ||
/// <reference types="@gasket/plugin-express" /> | ||
const { devDependencies, name } = require('../package.json'); | ||
const { | ||
name, | ||
version, | ||
description, | ||
devDependencies | ||
} = require('../package.json'); | ||
@@ -10,2 +16,4 @@ /** @type {import('@gasket/core').Plugin} */ | ||
name, | ||
version, | ||
description, | ||
hooks: { | ||
@@ -17,4 +25,5 @@ create: { | ||
}, | ||
handler: async function create(gasket, { files, pkg }) { | ||
const generatorDir = `${ __dirname }/../generator`; | ||
handler: async function create(gasket, context) { | ||
const { files, pkg, typescript, apiApp } = context; | ||
const generatorDir = `${__dirname}/../generator`; | ||
const isReactProject = pkg.has('dependencies', 'react'); | ||
@@ -26,3 +35,3 @@ | ||
if (isReactProject) { | ||
if (isReactProject && !apiApp) { | ||
files.add( | ||
@@ -38,9 +47,38 @@ `${generatorDir}/*`, | ||
}); | ||
pkg.add('scripts', { | ||
'test': 'jest', | ||
'test:watch': 'jest --watchAll', | ||
'test:coverage': 'jest --coverage' | ||
}); | ||
} else if (apiApp) { | ||
if (typescript) { | ||
pkg.add('devDependencies', { | ||
'@types/jest': devDependencies['@types/jest'], | ||
'ts-jest': devDependencies['ts-jest'], | ||
'ts-node': devDependencies['ts-node'] | ||
}); | ||
pkg.add('scripts', { | ||
'test': 'TS_NODE_PROJECT=./tsconfig.test.json jest', | ||
'test:watch': 'npm run test -- --watchAll', | ||
'test:coverage': 'npm run test -- --coverage' | ||
}); | ||
} else { | ||
pkg.add('devDependencies', { | ||
'cross-env': devDependencies['cross-env'] | ||
}); | ||
pkg.add('scripts', { | ||
'test': "cross-env NODE_OPTIONS='--unhandled-rejections=strict --experimental-vm-modules' jest", | ||
'test:watch': 'npm run test -- --watch', | ||
'test:coverage': 'npm run test -- --coverage' | ||
}); | ||
} | ||
} else { | ||
pkg.add('scripts', { | ||
'test': 'jest', | ||
'test:watch': 'jest --watchAll', | ||
'test:coverage': 'jest --coverage' | ||
}); | ||
} | ||
pkg.add('scripts', { | ||
'test': 'jest', | ||
'test:watch': 'jest --watchAll', | ||
'test:coverage': 'jest --coverage' | ||
}); | ||
} | ||
@@ -47,0 +85,0 @@ }, |
{ | ||
"name": "@gasket/plugin-jest", | ||
"version": "7.0.1-canary.12", | ||
"version": "7.0.1", | ||
"description": "Integrated jest into your application.", | ||
@@ -34,6 +34,2 @@ "main": "lib/index.js", | ||
"author": "GoDaddy Operating Company, LLC", | ||
"maintainers": [ | ||
"Salil Agrawal <sagrawal@godaddy.com>", | ||
"Andrew Gerard <agerard@godaddy.com>" | ||
], | ||
"license": "MIT", | ||
@@ -51,8 +47,8 @@ "bugs": { | ||
"eslint": "^8.56.0", | ||
"eslint-config-godaddy": "^7.1.0", | ||
"eslint-plugin-jest": "^27.6.3", | ||
"eslint-config-godaddy": "^7.1.1", | ||
"eslint-plugin-jest": "^28.6.0", | ||
"eslint-plugin-json": "^3.1.0", | ||
"eslint-plugin-jsx-a11y": "^6.8.0", | ||
"eslint-plugin-react": "^7.33.2", | ||
"eslint-plugin-unicorn": "^44.0.0", | ||
"eslint-plugin-react": "^7.35.0", | ||
"eslint-plugin-unicorn": "^55.0.0", | ||
"jest": "^29.7.0", | ||
@@ -63,2 +59,4 @@ "jest-environment-jsdom": "^29.7.0", | ||
"react-dom": "^18.2.0", | ||
"ts-jest": "^29.2.5", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.4.5" | ||
@@ -80,3 +78,3 @@ }, | ||
}, | ||
"gitHead": "30055cdc6bb04a78c07c5ede230242db17327260" | ||
"gitHead": "0426b7f57bc2618606955912c0f3cd55174f5367" | ||
} |
@@ -8,8 +8,4 @@ # @gasket/plugin-jest | ||
This plugin should only be used during the create command for new apps. | ||
This plugin is only used by presets for `create-gasket-app` and is not installed for apps. | ||
``` | ||
gasket create <app-name> --plugins @gasket/plugin-jest | ||
``` | ||
## Usage | ||
@@ -16,0 +12,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
7468
107
0
20
31