Skip to content

Commit 05d6624

Browse files
committed
refactor: enable cypress testing
1 parent 5c71a2b commit 05d6624

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
/example/dist
33
/example/.cache
44
/lib
5+
/dist
6+
/.cache
57
node_modules
68
package-lock.json
79
pnpm-lock.yaml

cypress.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"baseUrl": "http://localhost:1234",
3+
"video": false
4+
}

cypress/integration/test.spec.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/// <reference types="cypress" />
2+
3+
context('Page load', () => {
4+
beforeEach(() => {
5+
cy.visit('/')
6+
})
7+
describe('React integration', () => {
8+
it('Should mount', () => {
9+
cy.get('#app')
10+
.should('exist', 'success')
11+
})
12+
})
13+
})

package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@
2929
"@types/mocha": "^5.2.7",
3030
"@types/node": "^10.5.2",
3131
"@types/react": "16.9.49",
32+
"cypress": "^5.2.0",
3233
"mocha": "^6.2.0",
34+
"npm-run-all": "^4.1.5",
35+
"parcel": "^1.12.3",
3336
"react": "16.13.1",
3437
"react-dom": "16.13.1",
3538
"react-test-renderer": "16.13.1",
39+
"start-server-and-test": "^1.11.3",
3640
"symbol-observable": "^1.2.0",
3741
"ts-node": "^7.0.0",
38-
"typescript": "3.6.3",
39-
"xstream": "11.11.0"
42+
"typescript": "3.6.3"
4043
},
4144
"publishConfig": {
4245
"access": "public"
@@ -46,6 +49,8 @@
4649
"compile": "npm run compile-cjs && npm run compile-es6",
4750
"compile-cjs": "tsc --module commonjs --outDir ./lib/cjs",
4851
"compile-es6": "echo 'TODO' : tsc --module es6 --outDir ./lib/es6",
49-
"test": "$(npm bin)/mocha test/*.ts --require ts-node/register --recursive"
52+
"test": "$(npm bin)/mocha test/*.ts --require ts-node/register --recursive; cypress run",
53+
"start": "parcel example/index.html",
54+
"serve-test": "start-server-and-test start http://localhost:1234 test"
5055
}
5156
}

0 commit comments

Comments
 (0)