-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '10.0-release' into tbiethman/UNIFY-1221-spec-watcher
- Loading branch information
Showing
9 changed files
with
60 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
if (process.env.CYPRESS_INTERNAL_ENV !== 'production') { | ||
require('@packages/ts/register') | ||
require('@packages/ts/registerDir')(__dirname) | ||
} | ||
|
||
module.exports = require('./src') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
"rimraf": "3.0.2" | ||
}, | ||
"files": [ | ||
"register.js" | ||
"register.js", | ||
"registerDir.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,3 @@ | ||
// @ts-check | ||
const log = require('debug')('cypress:ts') | ||
const path = require('path') | ||
|
||
// in development we should have TypeScript hook installed | ||
// in production or staging we are likely to be running | ||
// built Electron app without ts-node hook. Assume the | ||
// build has been done correctly | ||
|
||
try { | ||
// Prevent double-compiling if we're testing the app and already have ts-node hook installed | ||
// TODO(tim): e2e testing does not like this, I guess b/c it's currently using the tsconfig | ||
// for the app project? | ||
if (!process.env.CYPRESS_INTERNAL_E2E_TESTING_SELF) { | ||
const tsNode = require('ts-node') | ||
// register TypeScript Node require hook | ||
// https://github.com/TypeStrong/ts-node#programmatic-usage | ||
const project = require('path').join(__dirname, 'tsconfig.json') | ||
|
||
process.env.TS_CACHED_TRANSPILE_CACHE = path.join(__dirname, 'node_modules', '.ts-cache') | ||
|
||
tsNode.register({ | ||
compiler: 'typescript-cached-transpile', | ||
project, | ||
transpileOnly: true, | ||
preferTsExts: true, // Helps when the files are compiled locally, resolves the TS file | ||
}) | ||
} | ||
|
||
// do we need to prevent any other TypeScript hooks? | ||
} catch (e) { | ||
// continue running without TypeScript require hook | ||
log('Running without ts-node hook in environment "%s"', process.env.CYPRESS_INTERNAL_ENV) | ||
} | ||
// This file can be used as a shortcut to invoke `registerDir` without a scope. | ||
// This is useful in Mocha tests with the `-r` option (`-r @packages/ts/register`) | ||
require('./registerDir')() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// @ts-check | ||
const debug = require('debug')('cypress:ts') | ||
const path = require('path') | ||
|
||
// in development we should have TypeScript hook installed | ||
// in production or staging we are likely to be running | ||
// built Electron app without ts-node hook. Assume the | ||
// build has been done correctly | ||
module.exports = function (scopeDir) { | ||
try { | ||
// Prevent double-compiling if we're testing the app and already have ts-node hook installed | ||
// TODO(tim): e2e testing does not like this, I guess b/c it's currently using the tsconfig | ||
// for the app project? | ||
if (!process.env.CYPRESS_INTERNAL_E2E_TESTING_SELF) { | ||
debug('registering ts-node on directory', scopeDir) | ||
const tsNode = require('ts-node') | ||
// register TypeScript Node require hook | ||
// https://github.com/TypeStrong/ts-node#programmatic-usage | ||
const project = require('path').join(__dirname, 'tsconfig.json') | ||
|
||
process.env.TS_CACHED_TRANSPILE_CACHE = path.join(__dirname, 'node_modules', '.ts-cache') | ||
|
||
tsNode.register({ | ||
compiler: 'typescript-cached-transpile', | ||
project, | ||
transpileOnly: true, | ||
preferTsExts: true, // Helps when the files are compiled locally, resolves the TS file | ||
scope: Boolean(scopeDir), | ||
scopeDir, | ||
}) | ||
} else { | ||
debug('skipping ts-node registration while testing the app') | ||
} | ||
|
||
// do we need to prevent any other TypeScript hooks? | ||
} catch (e) { | ||
// continue running without TypeScript require hook | ||
debug('Running without ts-node hook in environment "%s"', process.env.CYPRESS_INTERNAL_ENV) | ||
} | ||
} |