Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit 07b7d12

Browse files
authored
Add ts-loader example (#85)
1 parent 7eefb7c commit 07b7d12

File tree

14 files changed

+121
-6
lines changed

14 files changed

+121
-6
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ node_modules/
22
.DS_Store
33
*.log*
44
_test-output
5-
cypress/videos
5+
**/cypress/videos
66
cypress/screenshots
77
examples/react-app/build/
88
dist

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ module.exports = (on) => {
4646

4747
- [React app](examples/react-app) shows how to point Cypress at Webpack configuration from `react-scripts` dependency
4848
- [use-babelrc](examples/use-babelrc) shows to to use your project's `.babelrc` with Webpack
49+
- [use-ts-loader](examples/use-ts-loader) shows how to transpile TypeScript specs following [Webpack TypeScript guide](https://webpack.js.org/guides/typescript/)
4950

5051
## Options
5152

circle.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,33 @@ workflows:
5757
no-workspace: true
5858
working_directory: examples/use-babelrc
5959

60+
- cypress/run:
61+
name: Test ts-loader
62+
requires:
63+
- Install
64+
executor: cypress/base-12-14-0
65+
# we still need to install local TypeScript and Cypress
66+
install-command: npm install
67+
# not really a build command, just TS check
68+
build: npm run types
69+
timeout: '1m'
70+
no-workspace: true
71+
working_directory: examples/use-ts-loader
72+
6073
# wait for all jobs to finish and possible run NPM release
6174
- cypress/run:
6275
name: NPM release
76+
# only run NPM release from specific branch(es)
77+
filters:
78+
branches:
79+
only:
80+
- master
6381
requires:
6482
- Install
6583
- Tests
6684
- Test React App
6785
- Test babelrc
86+
- Test ts-loader
6887
executor: cypress/base-12-14-0
6988
# nothing to install - cypress/install job does it
7089
# and nothing to pass to the next job
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"env": {
3+
"cypress/globals": true
4+
},
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:cypress/recommended"
8+
],
9+
"plugins": [
10+
"cypress"
11+
]
12+
}

examples/use-ts-loader/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

examples/use-ts-loader/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# use-ts-loader
2+
3+
> Transpiling TypeScript specs following [Webpack ts-loader guide](https://webpack.js.org/guides/typescript/)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"fixturesFolder": false,
3+
"supportFile": false
4+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
describe('Use ts-loader', () => {
2+
it('works', () => {
3+
const data = {
4+
person: {
5+
firstName: 'Joe',
6+
},
7+
}
8+
9+
expect(data.person.firstName).to.equal('Joe')
10+
11+
cy.wrap(data).should('have.property', 'person')
12+
.should('deep.equal', {
13+
firstName: 'Joe',
14+
})
15+
})
16+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const webpackPreprocessor = require('../../../..')
2+
3+
module.exports = (on) => {
4+
const webpack = require('../../webpack.config.js')
5+
6+
on('file:preprocessor', webpackPreprocessor({ webpack }))
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "use-babelrc",
3+
"version": "1.0.0",
4+
"description": "Transpiling specs using local .babelrc file",
5+
"private": true,
6+
"scripts": {
7+
"cy:open": "cypress open",
8+
"test": "cypress run",
9+
"types": "tsc --noEmit --lib es2015,dom --types cypress cypress/integration/*.ts"
10+
},
11+
"devDependencies": {
12+
"cypress": "4.5.0",
13+
"ts-loader": "7.0.4",
14+
"typescript": "3.9.2"
15+
},
16+
"license": "ISC",
17+
"author": "",
18+
"keywords": []
19+
}

0 commit comments

Comments
 (0)