Skip to content

Commit 2b4f713

Browse files
committed
fix e2e cli calls to use the pkg build
1 parent 385c488 commit 2b4f713

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
"test:e2e": "npm run build -- --target host && mocha 'test/{,!(__fixtures__)/**}/*.e2e.js' --timeout 120000 --exit",
143143
"test:e2e:ci": "npm run test:e2e:no-device -- --forbid-only",
144144
"test:e2e:no-device": "npm run test:e2e -- --grep @device --invert",
145-
"test:e2e:wifi": "npm run test:e2e -- --grep @wifi",
145+
"test:e2e:wifi": "npm run test:e2e -- --grep @device,@wifi",
146146
"test:e2e:watch": "npm run test:e2e -- --watch --watch-extensions js,json",
147147
"test:e2e:inspect": "npm test:e2e -- --inspect-brk",
148148
"test:e2e:silent": "PARTICLE_NOOP=$(npm run test:e2e:ci)",

test/lib/cli.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,30 @@ const {
1111
PATH_TMP_DIR,
1212
PATH_PROJ_BLANK_INO,
1313
PATH_PROJ_STROBY_INO,
14-
PATH_FIXTURES_PKG_DIR
14+
PATH_FIXTURES_PKG_DIR, PATH_REPO_DIR
1515
} = require('./env');
16+
const os = require('os');
1617
const cliBinPath = path.join(PATH_FIXTURES_PKG_DIR, 'node_modules', '.bin', 'particle');
1718

19+
const builds = {
20+
'darwin-x64': 'particle-cli',
21+
'linux-x64': 'particle-cli',
22+
'win32-x64': 'particle-cli.exe',
23+
'darwin-arm64': 'particle-cli',
24+
};
1825

19-
module.exports.run = (args = [], options = {}) => {
26+
module.exports.run = async (args = [], options = {}) => {
2027
const opts = Object.assign({
2128
cwd: PATH_TMP_DIR,
2229
reject: false,
2330
all: true
2431
}, options);
2532

2633
args = Array.isArray(args) ? args : [args];
34+
const osKey = `${os.platform()}-${os.arch()}`;
35+
const cliName = builds[osKey];
36+
const appName = os.platform() === 'win32' ? 'particle.exe' : 'particle';
37+
await execa('cp', [path.join(PATH_REPO_DIR, 'build', cliName), path.join(PATH_FIXTURES_PKG_DIR, 'node_modules', '.bin', appName)]);
2738
return execa(cliBinPath, [...args], opts);
2839
};
2940

0 commit comments

Comments
 (0)