Skip to content

Commit

Permalink
fix: Support path aliases in plugins file (#8557)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbreiding authored Sep 11, 2020
1 parent 125a810 commit f538c94
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/server/lib/util/ts-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const registerTsNode = (projectRoot, pluginsFile) => {
debug('typescript path: %s', tsPath)
debug('registering project TS with options %o', tsOptions)

require('tsconfig-paths/register')
tsnode.register(tsOptions)
} catch (err) {
debug(`typescript doesn't exist. ts-node setup failed.`)
Expand Down
1 change: 1 addition & 0 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
"supertest-session": "4.0.0",
"through2": "2.0.5",
"ts-loader": "7.0.4",
"tsconfig-paths": "3.9.0",
"webpack": "4.43.0",
"ws": "5.2.2",
"xvfb": "cypress-io/node-xvfb#22e3783c31d81ebe64d8c0df491ea00cdc74726a",
Expand Down
3 changes: 3 additions & 0 deletions packages/server/test/e2e/1_typescript_spec_support_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ describe('e2e typescript in spec and support file', function () {
})
})

// this covers spec/support files as well as the plugins file
// @see https://github.com/cypress-io/cypress/issues/7006
// @see https://github.com/cypress-io/cypress/issues/8555
it('respects tsconfig paths', function () {
return e2e.exec(this, {
project: Fixtures.projectPath('ts-proj-with-paths'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
{
"supportFile": false,
"pluginsFile": false
}
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { appName } from '@app/main'

if (appName !== 'Best App Ever') {
throw new Error('Path alias not working properly in plugins file!')
}

export default () => {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { appName } from '@app/main'

if (appName !== 'Best App Ever') {
throw new Error('Path alias not working properly in support file!')
}
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24475,7 +24475,7 @@ tsconfig-paths-webpack-plugin@^3.3.0:
enhanced-resolve "^4.0.0"
tsconfig-paths "^3.4.0"

tsconfig-paths@^3.4.0:
tsconfig-paths@3.9.0, tsconfig-paths@^3.4.0:
version "3.9.0"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b"
integrity sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==
Expand Down

3 comments on commit f538c94

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f538c94 Sep 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.2.0/linux-x64/circle-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.2.0/circle-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f538c94 Sep 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.2.0/win32-x64/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.2.0/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/5.2.0/win32-x64/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.2.0/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.2.0/win32-x64/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.2.0/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.2.0/win32-x64/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.zip npm install https://cdn.cypress.io/beta/npm/5.2.0/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f538c94 Sep 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.2.0/win32-ia32/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.2.0/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/5.2.0/win32-ia32/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.2.0/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.2.0/win32-ia32/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.2.0/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.2.0/win32-ia32/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.zip npm install https://cdn.cypress.io/beta/npm/5.2.0/appveyor-develop-f538c94245cb1dd41cac6f6c8e8388afe47644d2/cypress.tgz

Please sign in to comment.