Repository: probot/settings
Pull request #587 (2022-05-23 17:18:47)

Revert "ESM support (#569)"
## what

- This reverts commit 9fb82c442188bd3df5524ac8b83f3aad3775b91b.

## why

- Get probot in a working state again

## references

- Closes https://github.com/probot/settings/issues/585
- Hopefully closes https://github.com/probot/settings/issues/583
- Related PR https://github.com/probot/settings/pull/581

vercel[bot]: @nitrocode is attempting to deploy a commit to the **Probot** Team on [Vercel](https://vercel.com).

A member of the Team first needs to [authorize it](https://vercel.com/git/authorize?team=Probot&type=github&job=%7B%22headInfo%22%3A%7B%22sha%22%3A%221a56b9f59547ed04836b39fdb2eaaf1e890636f5%22%7D%2C%22id%22%3A%22QmUVQKPWumFTnmuXYu5MrXoLMHDboqzqMgwkNY2FW928ua%22%2C%22org%22%3A%22probot%22%2C%22prId%22%3A587%2C%22repo%22%3A%22settings%22%7D).


nitrocode: cc: @travi @mattwynne 

Patch:
diff --git a/index.js b/index.js
index 167b488..d8aaeea 100644
--- a/index.js
+++ b/index.js
@@ -1,10 +1,9 @@
-import mergeArrayByName from './lib/mergeArrayByName'
-import SettingsApp from './lib/settings'
+const mergeArrayByName = require('./lib/mergeArrayByName')
 
 /**
  * @param {import('probot').Probot} robot
  */
-export default (robot, _, Settings = SettingsApp) => {
+module.exports = (robot, _, Settings = require('./lib/settings')) => {
   async function syncSettings (context, repo = context.repo()) {
     const config = await context.config('settings.yml', {}, { arrayMerge: mergeArrayByName })
     return Settings.sync(context.octokit, repo, config)
diff --git a/lib/mergeArrayByName.js b/lib/mergeArrayByName.js
index f1ef9db..1caa695 100644
--- a/lib/mergeArrayByName.js
+++ b/lib/mergeArrayByName.js
@@ -1,6 +1,6 @@
 // https://github.com/KyleAMathews/deepmerge#arraymerge
 
-import merge from 'deepmerge'
+const merge = require('deepmerge')
 
 function findMatchingIndex (sourceItem, target) {
   if (Object.prototype.hasOwnProperty.call(sourceItem, 'name')) {
@@ -10,7 +10,7 @@ function findMatchingIndex (sourceItem, target) {
   }
 }
 
-export default function mergeByName (target, source, options) {
+function mergeByName (target, source, options) {
   const destination = target.slice()
 
   source.forEach(sourceItem => {
@@ -24,3 +24,5 @@ export default function mergeByName (target, source, options) {
 
   return destination
 }
+
+module.exports = mergeByName
diff --git a/lib/plugins/branches.js b/lib/plugins/branches.js
index a176455..2c48752 100644
--- a/lib/plugins/branches.js
+++ b/lib/plugins/branches.js
@@ -3,7 +3,7 @@ const previewHeaders = {
     'application/vnd.github.hellcat-preview+json,application/vnd.github.luke-cage-preview+json,application/vnd.github.zzzax-preview+json'
 }
 
-export default class Branches {
+module.exports = class Branches {
   constructor (github, repo, settings) {
     this.github = github
     this.repo = repo
diff --git a/lib/plugins/collaborators.js b/lib/plugins/collaborators.js
index 27d0fb4..71f67a6 100644
--- a/lib/plugins/collaborators.js
+++ b/lib/plugins/collaborators.js
@@ -1,6 +1,6 @@
-import Diffable from './diffable'
+const Diffable = require('./diffable')
 
-export default class Collaborators extends Diffable {
+module.exports = class Collaborators extends Diffable {
   constructor (...args) {
     super(...args)
 
diff --git a/lib/plugins/diffable.js b/lib/plugins/diffable.js
index a3101b0..e95af70 100644
--- a/lib/plugins/diffable.js
+++ b/lib/plugins/diffable.js
@@ -19,7 +19,7 @@
 //       remove(existing) {
 //       }
 //     }
-export default class Diffable {
+module.exports = class Diffable {
   constructor (github, repo, entries) {
     this.github = github
     this.repo = repo
diff --git a/lib/plugins/labels.js b/lib/plugins/labels.js
index 8969e8f..ded34f2 100644
--- a/lib/plugins/labels.js
+++ b/lib/plugins/labels.js
@@ -1,7 +1,7 @@
-import Diffable from './diffable'
+const Diffable = require('./diffable')
 const previewHeaders = { accept: 'application/vnd.github.symmetra-preview+json' }
 
-export default class Labels extends Diffable {
+module.exports = class Labels extends Diffable {
   constructor (...args) {
     super(...args)
 
diff --git a/lib/plugins/milestones.js b/lib/plugins/milestones.js
index 904b8a4..c6dff78 100644
--- a/lib/plugins/milestones.js
+++ b/lib/plugins/milestones.js
@@ -1,6 +1,6 @@
-import Diffable from './diffable'
+const Diffable = require('./diffable')
 
-export default class Milestones extends Diffable {
+module.exports = class Milestones extends Diffable {
   constructor (...args) {
     super(...args)
 
diff --git a/lib/plugins/repository.js b/lib/plugins/repository.js
index cfb3800..e4ed8ed 100644
--- a/lib/plugins/repository.js
+++ b/lib/plugins/repository.js
@@ -32,7 +32,7 @@ const enableVulnerabilityAlerts = ({ github, settings, enabled }) => {
   return github.repos[methodName](args)
 }
 
-export default class Repository {
+module.exports = class Repository {
   constructor (github, repo, settings) {
     this.github = github
     this.settings = Object.assign({ mediaType: { previews: ['baptiste'] } }, settings, repo)
diff --git a/lib/plugins/teams.js b/lib/plugins/teams.js
index bc34f61..176bae8 100644
--- a/lib/plugins/teams.js
+++ b/lib/plugins/teams.js
@@ -1,10 +1,10 @@
-import Diffable from './diffable'
+const Diffable = require('./diffable')
 
 // it is necessary to use this endpoint until GitHub Enterprise supports
 // the modern version under /orgs
 const teamRepoEndpoint = '/teams/:team_id/repos/:owner/:repo'
 
-export default class Teams extends Diffable {
+module.exports = class Teams extends Diffable {
   find () {
     return this.github.repos.listTeams(this.repo).then(res => res.data)
   }
diff --git a/lib/settings.js b/lib/settings.js
index 64801be..9a5051b 100644
--- a/lib/settings.js
+++ b/lib/settings.js
@@ -1,11 +1,4 @@
-import Repository from './plugins/repository'
-import Labels from './plugins/labels'
-import Collaborators from './plugins/collaborators'
-import Teams from './plugins/teams'
-import Milestones from './plugins/milestones'
-import Branches from './plugins/branches'
-
-export default class Settings {
+class Settings {
   static sync (github, repo, config) {
     return new Settings(github, repo, config).update()
   }
@@ -32,10 +25,12 @@ export default class Settings {
 Settings.FILE_NAME = '.github/settings.yml'
 
 Settings.PLUGINS = {
-  repository: Repository,
-  labels: Labels,
-  collaborators: Collaborators,
-  teams: Teams,
-  milestones: Milestones,
-  branches: Branches
+  repository: require('./plugins/repository'),
+  labels: require('./plugins/labels'),
+  collaborators: require('./plugins/collaborators'),
+  teams: require('./plugins/teams'),
+  milestones: require('./plugins/milestones'),
+  branches: require('./plugins/branches')
 }
+
+module.exports = Settings
diff --git a/package.json b/package.json
index 002bfd6..164b500 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,6 @@
   "version": "1.0.0",
   "description": "",
   "repository": "github:probot/settings",
-  "type": "module",
   "main": "index.js",
   "scripts": {
     "dev": "nodemon",
@@ -14,9 +13,9 @@
     "lint:lockfile": "lockfile-lint --path package-lock.json --type npm --validate-https --allowed-hosts npm",
     "lint:engines": "check-engine",
     "lint:peer": "npm ls >/dev/null",
-    "test:unit": "NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest 'test/unit/'",
+    "test:unit": "jest 'test/unit/'",
     "test:unit:watch": "npm run test:unit -- --watch",
-    "test:integration": "NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest --test-timeout=10000 'test/integration/'",
+    "test:integration": "jest --test-timeout=10000 'test/integration/'",
     "test:integration:debug": "LOG_LEVEL=debug DEBUG=nock.* run-s test:integration"
   },
   "author": "Brandon Keepers",


Test patch:
diff --git a/script/console.cjs b/script/console
similarity index 100%
rename from script/console.cjs
rename to script/console
diff --git a/test/integration/common.js b/test/integration/common.js
index 83e9917..303e2a4 100644
--- a/test/integration/common.js
+++ b/test/integration/common.js
@@ -1,8 +1,8 @@
-import { Probot } from 'probot'
-import nock from 'nock'
-import any from '@travi/any'
-import settingsBot from '../../index'
-import settings from '../../lib/settings'
+const { Probot } = require('probot')
+const nock = require('nock')
+const any = require('@travi/any')
+const settingsBot = require('../../index')
+const settings = require('../../lib/settings')
 
 nock.disableNetConnect()
 
@@ -65,7 +65,7 @@ function buildTriggerEvent () {
   return any.fromList([buildPushEvent(), buildRepositoryCreatedEvent(), buildRepositoryEditedEvent()])
 }
 
-export {
+module.exports = {
   loadInstance,
   initializeNock,
   teardownNock,
diff --git a/test/integration/plugins/collaborators.test.js b/test/integration/plugins/collaborators.test.js
index 01985fa..8b416d6 100644
--- a/test/integration/plugins/collaborators.test.js
+++ b/test/integration/plugins/collaborators.test.js
@@ -1,7 +1,8 @@
-import fs from 'fs'
-import { CREATED, NO_CONTENT, OK } from 'http-status-codes'
-import Settings from '../../../lib/settings'
-import { buildTriggerEvent, initializeNock, loadInstance, repository, teardownNock } from '../common'
+const path = require('path')
+const fs = require('fs')
+const { CREATED, NO_CONTENT, OK } = require('http-status-codes')
+const settings = require('../../../lib/settings')
+const { buildTriggerEvent, initializeNock, loadInstance, repository, teardownNock } = require('../common')
 
 describe('collaborators plugin', function () {
   let probot, githubScope
@@ -16,11 +17,11 @@ describe('collaborators plugin', function () {
   })
 
   it('syncs collaborators', async () => {
-    const pathToConfig = new URL('../../fixtures/collaborators-config.yml', import.meta.url)
+    const pathToConfig = path.resolve(__dirname, '..', '..', 'fixtures', 'collaborators-config.yml')
     const configFile = Buffer.from(fs.readFileSync(pathToConfig, 'utf8'))
     const config = configFile.toString()
     githubScope
-      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(Settings.FILE_NAME)}`)
+      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(settings.FILE_NAME)}`)
       .reply(OK, config)
     githubScope.get(`/repos/${repository.owner.name}/${repository.name}/collaborators?affiliation=direct`).reply(OK, [
       { login: 'travi', permissions: { admin: true } },
diff --git a/test/integration/plugins/milestones.test.js b/test/integration/plugins/milestones.test.js
index 876415a..fd760a2 100644
--- a/test/integration/plugins/milestones.test.js
+++ b/test/integration/plugins/milestones.test.js
@@ -1,7 +1,8 @@
-import fs from 'fs'
-import { CREATED, NO_CONTENT, OK } from 'http-status-codes'
-import Settings from '../../../lib/settings'
-import { buildTriggerEvent, initializeNock, loadInstance, repository, teardownNock } from '../common'
+const path = require('path')
+const fs = require('fs')
+const { CREATED, NO_CONTENT, OK } = require('http-status-codes')
+const settings = require('../../../lib/settings')
+const { buildTriggerEvent, initializeNock, loadInstance, repository, teardownNock } = require('../common')
 
 describe('milestones plugin', function () {
   let probot, githubScope
@@ -16,11 +17,11 @@ describe('milestones plugin', function () {
   })
 
   it('syncs milestones', async () => {
-    const pathToConfig = new URL('../../fixtures/milestones-config.yml', import.meta.url)
+    const pathToConfig = path.resolve(__dirname, '..', '..', 'fixtures', 'milestones-config.yml')
     const configFile = Buffer.from(fs.readFileSync(pathToConfig, 'utf8'))
     const config = configFile.toString()
     githubScope
-      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(Settings.FILE_NAME)}`)
+      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(settings.FILE_NAME)}`)
       .reply(OK, config)
     githubScope.patch(`/repos/${repository.owner.name}/${repository.name}`).reply(200)
     githubScope.get(`/repos/${repository.owner.name}/${repository.name}/milestones?per_page=100&state=all`).reply(OK, [
diff --git a/test/integration/plugins/repository.test.js b/test/integration/plugins/repository.test.js
index 3b6aa97..2d7a42b 100644
--- a/test/integration/plugins/repository.test.js
+++ b/test/integration/plugins/repository.test.js
@@ -1,10 +1,10 @@
-import path from 'path'
-import fs from 'fs'
-import Settings from '../../../lib/settings'
-import { buildTriggerEvent, initializeNock, loadInstance, repository, teardownNock } from '../common'
+const path = require('path')
+const fs = require('fs')
+const settings = require('../../../lib/settings')
+const { buildTriggerEvent, initializeNock, loadInstance, repository, teardownNock } = require('../common')
 
 const loadConfig = configFilename => {
-  const pathToConfig = new URL(path.join('../../fixtures/repository', configFilename), import.meta.url)
+  const pathToConfig = path.resolve(__dirname, '..', '..', 'fixtures', 'repository', configFilename)
   const configFile = Buffer.from(fs.readFileSync(pathToConfig, 'utf8'))
 
   return configFile.toString()
@@ -27,7 +27,7 @@ describe('repository plugin', function () {
     const repoSettings = Object.assign({}, config.repository)
 
     githubScope
-      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(Settings.FILE_NAME)}`)
+      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(settings.FILE_NAME)}`)
       .reply(200, config)
     githubScope
       .patch(`/repos/${repository.owner.name}/${repository.name}`, body => {
@@ -45,7 +45,7 @@ describe('repository plugin', function () {
     const repoSettings = Object.assign({}, config.repository)
 
     githubScope
-      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(Settings.FILE_NAME)}`)
+      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(settings.FILE_NAME)}`)
       .reply(200, config)
     githubScope
       .patch(`/repos/${repository.owner.name}/${repository.name}`, body => {
@@ -71,7 +71,7 @@ describe('repository plugin', function () {
     delete repoSettings.enable_vulnerability_alerts
 
     githubScope
-      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(Settings.FILE_NAME)}`)
+      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(settings.FILE_NAME)}`)
       .reply(200, config)
     githubScope
       .patch(`/repos/${repository.owner.name}/${repository.name}`, body => {
@@ -94,7 +94,7 @@ describe('repository plugin', function () {
     delete repoSettings.enable_automated_security_fixes
 
     githubScope
-      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(Settings.FILE_NAME)}`)
+      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(settings.FILE_NAME)}`)
       .reply(200, config)
     githubScope
       .patch(`/repos/${repository.owner.name}/${repository.name}`, body => {
diff --git a/test/integration/plugins/teams.test.js b/test/integration/plugins/teams.test.js
index 884759d..b5f9343 100644
--- a/test/integration/plugins/teams.test.js
+++ b/test/integration/plugins/teams.test.js
@@ -1,8 +1,9 @@
-import fs from 'fs'
-import { CREATED, NO_CONTENT, OK } from 'http-status-codes'
-import any from '@travi/any'
-import Settings from '../../../lib/settings'
-import { buildTriggerEvent, initializeNock, loadInstance, repository, teardownNock } from '../common'
+const path = require('path')
+const fs = require('fs')
+const { CREATED, NO_CONTENT, OK } = require('http-status-codes')
+const any = require('@travi/any')
+const settings = require('../../../lib/settings')
+const { buildTriggerEvent, initializeNock, loadInstance, repository, teardownNock } = require('../common')
 
 describe('teams plugin', function () {
   let probot, githubScope
@@ -17,7 +18,7 @@ describe('teams plugin', function () {
   })
 
   it('syncs teams', async () => {
-    const pathToConfig = new URL('../../fixtures/teams-config.yml', import.meta.url)
+    const pathToConfig = path.resolve(__dirname, '..', '..', 'fixtures', 'teams-config.yml')
     const configFile = Buffer.from(fs.readFileSync(pathToConfig, 'utf8'))
     const config = configFile.toString()
     const probotTeamId = any.integer()
@@ -25,7 +26,7 @@ describe('teams plugin', function () {
     const greenkeeperKeeperTeamId = any.integer()
     const formationTeamId = any.integer()
     githubScope
-      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(Settings.FILE_NAME)}`)
+      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(settings.FILE_NAME)}`)
       .reply(OK, config)
     githubScope.get(`/repos/${repository.owner.name}/${repository.name}/teams`).reply(OK, [
       { slug: 'greenkeeper-keeper', id: greenkeeperKeeperTeamId, permission: 'pull' },
diff --git a/test/integration/triggers/push.test.js b/test/integration/triggers/push.test.js
index 77bd22c..746fde7 100644
--- a/test/integration/triggers/push.test.js
+++ b/test/integration/triggers/push.test.js
@@ -1,5 +1,5 @@
-import Settings from '../../../lib/settings'
-import { initializeNock, loadInstance, repository, teardownNock } from '../common'
+const settings = require('../../../lib/settings')
+const { initializeNock, loadInstance, repository, teardownNock } = require('../common')
 
 describe('push trigger', function () {
   let probot, githubScope
@@ -19,7 +19,7 @@ describe('push trigger', function () {
       payload: {
         ref: 'refs/heads/wip',
         repository,
-        commits: [{ modified: [Settings.FILE_NAME], added: [] }]
+        commits: [{ modified: [settings.FILE_NAME], added: [] }]
       }
     })
   })
diff --git a/test/integration/triggers/repository-created.test.js b/test/integration/triggers/repository-created.test.js
index 1e0410d..8866d59 100644
--- a/test/integration/triggers/repository-created.test.js
+++ b/test/integration/triggers/repository-created.test.js
@@ -1,6 +1,6 @@
-import { NOT_FOUND } from 'http-status-codes'
-import Settings from '../../../lib/settings'
-import { buildRepositoryCreatedEvent, initializeNock, loadInstance, repository, teardownNock } from '../common'
+const { NOT_FOUND } = require('http-status-codes')
+const settings = require('../../../lib/settings')
+const { buildRepositoryCreatedEvent, initializeNock, loadInstance, repository, teardownNock } = require('../common')
 
 describe('repository.created trigger', function () {
   let probot, githubScope
@@ -16,13 +16,13 @@ describe('repository.created trigger', function () {
 
   it('does not apply configuration when the repository does not have a settings.yml', async () => {
     githubScope
-      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(Settings.FILE_NAME)}`)
+      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(settings.FILE_NAME)}`)
       .reply(NOT_FOUND, {
         message: 'Not Found',
         documentation_url: 'https://developer.github.com/v3/repos/contents/#get-contents'
       })
     githubScope
-      .get(`/repos/${repository.owner.name}/.github/contents/${encodeURIComponent(Settings.FILE_NAME)}`)
+      .get(`/repos/${repository.owner.name}/.github/contents/${encodeURIComponent(settings.FILE_NAME)}`)
       .reply(NOT_FOUND, {
         message: 'Not Found',
         documentation_url: 'https://developer.github.com/v3/repos/contents/#get-contents'
diff --git a/test/integration/triggers/repository-edited.test.js b/test/integration/triggers/repository-edited.test.js
index c4e653f..ea784ae 100644
--- a/test/integration/triggers/repository-edited.test.js
+++ b/test/integration/triggers/repository-edited.test.js
@@ -1,7 +1,7 @@
-import { NOT_FOUND } from 'http-status-codes'
-import any from '@travi/any'
-import Settings from '../../../lib/settings'
-import { buildRepositoryEditedEvent, initializeNock, loadInstance, repository, teardownNock } from '../common'
+const { NOT_FOUND } = require('http-status-codes')
+const any = require('@travi/any')
+const settings = require('../../../lib/settings')
+const { buildRepositoryEditedEvent, initializeNock, loadInstance, repository, teardownNock } = require('../common')
 
 describe('repository.edited trigger', function () {
   let probot, githubScope
@@ -26,13 +26,13 @@ describe('repository.edited trigger', function () {
 
   it('does not apply configuration when the repository does not have a settings.yml', async () => {
     githubScope
-      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(Settings.FILE_NAME)}`)
+      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${encodeURIComponent(settings.FILE_NAME)}`)
       .reply(NOT_FOUND, {
         message: 'Not Found',
         documentation_url: 'https://developer.github.com/v3/repos/contents/#get-contents'
       })
     githubScope
-      .get(`/repos/${repository.owner.name}/.github/contents/${encodeURIComponent(Settings.FILE_NAME)}`)
+      .get(`/repos/${repository.owner.name}/.github/contents/${encodeURIComponent(settings.FILE_NAME)}`)
       .reply(NOT_FOUND, {
         message: 'Not Found',
         documentation_url: 'https://developer.github.com/v3/repos/contents/#get-contents'
diff --git a/test/unit/index.test.js b/test/unit/index.test.js
index 2b3fb7a..ed18ce5 100644
--- a/test/unit/index.test.js
+++ b/test/unit/index.test.js
@@ -1,12 +1,6 @@
-import { Probot } from 'probot'
-import any from '@travi/any'
-import plugin from '../../index'
-import { readFileSync } from 'fs'
-import { jest } from '@jest/globals'
-
-const pushSettings = JSON.parse(readFileSync(new URL('../fixtures/events/push.settings.json', import.meta.url)))
-const pushReadme = JSON.parse(readFileSync(new URL('../fixtures/events/push.readme.json', import.meta.url)))
-const repositoryEdited = JSON.parse(readFileSync(new URL('../fixtures/events/repository.edited.json', import.meta.url)))
+const { Probot } = require('probot')
+const any = require('@travi/any')
+const plugin = require('../../index')
 
 describe('plugin', () => {
   let app, event, sync
@@ -32,7 +26,7 @@ describe('plugin', () => {
 
     event = {
       name: 'push',
-      payload: pushSettings
+      payload: JSON.parse(JSON.stringify(require('../fixtures/events/push.settings.json')))
     }
     sync = jest.fn()
 
@@ -59,7 +53,7 @@ describe('plugin', () => {
 
   describe('with other files modified', () => {
     beforeEach(() => {
-      event.payload = pushReadme
+      event.payload = require('../fixtures/events/push.readme.json')
     })
 
     it('does not sync settings', async () => {
@@ -72,7 +66,7 @@ describe('plugin', () => {
     beforeEach(() => {
       event = {
         name: 'repository.edited',
-        payload: repositoryEdited
+        payload: require('../fixtures/events/repository.edited.json')
       }
     })
 
diff --git a/test/unit/lib/mergeArrayByName.test.js b/test/unit/lib/mergeArrayByName.test.js
index 5f64f38..1949a5a 100644
--- a/test/unit/lib/mergeArrayByName.test.js
+++ b/test/unit/lib/mergeArrayByName.test.js
@@ -1,5 +1,5 @@
-import branchArrayMerge from '../../../lib/mergeArrayByName'
-import YAML from 'js-yaml'
+const branchArrayMerge = require('../../../lib/mergeArrayByName')
+const YAML = require('js-yaml')
 
 describe('mergeArrayByName', () => {
   it('works', () => {
diff --git a/test/unit/lib/plugins/branches.test.js b/test/unit/lib/plugins/branches.test.js
index 4cafd53..fa3b2c0 100644
--- a/test/unit/lib/plugins/branches.test.js
+++ b/test/unit/lib/plugins/branches.test.js
@@ -1,5 +1,4 @@
-import Branches from '../../../../lib/plugins/branches'
-import { jest } from '@jest/globals'
+const Branches = require('../../../../lib/plugins/branches')
 
 describe('Branches', () => {
   let github
diff --git a/test/unit/lib/plugins/collaborators.test.js b/test/unit/lib/plugins/collaborators.test.js
index 0866532..72e6e94 100644
--- a/test/unit/lib/plugins/collaborators.test.js
+++ b/test/unit/lib/plugins/collaborators.test.js
@@ -1,5 +1,4 @@
-import Collaborators from '../../../../lib/plugins/collaborators'
-import { jest } from '@jest/globals'
+const Collaborators = require('../../../../lib/plugins/collaborators')
 
 describe('Collaborators', () => {
   let github
diff --git a/test/unit/lib/plugins/labels.test.js b/test/unit/lib/plugins/labels.test.js
index bb08ca2..5ceeeaf 100644
--- a/test/unit/lib/plugins/labels.test.js
+++ b/test/unit/lib/plugins/labels.test.js
@@ -1,5 +1,4 @@
-import Labels from '../../../../lib/plugins/labels'
-import { jest } from '@jest/globals'
+const Labels = require('../../../../lib/plugins/labels')
 
 describe('Labels', () => {
   let github
diff --git a/test/unit/lib/plugins/milestones.test.js b/test/unit/lib/plugins/milestones.test.js
index cb1514b..faec3a5 100644
--- a/test/unit/lib/plugins/milestones.test.js
+++ b/test/unit/lib/plugins/milestones.test.js
@@ -1,5 +1,4 @@
-import Milestones from '../../../../lib/plugins/milestones'
-import { jest } from '@jest/globals'
+const Milestones = require('../../../../lib/plugins/milestones')
 
 describe('Milestones', () => {
   let github
diff --git a/test/unit/lib/plugins/repository.test.js b/test/unit/lib/plugins/repository.test.js
index 004c209..ac619b0 100644
--- a/test/unit/lib/plugins/repository.test.js
+++ b/test/unit/lib/plugins/repository.test.js
@@ -1,5 +1,4 @@
-import Repository from '../../../../lib/plugins/repository'
-import { jest } from '@jest/globals'
+const Repository = require('../../../../lib/plugins/repository')
 
 describe('Repository', () => {
   let github
diff --git a/test/unit/lib/plugins/teams.test.js b/test/unit/lib/plugins/teams.test.js
index 05615ec..4a90e08 100644
--- a/test/unit/lib/plugins/teams.test.js
+++ b/test/unit/lib/plugins/teams.test.js
@@ -1,7 +1,6 @@
-import { when } from 'jest-when'
-import any from '@travi/any'
-import Teams from '../../../../lib/plugins/teams'
-import { jest } from '@jest/globals'
+const { when } = require('jest-when')
+const any = require('@travi/any')
+const Teams = require('../../../../lib/plugins/teams')
 
 describe('Teams', () => {
   let github