From 005dad3194ef648a60ce677d428b3b313ee1b38b Mon Sep 17 00:00:00 2001 From: Yannick Croissant Date: Wed, 1 May 2019 22:27:55 +0200 Subject: [PATCH] Revert "Replace mocha by jest" This reverts commit 6e4f43ef4739191a2157659de178d1cd9a28a42e. --- jest.config.js | 12 ------------ package.json | 7 ++++--- tests/index.js | 2 +- tests/util/.eslintrc | 2 +- tests/util/version.js | 8 ++++---- 5 files changed, 10 insertions(+), 21 deletions(-) delete mode 100644 jest.config.js diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index 453806d390..0000000000 --- a/jest.config.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -module.exports = { - clearMocks: true, - coverageDirectory: 'reports/coverage', - testEnvironment: 'node', - testMatch: [ - '**/tests/lib/**/*.[jt]s?(x)', - '**/tests/util/**/*.[jt]s?(x)', - '**/tests/index.[jt]s?(x)' - ] -}; diff --git a/package.json b/package.json index 1f205a96d7..e31d5e6de2 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,7 @@ "lint": "eslint ./", "pretest": "npm run lint", "test": "npm run unit-test", - "test:watch": "jest --watch", - "unit-test": "jest --coverage" + "unit-test": "istanbul cover --dir reports/coverage node_modules/mocha/bin/_mocha tests/lib/**/*.js tests/util/**/*.js tests/index.js" }, "files": [ "LICENSE", @@ -38,7 +37,9 @@ "babel-eslint": "^10.0.1", "coveralls": "^3.0.2", "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0", - "jest": "^24.7.1", + "istanbul": "^0.4.5", + "mocha": "^6.1.4", + "sinon": "^7.2.2", "typescript": "^3.2.2" }, "peerDependencies": { diff --git a/tests/index.js b/tests/index.js index 914ca65882..69c8051fae 100644 --- a/tests/index.js +++ b/tests/index.js @@ -1,4 +1,4 @@ -/* eslint-env jest */ +/* eslint-env mocha */ 'use strict'; const plugin = require('..'); diff --git a/tests/util/.eslintrc b/tests/util/.eslintrc index e6c347adc3..078e30c590 100644 --- a/tests/util/.eslintrc +++ b/tests/util/.eslintrc @@ -1,5 +1,5 @@ { "env": { - "jest": true + "mocha": true } } diff --git a/tests/util/version.js b/tests/util/version.js index cb56e9463b..cf0eaf034c 100644 --- a/tests/util/version.js +++ b/tests/util/version.js @@ -2,26 +2,26 @@ const path = require('path'); const assert = require('assert'); +const sinon = require('sinon'); const versionUtil = require('../../lib/util/version'); describe('Version', () => { const base = path.resolve(__dirname, '..', 'fixtures', 'version'); let cwd; let expectedErrorArgs = []; - let spy; beforeEach(() => { cwd = process.cwd(); process.chdir(base); - spy = jest.spyOn(console, 'error').mockImplementation(() => {}); + sinon.stub(console, 'error'); expectedErrorArgs = []; }); afterEach(() => { process.chdir(cwd); - const actualArgs = console.error.mock.calls; // eslint-disable-line no-console - spy.mockRestore(); + const actualArgs = console.error.args; // eslint-disable-line no-console + console.error.restore(); // eslint-disable-line no-console assert.deepEqual(actualArgs, expectedErrorArgs); });