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

Commit b211694

Browse files
authored
chore: Convert to Typescript (#83)
1 parent e69eb84 commit b211694

File tree

18 files changed

+486
-78
lines changed

18 files changed

+486
-78
lines changed

.eslintignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
!.*
2+
**/node_modules
13
test/_test-output
24
cypress/tests/e2e/compile-error.js
35
test/fixtures
@@ -8,4 +10,6 @@ examples/react-app/package.json
810
examples/react-app/cypress/integration/dynamic-import-spec.js
911
# contains nullish operator
1012
examples/use-babelrc/cypress/integration/spec.js
11-
*.ts
13+
dist
14+
tsconfig.json
15+
.vscode/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ _test-output
55
cypress/videos
66
cypress/screenshots
77
examples/react-app/build/
8+
dist

.mocharc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2-
"watch-ignore": ["./test/_test-output", "node_modules"],
2+
"watch-ignore": [
3+
"./test/_test-output",
4+
"node_modules"
5+
],
36
"exit": true
47
}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ By necessity, this preprocessor sets the entry point for webpack as the spec fil
122122
**Example**:
123123

124124
```javascript
125-
const webpack = require('@cypress/webpack-preprocessor')
125+
const webpackPreprocessor = require('@cypress/webpack-preprocessor')
126126

127127
module.exports = (on) => {
128128
const options = {
129129
webpackOptions: require('../../webpack.config'),
130130
additionalEntries: ['./app/some-module.js'],
131131
}
132132

133-
on('file:preprocessor', webpack(options))
133+
on('file:preprocessor', webpackPreprocessor(options))
134134
}
135135
```
136136

@@ -141,13 +141,13 @@ The default options are provided as `webpack.defaultOptions` so they can be more
141141
If, for example, you want to update the options for the `babel-loader` to add the [stage-3 preset](https://babeljs.io/docs/plugins/preset-stage-3/), you could do the following:
142142

143143
```javascript
144-
const webpack = require('@cypress/webpack-preprocessor')
144+
const webpackPreprocessor = require('@cypress/webpack-preprocessor')
145145

146146
module.exports = (on) => {
147147
const options = webpack.defaultOptions
148148
options.webpackOptions.module.rules[0].use[0].options.presets.push('babel-preset-stage-3')
149149

150-
on('file:preprocessor', webpack(options))
150+
on('file:preprocessor', webpackPreprocessor(options))
151151
}
152152
```
153153

circle.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ workflows:
1111
name: Install
1212
executor: cypress/base-12-14-0
1313
yarn: true
14+
build: npm run build
1415
post-steps:
1516
- run:
1617
name: Show info 📺

deferred.js

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

deferred.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import * as Promise from 'bluebird'
2+
3+
export function createDeferred<T> () {
4+
let resolve: (thenableOrResult?: T | PromiseLike<T> | undefined) => void
5+
let reject: any
6+
const promise = new Promise<T>(function (_resolve, _reject) {
7+
resolve = _resolve
8+
reject = _reject
9+
})
10+
11+
return {
12+
//@ts-ignore
13+
resolve,
14+
reject,
15+
promise,
16+
}
17+
}

examples/react-app/cypress/.eslintrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
"eslint:recommended",
77
"plugin:cypress/recommended"
88
],
9-
"plugins": ["cypress"]
9+
"plugins": [
10+
"cypress"
11+
]
1012
}

examples/react-app/cypress/plugins/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/// <reference types="cypress" />
2+
/// <reference types="../../../.." />
3+
// @ts-check
14
const findWebpack = require('find-webpack')
25
const webpackPreprocessor = require('../../../..')
36

examples/use-babelrc/.eslintrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
"eslint:recommended",
77
"plugin:cypress/recommended"
88
],
9-
"plugins": ["cypress"]
9+
"plugins": [
10+
"cypress"
11+
]
1012
}

0 commit comments

Comments
 (0)