Skip to content

Commit

Permalink
Merge pull request #1021 from bertdeblock/remove-use-of-rsvp
Browse files Browse the repository at this point in the history
Remove use of `rsvp`
  • Loading branch information
bertdeblock authored Dec 11, 2024
2 parents b4bc68f + 1da354a commit a16600a
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 54 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"nyc": "^17.1.0",
"prettier": "^3.3.3",
"release-it": "^17.10.0",
"rsvp": "^4.7.0",
"sinon": "^19.0.2",
"tmp-sync": "^1.1.0"
},
Expand Down
5 changes: 2 additions & 3 deletions test/commands/try-each-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const expect = require('chai').expect;
const RSVP = require('rsvp');
const TryEachCommand = require('../../lib/commands/try-each');

const origTryEachTask = TryEachCommand._TryEachTask;
Expand All @@ -16,7 +15,7 @@ describe('commands/try-each', () => {

beforeEach(() => {
TryEachCommand._getConfig = function () {
return RSVP.resolve(mockConfig || { scenarios: [] });
return Promise.resolve(mockConfig || { scenarios: [] });
};

TryEachCommand._TryEachTask = MockTryEachTask;
Expand All @@ -33,7 +32,7 @@ describe('commands/try-each', () => {
TryEachCommand._getConfig = function (options) {
configPath = options.configPath;

return RSVP.resolve({ scenarios: [{ name: 'foo' }] });
return Promise.resolve({ scenarios: [{ name: 'foo' }] });
};

TryEachCommand.run({ configPath: 'foo/bar/widget.js' }, ['foo']);
Expand Down
7 changes: 3 additions & 4 deletions test/commands/try-ember-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const expect = require('chai').expect;
const RSVP = require('rsvp');
const TryEmberCommand = require('../../lib/commands/try-ember');

const origTryEachTask = TryEmberCommand._TryEachTask;
Expand All @@ -16,7 +15,7 @@ describe('commands/try-ember', () => {

beforeEach(() => {
TryEmberCommand._getConfig = function () {
return RSVP.resolve(mockConfig || { scenarios: [] });
return Promise.resolve(mockConfig || { scenarios: [] });
};

TryEmberCommand._TryEachTask = MockTryEachTask;
Expand All @@ -33,7 +32,7 @@ describe('commands/try-ember', () => {
TryEmberCommand._getConfig = function (options) {
configPath = options.configPath;

return RSVP.resolve({ scenarios: [{ name: 'foo' }] });
return Promise.resolve({ scenarios: [{ name: 'foo' }] });
};

TryEmberCommand.run({ configPath: 'foo/bar/widget.js' }, ['foo']);
Expand All @@ -45,7 +44,7 @@ describe('commands/try-ember', () => {
TryEmberCommand._getConfig = function (options) {
versionCompatibility = options.versionCompatibility;

return RSVP.resolve({ scenarios: [{ name: 'foo' }] });
return Promise.resolve({ scenarios: [{ name: 'foo' }] });
};

TryEmberCommand.run({}, ['1.13.0']);
Expand Down
5 changes: 2 additions & 3 deletions test/commands/try-one-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const expect = require('chai').expect;
const RSVP = require('rsvp');
const TryOneCommand = require('../../lib/commands/try-one');

const origTryEachTask = TryOneCommand._TryEachTask;
Expand Down Expand Up @@ -41,7 +40,7 @@ describe('commands/try-one', () => {

beforeEach(() => {
TryOneCommand._getConfig = function () {
return RSVP.resolve(mockConfig || { scenarios: [] });
return Promise.resolve(mockConfig || { scenarios: [] });
};

TryOneCommand._TryEachTask = MockTryEachTask;
Expand Down Expand Up @@ -122,7 +121,7 @@ async function testCommandSetsTheseAsCommandArgs(command, expectedArgs) {
};

TryOneCommand._getConfig = async function () {
return RSVP.resolve({ scenarios: [{ name: 'default' }] });
return Promise.resolve({ scenarios: [{ name: 'default' }] });
};

return await TryOneCommand.run({}, ['default']);
Expand Down
16 changes: 7 additions & 9 deletions test/dependency-manager-adapters/npm-adapter-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

let expect = require('chai').expect;
let RSVP = require('rsvp');
let fs = require('fs-extra');
let path = require('path');
let tmp = require('tmp-sync');
Expand All @@ -11,7 +10,6 @@ let writeJSONFile = require('../helpers/write-json-file');
let assertFileContainsJSON = require('../helpers/assert-file-contains-json');
let generateMockRun = require('../helpers/generate-mock-run');

let remove = RSVP.denodeify(fs.remove);
let root = process.cwd();
let tmproot = path.join(root, 'tmp');
let tmpdir;
Expand All @@ -24,7 +22,7 @@ describe('npmAdapter', () => {

afterEach(() => {
process.chdir(root);
return remove(tmproot);
return fs.remove(tmproot);
});

describe('#setup', () => {
Expand Down Expand Up @@ -61,7 +59,7 @@ describe('npmAdapter', () => {
callback(command, args, opts) {
runCount++;
expect(opts).to.have.property('cwd', tmpdir);
return RSVP.resolve();
return Promise.resolve();
},
},
],
Expand All @@ -86,7 +84,7 @@ describe('npmAdapter', () => {
command: 'npm install --no-optional --no-package-lock',
callback() {
runCount++;
return RSVP.resolve();
return Promise.resolve();
},
},
],
Expand All @@ -112,7 +110,7 @@ describe('npmAdapter', () => {
command: 'npm install --flat',
callback() {
runCount++;
return RSVP.resolve();
return Promise.resolve();
},
},
],
Expand Down Expand Up @@ -162,7 +160,7 @@ describe('npmAdapter', () => {
callback(command, args, opts) {
runCount++;
expect(opts).to.have.property('cwd', tmpdir);
return RSVP.resolve();
return Promise.resolve();
},
},
],
Expand All @@ -188,7 +186,7 @@ describe('npmAdapter', () => {
command: 'yarn install --flat --no-lockfile --ignore-engines',
callback() {
runCount++;
return RSVP.resolve();
return Promise.resolve();
},
},
],
Expand All @@ -215,7 +213,7 @@ describe('npmAdapter', () => {
command: 'yarn install --flat',
callback() {
runCount++;
return RSVP.resolve();
return Promise.resolve();
},
},
],
Expand Down
12 changes: 5 additions & 7 deletions test/dependency-manager-adapters/workspace-adapter-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

let expect = require('chai').expect;
let RSVP = require('rsvp');
let fs = require('fs-extra');
let path = require('path');
let tmp = require('tmp-sync');
Expand All @@ -11,7 +10,6 @@ let writeJSONFile = require('../helpers/write-json-file');
let assertFileContainsJSON = require('../helpers/assert-file-contains-json');
let generateMockRun = require('../helpers/generate-mock-run');

let remove = RSVP.denodeify(fs.remove);
let root = process.cwd();
let tmproot = path.join(root, 'tmp');
let tmpdir;
Expand All @@ -25,7 +23,7 @@ describe('workspaceAdapter', () => {

afterEach(() => {
process.chdir(root);
return remove(tmproot);
return fs.remove(tmproot);
});

describe('#setup', () => {
Expand Down Expand Up @@ -141,7 +139,7 @@ describe('workspaceAdapter', () => {
callback(command, args, opts) {
runCount++;
expect(opts).to.have.property('cwd', tmpdir);
return RSVP.resolve();
return Promise.resolve();
},
},
],
Expand All @@ -167,7 +165,7 @@ describe('workspaceAdapter', () => {
command: 'yarn install --flat --no-lockfile --ignore-engines',
callback() {
runCount++;
return RSVP.resolve();
return Promise.resolve();
},
},
],
Expand All @@ -194,7 +192,7 @@ describe('workspaceAdapter', () => {
command: 'yarn install --flat',
callback() {
runCount++;
return RSVP.resolve();
return Promise.resolve();
},
},
],
Expand Down Expand Up @@ -438,7 +436,7 @@ describe('workspaceAdapter', () => {
callback(command, args, opts) {
runCount++;
expect(opts).to.have.property('cwd', tmpdir);
return RSVP.resolve();
return Promise.resolve();
},
},
],
Expand Down
4 changes: 1 addition & 3 deletions test/tasks/reset-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

const tmp = require('tmp-sync');
const path = require('path');
const RSVP = require('rsvp');
const fs = require('fs-extra');
const fixturePackageJson = require('../fixtures/package.json');
const writeJSONFile = require('../helpers/write-json-file');

const remove = RSVP.denodeify(fs.remove);
const root = process.cwd();
const tmproot = path.join(root, 'tmp');

Expand All @@ -20,7 +18,7 @@ describe('reset', () => {

afterEach(() => {
process.chdir(root);
return remove(tmproot);
return fs.remove(tmproot);
});

it('runs without blowing up', function () {
Expand Down
30 changes: 14 additions & 16 deletions test/tasks/try-each-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const expect = require('chai').expect;
const tmp = require('tmp-sync');
const path = require('path');
const RSVP = require('rsvp');
const fs = require('fs-extra');
const fixturePackage = require('../fixtures/package.json');
const writeJSONFile = require('../helpers/write-json-file');
Expand All @@ -13,7 +12,6 @@ const mockery = require('mockery');
const StubDependencyAdapter = require('../helpers/stub-dependency-manager-adapter');
const generateMockRun = require('../helpers/generate-mock-run');

const remove = RSVP.denodeify(fs.remove);
const root = process.cwd();
const tmproot = path.join(root, 'tmp');

Expand Down Expand Up @@ -66,15 +64,15 @@ describe('tryEach', () => {
mockery.deregisterAll();
mockery.disable();
process.chdir(root);
return remove(tmproot);
return fs.remove(tmproot);
});

describe('with npm scenarios', () => {
it("succeeds when scenario's tests succeed", function () {
this.timeout(300000);

let mockedRun = generateMockRun('ember test', () => {
return RSVP.resolve(0);
return Promise.resolve(0);
});

mockery.registerMock('./run', mockedRun);
Expand Down Expand Up @@ -126,9 +124,9 @@ describe('tryEach', () => {
let mockedRun = generateMockRun('ember test', () => {
runTestCount++;
if (runTestCount === 1) {
return RSVP.reject(1);
return Promise.reject(1);
} else {
return RSVP.resolve(0);
return Promise.resolve(0);
}
});

Expand Down Expand Up @@ -241,7 +239,7 @@ describe('tryEach', () => {
if (options.timeout && options.timeout.length === 20000 && options.timeout.isSuccess) {
passedInOptions = true;
}
return RSVP.resolve(0);
return Promise.resolve(0);
});

mockery.registerMock('./run', mockedRun);
Expand Down Expand Up @@ -295,7 +293,7 @@ describe('tryEach', () => {
};

let mockedRun = generateMockRun('ember test', () => {
return RSVP.reject(1);
return Promise.reject(1);
});
mockery.registerMock('./run', mockedRun);

Expand Down Expand Up @@ -345,7 +343,7 @@ describe('tryEach', () => {
};

let mockedRun = generateMockRun('ember test', () => {
return RSVP.reject(1);
return Promise.reject(1);
});
mockery.registerMock('./run', mockedRun);

Expand Down Expand Up @@ -396,7 +394,7 @@ describe('tryEach', () => {
};

let mockedRun = generateMockRun('ember test', () => {
return RSVP.resolve(0);
return Promise.resolve(0);
});
mockery.registerMock('./run', mockedRun);

Expand Down Expand Up @@ -450,7 +448,7 @@ describe('tryEach', () => {

let mockedRun = generateMockRun('ember test', () => {
ranDefaultCommand = true;
return RSVP.resolve(0);
return Promise.resolve(0);
});

mockery.registerMock('./run', mockedRun);
Expand Down Expand Up @@ -498,7 +496,7 @@ describe('tryEach', () => {
let ranPassedInCommand = false;
let mockedRun = generateMockRun('ember serve', () => {
ranPassedInCommand = true;
return RSVP.resolve(0);
return Promise.resolve(0);
});
mockery.registerMock('./run', mockedRun);

Expand Down Expand Up @@ -561,14 +559,14 @@ describe('tryEach', () => {
command: 'ember test --test-port=2345',
callback() {
ranDefaultCommandCount++;
return RSVP.resolve(0);
return Promise.resolve(0);
},
},
{
command: 'npm run-script different',
callback() {
ranScenarioCommandCount++;
return RSVP.resolve(0);
return Promise.resolve(0);
},
},
]);
Expand Down Expand Up @@ -673,7 +671,7 @@ describe('tryEach', () => {
let actualOptions = [];
let mockedRun = generateMockRun('true', (actualCommand, actualArgs, opts) => {
actualOptions.push(opts);
return RSVP.resolve(0);
return Promise.resolve(0);
});
mockery.registerMock('./run', mockedRun);

Expand Down Expand Up @@ -733,7 +731,7 @@ describe('tryEach', () => {
let mockRunCommand = function () {
let currentScenario = process.env.EMBER_TRY_CURRENT_SCENARIO;
scenarios.push(currentScenario);
return RSVP.resolve(true);
return Promise.resolve(true);
};

let TryEachTask = require('../../lib/tasks/try-each');
Expand Down
Loading

0 comments on commit a16600a

Please sign in to comment.