Skip to content
This repository was archived by the owner on Jun 8, 2022. It is now read-only.

Commit e485209

Browse files
authored
update typescript, pass CI (#63)
1 parent 565c78c commit e485209

File tree

13 files changed

+285
-2835
lines changed

13 files changed

+285
-2835
lines changed

.circleci/config.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ workflows:
88
# there are no jobs to follow this one
99
# so no need to save the workspace files (saves time)
1010
no-workspace: true
11+
build: npm run lint
1112
post-steps:
12-
# run Jest tests
13-
- run: npm test
13+
- run:
14+
name: Jest tests
15+
command: npm test

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
44
If you are using Jest and Cypress types in the same project, they might conflict because both test runners use globals like `expect`. This project shows how to isolate Cypress TypeScript definitions from Jest TS definitions in the same project.
55

6-
See the root level [tsconfig.json](tsconfig.json) and [jest.config.js](jest.config.js). The Cypress types are isolated from the root in the file [cypress/tsconfig.json](cypress/tsconfig.json)
6+
See the root level [tsconfig.json](tsconfig.json) and [jest.config.js](jest.config.js). The Cypress types are isolated from the root in the file [cypress/tsconfig.json](cypress/tsconfig.json). The root tsconfig explicitly only includes `libs` with Jest globals (without Cypress)
77

88
## Additional information
99

1010
See the excellent advice on setting TypeScript for Jest and Cypress in [TypeScript Deep Dive](https://basarat.gitbooks.io/typescript/content/) e-book by [Basarat Syed](https://twitter.com/basarat)
1111

1212
- [Using Jest with TypeScript](https://basarat.gitbooks.io/typescript/docs/testing/jest.html)
1313
- [Cypress E2E with TypeScript](https://basarat.gitbooks.io/typescript/docs/testing/cypress.html)
14-
- Cypress TypeScript transpilation was setup using [add-typescript-to-cypress](https://github.com/bahmutov/add-typescript-to-cypress) module
14+
- Cypress TypeScript transpilation is using [built-in TS support](https://on.cypress.io/typescript)
1515

1616
## Questions or problems
1717

cypress.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
{}
1+
{
2+
"pluginsFile": false,
3+
"supportFile": false,
4+
"fixturesFolder": false
5+
}

cypress/fixtures/example.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

cypress/integration/spec.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
it('works', () => {
2-
cy.wrap('foo').should('equal', 'foo')
1+
// import function from the application source
2+
import { sum } from '../../src/foo'
3+
4+
describe('TypeScript spec', () => {
5+
it('works', () => {
6+
cy.wrap('foo').should('equal', 'foo')
7+
})
8+
9+
it('calls TS source file', () => {
10+
expect(sum(1, 2, 3, 4)).to.equal(10)
11+
})
312
})

cypress/plugins/cy-ts-preprocessor.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

cypress/plugins/index.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

cypress/support/commands.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

cypress/support/index.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

cypress/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": false
5+
},
36
"include": [
47
"../node_modules/cypress",
58
"./*/*.ts"

0 commit comments

Comments
 (0)