Remove async-spec-helpers util methods
MODIFY
spec/async-spec-helpers.js
spec/async-spec-helpers.js
/** @babel */
-export function beforeEach (fn) {
- global.beforeEach(function () {
- const result = fn()
- if (result instanceof Promise) {
- waitsForPromise(() => result)
- }
- })
-}
-
-export function afterEach (fn) {
- global.afterEach(function () {
- const result = fn()
- if (result instanceof Promise) {
- waitsForPromise(() => result)
- }
- })
-}
-
-['it', 'fit', 'ffit', 'fffit'].forEach(function (name) {
- module.exports[name] = function (description, fn) {
- global[name](description, function () {
- const result = fn()
- if (result instanceof Promise) {
- waitsForPromise(() => result)
- }
- })
- }
-})
-
export async function conditionPromise (condition) {
const startTime = Date.now()
@@ -45,18 +16,8 @@ export async function conditionPromise (condition) {
}
}
-export function timeoutPromise (timeout) {
+function timeoutPromise (timeout) {
return new Promise(function (resolve) {
global.setTimeout(resolve, timeout)
})
}
-
-function waitsForPromise (fn) {
- const promise = fn()
- global.waitsFor('spec promise to resolve', function (done) {
- promise.then(done, function (error) {
- jasmine.getEnv().currentSpec.fail(error)
- done()
- })
- })
-}

MODIFY
spec/find-spec.js
spec/find-spec.js
-const {it, fit, ffit, beforeEach, afterEach} = require('./async-spec-helpers') // eslint-disable-line no-unused-vars
-
const BufferSearch = require('../lib/buffer-search')
const EmbeddedEditorItem = require('./item/embedded-editor-item')
const DeferredEditorItem = require('./item/deferred-editor-item');

MODIFY
spec/find-view-spec.js
spec/find-view-spec.js
/** @babel */
const path = require("path");
-const {beforeEach, it, fit, ffit, fffit} = require('./async-spec-helpers')
describe("FindView", () => {
let workspaceElement, editorView, editor, findView, activationPromise;

MODIFY
spec/project-find-view-spec.js
spec/project-find-view-spec.js
@@ -7,7 +7,7 @@ const dedent = require('dedent');
const {TextBuffer} = require('atom');
const ResultsPaneView = require('../lib/project/results-pane');
const etch = require('etch');
-const {beforeEach, it, fit, ffit, fffit, conditionPromise} = require('./async-spec-helpers')
+const {conditionPromise} = require('./async-spec-helpers');
for (const ripgrep of [false, true]) {
describe(`ProjectFindView (ripgrep=${ripgrep})`, () => {

MODIFY
spec/result-row-spec.js
spec/result-row-spec.js
@@ -7,7 +7,6 @@ const {
MatchRow,
ResultRowGroup
} = require("../lib/project/result-row");
-const {beforeEach, it, fit, ffit, fffit} = require('./async-spec-helpers')
describe("ResultRowGroup", () => {
const lines = (new Array(18)).fill().map((x, i) => `line-${i}`)

MODIFY
spec/results-model-spec.js
spec/results-model-spec.js
const path = require("path");
const ResultsModel = require("../lib/project/results-model");
const FindOptions = require("../lib/find-options");
-const {beforeEach, it, fit, ffit, fffit} = require('./async-spec-helpers')
describe("ResultsModel", () => {
let editor, resultsModel, reporterSpy;

MODIFY
spec/results-view-spec.js
spec/results-view-spec.js
@@ -9,7 +9,6 @@ const ResultsPaneView = require('../lib/project/results-pane');
const getIconServices = require('../lib/get-icon-services');
const DefaultFileIcons = require('../lib/default-file-icons');
const {Disposable} = require('atom')
-const {beforeEach, it, fit, ffit, fffit} = require('./async-spec-helpers')
global.beforeEach(function() {
this.addMatchers({

MODIFY
spec/select-next-spec.js
spec/select-next-spec.js
const path = require('path');
const SelectNext = require('../lib/select-next');
const dedent = require('dedent');
-const {beforeEach, it, fit, ffit, fffit} = require('./async-spec-helpers')
describe("SelectNext", () => {
let workspaceElement, editorElement, editor;

Remove async-spec-helpers util methods