diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 245a5eda..5eb7f444 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -8,7 +8,8 @@ jobs: strategy: matrix: - node: [10.x, 11.x, 12.x, 14.x, 15.x] + # Test with Node.js v12 (LTS), v14 (LTS), and v16 (latest) + node: [12.x, 14.x, 15.x, 16.x] steps: - uses: actions/checkout@v1 @@ -38,7 +39,7 @@ jobs: - uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '14.x' registry-url: 'https://registry.npmjs.org' - name: install dependencies diff --git a/jest.config.js b/jest.config.js index 61f21edc..2b034105 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,9 +1,10 @@ -const {jest: jestConfig} = require('./src/config') +const {jest} = require('./src/config') -module.exports = Object.assign(jestConfig, { +module.exports = { + ...jest, coverageThreshold: null, testPathIgnorePatterns: [ - ...jestConfig.testPathIgnorePatterns, + ...jest.testPathIgnorePatterns, './src/scripts/test.js', ], -}) +} diff --git a/jest.js b/jest.js index 3a1bd4e9..e820b482 100644 --- a/jest.js +++ b/jest.js @@ -1 +1,2 @@ +// eslint-ignore-next-line import/extensions module.exports = require('./dist/config/jest.config') diff --git a/package.json b/package.json index 708ec022..e56a78e4 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.0-semantically-released", "description": "CLI for common scripts for my projects", "engines": { - "node": ">=12", + "node": ">=12.13.0", "npm": ">=6", "yarn": ">=1" }, @@ -35,58 +35,59 @@ "author": "Chris O'Donnell (http://codfish.io/)", "license": "MIT", "dependencies": { - "@babel/cli": "^7.13.16", - "@babel/core": "^7.13.16", + "@babel/cli": "^7.14.3", + "@babel/core": "^7.14.3", "@babel/plugin-proposal-class-properties": "^7.13.0", - "@babel/plugin-transform-modules-commonjs": "^7.13.0", - "@babel/plugin-transform-runtime": "^7.13.15", - "@babel/preset-env": "^7.13.15", + "@babel/plugin-transform-modules-commonjs": "^7.14.0", + "@babel/plugin-transform-runtime": "^7.14.3", + "@babel/preset-env": "^7.14.4", "@babel/preset-react": "^7.13.13", "@babel/preset-typescript": "^7.13.0", - "@babel/runtime": "^7.13.17", - "@commitlint/cli": "^12.1.1", - "@commitlint/config-conventional": "^12.1.1", + "@babel/runtime": "^7.14.0", + "@commitlint/cli": "^12.1.4", + "@commitlint/config-conventional": "^12.1.4", "@rollup/plugin-babel": "^5.3.0", - "@rollup/plugin-commonjs": "^18.0.0", + "@rollup/plugin-commonjs": "^19.0.0", "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^11.2.1", + "@rollup/plugin-node-resolve": "^13.0.0", "@rollup/plugin-replace": "^2.4.2", - "@types/jest": "^26.0.22", + "@types/jest": "^26.0.23", "arrify": "^2.0.1", - "babel-jest": "^26.6.3", - "babel-plugin-macros": "^3.0.0", + "babel-jest": "^27.0.1", + "babel-plugin-macros": "^3.1.0", "babel-plugin-minify-dead-code-elimination": "^0.5.1", "babel-plugin-module-resolver": "^4.0.0", "babel-plugin-transform-inline-environment-variables": "^0.4.3", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", - "browserslist": "^4.16.5", + "browserslist": "^4.16.6", "builtin-modules": "^3.2.0", "chalk": "^4.1.1", - "concurrently": "^6.0.2", + "concurrently": "^6.2.0", "cosmiconfig": "^7.0.0", "cpy": "^8.1.2", "cross-env": "^7.0.3", "cross-spawn": "^7.0.3", "doctoc": "^2.0.0", - "eslint": "^7.25.0", + "eslint": "^7.27.0", "eslint-config-codfish": "^10.0.0", - "glob": "^7.1.5", + "glob": "^7.1.7", "husky": "^6.0.0", "is-ci": "^3.0.0", - "jest": "^26.6.1", + "jest": "^27.0.1", "jest-serializer-path": "^0.1.15", - "jest-watch-typeahead": "^0.6.3", - "lint-staged": "^10.5.4", + "jest-snapshot-serializer-raw": "^1.2.0", + "jest-watch-typeahead": "^0.6.4", + "lint-staged": "^11.0.0", "lodash.camelcase": "^4.3.0", "lodash.has": "^4.5.2", "lodash.omit": "^4.5.0", "mkdirp": "^1.0.4", - "prettier": "2.2.1", + "prettier": "^2.3.0", "react-app-polyfill": "^2.0.0", "read-pkg-up": "^7.0.1", "resolve": "^1.20.0", "rimraf": "^3.0.2", - "rollup": "^2.45.2", + "rollup": "^2.50.5", "rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-size-snapshot": "^0.12.0", @@ -100,7 +101,6 @@ "./src/config/eslintrc.js" ], "rules": { - "no-console": "off", "semi": "off", "@babel/semi": "off", "object-curly-spacing": "off", @@ -110,7 +110,10 @@ "no-prototype-builtins": "off", "no-useless-catch": "off", "import/no-dynamic-require": "off", + "import/no-import-module-exports": "off", "import/no-unassigned-import": "off", + "import/extensions": "off", + "no-console": "off", "no-nested-ternary": "off", "no-use-before-define": "off", "no-restricted-syntax": "off", diff --git a/src/__tests__/__snapshots__/utils.js.snap b/src/__tests__/__snapshots__/utils.js.snap index e5a9478d..4b27a32e 100644 --- a/src/__tests__/__snapshots__/utils.js.snap +++ b/src/__tests__/__snapshots__/utils.js.snap @@ -2,26 +2,26 @@ exports[`getConcurrentlyArgs gives good args to pass to concurrently 1`] = ` Array [ - "--kill-others-on-fail", - "--prefix", - "[{name}]", - "--names", - "build,lint,test,validate,a,b,c,d,e,f,g,h,i,j", - "--prefix-colors", - "bgBlue.bold.white,bgGreen.bold.white,bgMagenta.bold.white,bgCyan.bold.white,bgWhite.bold.white,bgRed.bold.white,bgBlack.bold.white,bgYellow.bold.white,bgBlue.bold.white,bgGreen.bold.white,bgMagenta.bold.white,bgCyan.bold.white,bgWhite.bold.white,bgRed.bold.white", - "\\"echo build\\"", - "\\"echo lint\\"", - "\\"echo test\\"", - "\\"echo validate\\"", - "\\"echo a\\"", - "\\"echo b\\"", - "\\"echo c\\"", - "\\"echo d\\"", - "\\"echo e\\"", - "\\"echo f\\"", - "\\"echo g\\"", - "\\"echo h\\"", - "\\"echo i\\"", - "\\"echo j\\"", + --kill-others-on-fail, + --prefix, + [{name}], + --names, + build,lint,test,validate,a,b,c,d,e,f,g,h,i,j, + --prefix-colors, + bgBlue.bold.white,bgGreen.bold.white,bgMagenta.bold.white,bgCyan.bold.white,bgWhite.bold.white,bgRed.bold.white,bgBlack.bold.white,bgYellow.bold.white,bgBlue.bold.white,bgGreen.bold.white,bgMagenta.bold.white,bgCyan.bold.white,bgWhite.bold.white,bgRed.bold.white, + "echo build", + "echo lint", + "echo test", + "echo validate", + "echo a", + "echo b", + "echo c", + "echo d", + "echo e", + "echo f", + "echo g", + "echo h", + "echo i", + "echo j", ] `; diff --git a/src/__tests__/index.js b/src/__tests__/index.js index 83150096..454525f9 100644 --- a/src/__tests__/index.js +++ b/src/__tests__/index.js @@ -1,11 +1,9 @@ import path from 'path' import slash from 'slash' import cases from 'jest-in-case' -import {unquoteSerializer} from '../scripts/__tests__/helpers/serializers' const projectRoot = path.join(__dirname, '../../') -expect.addSnapshotSerializer(unquoteSerializer) expect.addSnapshotSerializer({ print: val => slash(val.replace(projectRoot, '/')), test: val => typeof val === 'string' && val.includes(projectRoot), diff --git a/src/config/babel-transform.js b/src/config/babel-transform.js index cbda1e7a..740fbaaf 100644 --- a/src/config/babel-transform.js +++ b/src/config/babel-transform.js @@ -1,4 +1,4 @@ -const babelJest = require('babel-jest') +const babelJest = require('babel-jest').default module.exports = babelJest.createTransformer({ presets: [require.resolve('./babelrc')], diff --git a/src/config/babelrc.js b/src/config/babelrc.js index ba3f5f65..0412e377 100644 --- a/src/config/babelrc.js +++ b/src/config/babelrc.js @@ -54,8 +54,7 @@ function getNodeVersion({engines: {node: nodeVersion = '10.13'} = {}}) { * @see https://github.com/browserslist/browserslist/blob/master/node.js#L139 */ const browsersConfig = browserslist.loadConfig({path: appDirectory}) || [ - 'ie 10', - 'ios 7', + 'defaults', ] const envTargets = isTest diff --git a/src/config/jest.config.js b/src/config/jest.config.js index 8e979623..5a340f7a 100644 --- a/src/config/jest.config.js +++ b/src/config/jest.config.js @@ -46,6 +46,10 @@ const jestConfig = { require.resolve('jest-watch-typeahead/filename'), require.resolve('jest-watch-typeahead/testname'), ], + snapshotSerializers: [ + require.resolve('jest-serializer-path'), + require.resolve('jest-snapshot-serializer-raw/always'), + ], } const setupFilesAfterEnv = [ diff --git a/src/scripts/__tests__/format.js b/src/scripts/__tests__/format.js index 489d0fc6..bab68a53 100644 --- a/src/scripts/__tests__/format.js +++ b/src/scripts/__tests__/format.js @@ -1,7 +1,7 @@ import cases from 'jest-in-case' -import {unquoteSerializer, winPathSerializer} from './helpers/serializers' -expect.addSnapshotSerializer(unquoteSerializer) +import {winPathSerializer} from './helpers/serializers' + expect.addSnapshotSerializer(winPathSerializer) cases( diff --git a/src/scripts/__tests__/helpers/serializers.js b/src/scripts/__tests__/helpers/serializers.js index 3cded83a..8f507fc5 100644 --- a/src/scripts/__tests__/helpers/serializers.js +++ b/src/scripts/__tests__/helpers/serializers.js @@ -1,11 +1,5 @@ import slash from 'slash' -// this removes the quotes around strings... -export const unquoteSerializer = { - print: val => val, - test: val => typeof val === 'string', -} - // this converts windows style file paths to unix... export const winPathSerializer = { print: val => slash(val), diff --git a/src/scripts/__tests__/lint.js b/src/scripts/__tests__/lint.js index d3c0c3bf..adc7fc23 100644 --- a/src/scripts/__tests__/lint.js +++ b/src/scripts/__tests__/lint.js @@ -1,11 +1,7 @@ import cases from 'jest-in-case' -import { - unquoteSerializer, - winPathSerializer, - relativePathSerializer, -} from './helpers/serializers' -expect.addSnapshotSerializer(unquoteSerializer) +import {winPathSerializer, relativePathSerializer} from './helpers/serializers' + expect.addSnapshotSerializer(winPathSerializer) expect.addSnapshotSerializer(relativePathSerializer) diff --git a/src/scripts/__tests__/pre-commit.js b/src/scripts/__tests__/pre-commit.js index 12f653bc..76bf605e 100644 --- a/src/scripts/__tests__/pre-commit.js +++ b/src/scripts/__tests__/pre-commit.js @@ -1,7 +1,7 @@ import cases from 'jest-in-case' -import {unquoteSerializer, winPathSerializer} from './helpers/serializers' -expect.addSnapshotSerializer(unquoteSerializer) +import {winPathSerializer} from './helpers/serializers' + expect.addSnapshotSerializer(winPathSerializer) cases( diff --git a/src/scripts/__tests__/test.js b/src/scripts/__tests__/test.js index 8f763795..4a55ba78 100644 --- a/src/scripts/__tests__/test.js +++ b/src/scripts/__tests__/test.js @@ -1,13 +1,10 @@ import cases from 'jest-in-case' -import {unquoteSerializer} from './helpers/serializers' jest.mock('jest', () => ({run: jest.fn()})) jest.mock('../../config/jest.config', () => ({builtInConfig: true})) let mockIsCI = false jest.mock('is-ci', () => mockIsCI) -expect.addSnapshotSerializer(unquoteSerializer) - cases( 'test', ({ diff --git a/src/scripts/__tests__/validate.js b/src/scripts/__tests__/validate.js index be613644..96795920 100644 --- a/src/scripts/__tests__/validate.js +++ b/src/scripts/__tests__/validate.js @@ -1,7 +1,4 @@ import cases from 'jest-in-case' -import {unquoteSerializer} from './helpers/serializers' - -expect.addSnapshotSerializer(unquoteSerializer) function setupWithScripts(scripts = ['test', 'lint', 'build', 'typecheck']) { return function setup() {