Skip to content

Commit b1616ae

Browse files
Merge pull request #773 from particle-iot/fix-failing-e2e-tests
Fix failing e2e tests
2 parents 615848f + 0b6afce commit b1616ae

File tree

9 files changed

+13
-15
lines changed

9 files changed

+13
-15
lines changed

.github/workflows/production.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ on:
44
tags:
55
- v*
66
jobs:
7+
call-tests:
8+
uses: ./.github/workflows/reusable-tests.yml
9+
secrets: inherit
710
call-build:
811
uses: ./.github/workflows/reusable-build.yml
912
secrets: inherit
13+
needs: call-tests
1014
call-publish-v2:
1115
uses: ./.github/workflows/reusable-publish-v2.yml
1216
secrets: inherit

src/cmd/cloud.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,6 @@ function formatAPIErrorMessage(error){
881881
// TODO (mirande): refactor cmd/api.js to do this check by default when appropriate
882882
function ensureAPIToken(){
883883
if (!settings.access_token){
884-
throw new Error(`You're not logged in. Please login using ${chalk.bold.cyan('particle cloud login')} before using this command`);
884+
throw new Error(`You're not logged in. Please login using ${chalk.bold.cyan('particle login')} before using this command`);
885885
}
886886
}

src/cmd/whoami.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('Whoami Commands', () => {
3535
throw new Error('expected promise to be rejected');
3636
})
3737
.catch(error => {
38-
expect(stripAnsi(error.message)).to.eql('You\'re not logged in. Please login using particle cloud login before using this command');
38+
expect(stripAnsi(error.message)).to.eql('You\'re not logged in. Please login using particle login before using this command');
3939
});
4040
});
4141

src/lib/api-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ module.exports = class ApiClient {
122122

123123
ensureToken(){
124124
if (!this._access_token){
125-
throw new VError(`You're not logged in. Please login using ${chalk.bold.cyan('particle cloud login')} before using this command`);
125+
throw new VError(`You're not logged in. Please login using ${chalk.bold.cyan('particle login')} before using this command`);
126126
}
127127
}
128128

test/e2e/compile.e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ describe('Compile Commands', () => {
523523
const args = ['compile', platform, '.'];
524524
const { stdout, stderr, exitCode } = await cli.run(args, { cwd });
525525

526-
expect(stdout).to.include('Compile failed: You\'re not logged in. Please login using particle cloud login before using this command');
526+
expect(stdout).to.include('Compile failed: You\'re not logged in. Please login using particle login before using this command');
527527
expect(stderr).to.equal('');
528528
expect(exitCode).to.equal(1);
529529
});

test/e2e/help.e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('Help & Unknown Command / Argument Handling', () => {
6666
'product device', 'product', 'project create', 'project', 'publish',
6767
'serial list', 'serial monitor', 'serial identify', 'serial wifi',
6868
'serial mac', 'serial inspect', 'serial flash',
69-
'serial', 'subscribe', 'token list', 'token revoke',
69+
'serial', 'subscribe', 'token revoke',
7070
'token create', 'token', 'udp send', 'udp listen', 'udp', 'update',
7171
'update-cli', 'usb list', 'usb start-listening', 'usb listen',
7272
'usb stop-listening', 'usb safe-mode', 'usb dfu', 'usb reset',

test/e2e/logout.e2e.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const { expect } = require('../setup');
2-
const { delay } = require('../lib/mocha-utils');
32
const cli = require('../lib/cli');
43
const { USERNAME } = require('../lib/env');
54

@@ -40,13 +39,7 @@ describe('Logout Commands', () => {
4039
});
4140

4241
it('Signs out', async () => {
43-
const subprocess = cli.run(['logout']);
44-
45-
await delay(1000);
46-
subprocess.stdin.write('y');
47-
subprocess.stdin.end('\n');
48-
49-
const { stdout, stderr, exitCode } = await subprocess;
42+
const { stdout, stderr, exitCode } = await cli.run(['logout']);
5043

5144
expect(stdout).to.include(`You have been logged out from ${USERNAME}`);
5245
expect(stderr).to.equal('');

test/e2e/whoami.e2e.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const cli = require('../lib/cli');
33
const {
44
USERNAME
55
} = require('../lib/env');
6+
const stripAnsi = require('strip-ansi');
67

78

89
describe('Whoami Commands', () => {
@@ -52,7 +53,7 @@ describe('Whoami Commands', () => {
5253
await cli.logout();
5354
const { stdout, stderr, exitCode } = await cli.run('whoami');
5455

55-
expect(stdout).to.equal('You are not signed in! Please run: `particle login`');
56+
expect(stripAnsi(stdout)).to.equal('You\'re not logged in. Please login using particle login before using this command');
5657
expect(stderr).to.equal('');
5758
expect(exitCode).to.equal(1);
5859
});

test/lib/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module.exports.loginToForeignAcct = () => {
5959

6060
module.exports.logout = () => {
6161
const { run } = module.exports;
62-
return run(['logout'], { input: 'y\n', reject: true });
62+
return run(['logout'], { reject: true });
6363
};
6464

6565
module.exports.setProfile = (name) => {

0 commit comments

Comments
 (0)