forked from cypress-io/cypress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (34 loc) · 1.1 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// @ts-check
// compile TypeScript files on the fly using
// Node require hook project
if (process.env.CYPRESS_INTERNAL_ENV !== 'production') {
require('@packages/ts/register')
}
const launcher = require('./lib/launcher')
module.exports = launcher
if (!module.parent) {
const Bluebird = require('bluebird')
// quick way to check if TS is working
/* eslint-disable no-console */
console.log('Launcher project exports')
console.log(launcher)
console.log('⛔️ please use it as a module, not from CLI')
if (process.argv.length > 2) {
const filenames = process.argv.slice(2)
Bluebird.each(filenames, (filename) => {
launcher.detectByPath(filename)
.then((foundBrowser) => {
console.log(` 👍 Found "${filename}":`, foundBrowser)
})
.catch((err) => {
console.log(` 👎 Couldn't find "${filename}:"`, err.message)
})
})
} else {
launcher.detect().then((browsers) => {
console.log('detected %s', browsers.length === 1 ? 'browser' : 'browsers')
console.log(browsers)
}, console.error)
}
/* eslint-enable no-console */
}