Skip to content

Commit 5bd0651

Browse files
authored
Merge pull request #17 from codeceptjs/some-improvements
fix: some improvements
2 parents 7faf193 + 6a9e30d commit 5bd0651

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,7 @@ dist
104104

105105
# TernJS port file
106106
.tern-port
107+
108+
#IDE
109+
.vscode
110+
.idea

index.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ const semver = require('semver');
88
const spawn = require('cross-spawn');
99

1010
const enginePackages = {
11-
puppeteer: ['puppeteer@5'],
11+
puppeteer: ['puppeteer@21.1.1'],
1212
playwright: ['playwright@1'],
1313
testcafe: ['testcafe@1'],
14-
webdriverio: ['webdriverio@6'],
14+
webdriverio: ['webdriverio@8'],
1515
};
1616

1717
const codeceptPackages = [
@@ -128,7 +128,7 @@ async function createCodecept(opts) {
128128
} else {
129129
console.log(`Powered by ${chalk.yellow('Playwright')} engine`);
130130
deps.push(enginePackages.playwright);
131-
}
131+
}
132132

133133
if (!existsSync('package.json')) {
134134
console.log('package.json file does not exist in current dir, creating it...');
@@ -148,11 +148,11 @@ async function createCodecept(opts) {
148148
packageJson.scripts['codeceptjs'] = 'codeceptjs run --steps';
149149
packageJson.scripts['codeceptjs:headless'] = 'HEADLESS=true codeceptjs run --steps';
150150
packageJson.scripts['codeceptjs:ui'] = 'codecept-ui --app';
151-
151+
152152
packageJson.scripts['codeceptjs:demo'] = `codeceptjs run --steps -c ${demoConfigFile}`;
153153
packageJson.scripts['codeceptjs:demo:headless'] = `HEADLESS=true codeceptjs run --steps -c ${demoConfigFile}`;
154154
packageJson.scripts['codeceptjs:demo:ui'] = `codecept-ui --app -c ${demoConfigFile}`;
155-
155+
156156
fs.writeJsonSync('package.json', packageJson, { spaces: 4 });
157157

158158

@@ -191,15 +191,15 @@ async function install(dependencies, verbose) {
191191
command = 'yarnpkg';
192192
args = ['add','-D', '--exact'];
193193
[].push.apply(args, dependencies);
194-
194+
195195
// Explicitly set cwd() to work around issues like
196196
// https://github.com/facebook/create-react-app/issues/3326.
197197
// Unfortunately we can only do this for Yarn because npm support for
198198
// equivalent --prefix flag doesn't help with this issue.
199199
// This is why for npm, we run checkThatNpmCanReadCwd() early instead.
200200
args.push('--cwd');
201201
args.push(root);
202-
202+
203203
} else {
204204
command = 'npm';
205205
args = [
@@ -214,8 +214,9 @@ async function install(dependencies, verbose) {
214214
const child = spawn(command, args, { stdio: 'inherit' });
215215
child.on('close', code => {
216216
if (code !== 0) {
217+
// if using Playwright, run the command to install the browser drivers
217218
reject({
218-
command: `${command} ${args.join(' ')}`,
219+
command: `${args.join(' ').includes('playwright')} ? ${command} ${args.join(' ')}; npx playwright install : ${command} ${args.join(' ')}`,
219220
});
220221
return;
221222
}

package.json

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "create-codeceptjs",
3-
"version": "0.1.7",
3+
"version": "0.1.8",
44
"description": "Install CodeceptJS with all its dependencies in a single run",
55
"main": "index.js",
66
"bin": {
7-
"create-codeceptjs": "index.js"
8-
},
7+
"create-codeceptjs": "index.js"
8+
},
99
"scripts": {
1010
},
1111
"repository": {
@@ -25,18 +25,18 @@
2525
},
2626
"homepage": "https://github.com/codecept-js/create-codeceptjs#readme",
2727
"dependencies": {
28-
"cfonts": "^2.8.5",
29-
"chalk": "^4.1.0",
30-
"commander": "^5.1.0",
31-
"cross-spawn": "^7.0.3",
32-
"fs-extra": "^9.0.1",
33-
"semver": "^7.3.2"
28+
"cfonts": "2.8.5",
29+
"chalk": "4.1.0",
30+
"commander": "5.1.0",
31+
"cross-spawn": "7.0.3",
32+
"fs-extra": "9.0.1",
33+
"semver": "7.3.2"
3434
},
3535
"devDependencies": {
36-
"@codeceptjs/configure": "^0.5.2",
37-
"@codeceptjs/examples": "^1.2.1",
38-
"@codeceptjs/ui": "^0.3.8",
39-
"codeceptjs": "^3.0.1",
40-
"playwright": "^1.2.1"
36+
"@codeceptjs/configure": "0.10.0",
37+
"@codeceptjs/examples": "1.2.1",
38+
"@codeceptjs/ui": "0.7.0",
39+
"codeceptjs": "3.5.11",
40+
"playwright": "1.40.1"
4141
}
4242
}

0 commit comments

Comments
 (0)